Convert menu options to tabs
Add new tab for apps on sd
This commit is contained in:
@@ -1585,6 +1585,9 @@
|
|||||||
<!-- Text for filter option in ManageApps screen to display list of running
|
<!-- Text for filter option in ManageApps screen to display list of running
|
||||||
packages only. -->
|
packages only. -->
|
||||||
<string name="filter_apps_running">Running</string>
|
<string name="filter_apps_running">Running</string>
|
||||||
|
<!-- Text for filter option in ManageApps screen to display list of
|
||||||
|
packages installed on sdcard. -->
|
||||||
|
<string name="filter_apps_onsdcard">On SD card</string>
|
||||||
<string name="loading">Loading\u2026</string>
|
<string name="loading">Loading\u2026</string>
|
||||||
<!-- Manage app screen, shown when the activity is busy recomputing the size of each app -->
|
<!-- Manage app screen, shown when the activity is busy recomputing the size of each app -->
|
||||||
<string name="recompute_size">Recomputing size\u2026</string>
|
<string name="recompute_size">Recomputing size\u2026</string>
|
||||||
|
@@ -140,7 +140,8 @@ public class ManageApplications extends TabActivity implements
|
|||||||
public static final int FILTER_APPS_ALL = MENU_OPTIONS_BASE + 0;
|
public static final int FILTER_APPS_ALL = MENU_OPTIONS_BASE + 0;
|
||||||
public static final int FILTER_APPS_RUNNING = MENU_OPTIONS_BASE + 1;
|
public static final int FILTER_APPS_RUNNING = MENU_OPTIONS_BASE + 1;
|
||||||
public static final int FILTER_APPS_THIRD_PARTY = MENU_OPTIONS_BASE + 2;
|
public static final int FILTER_APPS_THIRD_PARTY = MENU_OPTIONS_BASE + 2;
|
||||||
public static final int FILTER_OPTIONS = MENU_OPTIONS_BASE + 3;
|
public static final int FILTER_APPS_SDCARD = MENU_OPTIONS_BASE + 3;
|
||||||
|
|
||||||
public static final int SORT_ORDER_ALPHA = MENU_OPTIONS_BASE + 4;
|
public static final int SORT_ORDER_ALPHA = MENU_OPTIONS_BASE + 4;
|
||||||
public static final int SORT_ORDER_SIZE = MENU_OPTIONS_BASE + 5;
|
public static final int SORT_ORDER_SIZE = MENU_OPTIONS_BASE + 5;
|
||||||
// sort order
|
// sort order
|
||||||
@@ -612,7 +613,16 @@ public class ManageApplications extends TabActivity implements
|
|||||||
if (installedAppList == null) {
|
if (installedAppList == null) {
|
||||||
return new ArrayList<ApplicationInfo> ();
|
return new ArrayList<ApplicationInfo> ();
|
||||||
}
|
}
|
||||||
if (filterOption == FILTER_APPS_THIRD_PARTY) {
|
if (filterOption == FILTER_APPS_SDCARD) {
|
||||||
|
List<ApplicationInfo> appList =new ArrayList<ApplicationInfo> ();
|
||||||
|
for (ApplicationInfo appInfo : installedAppList) {
|
||||||
|
if ((appInfo.flags & ApplicationInfo.FLAG_ON_SDCARD) != 0) {
|
||||||
|
// App on sdcard
|
||||||
|
appList.add(appInfo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return appList;
|
||||||
|
} else if (filterOption == FILTER_APPS_THIRD_PARTY) {
|
||||||
List<ApplicationInfo> appList =new ArrayList<ApplicationInfo> ();
|
List<ApplicationInfo> appList =new ArrayList<ApplicationInfo> ();
|
||||||
for (ApplicationInfo appInfo : installedAppList) {
|
for (ApplicationInfo appInfo : installedAppList) {
|
||||||
boolean flag = false;
|
boolean flag = false;
|
||||||
@@ -680,7 +690,21 @@ public class ManageApplications extends TabActivity implements
|
|||||||
if(pAppList == null) {
|
if(pAppList == null) {
|
||||||
return retList;
|
return retList;
|
||||||
}
|
}
|
||||||
if (filterOption == FILTER_APPS_THIRD_PARTY) {
|
if (filterOption == FILTER_APPS_SDCARD) {
|
||||||
|
for (ApplicationInfo appInfo : pAppList) {
|
||||||
|
boolean flag = false;
|
||||||
|
if ((appInfo.flags & ApplicationInfo.FLAG_ON_SDCARD) != 0) {
|
||||||
|
// App on sdcard
|
||||||
|
flag = true;
|
||||||
|
}
|
||||||
|
if (flag) {
|
||||||
|
if (matchFilter(filter, filterMap, appInfo.packageName)) {
|
||||||
|
retList.add(appInfo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return retList;
|
||||||
|
} else if (filterOption == FILTER_APPS_THIRD_PARTY) {
|
||||||
for (ApplicationInfo appInfo : pAppList) {
|
for (ApplicationInfo appInfo : pAppList) {
|
||||||
boolean flag = false;
|
boolean flag = false;
|
||||||
if ((appInfo.flags & ApplicationInfo.FLAG_UPDATED_SYSTEM_APP) != 0) {
|
if ((appInfo.flags & ApplicationInfo.FLAG_UPDATED_SYSTEM_APP) != 0) {
|
||||||
@@ -1243,6 +1267,10 @@ public class ManageApplications extends TabActivity implements
|
|||||||
} else if ((info.flags & ApplicationInfo.FLAG_UPDATED_SYSTEM_APP) != 0) {
|
} else if ((info.flags & ApplicationInfo.FLAG_UPDATED_SYSTEM_APP) != 0) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
} else if (filterOption == FILTER_APPS_SDCARD) {
|
||||||
|
if ((info.flags & ApplicationInfo.FLAG_ON_SDCARD) != 0) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -1557,6 +1585,7 @@ public class ManageApplications extends TabActivity implements
|
|||||||
static final String TAB_DOWNLOADED = "Downloaded";
|
static final String TAB_DOWNLOADED = "Downloaded";
|
||||||
static final String TAB_RUNNING = "Running";
|
static final String TAB_RUNNING = "Running";
|
||||||
static final String TAB_ALL = "All";
|
static final String TAB_ALL = "All";
|
||||||
|
static final String TAB_SDCARD = "OnSdCard";
|
||||||
private View mRootView;
|
private View mRootView;
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
@@ -1623,6 +1652,10 @@ public class ManageApplications extends TabActivity implements
|
|||||||
tabHost.addTab(tabHost.newTabSpec(TAB_ALL)
|
tabHost.addTab(tabHost.newTabSpec(TAB_ALL)
|
||||||
.setIndicator(getString(R.string.filter_apps_all))
|
.setIndicator(getString(R.string.filter_apps_all))
|
||||||
.setContent(this));
|
.setContent(this));
|
||||||
|
tabHost.addTab(tabHost.newTabSpec(TAB_SDCARD)
|
||||||
|
.setIndicator(getString(R.string.filter_apps_onsdcard))
|
||||||
|
.setContent(this));
|
||||||
|
|
||||||
tabHost.setCurrentTabByTag(defaultTabTag);
|
tabHost.setCurrentTabByTag(defaultTabTag);
|
||||||
tabHost.setOnTabChangedListener(this);
|
tabHost.setOnTabChangedListener(this);
|
||||||
}
|
}
|
||||||
@@ -1986,6 +2019,8 @@ public class ManageApplications extends TabActivity implements
|
|||||||
newOption = FILTER_APPS_RUNNING;
|
newOption = FILTER_APPS_RUNNING;
|
||||||
} else if (TAB_ALL.equalsIgnoreCase(tabId)) {
|
} else if (TAB_ALL.equalsIgnoreCase(tabId)) {
|
||||||
newOption = FILTER_APPS_ALL;
|
newOption = FILTER_APPS_ALL;
|
||||||
|
} else if (TAB_SDCARD.equalsIgnoreCase(tabId)) {
|
||||||
|
newOption = FILTER_APPS_SDCARD;
|
||||||
} else {
|
} else {
|
||||||
// Invalid option. Do nothing
|
// Invalid option. Do nothing
|
||||||
return;
|
return;
|
||||||
|
Reference in New Issue
Block a user