Restyle sort dialog, make it somewhat nicer
This commit is contained in:
parent
a1bcb87c31
commit
4dd50014b3
@ -795,13 +795,13 @@ public class LibraryActivity
|
|||||||
break;
|
break;
|
||||||
case MENU_SORT: {
|
case MENU_SORT: {
|
||||||
SortableAdapter adapter = (SortableAdapter)mCurrentAdapter;
|
SortableAdapter adapter = (SortableAdapter)mCurrentAdapter;
|
||||||
LinearLayout header = (LinearLayout)getLayoutInflater().inflate(R.layout.sort_dialog, null);
|
LinearLayout list = (LinearLayout)getLayoutInflater().inflate(R.layout.sort_dialog, null);
|
||||||
CheckBox reverseSort = (CheckBox)header.findViewById(R.id.reverse_sort);
|
CheckBox reverseSort = (CheckBox)list.findViewById(R.id.reverse_sort);
|
||||||
|
|
||||||
int[] itemIds = adapter.getSortEntries();
|
int[] itemIds = adapter.getSortEntries();
|
||||||
String[] items = new String[itemIds.length];
|
String[] items = new String[itemIds.length];
|
||||||
Resources res = getResources();
|
Resources res = getResources();
|
||||||
for (int i = itemIds.length; --i != -1; ) {
|
for (int i = 0; i < itemIds.length; i++) {
|
||||||
items[i] = res.getString(itemIds[i]);
|
items[i] = res.getString(itemIds[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -810,11 +810,11 @@ public class LibraryActivity
|
|||||||
|
|
||||||
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
||||||
builder.setTitle(R.string.sort_by);
|
builder.setTitle(R.string.sort_by);
|
||||||
builder.setSingleChoiceItems(items, mode + 1, this); // add 1 for header
|
builder.setSingleChoiceItems(items, mode, this);
|
||||||
builder.setNeutralButton(R.string.done, null);
|
builder.setPositiveButton(R.string.done, null);
|
||||||
|
|
||||||
AlertDialog dialog = builder.create();
|
AlertDialog dialog = builder.create();
|
||||||
dialog.getListView().addHeaderView(header);
|
dialog.getListView().addFooterView(list);
|
||||||
dialog.setOnDismissListener(this);
|
dialog.setOnDismissListener(this);
|
||||||
dialog.show();
|
dialog.show();
|
||||||
break;
|
break;
|
||||||
@ -918,8 +918,7 @@ public class LibraryActivity
|
|||||||
public void onDismiss(DialogInterface dialog)
|
public void onDismiss(DialogInterface dialog)
|
||||||
{
|
{
|
||||||
ListView list = ((AlertDialog)dialog).getListView();
|
ListView list = ((AlertDialog)dialog).getListView();
|
||||||
// subtract 1 for header
|
int which = list.getCheckedItemPosition();
|
||||||
int which = list.getCheckedItemPosition() - 1;
|
|
||||||
|
|
||||||
CheckBox reverseSort = (CheckBox)list.findViewById(R.id.reverse_sort);
|
CheckBox reverseSort = (CheckBox)list.findViewById(R.id.reverse_sort);
|
||||||
if (reverseSort.isChecked()) {
|
if (reverseSort.isChecked()) {
|
||||||
|
@ -24,7 +24,6 @@ THE SOFTWARE.
|
|||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:paddingBottom="10dip"
|
|
||||||
android:orientation="horizontal">
|
android:orientation="horizontal">
|
||||||
<CheckBox
|
<CheckBox
|
||||||
android:id="@+id/reverse_sort"
|
android:id="@+id/reverse_sort"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user