forked from FolioReader/FolioReader-Android
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2815834
commit 71be31b
Showing
4 changed files
with
65 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
folioreader/src/main/java/com/folioreader/ui/activity/FolioActivityCallback.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
folioreader/src/main/java/com/folioreader/util/DefaultReadLocatorManager.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package com.folioreader.util | ||
|
||
import android.content.Context | ||
import com.folioreader.Constants | ||
import com.folioreader.model.locators.ReadLocator | ||
|
||
class DefaultReadLocatorManager(private val context: Context) : ReadLocatorListener { | ||
override fun saveReadLocator(readLocator: ReadLocator?) { | ||
val locator = readLocator ?: return | ||
SharedPreferenceUtil.putSharedPreferencesString( | ||
context, | ||
Constants.LAST_READ_LOCATOR, | ||
readLocator.toJson() | ||
) | ||
} | ||
|
||
fun getLastReadLocator(): ReadLocator? { | ||
return ReadLocator.fromJson( | ||
SharedPreferenceUtil.getSharedPreferencesString( | ||
context, | ||
Constants.LAST_READ_LOCATOR, | ||
null | ||
) | ||
) | ||
} | ||
} |