diff --git a/app/src/main/java/com/artemchep/pocketmode/ui/activities/MainActivity.kt b/app/src/main/java/com/artemchep/pocketmode/ui/activities/MainActivity.kt index a191dec..a85fc7c 100644 --- a/app/src/main/java/com/artemchep/pocketmode/ui/activities/MainActivity.kt +++ b/app/src/main/java/com/artemchep/pocketmode/ui/activities/MainActivity.kt @@ -7,7 +7,6 @@ import android.util.TypedValue import android.view.View import android.widget.SeekBar import androidx.browser.customtabs.CustomTabsIntent -import androidx.core.graphics.ColorUtils import androidx.core.net.toUri import androidx.core.view.* import androidx.lifecycle.Observer @@ -26,6 +25,7 @@ import com.artemchep.pocketmode.models.Proximity import com.artemchep.pocketmode.ui.activities.base.BaseActivity import com.artemchep.pocketmode.util.ObserverConsumer import com.artemchep.pocketmode.viewmodels.MainViewModel +import com.google.android.material.dialog.MaterialAlertDialogBuilder /** @@ -426,7 +426,16 @@ class MainActivity : BaseActivity(), R.id.labBtn -> mainViewModel.openLab() R.id.moreAppsBtn -> mainViewModel.openApps() // Permissions - R.id.accessibilityServiceBtn -> mainViewModel.grantAccessibilityService() + R.id.accessibilityServiceBtn -> MaterialAlertDialogBuilder(this) + .setTitle(R.string.access_accessibility_service_dialog_text) + .setMessage(R.string.access_accessibility_service_dialog_text) + .setNegativeButton(R.string.access_accessibility_service_dialog_no, null) + .setPositiveButton( + R.string.access_accessibility_service_dialog_yes, + ) { _, _ -> + mainViewModel.grantAccessibilityService() + } + .show() R.id.callStateBtn -> mainViewModel.grantCallState() } } diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index da54fa8..a4100a2 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -15,6 +15,10 @@ Permissions Pocket Mode uses accessibility service to send the command that locks the screen. Tap to grant accessibility service privileges + How do we use accessibility service + Pocket Mode uses accessibility service to send the command that locks the screen. Without it locking the screen would require a PIN code on each unlock, ruining the user experience. + Close + Enable accessibility service Pocket Mode reads call state to not turn screen off while call is active. Tap to grant call state privileges Pocket Mode can draw overlay on top of the user apps to show user that the proximity sensor is covered.