Commit c017664a authored by iman Fauzi's avatar iman Fauzi

remake login

parent 22966800
......@@ -6,16 +6,20 @@ import android.content.SharedPreferences;
import android.os.Build;
import android.os.Bundle;
import android.text.TextUtils;
import android.util.DisplayMetrics;
import android.util.Log;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.ProgressBar;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.lifecycle.Observer;
import androidx.lifecycle.ViewModelProviders;
import com.google.android.material.bottomsheet.BottomSheetBehavior;
import com.google.android.material.button.MaterialButton;
import com.google.android.material.snackbar.Snackbar;
import com.google.android.material.textfield.TextInputEditText;
......@@ -31,6 +35,13 @@ public class LoginActivity extends AppCompatActivity {
ProgressBar progressBar;
SharedPreferences sharedPreferences;
MaterialButton btnSignup;
ConstraintLayout loginSheetLayout;
BottomSheetBehavior sheetBehavior;
int height, width;
private String TAG = "MainActivity";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
......@@ -40,6 +51,62 @@ public class LoginActivity extends AppCompatActivity {
Window w = getWindow();
w.setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
}
// bindUI
btnSignup = findViewById(R.id.signInButtonDashboardLogin);
loginSheetLayout = findViewById(R.id.ConstraintLoginLayout);
// get window height
DisplayMetrics displayMetrics = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
height = displayMetrics.heightPixels;
width = displayMetrics.widthPixels;
// get bottom sheets
sheetBehavior = BottomSheetBehavior.from(loginSheetLayout);
// button on click
btnSignup.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);
}
}
});
// set Callback
sheetBehavior.setBottomSheetCallback(new BottomSheetBehavior.BottomSheetCallback() {
@Override
public void onStateChanged(@NonNull View bottomSheet, int newState) {
switch (newState) {
case BottomSheetBehavior.STATE_HIDDEN:
case BottomSheetBehavior.STATE_DRAGGING:
case BottomSheetBehavior.STATE_SETTLING:
break;
case BottomSheetBehavior.STATE_EXPANDED: {
Log.d(TAG, "onStateChanged: expanded");
}
break;
case BottomSheetBehavior.STATE_COLLAPSED: {
Log.d(TAG, "onStateChanged: collapsed");
}
break;
}
}
@Override
public void onSlide(@NonNull View bottomSheet, float slideOffset) {
}
});
//
// setContentView(R.layout.activity_login_m);
// username = findViewById(R.id.tiUsername);
......
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="64dp"
android:height="43dp"
android:viewportWidth="64"
android:viewportHeight="43">
<path
android:pathData="M8.5,36.682C13.1944,36.682 17,32.8764 17,28.182C17,23.4876 13.1944,19.682 8.5,19.682C3.8056,19.682 0,23.4876 0,28.182C0,32.8764 3.8056,36.682 8.5,36.682Z"
android:fillColor="@color/colorPrimary"
android:fillAlpha="0.87"/>
<path
android:pathData="M59.6642,27.3332L40.9464,5.0349C38.6122,2.2542 34.4658,1.8922 31.6851,4.2264C28.9044,6.5606 28.5424,10.7071 30.8766,13.4878L49.5943,35.7861C51.9285,38.5668 56.075,38.9287 58.8557,36.5945C61.6364,34.2603 61.9984,30.1139 59.6642,27.3332Z"
android:fillColor="@color/colorPrimary"
android:fillAlpha="0.87"/>
<path
android:pathData="M40.2832,29.2722L21.5654,6.9739C19.2312,4.1932 15.0848,3.8312 12.3041,6.1654C9.5234,8.4996 9.1614,12.6461 11.4956,15.4268L30.2133,37.7251C32.5475,40.5058 36.694,40.8677 39.4747,38.5335C42.2554,36.1993 42.6174,32.0529 40.2832,29.2722Z"
android:fillColor="@color/colorPrimary"
android:fillAlpha="0.87"/>
</vector>
......@@ -16,8 +16,8 @@
<ImageView
android:id="@+id/messerLogoDashboardLogin"
android:layout_width="215dp"
android:layout_height="213dp"
android:src="@drawable/ic_messer_login"
android:layout_height="215dp"
android:src="@drawable/ic_messer_white"
android:layout_centerHorizontal="true"
android:layout_marginTop="50dp"/>
......@@ -60,12 +60,10 @@
app:rippleColor="#A8A8A8"
app:cornerRadius="5dp"
android:textColor="@color/colorPrimary"/>
</RelativeLayout>
<include
layout="@layout/login_form"/>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/ConstraintLoginLayout"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
app:behavior_hideable="true"
android:padding="20dp"
style="@style/Widget.Rounded.BottomSheet"
app:behavior_peekHeight="0dp"
android:background="@color/colorWhite"
app:layout_behavior="com.google.android.material.bottomsheet.BottomSheetBehavior">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageButton
android:id="@+id/closeBtnLogin"
android:layout_width="50dp"
android:layout_height="50dp"
android:src="@drawable/ic_baseline_plus_24"
android:scaleType="centerInside"
android:adjustViewBounds="true"
android:padding="50dp"
android:backgroundTint="@android:color/transparent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
/>
<ImageView
android:id="@+id/messerLogoInLogin"
android:layout_width="215dp"
android:layout_height="215dp"
android:src="@drawable/ic_messer_primary"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/closeBtnLogin"/>
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/formUsernameLogin"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/username"
app:layout_constraintTop_toBottomOf="@id/messerLogoInLogin"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox">
<com.google.android.material.textfield.TextInputEditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
/>
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/FormPasswordLogin"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/password"
app:layout_constraintTop_toBottomOf="@id/formUsernameLogin"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox">
<com.google.android.material.textfield.TextInputEditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
/>
</com.google.android.material.textfield.TextInputLayout>
<CheckBox
android:id="@+id/CBRememberMe"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Remember Me"
android:textColor="@color/colorPrimary"
app:layout_constraintTop_toBottomOf="@id/FormPasswordLogin"
app:layout_constraintStart_toStartOf="parent"
app:useMaterialThemeColors="true"/>
<com.google.android.material.button.MaterialButton
android:id="@+id/SignInButtonInLogin"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintTop_toBottomOf="@id/CBRememberMe"
android:text="Sign In"
android:padding="20dp"/>
<com.google.android.material.textview.MaterialTextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Forgot Password?"
app:layout_constraintTop_toBottomOf="@id/SignInButtonInLogin"
app:layout_constraintEnd_toEndOf="parent"
android:layout_marginTop="10dp"
android:textColor="@color/colorPrimary"/>
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
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