@@ -41,6 +41,10 @@ import com.sameerasw.essentials.ui.composables.configs.CaffeinateSettingsUI
4141import com.sameerasw.essentials.ui.composables.configs.ScreenOffWidgetSettingsUI
4242import com.sameerasw.essentials.ui.composables.configs.EdgeLightingSettingsUI
4343import com.sameerasw.essentials.ui.composables.configs.SoundModeTileSettingsUI
44+ import com.sameerasw.essentials.ui.composables.configs.QuickSettingsTilesSettingsUI
45+ import com.sameerasw.essentials.ui.composables.configs.FlashlightSettingsUI
46+ import com.sameerasw.essentials.ui.composables.configs.DynamicNightLightSettingsUI
47+ import com.sameerasw.essentials.ui.composables.configs.SnoozeNotificationsSettingsUI
4448import com.sameerasw.essentials.viewmodels.CaffeinateViewModel
4549import com.sameerasw.essentials.viewmodels.MainViewModel
4650import com.sameerasw.essentials.viewmodels.StatusBarIconViewModel
@@ -60,7 +64,11 @@ class FeatureSettingsActivity : ComponentActivity() {
6064 " Caffeinate" to " Keep the screen awake" ,
6165 " Edge lighting" to " Preview edge lighting effects on new notifications" ,
6266 " Sound mode tile" to " QS tile to toggle sound mode" ,
63- " Link actions" to " Handle links with multiple apps"
67+ " Link actions" to " Handle links with multiple apps" ,
68+ " Flashlight toggle" to " Toggle flashlight while screen off" ,
69+ " Dynamic night light" to " Toggle based on current app" ,
70+ " Snooze system notifications" to " Automatically snooze persistent notifications" ,
71+ " Quick Settings Tiles" to " All available QS tiles"
6472 )
6573 val description = featureDescriptions[feature] ? : " "
6674 setContent {
@@ -105,6 +113,9 @@ class FeatureSettingsActivity : ComponentActivity() {
105113 " Screen off widget" -> ! isAccessibilityEnabled
106114 " Statusbar icons" -> ! isWriteSecureSettingsEnabled
107115 " Edge lighting" -> ! isOverlayPermissionGranted || ! isEdgeLightingAccessibilityEnabled || ! isNotificationListenerEnabled
116+ " Flashlight toggle" -> ! isAccessibilityEnabled
117+ " Dynamic night light" -> ! isAccessibilityEnabled || ! isWriteSecureSettingsEnabled
118+ " Snooze system notifications" -> ! isNotificationListenerEnabled
108119 else -> false
109120 }
110121 showPermissionSheet = hasMissingPermissions
@@ -182,6 +193,65 @@ class FeatureSettingsActivity : ComponentActivity() {
182193 isGranted = isNotificationListenerEnabled
183194 )
184195 )
196+ " Flashlight toggle" -> listOf (
197+ PermissionItem (
198+ iconRes = R .drawable.rounded_settings_accessibility_24,
199+ title = " Accessibility Service" ,
200+ description = " Required to intercept volume button presses when the screen is off" ,
201+ dependentFeatures = PermissionRegistry .getFeatures(" ACCESSIBILITY" ),
202+ actionLabel = " Enable in Settings" ,
203+ action = {
204+ val intent = Intent (Settings .ACTION_ACCESSIBILITY_SETTINGS )
205+ intent.flags = Intent .FLAG_ACTIVITY_NEW_TASK
206+ context.startActivity(intent)
207+ },
208+ isGranted = isAccessibilityEnabled
209+ )
210+ )
211+ " Dynamic night light" -> listOf (
212+ PermissionItem (
213+ iconRes = R .drawable.rounded_settings_accessibility_24,
214+ title = " Accessibility Service" ,
215+ description = " Needed to monitor foreground applications." ,
216+ dependentFeatures = PermissionRegistry .getFeatures(" ACCESSIBILITY" ),
217+ actionLabel = " Enable Service" ,
218+ action = {
219+ val intent = Intent (Settings .ACTION_ACCESSIBILITY_SETTINGS )
220+ intent.flags = Intent .FLAG_ACTIVITY_NEW_TASK
221+ context.startActivity(intent)
222+ },
223+ isGranted = isAccessibilityEnabled
224+ ),
225+ PermissionItem (
226+ iconRes = R .drawable.rounded_security_24,
227+ title = " Write Secure Settings" ,
228+ description = " Needed to toggle Night Light. Grant via ADB or root." ,
229+ dependentFeatures = PermissionRegistry .getFeatures(" WRITE_SECURE_SETTINGS" ),
230+ actionLabel = " Copy ADB" ,
231+ action = {
232+ val adbCommand = " adb shell pm grant com.sameerasw.essentials android.permission.WRITE_SECURE_SETTINGS"
233+ val clipboard = context.getSystemService(Context .CLIPBOARD_SERVICE ) as ClipboardManager
234+ val clip = ClipData .newPlainText(" adb_command" , adbCommand)
235+ clipboard.setPrimaryClip(clip)
236+ },
237+ secondaryActionLabel = " Check" ,
238+ secondaryAction = {
239+ viewModel.isWriteSecureSettingsEnabled.value = viewModel.canWriteSecureSettings(context)
240+ },
241+ isGranted = isWriteSecureSettingsEnabled
242+ )
243+ )
244+ " Snooze system notifications" -> listOf (
245+ PermissionItem (
246+ iconRes = R .drawable.rounded_snooze_24,
247+ title = " Notification Listener" ,
248+ description = " Required to detect and snooze notifications" ,
249+ dependentFeatures = PermissionRegistry .getFeatures(" NOTIFICATION_LISTENER" ),
250+ actionLabel = if (isNotificationListenerEnabled) " Permission granted" else " Grant listener" ,
251+ action = { viewModel.requestNotificationListenerPermission(context) },
252+ isGranted = isNotificationListenerEnabled
253+ )
254+ )
185255 else -> emptyList()
186256 }
187257
@@ -253,6 +323,29 @@ class FeatureSettingsActivity : ComponentActivity() {
253323 " Sound mode tile" -> {
254324 SoundModeTileSettingsUI (modifier = Modifier .padding(top = 16 .dp))
255325 }
326+ " Flashlight toggle" -> {
327+ FlashlightSettingsUI (
328+ viewModel = viewModel,
329+ modifier = Modifier .padding(top = 16 .dp)
330+ )
331+ }
332+ " Dynamic night light" -> {
333+ DynamicNightLightSettingsUI (
334+ viewModel = viewModel,
335+ modifier = Modifier .padding(top = 16 .dp)
336+ )
337+ }
338+ " Snooze system notifications" -> {
339+ SnoozeNotificationsSettingsUI (
340+ viewModel = viewModel,
341+ modifier = Modifier .padding(top = 16 .dp)
342+ )
343+ }
344+ " Quick Settings Tiles" -> {
345+ QuickSettingsTilesSettingsUI (
346+ modifier = Modifier .padding(top = 16 .dp)
347+ )
348+ }
256349 " Link actions" -> {
257350 setContent {
258351 EssentialsTheme {
0 commit comments