Bug 1205418 - Add "Manage account" link to Status Activity. r=vivek

This just directs to about:accounts?action=manage, which determines
the relevant URL and displays the web content.

Nota bene: about:accounts hasn't landed yet.
This commit is contained in:
Nick Alexander 2015-09-10 16:36:29 -07:00
parent 964d0f4327
commit 2db17655e9
4 changed files with 21 additions and 1 deletions

View File

@ -41,6 +41,7 @@ import org.mozilla.gecko.fxa.tasks.FxAccountCodeResender;
import org.mozilla.gecko.sync.ExtendedJSONObject;
import org.mozilla.gecko.sync.SharedPreferencesClientsDataDelegate;
import org.mozilla.gecko.sync.SyncConfiguration;
import org.mozilla.gecko.sync.setup.activities.ActivityUtils;
import org.mozilla.gecko.util.HardwareUtils;
import org.mozilla.gecko.util.ThreadUtils;
@ -94,6 +95,7 @@ public class FxAccountStatusFragment
protected PreferenceCategory accountCategory;
protected Preference profilePreference;
protected Preference emailPreference;
protected Preference manageAccountPreference;
protected Preference authServerPreference;
protected Preference needsPasswordPreference;
@ -169,6 +171,10 @@ public class FxAccountStatusFragment
} else {
accountCategory.removePreference(profilePreference);
}
manageAccountPreference = ensureFindPreference("manage_account");
if (AppConstants.MOZ_ANDROID_NATIVE_ACCOUNT_UI) {
accountCategory.removePreference(manageAccountPreference);
}
authServerPreference = ensureFindPreference("auth_server");
needsPasswordPreference = ensureFindPreference("needs_credentials");
@ -197,6 +203,7 @@ public class FxAccountStatusFragment
} else {
emailPreference.setOnPreferenceClickListener(this);
}
manageAccountPreference.setOnPreferenceClickListener(this);
needsPasswordPreference.setOnPreferenceClickListener(this);
needsVerificationPreference.setOnPreferenceClickListener(this);
@ -234,6 +241,12 @@ public class FxAccountStatusFragment
@Override
public boolean onPreferenceClick(Preference preference) {
if (preference == manageAccountPreference) {
// There's no native equivalent, so no need to re-direct through an Intent filter.
ActivityUtils.openURLInFennec(getActivity().getApplicationContext(), "about:accounts?action=manage");
return true;
}
if (preference == needsPasswordPreference) {
final Intent intent = new Intent(FxAccountConstants.ACTION_FXA_UPDATE_CREDENTIALS);
final Bundle extras = getExtrasForAccount();

View File

@ -197,6 +197,7 @@
<!ENTITY fxaccount_status_header2 'Firefox Account'>
<!ENTITY fxaccount_status_signed_in_as 'Signed in as'>
<!ENTITY fxaccount_status_manage_account 'Manage account'>
<!ENTITY fxaccount_status_auth_server 'Account server'>
<!ENTITY fxaccount_status_sync_now 'Sync now'>
<!ENTITY fxaccount_status_syncing2 'Syncing…'>

View File

@ -16,6 +16,11 @@
android:key="email"
android:persistent="false"
android:title="@string/fxaccount_email_hint" />
<Preference
android:editable="false"
android:key="manage_account"
android:persistent="false"
android:title="@string/fxaccount_status_manage_account" />
<Preference
android:editable="false"
android:key="auth_server"

View File

@ -186,6 +186,7 @@
<string name="fxaccount_status_activity_label">&syncBrand.shortName.label;</string>
<string name="fxaccount_status_header">&fxaccount_status_header2;</string>
<string name="fxaccount_status_signed_in_as">&fxaccount_status_signed_in_as;</string>
<string name="fxaccount_status_manage_account">&fxaccount_status_manage_account;</string>
<string name="fxaccount_status_auth_server">&fxaccount_status_auth_server;</string>
<string name="fxaccount_status_sync_now">&fxaccount_status_sync_now;</string>
<string name="fxaccount_status_syncing">&fxaccount_status_syncing2;</string>
@ -240,4 +241,4 @@
<string name="fxaccount_sync_finish_migrating_notification_text">&fxaccount_sync_finish_migrating_notification_text;</string>
<!-- Log Personal information -->
<string name="fxaccount_enable_debug_mode">&fxaccount_enable_debug_mode;</string>
<string name="fxaccount_enable_debug_mode">&fxaccount_enable_debug_mode;</string>