|
@@ -62,6 +62,9 @@ abstract class ReaderActivity : AppCompatActivity() {
|
|
abstract fun transferThumbIntent(): Intent
|
|
abstract fun transferThumbIntent(): Intent
|
|
abstract fun provideReaderSettingDialogFragment(): ReaderSettingDialogFragment
|
|
abstract fun provideReaderSettingDialogFragment(): ReaderSettingDialogFragment
|
|
|
|
|
|
|
|
+ open fun saveCurrentPageIndex(filename: String, currentPage: Int) {}
|
|
|
|
+ open fun loadCurrentPageIndex(filename: String, defaultValue: Int): Int = 0
|
|
|
|
+
|
|
companion object {
|
|
companion object {
|
|
const val KEY_FILE_ABSOLUTE = "file_absolutepath"
|
|
const val KEY_FILE_ABSOLUTE = "file_absolutepath"
|
|
const val THUMB = 221
|
|
const val THUMB = 221
|
|
@@ -131,6 +134,7 @@ abstract class ReaderActivity : AppCompatActivity() {
|
|
setContentView(R.layout.activity_reader)
|
|
setContentView(R.layout.activity_reader)
|
|
setSupportActionBar(toolbar_readerActivity)
|
|
setSupportActionBar(toolbar_readerActivity)
|
|
isShowPasswordActivity = savedInstanceState?.getBoolean("isShowPasswordActivity") ?: false
|
|
isShowPasswordActivity = savedInstanceState?.getBoolean("isShowPasswordActivity") ?: false
|
|
|
|
+ filePath = savedInstanceState?.getString("filePath")
|
|
|
|
|
|
val displayMetrics = DisplayMetrics()
|
|
val displayMetrics = DisplayMetrics()
|
|
windowManager.defaultDisplay.getMetrics(displayMetrics)
|
|
windowManager.defaultDisplay.getMetrics(displayMetrics)
|
|
@@ -190,6 +194,7 @@ abstract class ReaderActivity : AppCompatActivity() {
|
|
override fun onSaveInstanceState(outState: Bundle?) {
|
|
override fun onSaveInstanceState(outState: Bundle?) {
|
|
super.onSaveInstanceState(outState)
|
|
super.onSaveInstanceState(outState)
|
|
outState?.putBoolean("isShowPasswordActivity", isShowPasswordActivity)
|
|
outState?.putBoolean("isShowPasswordActivity", isShowPasswordActivity)
|
|
|
|
+ outState?.putString("filePath", filePath)
|
|
}
|
|
}
|
|
|
|
|
|
private fun requestPassword(isIncorrectPassword: Boolean = false) {
|
|
private fun requestPassword(isIncorrectPassword: Boolean = false) {
|
|
@@ -397,7 +402,11 @@ abstract class ReaderActivity : AppCompatActivity() {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
viewModel.setReaderView(readerView)
|
|
viewModel.setReaderView(readerView)
|
|
- viewModel.pdfInfoHandler.setCurrentPage(viewModel.pageIndexLiveData.value ?: 0)
|
|
|
|
|
|
+ if (!filePath.isNullOrEmpty()) {
|
|
|
|
+ val defaultValue = viewModel.pageIndexLiveData.value ?: 0
|
|
|
|
+ val pageIndex = loadCurrentPageIndex(filePath as String, defaultValue)
|
|
|
|
+ viewModel.pdfInfoHandler.setCurrentPage(pageIndex)
|
|
|
|
+ }
|
|
initTextBoxContextMenuActions()
|
|
initTextBoxContextMenuActions()
|
|
container.addView(readerView)
|
|
container.addView(readerView)
|
|
if (SharePrefsModel(this).isCropModeEnable.value == true) {
|
|
if (SharePrefsModel(this).isCropModeEnable.value == true) {
|
|
@@ -439,6 +448,9 @@ abstract class ReaderActivity : AppCompatActivity() {
|
|
override fun onStop() {
|
|
override fun onStop() {
|
|
viewModel.saveModifyingAnnotation()
|
|
viewModel.saveModifyingAnnotation()
|
|
viewModel.temporarySave()
|
|
viewModel.temporarySave()
|
|
|
|
+ if (!filePath.isNullOrEmpty()) {
|
|
|
|
+ saveCurrentPageIndex(filePath as String, currentPageIndex)
|
|
|
|
+ }
|
|
super.onStop()
|
|
super.onStop()
|
|
}
|
|
}
|
|
|
|
|