Change EditText to Material TextField

This commit is contained in:
Jarne Demeulemeester 2021-06-11 13:53:07 +02:00
parent e0c8f0aeb6
commit d3ebf29efa
No known key found for this signature in database
GPG key ID: 60884A0C1EBA43E5
6 changed files with 44 additions and 31 deletions

View file

@ -41,7 +41,6 @@ dependencies {
def room_version = "2.3.0"
def jellyfin_version = "1.0.0-beta.7"
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation 'androidx.core:core-ktx:1.5.0'
implementation 'androidx.appcompat:appcompat:1.3.0'
implementation 'com.google.android.material:material:1.3.0'

View file

@ -32,7 +32,7 @@ class AddServerFragment : Fragment() {
viewModel.checkServer(serverAddress)
binding.progressCircular.visibility = View.VISIBLE
} else {
binding.editTextServerAddress.error = "Empty server address"
binding.editTextServerAddressLayout.error = "Empty server address"
}
}
@ -45,7 +45,7 @@ class AddServerFragment : Fragment() {
})
viewModel.error.observe(viewLifecycleOwner, {
binding.editTextServerAddress.error = it
binding.editTextServerAddressLayout.error = it
})
return binding.root

View file

@ -32,7 +32,7 @@ class LoginFragment : Fragment() {
viewModel.error.observe(viewLifecycleOwner, {
binding.progressCircular.visibility = View.GONE
binding.editTextUsername.error = it
binding.editTextUsernameLayout.error = it
})
return binding.root

View file

@ -51,18 +51,23 @@
android:text="@string/add_server"
android:textColor="?android:textColorPrimary" />
<EditText
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/edit_text_server_address_layout"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:hint="@string/edit_text_server_address_hint"
app:errorEnabled="true">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/edit_text_server_address"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="24dp"
android:autofillHints="no"
android:background="@drawable/edit_text_background"
android:hint="@string/edit_text_server_address_hint"
android:inputType="text"
android:padding="10dp"
android:textAppearance="@style/text_subtitle"
android:textColorHint="@color/neutral_400" />
android:inputType="textUri"
android:singleLine="true" />
</com.google.android.material.textfield.TextInputLayout>
<RelativeLayout
android:layout_width="match_parent"

View file

@ -49,32 +49,40 @@
android:text="@string/login"
android:textColor="?android:textColorPrimary" />
<EditText
android:id="@+id/edit_text_username"
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/edit_text_username_layout"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="12dp"
android:autofillHints="username"
android:background="@drawable/edit_text_background"
android:hint="@string/edit_text_username_hint"
android:inputType="text"
android:padding="10dp"
android:textAppearance="@style/text_subtitle"
android:textColorHint="@color/neutral_400" />
android:hint="@string/edit_text_username_hint">
<EditText
android:id="@+id/edit_text_password"
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/edit_text_username"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="text"
android:autofillHints="username"/>
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/edit_text_password_layout"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="24dp"
android:autofillHints="password"
android:background="@drawable/edit_text_background"
android:hint="@string/edit_text_password_hint"
android:inputType="textPassword"
android:padding="10dp"
android:textAppearance="@style/text_subtitle"
android:textColorHint="@color/neutral_400" />
app:passwordToggleEnabled="true">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/edit_text_password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textPassword"
android:autofillHints="password"/>
</com.google.android.material.textfield.TextInputLayout>
<RelativeLayout
android:layout_width="match_parent"

View file

@ -25,7 +25,8 @@
<fragment
android:id="@+id/serverSelectFragment"
android:name="dev.jdtech.jellyfin.fragments.ServerSelectFragment"
android:label="ServerSelectFragment" >
android:label="ServerSelectFragment"
tools:layout="@layout/fragment_server_select">
<action
android:id="@+id/action_serverSelectFragment_to_addServerFragment"
app:destination="@id/addServerFragment"