add a switch for toggling Pull-to-refresh
This commit is contained in:
parent
9280533c74
commit
a5372f97a3
|
@ -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'
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -233,10 +233,6 @@ class Config(context: Context) : BaseConfig(context) {
|
|||
return Gson().fromJson<ArrayList<AlbumCover>>(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()
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -401,6 +401,29 @@
|
|||
android:textAllCaps="true"
|
||||
android:textSize="@dimen/smaller_text_size"/>
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/settings_show_info_bubble_holder"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/medium_margin"
|
||||
android:background="?attr/selectableItemBackground"
|
||||
android:paddingBottom="@dimen/activity_margin"
|
||||
android:paddingLeft="@dimen/normal_margin"
|
||||
android:paddingRight="@dimen/normal_margin"
|
||||
android:paddingTop="@dimen/activity_margin">
|
||||
|
||||
<com.simplemobiletools.commons.views.MySwitchCompat
|
||||
android:id="@+id/settings_show_info_bubble"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@null"
|
||||
android:clickable="false"
|
||||
android:paddingLeft="@dimen/medium_margin"
|
||||
android:paddingStart="@dimen/medium_margin"
|
||||
android:text="@string/show_info_bubble"/>
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/settings_scroll_horizontally_holder"
|
||||
android:layout_width="match_parent"
|
||||
|
@ -425,7 +448,7 @@
|
|||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/settings_show_info_bubble_holder"
|
||||
android:id="@+id/settings_enable_pull_to_refresh_holder"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/medium_margin"
|
||||
|
@ -436,14 +459,14 @@
|
|||
android:paddingTop="@dimen/activity_margin">
|
||||
|
||||
<com.simplemobiletools.commons.views.MySwitchCompat
|
||||
android:id="@+id/settings_show_info_bubble"
|
||||
android:id="@+id/settings_enable_pull_to_refresh"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@null"
|
||||
android:clickable="false"
|
||||
android:paddingLeft="@dimen/medium_margin"
|
||||
android:paddingStart="@dimen/medium_margin"
|
||||
android:text="@string/show_info_bubble"/>
|
||||
android:text="@string/enable_pull_to_refresh"/>
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
|
|
Loading…
Reference in New Issue