removing some settings and filepickers on Android 11+

This commit is contained in:
tibbi 2022-02-12 18:02:29 +01:00
parent 032ca877ed
commit cfbeb85b0d
3 changed files with 37 additions and 19 deletions

View file

@ -5,10 +5,13 @@ import android.view.Menu
import android.view.MenuItem import android.view.MenuItem
import com.simplemobiletools.commons.dialogs.FilePickerDialog import com.simplemobiletools.commons.dialogs.FilePickerDialog
import com.simplemobiletools.commons.extensions.beVisibleIf import com.simplemobiletools.commons.extensions.beVisibleIf
import com.simplemobiletools.commons.helpers.VIEW_TYPE_GRID
import com.simplemobiletools.commons.helpers.isRPlus
import com.simplemobiletools.commons.interfaces.RefreshRecyclerViewListener import com.simplemobiletools.commons.interfaces.RefreshRecyclerViewListener
import com.simplemobiletools.gallery.pro.R import com.simplemobiletools.gallery.pro.R
import com.simplemobiletools.gallery.pro.adapters.ManageFoldersAdapter import com.simplemobiletools.gallery.pro.adapters.ManageFoldersAdapter
import com.simplemobiletools.gallery.pro.extensions.config import com.simplemobiletools.gallery.pro.extensions.config
import com.simplemobiletools.gallery.pro.helpers.MAX_COLUMN_COUNT
import kotlinx.android.synthetic.main.activity_manage_folders.* import kotlinx.android.synthetic.main.activity_manage_folders.*
class ExcludedFoldersActivity : SimpleActivity(), RefreshRecyclerViewListener { class ExcludedFoldersActivity : SimpleActivity(), RefreshRecyclerViewListener {
@ -21,10 +24,16 @@ class ExcludedFoldersActivity : SimpleActivity(), RefreshRecyclerViewListener {
private fun updateFolders() { private fun updateFolders() {
val folders = ArrayList<String>() val folders = ArrayList<String>()
config.excludedFolders.mapTo(folders) { it } config.excludedFolders.mapTo(folders) { it }
var placeholderText = getString(R.string.excluded_activity_placeholder)
manage_folders_placeholder.apply { manage_folders_placeholder.apply {
text = getString(R.string.excluded_activity_placeholder)
beVisibleIf(folders.isEmpty()) beVisibleIf(folders.isEmpty())
setTextColor(config.textColor) setTextColor(config.textColor)
if (isRPlus()) {
placeholderText = placeholderText.substringBefore("\n")
}
text = placeholderText
} }
val adapter = ManageFoldersAdapter(this, folders, true, this, manage_folders_list) {} val adapter = ManageFoldersAdapter(this, folders, true, this, manage_folders_list) {}
@ -33,6 +42,7 @@ class ExcludedFoldersActivity : SimpleActivity(), RefreshRecyclerViewListener {
override fun onCreateOptionsMenu(menu: Menu): Boolean { override fun onCreateOptionsMenu(menu: Menu): Boolean {
menuInflater.inflate(R.menu.menu_add_folder, menu) menuInflater.inflate(R.menu.menu_add_folder, menu)
menu.findItem(R.id.add_folder).isVisible = !isRPlus()
updateMenuItemColors(menu) updateMenuItemColors(menu)
return true return true
} }

View file

@ -168,6 +168,7 @@ class SettingsActivity : SimpleActivity() {
} }
private fun setupFileLoadingPriority() { private fun setupFileLoadingPriority() {
settings_file_loading_priority_holder.beGoneIf(isRPlus())
settings_file_loading_priority.text = getFileLoadingPriorityText() settings_file_loading_priority.text = getFileLoadingPriorityText()
settings_file_loading_priority_holder.setOnClickListener { settings_file_loading_priority_holder.setOnClickListener {
val items = arrayListOf( val items = arrayListOf(
@ -192,6 +193,7 @@ class SettingsActivity : SimpleActivity() {
) )
private fun setupManageIncludedFolders() { private fun setupManageIncludedFolders() {
settings_manage_included_folders_holder.beGoneIf(isRPlus())
settings_manage_included_folders_holder.setOnClickListener { settings_manage_included_folders_holder.setOnClickListener {
startActivity(Intent(this, IncludedFoldersActivity::class.java)) startActivity(Intent(this, IncludedFoldersActivity::class.java))
} }
@ -204,7 +206,7 @@ class SettingsActivity : SimpleActivity() {
} }
private fun setupManageHiddenFolders() { private fun setupManageHiddenFolders() {
settings_manage_hidden_folders_holder.beVisibleIf(!isQPlus()) settings_manage_hidden_folders_holder.beGoneIf(isQPlus())
settings_manage_hidden_folders_holder.setOnClickListener { settings_manage_hidden_folders_holder.setOnClickListener {
handleHiddenFolderPasswordProtection { handleHiddenFolderPasswordProtection {
startActivity(Intent(this, HiddenFoldersActivity::class.java)) startActivity(Intent(this, HiddenFoldersActivity::class.java))
@ -213,6 +215,11 @@ class SettingsActivity : SimpleActivity() {
} }
private fun setupShowHiddenItems() { private fun setupShowHiddenItems() {
if (isRPlus()) {
settings_show_hidden_items_holder.beGone()
settings_manage_excluded_folders_holder.background = resources.getDrawable(R.drawable.ripple_bottom_corners, theme)
}
settings_show_hidden_items.isChecked = config.showHiddenMedia settings_show_hidden_items.isChecked = config.showHiddenMedia
settings_show_hidden_items_holder.setOnClickListener { settings_show_hidden_items_holder.setOnClickListener {
if (config.showHiddenMedia) { if (config.showHiddenMedia) {
@ -308,6 +315,7 @@ class SettingsActivity : SimpleActivity() {
} }
private fun setupHiddenItemPasswordProtection() { private fun setupHiddenItemPasswordProtection() {
settings_hidden_item_password_protection_holder.beGoneIf(isRPlus())
settings_hidden_item_password_protection.isChecked = config.isHiddenPasswordProtectionOn settings_hidden_item_password_protection.isChecked = config.isHiddenPasswordProtectionOn
settings_hidden_item_password_protection_holder.setOnClickListener { settings_hidden_item_password_protection_holder.setOnClickListener {
val tabToShow = if (config.isHiddenPasswordProtectionOn) config.hiddenProtectionType else SHOW_ALL_TABS val tabToShow = if (config.isHiddenPasswordProtectionOn) config.hiddenProtectionType else SHOW_ALL_TABS

View file

@ -706,28 +706,12 @@
android:background="@drawable/section_holder_stroke" android:background="@drawable/section_holder_stroke"
android:orientation="vertical"> android:orientation="vertical">
<RelativeLayout
android:id="@+id/settings_hidden_item_password_protection_holder"
style="@style/SettingsHolderCheckboxStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/ripple_top_corners">
<com.simplemobiletools.commons.views.MyAppCompatCheckbox
android:id="@+id/settings_hidden_item_password_protection"
style="@style/SettingsCheckboxStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/password_protect_hidden_items" />
</RelativeLayout>
<RelativeLayout <RelativeLayout
android:id="@+id/settings_app_password_protection_holder" android:id="@+id/settings_app_password_protection_holder"
style="@style/SettingsHolderCheckboxStyle" style="@style/SettingsHolderCheckboxStyle"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@drawable/ripple_background"> android:background="@drawable/ripple_top_corners">
<com.simplemobiletools.commons.views.MyAppCompatCheckbox <com.simplemobiletools.commons.views.MyAppCompatCheckbox
android:id="@+id/settings_app_password_protection" android:id="@+id/settings_app_password_protection"
@ -738,6 +722,22 @@
</RelativeLayout> </RelativeLayout>
<RelativeLayout
android:id="@+id/settings_hidden_item_password_protection_holder"
style="@style/SettingsHolderCheckboxStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/ripple_background">
<com.simplemobiletools.commons.views.MyAppCompatCheckbox
android:id="@+id/settings_hidden_item_password_protection"
style="@style/SettingsCheckboxStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/password_protect_hidden_items" />
</RelativeLayout>
<RelativeLayout <RelativeLayout
android:id="@+id/settings_file_deletion_password_protection_holder" android:id="@+id/settings_file_deletion_password_protection_holder"
style="@style/SettingsHolderCheckboxStyle" style="@style/SettingsHolderCheckboxStyle"