add a settings button for managing bottom action buttons

This commit is contained in:
tibbi 2018-06-29 15:26:50 +02:00
parent e9e6e3e059
commit 59d277c710
32 changed files with 133 additions and 39 deletions

View file

@ -70,16 +70,17 @@ class SettingsActivity : SimpleActivity() {
setupHideExtendedDetails()
setupManageExtendedDetails()
setupSkipDeleteConfirmation()
updateTextColors(settings_holder)
setupSectionColors()
setupManageBottomActions()
setupUseRecycleBin()
setupEmptyRecycleBin()
updateTextColors(settings_holder)
setupSectionColors()
}
private fun setupSectionColors() {
val adjustedPrimaryColor = getAdjustedPrimaryColor()
arrayListOf(visibility_label, videos_label, thumbnails_label, scrolling_label, fullscreen_media_label, security_label,
file_operations_label, extended_details_label, recycle_bin_label).forEach {
file_operations_label, extended_details_label, bottom_actions_label, recycle_bin_label).forEach {
it.setTextColor(adjustedPrimaryColor)
}
}
@ -291,14 +292,6 @@ class SettingsActivity : SimpleActivity() {
}
}
private fun setupBottomActions() {
settings_bottom_actions.isChecked = config.bottomActions
settings_bottom_actions_holder.setOnClickListener {
settings_bottom_actions.toggle()
config.bottomActions = settings_bottom_actions.isChecked
}
}
private fun setupShowMediaCount() {
settings_show_media_count.isChecked = config.showMediaCount
settings_show_media_count_holder.setOnClickListener {
@ -414,6 +407,22 @@ class SettingsActivity : SimpleActivity() {
else -> R.string.screen_rotation_aspect_ratio
})
private fun setupBottomActions() {
settings_bottom_actions.isChecked = config.bottomActions
settings_bottom_actions_holder.setOnClickListener {
settings_bottom_actions.toggle()
config.bottomActions = settings_bottom_actions.isChecked
settings_manage_bottom_actions_holder.beVisibleIf(config.bottomActions)
}
}
private fun setupManageBottomActions() {
settings_manage_bottom_actions_holder.beVisibleIf(config.bottomActions)
settings_manage_bottom_actions_holder.setOnClickListener {
}
}
private fun setupUseRecycleBin() {
settings_empty_recycle_bin_holder.beVisibleIf(config.useRecycleBin)
settings_use_recycle_bin.isChecked = config.useRecycleBin

View file

@ -261,10 +261,6 @@ class Config(context: Context) : BaseConfig(context) {
get() = prefs.getBoolean(ALLOW_VIDEO_GESTURES, true)
set(allowVideoGestures) = prefs.edit().putBoolean(ALLOW_VIDEO_GESTURES, allowVideoGestures).apply()
var bottomActions: Boolean
get() = prefs.getBoolean(BOTTOM_ACTIONS, true)
set(bottomActions) = prefs.edit().putBoolean(BOTTOM_ACTIONS, bottomActions).apply()
var showMediaCount: Boolean
get() = prefs.getBoolean(SHOW_MEDIA_COUNT, true)
set(showMediaCount) = prefs.edit().putBoolean(SHOW_MEDIA_COUNT, showMediaCount).apply()
@ -360,4 +356,12 @@ class Config(context: Context) : BaseConfig(context) {
var useRecycleBin: Boolean
get() = prefs.getBoolean(USE_RECYCLE_BIN, true)
set(useRecycleBin) = prefs.edit().putBoolean(USE_RECYCLE_BIN, useRecycleBin).apply()
var bottomActions: Boolean
get() = prefs.getBoolean(BOTTOM_ACTIONS, true)
set(bottomActions) = prefs.edit().putBoolean(BOTTOM_ACTIONS, bottomActions).apply()
var visibleBottomActions: Int
get() = prefs.getInt(VISIBLE_BOTTOM_ACTIONS, BOTTOM_ACTION_TOGGLE_FAVORITE or BOTTOM_ACTION_EDIT or BOTTOM_ACTION_SHARE or BOTTOM_ACTION_DELETE)
set(visibleBottomActions) = prefs.edit().putInt(VISIBLE_BOTTOM_ACTIONS, visibleBottomActions).apply()
}

View file

@ -52,6 +52,7 @@ const val LAST_FILEPICKER_PATH = "last_filepicker_path"
const val WAS_OTG_HANDLED = "was_otg_handled"
const val TEMP_SKIP_DELETE_CONFIRMATION = "temp_skip_delete_confirmation"
const val BOTTOM_ACTIONS = "bottom_actions"
const val VISIBLE_BOTTOM_ACTIONS = "visible_bottom_actions"
const val WERE_FAVORITES_PINNED = "were_favorites_pinned"
const val WAS_RECYCLE_BIN_PINNED = "was_recycle_bin_pinned"
const val USE_RECYCLE_BIN = "use_recycle_bin"
@ -129,3 +130,15 @@ const val GROUP_BY_FILE_TYPE = 8
const val GROUP_BY_EXTENSION = 16
const val GROUP_BY_FOLDER = 32
const val GROUP_DESCENDING = 1024
// bottom actions
const val BOTTOM_ACTION_TOGGLE_FAVORITE = 1
const val BOTTOM_ACTION_EDIT = 2
const val BOTTOM_ACTION_SHARE = 4
const val BOTTOM_ACTION_DELETE = 8
const val BOTTOM_ACTION_ROTATE = 16
const val BOTTOM_ACTION_PROPERTIES = 32
const val BOTTOM_ACTION_LOCK_ORIENTATION = 64
const val BOTTOM_ACTION_SLIDESHOW = 128
const val BOTTOM_ACTION_SHOW_ON_MAP = 256
const val BOTTOM_ACTION_TOGGLE_VISIBILITY = 512

View file

@ -649,29 +649,6 @@
</RelativeLayout>
<RelativeLayout
android:id="@+id/settings_bottom_actions_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_bottom_actions"
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_at_bottom"/>
</RelativeLayout>
<RelativeLayout
android:id="@+id/settings_screen_rotation_holder"
android:layout_width="match_parent"
@ -942,6 +919,69 @@
</RelativeLayout>
<View
android:id="@+id/bottom_actions_divider"
android:layout_width="match_parent"
android:layout_height="1px"
android:background="@color/divider_grey"
android:importantForAccessibility="no"/>
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/bottom_actions_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/bigger_margin"
android:layout_marginStart="@dimen/bigger_margin"
android:layout_marginTop="@dimen/activity_margin"
android:text="@string/bottom_actions"
android:textAllCaps="true"
android:textSize="@dimen/smaller_text_size"/>
<RelativeLayout
android:id="@+id/settings_bottom_actions_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_bottom_actions"
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_at_bottom"/>
</RelativeLayout>
<RelativeLayout
android:id="@+id/settings_manage_bottom_actions_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.MyTextView
android:id="@+id/settings_manage_bottom_actions"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:paddingLeft="@dimen/medium_margin"
android:paddingStart="@dimen/medium_margin"
android:text="@string/manage_bottom_actions"/>
</RelativeLayout>
<View
android:id="@+id/recycle_bin_divider"
android:layout_width="match_parent"

View file

@ -164,6 +164,7 @@
<string name="manage_bottom_actions">Manage visible bottom actions</string>
<string name="toggle_favorite">Toggle favorite</string>
<string name="orientation_locking">Orientation locking</string>
<string name="toggle_file_visibility">Toggle file visibility</string>
<!-- FAQ -->
<string name="faq_1_title">كيف يمكنني جعل الاستوديو البسيط معرض الأجهزة الافتراضي؟</string>

View file

@ -160,6 +160,7 @@
<string name="manage_bottom_actions">Manage visible bottom actions</string>
<string name="toggle_favorite">Toggle favorite</string>
<string name="orientation_locking">Orientation locking</string>
<string name="toggle_file_visibility">Toggle file visibility</string>
<!-- FAQ -->
<string name="faq_1_title">Com puc fer que Simple Gallery sigui la galeria de dispositius predeterminada?</string>

View file

@ -160,6 +160,7 @@
<string name="manage_bottom_actions">Manage visible bottom actions</string>
<string name="toggle_favorite">Toggle favorite</string>
<string name="orientation_locking">Orientation locking</string>
<string name="toggle_file_visibility">Toggle file visibility</string>
<!-- FAQ -->
<string name="faq_1_title">How can I make Simple Gallery the default device gallery?</string>

View file

@ -160,6 +160,7 @@
<string name="manage_bottom_actions">Manage visible bottom actions</string>
<string name="toggle_favorite">Toggle favorite</string>
<string name="orientation_locking">Orientation locking</string>
<string name="toggle_file_visibility">Toggle file visibility</string>
<!-- FAQ -->
<string name="faq_1_title">How can I make Simple Gallery the default device gallery?</string>

View file

@ -160,6 +160,7 @@
<string name="manage_bottom_actions">Manage visible bottom actions</string>
<string name="toggle_favorite">Toggle favorite</string>
<string name="orientation_locking">Orientation locking</string>
<string name="toggle_file_visibility">Toggle file visibility</string>
<!-- FAQ -->
<string name="faq_1_title">Wie kann ich Schlichte Galerie als Standardanwendung auswählen?</string>

View file

@ -161,6 +161,7 @@
<string name="manage_bottom_actions">Manage visible bottom actions</string>
<string name="toggle_favorite">Toggle favorite</string>
<string name="orientation_locking">Orientation locking</string>
<string name="toggle_file_visibility">Toggle file visibility</string>
<!-- FAQ -->
<string name="faq_1_title">Πώς μπορώ να κάνω το Simple Gallery προκαθορισμένη εφαρμογή συλλογής πολυμέσων;</string>

View file

@ -160,6 +160,7 @@
<string name="manage_bottom_actions">Manage visible bottom actions</string>
<string name="toggle_favorite">Toggle favorite</string>
<string name="orientation_locking">Orientation locking</string>
<string name="toggle_file_visibility">Toggle file visibility</string>
<!-- FAQ -->
<string name="faq_1_title">¿Cómo puedo hacer que Simple Gallery sea la galería de dispositivos predeterminada?</string>

View file

@ -160,6 +160,7 @@
<string name="manage_bottom_actions">Manage visible bottom actions</string>
<string name="toggle_favorite">Toggle favorite</string>
<string name="orientation_locking">Orientation locking</string>
<string name="toggle_file_visibility">Toggle file visibility</string>
<!-- FAQ -->
<string name="faq_1_title">Miten voin tehdä Simple Gallerystä oletusgalleriasovelluksen?</string>

View file

@ -160,6 +160,7 @@
<string name="manage_bottom_actions">Manage visible bottom actions</string>
<string name="toggle_favorite">Toggle favorite</string>
<string name="orientation_locking">Orientation locking</string>
<string name="toggle_file_visibility">Toggle file visibility</string>
<!-- FAQ -->
<string name="faq_1_title">Comment faire de Simple Galerie ma galerie par défaut ?</string>

View file

@ -160,6 +160,7 @@
<string name="manage_bottom_actions">Manage visible bottom actions</string>
<string name="toggle_favorite">Toggle favorite</string>
<string name="orientation_locking">Orientation locking</string>
<string name="toggle_file_visibility">Toggle file visibility</string>
<!-- FAQ -->
<string name="faq_1_title">Cómo podo facer que Simple Gallery sexa a galería por omisión no dispositivo?</string>

View file

@ -160,6 +160,7 @@
<string name="manage_bottom_actions">Manage visible bottom actions</string>
<string name="toggle_favorite">Toggle favorite</string>
<string name="orientation_locking">Orientation locking</string>
<string name="toggle_file_visibility">Toggle file visibility</string>
<!-- FAQ -->
<string name="faq_1_title">Kako mogu postaviti Jednostavnu galeriju kao zadanu galeriju uređaja?</string>

View file

@ -160,6 +160,7 @@
<string name="manage_bottom_actions">Manage visible bottom actions</string>
<string name="toggle_favorite">Toggle favorite</string>
<string name="orientation_locking">Orientation locking</string>
<string name="toggle_file_visibility">Toggle file visibility</string>
<!-- FAQ -->
<string name="faq_1_title">How can I make Simple Gallery the default device gallery?</string>

View file

@ -160,6 +160,7 @@
<string name="manage_bottom_actions">Manage visible bottom actions</string>
<string name="toggle_favorite">Toggle favorite</string>
<string name="orientation_locking">Orientation locking</string>
<string name="toggle_file_visibility">Toggle file visibility</string>
<!-- FAQ -->
<string name="faq_1_title">Come posso impostare Simple Gallery come galleria predefinita del dispositivo?</string>

View file

@ -160,6 +160,7 @@
<string name="manage_bottom_actions">Manage visible bottom actions</string>
<string name="toggle_favorite">Toggle favorite</string>
<string name="orientation_locking">Orientation locking</string>
<string name="toggle_file_visibility">Toggle file visibility</string>
<!-- FAQ -->
<string name="faq_1_title">How can I make Simple Gallery the default device gallery?</string>

View file

@ -160,6 +160,7 @@
<string name="manage_bottom_actions">Manage visible bottom actions</string>
<string name="toggle_favorite">Toggle favorite</string>
<string name="orientation_locking">Orientation locking</string>
<string name="toggle_file_visibility">Toggle file visibility</string>
<!-- FAQ -->
<string name="faq_1_title">How can I make Simple Gallery the default device gallery?</string>

View file

@ -160,6 +160,7 @@
<string name="manage_bottom_actions">Manage visible bottom actions</string>
<string name="toggle_favorite">Toggle favorite</string>
<string name="orientation_locking">Orientation locking</string>
<string name="toggle_file_visibility">Toggle file visibility</string>
<!-- FAQ -->
<string name="faq_1_title">Kaip galiu padaryti paprastą galeriją kaip numatytąją įrenginio galeriją?</string>

View file

@ -160,6 +160,7 @@
<string name="manage_bottom_actions">Manage visible bottom actions</string>
<string name="toggle_favorite">Toggle favorite</string>
<string name="orientation_locking">Orientation locking</string>
<string name="toggle_file_visibility">Toggle file visibility</string>
<!-- FAQ -->
<string name="faq_1_title">How can I make Simple Gallery the default device gallery?</string>

View file

@ -160,6 +160,7 @@
<string name="manage_bottom_actions">Manage visible bottom actions</string>
<string name="toggle_favorite">Toggle favorite</string>
<string name="orientation_locking">Orientation locking</string>
<string name="toggle_file_visibility">Toggle file visibility</string>
<!-- FAQ -->
<string name="faq_1_title">How can I make Simple Gallery the default device gallery?</string>

View file

@ -160,6 +160,7 @@
<string name="manage_bottom_actions">Manage visible bottom actions</string>
<string name="toggle_favorite">Toggle favorite</string>
<string name="orientation_locking">Orientation locking</string>
<string name="toggle_file_visibility">Toggle file visibility</string>
<!-- FAQ -->
   <string name="faq_1_title">Jak mogę ustawić tą aplikację jako domyślną aplikację galerii?</string>

View file

@ -160,6 +160,7 @@
<string name="manage_bottom_actions">Manage visible bottom actions</string>
<string name="toggle_favorite">Toggle favorite</string>
<string name="orientation_locking">Orientation locking</string>
<string name="toggle_file_visibility">Toggle file visibility</string>v
<!-- FAQ -->
<string name="faq_1_title">How can I make Simple Gallery the default device gallery?</string>

View file

@ -160,6 +160,7 @@
<string name="manage_bottom_actions">Manage visible bottom actions</string>
<string name="toggle_favorite">Toggle favorite</string>
<string name="orientation_locking">Orientation locking</string>
<string name="toggle_file_visibility">Toggle file visibility</string>
<!-- FAQ -->
<string name="faq_1_title">How can I make Simple Gallery the default device gallery?</string>

View file

@ -160,6 +160,7 @@
<string name="manage_bottom_actions">Manage visible bottom actions</string>
<string name="toggle_favorite">Toggle favorite</string>
<string name="orientation_locking">Orientation locking</string>
<string name="toggle_file_visibility">Toggle file visibility</string>
<!-- FAQ -->
<string name="faq_1_title">Как сделать Simple Gallery галереей по умолчанию?</string>

View file

@ -158,8 +158,9 @@
<!-- Bottom actions -->
<string name="manage_bottom_actions">Upraviť viditeľné spodné akčné tlačidlá</string>
<string name="toggle_favorite">Prepnúť obľúbené</string>
<string name="toggle_favorite">Prepnutie obľúbenosti</string>
<string name="orientation_locking">Uzamykanie orientácie zariadenia</string>
<string name="toggle_file_visibility">Prepnutie viditeľnosti súboru</string>
<!-- FAQ -->
<string name="faq_1_title">Ako viem spraviť Jednoduchú Galériu predvolenou galériou zariadenia?</string>

View file

@ -160,6 +160,7 @@
<string name="manage_bottom_actions">Manage visible bottom actions</string>
<string name="toggle_favorite">Toggle favorite</string>
<string name="orientation_locking">Orientation locking</string>
<string name="toggle_file_visibility">Toggle file visibility</string>
<!-- FAQ -->
<string name="faq_1_title">How can I make Simple Gallery the default device gallery?</string>

View file

@ -160,6 +160,7 @@
<string name="manage_bottom_actions">Manage visible bottom actions</string>
<string name="toggle_favorite">Toggle favorite</string>
<string name="orientation_locking">Orientation locking</string>
<string name="toggle_file_visibility">Toggle file visibility</string>
<!-- FAQ -->
<string name="faq_1_title">How can I make Simple Gallery the default device gallery?</string>

View file

@ -160,6 +160,7 @@
<string name="manage_bottom_actions">Manage visible bottom actions</string>
<string name="toggle_favorite">Toggle favorite</string>
<string name="orientation_locking">Orientation locking</string>
<string name="toggle_file_visibility">Toggle file visibility</string>
<!-- FAQ -->
<string name="faq_1_title">如何把简约图库设置为设备的默认图库?</string>

View file

@ -160,6 +160,7 @@
<string name="manage_bottom_actions">Manage visible bottom actions</string>
<string name="toggle_favorite">Toggle favorite</string>
<string name="orientation_locking">Orientation locking</string>
<string name="toggle_file_visibility">Toggle file visibility</string>
<!-- FAQ -->
<string name="faq_1_title">我如何將簡易相簿設為預設相簿?</string>

View file

@ -160,6 +160,7 @@
<string name="manage_bottom_actions">Manage visible bottom actions</string>
<string name="toggle_favorite">Toggle favorite</string>
<string name="orientation_locking">Orientation locking</string>
<string name="toggle_file_visibility">Toggle file visibility</string>
<!-- FAQ -->
<string name="faq_1_title">How can I make Simple Gallery the default device gallery?</string>