Skip to content

Commit

Permalink
Fixed the landscape bottomSheet hidden by default bug. (#257)
Browse files Browse the repository at this point in the history
* Fixed the landscape bottomSheet hidden by default bug.

* Adds android-19 to the travis.yml.
  • Loading branch information
octacode authored and cpg committed Aug 14, 2017
1 parent e51eebf commit 9bd358f
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
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

0 comments on commit 9bd358f

Please sign in to comment.