add a checkbox to sorting dialog for applying the selection to a folder only

This commit is contained in:
tibbi 2017-02-28 20:40:55 +01:00
parent bfb07dae2c
commit a8eeac2f8b
4 changed files with 22 additions and 4 deletions

View File

@ -158,7 +158,7 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener {
} }
private fun showSortingDialog() { private fun showSortingDialog() {
ChangeSortingDialog(this, true) { ChangeSortingDialog(this, true, false) {
getDirectories() getDirectories()
} }
} }

View File

@ -145,7 +145,7 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener {
} }
private fun showSortingDialog() { private fun showSortingDialog() {
ChangeSortingDialog(this, false) { ChangeSortingDialog(this, false, true) {
getMedia() getMedia()
} }
} }

View File

@ -4,6 +4,7 @@ import android.content.DialogInterface
import android.support.v7.app.AlertDialog import android.support.v7.app.AlertDialog
import android.view.LayoutInflater import android.view.LayoutInflater
import android.view.View import android.view.View
import com.simplemobiletools.commons.extensions.beVisibleIf
import com.simplemobiletools.commons.extensions.setupDialogStuff import com.simplemobiletools.commons.extensions.setupDialogStuff
import com.simplemobiletools.gallery.R import com.simplemobiletools.gallery.R
import com.simplemobiletools.gallery.activities.SimpleActivity import com.simplemobiletools.gallery.activities.SimpleActivity
@ -11,7 +12,8 @@ import com.simplemobiletools.gallery.extensions.config
import com.simplemobiletools.gallery.helpers.* import com.simplemobiletools.gallery.helpers.*
import kotlinx.android.synthetic.main.dialog_change_sorting.view.* import kotlinx.android.synthetic.main.dialog_change_sorting.view.*
class ChangeSortingDialog(val activity: SimpleActivity, val isDirectorySorting: Boolean, val callback: () -> Unit) : DialogInterface.OnClickListener { class ChangeSortingDialog(val activity: SimpleActivity, val isDirectorySorting: Boolean, val showFolderCheckbox: Boolean, val callback: () -> Unit) :
DialogInterface.OnClickListener {
companion object { companion object {
private var currSorting = 0 private var currSorting = 0
@ -22,6 +24,8 @@ class ChangeSortingDialog(val activity: SimpleActivity, val isDirectorySorting:
init { init {
config = activity.config config = activity.config
view = LayoutInflater.from(activity).inflate(R.layout.dialog_change_sorting, null) view = LayoutInflater.from(activity).inflate(R.layout.dialog_change_sorting, null)
view.use_for_this_folder_divider.beVisibleIf(showFolderCheckbox)
view.sorting_dialog_use_for_this_folder.beVisibleIf(showFolderCheckbox)
AlertDialog.Builder(activity) AlertDialog.Builder(activity)
.setPositiveButton(R.string.ok, this) .setPositiveButton(R.string.ok, this)

View File

@ -61,7 +61,8 @@
android:id="@+id/sorting_dialog_radio_order" android:id="@+id/sorting_dialog_radio_order"
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">
<com.simplemobiletools.commons.views.MyCompatRadioButton <com.simplemobiletools.commons.views.MyCompatRadioButton
android:id="@+id/sorting_dialog_radio_ascending" android:id="@+id/sorting_dialog_radio_ascending"
@ -79,5 +80,18 @@
android:paddingTop="@dimen/medium_margin" android:paddingTop="@dimen/medium_margin"
android:text="@string/descending"/> android:text="@string/descending"/>
</RadioGroup> </RadioGroup>
<include
android:id="@+id/use_for_this_folder_divider"
layout="@layout/divider"/>
<com.simplemobiletools.commons.views.MyAppCompatCheckbox
android:id="@+id/sorting_dialog_use_for_this_folder"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="@dimen/activity_margin"
android:paddingTop="@dimen/activity_margin"
android:text="@string/use_for_this_folder"/>
</LinearLayout> </LinearLayout>
</ScrollView> </ScrollView>