Pārlūkot izejas kodu

Hide encrypt & decrypt when the current file is not pdf

GameJob 4 gadi atpakaļ
vecāks
revīzija
810e5d0bd7
1 mainītis faili ar 11 papildinājumiem un 6 dzēšanām
  1. 11 6
      src/main/java/com/kdanmobile/reader/ReaderActivity.kt

+ 11 - 6
src/main/java/com/kdanmobile/reader/ReaderActivity.kt

@@ -318,12 +318,17 @@ abstract class ReaderActivity :
             }
             menuItemBookmark?.isVisible = false
         }
-        if (isPdf()) {
-            menu?.apply {
-                when (password.isEmpty()) {
-                    true -> findItem(R.id.item_reader_more_decrypt)
-                    false -> findItem(R.id.item_reader_more_encrypt)
-                }?.isVisible = false
+        menu?.apply {
+            val isPdf = isPdf()
+            when (password.isEmpty()) {
+                true -> {
+                    findItem(R.id.item_reader_more_encrypt)?.isVisible = isPdf
+                    findItem(R.id.item_reader_more_decrypt)?.isVisible = false
+                }
+                false -> {
+                    findItem(R.id.item_reader_more_encrypt)?.isVisible = false
+                    findItem(R.id.item_reader_more_decrypt)?.isVisible = isPdf
+                }
             }
         }
         if (!isIBonPrintEnabled()) {