improve input and button style on login activity

This commit is contained in:
dkanada 2020-11-08 16:13:49 +09:00
commit 402b545473
4 changed files with 59 additions and 28 deletions

View file

@ -54,7 +54,8 @@
android:label="@string/action_about" />
<activity
android:name=".ui.activities.LoginActivity"
android:label="@string/action_login" />
android:label="@string/action_login"
android:theme="@style/LoginScreen" />
<activity
android:name=".shortcuts.AppShortcutLauncherActivity"
android:launchMode="singleInstance"

View file

@ -48,13 +48,13 @@ public class LoginActivity extends AbsBaseActivity implements View.OnClickListen
private void setUpViews() {
setUpToolbar();
setUpOnClickListeners();
binding.login.setBackgroundColor(ThemeStore.primaryColor(this));
}
private void setUpToolbar() {
binding.toolbar.setBackgroundColor(ThemeStore.primaryColor(this));
setSupportActionBar(binding.toolbar);
// noinspection ConstantConditions
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
}
private void setUpOnClickListeners() {

View file

@ -1,9 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
tools:context=".ui.activities.LoginActivity">
@ -19,69 +19,95 @@
android:layout_height="100dp"
android:layout_marginTop="50dp"
android:layout_marginBottom="50dp"
android:src="@mipmap/ic_launcher" />
android:src="@mipmap/ic_launcher"
tools:ignore="ContentDescription" />
<com.google.android.material.textfield.TextInputLayout
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
android:layout_width="match_parent"
android:layout_height="wrap_content">
android:layout_height="wrap_content"
android:layout_marginStart="32dp"
android:layout_marginEnd="32dp"
android:textColorHint="?android:textColorHint"
app:boxCornerRadiusBottomEnd="24dp"
app:boxCornerRadiusBottomStart="24dp"
app:boxCornerRadiusTopEnd="24dp"
app:boxCornerRadiusTopStart="24dp"
app:errorEnabled="true"
app:endIconMode="clear_text"
app:endIconTint="?android:textColorSecondary"
app:boxStrokeColor="?android:textColorSecondary"
app:hintTextColor="?android:textColorSecondary">
<EditText
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/username"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="32dp"
android:layout_marginEnd="32dp"
android:paddingTop="8dp"
android:paddingBottom="8dp"
android:inputType="textShortMessage"
android:hint="@string/username" />
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:endIconMode="password_toggle">
android:layout_marginStart="32dp"
android:layout_marginEnd="32dp"
android:textColorHint="?android:textColorHint"
app:boxCornerRadiusBottomEnd="24dp"
app:boxCornerRadiusBottomStart="24dp"
app:boxCornerRadiusTopEnd="24dp"
app:boxCornerRadiusTopStart="24dp"
app:errorEnabled="true"
app:endIconMode="password_toggle"
app:endIconTint="?android:textColorSecondary"
app:boxStrokeColor="?android:textColorSecondary"
app:hintTextColor="?android:textColorSecondary">
<EditText
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="32dp"
android:layout_marginEnd="32dp"
android:paddingTop="8dp"
android:paddingBottom="8dp"
android:inputType="textPassword"
android:hint="@string/password" />
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
android:layout_width="match_parent"
android:layout_height="wrap_content">
android:layout_height="wrap_content"
android:layout_marginStart="32dp"
android:layout_marginEnd="32dp"
android:textColorHint="?android:textColorHint"
app:boxCornerRadiusBottomEnd="24dp"
app:boxCornerRadiusBottomStart="24dp"
app:boxCornerRadiusTopEnd="24dp"
app:boxCornerRadiusTopStart="24dp"
app:errorEnabled="true"
app:endIconMode="clear_text"
app:endIconTint="?android:textColorSecondary"
app:boxStrokeColor="?android:textColorSecondary"
app:hintTextColor="?android:textColorSecondary">
<EditText
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/server"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="32dp"
android:layout_marginEnd="32dp"
android:paddingTop="16dp"
android:paddingBottom="16dp"
android:inputType="textNoSuggestions"
android:hint="@string/server" />
</com.google.android.material.textfield.TextInputLayout>
<Button
<com.google.android.material.button.MaterialButton
android:id="@+id/login"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_height="64dp"
android:layout_marginStart="32dp"
android:layout_marginEnd="32dp"
android:layout_marginTop="32dp"
android:paddingTop="8dp"
android:paddingBottom="8dp"
android:text="@string/login" />
android:text="@string/login"
app:cornerRadius="24dp" />
</LinearLayout>

View file

@ -37,4 +37,8 @@
<item name="android:transitionName" tools:ignore="NewApi">toolbar</item>
</style>
<style name="LoginScreen" parent="Theme.MaterialComponents.Light.DarkActionBar">
<item name="android:windowAnimationStyle">@null</item>
</style>
</resources>