protected void linkifyOldFirefoxLink() { TextView oldFirefox = (TextView) findViewById(R.id.old_firefox); String text = getResources().getString(R.string.fxaccount_getting_started_old_firefox); final String url = FirefoxAccounts.getOldSyncUpgradeURL(getResources(), Locale.getDefault()); FxAccountUtils.pii( LOG_TAG, "Old Firefox url is: " + url); // Don't want to leak locale in particular. ActivityUtils.linkTextView(oldFirefox, text, url); }
protected void updateFromIntentExtras() { // Only set email/password in onCreate; we don't want to overwrite edited values onResume. if (getIntent() != null && getIntent().getExtras() != null) { Bundle bundle = getIntent().getExtras(); emailEdit.setText(bundle.getString(EXTRA_EMAIL)); passwordEdit.setText(bundle.getString(EXTRA_PASSWORD)); setPasswordButtonShown(bundle.getBoolean(EXTRA_PASSWORD_SHOWN, false)); } // This sets defaults as well as extracting from extras, so it's not conditional. updateServersFromIntentExtras(getIntent()); if (FxAccountUtils.LOG_PERSONAL_INFORMATION) { FxAccountUtils.pii(LOG_TAG, "Using auth server: " + authServerEndpoint); FxAccountUtils.pii(LOG_TAG, "Using sync server: " + syncServerEndpoint); } updateCustomServerView(); }
/** <b>For debugging only!</b> */ public void dump() { if (!FxAccountUtils.LOG_PERSONAL_INFORMATION) { return; } ExtendedJSONObject o = toJSONObject(); ArrayList<String> list = new ArrayList<String>(o.keySet()); Collections.sort(list); for (String key : list) { FxAccountUtils.pii(LOG_TAG, key + ": " + o.get(key)); } }
/** * Update profile information from json on UI thread. * * @param profileJSON json fetched from server. */ protected void updateProfileInformation(final ExtendedJSONObject profileJSON) { // View changes must always be done on UI thread. ThreadUtils.assertOnUiThread(); FxAccountUtils.pii(LOG_TAG, "Profile JSON is: " + profileJSON.toJSONString()); final String userName = profileJSON.getString(FxAccountConstants.KEY_PROFILE_JSON_USERNAME); // Update the profile username and email if available. if (!TextUtils.isEmpty(userName)) { profilePreference.setTitle(userName); profilePreference.setSummary(fxAccount.getEmail()); } else { profilePreference.setTitle(fxAccount.getEmail()); } // Icon update from java is not supported prior to API 11, skip the avatar image fetch and // update for older device. if (!AppConstants.Versions.feature11Plus) { Logger.info(LOG_TAG, "Skipping profile image fetch for older pre-API 11 devices."); return; } // Avatar URI empty, skip profile image fetch. final String avatarURI = profileJSON.getString(FxAccountConstants.KEY_PROFILE_JSON_AVATAR); if (TextUtils.isEmpty(avatarURI)) { Logger.info(LOG_TAG, "AvatarURI is empty, skipping profile image fetch."); return; } // Using noPlaceholder would avoid a pop of the default image, but it's not available in the // version of Picasso // we ship in the tree. Picasso.with(getActivity()) .load(avatarURI) .centerInside() .resizeDimen(R.dimen.fxaccount_profile_image_width, R.dimen.fxaccount_profile_image_height) .placeholder(R.drawable.sync_avatar_default) .error(R.drawable.sync_avatar_default) .into(profileAvatarTarget); }