Aperture: Add Lock icon if secured with no secure photo
Change-Id: I9e31ad58f3b213e168a5ff9b9b61db0741d826de
diff --git a/app/src/main/java/org/lineageos/aperture/MainActivity.kt b/app/src/main/java/org/lineageos/aperture/MainActivity.kt
index 446ff13..7db0cff 100644
--- a/app/src/main/java/org/lineageos/aperture/MainActivity.kt
+++ b/app/src/main/java/org/lineageos/aperture/MainActivity.kt
@@ -178,14 +178,19 @@
}
}
+ galleryButton.setOnClickListener { openGallery() }
+
+ cameraExecutor = Executors.newSingleThreadExecutor()
+ }
+
+ override fun onResume() {
+ super.onResume()
+
// Special case: we want to enable the gallery by default if
// we have at least one saved Uri and we aren't locked
sharedPreferences.lastSavedUri?.let {
updateGalleryButton(it, !keyguardManager.isKeyguardLocked)
}
- galleryButton.setOnClickListener { openGallery() }
-
- cameraExecutor = Executors.newSingleThreadExecutor()
}
override fun onDestroy() {
@@ -714,7 +719,6 @@
}
private fun updateGalleryButton(uri: Uri?, enable: Boolean = true) {
- galleryButton.clearColorFilter()
if (uri != null && enable) {
getThumbnail(uri)?.let {
runOnUiThread {
@@ -724,12 +728,10 @@
galleryButton.isEnabled = true
} else if (keyguardManager.isKeyguardLocked) {
// Mimic disable for now
- galleryButton.clearColorFilter()
- galleryButton.setColorFilter(getColor(R.color.dark_grey))
+ galleryButton.setImageResource(R.drawable.ic_lock)
galleryButton.isEnabled = false
} else {
- galleryButton.clearColorFilter()
- galleryButton.setColorFilter(getColor(R.color.dark_grey))
+ galleryButton.setImageResource(0)
galleryButton.isEnabled = false
}
}
diff --git a/app/src/main/res/drawable/ic_lock.xml b/app/src/main/res/drawable/ic_lock.xml
new file mode 100644
index 0000000..17523bf
--- /dev/null
+++ b/app/src/main/res/drawable/ic_lock.xml
@@ -0,0 +1,10 @@
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="28dp"
+ android:height="28dp"
+ android:tint="#000000"
+ android:viewportWidth="48"
+ android:viewportHeight="48">
+ <path
+ android:fillColor="@android:color/white"
+ android:pathData="M11,44Q9.75,44 8.875,43.125Q8,42.25 8,41V19.3Q8,18.05 8.875,17.175Q9.75,16.3 11,16.3H14.5V11.5Q14.5,7.55 17.275,4.775Q20.05,2 24,2Q27.95,2 30.725,4.775Q33.5,7.55 33.5,11.5V16.3H37Q38.25,16.3 39.125,17.175Q40,18.05 40,19.3V41Q40,42.25 39.125,43.125Q38.25,44 37,44ZM11,41H37Q37,41 37,41Q37,41 37,41V19.3Q37,19.3 37,19.3Q37,19.3 37,19.3H11Q11,19.3 11,19.3Q11,19.3 11,19.3V41Q11,41 11,41Q11,41 11,41ZM24,34Q25.6,34 26.725,32.9Q27.85,31.8 27.85,30.25Q27.85,28.75 26.725,27.525Q25.6,26.3 24,26.3Q22.4,26.3 21.275,27.525Q20.15,28.75 20.15,30.25Q20.15,31.8 21.275,32.9Q22.4,34 24,34ZM17.5,16.3H30.5V11.5Q30.5,8.8 28.6,6.9Q26.7,5 24,5Q21.3,5 19.4,6.9Q17.5,8.8 17.5,11.5ZM11,41Q11,41 11,41Q11,41 11,41V19.3Q11,19.3 11,19.3Q11,19.3 11,19.3Q11,19.3 11,19.3Q11,19.3 11,19.3V41Q11,41 11,41Q11,41 11,41Z" />
+</vector>
diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml
index cee9049..1be3332 100644
--- a/app/src/main/res/layout/activity_main.xml
+++ b/app/src/main/res/layout/activity_main.xml
@@ -207,8 +207,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:contentDescription="@string/gallery_button_description"
- android:scaleType="centerCrop"
- app:srcCompat="@drawable/ic_gallery_empty" />
+ android:scaleType="centerCrop" />
</androidx.cardview.widget.CardView>
<androidx.constraintlayout.widget.ConstraintLayout