forked from hardcoresushi/DroidFS
Slideshow UI fix
This commit is contained in:
parent
d19007f099
commit
3795f8790f
@ -48,12 +48,10 @@ class ImageViewer: FileViewerActivity() {
|
|||||||
action_buttons.visibility = View.GONE
|
action_buttons.visibility = View.GONE
|
||||||
action_bar.visibility = View.GONE
|
action_bar.visibility = View.GONE
|
||||||
}
|
}
|
||||||
private val slideshowLoop = object : Runnable {
|
private val slideshowNext = Runnable {
|
||||||
override fun run() {
|
if (slideshowActive){
|
||||||
if (slideshowActive){
|
image_viewer.resetZoomFactor()
|
||||||
swipeImage(-1F)
|
swipeImage(-1F, true)
|
||||||
handler.postDelayed(this, ConstValues.slideshow_delay)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
override fun viewFile() {
|
override fun viewFile() {
|
||||||
@ -107,7 +105,7 @@ class ImageViewer: FileViewerActivity() {
|
|||||||
handler.postDelayed(hideUI, hideDelay)
|
handler.postDelayed(hideUI, hideDelay)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun swipeImage(deltaX: Float){
|
private fun swipeImage(deltaX: Float, slideshowSwipe: Boolean = false){
|
||||||
if (!wasMapped){
|
if (!wasMapped){
|
||||||
for (e in gocryptfsVolume.recursiveMapFiles(PathUtils.getParentPath(filePath))){
|
for (e in gocryptfsVolume.recursiveMapFiles(PathUtils.getParentPath(filePath))){
|
||||||
if (e.isRegularFile && ConstValues.isImage(e.name)){
|
if (e.isRegularFile && ConstValues.isImage(e.name)){
|
||||||
@ -142,6 +140,12 @@ class ImageViewer: FileViewerActivity() {
|
|||||||
}
|
}
|
||||||
filePath = mappedImages[currentMappedImageIndex].fullPath
|
filePath = mappedImages[currentMappedImageIndex].fullPath
|
||||||
loadImage()
|
loadImage()
|
||||||
|
if (slideshowActive){
|
||||||
|
if (!slideshowSwipe) { //reset slideshow delay if user swipes
|
||||||
|
handler.removeCallbacks(slideshowNext)
|
||||||
|
}
|
||||||
|
handler.postDelayed(slideshowNext, ConstValues.slideshow_delay)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -172,7 +176,7 @@ class ImageViewer: FileViewerActivity() {
|
|||||||
fun onClickSlideshow(view: View) {
|
fun onClickSlideshow(view: View) {
|
||||||
if (!slideshowActive){
|
if (!slideshowActive){
|
||||||
slideshowActive = true
|
slideshowActive = true
|
||||||
handler.postDelayed(slideshowLoop, ConstValues.slideshow_delay)
|
handler.postDelayed(slideshowNext, ConstValues.slideshow_delay)
|
||||||
window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)
|
window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)
|
||||||
hideUI.run()
|
hideUI.run()
|
||||||
Toast.makeText(this, R.string.slideshow_started, Toast.LENGTH_SHORT).show()
|
Toast.makeText(this, R.string.slideshow_started, Toast.LENGTH_SHORT).show()
|
||||||
@ -236,12 +240,13 @@ class ImageViewer: FileViewerActivity() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun askSaveRotation(callback: () -> Unit){
|
private fun askSaveRotation(callback: () -> Unit){
|
||||||
if (rotationAngle%360 != 0f){
|
if (rotationAngle%360 != 0f && !slideshowActive){
|
||||||
ColoredAlertDialogBuilder(this)
|
ColoredAlertDialogBuilder(this)
|
||||||
.keepFullScreen()
|
.keepFullScreen()
|
||||||
.setTitle(R.string.warning)
|
.setTitle(R.string.warning)
|
||||||
.setMessage(R.string.ask_save_img_rotated)
|
.setMessage(R.string.ask_save_img_rotated)
|
||||||
.setNegativeButton(R.string.no) { _, _ -> callback() }
|
.setNegativeButton(R.string.no) { _, _ -> callback() }
|
||||||
|
.setNeutralButton(R.string.cancel, null)
|
||||||
.setPositiveButton(R.string.yes) { _, _ ->
|
.setPositiveButton(R.string.yes) { _, _ ->
|
||||||
val outputStream = ByteArrayOutputStream()
|
val outputStream = ByteArrayOutputStream()
|
||||||
if (rotatedBitmap?.compress(
|
if (rotatedBitmap?.compress(
|
||||||
|
Loading…
Reference in New Issue
Block a user