diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 318e0b01ee8..23683451aad 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -479,7 +479,7 @@
-
+
diff --git a/res/drawable/ic_menu_filter_settings.png b/res/drawable/ic_menu_filter_settings.png
new file mode 100755
index 00000000000..7be883aeb14
Binary files /dev/null and b/res/drawable/ic_menu_filter_settings.png differ
diff --git a/res/layout/compute_sizes.xml b/res/layout/compute_sizes.xml
index bba8c636eae..1c8e96648d2 100755
--- a/res/layout/compute_sizes.xml
+++ b/res/layout/compute_sizes.xml
@@ -20,19 +20,17 @@
android:layout_height="fill_parent">
-
-
+
+ android:gravity="center"
+ android:textAppearance="?android:attr/textAppearanceMedium" />
diff --git a/res/values-en-rGB/strings.xml b/res/values-en-rGB/strings.xml
deleted file mode 100644
index 0f6d3c3b526..00000000000
--- a/res/values-en-rGB/strings.xml
+++ /dev/null
@@ -1,1234 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
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+
+ "Installerte applikasjoner, hurtigtaster"
+
diff --git a/res/values-nb/strings.xml b/res/values-nb/strings.xml
index bd6881f90ef..6e03e32d14a 100644
--- a/res/values-nb/strings.xml
+++ b/res/values-nb/strings.xml
@@ -49,8 +49,7 @@
"LAC"
"CID"
"Unmount SD card"
-
-
+ "Format SD card"
"Liten"
"Middels"
"Stor"
@@ -160,8 +159,7 @@
"SMSC:"
"Update"
"Refresh"
-
-
+ "Toggle DNS check"
"Velg GSM/UMTS-bånd"
"Henter båndliste…"
"Velg"
@@ -184,8 +182,7 @@
"Velg aktivitet"
"Enhetsinformasjon"
"Batteriinformasjon"
-
-
+ "Batterihistorikk"
"Skjerm"
"Telefoninformasjon"
"Minnekort"
@@ -317,12 +314,9 @@
"Velg antall kanaler som skal brukes"
"Kunne ikke velge juridisk område."
"%1$d kanaler"
-
-
-
-
-
-
+ "Soveinnstillinger for trådløst nett"
+ "Spesifiser når telefonen skal bytte fra trådløsnett til mobiltelefonidata"
+ "Det oppsto et problem under setting av soveinnstilling."
"MAC-adresse"
"Søker…"
"Kobler til %1$s…"
@@ -365,12 +359,9 @@
"Hørbart valg"
"Lag lyd under skjermvalg"
"Lag lyd under skjermvalg"
-
-
-
-
-
-
+ "Varsling for minnekort"
+ "Deaktiver varslingslyder for minnekort"
+ "Aktiver varslingslyder for minnekort"
"Datasynkronisering"
"Applikasjoner som skal synkroniseres"
"Skjerminnstillinger"
@@ -378,11 +369,9 @@
"Vis animasjon når vinduer åpnes/lukkes"
"Vis animasjon når vinduer åpnes/lukkes"
"Lysstyrke"
-
-
+ "Juster skjermens lysstyrke"
"Skjermsparer"
-
-
+ "Juster hvor lang tid som skal gå før skjermen slås av automatisk"
"Innstillinger for SIM-kort-lås"
"Sett opp SIM-kort-lås"
"SIM-kort-lås"
@@ -428,10 +417,8 @@
"MAC-adresse for WLAN"
"Bluetooth-adresse"
"Ikke tilgjengelig"
-
-
-
-
+ "Nettverksbruk"
+ "Sendt: %1$d packets, %2$d bytes%nMottatt: %3$d packets, %4$d bytes"
"Oppetid"
"Våken tid"
"Intern lagringsplass"
@@ -439,12 +426,9 @@
"Tilgjengelig plass"
"Total plass"
"Avmonter/løs ut minnekort"
-
-
-
-
-
-
+ "Løs ut minnekortet for trygg fjerning"
+ "Formater minnekort"
+ "Formater (fjern alt fra) minnekortet"
"Ikke tilgjengelig"
"(skrivebeskyttet)"
"Batteristatus"
@@ -483,22 +467,14 @@
"Tegn opplåsingsmønsteret"
"Du må tegne opplåsingsmønsteret for å bekrefte nullstilling av telefonen."
"Telefonen ble ikke nullstilt fordi nullstillingstjenesten ikke er tilgjengelig."
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+ "Formater minnekort"
+ "Sletter alle data fra minnekortet"
+ "Dette valget vil slette alle data fra minnekortet i telefonen. Du vil miste ALLE data på kortet!"
+ "Formater minnekort"
+ "Formater minnekortet? Dette vil fjerne alle data, og kan ikke gjøres om!"
+ "Slett alt"
+ "Tegn opplåsingsmønsteret"
+ "Du må tegne opplåsingsmønsteret for å bekrefte formatering av minnekortet."
"Samtaleinnstillinger"
"Telefonsvarer, viderekobling, samtale venter, nummervisning"
"Mobile nettverk"
@@ -552,8 +528,7 @@
"Eksempelmønster"
"Tegn over minst fire prikker."\n" "\n"Velg «Neste» når du er klar til å tegne ditt eget mønster."
"Installerte applikasjoner"
-
-
+ "Hold orden på og fjern installerte applikasjoner"
"Applikasjoner"
"Installerte applikasjoner, hurtigtaster"
"Innstillinger for applikasjoner"
@@ -567,10 +542,8 @@
"Hurtiglager"
"Fjern hurtiglager"
"Hurtiglager"
-
-
-
-
+ "Kontroller"
+ "Tving avslutning"
"Totalt"
"Applikasjon"
"Data"
@@ -583,10 +556,8 @@
"Sorter"
"Sorter etter størrelse"
"Styr plass"
-
-
-
-
+ "Filter"
+ "Velg filtreringsinnstillinger"
"Alle"
"Tredjeparts"
"Kjører"
@@ -608,39 +579,28 @@
"Innstillinger for språk"
"Tekstinnstillinger"
"Språk"
-
-
+ "Velg språk og region"
"Automatisk erstatting"
"Rett opp stavefeil"
"Stor forbokstav"
"Start automatisk setninger med stor bokstav"
"Autopunktum"
-
-
+ "Innstillinger for fysisk tastatur"
"Trykk mellomromstasten to ganger for å skrive punktum"
"Synlige passord"
"Vis passord mens de skrives inn"
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+ "Ordliste"
+ "Ordliste"
+ "Legg til og fjern ord fra ordlisten"
+ "Legg til"
+ "Legg til ordliste"
+ "Rediger"
+ "Slett"
+ "Ordlisten er tom. Du kan legge til ord i menyen."
"Testing"
"Telefoninformasjon"
"Batteriinformasjon"
-
-
+ "Batterihistorikk"
"Hurtigtaster"
"Tastatursnarveier for å starte applikasjoner"
"Tilordne applikasjon"
@@ -654,8 +614,7 @@
"Snarveier"
"Skriving av tekst"
"Innstillinger for skriving av tekst"
-
-
+ "Innstillinger for %s"
"Utvikling"
"Innstillinger for applikasjonsutvikling"
"USB-debugging"
@@ -664,68 +623,36 @@
"Skjermen vil aldri blankes under lading"
"Tillat manuell plassering"
"Tillat manuell plassering"
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+ "Android System;Dialer;Calendar;Camera;Google Apps;Contacts;"
+ "Velg gadget"
+ "Detaljer for UID %d"
+ "UID %1$d"
+ "Nettbruk av %1$s:"
+ "Byte mottatt: %1$d"
+ "Byte sendt: %1$d"
+ "Totalt antall byte: %1$d"
+ "CPU-bruk av %1$s:"
+ "Brukertid:"
+ "Systemtid:"
+ "Total tid:"
+ "Oppstarter: %1$d"
+ "%1$d dager, %2$d timer, %3$d minutter, %4$d sekunder"
+ "%1$d timer, %2$d minutter, %3$d sekunder"
+ "%1$d minutter, %2$d sekunder"
+ "%1$d sekunder"
+ "Pakker som deler denne UID-en:"
+ "Ingen batterihistorikk tilgjengelig"
+ "Sensor:"
+ "Sensor brukt av pakker:"
+ "Brukt %1$d ganger av %2$s"
+ "Brukt %1$d ganger av en av:"
+ "Tid brukt med skjermen på:"
+ "På batteri:"
+ "På nettstrøm:"
+ "Bruksstatistikk"
+ "Bruksstatistikk"
+ "Sorter etter:"
+ "Applikasjon"
+ "Antall"
+ "Brukstid"
diff --git a/src/com/android/settings/DeviceInfoSettings.java b/src/com/android/settings/DeviceInfoSettings.java
index 36973197c25..be01f7dc57e 100644
--- a/src/com/android/settings/DeviceInfoSettings.java
+++ b/src/com/android/settings/DeviceInfoSettings.java
@@ -65,18 +65,24 @@ public class DeviceInfoSettings extends PreferenceActivity {
* Settings is a generic app and should not contain any device-specific
* info.
*/
+
+ // These are contained in the "container" preference group
PreferenceGroup parentPreference = (PreferenceGroup) findPreference(KEY_CONTAINER);
Utils.updatePreferenceToSpecificActivityOrRemove(this, parentPreference, KEY_TERMS,
Utils.UPDATE_PREFERENCE_FLAG_SET_TITLE_TO_MATCHING_ACTIVITY);
Utils.updatePreferenceToSpecificActivityOrRemove(this, parentPreference, KEY_LICENSE,
Utils.UPDATE_PREFERENCE_FLAG_SET_TITLE_TO_MATCHING_ACTIVITY);
- Utils.updatePreferenceToSpecificActivityOrRemove(this, parentPreference, KEY_CONTRIBUTORS,
- Utils.UPDATE_PREFERENCE_FLAG_SET_TITLE_TO_MATCHING_ACTIVITY);
Utils.updatePreferenceToSpecificActivityOrRemove(this, parentPreference, KEY_COPYRIGHT,
Utils.UPDATE_PREFERENCE_FLAG_SET_TITLE_TO_MATCHING_ACTIVITY);
Utils.updatePreferenceToSpecificActivityOrRemove(this, parentPreference, KEY_TEAM,
Utils.UPDATE_PREFERENCE_FLAG_SET_TITLE_TO_MATCHING_ACTIVITY);
- Utils.updatePreferenceToSpecificActivityOrRemove(this, parentPreference, KEY_SYSTEM_UPDATE_SETTINGS,
+
+ // These are contained by the root preference screen
+ parentPreference = getPreferenceScreen();
+ Utils.updatePreferenceToSpecificActivityOrRemove(this, parentPreference,
+ KEY_SYSTEM_UPDATE_SETTINGS,
+ Utils.UPDATE_PREFERENCE_FLAG_SET_TITLE_TO_MATCHING_ACTIVITY);
+ Utils.updatePreferenceToSpecificActivityOrRemove(this, parentPreference, KEY_CONTRIBUTORS,
Utils.UPDATE_PREFERENCE_FLAG_SET_TITLE_TO_MATCHING_ACTIVITY);
}
diff --git a/src/com/android/settings/GadgetPickActivity.java b/src/com/android/settings/GadgetPickActivity.java
index 09e0fc70c55..408039aec4b 100644
--- a/src/com/android/settings/GadgetPickActivity.java
+++ b/src/com/android/settings/GadgetPickActivity.java
@@ -20,7 +20,7 @@ import android.app.LauncherActivity;
import android.content.ComponentName;
import android.content.Intent;
import android.content.pm.PackageManager;
-import android.gadget.GadgetInfo;
+import android.gadget.GadgetProviderInfo;
import android.gadget.GadgetManager;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
@@ -28,8 +28,11 @@ import android.view.View;
import android.widget.ListView;
import android.util.Log;
+import java.text.Collator;
import java.util.List;
import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
public class GadgetPickActivity extends LauncherActivity
{
@@ -37,7 +40,6 @@ public class GadgetPickActivity extends LauncherActivity
GadgetManager mGadgetManager;
int mGadgetId;
- int mHostId;
public GadgetPickActivity() {
mGadgetManager = GadgetManager.getInstance(this);
@@ -48,7 +50,6 @@ public class GadgetPickActivity extends LauncherActivity
super.onCreate(icicle);
Bundle extras = getIntent().getExtras();
- mHostId = extras.getInt(GadgetManager.EXTRA_HOST_ID);
mGadgetId = extras.getInt(GadgetManager.EXTRA_GADGET_ID);
setResultData(RESULT_CANCELED);
@@ -65,7 +66,7 @@ public class GadgetPickActivity extends LauncherActivity
@Override
public List makeListItems() {
- List installed = mGadgetManager.getInstalledProviders();
+ List installed = mGadgetManager.getInstalledProviders();
PackageManager pm = getPackageManager();
Drawable defaultIcon = null;
@@ -74,7 +75,7 @@ public class GadgetPickActivity extends LauncherActivity
ArrayList result = new ArrayList();
final int N = installed.size();
for (int i=0; i() {
+ Collator mCollator = Collator.getInstance();
+ public int compare(ListItem lhs, ListItem rhs) {
+ return mCollator.compare(lhs.label, rhs.label);
+ }
+ });
return result;
}
-
+
void setResultData(int code) {
Intent result = new Intent();
result.putExtra(GadgetManager.EXTRA_GADGET_ID, mGadgetId);
diff --git a/src/com/android/settings/ManageApplications.java b/src/com/android/settings/ManageApplications.java
index e5311aeedd7..512e547e6d4 100644
--- a/src/com/android/settings/ManageApplications.java
+++ b/src/com/android/settings/ManageApplications.java
@@ -133,13 +133,14 @@ public class ManageApplications extends ListActivity implements
// messages posted to the handler
private static final int HANDLER_MESSAGE_BASE = 0;
- private static final int COMPUTE_PKG_SIZE_START = HANDLER_MESSAGE_BASE+1;
+ private static final int INIT_PKG_INFO = HANDLER_MESSAGE_BASE+1;
private static final int COMPUTE_PKG_SIZE_DONE = HANDLER_MESSAGE_BASE+2;
private static final int REMOVE_PKG = HANDLER_MESSAGE_BASE+3;
private static final int REORDER_LIST = HANDLER_MESSAGE_BASE+4;
private static final int ADD_PKG_START = HANDLER_MESSAGE_BASE+5;
private static final int ADD_PKG_DONE = HANDLER_MESSAGE_BASE+6;
private static final int REFRESH_ICONS = HANDLER_MESSAGE_BASE+7;
+ private static final int NEXT_LOAD_STEP = HANDLER_MESSAGE_BASE+8;
// observer object used for computing pkg sizes
private PkgSizeObserver mObserver;
@@ -150,7 +151,7 @@ public class ManageApplications extends ListActivity implements
private PackageIntentReceiver mReceiver;
// atomic variable used to track if computing pkg sizes is in progress. should be volatile?
- private boolean mDoneIniting = false;
+ private boolean mComputeSizes = false;
// default icon thats used when displaying applications initially before resource info is
// retrieved
private Drawable mDefaultAppIcon;
@@ -189,6 +190,13 @@ public class ManageApplications extends ListActivity implements
//TODO implement a cache system
private Map mAppPropCache;
+ // empty message displayed when list is empty
+ private TextView mEmptyView;
+
+ // Boolean variables indicating state
+ private boolean mLoadLabels = false;
+ private boolean mSizesFirst = false;
+
/*
* Handler class to handle messages for various operations
* Most of the operations that effect Application related data
@@ -232,11 +240,13 @@ public class ManageApplications extends ListActivity implements
pkgName = data.getString(ATTR_PKG_NAME);
}
switch (msg.what) {
- case COMPUTE_PKG_SIZE_START:
- if(localLOGV) Log.i(TAG, "Message COMPUTE_PKG_SIZE_START");
+ case INIT_PKG_INFO:
+ if(localLOGV) Log.i(TAG, "Message INIT_PKG_INFO");
setProgressBarIndeterminateVisibility(true);
mComputeIndex = 0;
+ // Retrieve the package list and init some structures
initAppList(mFilterApps);
+ mHandler.sendEmptyMessage(NEXT_LOAD_STEP);
break;
case COMPUTE_PKG_SIZE_DONE:
if(localLOGV) Log.i(TAG, "Message COMPUTE_PKG_SIZE_DONE");
@@ -297,9 +307,9 @@ public class ManageApplications extends ListActivity implements
COMPUTE_PKG_SIZE_DONE);
} else {
// end computation here
- mDoneIniting = true;
+ mComputeSizes = true;
mAppInfoAdapter.sortList(mSortOrder);
- setProgressBarIndeterminateVisibility(false);
+ mHandler.sendEmptyMessage(NEXT_LOAD_STEP);
}
}
break;
@@ -309,7 +319,7 @@ public class ManageApplications extends ListActivity implements
Log.w(TAG, "Ignoring message:REMOVE_PKG for null pkgName");
break;
}
- if (!mDoneIniting) {
+ if (!mComputeSizes) {
Boolean currB = mAddRemoveMap.get(pkgName);
if (currB == null || (currB.equals(Boolean.TRUE))) {
mAddRemoveMap.put(pkgName, Boolean.FALSE);
@@ -340,7 +350,7 @@ public class ManageApplications extends ListActivity implements
// Reset cache
mAppPropCache = null;
mFilterApps = FILTER_APPS_ALL;
- mHandler.sendEmptyMessage(COMPUTE_PKG_SIZE_START);
+ mHandler.sendEmptyMessage(INIT_PKG_INFO);
sendMessageToHandler(REORDER_LIST, menuOption);
}
}
@@ -351,7 +361,7 @@ public class ManageApplications extends ListActivity implements
Log.w(TAG, "Ignoring message:ADD_PKG_START for null pkgName");
break;
}
- if (!mDoneIniting) {
+ if (!mComputeSizes) {
Boolean currB = mAddRemoveMap.get(pkgName);
if (currB == null || (currB.equals(Boolean.FALSE))) {
mAddRemoveMap.put(pkgName, Boolean.TRUE);
@@ -380,23 +390,43 @@ public class ManageApplications extends ListActivity implements
if(iconMap == null) {
Log.w(TAG, "Error loading icons for applications");
} else {
- mAppInfoAdapter.updateAppsResourceInfo(iconMap);
+ mAppInfoAdapter.updateAppsResourceInfo(iconMap);
}
- // initiate compute pkg sizes
- if (localLOGV) Log.i(TAG, "Initiating compute sizes for first time");
- mObserver = new PkgSizeObserver();
- if (mAppInfoAdapter.getCount() > 0) {
- mObserver.invokeGetSizeInfo(mAppInfoAdapter.getApplicationInfo(0),
- COMPUTE_PKG_SIZE_DONE);
+ mLoadLabels = true;
+ mHandler.sendEmptyMessage(NEXT_LOAD_STEP);
+ break;
+ case NEXT_LOAD_STEP:
+ if (mComputeSizes && mLoadLabels) {
+ doneLoadingData();
+ } else if (!mComputeSizes && !mLoadLabels) {
+ // Either load the package labels or initiate get size info
+ if (mSizesFirst) {
+ initComputeSizes();
+ } else {
+ initResourceThread();
+ }
} else {
- mDoneIniting = true;
+ // Create list view from the adapter here. Wait till the sort order
+ // of list is defined. its either by label or by size. so atleast one of the
+ // first steps should be complete before creating the list
+ createListView();
+ if (!mComputeSizes) {
+ initComputeSizes();
+ } else if (!mLoadLabels) {
+ initResourceThread();
+ }
}
+ break;
default:
break;
}
}
};
+ private void doneLoadingData() {
+ setProgressBarIndeterminateVisibility(false);
+ }
+
List getInstalledApps(int filterOption) {
List installedAppList = mPm.getInstalledApplications(
PackageManager.GET_UNINSTALLED_PACKAGES);
@@ -457,27 +487,54 @@ public class ManageApplications extends ListActivity implements
// some initialization code used when kicking off the size computation
private void initAppList(int filterOption) {
- mDoneIniting = false;
+ mComputeSizes = false;
// Initialize lists
List appList = getInstalledApps(filterOption);
mAddRemoveMap = new TreeMap();
- mAppInfoAdapter = new AppInfoAdapter(this, appList);
- dismissLoadingMsg();
- // get list and set listeners and adapter
- ListView lv= (ListView) findViewById(android.R.id.list);
- lv.setOnItemClickListener(this);
- lv.setSaveEnabled(true);
- lv.setItemsCanFocus(true);
- lv.setOnItemClickListener(this);
- lv.setAdapter(mAppInfoAdapter);
+ mAppInfoAdapter = new AppInfoAdapter(this, appList);
// register receiver
- mReceiver = new PackageIntentReceiver();
mReceiver.registerReceiver();
+ }
+
+ // Utility method to start a thread to read application labels and icons
+ private void initResourceThread() {
//load resources now
if(mResourceThread.isAlive()) {
mResourceThread.interrupt();
}
- mResourceThread.loadAllResources(appList);
+ mResourceThread.loadAllResources(mAppInfoAdapter.getAppList());
+ }
+
+ private void initComputeSizes() {
+ // initiate compute pkg sizes
+ if (localLOGV) Log.i(TAG, "Initiating compute sizes for first time");
+ if (mAppInfoAdapter.getCount() > 0) {
+ mObserver.invokeGetSizeInfo(mAppInfoAdapter.getApplicationInfo(0),
+ COMPUTE_PKG_SIZE_DONE);
+ } else {
+ mComputeSizes = true;
+ }
+ }
+
+ private void showEmptyViewIfListEmpty() {
+ if (localLOGV) Log.i(TAG, "Checking for empty view");
+ if (mAppInfoAdapter.getCount() > 0) {
+ mEmptyView.setVisibility(View.GONE);
+ } else {
+ mEmptyView.setVisibility(View.VISIBLE);
+ }
+ }
+
+ private void createListView() {
+ dismissLoadingMsg();
+ // get list and set listeners and adapter
+ ListView lv= (ListView) findViewById(android.R.id.list);
+ lv.setAdapter(mAppInfoAdapter);
+ lv.setOnItemClickListener(this);
+ lv.setSaveEnabled(true);
+ lv.setItemsCanFocus(true);
+ lv.setOnItemClickListener(this);
+ showEmptyViewIfListEmpty();
}
// internal structure used to track added and deleted packages when
@@ -495,21 +552,21 @@ public class ManageApplications extends ListActivity implements
List mAppList;
void loadAllResources(List appList) {
- if(appList == null || appList.size() <= 0) {
- Log.w(TAG, "Empty or null application list");
- return;
- }
mAppList = appList;
start();
}
public void run() {
Map iconMap = new HashMap();
- for (ApplicationInfo appInfo : mAppList) {
- CharSequence appName = appInfo.loadLabel(mPm);
- Drawable appIcon = appInfo.loadIcon(mPm);
- iconMap.put(appInfo.packageName,
- new AppInfo(appInfo.packageName, appName, appIcon));
+ if(mAppList == null || mAppList.size() <= 0) {
+ Log.w(TAG, "Empty or null application list");
+ } else {
+ for (ApplicationInfo appInfo : mAppList) {
+ CharSequence appName = appInfo.loadLabel(mPm);
+ Drawable appIcon = appInfo.loadIcon(mPm);
+ iconMap.put(appInfo.packageName,
+ new AppInfo(appInfo.packageName, appName, appIcon));
+ }
}
Message msg = mHandler.obtainMessage(REFRESH_ICONS);
msg.obj = iconMap;
@@ -697,6 +754,10 @@ public class ManageApplications extends ListActivity implements
}
public View getView(int position, View convertView, ViewGroup parent) {
+ if (position >= mAppLocalList.size()) {
+ Log.w(TAG, "Invalid view position:"+position+", actual size is:"+mAppLocalList.size());
+ return null;
+ }
// A ViewHolder keeps references to children views to avoid unneccessary calls
// to findViewById() on each row.
AppViewHolder holder;
@@ -773,7 +834,12 @@ public class ManageApplications extends ListActivity implements
mAppPropMap.put(applicationInfo.packageName, rInfo);
}
}
- sortList(mSortOrder);
+ if (mAppLocalList.size() > 0) {
+ sortList(mSortOrder);
+ } else {
+ notifyDataSetChanged();
+ }
+ showEmptyViewIfListEmpty();
return true;
}
@@ -927,7 +993,7 @@ public class ManageApplications extends ListActivity implements
* posts a message, we do a cursory check of validity on mAppInfoAdapter's applist
*/
private void clearMessagesInHandler() {
- mHandler.removeMessages(COMPUTE_PKG_SIZE_START);
+ mHandler.removeMessages(INIT_PKG_INFO);
mHandler.removeMessages(COMPUTE_PKG_SIZE_DONE);
mHandler.removeMessages(REMOVE_PKG);
mHandler.removeMessages(REORDER_LIST);
@@ -1040,12 +1106,14 @@ public class ManageApplications extends ListActivity implements
String action = lIntent.getAction();
if (action.equals(Intent.ACTION_MANAGE_PACKAGE_STORAGE)) {
mSortOrder = SORT_ORDER_SIZE;
+ mSizesFirst = true;
}
mPm = getPackageManager();
// initialize some window features
requestWindowFeature(Window.FEATURE_RIGHT_ICON);
requestWindowFeature(Window.FEATURE_PROGRESS);
requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
+ setContentView(R.layout.compute_sizes);
// init mLoadingDlg
mLoadingDlg = new ProgressDialog(this);
mLoadingDlg.setProgressStyle(ProgressDialog.STYLE_SPINNER);
@@ -1058,6 +1126,9 @@ public class ManageApplications extends ListActivity implements
mComputingSizeStr = getText(R.string.computing_size);
// initialize the inflater
mInflater = (LayoutInflater)getSystemService(Context.LAYOUT_INFLATER_SERVICE);
+ mReceiver = new PackageIntentReceiver();
+ mEmptyView = (TextView) findViewById(R.id.empty_view);
+ mObserver = new PkgSizeObserver();
}
private void showLoadingMsg() {
@@ -1077,11 +1148,10 @@ public class ManageApplications extends ListActivity implements
@Override
public void onStart() {
super.onStart();
- setContentView(R.layout.compute_sizes);
showLoadingMsg();
// Create a thread to load resources
mResourceThread = new ResourceLoaderThread();
- sendMessageToHandler(COMPUTE_PKG_SIZE_START);
+ sendMessageToHandler(INIT_PKG_INFO);
}
@Override
@@ -1138,13 +1208,14 @@ public class ManageApplications extends ListActivity implements
.setIcon(android.R.drawable.ic_menu_sort_alphabetically);
menu.add(0, SORT_ORDER_SIZE, 2, R.string.sort_order_size)
.setIcon(android.R.drawable.ic_menu_sort_by_size);
- menu.add(0, FILTER_OPTIONS, 3, R.string.filter);
+ menu.add(0, FILTER_OPTIONS, 3, R.string.filter)
+ .setIcon(R.drawable.ic_menu_filter_settings);
return true;
}
@Override
public boolean onPrepareOptionsMenu(Menu menu) {
- if (mDoneIniting) {
+ if (mComputeSizes) {
menu.findItem(SORT_ORDER_ALPHA).setVisible(mSortOrder != SORT_ORDER_ALPHA);
menu.findItem(SORT_ORDER_SIZE).setVisible(mSortOrder != SORT_ORDER_SIZE);
menu.findItem(FILTER_OPTIONS).setVisible(true);
diff --git a/src/com/android/settings/UserDictionarySettings.java b/src/com/android/settings/UserDictionarySettings.java
index 8b86a6bfae0..89d52794031 100644
--- a/src/com/android/settings/UserDictionarySettings.java
+++ b/src/com/android/settings/UserDictionarySettings.java
@@ -44,6 +44,7 @@ import java.util.Locale;
public class UserDictionarySettings extends ListActivity {
private static final String INSTANCE_KEY_DIALOG_EDITING_WORD = "DIALOG_EDITING_WORD";
+ private static final String INSTANCE_KEY_ADDED_WORD = "DIALOG_ADDED_WORD";
private static final String[] QUERY_PROJECTION = {
UserDictionary.Words._ID, UserDictionary.Words.WORD
@@ -70,6 +71,9 @@ public class UserDictionarySettings extends ListActivity {
private Cursor mCursor;
+ private boolean mAddedWordAlready;
+ private boolean mAutoReturn;
+
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@@ -85,15 +89,17 @@ public class UserDictionarySettings extends ListActivity {
ListView listView = getListView();
listView.setFastScrollEnabled(true);
listView.setEmptyView(emptyView);
-
+
registerForContextMenu(listView);
}
@Override
protected void onResume() {
super.onResume();
- if (getIntent().getAction().equals("com.android.settings.USER_DICTIONARY_INSERT")) {
+ if (!mAddedWordAlready
+ && getIntent().getAction().equals("com.android.settings.USER_DICTIONARY_INSERT")) {
String word = getIntent().getStringExtra(EXTRA_WORD);
+ mAutoReturn = true;
if (word != null) {
showAddOrEditDialog(word);
}
@@ -103,12 +109,14 @@ public class UserDictionarySettings extends ListActivity {
protected void onRestoreInstanceState(Bundle state) {
super.onRestoreInstanceState(state);
mDialogEditingWord = state.getString(INSTANCE_KEY_DIALOG_EDITING_WORD);
+ mAddedWordAlready = state.getBoolean(INSTANCE_KEY_ADDED_WORD, false);
}
@Override
protected void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
outState.putString(INSTANCE_KEY_DIALOG_EDITING_WORD, mDialogEditingWord);
+ outState.putBoolean(INSTANCE_KEY_ADDED_WORD, mAddedWordAlready);
}
private Cursor createCursor() {
@@ -196,9 +204,13 @@ public class UserDictionarySettings extends ListActivity {
.setView(content)
.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
- onAddOrEditFinished(editText.getText().toString());
+ onAddOrEditFinished(editText.getText().toString());
+ if (mAutoReturn) finish();
+ }})
+ .setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() {
+ public void onClick(DialogInterface dialog, int which) {
+ if (mAutoReturn) finish();
}})
- .setNegativeButton(android.R.string.cancel, null)
.create();
}
@@ -220,8 +232,9 @@ public class UserDictionarySettings extends ListActivity {
// TODO: present UI for picking whether to add word to all locales, or current.
UserDictionary.Words.addWord(this, word.toString(),
- 128, UserDictionary.Words.LOCALE_TYPE_ALL);
+ 250, UserDictionary.Words.LOCALE_TYPE_ALL);
mCursor.requery();
+ mAddedWordAlready = true;
}
private void deleteWord(String word) {
diff --git a/src/com/android/settings/bluetooth/ConnectSpecificProfilesActivity.java b/src/com/android/settings/bluetooth/ConnectSpecificProfilesActivity.java
index f2f3bdffda7..b4a8ae0e00d 100644
--- a/src/com/android/settings/bluetooth/ConnectSpecificProfilesActivity.java
+++ b/src/com/android/settings/bluetooth/ConnectSpecificProfilesActivity.java
@@ -229,9 +229,12 @@ public class ConnectSpecificProfilesActivity extends PreferenceActivity
for (Profile profile : mDevice.getProfiles()) {
CheckBoxPreference profilePref =
(CheckBoxPreference) findPreference(profile.toString());
- if (profilePref == null) continue;
-
- refreshProfilePreference(profilePref, profile);
+ if (profilePref == null) {
+ profilePref = createProfilePreference(profile);
+ mProfileContainer.addPreference(profilePref);
+ } else {
+ refreshProfilePreference(profilePref, profile);
+ }
}
}