mirror of
https://github.com/SimpleMobileTools/Simple-File-Manager.git
synced 2025-02-14 10:50:43 +01:00
Minor code improvements
This commit is contained in:
parent
c7c96d2faa
commit
d591ac4b34
@ -28,7 +28,7 @@ import kotlinx.android.synthetic.main.activity_pdf_viewer.*
|
|||||||
class PDFViewerActivity : SimpleActivity() {
|
class PDFViewerActivity : SimpleActivity() {
|
||||||
private var realFilePath = ""
|
private var realFilePath = ""
|
||||||
|
|
||||||
private var systemUiVisible = true
|
private var isFullScreen = false
|
||||||
private var pdfViewerHeight = -1
|
private var pdfViewerHeight = -1
|
||||||
private var positionOffset = 0f
|
private var positionOffset = 0f
|
||||||
|
|
||||||
@ -45,7 +45,7 @@ class PDFViewerActivity : SimpleActivity() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
checkIntent()
|
checkIntent()
|
||||||
setupFullScreenView()
|
setupNotch()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onCreateOptionsMenu(menu: Menu): Boolean {
|
override fun onCreateOptionsMenu(menu: Menu): Boolean {
|
||||||
@ -83,6 +83,7 @@ class PDFViewerActivity : SimpleActivity() {
|
|||||||
pdf_viewer.fromUri(uri)
|
pdf_viewer.fromUri(uri)
|
||||||
.scrollHandle(DefaultScrollHandle(this, primaryColor.getContrastColor(), primaryColor))
|
.scrollHandle(DefaultScrollHandle(this, primaryColor.getContrastColor(), primaryColor))
|
||||||
.spacing(15)
|
.spacing(15)
|
||||||
|
.onTap { toggleFullScreen() }
|
||||||
.load()
|
.load()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -94,12 +95,10 @@ class PDFViewerActivity : SimpleActivity() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setupFullScreenView() {
|
private fun toggleFullScreen(): Boolean {
|
||||||
pdf_viewer.setOnClickListener {
|
if (isFullScreen) exitFullScreen() else enterFullScreen()
|
||||||
if (systemUiVisible) enterFullScreen() else exitFullScreen()
|
isFullScreen = !isFullScreen
|
||||||
systemUiVisible = !systemUiVisible
|
return true
|
||||||
}
|
|
||||||
setupNotch()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun enterFullScreen() {
|
private fun enterFullScreen() {
|
||||||
@ -116,6 +115,8 @@ class PDFViewerActivity : SimpleActivity() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun exitFullScreen() {
|
private fun exitFullScreen() {
|
||||||
|
positionOffset = pdf_viewer.positionOffset
|
||||||
|
|
||||||
showSystemUI(true)
|
showSystemUI(true)
|
||||||
pdf_viewer.updateLayoutParams<RelativeLayout.LayoutParams> {
|
pdf_viewer.updateLayoutParams<RelativeLayout.LayoutParams> {
|
||||||
this.height = pdfViewerHeight
|
this.height = pdfViewerHeight
|
||||||
|
Loading…
x
Reference in New Issue
Block a user