|
@@ -25,6 +25,7 @@ import android.view.View
|
|
|
import android.widget.EditText
|
|
|
import android.widget.LinearLayout
|
|
|
import android.widget.TextView
|
|
|
+import com.kdanmobile.kmpdfkit.globaldata.KMPDFAnnotEditMode
|
|
|
import com.kdanmobile.reader.annotationattribute.AnnotationAttribute
|
|
|
import com.kdanmobile.reader.annotationattribute.AnnotationColor
|
|
|
import com.kdanmobile.reader.annotationattribute.InkAttribute
|
|
@@ -99,6 +100,7 @@ abstract class ReaderActivity : AppCompatActivity() {
|
|
|
viewModel.isOpenedFileLiveData.observe(this, Observer(this::onIsOpenedFileUpdate))
|
|
|
viewModel.fileNameLiveData.observe(this, Observer { tv_readerActivity_title.text = it })
|
|
|
viewModel.annotationModeLiveData.observe(this, Observer(this::onAnnotationModeUpdate))
|
|
|
+ viewModel.annotationEitModeLiveData.observe(this, Observer(this::onAnnotationEditModeUpdate))
|
|
|
viewModel.isCopyModeLiveData.observe(this, Observer (this::onIsCopyModeUpdate))
|
|
|
viewModel.highLightAttributeLiveData.observe(this, Observer(this::onHighlightAttributeUpdate))
|
|
|
viewModel.strikeAttributeLiveData.observe(this, Observer(this::onStrikeAttributeUpdate))
|
|
@@ -239,6 +241,15 @@ abstract class ReaderActivity : AppCompatActivity() {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ private fun onAnnotationEditModeUpdate(mode: KMPDFAnnotEditMode.Mode?) {
|
|
|
+ println("onAnnotationEditModeUpdate KMPDFAnnotEditMode.Mode.$mode")
|
|
|
+ when (mode) {
|
|
|
+ KMPDFAnnotEditMode.Mode.NULL -> showAllToolbars()
|
|
|
+ KMPDFAnnotEditMode.Mode.FREETEXT_MODIFY, KMPDFAnnotEditMode.Mode.STAMP_MODIFY, KMPDFAnnotEditMode.Mode.SIGN_MODIFY, KMPDFAnnotEditMode.Mode.SHAPE_MODIFY -> hideAllToolbars()
|
|
|
+ else -> {}
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
private fun onIsOpenedFileUpdate(isOpened: Boolean?) {
|
|
|
if (isOpened == null) return
|
|
|
val container = viewGroup_readerActivity_container
|
|
@@ -275,7 +286,10 @@ abstract class ReaderActivity : AppCompatActivity() {
|
|
|
}
|
|
|
|
|
|
override fun onScroll(e1: MotionEvent?, e2: MotionEvent?, distanceX: Float, distanceY: Float): Boolean {
|
|
|
- if (!isHideToolbar) {
|
|
|
+ val isEditMode = viewModel.annotationModeLiveData.value != ReaderViewModel.AnnotationMode.None
|
|
|
+ val isCopyMode = viewModel.isCopyModeLiveData.value != false
|
|
|
+
|
|
|
+ if (!isEditMode && !isCopyMode && !isHideToolbar) {
|
|
|
hideAllToolbars()
|
|
|
isHideToolbar = true
|
|
|
}
|
|
@@ -283,6 +297,7 @@ abstract class ReaderActivity : AppCompatActivity() {
|
|
|
}
|
|
|
}
|
|
|
viewModel.setReaderView(readerView)
|
|
|
+ viewModel.pdfInfoHandler.setCurrentPage(viewModel.pageIndexLiveData.value ?: 0)
|
|
|
container.addView(readerView)
|
|
|
}
|
|
|
|
|
@@ -463,22 +478,22 @@ abstract class ReaderActivity : AppCompatActivity() {
|
|
|
onDismissListener = Runnable { onMediaBoxDismissed() }
|
|
|
onViewerEditTabAddButtonClickListener = object : ViewerEditView.OnViewerEditTabAddButtonClickListener {
|
|
|
override fun onTabTextBoxAddButtonClick(textBoxTabView: TextBoxTabView) {
|
|
|
- dismiss()
|
|
|
+ dismiss(false)
|
|
|
viewModel.setTextBoxAttribute(textBoxTabView.getTextBoxAttribute())
|
|
|
}
|
|
|
|
|
|
override fun onTabSignatureAddButtonClick(signatureTabView: SignatureTabView) {
|
|
|
- dismiss()
|
|
|
+ dismiss(false)
|
|
|
viewModel.setSignatureAttribute(signatureTabView.getSignatureAttribute())
|
|
|
}
|
|
|
|
|
|
override fun onTabStampAddButtonClick(stampTabView: StampTabView) {
|
|
|
- dismiss()
|
|
|
+ dismiss(false)
|
|
|
viewModel.setStampAttribute(stampTabView.getStampAttribute())
|
|
|
}
|
|
|
|
|
|
override fun onTabShapeAddButtonClick(shapeTabView: ShapeTabView) {
|
|
|
- dismiss()
|
|
|
+ dismiss(false)
|
|
|
viewModel.setShapeAttribute(shapeTabView.getShapeAttribute())
|
|
|
}
|
|
|
}
|