mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2024-11-22 20:48:00 +01:00
moving some file thumbnail settings into a separate window
This commit is contained in:
parent
28bbf5a728
commit
d0da7d589a
4 changed files with 126 additions and 97 deletions
|
@ -12,6 +12,7 @@ import com.simplemobiletools.commons.extensions.*
|
|||
import com.simplemobiletools.commons.helpers.*
|
||||
import com.simplemobiletools.commons.models.RadioItem
|
||||
import com.simplemobiletools.gallery.pro.R
|
||||
import com.simplemobiletools.gallery.pro.dialogs.ChangeFileThumbnailStyleDialog
|
||||
import com.simplemobiletools.gallery.pro.dialogs.ChangeFolderThumbnailStyleDialog
|
||||
import com.simplemobiletools.gallery.pro.dialogs.ManageBottomActionsDialog
|
||||
import com.simplemobiletools.gallery.pro.dialogs.ManageExtendedDetailsDialog
|
||||
|
@ -53,7 +54,6 @@ class SettingsActivity : SimpleActivity() {
|
|||
setupRememberLastVideo()
|
||||
setupLoopVideos()
|
||||
setupOpenVideosOnSeparateScreen()
|
||||
setupAnimateGifs()
|
||||
setupMaxBrightness()
|
||||
setupCropThumbnails()
|
||||
setupDarkBackground()
|
||||
|
@ -68,8 +68,6 @@ class SettingsActivity : SimpleActivity() {
|
|||
setupAllowRotatingWithGestures()
|
||||
setupShowNotch()
|
||||
setupBottomActions()
|
||||
setupThumbnailVideoDuration()
|
||||
setupThumbnailFileTypes()
|
||||
setupFileThumbnailStyle()
|
||||
setupFolderThumbnailStyle()
|
||||
setupKeepLastModified()
|
||||
|
@ -231,14 +229,6 @@ class SettingsActivity : SimpleActivity() {
|
|||
}
|
||||
}
|
||||
|
||||
private fun setupAnimateGifs() {
|
||||
settings_animate_gifs.isChecked = config.animateGifs
|
||||
settings_animate_gifs_holder.setOnClickListener {
|
||||
settings_animate_gifs.toggle()
|
||||
config.animateGifs = settings_animate_gifs.isChecked
|
||||
}
|
||||
}
|
||||
|
||||
private fun setupMaxBrightness() {
|
||||
settings_max_brightness.isChecked = config.maxBrightness
|
||||
settings_max_brightness_holder.setOnClickListener {
|
||||
|
@ -255,22 +245,6 @@ class SettingsActivity : SimpleActivity() {
|
|||
}
|
||||
}
|
||||
|
||||
private fun setupThumbnailVideoDuration() {
|
||||
settings_show_thumbnail_video_duration.isChecked = config.showThumbnailVideoDuration
|
||||
settings_show_thumbnail_video_duration_holder.setOnClickListener {
|
||||
settings_show_thumbnail_video_duration.toggle()
|
||||
config.showThumbnailVideoDuration = settings_show_thumbnail_video_duration.isChecked
|
||||
}
|
||||
}
|
||||
|
||||
private fun setupThumbnailFileTypes() {
|
||||
settings_show_thumbnail_file_types.isChecked = config.showThumbnailFileTypes
|
||||
settings_show_thumbnail_file_types_holder.setOnClickListener {
|
||||
settings_show_thumbnail_file_types.toggle()
|
||||
config.showThumbnailFileTypes = settings_show_thumbnail_file_types.isChecked
|
||||
}
|
||||
}
|
||||
|
||||
private fun setupDarkBackground() {
|
||||
settings_black_background.isChecked = config.blackBackground
|
||||
settings_black_background_holder.setOnClickListener {
|
||||
|
@ -401,7 +375,7 @@ class SettingsActivity : SimpleActivity() {
|
|||
|
||||
private fun setupFileThumbnailStyle() {
|
||||
settings_file_thumbnail_style_holder.setOnClickListener {
|
||||
|
||||
ChangeFileThumbnailStyleDialog(this)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,40 @@
|
|||
package com.simplemobiletools.gallery.pro.dialogs
|
||||
|
||||
import android.content.DialogInterface
|
||||
import android.view.View
|
||||
import androidx.appcompat.app.AlertDialog
|
||||
import com.simplemobiletools.commons.activities.BaseSimpleActivity
|
||||
import com.simplemobiletools.commons.extensions.setupDialogStuff
|
||||
import com.simplemobiletools.gallery.pro.R
|
||||
import com.simplemobiletools.gallery.pro.extensions.config
|
||||
import kotlinx.android.synthetic.main.dialog_change_file_thumbnail_style.view.*
|
||||
|
||||
class ChangeFileThumbnailStyleDialog(val activity: BaseSimpleActivity) : DialogInterface.OnClickListener {
|
||||
private var config = activity.config
|
||||
private var view: View
|
||||
|
||||
init {
|
||||
view = activity.layoutInflater.inflate(R.layout.dialog_change_file_thumbnail_style, null).apply {
|
||||
dialog_file_style_animate_gifs.isChecked = config.animateGifs
|
||||
dialog_file_style_show_thumbnail_video_duration.isChecked = config.showThumbnailVideoDuration
|
||||
dialog_file_style_show_thumbnail_file_types.isChecked = config.showThumbnailFileTypes
|
||||
|
||||
dialog_file_style_animate_gifs_holder.setOnClickListener { dialog_file_style_animate_gifs.toggle() }
|
||||
dialog_file_style_show_thumbnail_video_duration_holder.setOnClickListener { dialog_file_style_show_thumbnail_video_duration.toggle() }
|
||||
dialog_file_style_show_thumbnail_file_types_holder.setOnClickListener { dialog_file_style_show_thumbnail_file_types.toggle() }
|
||||
}
|
||||
|
||||
AlertDialog.Builder(activity)
|
||||
.setPositiveButton(R.string.ok, this)
|
||||
.setNegativeButton(R.string.cancel, null)
|
||||
.create().apply {
|
||||
activity.setupDialogStuff(view, this)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onClick(dialog: DialogInterface, which: Int) {
|
||||
config.animateGifs = view.dialog_file_style_animate_gifs.isChecked
|
||||
config.showThumbnailVideoDuration = view.dialog_file_style_show_thumbnail_video_duration.isChecked
|
||||
config.showThumbnailFileTypes = view.dialog_file_style_show_thumbnail_file_types.isChecked
|
||||
}
|
||||
}
|
|
@ -320,29 +320,6 @@
|
|||
android:textAllCaps="true"
|
||||
android:textSize="@dimen/smaller_text_size" />
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/settings_animate_gifs_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_animate_gifs"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@null"
|
||||
android:clickable="false"
|
||||
android:paddingStart="@dimen/medium_margin"
|
||||
android:text="@string/animate_gifs"
|
||||
app:switchPadding="@dimen/medium_margin" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/settings_crop_thumbnails_holder"
|
||||
android:layout_width="match_parent"
|
||||
|
@ -366,52 +343,6 @@
|
|||
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/settings_show_thumbnail_video_duration_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_show_thumbnail_video_duration"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@null"
|
||||
android:clickable="false"
|
||||
android:paddingStart="@dimen/medium_margin"
|
||||
android:text="@string/show_thumbnail_video_duration"
|
||||
app:switchPadding="@dimen/medium_margin" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/settings_show_thumbnail_file_types_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_show_thumbnail_file_types"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@null"
|
||||
android:clickable="false"
|
||||
android:paddingStart="@dimen/medium_margin"
|
||||
android:text="@string/show_image_file_types"
|
||||
app:switchPadding="@dimen/medium_margin" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/settings_file_thumbnail_style_holder"
|
||||
android:layout_width="match_parent"
|
||||
|
|
|
@ -0,0 +1,84 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/dialog_scrollview"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/dialog_holder"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:paddingTop="@dimen/normal_margin">
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/dialog_file_style_animate_gifs_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/dialog_file_style_animate_gifs"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@null"
|
||||
android:clickable="false"
|
||||
android:paddingStart="@dimen/medium_margin"
|
||||
android:text="@string/animate_gifs"
|
||||
app:switchPadding="@dimen/medium_margin" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/dialog_file_style_show_thumbnail_video_duration_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/dialog_file_style_show_thumbnail_video_duration"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@null"
|
||||
android:clickable="false"
|
||||
android:paddingStart="@dimen/medium_margin"
|
||||
android:text="@string/show_thumbnail_video_duration"
|
||||
app:switchPadding="@dimen/medium_margin" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/dialog_file_style_show_thumbnail_file_types_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/dialog_file_style_show_thumbnail_file_types"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@null"
|
||||
android:clickable="false"
|
||||
android:paddingStart="@dimen/medium_margin"
|
||||
android:text="@string/show_image_file_types"
|
||||
app:switchPadding="@dimen/medium_margin" />
|
||||
|
||||
</RelativeLayout>
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
Loading…
Reference in a new issue