mirror of
https://github.com/nextcloud/talk-android
synced 2025-03-06 14:27:24 +00:00
unify tab layout theming on surface
Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
This commit is contained in:
parent
1d776ed6bd
commit
365a7502b4
@ -24,6 +24,7 @@ package com.nextcloud.talk.remotefilebrowser.activities
|
||||
|
||||
import android.app.Activity
|
||||
import android.content.Intent
|
||||
import android.content.res.ColorStateList
|
||||
import android.os.Bundle
|
||||
import android.util.Log
|
||||
import android.view.Menu
|
||||
@ -74,14 +75,18 @@ class RemoteFileBrowserActivity : AppCompatActivity(), SelectionInterface, Swipe
|
||||
|
||||
binding = ActivityRemoteFileBrowserBinding.inflate(layoutInflater)
|
||||
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)
|
||||
|
||||
DisplayUtils.applyColorToStatusBar(
|
||||
this,
|
||||
ResourcesCompat.getColor(
|
||||
resources, R.color.appbar, null
|
||||
)
|
||||
)
|
||||
DisplayUtils.applyColorToNavigationBar(
|
||||
this.window,
|
||||
ResourcesCompat.getColor(resources, R.color.bg_default, null)
|
||||
|
@ -74,6 +74,8 @@ class SharedItemsActivity : AppCompatActivity() {
|
||||
setContentView(binding.root)
|
||||
|
||||
viewThemeUtils.themeStatusBar(this, binding.sharedItemsToolbar)
|
||||
viewThemeUtils.themeToolbar(binding.sharedItemsToolbar)
|
||||
viewThemeUtils.themeTabLayoutOnSurface(binding.sharedItemsTabs)
|
||||
|
||||
DisplayUtils.applyColorToNavigationBar(
|
||||
this.window,
|
||||
|
@ -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)
|
||||
}
|
||||
|
@ -585,27 +585,32 @@ class ViewThemeUtils @Inject constructor(private val theme: ServerTheme, private
|
||||
}
|
||||
}
|
||||
|
||||
fun colorTabLayout(tabLayout: TabLayout) {
|
||||
fun themeTabLayoutOnSurface(tabLayout: TabLayout) {
|
||||
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? {
|
||||
val drawableResourceId = DrawableUtils.getDrawableResourceIdForMimeType(mimetype)
|
||||
val drawable = AppCompatResources.getDrawable(
|
||||
|
Loading…
Reference in New Issue
Block a user