removing some checkbox hacks

This commit is contained in:
tibbi 2021-11-12 19:08:21 +01:00
parent d8010b6adb
commit 2262391749
3 changed files with 3 additions and 15 deletions

View file

@ -25,7 +25,7 @@
android:name="com.samsung.android.providers.context.permission.WRITE_USE_APP_FEATURE_SURVEY"
tools:node="remove" />
<application>
<application android:supportsRtl="true">
<activity
android:name="com.simplemobiletools.commons.activities.ContributorsActivity"
android:label="@string/contributors"

View file

@ -4,9 +4,6 @@ import android.content.Context
import android.content.res.ColorStateList
import android.util.AttributeSet
import androidx.appcompat.widget.AppCompatCheckBox
import com.simplemobiletools.commons.R
import com.simplemobiletools.commons.extensions.applyColorFilter
import com.simplemobiletools.commons.helpers.isMarshmallowPlus
class MyAppCompatCheckbox : AppCompatCheckBox {
constructor(context: Context) : super(context)
@ -17,19 +14,12 @@ class MyAppCompatCheckbox : AppCompatCheckBox {
fun setColors(textColor: Int, accentColor: Int, backgroundColor: Int) {
setTextColor(textColor)
if (isMarshmallowPlus()) {
buttonDrawable?.applyColorFilter(textColor)
compoundDrawablesRelative.forEach {
it?.applyColorFilter(textColor)
}
}
val colorStateList = ColorStateList(
arrayOf(
intArrayOf(-android.R.attr.state_checked),
intArrayOf(android.R.attr.state_checked)
),
intArrayOf(context.resources.getColor(R.color.radiobutton_disabled), accentColor)
intArrayOf(textColor, accentColor)
)
supportButtonTintList = colorStateList
}

View file

@ -136,10 +136,8 @@
<style name="SettingsCheckboxStyle">
<item name="android:background">@null</item>
<item name="android:button">@null</item>
<item name="android:clickable">false</item>
<item name="drawableEndCompat">?android:attr/listChoiceIndicatorMultiple</item>
<item name="android:drawablePadding">@dimen/activity_margin</item>
<item name="android:layoutDirection">rtl</item>
</style>
<style name="SettingsLeftLabelStyle">