Commit 3c5e6bc5 authored by fauzi's avatar fauzi

menambahkan scroll view ke login dan register form

parent c62d96a2
......@@ -61,7 +61,6 @@ public class LoginState extends BottomSheetDialogFragment {
this.mainViewModels = mainViewModels;
}
@NonNull
@Override
public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) {
......@@ -114,7 +113,6 @@ public class LoginState extends BottomSheetDialogFragment {
// close btn is clicked
closeBtn.setOnClickListener(view12 -> {
Log.d(TAG, "onCreateDialog: "+sheetBehavior.getState());
sheetDialog.dismiss();
});
......@@ -134,14 +132,8 @@ public class LoginState extends BottomSheetDialogFragment {
}else{
/**
* Jika tombol sign in ditekan
*/
// aktifkan progress bar
bar.setVisibility(View.VISIBLE);
// hilangkan tulisan di button
loginButton.setText("");
// nonaktifkan semua form
*
* nonaktifkan semua form */
username.setEnabled(false);
password.setEnabled(false);
loginButton.setEnabled(false);
......@@ -150,10 +142,7 @@ public class LoginState extends BottomSheetDialogFragment {
// buat checking login
mainViewModels.checkLogin(new UsersModels(username.getText().toString(),
password.getText().toString()))
.observe((LifecycleOwner) context, new Observer<DataResponse<UsersModels>>() {
@SuppressLint("ResourceType")
@Override
public void onChanged(DataResponse<UsersModels> usersModelsDataResponse) {
.observe((LifecycleOwner) context, usersModelsDataResponse -> {
if (usersModelsDataResponse != null) {
......@@ -166,18 +155,18 @@ public class LoginState extends BottomSheetDialogFragment {
if(editor.commit()){
startActivity(new Intent(context, MainActivity.class));
}
// redirect ke home
// redirect ke home
// set progress bar jadi nonaktif
// set progress bar jadi nonaktif
bar.setVisibility(View.GONE);
// munculkan tulisan default di button sign in
// munculkan tulisan default di button sign in
loginButton.setText(DEFAULT_LOGIN_NAME);
// ubah sheet dialog jadi tidak bisa di slide atau cancel
// ubah sheet dialog jadi tidak bisa di slide atau cancel
sheetDialog.setCancelable(true);
// set form jadi enable
// set form jadi enable
username.setEnabled(true);
password.setEnabled(true);
loginButton.setEnabled(true);
......@@ -198,7 +187,7 @@ public class LoginState extends BottomSheetDialogFragment {
R.layout.alert_dialog,
null);
// tampilkan alert dialog
// tampilkan alert dialog
utils = new Utils(customLayout);
utils.dialog(context, false, customLayout, "Wrong Username or Password",
"The username or password is incorrect. Please try again!",
......@@ -216,7 +205,6 @@ public class LoginState extends BottomSheetDialogFragment {
utils.snackBar(v, "Oppss! ログイン中にエラーが発生しました。しばらくしてからもう一度お試しください").show();
}
}
});
}
loginButton.setText(DEFAULT_LOGIN_NAME);
......
<vector android:height="24dp" android:tint="#B6B6B6"
android:viewportHeight="24" android:viewportWidth="24"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="@android:color/white" android:pathData="M12,4.5C7,4.5 2.73,7.61 1,12c1.73,4.39 6,7.5 11,7.5s9.27,-3.11 11,-7.5c-1.73,-4.39 -6,-7.5 -11,-7.5zM12,17c-2.76,0 -5,-2.24 -5,-5s2.24,-5 5,-5 5,2.24 5,5 -2.24,5 -5,5zM12,9c-1.66,0 -3,1.34 -3,3s1.34,3 3,3 3,-1.34 3,-3 -1.34,-3 -3,-3z"/>
</vector>
......@@ -26,14 +26,24 @@
android:scaleType="centerInside"
android:src="@drawable/ic_close" />
<ScrollView
android:layout_below="@id/closeBtnLogin"
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="@+id/messerLogoInLogin"
android:layout_width="150dp"
android:layout_height="150dp"
android:layout_below="@id/closeBtnLogin"
android:layout_width="wrap_content"
android:layout_height="213dp"
android:layout_centerHorizontal="true"
android:layout_marginTop="20dp"
android:src="@drawable/ic_messer_primary" />
android:layout_marginBottom="40dp"
android:src="@drawable/login_image" />
<com.google.android.material.textview.MaterialTextView
android:id="@+id/tvLogin"
......@@ -59,6 +69,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:imeOptions="actionNext"
android:textColor="@color/colorPrimary"
android:inputType="text" />
</com.google.android.material.textfield.TextInputLayout>
......@@ -77,25 +88,18 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:imeOptions="actionDone|actionGo"
android:textColor="@color/colorPrimary"
android:inputType="textPassword" />
</com.google.android.material.textfield.TextInputLayout>
<CheckBox
android:id="@+id/CBRememberMe"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/FormPasswordLogin"
android:layout_marginVertical="10dp"
android:text="Remember Me"
android:textColor="@color/colorPrimary"
app:useMaterialThemeColors="true" />
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/constraintBtn"
android:layout_below="@id/CBRememberMe"
android:layout_below="@id/FormPasswordLogin"
android:layout_width="match_parent"
android:layout_height="wrap_content">
android:layout_height="wrap_content"
android:layout_marginTop="20dp">
<com.google.android.material.button.MaterialButton
android:id="@+id/SignInButtonInLogin"
......@@ -133,6 +137,8 @@
android:textColor="@color/colorPrimary"/>
</RelativeLayout>
</ScrollView>
</RelativeLayout>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
......
......@@ -25,12 +25,22 @@
/>
<ScrollView
android:layout_below="@id/ivclose"
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="@+id/ivMeserRegister"
android:layout_width="150dp"
android:layout_height="150dp"
android:src="@drawable/ic_messer_primary"
android:layout_below="@+id/ivclose"
android:layout_width="match_parent"
android:layout_height="213dp"
android:src="@drawable/register_image"
android:layout_marginTop="20dp"
android:layout_marginBottom="40dp"
android:layout_centerHorizontal="true" />
<com.google.android.material.textview.MaterialTextView
......@@ -45,8 +55,6 @@
android:paddingLeft="12dp"
/>
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/formUsernameReg"
android:layout_width="match_parent"
......@@ -141,6 +149,11 @@
android:text="Create Account"
android:layout_below="@id/cbAgree"
android:padding="20dp"/>
</RelativeLayout>
</ScrollView>
</RelativeLayout>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
......
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