diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/PhotoVideoActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/PhotoVideoActivity.kt
index aba3b7060..602154896 100644
--- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/PhotoVideoActivity.kt
+++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/PhotoVideoActivity.kt
@@ -24,6 +24,7 @@ import kotlinx.android.synthetic.main.fragment_holder.*
import java.io.File
open class PhotoVideoActivity : SimpleActivity(), ViewPagerFragment.FragmentListener {
+
private var mMedium: Medium? = null
private var mIsFullScreen = false
private var mIsFromGallery = false
@@ -158,4 +159,8 @@ open class PhotoVideoActivity : SimpleActivity(), ViewPagerFragment.FragmentList
}
override fun videoEnded() = false
+
+ override fun goToPrevItem() {}
+
+ override fun goToNextItem() {}
}
diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/SettingsActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/SettingsActivity.kt
index d35769e5e..4b08f6971 100644
--- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/SettingsActivity.kt
+++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/SettingsActivity.kt
@@ -55,6 +55,7 @@ class SettingsActivity : SimpleActivity() {
setupKeepLastModified()
setupShowInfoBubble()
setupOneFingerZoom()
+ setupAllowInstantChange()
setupShowExtendedDetails()
setupManageExtendedDetails()
updateTextColors(settings_holder)
@@ -286,6 +287,14 @@ class SettingsActivity : SimpleActivity() {
}
}
+ private fun setupAllowInstantChange() {
+ settings_allow_instant_change.isChecked = config.allowInstantChange
+ settings_allow_instant_change_holder.setOnClickListener {
+ settings_allow_instant_change.toggle()
+ config.allowInstantChange = settings_allow_instant_change.isChecked
+ }
+ }
+
private fun setupShowExtendedDetails() {
settings_show_extended_details.isChecked = config.showExtendedDetails
settings_show_extended_details_holder.setOnClickListener {
diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt
index 22f5b03c0..26104988a 100644
--- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt
+++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt
@@ -3,7 +3,6 @@ package com.simplemobiletools.gallery.activities
import android.animation.Animator
import android.animation.ValueAnimator
import android.app.Activity
-import android.content.Context
import android.content.Intent
import android.content.pm.ActivityInfo
import android.content.res.Configuration
@@ -820,11 +819,20 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
}
override fun videoEnded(): Boolean {
- if (mIsSlideshowActive)
+ if (mIsSlideshowActive) {
swipeToNextMedium()
+ }
return mIsSlideshowActive
}
+ override fun goToPrevItem() {
+ view_pager.setCurrentItem(view_pager.currentItem - 1, false)
+ }
+
+ override fun goToNextItem() {
+ view_pager.setCurrentItem(view_pager.currentItem + 1, false)
+ }
+
private fun checkSystemUI() {
if (mIsFullScreen) {
hideSystemUI()
diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/PhotoFragment.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/PhotoFragment.kt
index 7bdff57d6..4bbc7ef34 100644
--- a/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/PhotoFragment.kt
+++ b/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/PhotoFragment.kt
@@ -49,7 +49,12 @@ class PhotoFragment : ViewPagerFragment() {
lateinit var medium: Medium
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View {
- view = inflater.inflate(R.layout.pager_photo_item, container, false) as ViewGroup
+ view = (inflater.inflate(R.layout.pager_photo_item, container, false) as ViewGroup).apply {
+ subsampling_view.setOnClickListener { photoClicked() }
+ gif_view.setOnClickListener { photoClicked() }
+ instant_prev_item.setOnClickListener { listener?.goToPrevItem() }
+ instant_next_item.setOnClickListener { listener?.goToNextItem() }
+ }
if (!isFragmentVisible && activity is PhotoActivity) {
isFragmentVisible = true
@@ -88,11 +93,8 @@ class PhotoFragment : ViewPagerFragment() {
}
isFullscreen = activity!!.window.decorView.systemUiVisibility and View.SYSTEM_UI_FLAG_FULLSCREEN == View.SYSTEM_UI_FLAG_FULLSCREEN
- view.subsampling_view.setOnClickListener { photoClicked() }
- view.gif_view.setOnClickListener { photoClicked() }
loadImage()
checkExtendedDetails()
-
wasInit = true
return view
@@ -109,6 +111,10 @@ class PhotoFragment : ViewPagerFragment() {
if (wasInit && (context!!.config.showExtendedDetails != storedShowExtendedDetails || context!!.config.extendedDetails != storedExtendedDetails)) {
checkExtendedDetails()
}
+
+ val allowInstantChange = context!!.config.allowInstantChange
+ view.instant_prev_item.beVisibleIf(allowInstantChange)
+ view.instant_next_item.beVisibleIf(allowInstantChange)
}
override fun setMenuVisibility(menuVisible: Boolean) {
diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/VideoFragment.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/VideoFragment.kt
index 466e8b999..8b3099e43 100644
--- a/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/VideoFragment.kt
+++ b/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/VideoFragment.kt
@@ -66,8 +66,12 @@ class VideoFragment : ViewPagerFragment(), SurfaceHolder.Callback, SeekBar.OnSee
lateinit var medium: Medium
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
- mView = inflater.inflate(R.layout.pager_video_item, container, false)
- mTimeHolder = mView!!.video_time_holder
+ mView = inflater.inflate(R.layout.pager_video_item, container, false).apply {
+ instant_prev_item.setOnClickListener { listener?.goToPrevItem() }
+ instant_next_item.setOnClickListener { listener?.goToNextItem() }
+ mTimeHolder = video_time_holder
+ }
+
medium = arguments!!.getSerializable(MEDIUM) as Medium
// setMenuVisibility is not called at VideoActivity (third party intent)
@@ -90,8 +94,15 @@ class VideoFragment : ViewPagerFragment(), SurfaceHolder.Callback, SeekBar.OnSee
override fun onResume() {
super.onResume()
activity!!.updateTextColors(mView!!.video_holder)
- mView!!.video_volume_controller.beVisibleIf(context!!.config.allowVideoGestures)
- mView!!.video_brightness_controller.beVisibleIf(context!!.config.allowVideoGestures)
+ val allowVideoGestures = context!!.config.allowVideoGestures
+ val allowInstantChange = context!!.config.allowInstantChange
+ mView!!.apply {
+ video_volume_controller.beVisibleIf(allowVideoGestures)
+ video_brightness_controller.beVisibleIf(allowVideoGestures)
+
+ instant_prev_item.beVisibleIf(allowInstantChange)
+ instant_next_item.beVisibleIf(allowInstantChange)
+ }
if (context!!.config.showExtendedDetails != mStoredShowExtendedDetails || context!!.config.extendedDetails != mStoredExtendedDetails) {
checkExtendedDetails()
diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/ViewPagerFragment.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/ViewPagerFragment.kt
index d4ddfa698..8cb977537 100644
--- a/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/ViewPagerFragment.kt
+++ b/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/ViewPagerFragment.kt
@@ -16,6 +16,10 @@ abstract class ViewPagerFragment : Fragment() {
fun fragmentClicked()
fun videoEnded(): Boolean
+
+ fun goToPrevItem()
+
+ fun goToNextItem()
}
fun getMediumExtendedDetails(medium: Medium): String {
diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Config.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Config.kt
index e294f6da1..e76e02c38 100644
--- a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Config.kt
+++ b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Config.kt
@@ -172,6 +172,10 @@ class Config(context: Context) : BaseConfig(context) {
get() = prefs.getBoolean(ONE_FINGER_ZOOM, false)
set(oneFingerZoom) = prefs.edit().putBoolean(ONE_FINGER_ZOOM, oneFingerZoom).apply()
+ var allowInstantChange: Boolean
+ get() = prefs.getBoolean(ALLOW_INSTANT_CHANGE, false)
+ set(allowInstantChange) = prefs.edit().putBoolean(ALLOW_INSTANT_CHANGE, allowInstantChange).apply()
+
private fun getDirectoryColumnsField(): String {
val isPortrait = context.resources.configuration.orientation == Configuration.ORIENTATION_PORTRAIT
return if (isPortrait) {
diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Constants.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Constants.kt
index 17e2dab26..1ef5d45b1 100644
--- a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Constants.kt
+++ b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Constants.kt
@@ -44,6 +44,7 @@ val SHOW_EXTENDED_DETAILS = "show_extended_details"
val EXTENDED_DETAILS = "extended_details"
val LAST_FILE_CLEANUP = "last_file_cleanup"
val ONE_FINGER_ZOOM = "one_finger_zoom"
+val ALLOW_INSTANT_CHANGE = "allow_instant_change"
// slideshow
val SLIDESHOW_INTERVAL = "slideshow_interval"
diff --git a/app/src/main/res/layout/activity_settings.xml b/app/src/main/res/layout/activity_settings.xml
index 085907c47..00563ba86 100644
--- a/app/src/main/res/layout/activity_settings.xml
+++ b/app/src/main/res/layout/activity_settings.xml
@@ -477,6 +477,26 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/res/layout/pager_video_item.xml b/app/src/main/res/layout/pager_video_item.xml
index d0be9b3d2..c8ddbf676 100644
--- a/app/src/main/res/layout/pager_video_item.xml
+++ b/app/src/main/res/layout/pager_video_item.xml
@@ -25,6 +25,18 @@
android:layout_width="@dimen/video_side_slider_width"
android:layout_height="match_parent"/>
+
+
+
+
24dp
50dp
150dp
+ 60dp
72dp