summaryrefslogtreecommitdiffstats
path: root/src/com/android/settings/AccountPreference.java
diff options
context:
space:
mode:
authorAmith Yamasani <yamasani@google.com>2012-05-18 09:50:08 -0700
committerAmith Yamasani <yamasani@google.com>2012-06-04 17:01:22 -0700
commitd1ab82807aae63926b35f66080a1f7a75c00b95b (patch)
treed9122259ef7c6a885efefaddda488352b9bfb86c /src/com/android/settings/AccountPreference.java
parent13b2f06d2e5a74a52bc00b21f91d720407f5a98d (diff)
downloadpackages_apps_Settings-d1ab82807aae63926b35f66080a1f7a75c00b95b.zip
packages_apps_Settings-d1ab82807aae63926b35f66080a1f7a75c00b95b.tar.gz
packages_apps_Settings-d1ab82807aae63926b35f66080a1f7a75c00b95b.tar.bz2
Account types at toplevel of Settings
Reorganized Account settings to show account types at the top-level of Settings. Only account types that have accounts added are visible here. There is an Add account button to add a new account. Master sync toggle has moved to Data Usage screen in the overflow menu. It shows additional detail of the function of the auto-sync toggle when it is toggled by the user. Account type screen (ManageAccountsSettings) shows list of accounts of that type and any available authenticator settings. It additionally verifies any Intents can be resolved before showing the corresponding entry. This screen now shows last synced time for each account. You can now sync all accounts of a type by selecting Sync now in the Account type screen. Account Sync screen that shows the list of syncable items has minor tweaks: - "Last synced...", "Sync is OFF" - Doesn't show the authenticator settings here anymore. Bug: 6579937 Change-Id: I8139a4c992b525a3e1efc24d2d223c3f5caddc76
Diffstat (limited to 'src/com/android/settings/AccountPreference.java')
-rw-r--r--src/com/android/settings/AccountPreference.java40
1 files changed, 11 insertions, 29 deletions
diff --git a/src/com/android/settings/AccountPreference.java b/src/com/android/settings/AccountPreference.java
index 824420d..e7919dd 100644
--- a/src/com/android/settings/AccountPreference.java
+++ b/src/com/android/settings/AccountPreference.java
@@ -20,7 +20,6 @@ import java.util.ArrayList;
import android.accounts.Account;
import android.content.Context;
-import android.content.Intent;
import android.graphics.drawable.Drawable;
import android.preference.Preference;
import android.util.Log;
@@ -36,25 +35,20 @@ public class AccountPreference extends Preference {
public static final int SYNC_ENABLED = 0; // all know sync adapters are enabled and OK
public static final int SYNC_DISABLED = 1; // no sync adapters are enabled
public static final int SYNC_ERROR = 2; // one or more sync adapters have a problem
+ public static final int SYNC_IN_PROGRESS = 3; // currently syncing
private int mStatus;
private Account mAccount;
private ArrayList<String> mAuthorities;
- private Drawable mProviderIcon;
- private ImageView mSyncStatusIcon;
- private ImageView mProviderIconView;
public AccountPreference(Context context, Account account, Drawable icon,
ArrayList<String> authorities) {
super(context);
mAccount = account;
mAuthorities = authorities;
- mProviderIcon = icon;
- setWidgetLayoutResource(R.layout.account_preference);
setTitle(mAccount.name);
setSummary("");
setPersistent(false);
setSyncStatus(SYNC_DISABLED);
- setIcon(mProviderIcon);
}
public Account getAccount() {
@@ -69,23 +63,14 @@ public class AccountPreference extends Preference {
protected void onBindView(View view) {
super.onBindView(view);
setSummary(getSyncStatusMessage(mStatus));
- mSyncStatusIcon = (ImageView) view.findViewById(R.id.syncStatusIcon);
- mSyncStatusIcon.setImageResource(getSyncStatusIcon(mStatus));
- mSyncStatusIcon.setContentDescription(getSyncContentDescription(mStatus));
- }
-
- public void setProviderIcon(Drawable icon) {
- mProviderIcon = icon;
- if (mProviderIconView != null) {
- mProviderIconView.setImageDrawable(icon);
- }
+ ImageView iconView = (ImageView) view.findViewById(android.R.id.icon);
+ iconView.setImageResource(getSyncStatusIcon(mStatus));
+ iconView.setContentDescription(getSyncContentDescription(mStatus));
}
public void setSyncStatus(int status) {
mStatus = status;
- if (mSyncStatusIcon != null) {
- mSyncStatusIcon.setImageResource(getSyncStatusIcon(status));
- }
+ setIcon(getSyncStatusIcon(status));
setSummary(getSyncStatusMessage(status));
}
@@ -101,6 +86,9 @@ public class AccountPreference extends Preference {
case SYNC_ERROR:
res = R.string.sync_error;
break;
+ case SYNC_IN_PROGRESS:
+ res = R.string.sync_in_progress;
+ break;
default:
res = R.string.sync_error;
Log.e(TAG, "Unknown sync status: " + status);
@@ -120,6 +108,9 @@ public class AccountPreference extends Preference {
case SYNC_ERROR:
res = R.drawable.ic_sync_red_holo;
break;
+ case SYNC_IN_PROGRESS:
+ res = R.drawable.ic_sync_grey_holo;
+ break;
default:
res = R.drawable.ic_sync_red_holo;
Log.e(TAG, "Unknown sync status: " + status);
@@ -140,13 +131,4 @@ public class AccountPreference extends Preference {
return getContext().getString(R.string.accessibility_sync_error);
}
}
-
- @Override
- public int compareTo(Preference other) {
- if (!(other instanceof AccountPreference)) {
- // Put other preference types above us
- return 1;
- }
- return mAccount.name.compareTo(((AccountPreference) other).mAccount.name);
- }
}