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() {
ChangeSortingDialog(this, true) {
ChangeSortingDialog(this, true, false) {
getDirectories()
}
}

View file

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

View file

@ -4,6 +4,7 @@ import android.content.DialogInterface
import android.support.v7.app.AlertDialog
import android.view.LayoutInflater
import android.view.View
import com.simplemobiletools.commons.extensions.beVisibleIf
import com.simplemobiletools.commons.extensions.setupDialogStuff
import com.simplemobiletools.gallery.R
import com.simplemobiletools.gallery.activities.SimpleActivity
@ -11,7 +12,8 @@ import com.simplemobiletools.gallery.extensions.config
import com.simplemobiletools.gallery.helpers.*
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 {
private var currSorting = 0
@ -22,6 +24,8 @@ class ChangeSortingDialog(val activity: SimpleActivity, val isDirectorySorting:
init {
config = activity.config
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)
.setPositiveButton(R.string.ok, this)

View file

@ -61,7 +61,8 @@
android:id="@+id/sorting_dialog_radio_order"
android:layout_width="match_parent"
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
android:id="@+id/sorting_dialog_radio_ascending"
@ -79,5 +80,18 @@
android:paddingTop="@dimen/medium_margin"
android:text="@string/descending"/>
</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>
</ScrollView>