Commit f9c55f16 authored by iman Fauzi's avatar iman Fauzi

reconfig height fragment

parent c017664a
...@@ -35,7 +35,7 @@ public class LoginActivity extends AppCompatActivity { ...@@ -35,7 +35,7 @@ public class LoginActivity extends AppCompatActivity {
ProgressBar progressBar; ProgressBar progressBar;
SharedPreferences sharedPreferences; SharedPreferences sharedPreferences;
MaterialButton btnSignup; MaterialButton btnSignin;
ConstraintLayout loginSheetLayout; ConstraintLayout loginSheetLayout;
BottomSheetBehavior sheetBehavior; BottomSheetBehavior sheetBehavior;
int height, width; int height, width;
...@@ -53,7 +53,7 @@ public class LoginActivity extends AppCompatActivity { ...@@ -53,7 +53,7 @@ public class LoginActivity extends AppCompatActivity {
} }
// bindUI // bindUI
btnSignup = findViewById(R.id.signInButtonDashboardLogin); btnSignin = findViewById(R.id.signInButtonDashboardLogin);
loginSheetLayout = findViewById(R.id.ConstraintLoginLayout); loginSheetLayout = findViewById(R.id.ConstraintLoginLayout);
// get window height // get window height
...@@ -62,16 +62,19 @@ public class LoginActivity extends AppCompatActivity { ...@@ -62,16 +62,19 @@ public class LoginActivity extends AppCompatActivity {
height = displayMetrics.heightPixels; height = displayMetrics.heightPixels;
width = displayMetrics.widthPixels; width = displayMetrics.widthPixels;
int maxHeight = height - ((height * 10) / 100);
loginSheetLayout.setMaxHeight(maxHeight);
// get bottom sheets // get bottom sheets
sheetBehavior = BottomSheetBehavior.from(loginSheetLayout); sheetBehavior = BottomSheetBehavior.from(loginSheetLayout);
sheetBehavior.setDraggable(false);
// button on click // button on click
btnSignup.setOnClickListener(new View.OnClickListener() { btnSignin.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View view) { public void onClick(View view) {
if (sheetBehavior.getState() != BottomSheetBehavior.STATE_EXPANDED) { if (sheetBehavior.getState() != BottomSheetBehavior.STATE_EXPANDED) {
sheetBehavior.setState(BottomSheetBehavior.STATE_EXPANDED); sheetBehavior.setState(BottomSheetBehavior.STATE_EXPANDED);
loginSheetLayout.setMaxHeight(height - 100);
}else { }else {
sheetBehavior.setState(BottomSheetBehavior.STATE_COLLAPSED); sheetBehavior.setState(BottomSheetBehavior.STATE_COLLAPSED);
} }
......
...@@ -6,7 +6,8 @@ ...@@ -6,7 +6,8 @@
android:layout_height="match_parent" android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical" android:orientation="vertical"
app:behavior_hideable="true" android:layout_gravity="bottom"
app:behavior_hideable="false"
android:padding="20dp" android:padding="20dp"
style="@style/Widget.Rounded.BottomSheet" style="@style/Widget.Rounded.BottomSheet"
app:behavior_peekHeight="0dp" app:behavior_peekHeight="0dp"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment