This commit is contained in:
Luna712 2023-11-05 11:05:53 -07:00
parent 9c2d5ad5f9
commit 19d9034e65
8 changed files with 75 additions and 115 deletions

View file

@ -98,6 +98,7 @@ class AccountAdapter(
} }
if (isTv) { if (isTv) {
// For emulator but this is fine on TV also
root.isFocusableInTouchMode = true root.isFocusableInTouchMode = true
if (isLastUsedAccount) { if (isLastUsedAccount) {
root.requestFocus() root.requestFocus()

View file

@ -48,7 +48,7 @@ object AccountHelper {
var currentEditAccount = account var currentEditAccount = account
val dialog = builder.show() val dialog = builder.show()
if (!isNewAccount) binding.text1.setText(R.string.edit_account) if (!isNewAccount) binding.title.setText(R.string.edit_account)
// Set up the dialog content // Set up the dialog content
binding.accountName.text = Editable.Factory.getInstance()?.newEditable(account.name) binding.accountName.text = Editable.Factory.getInstance()?.newEditable(account.name)
@ -98,12 +98,12 @@ object AccountHelper {
} }
// Handle the profile picture and its interactions // Handle the profile picture and its interactions
binding.profilePic.setImage(account.image) binding.accountImage.setImage(account.image)
binding.profilePic.setOnClickListener { binding.accountImage.setOnClickListener {
// Roll the image forwards once // Roll the image forwards once
currentEditAccount = currentEditAccount =
currentEditAccount.copy(defaultImageIndex = (currentEditAccount.defaultImageIndex + 1) % DataStoreHelper.profileImages.size) currentEditAccount.copy(defaultImageIndex = (currentEditAccount.defaultImageIndex + 1) % DataStoreHelper.profileImages.size)
binding.profilePic.setImage(currentEditAccount.image) binding.accountImage.setImage(currentEditAccount.image)
} }
// Handle applying changes // Handle applying changes

View file

@ -15,13 +15,12 @@
android:orientation="horizontal"> android:orientation="horizontal">
<TextView <TextView
android:id="@+id/text1" android:id="@+id/title"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_rowWeight="1" android:layout_rowWeight="1"
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"
android:layout_weight="1" android:layout_weight="1"
android:paddingStart="?android:attr/listPreferredItemPaddingStart" android:paddingStart="?android:attr/listPreferredItemPaddingStart"
android:paddingEnd="?android:attr/listPreferredItemPaddingEnd" android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
android:text="@string/create_account" android:text="@string/create_account"
@ -31,23 +30,6 @@
</LinearLayout> </LinearLayout>
<TextView
android:id="@+id/text2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_rowWeight="1"
android:layout_gravity="center_vertical"
android:layout_marginBottom="10dp"
android:paddingStart="?android:attr/listPreferredItemPaddingStart"
android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
android:textColor="?attr/grayTextColor"
android:textSize="15sp"
android:visibility="gone"
tools:text="Gogoanime" />
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -81,56 +63,55 @@
app:cardCornerRadius="@dimen/rounded_image_radius"> app:cardCornerRadius="@dimen/rounded_image_radius">
<ImageView <ImageView
android:foreground="@drawable/outline_drawable_forced_round" android:id="@+id/account_image"
android:id="@+id/profile_pic" android:src="@drawable/profile_bg_blue"
android:layout_width="match_parent"
android:layout_height="60dp"
android:layout_gravity="center"
android:focusable="true" android:focusable="true"
android:contentDescription="@string/preview_background_img_des" android:contentDescription="@string/preview_background_img_des"
android:scaleType="centerCrop" android:scaleType="centerCrop"
android:src="@drawable/profile_bg_blue" /> android:foreground="@drawable/outline_drawable_forced_round"
android:layout_width="match_parent"
android:layout_height="60dp"
android:layout_gravity="center" />
</androidx.cardview.widget.CardView> </androidx.cardview.widget.CardView>
</LinearLayout> </LinearLayout>
<RelativeLayout <RelativeLayout
android:id="@+id/apply_btt_holder" android:id="@+id/apply_btt_holder"
android:orientation="horizontal"
android:padding="10dp"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="60dp" android:layout_height="60dp"
android:layout_gravity="bottom" android:layout_gravity="bottom"
android:layout_marginTop="-60dp" android:layout_marginTop="-60dp">
android:orientation="horizontal"
android:padding="10dp">
<com.google.android.material.button.MaterialButton <com.google.android.material.button.MaterialButton
android:id="@+id/delete_btt" android:id="@+id/delete_btt"
style="@style/BlackButton" android:text="@string/delete"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_alignParentStart="true" android:layout_alignParentStart="true"
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"
android:nextFocusRight="@id/apply_btt" android:nextFocusRight="@id/apply_btt"
android:text="@string/delete" /> style="@style/BlackButton" />
<com.google.android.material.button.MaterialButton <com.google.android.material.button.MaterialButton
android:id="@+id/apply_btt" android:id="@+id/apply_btt"
style="@style/WhiteButton" android:text="@string/sort_apply"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_gravity="center_vertical|end" android:layout_gravity="center_vertical|end"
android:layout_toStartOf="@+id/cancel_btt" android:layout_toStartOf="@+id/cancel_btt"
android:nextFocusLeft="@id/delete_btt" android:nextFocusLeft="@id/delete_btt"
android:nextFocusRight="@id/cancel_btt" android:nextFocusRight="@id/cancel_btt"
android:text="@string/sort_apply" /> style="@style/WhiteButton" />
<com.google.android.material.button.MaterialButton <com.google.android.material.button.MaterialButton
android:id="@+id/cancel_btt" android:id="@+id/cancel_btt"
style="@style/BlackButton" android:text="@string/sort_cancel"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_alignParentEnd="true" android:layout_alignParentEnd="true"
android:layout_gravity="center_vertical|end" android:layout_gravity="center_vertical|end"
android:nextFocusLeft="@id/apply_btt" android:nextFocusLeft="@id/apply_btt"
android:text="@string/sort_cancel" /> style="@style/BlackButton" />
</RelativeLayout>
</RelativeLayout>
</LinearLayout> </LinearLayout>

View file

@ -9,9 +9,9 @@
android:animateLayoutChanges="true" android:animateLayoutChanges="true"
android:backgroundTint="?attr/primaryGrayBackground" android:backgroundTint="?attr/primaryGrayBackground"
android:foreground="?attr/selectableItemBackground" android:foreground="?attr/selectableItemBackground"
app:cardCornerRadius="@dimen/rounded_image_radius"
android:layout_margin="10dp" android:layout_margin="10dp"
android:focusable="true" android:focusable="true"
app:cardCornerRadius="@dimen/rounded_image_radius"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintDimensionRatio="1" app:layout_constraintDimensionRatio="1"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
@ -24,16 +24,15 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:alpha="0.4" android:alpha="0.4"
android:contentDescription="@string/profile_background_des"
android:scaleType="centerCrop" /> android:scaleType="centerCrop" />
<View <View
android:id="@+id/outline" android:id="@+id/outline"
tools:visibility="visible"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@drawable/outline_card" android:background="@drawable/outline_card"
android:visibility="gone" /> android:visibility="gone"
tools:visibility="visible" />
<ImageView <ImageView
android:id="@+id/lock_icon" android:id="@+id/lock_icon"
@ -42,7 +41,8 @@
android:layout_gravity="top|end" android:layout_gravity="top|end"
android:layout_margin="4dp" android:layout_margin="4dp"
android:src="@drawable/video_locked" android:src="@drawable/video_locked"
android:visibility="gone" /> android:visibility="gone"
tools:visibility="visible" />
<TextView <TextView
android:id="@+id/account_name" android:id="@+id/account_name"
@ -53,4 +53,4 @@
android:padding="10dp" android:padding="10dp"
android:textSize="16sp" /> android:textSize="16sp" />
</androidx.cardview.widget.CardView> </androidx.cardview.widget.CardView>

View file

@ -8,9 +8,9 @@
android:animateLayoutChanges="true" android:animateLayoutChanges="true"
android:backgroundTint="?attr/primaryGrayBackground" android:backgroundTint="?attr/primaryGrayBackground"
android:foreground="?attr/selectableItemBackground" android:foreground="?attr/selectableItemBackground"
app:cardCornerRadius="@dimen/rounded_image_radius"
android:layout_margin="10dp" android:layout_margin="10dp"
android:focusable="true" android:focusable="true"
app:cardCornerRadius="@dimen/rounded_image_radius"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintDimensionRatio="1" app:layout_constraintDimensionRatio="1"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
@ -27,4 +27,3 @@
android:contentDescription="@string/add_account" /> android:contentDescription="@string/add_account" />
</androidx.cardview.widget.CardView> </androidx.cardview.widget.CardView>

View file

@ -9,9 +9,9 @@
android:animateLayoutChanges="true" android:animateLayoutChanges="true"
android:backgroundTint="?attr/primaryGrayBackground" android:backgroundTint="?attr/primaryGrayBackground"
android:foreground="?attr/selectableItemBackground" android:foreground="?attr/selectableItemBackground"
app:cardCornerRadius="@dimen/rounded_image_radius"
android:layout_margin="10dp" android:layout_margin="10dp"
android:focusable="true" android:focusable="true"
app:cardCornerRadius="@dimen/rounded_image_radius"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintDimensionRatio="1" app:layout_constraintDimensionRatio="1"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
@ -24,16 +24,15 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:alpha="0.1" android:alpha="0.1"
android:contentDescription="@string/profile_background_des"
android:scaleType="centerCrop" /> android:scaleType="centerCrop" />
<View <View
android:id="@+id/outline" android:id="@+id/outline"
tools:visibility="visible"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@drawable/outline_card" android:background="@drawable/outline_card"
android:visibility="gone" /> android:visibility="gone"
tools:visibility="visible" />
<ImageView <ImageView
android:id="@+id/lock_icon" android:id="@+id/lock_icon"
@ -42,7 +41,8 @@
android:layout_gravity="top|end" android:layout_gravity="top|end"
android:layout_margin="4dp" android:layout_margin="4dp"
android:src="@drawable/video_locked" android:src="@drawable/video_locked"
android:visibility="gone" /> android:visibility="gone"
tools:visibility="visible" />
<ImageView <ImageView
android:id="@+id/pencil_icon" android:id="@+id/pencil_icon"

View file

@ -1,57 +1,34 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <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:orientation="vertical" android:orientation="vertical"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent">
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools">
<TextView <TextView
android:paddingStart="?android:attr/listPreferredItemPaddingStart" android:paddingStart="?android:attr/listPreferredItemPaddingStart"
android:paddingEnd="?android:attr/listPreferredItemPaddingEnd" android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
android:layout_marginTop="20dp"
android:textStyle="bold" android:textStyle="bold"
android:text="@string/switch_account" android:text="@string/switch_account"
android:textSize="20sp" android:textSize="20sp"
android:textColor="?attr/textColor" android:textColor="?attr/textColor"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_rowWeight="1" android:layout_rowWeight="1"
android:layout_height="wrap_content" /> android:layout_height="wrap_content"
android:layout_marginTop="20dp" />
<TextView
android:paddingStart="?android:attr/listPreferredItemPaddingStart"
android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
android:text="@string/history"
android:textSize="15sp"
android:textColor="?attr/grayTextColor"
android:layout_width="match_parent"
android:layout_rowWeight="1"
android:layout_height="wrap_content" />
<TextView
android:paddingStart="?android:attr/listPreferredItemPaddingStart"
android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
android:text="@string/error_bookmarks_text"
android:textSize="15sp"
android:textColor="?attr/grayTextColor"
android:layout_width="match_parent"
android:layout_rowWeight="1"
android:layout_height="wrap_content" />
<androidx.recyclerview.widget.RecyclerView <androidx.recyclerview.widget.RecyclerView
android:layout_marginTop="10dp"
android:descendantFocusability="afterDescendants"
android:id="@+id/account_recycler_view" android:id="@+id/account_recycler_view"
android:orientation="horizontal"
android:descendantFocusability="afterDescendants"
android:layout_marginTop="10dp"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="horizontal"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
tools:itemCount="4" tools:itemCount="4"
tools:listitem="@layout/account_list_item"> tools:listitem="@layout/account_list_item" />
<requestFocus />
</androidx.recyclerview.widget.RecyclerView>
<com.google.android.material.button.MaterialButton <com.google.android.material.button.MaterialButton
android:id="@+id/manage_accounts_button" android:id="@+id/manage_accounts_button"
@ -63,4 +40,5 @@
android:textSize="16sp" android:textSize="16sp"
app:icon="@drawable/ic_baseline_edit_24" app:icon="@drawable/ic_baseline_edit_24"
style="@style/Widget.MaterialComponents.Button.TextButton" /> style="@style/Widget.MaterialComponents.Button.TextButton" />
</LinearLayout> </LinearLayout>

View file

@ -44,5 +44,6 @@
android:layout_gravity="center_horizontal" android:layout_gravity="center_horizontal"
android:paddingLeft="16dp" android:paddingLeft="16dp"
android:paddingRight="16dp" /> android:paddingRight="16dp" />
</LinearLayout> </LinearLayout>
</FrameLayout> </FrameLayout>