+
+ public static final HashMap<String, Boolean> getAccountStatus(final Context context) {
+ final Account[] accounts = PicasaApi.getAccounts(context);
+ int numAccounts = accounts.length;
+ HashMap<String, Boolean> accountsEnabled = new HashMap<String, Boolean>(numAccounts);
+ for (int i = 0; i < numAccounts; ++i) {
+ Account account = accounts[i];
+ boolean isEnabled = ContentResolver.getSyncAutomatically(account, PicasaContentProvider.AUTHORITY);
+ String username = account.name;
+ if (username.contains("@gmail.") || username.contains("@googlemail.")) {
+ // Strip the domain from GMail accounts for canonicalization. TODO: is there an official way?
+ username = username.substring(0, username.indexOf('@'));
+ }
+ accountsEnabled.put(username, new Boolean(isEnabled));
+ }
+ return accountsEnabled;
+ }