Use view binding instead of data binding for AddServerFragment and LoginFragment
This commit is contained in:
parent
94b3790560
commit
ee9dedd7b7
4 changed files with 156 additions and 186 deletions
|
@ -30,9 +30,6 @@ class AddServerFragment : Fragment() {
|
||||||
): View {
|
): View {
|
||||||
binding = FragmentAddServerBinding.inflate(inflater)
|
binding = FragmentAddServerBinding.inflate(inflater)
|
||||||
|
|
||||||
binding.lifecycleOwner = viewLifecycleOwner
|
|
||||||
binding.viewModel = viewModel
|
|
||||||
|
|
||||||
binding.editTextServerAddress.setOnEditorActionListener { _, actionId, _ ->
|
binding.editTextServerAddress.setOnEditorActionListener { _, actionId, _ ->
|
||||||
return@setOnEditorActionListener when (actionId) {
|
return@setOnEditorActionListener when (actionId) {
|
||||||
EditorInfo.IME_ACTION_GO -> {
|
EditorInfo.IME_ACTION_GO -> {
|
||||||
|
|
|
@ -30,9 +30,6 @@ class LoginFragment : Fragment() {
|
||||||
): View {
|
): View {
|
||||||
binding = FragmentLoginBinding.inflate(inflater)
|
binding = FragmentLoginBinding.inflate(inflater)
|
||||||
|
|
||||||
binding.lifecycleOwner = viewLifecycleOwner
|
|
||||||
binding.viewModel = viewModel
|
|
||||||
|
|
||||||
binding.editTextPassword.setOnEditorActionListener { _, actionId, _ ->
|
binding.editTextPassword.setOnEditorActionListener { _, actionId, _ ->
|
||||||
return@setOnEditorActionListener when (actionId) {
|
return@setOnEditorActionListener when (actionId) {
|
||||||
EditorInfo.IME_ACTION_GO -> {
|
EditorInfo.IME_ACTION_GO -> {
|
||||||
|
|
|
@ -1,105 +1,93 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
<layout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
xmlns:tools="http://schemas.android.com/tools">
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:fillViewport="true"
|
||||||
|
tools:context=".fragments.AddServerFragment">
|
||||||
|
|
||||||
<data>
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
|
||||||
<variable
|
|
||||||
name="viewModel"
|
|
||||||
type="dev.jdtech.jellyfin.viewmodels.AddServerViewModel" />
|
|
||||||
</data>
|
|
||||||
|
|
||||||
<ScrollView
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="wrap_content">
|
||||||
android:fillViewport="true"
|
|
||||||
tools:context=".fragments.AddServerFragment">
|
|
||||||
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
<ImageView
|
||||||
android:layout_width="match_parent"
|
android:id="@+id/image_banner"
|
||||||
android:layout_height="wrap_content">
|
android:layout_width="268dp"
|
||||||
|
android:layout_height="75dp"
|
||||||
|
android:layout_marginTop="64dp"
|
||||||
|
android:contentDescription="@string/jellyfin_banner"
|
||||||
|
android:src="@drawable/ic_banner"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
<ImageView
|
<LinearLayout
|
||||||
android:id="@+id/image_banner"
|
android:id="@+id/linearLayout"
|
||||||
android:layout_width="268dp"
|
android:layout_width="@dimen/setup_container_width"
|
||||||
android:layout_height="75dp"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="64dp"
|
android:layout_marginStart="24dp"
|
||||||
android:contentDescription="@string/jellyfin_banner"
|
android:layout_marginEnd="24dp"
|
||||||
android:src="@drawable/ic_banner"
|
android:orientation="vertical"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/image_banner"
|
||||||
|
app:layout_constraintVertical_bias="0.36">
|
||||||
|
|
||||||
<LinearLayout
|
<TextView
|
||||||
android:id="@+id/linearLayout"
|
android:id="@+id/text_add_server"
|
||||||
android:layout_width="@dimen/setup_container_width"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginStart="24dp"
|
android:layout_marginBottom="32dp"
|
||||||
android:layout_marginEnd="24dp"
|
android:text="@string/add_server"
|
||||||
android:orientation="vertical"
|
android:textAppearance="@style/TextAppearance.MaterialComponents.Headline5"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
android:textColor="?android:textColorPrimary" />
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toBottomOf="@+id/image_banner"
|
|
||||||
app:layout_constraintVertical_bias="0.36">
|
|
||||||
|
|
||||||
<TextView
|
<com.google.android.material.textfield.TextInputLayout
|
||||||
android:id="@+id/text_add_server"
|
android:id="@+id/edit_text_server_address_layout"
|
||||||
android:layout_width="wrap_content"
|
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
|
||||||
android:layout_height="wrap_content"
|
android:layout_width="match_parent"
|
||||||
android:layout_marginBottom="32dp"
|
android:layout_height="wrap_content"
|
||||||
android:text="@string/add_server"
|
android:layout_marginBottom="8dp"
|
||||||
android:textAppearance="@style/TextAppearance.MaterialComponents.Headline5"
|
android:hint="@string/edit_text_server_address_hint"
|
||||||
android:textColor="?android:textColorPrimary" />
|
app:errorEnabled="true"
|
||||||
|
app:startIconDrawable="@drawable/ic_server">
|
||||||
|
|
||||||
<com.google.android.material.textfield.TextInputLayout
|
<com.google.android.material.textfield.TextInputEditText
|
||||||
android:id="@+id/edit_text_server_address_layout"
|
android:id="@+id/edit_text_server_address"
|
||||||
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginBottom="8dp"
|
android:imeOptions="actionGo"
|
||||||
android:hint="@string/edit_text_server_address_hint"
|
android:inputType="textUri"
|
||||||
app:errorEnabled="true"
|
android:singleLine="true" />
|
||||||
app:startIconDrawable="@drawable/ic_server">
|
|
||||||
|
|
||||||
<com.google.android.material.textfield.TextInputEditText
|
</com.google.android.material.textfield.TextInputLayout>
|
||||||
android:id="@+id/edit_text_server_address"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:imeOptions="actionGo"
|
|
||||||
android:inputType="textUri"
|
|
||||||
android:singleLine="true" />
|
|
||||||
|
|
||||||
</com.google.android.material.textfield.TextInputLayout>
|
<RelativeLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
<RelativeLayout
|
<Button
|
||||||
|
android:id="@+id/button_connect"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content">
|
android:layout_height="wrap_content"
|
||||||
|
android:drawableStart="@drawable/ic_launcher_foreground"
|
||||||
|
android:text="@string/button_connect" />
|
||||||
|
|
||||||
<Button
|
<ProgressBar
|
||||||
android:id="@+id/button_connect"
|
android:id="@+id/progress_circular"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="48dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="48dp"
|
||||||
android:drawableStart="@drawable/ic_launcher_foreground"
|
android:elevation="8dp"
|
||||||
android:text="@string/button_connect" />
|
android:indeterminateTint="@color/white"
|
||||||
|
android:padding="8dp"
|
||||||
|
android:visibility="invisible" />
|
||||||
|
|
||||||
<ProgressBar
|
</RelativeLayout>
|
||||||
android:id="@+id/progress_circular"
|
|
||||||
android:layout_width="48dp"
|
|
||||||
android:layout_height="48dp"
|
|
||||||
android:elevation="8dp"
|
|
||||||
android:indeterminateTint="@color/white"
|
|
||||||
android:padding="8dp"
|
|
||||||
android:visibility="invisible" />
|
|
||||||
|
|
||||||
</RelativeLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
</LinearLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</ScrollView>
|
||||||
|
|
||||||
</ScrollView>
|
|
||||||
|
|
||||||
</layout>
|
|
||||||
|
|
|
@ -1,121 +1,109 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
<layout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
xmlns:tools="http://schemas.android.com/tools">
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:fillViewport="true"
|
||||||
|
tools:context=".fragments.LoginFragment">
|
||||||
|
|
||||||
<data>
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
|
||||||
<variable
|
|
||||||
name="viewModel"
|
|
||||||
type="dev.jdtech.jellyfin.viewmodels.LoginViewModel" />
|
|
||||||
</data>
|
|
||||||
|
|
||||||
<ScrollView
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="wrap_content">
|
||||||
android:fillViewport="true"
|
|
||||||
tools:context=".fragments.LoginFragment">
|
|
||||||
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
<ImageView
|
||||||
android:layout_width="match_parent"
|
android:id="@+id/image_banner"
|
||||||
android:layout_height="wrap_content">
|
android:layout_width="268dp"
|
||||||
|
android:layout_height="75dp"
|
||||||
|
android:layout_marginTop="64dp"
|
||||||
|
android:contentDescription="@string/jellyfin_banner"
|
||||||
|
android:src="@drawable/ic_banner"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
<ImageView
|
<LinearLayout
|
||||||
android:id="@+id/image_banner"
|
android:id="@+id/linearLayout"
|
||||||
android:layout_width="268dp"
|
android:layout_width="@dimen/setup_container_width"
|
||||||
android:layout_height="75dp"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="64dp"
|
android:layout_marginStart="24dp"
|
||||||
android:contentDescription="@string/jellyfin_banner"
|
android:layout_marginEnd="24dp"
|
||||||
android:src="@drawable/ic_banner"
|
android:orientation="vertical"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/image_banner"
|
||||||
|
app:layout_constraintVertical_bias="0.36">
|
||||||
|
|
||||||
<LinearLayout
|
<TextView
|
||||||
android:id="@+id/linearLayout"
|
android:id="@+id/text_login"
|
||||||
android:layout_width="@dimen/setup_container_width"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginStart="24dp"
|
android:layout_marginBottom="32dp"
|
||||||
android:layout_marginEnd="24dp"
|
android:text="@string/login"
|
||||||
android:orientation="vertical"
|
android:textAppearance="@style/TextAppearance.MaterialComponents.Headline5"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
android:textColor="?android:textColorPrimary" />
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toBottomOf="@+id/image_banner"
|
|
||||||
app:layout_constraintVertical_bias="0.36">
|
|
||||||
|
|
||||||
<TextView
|
<com.google.android.material.textfield.TextInputLayout
|
||||||
android:id="@+id/text_login"
|
android:id="@+id/edit_text_username_layout"
|
||||||
android:layout_width="wrap_content"
|
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
|
||||||
android:layout_height="wrap_content"
|
android:layout_width="match_parent"
|
||||||
android:layout_marginBottom="32dp"
|
android:layout_height="wrap_content"
|
||||||
android:text="@string/login"
|
android:layout_marginBottom="12dp"
|
||||||
android:textAppearance="@style/TextAppearance.MaterialComponents.Headline5"
|
android:hint="@string/edit_text_username_hint"
|
||||||
android:textColor="?android:textColorPrimary" />
|
app:startIconDrawable="@drawable/ic_user">
|
||||||
|
|
||||||
<com.google.android.material.textfield.TextInputLayout
|
<com.google.android.material.textfield.TextInputEditText
|
||||||
android:id="@+id/edit_text_username_layout"
|
android:id="@+id/edit_text_username"
|
||||||
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginBottom="12dp"
|
android:autofillHints="username"
|
||||||
android:hint="@string/edit_text_username_hint"
|
android:inputType="text" />
|
||||||
app:startIconDrawable="@drawable/ic_user">
|
|
||||||
|
|
||||||
<com.google.android.material.textfield.TextInputEditText
|
</com.google.android.material.textfield.TextInputLayout>
|
||||||
android:id="@+id/edit_text_username"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:autofillHints="username"
|
|
||||||
android:inputType="text" />
|
|
||||||
|
|
||||||
</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:hint="@string/edit_text_password_hint"
|
||||||
|
app:passwordToggleEnabled="true"
|
||||||
|
app:startIconDrawable="@drawable/ic_lock">
|
||||||
|
|
||||||
<com.google.android.material.textfield.TextInputLayout
|
<com.google.android.material.textfield.TextInputEditText
|
||||||
android:id="@+id/edit_text_password_layout"
|
android:id="@+id/edit_text_password"
|
||||||
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginBottom="24dp"
|
android:autofillHints="password"
|
||||||
android:hint="@string/edit_text_password_hint"
|
android:imeOptions="actionGo"
|
||||||
app:passwordToggleEnabled="true"
|
android:inputType="textPassword" />
|
||||||
app:startIconDrawable="@drawable/ic_lock">
|
|
||||||
|
|
||||||
<com.google.android.material.textfield.TextInputEditText
|
</com.google.android.material.textfield.TextInputLayout>
|
||||||
android:id="@+id/edit_text_password"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:autofillHints="password"
|
|
||||||
android:imeOptions="actionGo"
|
|
||||||
android:inputType="textPassword" />
|
|
||||||
|
|
||||||
</com.google.android.material.textfield.TextInputLayout>
|
<RelativeLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
<RelativeLayout
|
<Button
|
||||||
|
android:id="@+id/button_login"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content">
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/button_login" />
|
||||||
|
|
||||||
<Button
|
<ProgressBar
|
||||||
android:id="@+id/button_login"
|
android:id="@+id/progress_circular"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="48dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="48dp"
|
||||||
android:text="@string/button_login" />
|
android:elevation="8dp"
|
||||||
|
android:indeterminateTint="@color/white"
|
||||||
|
android:padding="8dp"
|
||||||
|
android:visibility="invisible" />
|
||||||
|
</RelativeLayout>
|
||||||
|
|
||||||
<ProgressBar
|
</LinearLayout>
|
||||||
android:id="@+id/progress_circular"
|
|
||||||
android:layout_width="48dp"
|
|
||||||
android:layout_height="48dp"
|
|
||||||
android:elevation="8dp"
|
|
||||||
android:indeterminateTint="@color/white"
|
|
||||||
android:padding="8dp"
|
|
||||||
android:visibility="invisible" />
|
|
||||||
</RelativeLayout>
|
|
||||||
|
|
||||||
</LinearLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</ScrollView>
|
||||||
|
|
||||||
</ScrollView>
|
|
||||||
|
|
||||||
</layout>
|
|
||||||
|
|
Loading…
Reference in a new issue