mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2025-01-18 06:17:59 +01:00
renaming thumbnail style dialog to folder thumbnail style
This commit is contained in:
parent
469415e93c
commit
28bbf5a728
3 changed files with 41 additions and 34 deletions
|
@ -12,7 +12,7 @@ import com.simplemobiletools.commons.extensions.*
|
||||||
import com.simplemobiletools.commons.helpers.*
|
import com.simplemobiletools.commons.helpers.*
|
||||||
import com.simplemobiletools.commons.models.RadioItem
|
import com.simplemobiletools.commons.models.RadioItem
|
||||||
import com.simplemobiletools.gallery.pro.R
|
import com.simplemobiletools.gallery.pro.R
|
||||||
import com.simplemobiletools.gallery.pro.dialogs.ChangeThumbnailStyleDialog
|
import com.simplemobiletools.gallery.pro.dialogs.ChangeFolderThumbnailStyleDialog
|
||||||
import com.simplemobiletools.gallery.pro.dialogs.ManageBottomActionsDialog
|
import com.simplemobiletools.gallery.pro.dialogs.ManageBottomActionsDialog
|
||||||
import com.simplemobiletools.gallery.pro.dialogs.ManageExtendedDetailsDialog
|
import com.simplemobiletools.gallery.pro.dialogs.ManageExtendedDetailsDialog
|
||||||
import com.simplemobiletools.gallery.pro.extensions.config
|
import com.simplemobiletools.gallery.pro.extensions.config
|
||||||
|
@ -70,6 +70,7 @@ class SettingsActivity : SimpleActivity() {
|
||||||
setupBottomActions()
|
setupBottomActions()
|
||||||
setupThumbnailVideoDuration()
|
setupThumbnailVideoDuration()
|
||||||
setupThumbnailFileTypes()
|
setupThumbnailFileTypes()
|
||||||
|
setupFileThumbnailStyle()
|
||||||
setupFolderThumbnailStyle()
|
setupFolderThumbnailStyle()
|
||||||
setupKeepLastModified()
|
setupKeepLastModified()
|
||||||
setupEnablePullToRefresh()
|
setupEnablePullToRefresh()
|
||||||
|
@ -398,10 +399,16 @@ class SettingsActivity : SimpleActivity() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun setupFileThumbnailStyle() {
|
||||||
|
settings_file_thumbnail_style_holder.setOnClickListener {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private fun setupFolderThumbnailStyle() {
|
private fun setupFolderThumbnailStyle() {
|
||||||
settings_folder_thumbnail_style.text = getFolderStyleText()
|
settings_folder_thumbnail_style.text = getFolderStyleText()
|
||||||
settings_folder_thumbnail_style_holder.setOnClickListener {
|
settings_folder_thumbnail_style_holder.setOnClickListener {
|
||||||
ChangeThumbnailStyleDialog(this) {
|
ChangeFolderThumbnailStyleDialog(this) {
|
||||||
settings_folder_thumbnail_style.text = getFolderStyleText()
|
settings_folder_thumbnail_style.text = getFolderStyleText()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,16 +15,16 @@ import com.simplemobiletools.commons.extensions.setupDialogStuff
|
||||||
import com.simplemobiletools.gallery.pro.R
|
import com.simplemobiletools.gallery.pro.R
|
||||||
import com.simplemobiletools.gallery.pro.extensions.config
|
import com.simplemobiletools.gallery.pro.extensions.config
|
||||||
import com.simplemobiletools.gallery.pro.helpers.*
|
import com.simplemobiletools.gallery.pro.helpers.*
|
||||||
import kotlinx.android.synthetic.main.dialog_change_thumbnail_style.view.*
|
import kotlinx.android.synthetic.main.dialog_change_folder_thumbnail_style.view.*
|
||||||
import kotlinx.android.synthetic.main.directory_item_grid_square.view.*
|
import kotlinx.android.synthetic.main.directory_item_grid_square.view.*
|
||||||
|
|
||||||
class ChangeThumbnailStyleDialog(val activity: BaseSimpleActivity, val callback: () -> Unit) : DialogInterface.OnClickListener {
|
class ChangeFolderThumbnailStyleDialog(val activity: BaseSimpleActivity, val callback: () -> Unit) : DialogInterface.OnClickListener {
|
||||||
private var config = activity.config
|
private var config = activity.config
|
||||||
private var view: View
|
private var view: View
|
||||||
|
|
||||||
init {
|
init {
|
||||||
view = activity.layoutInflater.inflate(R.layout.dialog_change_thumbnail_style, null).apply {
|
view = activity.layoutInflater.inflate(R.layout.dialog_change_folder_thumbnail_style, null).apply {
|
||||||
dialog_limit_title.isChecked = config.limitFolderTitle
|
dialog_folder_limit_title.isChecked = config.limitFolderTitle
|
||||||
}
|
}
|
||||||
|
|
||||||
AlertDialog.Builder(activity)
|
AlertDialog.Builder(activity)
|
||||||
|
@ -40,29 +40,29 @@ class ChangeThumbnailStyleDialog(val activity: BaseSimpleActivity, val callback:
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setupStyle() {
|
private fun setupStyle() {
|
||||||
val styleRadio = view.dialog_radio_style
|
val styleRadio = view.dialog_radio_folder_style
|
||||||
styleRadio.setOnCheckedChangeListener { group, checkedId ->
|
styleRadio.setOnCheckedChangeListener { group, checkedId ->
|
||||||
updateSample()
|
updateSample()
|
||||||
}
|
}
|
||||||
|
|
||||||
val styleBtn = when (config.folderStyle) {
|
val styleBtn = when (config.folderStyle) {
|
||||||
FOLDER_STYLE_SQUARE -> styleRadio.dialog_radio_square
|
FOLDER_STYLE_SQUARE -> styleRadio.dialog_radio_folder_square
|
||||||
else -> styleRadio.dialog_radio_rounded_corners
|
else -> styleRadio.dialog_radio_folder_rounded_corners
|
||||||
}
|
}
|
||||||
|
|
||||||
styleBtn.isChecked = true
|
styleBtn.isChecked = true
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setupMediaCount() {
|
private fun setupMediaCount() {
|
||||||
val countRadio = view.dialog_radio_count_holder
|
val countRadio = view.dialog_radio_folder_count_holder
|
||||||
countRadio.setOnCheckedChangeListener { group, checkedId ->
|
countRadio.setOnCheckedChangeListener { group, checkedId ->
|
||||||
updateSample()
|
updateSample()
|
||||||
}
|
}
|
||||||
|
|
||||||
val countBtn = when (config.showFolderMediaCount) {
|
val countBtn = when (config.showFolderMediaCount) {
|
||||||
FOLDER_MEDIA_CNT_LINE -> countRadio.dialog_radio_count_line
|
FOLDER_MEDIA_CNT_LINE -> countRadio.dialog_radio_folder_count_line
|
||||||
FOLDER_MEDIA_CNT_BRACKETS -> countRadio.dialog_radio_count_brackets
|
FOLDER_MEDIA_CNT_BRACKETS -> countRadio.dialog_radio_folder_count_brackets
|
||||||
else -> countRadio.dialog_radio_count_none
|
else -> countRadio.dialog_radio_folder_count_none
|
||||||
}
|
}
|
||||||
|
|
||||||
countBtn.isChecked = true
|
countBtn.isChecked = true
|
||||||
|
@ -72,23 +72,23 @@ class ChangeThumbnailStyleDialog(val activity: BaseSimpleActivity, val callback:
|
||||||
val photoCount = 36
|
val photoCount = 36
|
||||||
val folderName = "Camera"
|
val folderName = "Camera"
|
||||||
view.apply {
|
view.apply {
|
||||||
val useRoundedCornersLayout = dialog_radio_style.checkedRadioButtonId == R.id.dialog_radio_rounded_corners
|
val useRoundedCornersLayout = dialog_radio_folder_style.checkedRadioButtonId == R.id.dialog_radio_folder_rounded_corners
|
||||||
dialog_sample_holder.removeAllViews()
|
dialog_folder_sample_holder.removeAllViews()
|
||||||
|
|
||||||
val layout = if (useRoundedCornersLayout) R.layout.directory_item_grid_rounded_corners else R.layout.directory_item_grid_square
|
val layout = if (useRoundedCornersLayout) R.layout.directory_item_grid_rounded_corners else R.layout.directory_item_grid_square
|
||||||
val sampleView = activity.layoutInflater.inflate(layout, null)
|
val sampleView = activity.layoutInflater.inflate(layout, null)
|
||||||
dialog_sample_holder.addView(sampleView)
|
dialog_folder_sample_holder.addView(sampleView)
|
||||||
|
|
||||||
sampleView.layoutParams.width = activity.resources.getDimension(R.dimen.sample_thumbnail_size).toInt()
|
sampleView.layoutParams.width = activity.resources.getDimension(R.dimen.sample_thumbnail_size).toInt()
|
||||||
(sampleView.layoutParams as RelativeLayout.LayoutParams).addRule(RelativeLayout.CENTER_HORIZONTAL)
|
(sampleView.layoutParams as RelativeLayout.LayoutParams).addRule(RelativeLayout.CENTER_HORIZONTAL)
|
||||||
|
|
||||||
when (dialog_radio_count_holder.checkedRadioButtonId) {
|
when (dialog_radio_folder_count_holder.checkedRadioButtonId) {
|
||||||
R.id.dialog_radio_count_line -> {
|
R.id.dialog_radio_folder_count_line -> {
|
||||||
dir_name.text = folderName
|
dir_name.text = folderName
|
||||||
photo_cnt.text = photoCount.toString()
|
photo_cnt.text = photoCount.toString()
|
||||||
photo_cnt.beVisible()
|
photo_cnt.beVisible()
|
||||||
}
|
}
|
||||||
R.id.dialog_radio_count_brackets -> {
|
R.id.dialog_radio_folder_count_brackets -> {
|
||||||
photo_cnt.beGone()
|
photo_cnt.beGone()
|
||||||
dir_name.text = "$folderName ($photoCount)"
|
dir_name.text = "$folderName ($photoCount)"
|
||||||
}
|
}
|
||||||
|
@ -115,20 +115,20 @@ class ChangeThumbnailStyleDialog(val activity: BaseSimpleActivity, val callback:
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onClick(dialog: DialogInterface, which: Int) {
|
override fun onClick(dialog: DialogInterface, which: Int) {
|
||||||
val style = when (view.dialog_radio_style.checkedRadioButtonId) {
|
val style = when (view.dialog_radio_folder_style.checkedRadioButtonId) {
|
||||||
R.id.dialog_radio_square -> FOLDER_STYLE_SQUARE
|
R.id.dialog_radio_folder_square -> FOLDER_STYLE_SQUARE
|
||||||
else -> FOLDER_STYLE_ROUNDED_CORNERS
|
else -> FOLDER_STYLE_ROUNDED_CORNERS
|
||||||
}
|
}
|
||||||
|
|
||||||
val count = when (view.dialog_radio_count_holder.checkedRadioButtonId) {
|
val count = when (view.dialog_radio_folder_count_holder.checkedRadioButtonId) {
|
||||||
R.id.dialog_radio_count_line -> FOLDER_MEDIA_CNT_LINE
|
R.id.dialog_radio_folder_count_line -> FOLDER_MEDIA_CNT_LINE
|
||||||
R.id.dialog_radio_count_brackets -> FOLDER_MEDIA_CNT_BRACKETS
|
R.id.dialog_radio_folder_count_brackets -> FOLDER_MEDIA_CNT_BRACKETS
|
||||||
else -> FOLDER_MEDIA_CNT_NONE
|
else -> FOLDER_MEDIA_CNT_NONE
|
||||||
}
|
}
|
||||||
|
|
||||||
config.folderStyle = style
|
config.folderStyle = style
|
||||||
config.showFolderMediaCount = count
|
config.showFolderMediaCount = count
|
||||||
config.limitFolderTitle = view.dialog_limit_title.isChecked
|
config.limitFolderTitle = view.dialog_folder_limit_title.isChecked
|
||||||
callback()
|
callback()
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -14,19 +14,19 @@
|
||||||
android:paddingRight="@dimen/activity_margin">
|
android:paddingRight="@dimen/activity_margin">
|
||||||
|
|
||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
android:id="@+id/dialog_sample_holder"
|
android:id="@+id/dialog_folder_sample_holder"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content" />
|
android:layout_height="wrap_content" />
|
||||||
|
|
||||||
<RadioGroup
|
<RadioGroup
|
||||||
android:id="@+id/dialog_radio_style"
|
android:id="@+id/dialog_radio_folder_style"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="@dimen/activity_margin"
|
android:layout_marginTop="@dimen/activity_margin"
|
||||||
android:layout_marginBottom="@dimen/medium_margin">
|
android:layout_marginBottom="@dimen/medium_margin">
|
||||||
|
|
||||||
<com.simplemobiletools.commons.views.MyCompatRadioButton
|
<com.simplemobiletools.commons.views.MyCompatRadioButton
|
||||||
android:id="@+id/dialog_radio_square"
|
android:id="@+id/dialog_radio_folder_square"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:paddingTop="@dimen/medium_margin"
|
android:paddingTop="@dimen/medium_margin"
|
||||||
|
@ -34,7 +34,7 @@
|
||||||
android:text="@string/square" />
|
android:text="@string/square" />
|
||||||
|
|
||||||
<com.simplemobiletools.commons.views.MyCompatRadioButton
|
<com.simplemobiletools.commons.views.MyCompatRadioButton
|
||||||
android:id="@+id/dialog_radio_rounded_corners"
|
android:id="@+id/dialog_radio_folder_rounded_corners"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:paddingTop="@dimen/medium_margin"
|
android:paddingTop="@dimen/medium_margin"
|
||||||
|
@ -46,14 +46,14 @@
|
||||||
<include layout="@layout/divider" />
|
<include layout="@layout/divider" />
|
||||||
|
|
||||||
<RadioGroup
|
<RadioGroup
|
||||||
android:id="@+id/dialog_radio_count_holder"
|
android:id="@+id/dialog_radio_folder_count_holder"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="@dimen/medium_margin"
|
android:layout_marginTop="@dimen/medium_margin"
|
||||||
android:paddingBottom="@dimen/medium_margin">
|
android:paddingBottom="@dimen/medium_margin">
|
||||||
|
|
||||||
<com.simplemobiletools.commons.views.MyCompatRadioButton
|
<com.simplemobiletools.commons.views.MyCompatRadioButton
|
||||||
android:id="@+id/dialog_radio_count_line"
|
android:id="@+id/dialog_radio_folder_count_line"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:paddingTop="@dimen/medium_margin"
|
android:paddingTop="@dimen/medium_margin"
|
||||||
|
@ -61,7 +61,7 @@
|
||||||
android:text="@string/show_file_count_line" />
|
android:text="@string/show_file_count_line" />
|
||||||
|
|
||||||
<com.simplemobiletools.commons.views.MyCompatRadioButton
|
<com.simplemobiletools.commons.views.MyCompatRadioButton
|
||||||
android:id="@+id/dialog_radio_count_brackets"
|
android:id="@+id/dialog_radio_folder_count_brackets"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:paddingTop="@dimen/medium_margin"
|
android:paddingTop="@dimen/medium_margin"
|
||||||
|
@ -69,7 +69,7 @@
|
||||||
android:text="@string/show_file_count_brackets" />
|
android:text="@string/show_file_count_brackets" />
|
||||||
|
|
||||||
<com.simplemobiletools.commons.views.MyCompatRadioButton
|
<com.simplemobiletools.commons.views.MyCompatRadioButton
|
||||||
android:id="@+id/dialog_radio_count_none"
|
android:id="@+id/dialog_radio_folder_count_none"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:paddingTop="@dimen/medium_margin"
|
android:paddingTop="@dimen/medium_margin"
|
||||||
|
@ -80,7 +80,7 @@
|
||||||
<include layout="@layout/divider" />
|
<include layout="@layout/divider" />
|
||||||
|
|
||||||
<com.simplemobiletools.commons.views.MyAppCompatCheckbox
|
<com.simplemobiletools.commons.views.MyAppCompatCheckbox
|
||||||
android:id="@+id/dialog_limit_title"
|
android:id="@+id/dialog_folder_limit_title"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:paddingTop="@dimen/activity_margin"
|
android:paddingTop="@dimen/activity_margin"
|
Loading…
Reference in a new issue