Theme refactoring (#1656)
* Theme refactoring * disable the automatic tinting of surfaces with elevation in dark mode * make the media warning visible again with the dark theme * fix nav bar on api 27+ * use correct color for all media warnings
This commit is contained in:
parent
29ef92edd3
commit
8767d2ed3d
122 changed files with 330 additions and 724 deletions
|
@ -23,7 +23,6 @@ import android.view.View
|
|||
import android.view.ViewGroup
|
||||
import android.widget.ImageView
|
||||
import androidx.core.app.ActivityOptionsCompat
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.core.view.ViewCompat
|
||||
import androidx.recyclerview.widget.GridLayoutManager
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
|
@ -179,15 +178,11 @@ class AccountMediaFragment : BaseFragment(), RefreshableFragment, Injectable {
|
|||
val columnCount = view.context.resources.getInteger(R.integer.profile_media_column_count)
|
||||
val layoutManager = GridLayoutManager(view.context, columnCount)
|
||||
|
||||
val bgRes = ThemeUtils.getColorId(view.context, R.attr.window_background)
|
||||
|
||||
adapter.baseItemColor = ContextCompat.getColor(recyclerView.context, bgRes)
|
||||
adapter.baseItemColor = ThemeUtils.getColor(view.context, android.R.attr.windowBackground)
|
||||
|
||||
recyclerView.layoutManager = layoutManager
|
||||
recyclerView.adapter = adapter
|
||||
|
||||
|
||||
|
||||
if (isSwipeToRefreshEnabled) {
|
||||
swipeRefreshLayout.setOnRefreshListener {
|
||||
refresh()
|
||||
|
|
|
@ -92,9 +92,9 @@ class AccountPreferencesFragment : PreferenceFragmentCompat(),
|
|||
publicFiltersPreference = requirePreference("publicFilters")
|
||||
threadFiltersPreference = requirePreference("threadFilters")
|
||||
|
||||
notificationPreference.icon = IconicsDrawable(notificationPreference.context, GoogleMaterial.Icon.gmd_notifications).sizePx(iconSize).color(ThemeUtils.getColor(notificationPreference.context, R.attr.preference_icon_tint))
|
||||
notificationPreference.icon = IconicsDrawable(notificationPreference.context, GoogleMaterial.Icon.gmd_notifications).sizePx(iconSize).color(ThemeUtils.getColor(notificationPreference.context, R.attr.iconColor))
|
||||
mutedUsersPreference.icon = getTintedIcon(R.drawable.ic_mute_24dp)
|
||||
blockedUsersPreference.icon = IconicsDrawable(blockedUsersPreference.context, GoogleMaterial.Icon.gmd_block).sizePx(iconSize).color(ThemeUtils.getColor(blockedUsersPreference.context, R.attr.preference_icon_tint))
|
||||
blockedUsersPreference.icon = IconicsDrawable(blockedUsersPreference.context, GoogleMaterial.Icon.gmd_block).sizePx(iconSize).color(ThemeUtils.getColor(blockedUsersPreference.context, R.attr.iconColor))
|
||||
mutedDomainsPreference.icon = getTintedIcon(R.drawable.ic_mute_24dp)
|
||||
|
||||
notificationPreference.onPreferenceClickListener = this
|
||||
|
@ -288,9 +288,7 @@ class AccountPreferencesFragment : PreferenceFragmentCompat(),
|
|||
}
|
||||
|
||||
private fun getTintedIcon(iconId: Int): Drawable? {
|
||||
val drawable = context?.getDrawable(iconId)
|
||||
ThemeUtils.setDrawableTint(context, drawable, R.attr.preference_icon_tint)
|
||||
return drawable
|
||||
return ThemeUtils.getTintedDrawable(requireContext(), iconId, R.attr.iconColor)
|
||||
}
|
||||
|
||||
private fun launchFilterActivity(filterContext: String, titleResource: Int): Boolean {
|
||||
|
@ -303,9 +301,7 @@ class AccountPreferencesFragment : PreferenceFragmentCompat(),
|
|||
}
|
||||
|
||||
companion object {
|
||||
fun newInstance(): AccountPreferencesFragment {
|
||||
return AccountPreferencesFragment()
|
||||
}
|
||||
fun newInstance() = AccountPreferencesFragment()
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -38,13 +38,13 @@ class PreferencesFragment : PreferenceFragmentCompat() {
|
|||
addPreferencesFromResource(R.xml.preferences)
|
||||
|
||||
val themePreference: Preference = requirePreference("appTheme")
|
||||
themePreference.icon = IconicsDrawable(themePreference.context, GoogleMaterial.Icon.gmd_palette).sizePx(iconSize).color(ThemeUtils.getColor(themePreference.context, R.attr.preference_icon_tint))
|
||||
themePreference.icon = IconicsDrawable(themePreference.context, GoogleMaterial.Icon.gmd_palette).sizePx(iconSize).color(ThemeUtils.getColor(themePreference.context, R.attr.iconColor))
|
||||
|
||||
val emojiPreference: Preference = requirePreference("emojiCompat")
|
||||
emojiPreference.icon = IconicsDrawable(emojiPreference.context, GoogleMaterial.Icon.gmd_sentiment_satisfied).sizePx(iconSize).color(ThemeUtils.getColor(emojiPreference.context, R.attr.preference_icon_tint))
|
||||
emojiPreference.icon = IconicsDrawable(emojiPreference.context, GoogleMaterial.Icon.gmd_sentiment_satisfied).sizePx(iconSize).color(ThemeUtils.getColor(emojiPreference.context, R.attr.iconColor))
|
||||
|
||||
val textSizePreference: Preference = requirePreference("statusTextSize")
|
||||
textSizePreference.icon = IconicsDrawable(textSizePreference.context, GoogleMaterial.Icon.gmd_format_size).sizePx(iconSize).color(ThemeUtils.getColor(textSizePreference.context, R.attr.preference_icon_tint))
|
||||
textSizePreference.icon = IconicsDrawable(textSizePreference.context, GoogleMaterial.Icon.gmd_format_size).sizePx(iconSize).color(ThemeUtils.getColor(textSizePreference.context, R.attr.iconColor))
|
||||
|
||||
val timelineFilterPreferences: Preference = requirePreference("timelineFilterPreferences")
|
||||
timelineFilterPreferences.setOnPreferenceClickListener {
|
||||
|
@ -67,12 +67,11 @@ class PreferencesFragment : PreferenceFragmentCompat() {
|
|||
}
|
||||
|
||||
val languagePreference: Preference = requirePreference("language")
|
||||
languagePreference.icon = IconicsDrawable(languagePreference.context, GoogleMaterial.Icon.gmd_translate).sizePx(iconSize).color(ThemeUtils.getColor(languagePreference.context, R.attr.preference_icon_tint))
|
||||
languagePreference.icon = IconicsDrawable(languagePreference.context, GoogleMaterial.Icon.gmd_translate).sizePx(iconSize).color(ThemeUtils.getColor(languagePreference.context, R.attr.iconColor))
|
||||
|
||||
val botIndicatorPreference = requirePreference("showBotOverlay")
|
||||
val botDrawable = botIndicatorPreference.context.getDrawable(R.drawable.ic_bot_24dp)
|
||||
ThemeUtils.setDrawableTint(context, botDrawable, R.attr.preference_icon_tint)
|
||||
botIndicatorPreference.icon = botDrawable
|
||||
|
||||
botIndicatorPreference.icon = ThemeUtils.getTintedDrawable(requireContext(), R.drawable.ic_bot_24dp, R.attr.iconColor)
|
||||
}
|
||||
|
||||
override fun onResume() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue