зеркало из https://github.com/mozilla/gecko-dev.git
Bug 735842 - replace hard-coded isSyncSetup() with SyncAccounts.syncAccountsExist in AboutHomeContent. r=rnewman
This commit is contained in:
Родитель
621da71044
Коммит
78d22c984d
|
@ -23,6 +23,7 @@ import org.json.JSONException;
|
|||
import org.json.JSONObject;
|
||||
import org.mozilla.gecko.db.BrowserDB;
|
||||
import org.mozilla.gecko.db.BrowserDB.URLColumns;
|
||||
import org.mozilla.gecko.sync.setup.SyncAccounts;
|
||||
import org.mozilla.gecko.sync.setup.activities.SetupSyncActivity;
|
||||
|
||||
import android.accounts.Account;
|
||||
|
@ -108,7 +109,7 @@ public class AboutHomeContent extends ScrollView
|
|||
}
|
||||
|
||||
public void init() {
|
||||
Context context = getContext();
|
||||
final Context context = getContext();
|
||||
mInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
||||
mInflater.inflate(R.layout.abouthome_content, this);
|
||||
|
||||
|
@ -118,7 +119,7 @@ public class AboutHomeContent extends ScrollView
|
|||
mAccountManager.addOnAccountsUpdatedListener(mAccountListener = new OnAccountsUpdateListener() {
|
||||
public void onAccountsUpdated(Account[] accounts) {
|
||||
final GeckoApp.StartupMode startupMode = GeckoApp.mAppContext.getStartupMode();
|
||||
final boolean syncIsSetup = isSyncSetup();
|
||||
final boolean syncIsSetup = SyncAccounts.syncAccountsExist(context);
|
||||
|
||||
GeckoApp.mAppContext.mMainHandler.post(new Runnable() {
|
||||
public void run() {
|
||||
|
@ -263,11 +264,6 @@ public class AboutHomeContent extends ScrollView
|
|||
syncContainer.setBackgroundResource(background);
|
||||
}
|
||||
|
||||
private boolean isSyncSetup() {
|
||||
Account[] accounts = mAccountManager.getAccountsByType("org.mozilla.firefox_sync");
|
||||
return accounts.length > 0;
|
||||
}
|
||||
|
||||
private void updateLayout(GeckoApp.StartupMode startupMode, boolean syncIsSetup) {
|
||||
// The idea here is that we only show the sync invitation
|
||||
// on the very first run. Show sync banner below the top
|
||||
|
@ -295,9 +291,9 @@ public class AboutHomeContent extends ScrollView
|
|||
// the top sites section layout in main thread.
|
||||
final GeckoApp.StartupMode startupMode = GeckoApp.mAppContext.getStartupMode();
|
||||
|
||||
// The isSyncSetup method should not be called on
|
||||
// The SyncAccounts.syncAccountsExist method should not be called on
|
||||
// UI thread as it touches disk to access a sqlite DB.
|
||||
final boolean syncIsSetup = isSyncSetup();
|
||||
final boolean syncIsSetup = SyncAccounts.syncAccountsExist(activity);
|
||||
|
||||
final ContentResolver resolver = GeckoApp.mAppContext.getContentResolver();
|
||||
final Cursor oldCursor = mCursor;
|
||||
|
@ -589,7 +585,7 @@ public class AboutHomeContent extends ScrollView
|
|||
}
|
||||
|
||||
private void loadRemoteTabs(final Activity activity) {
|
||||
if (!isSyncSetup()) {
|
||||
if (!SyncAccounts.syncAccountsExist(activity)) {
|
||||
GeckoApp.mAppContext.mMainHandler.post(new Runnable() {
|
||||
public void run() {
|
||||
mRemoteTabs.hide();
|
||||
|
|
|
@ -31,8 +31,7 @@ class SyncPreference extends Preference {
|
|||
final String accountType = org.mozilla.gecko.sync.setup.Constants.ACCOUNTTYPE_SYNC;
|
||||
|
||||
// Show Sync setup if no accounts exist; otherwise, show account settings.
|
||||
Account[] accounts = AccountManager.get(mContext).getAccountsByType(accountType);
|
||||
if (accounts.length > 0) {
|
||||
if (SyncAccounts.syncAccountsExist(mContext)) {
|
||||
SyncAccounts.openSyncSettings(mContext);
|
||||
} else {
|
||||
Intent intent = new Intent(mContext, SetupSyncActivity.class);
|
||||
|
|
Загрузка…
Ссылка в новой задаче