|
@@ -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()
|
|
|
}
|
|
|
}
|
|
|
|