diff --git a/app/build.gradle b/app/build.gradle index 1766d3de5..eba887b67 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -46,7 +46,7 @@ ext { } dependencies { - implementation 'com.simplemobiletools:commons:3.12.24' + implementation 'com.simplemobiletools:commons:3.13.0' implementation 'com.theartofdev.edmodo:android-image-cropper:2.6.0' implementation 'com.android.support:multidex:1.0.2' implementation 'com.google.code.gson:gson:2.8.2' diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt index ccfaa66f6..c6b8469fd 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt @@ -137,6 +137,7 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener { directories_horizontal_fastscroller.updateBubbleColors() directories_vertical_fastscroller.updateBubbleColors() + directories_refresh_layout.isEnabled = config.enablePullToRefresh invalidateOptionsMenu() directories_empty_text_label.setTextColor(config.textColor) directories_empty_text.setTextColor(getAdjustedPrimaryColor()) @@ -622,7 +623,6 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener { private fun setupScrollDirection() { val allowHorizontalScroll = config.scrollHorizontally && config.viewTypeFolders == VIEW_TYPE_GRID - directories_refresh_layout.isEnabled = !config.scrollHorizontally directories_vertical_fastscroller.isHorizontal = false directories_vertical_fastscroller.beGoneIf(allowHorizontalScroll) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt index 081d0df72..5b5d07f84 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt @@ -134,6 +134,7 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener { media_horizontal_fastscroller.updateBubbleColors() media_vertical_fastscroller.updateBubbleColors() + media_refresh_layout.isEnabled = config.enablePullToRefresh tryloadGallery() invalidateOptionsMenu() media_empty_text_label.setTextColor(config.textColor) @@ -329,8 +330,6 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener { private fun setupScrollDirection() { val allowHorizontalScroll = config.scrollHorizontally && config.viewTypeFiles == VIEW_TYPE_GRID - media_refresh_layout.isEnabled = !config.scrollHorizontally - media_vertical_fastscroller.isHorizontal = false media_vertical_fastscroller.beGoneIf(allowHorizontalScroll) 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 09e3c774c..0930d4463 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/SettingsActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/SettingsActivity.kt @@ -57,6 +57,7 @@ class SettingsActivity : SimpleActivity() { setupShowMediaCount() setupKeepLastModified() setupShowInfoBubble() + setupEnablePullToRefresh() setupOneFingerZoom() setupAllowInstantChange() setupReplaceZoomableImages() @@ -310,6 +311,14 @@ class SettingsActivity : SimpleActivity() { } } + private fun setupEnablePullToRefresh() { + settings_enable_pull_to_refresh.isChecked = config.enablePullToRefresh + settings_enable_pull_to_refresh_holder.setOnClickListener { + settings_enable_pull_to_refresh.toggle() + config.enablePullToRefresh = settings_enable_pull_to_refresh.isChecked + } + } + private fun setupOneFingerZoom() { settings_one_finger_zoom.isChecked = config.oneFingerZoom settings_one_finger_zoom_holder.setOnClickListener { 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 e8a691f53..c8543c2e4 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Config.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Config.kt @@ -233,10 +233,6 @@ class Config(context: Context) : BaseConfig(context) { return Gson().fromJson>(albumCovers, listType) ?: ArrayList(1) } - var scrollHorizontally: Boolean - get() = prefs.getBoolean(SCROLL_HORIZONTALLY, false) - set(scrollHorizontally) = prefs.edit().putBoolean(SCROLL_HORIZONTALLY, scrollHorizontally).apply() - var hideSystemUI: Boolean get() = prefs.getBoolean(HIDE_SYSTEM_UI, false) set(hideSystemUI) = prefs.edit().putBoolean(HIDE_SYSTEM_UI, hideSystemUI).apply() 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 9d30dd61f..bf251b41b 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Constants.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Constants.kt @@ -30,7 +30,6 @@ const val HIDE_FOLDER_TOOLTIP_SHOWN = "hide_folder_tooltip_shown" const val EXCLUDED_FOLDERS = "excluded_folders" const val INCLUDED_FOLDERS = "included_folders" const val ALBUM_COVERS = "album_covers" -const val SCROLL_HORIZONTALLY = "scroll_horizontally" const val HIDE_SYSTEM_UI = "hide_system_ui" const val REPLACE_SHARE_WITH_ROTATE = "replace_share_with_rotate" const val DELETE_EMPTY_FOLDERS = "delete_empty_folders" diff --git a/app/src/main/res/layout/activity_settings.xml b/app/src/main/res/layout/activity_settings.xml index c1bfe8b79..a41f8df5c 100644 --- a/app/src/main/res/layout/activity_settings.xml +++ b/app/src/main/res/layout/activity_settings.xml @@ -401,6 +401,29 @@ android:textAllCaps="true" android:textSize="@dimen/smaller_text_size"/> + + + + + + + android:text="@string/enable_pull_to_refresh"/>