From 19421401870b944e7f5f3e825bc5b00926a18841 Mon Sep 17 00:00:00 2001 From: Brian Floersch Date: Sat, 13 Jan 2018 22:58:42 -0500 Subject: [PATCH] added one finger zooming --- .../gallery/activities/SettingsActivity.kt | 9 +++++++++ .../gallery/fragments/PhotoFragment.kt | 2 +- .../gallery/helpers/Config.kt | 4 ++++ .../gallery/helpers/Constants.kt | 1 + app/src/main/res/layout/activity_settings.xml | 19 +++++++++++++++++++ app/src/main/res/values/strings.xml | 1 + 6 files changed, 35 insertions(+), 1 deletion(-) 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 6a32c732a..a41e2d750 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/SettingsActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/SettingsActivity.kt @@ -59,6 +59,7 @@ class SettingsActivity : SimpleActivity() { setupShowInfoBubble() setupShowExtendedDetails() setupManageExtendedDetails() + setupOneFingerZoom() updateTextColors(settings_holder) } @@ -312,4 +313,12 @@ class SettingsActivity : SimpleActivity() { } } } + + private fun setupOneFingerZoom() { + settings_one_finger_zoom.isChecked = config.oneFingerZoom + settings_one_finger_zoom_holder.setOnClickListener { + settings_one_finger_zoom.toggle() + config.oneFingerZoom = settings_one_finger_zoom.isChecked + } + } } 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 eecaff05c..7bdff57d6 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/PhotoFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/PhotoFragment.kt @@ -246,7 +246,7 @@ class PhotoFragment : ViewPagerFragment() { view.subsampling_view.apply { maxScale = 10f beVisible() - isQuickScaleEnabled = false + isQuickScaleEnabled = context.config.oneFingerZoom setImage(ImageSource.uri(medium.path)) orientation = if (orient == -1) SubsamplingScaleImageView.ORIENTATION_USE_EXIF else degreesForRotation(orient) setOnImageEventListener(object : SubsamplingScaleImageView.OnImageEventListener { 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 e54d51918..7d45e1b02 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Config.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Config.kt @@ -168,6 +168,10 @@ class Config(context: Context) : BaseConfig(context) { get() = prefs.getInt(getDirectoryColumnsField(), getDefaultDirectoryColumnCount()) set(dirColumnCnt) = prefs.edit().putInt(getDirectoryColumnsField(), dirColumnCnt).apply() + var oneFingerZoom: Boolean + get() = prefs.getBoolean(ONE_FINGER_ZOOM, false) + set(loop) = prefs.edit().putBoolean(ONE_FINGER_ZOOM, loop).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 7318c6d9e..cf5bd0fa3 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Constants.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Constants.kt @@ -43,6 +43,7 @@ val VIEW_TYPE_FILES = "view_type_files" 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" // 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 8ec33b33f..1d3c83420 100644 --- a/app/src/main/res/layout/activity_settings.xml +++ b/app/src/main/res/layout/activity_settings.xml @@ -464,6 +464,25 @@ android:paddingLeft="@dimen/medium_margin" android:paddingStart="@dimen/medium_margin" android:text="@string/show_extended_details"/> + + + + + diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index d241e4961..7b002e5b7 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -146,6 +146,7 @@ This app is just one piece of a bigger series of apps. You can find the rest of them at http://www.simplemobiletools.com + Toggle one finger zoom