import android.text.format.DateFormat;
import android.util.AttributeSet;
import android.util.Log;
+import android.util.Patterns;
import android.view.ContextMenu;
import android.view.Gravity;
import android.view.KeyEvent;
import android.accounts.OperationCanceledException;
import android.accounts.AccountManagerCallback;
-import com.android.common.Patterns;
import com.android.common.Search;
import com.android.common.speech.LoggingEvents;
-import com.google.android.gsf.GoogleLoginServiceConstants;
-
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.IOException;
private Account[] mAccountsGoogle;
private Account[] mAccountsPreferHosted;
+ // XXX: These constants should be exposed through some public api. Hardcode
+ // the values for now until some solution for gsf can be worked out.
+ // http://b/issue?id=2425179
+ private static final String ACCOUNT_TYPE = "com.google";
+ private static final String FEATURE_LEGACY_GOOGLE = "legacy_google";
+ private static final String FEATURE_LEGACY_HOSTED_OR_GOOGLE =
+ "legacy_hosted_or_google";
+
private void startReadOfGoogleAccounts() {
mAccountsGoogle = null;
mAccountsPreferHosted = null;
AccountManager.get(this).getAccountsByTypeAndFeatures(
- GoogleLoginServiceConstants.ACCOUNT_TYPE,
- new String[]{GoogleLoginServiceConstants.FEATURE_LEGACY_HOSTED_OR_GOOGLE},
+ ACCOUNT_TYPE, new String[]{ FEATURE_LEGACY_HOSTED_OR_GOOGLE },
this, null);
}
mAccountsGoogle = accountManagerFuture.getResult();
AccountManager.get(this).getAccountsByTypeAndFeatures(
- GoogleLoginServiceConstants.ACCOUNT_TYPE,
- new String[]{GoogleLoginServiceConstants.FEATURE_LEGACY_GOOGLE},
+ ACCOUNT_TYPE, new String[]{ FEATURE_LEGACY_GOOGLE },
this, null);
} else {
mAccountsPreferHosted = accountManagerFuture.getResult();
resetTitleIconAndProgress();
}
- private void goBackOnePageOrQuit() {
+ /* package */ void goBackOnePageOrQuit() {
Tab current = mTabControl.getCurrentTab();
if (current == null) {
/*
}
// issued on:
- String issuedOn = reformatCertificateDate(
- certificate.getValidNotBefore());
+ String issuedOn = formatCertificateDate(
+ certificate.getValidNotBeforeDate());
((TextView) certificateView.findViewById(R.id.issued_on))
.setText(issuedOn);
// expires on:
- String expiresOn = reformatCertificateDate(
- certificate.getValidNotAfter());
+ String expiresOn = formatCertificateDate(
+ certificate.getValidNotAfterDate());
((TextView) certificateView.findViewById(R.id.expires_on))
.setText(expiresOn);
}
/**
- * Re-formats the certificate date (Date.toString()) string to
- * a properly localized date string.
+ * Formats the certificate date to a properly localized date string.
* @return Properly localized version of the certificate date string and
- * the original certificate date string if fails to localize.
- * If the original string is null, returns an empty string "".
+ * the "" if it fails to localize.
*/
- private String reformatCertificateDate(String certificateDate) {
- String reformattedDate = null;
-
- if (certificateDate != null) {
- Date date = null;
- try {
- date = java.text.DateFormat.getInstance().parse(certificateDate);
- } catch (ParseException e) {
- date = null;
- }
-
- if (date != null) {
- reformattedDate =
- DateFormat.getDateFormat(this).format(date);
- }
+ private String formatCertificateDate(Date certificateDate) {
+ if (certificateDate == null) {
+ return "";
}
-
- return reformattedDate != null ? reformattedDate :
- (certificateDate != null ? certificateDate : "");
+ String formattedDate = DateFormat.getDateFormat(this).format(certificateDate);
+ if (formattedDate == null) {
+ return "";
+ }
+ return formattedDate;
}
/**