[Android] Show a message when Safe mode is re-enabled

Nicolas Pomepuy git at videolan.org
Wed Jul 12 08:30:37 UTC 2023


vlc-android | branch: master | Nicolas Pomepuy <nicolas at videolabs.io> | Thu Jul  6 07:48:37 2023 +0200| [655b116c948a9f9a66c926e985fa8b84baaa043f] | committer: Duncan McNamara

Show a message when Safe mode is re-enabled

> https://code.videolan.org/videolan/vlc-android/commit/655b116c948a9f9a66c926e985fa8b84baaa043f
---

 application/resources/src/main/res/values/strings.xml            | 1 +
 application/vlc-android/res/menu/activity_option.xml             | 2 +-
 application/vlc-android/res/menu/playlist_option.xml             | 2 +-
 application/vlc-android/res/menu/video_group.xml                 | 2 +-
 application/vlc-android/src/org/videolan/vlc/gui/BaseActivity.kt | 7 ++++---
 5 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/application/resources/src/main/res/values/strings.xml b/application/resources/src/main/res/values/strings.xml
index 2e26980647..416399a766 100644
--- a/application/resources/src/main/res/values/strings.xml
+++ b/application/resources/src/main/res/values/strings.xml
@@ -975,6 +975,7 @@
     <string name="pin_code_modified">PIN code successfully modified</string>
     <string name="pin_code_reason_check">Access restricted. Please enter your PIN code</string>
     <string name="pin_code_access_granted">Access granted. You can re-lock in the main screen</string>
+    <string name="safe_mode_enabled">Safe mode is now enabled</string>
     <string name="restricted_access">Access restricted</string>
     <string name="unlock">Unlock</string>
     <string name="lock_with_pin">Re-enable PIN lock</string>
diff --git a/application/vlc-android/res/menu/activity_option.xml b/application/vlc-android/res/menu/activity_option.xml
index b26919d5f9..478f4c9ff3 100644
--- a/application/vlc-android/res/menu/activity_option.xml
+++ b/application/vlc-android/res/menu/activity_option.xml
@@ -4,7 +4,7 @@
 
     <item
             android:orderInCategory="0"
-            android:id="@+id/pin_unlocked"
+            android:id="@+id/pin_relocked"
             android:icon="@drawable/ic_am_pin_lock"
             android:title="@string/lock_with_pin"
             vlc:showAsAction="always"
diff --git a/application/vlc-android/res/menu/playlist_option.xml b/application/vlc-android/res/menu/playlist_option.xml
index 1ae5cb3d8b..1c973e71c9 100644
--- a/application/vlc-android/res/menu/playlist_option.xml
+++ b/application/vlc-android/res/menu/playlist_option.xml
@@ -26,7 +26,7 @@
         xmlns:app="http://schemas.android.com/apk/res-auto">
     <item
             android:orderInCategory="0"
-            android:id="@+id/pin_unlocked"
+            android:id="@+id/pin_relocked"
             android:icon="@drawable/ic_am_pin_lock"
             android:title="@string/lock_with_pin"
             app:showAsAction="always"
diff --git a/application/vlc-android/res/menu/video_group.xml b/application/vlc-android/res/menu/video_group.xml
index 72b73231d4..e83d8363c4 100644
--- a/application/vlc-android/res/menu/video_group.xml
+++ b/application/vlc-android/res/menu/video_group.xml
@@ -3,7 +3,7 @@
     xmlns:vlc="http://schemas.android.com/apk/res-auto" >
     <item
             android:orderInCategory="0"
-            android:id="@+id/pin_unlocked"
+            android:id="@+id/pin_relocked"
             android:icon="@drawable/ic_am_pin_lock"
             android:title="@string/lock_with_pin"
             vlc:showAsAction="always"
diff --git a/application/vlc-android/src/org/videolan/vlc/gui/BaseActivity.kt b/application/vlc-android/src/org/videolan/vlc/gui/BaseActivity.kt
index a3cfcfa677..c5527728ba 100644
--- a/application/vlc-android/src/org/videolan/vlc/gui/BaseActivity.kt
+++ b/application/vlc-android/src/org/videolan/vlc/gui/BaseActivity.kt
@@ -81,7 +81,7 @@ abstract class BaseActivity : AppCompatActivity() {
                 lifecycleScope.launch(Dispatchers.IO) {
                     delay(500)
                     lifecycleScope.launchWhenStarted {
-                        findViewById<View?>(R.id.pin_unlocked)?.performLongClick()
+                        findViewById<View?>(R.id.pin_relocked)?.performLongClick()
                         PinCodeDelegate.tipShown = true
                     }
                 }
@@ -90,7 +90,7 @@ abstract class BaseActivity : AppCompatActivity() {
     }
 
     override fun onPrepareOptionsMenu(menu: Menu?): Boolean {
-        val unlockedItem = menu?.findItem(R.id.pin_unlocked)
+        val unlockedItem = menu?.findItem(R.id.pin_relocked)
         if (unlockedItem != null) {
             unlockedItem.isVisible = PinCodeDelegate.pinUnlocked.value == true
         }
@@ -98,8 +98,9 @@ abstract class BaseActivity : AppCompatActivity() {
     }
 
     override fun onOptionsItemSelected(item: MenuItem): Boolean {
-        if (item.itemId == R.id.pin_unlocked) {
+        if (item.itemId == R.id.pin_relocked) {
             PinCodeDelegate.pinUnlocked.postValue(false)
+            UiTools.snacker(this, R.string.safe_mode_enabled)
             return true
         }
         return super.onOptionsItemSelected(item)



More information about the Android mailing list