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.models.RadioItem
|
||||
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.ManageExtendedDetailsDialog
|
||||
import com.simplemobiletools.gallery.pro.extensions.config
|
||||
|
@ -70,6 +70,7 @@ class SettingsActivity : SimpleActivity() {
|
|||
setupBottomActions()
|
||||
setupThumbnailVideoDuration()
|
||||
setupThumbnailFileTypes()
|
||||
setupFileThumbnailStyle()
|
||||
setupFolderThumbnailStyle()
|
||||
setupKeepLastModified()
|
||||
setupEnablePullToRefresh()
|
||||
|
@ -398,10 +399,16 @@ class SettingsActivity : SimpleActivity() {
|
|||
}
|
||||
}
|
||||
|
||||
private fun setupFileThumbnailStyle() {
|
||||
settings_file_thumbnail_style_holder.setOnClickListener {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private fun setupFolderThumbnailStyle() {
|
||||
settings_folder_thumbnail_style.text = getFolderStyleText()
|
||||
settings_folder_thumbnail_style_holder.setOnClickListener {
|
||||
ChangeThumbnailStyleDialog(this) {
|
||||
ChangeFolderThumbnailStyleDialog(this) {
|
||||
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.extensions.config
|
||||
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.*
|
||||
|
||||
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 view: View
|
||||
|
||||
init {
|
||||
view = activity.layoutInflater.inflate(R.layout.dialog_change_thumbnail_style, null).apply {
|
||||
dialog_limit_title.isChecked = config.limitFolderTitle
|
||||
view = activity.layoutInflater.inflate(R.layout.dialog_change_folder_thumbnail_style, null).apply {
|
||||
dialog_folder_limit_title.isChecked = config.limitFolderTitle
|
||||
}
|
||||
|
||||
AlertDialog.Builder(activity)
|
||||
|
@ -40,29 +40,29 @@ class ChangeThumbnailStyleDialog(val activity: BaseSimpleActivity, val callback:
|
|||
}
|
||||
|
||||
private fun setupStyle() {
|
||||
val styleRadio = view.dialog_radio_style
|
||||
val styleRadio = view.dialog_radio_folder_style
|
||||
styleRadio.setOnCheckedChangeListener { group, checkedId ->
|
||||
updateSample()
|
||||
}
|
||||
|
||||
val styleBtn = when (config.folderStyle) {
|
||||
FOLDER_STYLE_SQUARE -> styleRadio.dialog_radio_square
|
||||
else -> styleRadio.dialog_radio_rounded_corners
|
||||
FOLDER_STYLE_SQUARE -> styleRadio.dialog_radio_folder_square
|
||||
else -> styleRadio.dialog_radio_folder_rounded_corners
|
||||
}
|
||||
|
||||
styleBtn.isChecked = true
|
||||
}
|
||||
|
||||
private fun setupMediaCount() {
|
||||
val countRadio = view.dialog_radio_count_holder
|
||||
val countRadio = view.dialog_radio_folder_count_holder
|
||||
countRadio.setOnCheckedChangeListener { group, checkedId ->
|
||||
updateSample()
|
||||
}
|
||||
|
||||
val countBtn = when (config.showFolderMediaCount) {
|
||||
FOLDER_MEDIA_CNT_LINE -> countRadio.dialog_radio_count_line
|
||||
FOLDER_MEDIA_CNT_BRACKETS -> countRadio.dialog_radio_count_brackets
|
||||
else -> countRadio.dialog_radio_count_none
|
||||
FOLDER_MEDIA_CNT_LINE -> countRadio.dialog_radio_folder_count_line
|
||||
FOLDER_MEDIA_CNT_BRACKETS -> countRadio.dialog_radio_folder_count_brackets
|
||||
else -> countRadio.dialog_radio_folder_count_none
|
||||
}
|
||||
|
||||
countBtn.isChecked = true
|
||||
|
@ -72,23 +72,23 @@ class ChangeThumbnailStyleDialog(val activity: BaseSimpleActivity, val callback:
|
|||
val photoCount = 36
|
||||
val folderName = "Camera"
|
||||
view.apply {
|
||||
val useRoundedCornersLayout = dialog_radio_style.checkedRadioButtonId == R.id.dialog_radio_rounded_corners
|
||||
dialog_sample_holder.removeAllViews()
|
||||
val useRoundedCornersLayout = dialog_radio_folder_style.checkedRadioButtonId == R.id.dialog_radio_folder_rounded_corners
|
||||
dialog_folder_sample_holder.removeAllViews()
|
||||
|
||||
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)
|
||||
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 as RelativeLayout.LayoutParams).addRule(RelativeLayout.CENTER_HORIZONTAL)
|
||||
|
||||
when (dialog_radio_count_holder.checkedRadioButtonId) {
|
||||
R.id.dialog_radio_count_line -> {
|
||||
when (dialog_radio_folder_count_holder.checkedRadioButtonId) {
|
||||
R.id.dialog_radio_folder_count_line -> {
|
||||
dir_name.text = folderName
|
||||
photo_cnt.text = photoCount.toString()
|
||||
photo_cnt.beVisible()
|
||||
}
|
||||
R.id.dialog_radio_count_brackets -> {
|
||||
R.id.dialog_radio_folder_count_brackets -> {
|
||||
photo_cnt.beGone()
|
||||
dir_name.text = "$folderName ($photoCount)"
|
||||
}
|
||||
|
@ -115,20 +115,20 @@ class ChangeThumbnailStyleDialog(val activity: BaseSimpleActivity, val callback:
|
|||
}
|
||||
|
||||
override fun onClick(dialog: DialogInterface, which: Int) {
|
||||
val style = when (view.dialog_radio_style.checkedRadioButtonId) {
|
||||
R.id.dialog_radio_square -> FOLDER_STYLE_SQUARE
|
||||
val style = when (view.dialog_radio_folder_style.checkedRadioButtonId) {
|
||||
R.id.dialog_radio_folder_square -> FOLDER_STYLE_SQUARE
|
||||
else -> FOLDER_STYLE_ROUNDED_CORNERS
|
||||
}
|
||||
|
||||
val count = when (view.dialog_radio_count_holder.checkedRadioButtonId) {
|
||||
R.id.dialog_radio_count_line -> FOLDER_MEDIA_CNT_LINE
|
||||
R.id.dialog_radio_count_brackets -> FOLDER_MEDIA_CNT_BRACKETS
|
||||
val count = when (view.dialog_radio_folder_count_holder.checkedRadioButtonId) {
|
||||
R.id.dialog_radio_folder_count_line -> FOLDER_MEDIA_CNT_LINE
|
||||
R.id.dialog_radio_folder_count_brackets -> FOLDER_MEDIA_CNT_BRACKETS
|
||||
else -> FOLDER_MEDIA_CNT_NONE
|
||||
}
|
||||
|
||||
config.folderStyle = style
|
||||
config.showFolderMediaCount = count
|
||||
config.limitFolderTitle = view.dialog_limit_title.isChecked
|
||||
config.limitFolderTitle = view.dialog_folder_limit_title.isChecked
|
||||
callback()
|
||||
}
|
||||
}
|
|
@ -14,19 +14,19 @@
|
|||
android:paddingRight="@dimen/activity_margin">
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/dialog_sample_holder"
|
||||
android:id="@+id/dialog_folder_sample_holder"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<RadioGroup
|
||||
android:id="@+id/dialog_radio_style"
|
||||
android:id="@+id/dialog_radio_folder_style"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/activity_margin"
|
||||
android:layout_marginBottom="@dimen/medium_margin">
|
||||
|
||||
<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_height="wrap_content"
|
||||
android:paddingTop="@dimen/medium_margin"
|
||||
|
@ -34,7 +34,7 @@
|
|||
android:text="@string/square" />
|
||||
|
||||
<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_height="wrap_content"
|
||||
android:paddingTop="@dimen/medium_margin"
|
||||
|
@ -46,14 +46,14 @@
|
|||
<include layout="@layout/divider" />
|
||||
|
||||
<RadioGroup
|
||||
android:id="@+id/dialog_radio_count_holder"
|
||||
android:id="@+id/dialog_radio_folder_count_holder"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/medium_margin"
|
||||
android:paddingBottom="@dimen/medium_margin">
|
||||
|
||||
<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_height="wrap_content"
|
||||
android:paddingTop="@dimen/medium_margin"
|
||||
|
@ -61,7 +61,7 @@
|
|||
android:text="@string/show_file_count_line" />
|
||||
|
||||
<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_height="wrap_content"
|
||||
android:paddingTop="@dimen/medium_margin"
|
||||
|
@ -69,7 +69,7 @@
|
|||
android:text="@string/show_file_count_brackets" />
|
||||
|
||||
<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_height="wrap_content"
|
||||
android:paddingTop="@dimen/medium_margin"
|
||||
|
@ -80,7 +80,7 @@
|
|||
<include layout="@layout/divider" />
|
||||
|
||||
<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_height="wrap_content"
|
||||
android:paddingTop="@dimen/activity_margin"
|
Loading…
Reference in a new issue