Merge pull request #512 from Aga-C/pull-to-refresh-option

Added an option to disable pull-to-refresh (#223)
This commit is contained in:
Tibor Kaputa 2021-11-26 17:28:23 +01:00 committed by GitHub
commit 171a4e45b3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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

@ -24,6 +24,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.*
@ -63,6 +64,7 @@ class ItemsFragment(context: Context, attributeSet: AttributeSet) : MyViewPagerF
if (currentPath != "") {
breadcrumbs.updateColor(textColor)
}
items_swipe_refresh.isEnabled = activity?.config?.enablePullToRefresh != false
}
override fun setupFontSize() {
@ -378,7 +380,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_fastscroller.beVisible()
items_placeholder.beGone()
items_placeholder_2.beGone()

View File

@ -74,6 +74,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"