Commit f9c55f16 authored by iman Fauzi's avatar iman Fauzi

reconfig height fragment

parent c017664a
......@@ -35,7 +35,7 @@ public class LoginActivity extends AppCompatActivity {
ProgressBar progressBar;
SharedPreferences sharedPreferences;
MaterialButton btnSignup;
MaterialButton btnSignin;
ConstraintLayout loginSheetLayout;
BottomSheetBehavior sheetBehavior;
int height, width;
......@@ -53,7 +53,7 @@ public class LoginActivity extends AppCompatActivity {
}
// bindUI
btnSignup = findViewById(R.id.signInButtonDashboardLogin);
btnSignin = findViewById(R.id.signInButtonDashboardLogin);
loginSheetLayout = findViewById(R.id.ConstraintLoginLayout);
// get window height
......@@ -62,16 +62,19 @@ public class LoginActivity extends AppCompatActivity {
height = displayMetrics.heightPixels;
width = displayMetrics.widthPixels;
int maxHeight = height - ((height * 10) / 100);
loginSheetLayout.setMaxHeight(maxHeight);
// get bottom sheets
sheetBehavior = BottomSheetBehavior.from(loginSheetLayout);
sheetBehavior.setDraggable(false);
// button on click
btnSignup.setOnClickListener(new View.OnClickListener() {
btnSignin.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (sheetBehavior.getState() != BottomSheetBehavior.STATE_EXPANDED) {
sheetBehavior.setState(BottomSheetBehavior.STATE_EXPANDED);
loginSheetLayout.setMaxHeight(height - 100);
}else {
sheetBehavior.setState(BottomSheetBehavior.STATE_COLLAPSED);
}
......
......@@ -6,7 +6,8 @@
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
app:behavior_hideable="true"
android:layout_gravity="bottom"
app:behavior_hideable="false"
android:padding="20dp"
style="@style/Widget.Rounded.BottomSheet"
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