瀏覽代碼

Hide encrypt & decrypt when the current file is not pdf

GameJob 4 年之前
父節點
當前提交
810e5d0bd7
共有 1 個文件被更改,包括 11 次插入6 次删除
  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()) {