Merge change 26713 into eclair
* changes: Set selection in single choice list. Reorder the menu entries to use the menu options as indices into the choice box directly
This commit is contained in:
@@ -134,13 +134,13 @@ public class ManageApplications extends ListActivity implements
|
|||||||
// sort order that can be changed through the menu can be sorted alphabetically
|
// sort order that can be changed through the menu can be sorted alphabetically
|
||||||
// or size(descending)
|
// or size(descending)
|
||||||
private static final int MENU_OPTIONS_BASE = 0;
|
private static final int MENU_OPTIONS_BASE = 0;
|
||||||
public static final int SORT_ORDER_ALPHA = MENU_OPTIONS_BASE + 0;
|
|
||||||
public static final int SORT_ORDER_SIZE = MENU_OPTIONS_BASE + 1;
|
|
||||||
// Filter options used for displayed list of applications
|
// Filter options used for displayed list of applications
|
||||||
public static final int FILTER_APPS_ALL = MENU_OPTIONS_BASE + 2;
|
public static final int FILTER_APPS_ALL = MENU_OPTIONS_BASE + 0;
|
||||||
public static final int FILTER_APPS_THIRD_PARTY = MENU_OPTIONS_BASE + 3;
|
public static final int FILTER_APPS_RUNNING = MENU_OPTIONS_BASE + 1;
|
||||||
public static final int FILTER_APPS_RUNNING = MENU_OPTIONS_BASE + 4;
|
public static final int FILTER_APPS_THIRD_PARTY = MENU_OPTIONS_BASE + 2;
|
||||||
public static final int FILTER_OPTIONS = MENU_OPTIONS_BASE + 5;
|
public static final int FILTER_OPTIONS = MENU_OPTIONS_BASE + 3;
|
||||||
|
public static final int SORT_ORDER_ALPHA = MENU_OPTIONS_BASE + 4;
|
||||||
|
public static final int SORT_ORDER_SIZE = MENU_OPTIONS_BASE + 5;
|
||||||
// Alert Dialog presented to user to find out the filter option
|
// Alert Dialog presented to user to find out the filter option
|
||||||
private AlertDialog mAlertDlg;
|
private AlertDialog mAlertDlg;
|
||||||
// sort order
|
// sort order
|
||||||
@@ -1953,6 +1953,8 @@ public class ManageApplications extends ListActivity implements
|
|||||||
if ((menuId == SORT_ORDER_ALPHA) || (menuId == SORT_ORDER_SIZE)) {
|
if ((menuId == SORT_ORDER_ALPHA) || (menuId == SORT_ORDER_SIZE)) {
|
||||||
sendMessageToHandler(REORDER_LIST, menuId);
|
sendMessageToHandler(REORDER_LIST, menuId);
|
||||||
} else if (menuId == FILTER_OPTIONS) {
|
} else if (menuId == FILTER_OPTIONS) {
|
||||||
|
// Pick up the selection value from the list of added choice items.
|
||||||
|
int selection = mFilterApps - MENU_OPTIONS_BASE;
|
||||||
if (mAlertDlg == null) {
|
if (mAlertDlg == null) {
|
||||||
mAlertDlg = new AlertDialog.Builder(this).
|
mAlertDlg = new AlertDialog.Builder(this).
|
||||||
setTitle(R.string.filter_dlg_title).
|
setTitle(R.string.filter_dlg_title).
|
||||||
@@ -1960,7 +1962,7 @@ public class ManageApplications extends ListActivity implements
|
|||||||
setSingleChoiceItems(new CharSequence[] {getText(R.string.filter_apps_all),
|
setSingleChoiceItems(new CharSequence[] {getText(R.string.filter_apps_all),
|
||||||
getText(R.string.filter_apps_running),
|
getText(R.string.filter_apps_running),
|
||||||
getText(R.string.filter_apps_third_party)},
|
getText(R.string.filter_apps_third_party)},
|
||||||
-1, this).
|
selection, this).
|
||||||
create();
|
create();
|
||||||
}
|
}
|
||||||
mAlertDlg.show();
|
mAlertDlg.show();
|
||||||
@@ -1985,18 +1987,16 @@ public class ManageApplications extends ListActivity implements
|
|||||||
switch (which) {
|
switch (which) {
|
||||||
// Make sure that values of 0, 1, 2 match options all, running, third_party when
|
// Make sure that values of 0, 1, 2 match options all, running, third_party when
|
||||||
// created via the AlertDialog.Builder
|
// created via the AlertDialog.Builder
|
||||||
case 0:
|
case FILTER_APPS_ALL:
|
||||||
newOption = FILTER_APPS_ALL;
|
|
||||||
break;
|
break;
|
||||||
case 1:
|
case FILTER_APPS_RUNNING:
|
||||||
newOption = FILTER_APPS_RUNNING;
|
|
||||||
break;
|
break;
|
||||||
case 2:
|
case FILTER_APPS_THIRD_PARTY:
|
||||||
newOption = FILTER_APPS_THIRD_PARTY;
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
newOption = which;
|
||||||
mAlertDlg.dismiss();
|
mAlertDlg.dismiss();
|
||||||
sendMessageToHandler(REORDER_LIST, newOption);
|
sendMessageToHandler(REORDER_LIST, newOption);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user