Browse Source

improve status card views for m3

Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
Andy Scherzinger 2 years ago
parent
commit
d49f725e5e

+ 11 - 7
app/src/main/java/com/nextcloud/ui/SetStatusDialogFragment.kt

@@ -163,6 +163,11 @@ class SetStatusDialogFragment :
         binding.awayStatus.setOnClickListener { setStatus(StatusType.AWAY) }
         binding.invisibleStatus.setOnClickListener { setStatus(StatusType.INVISIBLE) }
 
+        viewThemeUtils.files.themeStatusCardView(binding.onlineStatus)
+        viewThemeUtils.files.themeStatusCardView(binding.dndStatus)
+        viewThemeUtils.files.themeStatusCardView(binding.awayStatus)
+        viewThemeUtils.files.themeStatusCardView(binding.invisibleStatus)
+
         binding.clearStatus.setOnClickListener { clearStatus() }
         binding.setStatus.setOnClickListener { setStatusMessage() }
         binding.emoji.setOnClickListener { popup.show() }
@@ -324,18 +329,12 @@ class SetStatusDialogFragment :
                 return
             }
         }
-        viewThemeUtils.material.colorCardViewBackground(views.first)
+        views.first.isChecked = true;
         viewThemeUtils.platform.colorPrimaryTextViewElement(views.second)
     }
 
     private fun clearTopStatus() {
         context?.let {
-            val grey = it.resources.getColor(R.color.grey_200)
-            binding.onlineStatus.setCardBackgroundColor(grey)
-            binding.awayStatus.setCardBackgroundColor(grey)
-            binding.dndStatus.setCardBackgroundColor(grey)
-            binding.invisibleStatus.setCardBackgroundColor(grey)
-
             binding.onlineHeadline.setTextColor(resources.getColor(R.color.high_emphasis_text))
             binding.awayHeadline.setTextColor(resources.getColor(R.color.high_emphasis_text))
             binding.dndHeadline.setTextColor(resources.getColor(R.color.high_emphasis_text))
@@ -345,6 +344,11 @@ class SetStatusDialogFragment :
             binding.awayIcon.imageTintList = null
             binding.dndIcon.imageTintList = null
             binding.invisibleIcon.imageTintList = null
+
+            binding.onlineStatus.isChecked = false
+            binding.awayStatus.isChecked = false
+            binding.dndStatus.isChecked = false
+            binding.invisibleStatus.isChecked = false
         }
     }
 

+ 28 - 0
app/src/main/java/com/owncloud/android/utils/theme/newm3/FilesSpecificViewThemeUtils.kt

@@ -192,6 +192,34 @@ class FilesSpecificViewThemeUtils @Inject constructor(
         }
     }
 
+    fun themeStatusCardView(cardView: MaterialCardView) {
+        withScheme(cardView) { scheme ->
+            cardView.backgroundTintList =
+                ColorStateList(
+                    arrayOf(
+                        intArrayOf(android.R.attr.state_checked),
+                        intArrayOf(-android.R.attr.state_checked)
+                    ),
+                    intArrayOf(
+                        scheme.surfaceVariant,
+                        scheme.surfaceVariant
+                    )
+                )
+            cardView.setStrokeColor(
+                ColorStateList(
+                    arrayOf(
+                        intArrayOf(android.R.attr.state_checked),
+                        intArrayOf(-android.R.attr.state_checked)
+                    ),
+                    intArrayOf(
+                        scheme.primary,
+                        scheme.surface
+                    )
+                )
+            )
+        }
+    }
+
     fun themeAvatarButton(shareImageView: ImageView) {
         withScheme(shareImageView.context) { scheme ->
             shareImageView.background.setColorFilter(scheme.primary, PorterDuff.Mode.SRC_IN)

+ 15 - 7
app/src/main/res/layout/dialog_set_status.xml

@@ -60,10 +60,12 @@
                 android:layout_gravity="center_vertical"
                 android:layout_marginEnd="@dimen/standard_half_margin"
                 android:layout_weight="1"
+                android:checkable="true"
                 android:orientation="horizontal"
                 app:cardBackgroundColor="@color/grey_200"
+                app:cardCornerRadius="@dimen/button_corner_radius"
                 app:cardElevation="0dp"
-                app:cardCornerRadius="@dimen/button_corner_radius">
+                app:checkedIcon="@null">
 
                 <RelativeLayout
                     android:layout_width="match_parent"
@@ -128,10 +130,12 @@
                 android:layout_gravity="center_vertical"
                 android:layout_marginStart="@dimen/standard_half_margin"
                 android:layout_weight="1"
+                android:checkable="true"
                 android:orientation="horizontal"
                 app:cardBackgroundColor="@color/grey_200"
+                app:cardCornerRadius="@dimen/button_corner_radius"
                 app:cardElevation="0dp"
-                app:cardCornerRadius="@dimen/button_corner_radius">
+                app:checkedIcon="@null">
 
                 <RelativeLayout
                     android:layout_width="match_parent"
@@ -205,10 +209,12 @@
                 android:layout_gravity="center_vertical"
                 android:layout_marginEnd="@dimen/standard_half_margin"
                 android:layout_weight="1"
+                android:checkable="true"
                 android:orientation="horizontal"
                 app:cardBackgroundColor="@color/grey_200"
+                app:cardCornerRadius="@dimen/button_corner_radius"
                 app:cardElevation="0dp"
-                app:cardCornerRadius="@dimen/button_corner_radius">
+                app:checkedIcon="@null">
 
                 <RelativeLayout
                     android:layout_width="match_parent"
@@ -260,10 +266,12 @@
                 android:layout_gravity="center_vertical"
                 android:layout_marginStart="@dimen/standard_half_margin"
                 android:layout_weight="1"
+                android:checkable="true"
                 android:orientation="horizontal"
                 app:cardBackgroundColor="@color/grey_200"
+                app:cardCornerRadius="@dimen/button_corner_radius"
                 app:cardElevation="0dp"
-                app:cardCornerRadius="@dimen/button_corner_radius">
+                app:checkedIcon="@null">
 
                 <RelativeLayout
                     android:layout_width="match_parent"
@@ -421,8 +429,8 @@
             android:id="@+id/remainingClearTime"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
-            android:textColor="@color/text_color"
             android:layout_marginStart="4dp"
+            android:textColor="@color/text_color"
             android:visibility="gone" />
 
     </LinearLayout>
@@ -437,7 +445,7 @@
             android:id="@+id/clearStatus"
             style="@style/OutlinedButton"
             android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
+            android:layout_height="match_parent"
             android:layout_marginEnd="@dimen/standard_half_margin"
             android:layout_weight="1"
             android:text="@string/clear_status_message"
@@ -446,7 +454,7 @@
         <com.google.android.material.button.MaterialButton
             android:id="@+id/setStatus"
             android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
+            android:layout_height="match_parent"
             android:layout_weight="1"
             android:text="@string/set_status_message"
             android:theme="@style/Button.Primary"