diff --git a/app/src/main/java/org/oxycblt/auxio/detail/ReadOnlyTextInput.kt b/app/src/main/java/org/oxycblt/auxio/detail/ReadOnlyTextInput.kt index 4882907a7..1c704c7c8 100644 --- a/app/src/main/java/org/oxycblt/auxio/detail/ReadOnlyTextInput.kt +++ b/app/src/main/java/org/oxycblt/auxio/detail/ReadOnlyTextInput.kt @@ -22,8 +22,8 @@ import android.os.Build import android.text.method.MovementMethod import android.util.AttributeSet import android.view.View -import androidx.annotation.AttrRes import com.google.android.material.textfield.TextInputEditText +import org.oxycblt.auxio.R /** * A [TextInputEditText] that deliberately restricts all input except for selection. Yes, this is a @@ -32,16 +32,13 @@ import com.google.android.material.textfield.TextInputEditText * * @author OxygenCobalt */ -class ReadOnlyTextInput : TextInputEditText { - constructor(context: Context) : super(context) - - constructor(context: Context, attrs: AttributeSet?) : super(context, attrs) - - constructor( - context: Context, - attrs: AttributeSet?, - @AttrRes defStyleAttr: Int - ) : super(context, attrs, defStyleAttr) +class ReadOnlyTextInput +@JvmOverloads +constructor( + context: Context, + attrs: AttributeSet? = null, + defStyleAttr: Int = R.attr.editTextStyle +) : TextInputEditText(context, attrs, defStyleAttr) { init { setTextIsSelectable(true) diff --git a/app/src/main/java/org/oxycblt/auxio/playback/ForcedLTRFrameLayout.kt b/app/src/main/java/org/oxycblt/auxio/playback/ForcedLTRFrameLayout.kt index 614c1c9b3..ac15dc1d1 100644 --- a/app/src/main/java/org/oxycblt/auxio/playback/ForcedLTRFrameLayout.kt +++ b/app/src/main/java/org/oxycblt/auxio/playback/ForcedLTRFrameLayout.kt @@ -41,7 +41,8 @@ constructor( context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0, -) : FrameLayout(context, attrs, defStyleAttr) { + defStyleRes: Int = 0, +) : FrameLayout(context, attrs, defStyleAttr, defStyleRes) { override fun onFinishInflate() { super.onFinishInflate() check(childCount == 1) { "This layout should only contain one child" } diff --git a/app/src/main/java/org/oxycblt/auxio/settings/ui/M3SwitchPreference.kt b/app/src/main/java/org/oxycblt/auxio/settings/ui/M3SwitchPreference.kt deleted file mode 100644 index a6f92214f..000000000 --- a/app/src/main/java/org/oxycblt/auxio/settings/ui/M3SwitchPreference.kt +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (c) 2022 Auxio Project - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -package org.oxycblt.auxio.settings.ui - -import android.content.Context -import android.os.Build -import android.util.AttributeSet -import androidx.appcompat.widget.SwitchCompat -import androidx.preference.PreferenceViewHolder -import androidx.preference.SwitchPreferenceCompat -import org.oxycblt.auxio.R -import org.oxycblt.auxio.util.getColorStateListSafe -import org.oxycblt.auxio.util.getDrawableSafe - -/** - * A [SwitchPreferenceCompat] that emulates the M3 switches until the design team actually bothers - * to add them to MDC - * - * TODO: Remove this once MaterialSwitch is stabilized. - */ -class M3SwitchPreference -@JvmOverloads -constructor( - context: Context, - attrs: AttributeSet? = null, - defStyleAttr: Int = R.attr.switchPreferenceCompatStyle, - defStyleRes: Int = 0 -) : SwitchPreferenceCompat(context, attrs, defStyleAttr, defStyleRes) { - override fun onBindViewHolder(holder: PreferenceViewHolder) { - super.onBindViewHolder(holder) - - // Lollipop cannot into ColorStateList, disable this feature on that version - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { - val switch = holder.findViewById(androidx.preference.R.id.switchWidget) - if (switch is SwitchCompat) { - switch.apply { - trackDrawable = context.getDrawableSafe(R.drawable.ui_m3_switch_track) - trackTintList = context.getColorStateListSafe(R.color.sel_m3_switch_track) - thumbDrawable = context.getDrawableSafe(R.drawable.ui_m3_switch_thumb) - thumbTintList = context.getColorStateListSafe(R.color.sel_m3_switch_thumb) - } - } - } - } -} diff --git a/app/src/main/res/drawable-nodpi/ui_widget_preview.png b/app/src/main/res/drawable-nodpi/ui_widget_preview.png index 958395589..396fc7dba 100644 Binary files a/app/src/main/res/drawable-nodpi/ui_widget_preview.png and b/app/src/main/res/drawable-nodpi/ui_widget_preview.png differ