Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed the landscape bottomSheet hidden by default bug. #257

Merged
merged 2 commits into from
Aug 14, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ android:
- platform-tools
- build-tools-25.0.2
- android-25
- android-19
- extra-android-support
- extra-android-m2repository
- extra-google-m2repository
Expand Down
18 changes: 17 additions & 1 deletion src/main/java/org/amahi/anywhere/fragment/UploadBottomSheet.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,15 @@

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.design.widget.BottomSheetBehavior;
import android.support.design.widget.BottomSheetDialog;
import android.support.design.widget.BottomSheetDialogFragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewTreeObserver;
import android.widget.AdapterView;
import android.widget.FrameLayout;
import android.widget.ListView;

import org.amahi.anywhere.R;
Expand All @@ -46,7 +50,19 @@ public class UploadBottomSheet extends BottomSheetDialogFragment implements Adap
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container,
@Nullable Bundle savedInstanceState) {
return inflater.inflate(R.layout.upload_bottom_sheet, container);
View rootView = inflater.inflate(R.layout.upload_bottom_sheet, container);
rootView.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
@Override
public void onGlobalLayout() {
BottomSheetDialog bottomSheetDialog = (BottomSheetDialog)getDialog();
FrameLayout bottomSheet = (FrameLayout)bottomSheetDialog.findViewById(android.support.design.R.id.design_bottom_sheet);
assert bottomSheet != null;
BottomSheetBehavior behavior = BottomSheetBehavior.from(bottomSheet);
behavior.setState(BottomSheetBehavior.STATE_EXPANDED);
behavior.setPeekHeight(0);
}
});
return rootView;
}

@Override
Expand Down