Multi server/user implementation

This commit is contained in:
CappielloAntonio 2021-08-08 19:21:56 +02:00
parent 4e269a7446
commit 78a4006ed6
30 changed files with 959 additions and 192 deletions

View file

@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="@color/titleTextColor"
android:pathData="M19,13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"/>
</vector>

View file

@ -0,0 +1,97 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<com.google.android.material.textfield.TextInputLayout
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="24dp"
android:layout_marginTop="24dp"
android:layout_marginEnd="24dp"
android:textColorHint="?android:textColorHint"
app:endIconMode="clear_text"
app:endIconTint="?android:textColorSecondary"
app:errorEnabled="true"
app:hintTextColor="?android:textColorSecondary">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/server_name_text_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Server Name"
android:inputType="textNoSuggestions"
android:text="Navidrome" />
</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_marginStart="24dp"
android:layout_marginEnd="24dp"
android:textColorHint="?android:textColorHint"
app:endIconMode="clear_text"
app:endIconTint="?android:textColorSecondary"
app:errorEnabled="true"
app:hintTextColor="?android:textColorSecondary">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/username_text_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Username"
android:inputType="textShortMessage"
android:text="antonio" />
</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_marginStart="24dp"
android:layout_marginEnd="24dp"
android:textColorHint="?android:textColorHint"
app:endIconMode="password_toggle"
app:endIconTint="?android:textColorSecondary"
app:errorEnabled="true"
app:hintTextColor="?android:textColorSecondary">
<!-- Navidrome android:text="!$4EBXhSPUi4$E#oagvAisCA" -->
<!-- Gonic android:text="hYP3%yD!rx@GBf95B2wbRUk8" -->
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/password_text_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Password"
android:inputType="textPassword"
android:text="!$4EBXhSPUi4$E#oagvAisCA" />
</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_marginStart="24dp"
android:layout_marginEnd="24dp"
android:textColorHint="?android:textColorHint"
app:endIconMode="clear_text"
app:endIconTint="?android:textColorSecondary"
app:errorEnabled="true"
app:hintTextColor="?android:textColorSecondary">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/server_text_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Server URL"
android:inputType="textNoSuggestions"
android:text="http://192.168.1.81:4533" />
</com.google.android.material.textfield.TextInputLayout>
</LinearLayout>

View file

@ -1,104 +1,70 @@
<?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"
android:id="@+id/login_screen"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="vertical"
android:paddingTop="20dp">
android:orientation="vertical">
<com.google.android.material.textfield.TextInputLayout
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
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:boxStrokeColor="?android:textColorSecondary"
app:endIconMode="clear_text"
app:endIconTint="?android:textColorSecondary"
app:errorEnabled="true"
app:hintTextColor="?android:textColorSecondary">
android:layout_height="?attr/actionBarSize"
app:layout_collapseMode="pin" />
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/username_text_view"
<androidx.coordinatorlayout.widget.CoordinatorLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingTop="8dp">
<com.google.android.material.appbar.AppBarLayout
android:id="@+id/app_bar_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Username"
android:inputType="textShortMessage"
android:text="antonio" />
app:elevation="0dp">
</com.google.android.material.textfield.TextInputLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/server_info_sector"
android:layout_width="match_parent"
android:layout_height="172dp"
app:layout_scrollFlags="scroll|exitUntilCollapsed|snap">
<com.google.android.material.textfield.TextInputLayout
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
android:layout_width="match_parent"
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:boxStrokeColor="?android:textColorSecondary"
app:endIconMode="password_toggle"
app:endIconTint="?android:textColorSecondary"
app:errorEnabled="true"
app:hintTextColor="?android:textColorSecondary">
<TextView
style="@style/HeadlineTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingStart="16dp"
android:paddingTop="16dp"
android:paddingEnd="16dp"
android:paddingBottom="24dp"
android:text="Subsonic servers"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
</com.google.android.material.appbar.AppBarLayout>
<!-- Navidrome android:text="!$4EBXhSPUi4$E#oagvAisCA" -->
<!-- Gonic android:text="hYP3%yD!rx@GBf95B2wbRUk8" -->
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/password_text_view"
<TextView
android:id="@+id/no_server_added_text_view"
style="@style/SubheadTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Password"
android:inputType="textPassword"
android:text="!$4EBXhSPUi4$E#oagvAisCA"/>
android:paddingStart="16dp"
android:paddingTop="16dp"
android:paddingEnd="16dp"
android:gravity="center"
android:text="No server added"
android:clipToPadding="false"
android:paddingBottom="@dimen/global_padding_bottom"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
android:visibility="gone"/>
</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_marginStart="32dp"
android:layout_marginEnd="32dp"
android:textColorHint="?android:textColorHint"
app:boxCornerRadiusBottomEnd="24dp"
app:boxCornerRadiusBottomStart="24dp"
app:boxCornerRadiusTopEnd="24dp"
app:boxCornerRadiusTopStart="24dp"
app:boxStrokeColor="?android:textColorSecondary"
app:endIconMode="clear_text"
app:endIconTint="?android:textColorSecondary"
app:errorEnabled="true"
app:hintTextColor="?android:textColorSecondary">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/server_text_view"
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/server_list_recycler_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Server URL"
android:inputType="textNoSuggestions"
android:text="http://192.168.1.81:4533" />
</com.google.android.material.textfield.TextInputLayout>
<Button
android:id="@+id/login_button"
android:layout_width="match_parent"
android:layout_height="64dp"
android:layout_margin="32dp"
android:backgroundTint="@color/colorAccent"
android:text="Login"
android:textAllCaps="false"
app:cornerRadius="24dp" />
</LinearLayout>
android:clipToPadding="false"
android:paddingBottom="@dimen/global_padding_bottom"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
android:visibility="gone"/>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
</LinearLayout>

View file

@ -0,0 +1,59 @@
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/cardColor"
android:clipChildren="false"
android:foreground="?attr/selectableItemBackground">
<TextView
android:id="@+id/server_name_text_view"
style="@style/ItemTitleTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ellipsize="marquee"
android:focusable="true"
android:focusableInTouchMode="true"
android:marqueeRepeatLimit="marquee_forever"
android:maxLines="1"
android:paddingStart="20dp"
android:paddingTop="12dp"
android:paddingBottom="4dp"
android:paddingEnd="12dp"
android:scrollHorizontally="true"
android:text="@string/label_placeholder"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toStartOf="@+id/server_holder_image"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/server_address_text_view"
style="@style/ItemSubtitleTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ellipsize="marquee"
android:focusable="true"
android:focusableInTouchMode="true"
android:marqueeRepeatLimit="marquee_forever"
android:maxLines="1"
android:paddingStart="20dp"
android:paddingBottom="12dp"
android:paddingEnd="12dp"
android:text="@string/label_placeholder"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toStartOf="@+id/server_holder_image"
app:layout_constraintTop_toBottomOf="@+id/server_name_text_view" />
<ImageView
android:id="@+id/server_holder_image"
android:layout_width="36dp"
android:layout_height="match_parent"
android:gravity="center_vertical"
android:layout_marginEnd="20dp"
android:src="@drawable/ic_drag_handle"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>

View file

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item
android:id="@+id/action_add"
android:icon="@drawable/ic_add"
android:iconTint="@color/titleTextColor"
android:title="Add"
app:showAsAction="always" />
</menu>

View file

@ -93,6 +93,11 @@
android:name="com.cappielloantonio.play.ui.fragment.SettingsFragment"
android:label="SettingsFragment"
tools:layout="@layout/fragment_settings">
<action
android:id="@+id/action_settingsFragment_to_loginFragment"
app:destination="@id/loginFragment"
app:popUpTo="@id/homeFragment"
app:popUpToInclusive="true" />
</fragment>
<fragment
android:id="@+id/searchFragment"

View file

@ -18,6 +18,10 @@
app:key="themePref"
app:title="@string/theme_selection"
app:useSimpleSummaryProvider="true" />
<Preference
android:key="logout"
android:title="Log out" />
</PreferenceCategory>