From 3da6a6f999a88f435a9db7611f3981ffefe42d38 Mon Sep 17 00:00:00 2001 From: Soren Stoutner Date: Thu, 26 Jan 2017 16:38:29 -0700 Subject: [PATCH] Localize the start and end dates for `ViewSslCertificate.java` and `SslCertificateError.java`. Fixes https://redmine.stoutner.com/issues/82. --- .../privacybrowser/dialogs/SslCertificateError.java | 7 ++++--- .../privacybrowser/dialogs/ViewSslCertificate.java | 7 ++++--- .../stoutner/privacybrowser/helpers/OrbotProxyHelper.java | 2 +- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/com/stoutner/privacybrowser/dialogs/SslCertificateError.java b/app/src/main/java/com/stoutner/privacybrowser/dialogs/SslCertificateError.java index 1e956162..10afe62e 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/dialogs/SslCertificateError.java +++ b/app/src/main/java/com/stoutner/privacybrowser/dialogs/SslCertificateError.java @@ -1,5 +1,5 @@ /** - * Copyright 2016 Soren Stoutner . + * Copyright 2016-2017 Soren Stoutner . * * This file is part of Privacy Browser . * @@ -37,6 +37,7 @@ import android.widget.TextView; import com.stoutner.privacybrowser.R; +import java.text.DateFormat; import java.util.Date; public class SslCertificateError extends AppCompatDialogFragment { @@ -76,8 +77,8 @@ public class SslCertificateError extends AppCompatDialogFragment { argumentsBundle.putString("IssuedByCName", issuedByCNameForBundle); argumentsBundle.putString("IssuedByOName", issuedByONameForBundle); argumentsBundle.putString("IssuedByUName", issuedByUNameForBundle); - argumentsBundle.putString("StartDate", startDateForBundle.toString()); - argumentsBundle.putString("EndDate", endDateForBundle.toString()); + argumentsBundle.putString("StartDate", DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.LONG).format(startDateForBundle)); + argumentsBundle.putString("EndDate", DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.LONG).format(endDateForBundle)); // Add `argumentsBundle` to this instance of `SslCertificateError`. SslCertificateError thisSslCertificateErrorDialog = new SslCertificateError(); diff --git a/app/src/main/java/com/stoutner/privacybrowser/dialogs/ViewSslCertificate.java b/app/src/main/java/com/stoutner/privacybrowser/dialogs/ViewSslCertificate.java index d977cbed..b675c45b 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/dialogs/ViewSslCertificate.java +++ b/app/src/main/java/com/stoutner/privacybrowser/dialogs/ViewSslCertificate.java @@ -1,5 +1,5 @@ /** - * Copyright 2016 Soren Stoutner . + * Copyright 2016-2017 Soren Stoutner . * * This file is part of Privacy Browser . * @@ -36,6 +36,7 @@ import android.widget.TextView; import com.stoutner.privacybrowser.activities.MainWebView; import com.stoutner.privacybrowser.R; +import java.text.DateFormat; import java.util.Date; // `@SuppressLing("InflateParams")` removes the warning about using `null` as the parent view group when inflating the `AlertDialog`. @@ -122,8 +123,8 @@ public class ViewSslCertificate extends DialogFragment { SpannableStringBuilder issuedByCNameStringBuilder = new SpannableStringBuilder(cNameLabel + issuedByCNameString); SpannableStringBuilder issuedByONameStringBuilder = new SpannableStringBuilder(oNameLabel + issuedByONameString); SpannableStringBuilder issuedByUNameStringBuilder = new SpannableStringBuilder(uNameLabel + issuedByUNameString); - SpannableStringBuilder startDateStringBuilder = new SpannableStringBuilder(startDateLabel + startDate.toString()); - SpannableStringBuilder endDateStringBuilder = new SpannableStringBuilder(endDateLabel + endDate.toString()); + SpannableStringBuilder startDateStringBuilder = new SpannableStringBuilder(startDateLabel + DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.LONG).format(startDate)); + SpannableStringBuilder endDateStringBuilder = new SpannableStringBuilder(endDateLabel + DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.LONG).format(endDate)); // Create a blue `ForegroundColorSpan`. We have to use the deprecated `getColor` until API >= 23. @SuppressWarnings("deprecation") ForegroundColorSpan blueColorSpan = new ForegroundColorSpan(getResources().getColor(R.color.blue_700)); diff --git a/app/src/main/java/com/stoutner/privacybrowser/helpers/OrbotProxyHelper.java b/app/src/main/java/com/stoutner/privacybrowser/helpers/OrbotProxyHelper.java index 6e751411..87db7ea6 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/helpers/OrbotProxyHelper.java +++ b/app/src/main/java/com/stoutner/privacybrowser/helpers/OrbotProxyHelper.java @@ -1,5 +1,5 @@ /** - * Copyright 2016 Soren Stoutner . + * Copyright 2016-2017 Soren Stoutner . * * This file is part of Privacy Browser . * -- 2.45.2