summaryrefslogtreecommitdiffstats
path: root/src/com/android/settings/accounts
diff options
context:
space:
mode:
authorFabrice Di Meglio <fdimeglio@google.com>2014-01-17 19:17:58 -0800
committerFabrice Di Meglio <fdimeglio@google.com>2014-02-03 16:36:46 -0800
commit263bcc8b732dbb47d3ce63904e0e05191fabbad6 (patch)
treedc8fd51052ac94e418473d378c1244cb42594665 /src/com/android/settings/accounts
parentaf79ddb358ff6ed078708ce5995da9ff269f1679 (diff)
downloadpackages_apps_Settings-263bcc8b732dbb47d3ce63904e0e05191fabbad6.tar.gz
packages_apps_Settings-263bcc8b732dbb47d3ce63904e0e05191fabbad6.tar.bz2
packages_apps_Settings-263bcc8b732dbb47d3ce63904e0e05191fabbad6.zip
Use Drawer in Settings app
- get rid of PreferenceActivity as much as we can and use fragments instead - add Drawer widget - add Dashboard high level entry into the Drawer (but this is work in progress and would be done in another CL) - add bypass of fragment's Header validation when launched from the Drawer but *force* validation if external call thru an Intent Be aware that WifiPickerActivity should remain for now a PreferenceActivity. It is used by SetupWizard and should not trigger running the SettingsActivity's header building code. SetupWizard is a Home during the provisionnig process and then deactivate itself as a Home but would make the Home header to appear in the Drawer (because momentarily we would have two Home). Also, verified that: - the WiFi settings still work when called from SetupWizard - when you have multiple Launchers, the Home header will appear in the list of Headers in the Drawer Change-Id: I407a5e0fdd843ad7615d3d511c416a44e3d97c90
Diffstat (limited to 'src/com/android/settings/accounts')
-rw-r--r--src/com/android/settings/accounts/AccountPreferenceBase.java1
-rw-r--r--src/com/android/settings/accounts/AddAccountSettings.java3
-rw-r--r--src/com/android/settings/accounts/ChooseAccountFragment.java (renamed from src/com/android/settings/accounts/ChooseAccountActivity.java)26
-rw-r--r--src/com/android/settings/accounts/ManageAccountsSettings.java6
-rw-r--r--src/com/android/settings/accounts/SyncSettingsActivity.java12
5 files changed, 23 insertions, 25 deletions
diff --git a/src/com/android/settings/accounts/AccountPreferenceBase.java b/src/com/android/settings/accounts/AccountPreferenceBase.java
index 2759a8f16..f5332633a 100644
--- a/src/com/android/settings/accounts/AccountPreferenceBase.java
+++ b/src/com/android/settings/accounts/AccountPreferenceBase.java
@@ -38,7 +38,6 @@ import android.content.res.Resources;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.os.Handler;
-import android.preference.PreferenceActivity;
import android.preference.PreferenceScreen;
import android.text.format.DateFormat;
import android.util.Log;
diff --git a/src/com/android/settings/accounts/AddAccountSettings.java b/src/com/android/settings/accounts/AddAccountSettings.java
index 39906eb30..3f98e5921 100644
--- a/src/com/android/settings/accounts/AddAccountSettings.java
+++ b/src/com/android/settings/accounts/AddAccountSettings.java
@@ -31,6 +31,7 @@ import android.util.Log;
import android.widget.Toast;
import com.android.settings.R;
+import com.android.settings.Settings;
import com.android.settings.Utils;
import java.io.IOException;
@@ -142,7 +143,7 @@ public class AddAccountSettings extends Activity {
getIntent().getStringArrayExtra(AccountPreferenceBase.AUTHORITIES_FILTER_KEY);
final String[] accountTypes =
getIntent().getStringArrayExtra(AccountPreferenceBase.ACCOUNT_TYPES_FILTER_KEY);
- final Intent intent = new Intent(this, ChooseAccountActivity.class);
+ final Intent intent = new Intent(this, Settings.ChooseAccountActivity.class);
if (authorities != null) {
intent.putExtra(AccountPreferenceBase.AUTHORITIES_FILTER_KEY, authorities);
}
diff --git a/src/com/android/settings/accounts/ChooseAccountActivity.java b/src/com/android/settings/accounts/ChooseAccountFragment.java
index 631fe47d6..292c3ddd5 100644
--- a/src/com/android/settings/accounts/ChooseAccountActivity.java
+++ b/src/com/android/settings/accounts/ChooseAccountFragment.java
@@ -18,6 +18,7 @@ package com.android.settings.accounts;
import android.accounts.AccountManager;
import android.accounts.AuthenticatorDescription;
+import android.app.Activity;
import android.content.ContentResolver;
import android.content.Context;
import android.content.Intent;
@@ -27,12 +28,12 @@ import android.content.res.Resources;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.preference.Preference;
-import android.preference.PreferenceActivity;
import android.preference.PreferenceGroup;
import android.preference.PreferenceScreen;
import android.util.Log;
import com.android.internal.util.CharSequences;
import com.android.settings.R;
+import com.android.settings.SettingsPreferenceFragment;
import com.google.android.collect.Maps;
import java.util.ArrayList;
@@ -44,9 +45,9 @@ import java.util.Map;
/**
* Activity asking a user to select an account to be set up.
*/
-public class ChooseAccountActivity extends PreferenceActivity {
+public class ChooseAccountFragment extends SettingsPreferenceFragment {
- private static final String TAG = "ChooseAccountActivity";
+ private static final String TAG = "ChooseAccountFragment";
private String[] mAuthorities;
private PreferenceGroup mAddAccountGroup;
private final ArrayList<ProviderEntry> mProviderList = new ArrayList<ProviderEntry>();
@@ -76,14 +77,13 @@ public class ChooseAccountActivity extends PreferenceActivity {
}
@Override
- protected void onCreate(Bundle icicle) {
+ public void onCreate(Bundle icicle) {
super.onCreate(icicle);
- setContentView(R.layout.add_account_screen);
addPreferencesFromResource(R.xml.add_account_settings);
- mAuthorities = getIntent().getStringArrayExtra(
+ mAuthorities = getActivity().getIntent().getStringArrayExtra(
AccountPreferenceBase.AUTHORITIES_FILTER_KEY);
- String[] accountTypesFilter = getIntent().getStringArrayExtra(
+ String[] accountTypesFilter = getActivity().getIntent().getStringArrayExtra(
AccountPreferenceBase.ACCOUNT_TYPES_FILTER_KEY);
if (accountTypesFilter != null) {
mAccountTypesFilter = new HashSet<String>();
@@ -100,7 +100,7 @@ public class ChooseAccountActivity extends PreferenceActivity {
* and update any UI that depends on AuthenticatorDescriptions in onAuthDescriptionsUpdated().
*/
private void updateAuthDescriptions() {
- mAuthDescs = AccountManager.get(this).getAuthenticatorTypes();
+ mAuthDescs = AccountManager.get(getActivity()).getAuthenticatorTypes();
for (int i = 0; i < mAuthDescs.length; i++) {
mTypeToAuthDescription.put(mAuthDescs[i].type, mAuthDescs[i]);
}
@@ -148,7 +148,7 @@ public class ChooseAccountActivity extends PreferenceActivity {
for (ProviderEntry pref : mProviderList) {
Drawable drawable = getDrawableForType(pref.type);
ProviderPreference p =
- new ProviderPreference(this, pref.type, drawable, pref.name);
+ new ProviderPreference(getActivity(), pref.type, drawable, pref.name);
mAddAccountGroup.addPreference(p);
}
} else {
@@ -160,7 +160,7 @@ public class ChooseAccountActivity extends PreferenceActivity {
}
Log.v(TAG, "No providers found for authorities: " + auths);
}
- setResult(RESULT_CANCELED);
+ getActivity().setResult(Activity.RESULT_CANCELED);
finish();
}
}
@@ -196,7 +196,7 @@ public class ChooseAccountActivity extends PreferenceActivity {
if (mTypeToAuthDescription.containsKey(accountType)) {
try {
AuthenticatorDescription desc = mTypeToAuthDescription.get(accountType);
- Context authContext = createPackageContext(desc.packageName, 0);
+ Context authContext = getActivity().createPackageContext(desc.packageName, 0);
icon = authContext.getResources().getDrawable(desc.iconId);
} catch (PackageManager.NameNotFoundException e) {
// TODO: place holder icon for missing account icons?
@@ -219,7 +219,7 @@ public class ChooseAccountActivity extends PreferenceActivity {
if (mTypeToAuthDescription.containsKey(accountType)) {
try {
AuthenticatorDescription desc = mTypeToAuthDescription.get(accountType);
- Context authContext = createPackageContext(desc.packageName, 0);
+ Context authContext = getActivity().createPackageContext(desc.packageName, 0);
label = authContext.getResources().getText(desc.labelId);
} catch (PackageManager.NameNotFoundException e) {
Log.w(TAG, "No label name for account type " + accountType);
@@ -245,7 +245,7 @@ public class ChooseAccountActivity extends PreferenceActivity {
private void finishWithAccountType(String accountType) {
Intent intent = new Intent();
intent.putExtra(AddAccountSettings.EXTRA_SELECTED_ACCOUNT, accountType);
- setResult(RESULT_OK, intent);
+ getActivity().setResult(Activity.RESULT_OK, intent);
finish();
}
}
diff --git a/src/com/android/settings/accounts/ManageAccountsSettings.java b/src/com/android/settings/accounts/ManageAccountsSettings.java
index 184f68092..b5a6579e3 100644
--- a/src/com/android/settings/accounts/ManageAccountsSettings.java
+++ b/src/com/android/settings/accounts/ManageAccountsSettings.java
@@ -31,7 +31,6 @@ import android.content.pm.ResolveInfo;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.preference.Preference;
-import android.preference.PreferenceActivity;
import android.preference.PreferenceScreen;
import android.util.Log;
import android.view.LayoutInflater;
@@ -45,6 +44,7 @@ import android.widget.TextView;
import com.android.settings.AccountPreference;
import com.android.settings.R;
+import com.android.settings.SettingsActivity;
import com.android.settings.Utils;
import com.android.settings.location.LocationSettings;
@@ -146,7 +146,7 @@ public class ManageAccountsSettings extends AccountPreferenceBase
private void startAccountSettings(AccountPreference acctPref) {
Bundle args = new Bundle();
args.putParcelable(AccountSyncSettings.ACCOUNT_KEY, acctPref.getAccount());
- ((PreferenceActivity) getActivity()).startPreferencePanel(
+ ((SettingsActivity) getActivity()).startPreferencePanel(
AccountSyncSettings.class.getCanonicalName(), args,
R.string.account_sync_settings_title, acctPref.getAccount().name,
this, REQUEST_SHOW_SYNC_SETTINGS);
@@ -368,7 +368,7 @@ public class ManageAccountsSettings extends AccountPreferenceBase
@Override
public boolean onPreferenceClick(Preference preference) {
- ((PreferenceActivity) getActivity()).startPreferencePanel(
+ ((SettingsActivity) getActivity()).startPreferencePanel(
mClass, null, mTitleRes, null, null, 0);
// Hack: announce that the Google account preferences page is launching the location
// settings
diff --git a/src/com/android/settings/accounts/SyncSettingsActivity.java b/src/com/android/settings/accounts/SyncSettingsActivity.java
index 96f16d684..bbd9f9190 100644
--- a/src/com/android/settings/accounts/SyncSettingsActivity.java
+++ b/src/com/android/settings/accounts/SyncSettingsActivity.java
@@ -16,22 +16,20 @@
package com.android.settings.accounts;
-import android.app.Fragment;
import android.content.Intent;
-import android.preference.PreferenceActivity;
-import com.android.settings.ChooseLockGeneric.ChooseLockGenericFragment;
+import com.android.settings.SettingsActivity;
/**
* Launcher activity for the SyncSettings fragment.
*
*/
-public class SyncSettingsActivity extends PreferenceActivity {
+public class SyncSettingsActivity extends SettingsActivity {
@Override
public Intent getIntent() {
- Intent modIntent = new Intent(super.getIntent());
- modIntent.putExtra(EXTRA_SHOW_FRAGMENT, SyncSettings.class.getName());
- modIntent.putExtra(EXTRA_NO_HEADERS, true);
+ Intent modIntent = new Intent(getIntent());
+ modIntent.putExtra(SettingsActivity.EXTRA_SHOW_FRAGMENT, SyncSettings.class.getName());
+ modIntent.putExtra(SettingsActivity.EXTRA_NO_HEADERS, true);
return modIntent;
}