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
This commit is contained in:
Amith Yamasani
2012-05-18 09:50:08 -07:00
parent 13b2f06d2e
commit d1ab82807a
15 changed files with 520 additions and 238 deletions

View File

@@ -178,6 +178,7 @@ public class DataUsageSummary extends Fragment {
private static final String TAG_CONFIRM_RESTRICT = "confirmRestrict";
private static final String TAG_DENIED_RESTRICT = "deniedRestrict";
private static final String TAG_CONFIRM_APP_RESTRICT = "confirmAppRestrict";
private static final String TAG_CONFIRM_AUTO_SYNC_CHANGE = "confirmAutoSyncChange";
private static final String TAG_APP_DETAILS = "appDetails";
private static final int LOADER_CHART_DATA = 2;
@@ -251,6 +252,7 @@ public class DataUsageSummary extends Fragment {
private MenuItem mMenuDataRoaming;
private MenuItem mMenuRestrictBackground;
private MenuItem mMenuAutoSync;
/** Flag used to ignore listeners during binding. */
private boolean mBinding;
@@ -453,6 +455,9 @@ public class DataUsageSummary extends Fragment {
mMenuRestrictBackground.setVisible(hasReadyMobileRadio(context) && !appDetailMode);
mMenuRestrictBackground.setChecked(mPolicyManager.getRestrictBackground());
mMenuAutoSync = menu.findItem(R.id.data_usage_menu_auto_sync);
mMenuAutoSync.setChecked(ContentResolver.getMasterSyncAutomatically());
final MenuItem split4g = menu.findItem(R.id.data_usage_menu_split_4g);
split4g.setVisible(hasReadyMobile4gRadio(context) && !appDetailMode);
split4g.setChecked(isMobilePolicySplit());
@@ -543,6 +548,10 @@ public class DataUsageSummary extends Fragment {
R.string.data_usage_metered_title, null, this, 0);
return true;
}
case R.id.data_usage_menu_auto_sync: {
ConfirmAutoSyncChangeFragment.show(this, !item.isChecked());
return true;
}
}
return false;
}
@@ -2022,6 +2031,46 @@ public class DataUsageSummary extends Fragment {
}
}
/**
* Dialog to inform user about changing auto-sync setting
*/
public static class ConfirmAutoSyncChangeFragment extends DialogFragment {
private boolean mEnabling;
public static void show(DataUsageSummary parent, boolean enabling) {
if (!parent.isAdded()) return;
final ConfirmAutoSyncChangeFragment dialog = new ConfirmAutoSyncChangeFragment();
dialog.mEnabling = enabling;
dialog.setTargetFragment(parent, 0);
dialog.show(parent.getFragmentManager(), TAG_CONFIRM_AUTO_SYNC_CHANGE);
}
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
final Context context = getActivity();
final AlertDialog.Builder builder = new AlertDialog.Builder(context);
if (!mEnabling) {
builder.setTitle(R.string.data_usage_auto_sync_off_dialog_title);
builder.setMessage(R.string.data_usage_auto_sync_off_dialog);
} else {
builder.setTitle(R.string.data_usage_auto_sync_on_dialog_title);
builder.setMessage(R.string.data_usage_auto_sync_on_dialog);
}
builder.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
ContentResolver.setMasterSyncAutomatically(mEnabling);
}
});
builder.setNegativeButton(android.R.string.cancel, null);
return builder.create();
}
}
/**
* Compute default tab that should be selected, based on
* {@link NetworkPolicyManager#EXTRA_NETWORK_TEMPLATE} extra.