Browse Source

Refactor: rename

cooperku_kdanmobile 5 years ago
parent
commit
7822be65a0

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

@@ -537,10 +537,10 @@ abstract class ReaderActivity :
     }
 
     fun removeAdditionalPages() {
-        if (additionalPageManager.displayStrategyType == DisplayStrategyType.HIDE) return
+        if (additionalPageManager.displayStrategyType == AdditionalPageDisplayStrategyType.HIDE) return
         val handler = viewModel.pdfInfoHandler
         val pageIndex = currentPageIndex
-        additionalPageManager.displayStrategyType = DisplayStrategyType.HIDE
+        additionalPageManager.displayStrategyType = AdditionalPageDisplayStrategyType.HIDE
         viewModel.getReaderView()?.refresh(true)
         handler.goToCurrentPage(pageIndex)
     }

+ 1 - 1
src/main/java/com/kdanmobile/reader/additionalpage/AdditionalPageDisplayStrategy.kt

@@ -9,7 +9,7 @@ import android.util.SparseBooleanArray
 interface AdditionalPageDisplayStrategy {
 
     //  額外頁面顯示策略類型
-    var displayStrategyType: DisplayStrategyType
+    var displayStrategyType: AdditionalPageDisplayStrategyType
 
     /**
      * 判斷第position頁是否能顯示額外頁面

+ 6 - 6
src/main/java/com/kdanmobile/reader/additionalpage/AdditionalPageDisplayStrategyImpl.kt

@@ -9,7 +9,7 @@ import kotlin.math.abs
  * 額外頁面創建成功後,需符合當前顯示策略類型時才會顯示該額外頁面
  */
 class AdditionalPageDisplayStrategyImpl(
-        override var displayStrategyType: DisplayStrategyType = DisplayStrategyType.PAGE_INTERVAL,
+        override var displayStrategyType: AdditionalPageDisplayStrategyType = AdditionalPageDisplayStrategyType.PAGE_INTERVAL,
         //  至少每隔幾頁(包含額外頁面)才可以顯示廣告
         @IntRange(from = 4) private val pageInterval: Int = DEFAULT_PAGE_INTERVAL,
         //  至少每隔幾秒才可以顯示廣告
@@ -33,11 +33,11 @@ class AdditionalPageDisplayStrategyImpl(
      */
     override fun canDisplayAdditionalPageAt(additionalPageVisibleSet: SparseBooleanArray, position: Int): Boolean {
         return when (displayStrategyType) {
-            DisplayStrategyType.HIDE -> false
-            DisplayStrategyType.PAGE_INTERVAL -> isPageStrategyValid(additionalPageVisibleSet, position)
-            DisplayStrategyType.TIME_INTERVAL -> isTimeStrategyValid()
-            DisplayStrategyType.PAGE_OR_TIME_INTERVAL -> isPageStrategyValid(additionalPageVisibleSet, position) || isTimeStrategyValid()
-            DisplayStrategyType.PAGE_AND_TIME_INTERVAL -> isPageStrategyValid(additionalPageVisibleSet, position) && isTimeStrategyValid()
+            AdditionalPageDisplayStrategyType.HIDE -> false
+            AdditionalPageDisplayStrategyType.PAGE_INTERVAL -> isPageStrategyValid(additionalPageVisibleSet, position)
+            AdditionalPageDisplayStrategyType.TIME_INTERVAL -> isTimeStrategyValid()
+            AdditionalPageDisplayStrategyType.PAGE_OR_TIME_INTERVAL -> isPageStrategyValid(additionalPageVisibleSet, position) || isTimeStrategyValid()
+            AdditionalPageDisplayStrategyType.PAGE_AND_TIME_INTERVAL -> isPageStrategyValid(additionalPageVisibleSet, position) && isTimeStrategyValid()
         }
     }
 

+ 1 - 1
src/main/java/com/kdanmobile/reader/additionalpage/AdditionalPageDisplayStrategyType.kt

@@ -4,7 +4,7 @@ package com.kdanmobile.reader.additionalpage
  * 額外頁面顯示策略類型
  * 額外頁面創建成功後,需符合當前顯示策略類型時才會顯示該額外頁面
  */
-enum class DisplayStrategyType {
+enum class AdditionalPageDisplayStrategyType {
     //  不顯示額外頁面,行為表現與未使用客製化的ReaderView前完全相同
     HIDE,
     //  每隔至少幾頁顯示一個額外頁面

+ 1 - 1
src/main/java/com/kdanmobile/reader/additionalpage/AdditionalPageManager.kt

@@ -16,7 +16,7 @@ interface AdditionalPageManager {
     val displayStrategy: AdditionalPageDisplayStrategy
 
     //  額外頁面顯示策略類型
-    var displayStrategyType: DisplayStrategyType
+    var displayStrategyType: AdditionalPageDisplayStrategyType
         get() {
             return displayStrategy.displayStrategyType
         }

+ 1 - 1
src/main/java/com/kdanmobile/reader/additionalpage/AdditionalPageManagerImpl.kt

@@ -46,7 +46,7 @@ class AdditionalPageManagerImpl(
 
     init {
         pageConverter.isAdditionalPageEnabled = {
-            displayStrategyType != DisplayStrategyType.HIDE
+            displayStrategyType != AdditionalPageDisplayStrategyType.HIDE
         }
     }