diff --git a/app/src/main/java/net/bible/android/view/util/widget/WindowButtonWidget.kt b/app/src/main/java/net/bible/android/view/util/widget/WindowButtonWidget.kt index ec1ed799aa..01ac1e585e 100644 --- a/app/src/main/java/net/bible/android/view/util/widget/WindowButtonWidget.kt +++ b/app/src/main/java/net/bible/android/view/util/widget/WindowButtonWidget.kt @@ -19,6 +19,8 @@ package net.bible.android.view.util.widget import android.annotation.SuppressLint import android.content.Context +import android.graphics.Color +import android.graphics.drawable.GradientDrawable import android.util.AttributeSet import android.view.KeyEvent import android.view.LayoutInflater @@ -131,6 +133,27 @@ class WindowButtonWidget( } ) } + + val theme = CurrentActivityHolder.currentActivity?.theme + val roundDrawable: GradientDrawable = resources.getDrawable(buttonResource,theme) as GradientDrawable + val toolbarColor = windowRepository.workspaceSettings.workspaceColor + if(windowRepository.visibleWindows.isNotEmpty()) { + // Set the button background color to the workspace color. Can't use setTint because it overrides the stroke color + roundDrawable.mutate() + if (isActive) { + roundDrawable.setColor(Color.parseColor("#" + Integer.toHexString(toolbarColor!!))) + // Set border color if using default actionbar color + if (toolbarColor == getResourceColor(R.color.actionbar_background_day)) + roundDrawable.setStroke(5, getResourceColor(R.color.bar_window_button_active_stroke_color)) + else + roundDrawable.setStroke(0, getResourceColor(R.color.transparent)) + } + else if (isWindowVisible) + roundDrawable.setColor(getResourceColor(R.color.window_button_background_colour_visible)) + else roundDrawable.setColor(getResourceColor(R.color.bar_window_button_background_colour)) + } + + windowButton.background = roundDrawable if (isRestoreButton) { buttonText.textSize = 13.0f val color = getResourceColor(R.color.bar_window_button_text_colour)