Disable OneUI-only settings on other devices
This commit is contained in:
@@ -30,6 +30,11 @@ class CardsLayoutFragment : Fragment(R.layout.fragment_cards_layout) {
|
|||||||
policy.aodCards,
|
policy.aodCards,
|
||||||
VisibilityPolicy::aodCards,
|
VisibilityPolicy::aodCards,
|
||||||
) { current, settings -> current.copy(aodCards = settings) }
|
) { current, settings -> current.copy(aodCards = settings) }
|
||||||
|
if (!DeviceCapabilities.isOneUi) {
|
||||||
|
binding!!.oneUiOnlyNotice.visibility = View.VISIBLE
|
||||||
|
binding!!.oneUiCardsControls.alpha = DISABLED_CONTROL_ALPHA
|
||||||
|
binding!!.oneUiCardsControls.disableRecursively()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onResume() {
|
override fun onResume() {
|
||||||
@@ -141,4 +146,5 @@ class CardsLayoutFragment : Fragment(R.layout.fragment_cards_layout) {
|
|||||||
)
|
)
|
||||||
|
|
||||||
private data class NumberStepper(val minus: Button, val value: TextView, val plus: Button)
|
private data class NumberStepper(val minus: Button, val value: TextView, val plus: Button)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,17 @@
|
|||||||
|
package se.ajpanton.notificationsmaster
|
||||||
|
|
||||||
|
import android.os.Build
|
||||||
|
import android.view.View
|
||||||
|
import android.view.ViewGroup
|
||||||
|
|
||||||
|
object DeviceCapabilities {
|
||||||
|
val isOneUi: Boolean
|
||||||
|
get() = Build.MANUFACTURER.equals("samsung", ignoreCase = true)
|
||||||
|
}
|
||||||
|
|
||||||
|
internal fun View.disableRecursively() {
|
||||||
|
isEnabled = false
|
||||||
|
if (this is ViewGroup) repeat(childCount) { getChildAt(it).disableRecursively() }
|
||||||
|
}
|
||||||
|
|
||||||
|
internal const val DISABLED_CONTROL_ALPHA = 0.45f
|
||||||
@@ -45,6 +45,11 @@ class MiscellaneousFragment : Fragment(R.layout.fragment_miscellaneous) {
|
|||||||
bind(binding!!.showAodBatteryPercent, settings.showAodBatteryPercentWhenUnplugged) { current, checked ->
|
bind(binding!!.showAodBatteryPercent, settings.showAodBatteryPercentWhenUnplugged) { current, checked ->
|
||||||
current.copy(showAodBatteryPercentWhenUnplugged = checked)
|
current.copy(showAodBatteryPercentWhenUnplugged = checked)
|
||||||
}
|
}
|
||||||
|
if (!DeviceCapabilities.isOneUi) {
|
||||||
|
binding!!.oneUiOnlyNotice.visibility = View.VISIBLE
|
||||||
|
binding!!.oneUiMiscControls.alpha = DISABLED_CONTROL_ALPHA
|
||||||
|
binding!!.oneUiMiscControls.disableRecursively()
|
||||||
|
}
|
||||||
binding!!.debugMinus10.setOnClickListener { changeDebugCount(-10) }
|
binding!!.debugMinus10.setOnClickListener { changeDebugCount(-10) }
|
||||||
binding!!.debugMinus1.setOnClickListener { changeDebugCount(-1) }
|
binding!!.debugMinus1.setOnClickListener { changeDebugCount(-1) }
|
||||||
binding!!.debugPlus1.setOnClickListener { changeDebugCount(1) }
|
binding!!.debugPlus1.setOnClickListener { changeDebugCount(1) }
|
||||||
@@ -106,4 +111,5 @@ class MiscellaneousFragment : Fragment(R.layout.fragment_miscellaneous) {
|
|||||||
binding?.debugCycle?.isChecked = DebugNotifications.isCycling(context)
|
binding?.debugCycle?.isChecked = DebugNotifications.isCycling(context)
|
||||||
updatingCycle = false
|
updatingCycle = false
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,6 +9,21 @@
|
|||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:padding="@dimen/page_padding">
|
android:padding="@dimen/page_padding">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/one_ui_only_notice"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="Cards layout is available only on Samsung OneUI devices."
|
||||||
|
android:textAppearance="?attr/textAppearanceBody1"
|
||||||
|
android:textStyle="bold"
|
||||||
|
android:visibility="gone" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/one_ui_cards_controls"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
@@ -37,4 +52,5 @@
|
|||||||
android:id="@+id/aod_settings"
|
android:id="@+id/aod_settings"
|
||||||
layout="@layout/include_cards_grid_settings_aod" />
|
layout="@layout/include_cards_grid_settings_aod" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
</LinearLayout>
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
|
|||||||
@@ -9,6 +9,21 @@
|
|||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:padding="@dimen/page_padding">
|
android:padding="@dimen/page_padding">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/one_ui_only_notice"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="The following display options are available only on Samsung OneUI devices."
|
||||||
|
android:textAppearance="?attr/textAppearanceBody1"
|
||||||
|
android:textStyle="bold"
|
||||||
|
android:visibility="gone" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/one_ui_misc_controls"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
<com.google.android.material.switchmaterial.SwitchMaterial
|
<com.google.android.material.switchmaterial.SwitchMaterial
|
||||||
android:id="@+id/keep_aod_visible_during_calls"
|
android:id="@+id/keep_aod_visible_during_calls"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
@@ -28,6 +43,7 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="24dp"
|
android:layout_marginTop="24dp"
|
||||||
android:text="@string/show_aod_battery_percent" />
|
android:text="@string/show_aod_battery_percent" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
|||||||
Reference in New Issue
Block a user