소스 검색

theme share buttons in m3

Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
Andy Scherzinger 2 년 전
부모
커밋
d57ea5a010

+ 1 - 5
app/src/main/java/com/owncloud/android/ui/dialog/SendShareDialog.java

@@ -207,11 +207,7 @@ public class SendShareDialog extends BottomSheetDialogFragment implements Inject
     }
 
     private void themeShareButtonImage(ImageView shareImageView) {
-        shareImageView.getBackground().setColorFilter(themeColorUtils.primaryColor(getContext().getApplicationContext(),
-                                                                                   true),
-                                                      PorterDuff.Mode.SRC_IN);
-        shareImageView.getDrawable().mutate().setColorFilter(themeColorUtils.fontColor(getContext().getApplicationContext()),
-                                                             PorterDuff.Mode.SRC_IN);
+        viewThemeUtils.files.themeAvatarButton(shareImageView);
     }
 
     private void showResharingNotAllowedSnackbar() {

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

@@ -23,6 +23,7 @@
 package com.owncloud.android.utils.theme.newm3
 
 import android.content.Context
+import android.content.res.ColorStateList
 import android.graphics.PorterDuff
 import android.graphics.drawable.Drawable
 import android.preference.PreferenceCategory
@@ -35,6 +36,7 @@ import androidx.annotation.Px
 import androidx.annotation.StringRes
 import androidx.appcompat.app.ActionBar
 import androidx.core.content.res.ResourcesCompat
+import com.google.android.material.card.MaterialCardView
 import com.nextcloud.android.common.ui.theme.MaterialSchemes
 import com.nextcloud.android.common.ui.theme.ViewThemeUtilsBase
 import com.nextcloud.android.common.ui.theme.utils.AndroidViewThemeUtils
@@ -173,6 +175,30 @@ class FilesSpecificViewThemeUtils @Inject constructor(
         androidXViewThemeUtils.themeActionBar(context, actionBar, backArrow)
     }
 
+    fun themeTemplateCardView(cardView: MaterialCardView) {
+        withScheme(cardView.context) { scheme ->
+            cardView.setStrokeColor(
+                ColorStateList(
+                    arrayOf(
+                        intArrayOf(android.R.attr.state_checked),
+                        intArrayOf(-android.R.attr.state_checked)
+                    ),
+                    intArrayOf(
+                        scheme.primary,
+                        scheme.outline
+                    )
+                )
+            )
+        }
+    }
+
+    fun themeAvatarButton(shareImageView: ImageView) {
+        withScheme(shareImageView.context) { scheme ->
+            shareImageView.background.setColorFilter(scheme.primary, PorterDuff.Mode.SRC_IN)
+            shareImageView.drawable.mutate().setColorFilter(scheme.onPrimary, PorterDuff.Mode.SRC_IN)
+        }
+    }
+
     companion object {
         private val TAG = FilesSpecificViewThemeUtils::class.simpleName