summaryrefslogtreecommitdiffstats
path: root/src/com/android
diff options
context:
space:
mode:
authorBrian Carlstrom <bdc@google.com>2011-07-06 13:15:03 -0700
committerBrian Carlstrom <bdc@google.com>2011-07-06 13:15:03 -0700
commit729c6d99e21856558f3631d31537b8dca6bb2314 (patch)
tree70b3cc0a76f3cd4981bcda96889d3e2d7ae7b82c /src/com/android
parent10cc989346e1beda02a0dc5e0ca257734bbd21fc (diff)
downloadpackages_apps_Settings-729c6d99e21856558f3631d31537b8dca6bb2314.tar.gz
packages_apps_Settings-729c6d99e21856558f3631d31537b8dca6bb2314.tar.bz2
packages_apps_Settings-729c6d99e21856558f3631d31537b8dca6bb2314.zip
Convert CA loading from spinning wheel to progress bar
Change-Id: I3d9d596cbdf3ac4751b7b2e297faa0f667d2de02
Diffstat (limited to 'src/com/android')
-rw-r--r--src/com/android/settings/TrustedCredentialsSettings.java24
1 files changed, 20 insertions, 4 deletions
diff --git a/src/com/android/settings/TrustedCredentialsSettings.java b/src/com/android/settings/TrustedCredentialsSettings.java
index 133940908..55a00106b 100644
--- a/src/com/android/settings/TrustedCredentialsSettings.java
+++ b/src/com/android/settings/TrustedCredentialsSettings.java
@@ -36,6 +36,7 @@ import android.widget.Button;
import android.widget.CheckBox;
import android.widget.FrameLayout;
import android.widget.ListView;
+import android.widget.ProgressBar;
import android.widget.TabHost;
import android.widget.TextView;
import java.security.cert.CertificateEncodingException;
@@ -210,15 +211,21 @@ public class TrustedCredentialsSettings extends Fragment {
return view;
};
- private class AliasLoader extends AsyncTask<Void, Void, List<CertHolder>> {
+ private class AliasLoader extends AsyncTask<Void, Integer, List<CertHolder>> {
+ ProgressBar mProgressBar;
+ View mList;
@Override protected void onPreExecute() {
View content = mTabHost.getTabContentView();
- content.findViewById(mTab.mProgress).setVisibility(View.VISIBLE);
- content.findViewById(mTab.mList).setVisibility(View.GONE);
+ mProgressBar = (ProgressBar) content.findViewById(mTab.mProgress);
+ mList = content.findViewById(mTab.mList);
+ mProgressBar.setVisibility(View.VISIBLE);
+ mList.setVisibility(View.GONE);
}
@Override protected List<CertHolder> doInBackground(Void... params) {
Set<String> aliases = mTab.getAliases(mStore);
- List<CertHolder> certHolders = new ArrayList<CertHolder>(aliases.size());
+ int max = aliases.size();
+ int progress = 0;
+ List<CertHolder> certHolders = new ArrayList<CertHolder>(max);
for (String alias : aliases) {
X509Certificate cert = (X509Certificate) mStore.getCertificate(alias, true);
certHolders.add(new CertHolder(mStore,
@@ -226,10 +233,19 @@ public class TrustedCredentialsSettings extends Fragment {
mTab,
alias,
cert));
+ publishProgress(++progress, max);
}
Collections.sort(certHolders);
return certHolders;
}
+ @Override protected void onProgressUpdate(Integer... progressAndMax) {
+ int progress = progressAndMax[0];
+ int max = progressAndMax[1];
+ if (max != mProgressBar.getMax()) {
+ mProgressBar.setMax(max);
+ }
+ mProgressBar.setProgress(progress);
+ }
@Override protected void onPostExecute(List<CertHolder> certHolders) {
mCertHolders.clear();
mCertHolders.addAll(certHolders);