Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show the blue border around buttons when no actionbar color is set #2535

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down