Added an option to disable pull-to-refresh (#223)

This commit is contained in:
Agnieszka C 2021-10-21 20:20:19 +02:00
parent cabcfb8cc9
commit b01900348b
4 changed files with 48 additions and 2 deletions

View File

@ -33,6 +33,7 @@ class SettingsActivity : SimpleActivity() {
setupChangeDateTimeFormat()
setupFontSize()
setupShowHidden()
setupEnablePullToRefresh()
setupPressBackTwice()
setupHiddenItemPasswordProtection()
setupAppPasswordProtection()
@ -52,7 +53,7 @@ class SettingsActivity : SimpleActivity() {
private fun setupSectionColors() {
val adjustedPrimaryColor = getAdjustedPrimaryColor()
arrayListOf(visibility_label, file_operations_label, security_label).forEach {
arrayListOf(visibility_label, scrolling_label, file_operations_label, security_label).forEach {
it.setTextColor(adjustedPrimaryColor)
}
}
@ -125,6 +126,14 @@ class SettingsActivity : SimpleActivity() {
config.showHidden = settings_show_hidden.isChecked
}
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 setupPressBackTwice() {
settings_press_back_twice.isChecked = config.pressBackTwice
settings_press_back_twice_holder.setOnClickListener {

View File

@ -23,6 +23,7 @@ import com.simplemobiletools.filemanager.pro.helpers.MAX_COLUMN_COUNT
import com.simplemobiletools.filemanager.pro.helpers.RootHelpers
import com.simplemobiletools.filemanager.pro.interfaces.ItemOperationsListener
import com.simplemobiletools.filemanager.pro.models.ListItem
import kotlinx.android.synthetic.main.items_fragment.*
import kotlinx.android.synthetic.main.items_fragment.view.*
import java.io.File
import java.util.*
@ -60,6 +61,7 @@ class ItemsFragment(context: Context, attributeSet: AttributeSet) : MyViewPagerF
breadcrumbs.updateColor(textColor)
items_fastscroller.updateBubbleColors()
items_swipe_refresh.isEnabled = activity?.config?.enablePullToRefresh != false
}
override fun setupFontSize() {
@ -380,7 +382,7 @@ class ItemsFragment(context: Context, attributeSet: AttributeSet) : MyViewPagerF
skipItemUpdating = false
lastSearchedText = ""
items_swipe_refresh.isEnabled = true
items_swipe_refresh.isEnabled = activity?.config?.enablePullToRefresh != false
items_list.beVisible()
items_placeholder.beGone()
items_placeholder_2.beGone()

View File

@ -72,6 +72,8 @@ class RecentsFragment(context: Context, attributeSet: AttributeSet) : MyViewPage
updateTextColor(textColor)
initDrawables()
}
recents_swipe_refresh.isEnabled = activity?.config?.enablePullToRefresh != false
}
private fun setupLayoutManager() {

View File

@ -206,6 +206,39 @@
</RelativeLayout>
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/scrolling_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/bigger_margin"
android:layout_marginTop="@dimen/section_margin"
android:text="@string/scrolling"
android:textAllCaps="true"
android:textSize="@dimen/smaller_text_size" />
<RelativeLayout
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"
android:background="?attr/selectableItemBackground"
android:paddingStart="@dimen/normal_margin"
android:paddingTop="@dimen/activity_margin"
android:paddingEnd="@dimen/normal_margin"
android:paddingBottom="@dimen/activity_margin">
<com.simplemobiletools.commons.views.MySwitchCompat
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:paddingStart="@dimen/medium_margin"
android:text="@string/enable_pull_to_refresh"
app:switchPadding="@dimen/medium_margin" />
</RelativeLayout>
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/file_operations_label"
android:layout_width="wrap_content"