wrap the sorting dialog in a scrollview
This commit is contained in:
parent
747e007fd0
commit
49247ee9f1
3 changed files with 77 additions and 70 deletions
|
@ -34,36 +34,36 @@ class ChangeSortingDialog(val activity: Activity, val isDirectorySorting: Boolea
|
|||
}
|
||||
|
||||
private fun setupSortRadio() {
|
||||
val sortingRadio = view.dialog_radio_sorting
|
||||
var sortBtn = sortingRadio.dialog_radio_name
|
||||
val sortingRadio = view.sorting_dialog_radio_sorting
|
||||
var sortBtn = sortingRadio.sorting_dialog_radio_name
|
||||
|
||||
if (currSorting and SORT_BY_DATE != 0) {
|
||||
sortBtn = sortingRadio.dialog_radio_date
|
||||
sortBtn = sortingRadio.sorting_dialog_radio_date
|
||||
} else if (currSorting and SORT_BY_SIZE != 0) {
|
||||
sortBtn = sortingRadio.dialog_radio_size
|
||||
sortBtn = sortingRadio.sorting_dialog_radio_size
|
||||
}
|
||||
sortBtn.isChecked = true
|
||||
}
|
||||
|
||||
private fun setupOrderRadio() {
|
||||
val orderRadio = view.dialog_radio_order
|
||||
var orderBtn = orderRadio.dialog_radio_ascending
|
||||
val orderRadio = view.sorting_dialog_radio_order
|
||||
var orderBtn = orderRadio.sorting_dialog_radio_ascending
|
||||
|
||||
if (currSorting and SORT_DESCENDING != 0) {
|
||||
orderBtn = orderRadio.dialog_radio_descending
|
||||
orderBtn = orderRadio.sorting_dialog_radio_descending
|
||||
}
|
||||
orderBtn.isChecked = true
|
||||
}
|
||||
|
||||
override fun onClick(dialog: DialogInterface, which: Int) {
|
||||
val sortingRadio = view.dialog_radio_sorting
|
||||
val sortingRadio = view.sorting_dialog_radio_sorting
|
||||
var sorting = when (sortingRadio.checkedRadioButtonId) {
|
||||
R.id.dialog_radio_name -> SORT_BY_NAME
|
||||
R.id.dialog_radio_date -> SORT_BY_DATE
|
||||
R.id.sorting_dialog_radio_name -> SORT_BY_NAME
|
||||
R.id.sorting_dialog_radio_date -> SORT_BY_DATE
|
||||
else -> SORT_BY_SIZE
|
||||
}
|
||||
|
||||
if (view.dialog_radio_order.checkedRadioButtonId == R.id.dialog_radio_descending) {
|
||||
if (view.sorting_dialog_radio_order.checkedRadioButtonId == R.id.sorting_dialog_radio_descending) {
|
||||
sorting = sorting or SORT_DESCENDING
|
||||
}
|
||||
|
||||
|
|
|
@ -1,69 +1,76 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout android:id="@+id/dialog_holder"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:paddingLeft="@dimen/activity_margin"
|
||||
android:paddingRight="@dimen/activity_margin"
|
||||
android:paddingTop="@dimen/activity_margin">
|
||||
<ScrollView
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/sorting_dialog_scrollview"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<RadioGroup
|
||||
android:id="@+id/dialog_radio_sorting"
|
||||
<LinearLayout
|
||||
android:id="@+id/sorting_dialog_holder"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:paddingLeft="@dimen/activity_margin"
|
||||
android:paddingRight="@dimen/activity_margin"
|
||||
android:paddingTop="@dimen/activity_margin">
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/dialog_radio_name"
|
||||
<RadioGroup
|
||||
android:id="@+id/sorting_dialog_radio_sorting"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingBottom="@dimen/medium_padding"
|
||||
android:paddingTop="@dimen/medium_padding"
|
||||
android:text="@string/name"/>
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/dialog_radio_date"
|
||||
<RadioButton
|
||||
android:id="@+id/sorting_dialog_radio_name"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingBottom="@dimen/medium_padding"
|
||||
android:paddingTop="@dimen/medium_padding"
|
||||
android:text="@string/name"/>
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/sorting_dialog_radio_date"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingBottom="@dimen/medium_padding"
|
||||
android:paddingTop="@dimen/medium_padding"
|
||||
android:text="@string/date"/>
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/sorting_dialog_radio_size"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingBottom="@dimen/medium_padding"
|
||||
android:paddingTop="@dimen/medium_padding"
|
||||
android:text="@string/size"/>
|
||||
</RadioGroup>
|
||||
|
||||
<ImageView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingBottom="@dimen/medium_padding"
|
||||
android:paddingTop="@dimen/medium_padding"
|
||||
android:text="@string/date"/>
|
||||
android:layout_height="1px"
|
||||
android:layout_marginBottom="@dimen/medium_padding"
|
||||
android:layout_marginTop="@dimen/medium_padding"
|
||||
android:background="@color/light_grey"/>
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/dialog_radio_size"
|
||||
<RadioGroup
|
||||
android:id="@+id/sorting_dialog_radio_order"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingBottom="@dimen/medium_padding"
|
||||
android:paddingTop="@dimen/medium_padding"
|
||||
android:text="@string/size"/>
|
||||
</RadioGroup>
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1px"
|
||||
android:layout_marginBottom="@dimen/medium_padding"
|
||||
android:layout_marginTop="@dimen/medium_padding"
|
||||
android:background="@color/light_grey"/>
|
||||
<RadioButton
|
||||
android:id="@+id/sorting_dialog_radio_ascending"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingBottom="@dimen/medium_padding"
|
||||
android:paddingTop="@dimen/medium_padding"
|
||||
android:text="@string/ascending"/>
|
||||
|
||||
<RadioGroup
|
||||
android:id="@+id/dialog_radio_order"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/dialog_radio_ascending"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingBottom="@dimen/medium_padding"
|
||||
android:paddingTop="@dimen/medium_padding"
|
||||
android:text="@string/ascending"/>
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/dialog_radio_descending"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingBottom="@dimen/medium_padding"
|
||||
android:paddingTop="@dimen/medium_padding"
|
||||
android:text="@string/descending"/>
|
||||
</RadioGroup>
|
||||
</LinearLayout>
|
||||
<RadioButton
|
||||
android:id="@+id/sorting_dialog_radio_descending"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingBottom="@dimen/medium_padding"
|
||||
android:paddingTop="@dimen/medium_padding"
|
||||
android:text="@string/descending"/>
|
||||
</RadioGroup>
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/dialog_holder"
|
||||
android:id="@+id/sorting_dialog_holder"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
|
|
Loading…
Reference in a new issue