Эх сурвалжийг харах

unify tab layout theming on surface

Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
Andy Scherzinger 2 жил өмнө
parent
commit
365a7502b4

+ 11 - 6
app/src/main/java/com/nextcloud/talk/remotefilebrowser/activities/RemoteFileBrowserActivity.kt

@@ -24,6 +24,7 @@ package com.nextcloud.talk.remotefilebrowser.activities
 
 
 import android.app.Activity
 import android.app.Activity
 import android.content.Intent
 import android.content.Intent
+import android.content.res.ColorStateList
 import android.os.Bundle
 import android.os.Bundle
 import android.util.Log
 import android.util.Log
 import android.view.Menu
 import android.view.Menu
@@ -74,14 +75,18 @@ class RemoteFileBrowserActivity : AppCompatActivity(), SelectionInterface, Swipe
 
 
         binding = ActivityRemoteFileBrowserBinding.inflate(layoutInflater)
         binding = ActivityRemoteFileBrowserBinding.inflate(layoutInflater)
         setSupportActionBar(binding.remoteFileBrowserItemsToolbar)
         setSupportActionBar(binding.remoteFileBrowserItemsToolbar)
+        viewThemeUtils.themeToolbar(binding.remoteFileBrowserItemsToolbar)
+        val scheme = viewThemeUtils.getScheme(binding.sortListButtonGroup.context)
+        binding.sortListButtonGroup.setBackgroundColor(scheme.surface)
+        binding.sortButton.iconTint = ColorStateList.valueOf(scheme.onSurface)
+        binding.sortButton.setTextColor(scheme.onSurface)
+        viewThemeUtils.colorMaterialTextButton(binding.sortButton)
+        binding.pathNavigationBackButton.iconTint = ColorStateList.valueOf(scheme.onSurface)
+        binding.pathNavigationBackButton.setTextColor(scheme.onSurface)
+        viewThemeUtils.colorMaterialTextButton(binding.pathNavigationBackButton)
+        viewThemeUtils.themeStatusBar(this, binding.remoteFileBrowserItemsToolbar)
         setContentView(binding.root)
         setContentView(binding.root)
 
 
-        DisplayUtils.applyColorToStatusBar(
-            this,
-            ResourcesCompat.getColor(
-                resources, R.color.appbar, null
-            )
-        )
         DisplayUtils.applyColorToNavigationBar(
         DisplayUtils.applyColorToNavigationBar(
             this.window,
             this.window,
             ResourcesCompat.getColor(resources, R.color.bg_default, null)
             ResourcesCompat.getColor(resources, R.color.bg_default, null)

+ 2 - 0
app/src/main/java/com/nextcloud/talk/shareditems/activities/SharedItemsActivity.kt

@@ -74,6 +74,8 @@ class SharedItemsActivity : AppCompatActivity() {
         setContentView(binding.root)
         setContentView(binding.root)
 
 
         viewThemeUtils.themeStatusBar(this, binding.sharedItemsToolbar)
         viewThemeUtils.themeStatusBar(this, binding.sharedItemsToolbar)
+        viewThemeUtils.themeToolbar(binding.sharedItemsToolbar)
+        viewThemeUtils.themeTabLayoutOnSurface(binding.sharedItemsTabs)
 
 
         DisplayUtils.applyColorToNavigationBar(
         DisplayUtils.applyColorToNavigationBar(
             this.window,
             this.window,

+ 1 - 3
app/src/main/java/com/nextcloud/talk/ui/dialog/ShowReactionsDialog.kt

@@ -148,9 +148,7 @@ class ShowReactionsDialog(
                 }
                 }
             })
             })
 
 
-            viewThemeUtils.colorTabLayout(binding.emojiReactionsTabs)
-            binding.emojiReactionsTabs.setBackgroundColor(
-                viewThemeUtils.getScheme(binding.emojiReactionsTabs .context).surface)
+            viewThemeUtils.themeTabLayoutOnSurface(binding.emojiReactionsTabs)
 
 
             updateParticipantsForEmoji(chatMessage, tagAll)
             updateParticipantsForEmoji(chatMessage, tagAll)
         }
         }

+ 22 - 17
app/src/main/java/com/nextcloud/talk/ui/theme/ViewThemeUtils.kt

@@ -585,27 +585,32 @@ class ViewThemeUtils @Inject constructor(private val theme: ServerTheme, private
         }
         }
     }
     }
 
 
-    fun colorTabLayout(tabLayout: TabLayout) {
+    fun themeTabLayoutOnSurface(tabLayout: TabLayout) {
         withScheme(tabLayout) { scheme ->
         withScheme(tabLayout) { scheme ->
-            tabLayout.setSelectedTabIndicatorColor(scheme.primary)
-            tabLayout.tabTextColors = ColorStateList(
-                arrayOf(
-                    intArrayOf(android.R.attr.state_selected),
-                    intArrayOf(-android.R.attr.state_selected)
-                ),
-                intArrayOf(scheme.primary, ContextCompat.getColor(tabLayout.context, R.color.high_emphasis_text))
-            )
-            tabLayout.tabRippleColor = ColorStateList(
-                arrayOf(
-                    intArrayOf(android.R.attr.state_pressed)
-                ),
-                intArrayOf(
-                    calculateDisabledColor(scheme.primary, SURFACE_OPACITY_BUTTON_DISABLED)
-                )
-            )
+            tabLayout.setBackgroundColor(scheme.surface)
+            colorTabLayout(tabLayout, scheme)
         }
         }
     }
     }
 
 
+    fun colorTabLayout(tabLayout: TabLayout, scheme: Scheme) {
+        tabLayout.setSelectedTabIndicatorColor(scheme.primary)
+        tabLayout.tabTextColors = ColorStateList(
+            arrayOf(
+                intArrayOf(android.R.attr.state_selected),
+                intArrayOf(-android.R.attr.state_selected)
+            ),
+            intArrayOf(scheme.primary, ContextCompat.getColor(tabLayout.context, R.color.high_emphasis_text))
+        )
+        tabLayout.tabRippleColor = ColorStateList(
+            arrayOf(
+                intArrayOf(android.R.attr.state_pressed)
+            ),
+            intArrayOf(
+                calculateDisabledColor(scheme.primary, SURFACE_OPACITY_BUTTON_DISABLED)
+            )
+        )
+    }
+
     fun getPlaceholderImage(context: Context, mimetype: String?): Drawable? {
     fun getPlaceholderImage(context: Context, mimetype: String?): Drawable? {
         val drawableResourceId = DrawableUtils.getDrawableResourceIdForMimeType(mimetype)
         val drawableResourceId = DrawableUtils.getDrawableResourceIdForMimeType(mimetype)
         val drawable = AppCompatResources.getDrawable(
         val drawable = AppCompatResources.getDrawable(