зеркало из https://github.com/mozilla/gecko-dev.git
Bug 721760 - Part 2: use Sync's openSyncSettings method from Fennec. r=blassey
This commit is contained in:
Родитель
f6b464405b
Коммит
a337077a21
|
@ -15,11 +15,9 @@ import android.util.AttributeSet;
|
|||
import android.util.Log;
|
||||
|
||||
import org.mozilla.gecko.sync.setup.activities.SetupSyncActivity;
|
||||
import org.mozilla.gecko.sync.setup.SyncAccounts;
|
||||
|
||||
class SyncPreference extends Preference {
|
||||
private static final String FENNEC_ACCOUNT_TYPE = "org.mozilla.firefox_sync";
|
||||
private static final String SYNC_SETTINGS = "android.settings.SYNC_SETTINGS";
|
||||
|
||||
private Context mContext;
|
||||
|
||||
public SyncPreference(Context context, AttributeSet attrs) {
|
||||
|
@ -29,13 +27,16 @@ class SyncPreference extends Preference {
|
|||
|
||||
@Override
|
||||
protected void onClick() {
|
||||
// show sync setup if no accounts exist; otherwise, show account settings
|
||||
Account[] accounts = AccountManager.get(mContext).getAccountsByType(FENNEC_ACCOUNT_TYPE);
|
||||
Intent intent;
|
||||
if (accounts.length > 0)
|
||||
intent = new Intent(SYNC_SETTINGS);
|
||||
else
|
||||
intent = new Intent(mContext, SetupSyncActivity.class);
|
||||
mContext.startActivity(intent);
|
||||
// Make sure we use the same account type as our bundled version of Sync!
|
||||
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) {
|
||||
SyncAccounts.openSyncSettings(mContext);
|
||||
} else {
|
||||
Intent intent = new Intent(mContext, SetupSyncActivity.class);
|
||||
mContext.startActivity(intent);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче