|
@@ -6,15 +6,15 @@ import android.arch.lifecycle.ViewModelProviders
|
|
import android.content.Intent
|
|
import android.content.Intent
|
|
import android.net.Uri
|
|
import android.net.Uri
|
|
import android.os.Build
|
|
import android.os.Build
|
|
-import android.support.v7.app.AppCompatActivity
|
|
|
|
import android.os.Bundle
|
|
import android.os.Bundle
|
|
import android.support.constraint.ConstraintLayout
|
|
import android.support.constraint.ConstraintLayout
|
|
import android.support.constraint.ConstraintSet
|
|
import android.support.constraint.ConstraintSet
|
|
import android.support.v4.content.ContextCompat
|
|
import android.support.v4.content.ContextCompat
|
|
import android.support.v7.app.AlertDialog
|
|
import android.support.v7.app.AlertDialog
|
|
|
|
+import android.support.v7.app.AppCompatActivity
|
|
|
|
+import android.util.DisplayMetrics
|
|
import android.view.Menu
|
|
import android.view.Menu
|
|
import android.view.MenuItem
|
|
import android.view.MenuItem
|
|
-import android.util.DisplayMetrics
|
|
|
|
import android.view.MotionEvent
|
|
import android.view.MotionEvent
|
|
import android.view.View
|
|
import android.view.View
|
|
import android.widget.EditText
|
|
import android.widget.EditText
|
|
@@ -22,16 +22,15 @@ import android.widget.LinearLayout
|
|
import android.widget.TextView
|
|
import android.widget.TextView
|
|
import com.kdanmobile.kmpdfkit.pdfcommon.KMPDFReaderView
|
|
import com.kdanmobile.kmpdfkit.pdfcommon.KMPDFReaderView
|
|
import com.kdanmobile.reader.Utils.applyConstraintSet
|
|
import com.kdanmobile.reader.Utils.applyConstraintSet
|
|
-import com.kdanmobile.reader.utils.AnimationUtil
|
|
|
|
-import com.kdanmobile.reader.utils.DensityUtil
|
|
|
|
import com.kdanmobile.reader.screen.ViewerSettingActivity
|
|
import com.kdanmobile.reader.screen.ViewerSettingActivity
|
|
import com.kdanmobile.reader.screen.view.*
|
|
import com.kdanmobile.reader.screen.view.*
|
|
import com.kdanmobile.reader.screen.view.edit.ShapeTabView
|
|
import com.kdanmobile.reader.screen.view.edit.ShapeTabView
|
|
import com.kdanmobile.reader.screen.view.edit.SignatureTabView
|
|
import com.kdanmobile.reader.screen.view.edit.SignatureTabView
|
|
import com.kdanmobile.reader.screen.view.edit.StampTabView
|
|
import com.kdanmobile.reader.screen.view.edit.StampTabView
|
|
import com.kdanmobile.reader.screen.view.edit.TextBoxTabView
|
|
import com.kdanmobile.reader.screen.view.edit.TextBoxTabView
|
|
|
|
+import com.kdanmobile.reader.utils.AnimationUtil
|
|
|
|
+import com.kdanmobile.reader.utils.DensityUtil
|
|
import kotlinx.android.synthetic.main.activity_reader.*
|
|
import kotlinx.android.synthetic.main.activity_reader.*
|
|
-import kotlin.Exception
|
|
|
|
|
|
|
|
abstract class ReaderActivity : AppCompatActivity() {
|
|
abstract class ReaderActivity : AppCompatActivity() {
|
|
|
|
|
|
@@ -99,6 +98,13 @@ abstract class ReaderActivity : AppCompatActivity() {
|
|
viewModel.isPageInBookmarksLiveData.observe(this, Observer(this::onIsPageInBookmarksChanged))
|
|
viewModel.isPageInBookmarksLiveData.observe(this, Observer(this::onIsPageInBookmarksChanged))
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ override fun onBackPressed() {
|
|
|
|
+ when {
|
|
|
|
+ viewerEditView.isShown -> viewerEditView.dismiss()
|
|
|
|
+ else -> super.onBackPressed()
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
override fun onCreateOptionsMenu(menu: Menu?): Boolean {
|
|
override fun onCreateOptionsMenu(menu: Menu?): Boolean {
|
|
menuInflater.inflate(R.menu.reader_more, menu)
|
|
menuInflater.inflate(R.menu.reader_more, menu)
|
|
menuItemBookmark = menu?.findItem(R.id.item_reader_bookmark)
|
|
menuItemBookmark = menu?.findItem(R.id.item_reader_bookmark)
|
|
@@ -329,10 +335,6 @@ abstract class ReaderActivity : AppCompatActivity() {
|
|
alertDialogBuilder.create().show()
|
|
alertDialogBuilder.create().show()
|
|
}
|
|
}
|
|
|
|
|
|
- private fun showMediaBox() {
|
|
|
|
- viewerEditView.show()
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
private fun hideSearchViewSoftKeyboard() {
|
|
private fun hideSearchViewSoftKeyboard() {
|
|
val view = linearLayout_readerActivity_leftToolbarContainer.getChildAt(0)
|
|
val view = linearLayout_readerActivity_leftToolbarContainer.getChildAt(0)
|
|
if (view is SearchView) {
|
|
if (view is SearchView) {
|
|
@@ -356,7 +358,7 @@ abstract class ReaderActivity : AppCompatActivity() {
|
|
}
|
|
}
|
|
|
|
|
|
private fun setupBottomToolbar() {
|
|
private fun setupBottomToolbar() {
|
|
- ib_readerActivity_bottomToolbarMediaBox.setOnClickListener { showMediaBox() }
|
|
|
|
|
|
+ ib_readerActivity_bottomToolbarMediaBox.setOnClickListener { viewerEditView.show() }
|
|
}
|
|
}
|
|
|
|
|
|
private fun setupViewerEditView() {
|
|
private fun setupViewerEditView() {
|