Skip to content
Merged
Changes from 1 commit
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
10 changes: 9 additions & 1 deletion app/src/main/java/moe/matsuri/nb4a/ui/SimpleMenuPreference.kt
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import android.view.View
import android.view.ViewGroup
import android.widget.ArrayAdapter
import android.widget.Spinner
import androidx.core.graphics.ColorUtils
import androidx.preference.DropDownPreference
import androidx.preference.PreferenceViewHolder
import io.nekohasekai.sagernet.R
Expand Down Expand Up @@ -70,7 +71,14 @@ open class SimpleMenuPreference
var currentPosition = -1

private val radius = 12f * context.resources.displayMetrics.density
private val selectedColor = context.getColorAttr(R.attr.colorMaterial100)

// Highlight the selected item with a translucent primary tint rather than
// an opaque colorMaterial100 fill: the light fill made the (light) item
// text low-contrast on dark themes. ~20% alpha reads on any background
// while keeping the text legible.
private val selectedColor = ColorUtils.setAlphaComponent(
context.getColorAttr(R.attr.colorPrimary), 51
)
Comment thread
greptile-apps[bot] marked this conversation as resolved.

private val topDrawable = GradientDrawable().apply {
setColor(selectedColor)
Expand Down
Loading