Skip to content

Commit

Permalink
Fixed tab strip colours, ready for next release
Browse files Browse the repository at this point in the history
  • Loading branch information
CookieJarApps committed Feb 6, 2022
1 parent 3802d83 commit f85c418
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 7 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ android {
defaultConfig {
minSdkVersion project.minSdkVersion
targetSdkVersion project.targetSdkVersion
versionName "16.1"
versionCode 150
versionName "16.2"
versionCode 151
vectorDrawables.useSupportLibrary = true
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1527,7 +1527,7 @@ abstract class BrowserActivity : ThemableBrowserActivity(), BrowserView, UIContr
private fun loadState(above: Int) = tabsManager.currentTab?.let { it.progress >= above } ?: false

override fun changeToolbarColor(tabBackground: Drawable?){
val primaryColor = ThemeUtils.getPrimaryColor(this)
val primaryColor = ThemeUtils.getColorBackground(this)

if(userPreferences.darkModeExtension) currentTabView?.setBackgroundColor(if (loadState(50)) Color.WHITE else primaryColor); currentTabView?.invalidate()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class TabsDesktopAdapter(
private fun updateViewHolderAppearance(viewHolder: TabViewHolder, favicon: Bitmap?, isForeground: Boolean) {
if (isForeground) {
val foregroundDrawable = resources.getDrawable(R.drawable.desktop_tab_selected)
foregroundDrawable.tint(ThemeUtils.getPrimaryColor(uiController as Context))
foregroundDrawable.tint(ThemeUtils.getColorBackground(uiController as Context))
if (uiController.isColorMode()) {
foregroundDrawable.tint(uiController.getUiColor())
}
Expand All @@ -76,7 +76,7 @@ class TabsDesktopAdapter(
uiController.changeToolbarBackground(favicon, foregroundDrawable)
} else {
val backgroundDrawable = resources.getDrawable(R.drawable.desktop_tab)
backgroundDrawable.tint(Utils.mixTwoColors(ThemeUtils.getPrimaryColor(uiController as Context), Color.BLACK, 0.85f))
backgroundDrawable.tint(Utils.mixTwoColors(ThemeUtils.getColorBackground(uiController as Context), Color.BLACK, 0.85f))
TextViewCompat.setTextAppearance(viewHolder.txtTitle, R.style.normalText)
viewHolder.layout.background = backgroundDrawable
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class TabsDesktopView @JvmOverloads constructor(
private val tabList: RecyclerView

init {
setBackgroundColor(Utils.mixTwoColors(ThemeUtils.getPrimaryColor(uiController as Context), Color.BLACK, 0.85f))
setBackgroundColor(Utils.mixTwoColors(ThemeUtils.getColorBackground(uiController as Context), Color.BLACK, 0.85f))
context.inflater.inflate(R.layout.tab_strip, this, true)
findViewById<ImageView>(R.id.new_tab_button).apply {
setColorFilter(ThemeUtils.getTextColor(uiController as Context))
Expand Down Expand Up @@ -73,7 +73,7 @@ class TabsDesktopView @JvmOverloads constructor(
setHasFixedSize(true)
}

val backgroundColor = Utils.mixTwoColors(ThemeUtils.getPrimaryColor(uiController as Context), Color.BLACK, 0.85f)
val backgroundColor = Utils.mixTwoColors(ThemeUtils.getColorBackground(uiController as Context), Color.BLACK, 0.85f)
tabList.setBackgroundColor(backgroundColor)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,4 +186,15 @@ public static Bitmap createThemedBitmap(@NonNull Context context, @DrawableRes i
public static int getTextColor(@NonNull Context context) {
return getColor(context, android.R.attr.editTextColor);
}

/**
* Gets the surface color for the current theme.
*
* @param context the context to use.
* @return a surface color.
*/
@ColorInt
public static int getColorBackground(@NonNull Context context) {
return getColor(context, android.R.attr.colorBackground);
}
}

0 comments on commit f85c418

Please sign in to comment.