Skip to content

Commit dd68541

Browse files
committed
Add debug toggle for audiobook battery optimizer dialog.
1 parent dd95da5 commit dd68541

2 files changed

Lines changed: 20 additions & 0 deletions

File tree

palace-ui/src/main/java/org/nypl/simplified/ui/settings/SettingsDebugMenuStartupFragment.kt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ class SettingsDebugMenuStartupFragment :
3333
return BACK_BUTTON_CONSUMED
3434
}
3535

36+
private lateinit var hasSeenAudiobookBatteryDialog: SwitchCompat
3637
private lateinit var hasSeenLibrarySelector: SwitchCompat
3738
private lateinit var hasSeenNotifications: SwitchCompat
3839
private lateinit var failNextBoot: SwitchCompat
@@ -72,5 +73,13 @@ class SettingsDebugMenuStartupFragment :
7273
this.hasSeenLibrarySelector.setOnCheckedChangeListener { _, checked ->
7374
SettingsDebugModel.updatePreferences { p -> p.copy(hasSeenLibrarySelectionScreen = checked) }
7475
}
76+
77+
this.hasSeenAudiobookBatteryDialog =
78+
view.findViewById(R.id.debugStartupShowAudiobookBatteryDialog)
79+
this.hasSeenAudiobookBatteryDialog.isChecked =
80+
SettingsDebugModel.hasSeenLibrarySelection()
81+
this.hasSeenAudiobookBatteryDialog.setOnCheckedChangeListener { _, checked ->
82+
SettingsDebugModel.updatePreferences { p -> p.copy(audioBookBatteryDialogAccepted = checked) }
83+
}
7584
}
7685
}

palace-ui/src/main/res/layout/debug_startup.xml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,4 +95,15 @@
9595
android:enabled="true"
9696
android:text="User has seen the library selector on startup?" />
9797

98+
<androidx.appcompat.widget.SwitchCompat
99+
android:id="@+id/debugStartupShowAudiobookBatteryDialog"
100+
android:layout_width="match_parent"
101+
android:layout_height="wrap_content"
102+
android:layout_marginStart="16dp"
103+
android:layout_marginEnd="16dp"
104+
android:layout_marginTop="16dp"
105+
android:checked="false"
106+
android:enabled="true"
107+
android:text="User has accepted the audiobook battery dialog?" />
108+
98109
</LinearLayout>

0 commit comments

Comments
 (0)