From: Soren Stoutner Date: Thu, 24 Jan 2019 19:58:39 +0000 (-0700) Subject: Improve the layout of SSL certificates in Domain Settings. https://redmine.stoutner... X-Git-Tag: v2.16~2 X-Git-Url: https://gitweb.stoutner.com/?p=PrivacyBrowserAndroid.git;a=commitdiff_plain;h=c712e2ddec063fb29676a2df99786b262d8c4bfe Improve the layout of SSL certificates in Domain Settings. https://redmine.stoutner.com/issues/179 --- diff --git a/app/src/main/assets/es/about_licenses_dark.html b/app/src/main/assets/es/about_licenses_dark.html index 66318aab..2f92b563 100644 --- a/app/src/main/assets/es/about_licenses_dark.html +++ b/app/src/main/assets/es/about_licenses_dark.html @@ -48,14 +48,14 @@

Librerías

Navegador privado está construido con la librería de soporte de android, que se libera bajo la Licencia Apache 2.0.

-

The free flavor of Privacy Browser is built with Firebase Ads, - which is released under the Android Software Development Kit License.

- -

Classes

-

com.stoutner.privacybrowser.views.CheckedLinearLayout is a modified version of a class contained in the - Android Camera source code. - The original file was released under the Apache License 2.0. - The modified file is released under the GPLv3+ license.

+

El sabor o versión libre de Navegador Privado está construido con anuncios de Firebase, + que se libera bajo la Licencia del Android Software Development Kit.

+ +

Clases

+

com.stoutner.privacybrowser.views.CheckedLinearLayout es una versión modificada de una clase incluida en el código fuente de + Android Camera. + El archivo original se liberó bajo la Licencia Apache 2.0. + El archivo modificado se libera bajo la licencia GPLv3+.

Iconos

diff --git a/app/src/main/assets/es/about_licenses_light.html b/app/src/main/assets/es/about_licenses_light.html index 5ff4c600..1a3aa312 100644 --- a/app/src/main/assets/es/about_licenses_light.html +++ b/app/src/main/assets/es/about_licenses_light.html @@ -48,14 +48,14 @@

Librerías

Navegador privado está construido con la librería de soporte de android, que se libera bajo la Licencia Apache 2.0.

-

The free flavor of Privacy Browser is built with Firebase Ads, - which is released under the Android Software Development Kit License.

- -

Classes

-

com.stoutner.privacybrowser.views.CheckedLinearLayout is a modified version of a class contained in the - Android Camera source code. - The original file was released under the Apache License 2.0. - The modified file is released under the GPLv3+ license.

+

El sabor o versión libre de Navegador Privado está construido con anuncios de Firebase, + que se libera bajo la Licencia del Android Software Development Kit.

+ +

Clases

+

com.stoutner.privacybrowser.views.CheckedLinearLayout es una versión modificada de una clase incluida en el código fuente de + Android Camera. + El archivo original se liberó bajo la Licencia Apache 2.0. + El archivo modificado se libera bajo la licencia GPLv3+.

Iconos

diff --git a/app/src/main/java/com/stoutner/privacybrowser/fragments/DomainSettingsFragment.java b/app/src/main/java/com/stoutner/privacybrowser/fragments/DomainSettingsFragment.java index 6061a00e..aea9bf3e 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/fragments/DomainSettingsFragment.java +++ b/app/src/main/java/com/stoutner/privacybrowser/fragments/DomainSettingsFragment.java @@ -1,5 +1,5 @@ /* - * Copyright © 2017-2018 Soren Stoutner . + * Copyright © 2017-2019 Soren Stoutner . * * This file is part of Privacy Browser . * @@ -27,10 +27,11 @@ import android.database.Cursor; import android.net.http.SslCertificate; import android.os.Build; import android.os.Bundle; -// `android.support.v4.app.Fragment` must be used until minimum API >= 23. Otherwise `getContext()` does not work. import android.preference.PreferenceManager; import android.support.annotation.NonNull; +// `android.support.v4.app.Fragment` must be used until minimum API >= 23. Otherwise `getContext()` does not work. import android.support.v4.app.Fragment; +import android.support.v7.widget.CardView; import android.text.Editable; import android.text.SpannableStringBuilder; import android.text.Spanned; @@ -140,7 +141,8 @@ public class DomainSettingsFragment extends Fragment { final TextView displayImagesTextView = domainSettingsView.findViewById(R.id.domain_settings_display_webpage_images_textview); final ImageView pinnedSslCertificateImageView = domainSettingsView.findViewById(R.id.domain_settings_pinned_ssl_certificate_imageview); Switch pinnedSslCertificateSwitch = domainSettingsView.findViewById(R.id.domain_settings_pinned_ssl_certificate_switch); - final LinearLayout savedSslCertificateLinearLayout = domainSettingsView.findViewById(R.id.saved_ssl_certificate_linearlayout); + final CardView savedSslCertificateCardView = domainSettingsView.findViewById(R.id.saved_ssl_certificate_cardview); + LinearLayout savedSslCertificateLinearLayout = domainSettingsView.findViewById(R.id.saved_ssl_certificate_linearlayout); final RadioButton savedSslCertificateRadioButton = domainSettingsView.findViewById(R.id.saved_ssl_certificate_radiobutton); final TextView savedSslCertificateIssuedToCNameTextView = domainSettingsView.findViewById(R.id.saved_ssl_certificate_issued_to_cname); TextView savedSslCertificateIssuedToONameTextView = domainSettingsView.findViewById(R.id.saved_ssl_certificate_issued_to_oname); @@ -150,7 +152,8 @@ public class DomainSettingsFragment extends Fragment { TextView savedSslCertificateIssuedByUNameTextView = domainSettingsView.findViewById(R.id.saved_ssl_certificate_issued_by_uname); TextView savedSslCertificateStartDateTextView = domainSettingsView.findViewById(R.id.saved_ssl_certificate_start_date); TextView savedSslCertificateEndDateTextView = domainSettingsView.findViewById(R.id.saved_ssl_certificate_end_date); - final LinearLayout currentWebsiteCertificateLinearLayout = domainSettingsView.findViewById(R.id.current_website_certificate_linearlayout); + final CardView currentWebsiteCertificateCardView = domainSettingsView.findViewById(R.id.current_website_certificate_cardview); + LinearLayout currentWebsiteCertificateLinearLayout = domainSettingsView.findViewById(R.id.current_website_certificate_linearlayout); final RadioButton currentWebsiteCertificateRadioButton = domainSettingsView.findViewById(R.id.current_website_certificate_radiobutton); final TextView currentWebsiteCertificateIssuedToCNameTextView = domainSettingsView.findViewById(R.id.current_website_certificate_issued_to_cname); TextView currentWebsiteCertificateIssuedToONameTextView = domainSettingsView.findViewById(R.id.current_website_certificate_issued_to_oname); @@ -1068,41 +1071,62 @@ public class DomainSettingsFragment extends Fragment { if (pinnedSslCertificateSwitch.isChecked()) { // Set the visibility of the saved SSL certificate. if (savedSslCertificateIssuedToCNameString == null) { - savedSslCertificateLinearLayout.setVisibility(View.GONE); + savedSslCertificateCardView.setVisibility(View.GONE); } else { - savedSslCertificateLinearLayout.setVisibility(View.VISIBLE); + savedSslCertificateCardView.setVisibility(View.VISIBLE); } // Set the visibility of the current website SSL certificate. if (currentWebsiteSslCertificate == null) { // Hide the SSL certificate. - currentWebsiteCertificateLinearLayout.setVisibility(View.GONE); + currentWebsiteCertificateCardView.setVisibility(View.GONE); // Show the instruction. noCurrentWebsiteCertificateTextView.setVisibility(View.VISIBLE); } else { // Show the SSL certificate. - currentWebsiteCertificateLinearLayout.setVisibility(View.VISIBLE); + currentWebsiteCertificateCardView.setVisibility(View.VISIBLE); // Hide the instruction. noCurrentWebsiteCertificateTextView.setVisibility(View.GONE); } // Set the status of the radio buttons. - if (savedSslCertificateLinearLayout.getVisibility() == View.VISIBLE) { // The saved SSL certificate is displayed. + if (savedSslCertificateCardView.getVisibility() == View.VISIBLE) { // The saved SSL certificate is displayed. + // Check the saved SSL certificate radio button. savedSslCertificateRadioButton.setChecked(true); + + // Uncheck the current website SSL certificate radio button. currentWebsiteCertificateRadioButton.setChecked(false); - } else if (currentWebsiteCertificateLinearLayout.getVisibility() == View.VISIBLE) { // The saved SSL certificate is hidden but the current website SSL certificate is visible. + + // Darken the background of the current website SSL certificate linear layout according to the theme. + if (MainWebViewActivity.darkTheme) { + currentWebsiteCertificateLinearLayout.setBackgroundResource(R.color.black_translucent_33); + } else { + currentWebsiteCertificateLinearLayout.setBackgroundResource(R.color.black_translucent_11); + } + } else if (currentWebsiteCertificateCardView.getVisibility() == View.VISIBLE) { // The saved SSL certificate is hidden but the current website SSL certificate is visible. + // Check the current website SSL certificate radio button. currentWebsiteCertificateRadioButton.setChecked(true); + + // Uncheck the saved SSL certificate radio button. savedSslCertificateRadioButton.setChecked(false); + + // Darken the background of the saved SSL certificate linear layout according to the theme. + if (MainWebViewActivity.darkTheme) { + savedSslCertificateLinearLayout.setBackgroundResource(R.color.black_translucent_33); + } else { + savedSslCertificateLinearLayout.setBackgroundResource(R.color.black_translucent_11); + } } else { // Neither SSL certificate is visible. + // Uncheck both radio buttons. savedSslCertificateRadioButton.setChecked(false); currentWebsiteCertificateRadioButton.setChecked(false); } } else { // `pinnedSslCertificateSwitch` is not checked. // Hide the SSl certificates and instructions. - savedSslCertificateLinearLayout.setVisibility(View.GONE); - currentWebsiteCertificateLinearLayout.setVisibility(View.GONE); + savedSslCertificateCardView.setVisibility(View.GONE); + currentWebsiteCertificateCardView.setVisibility(View.GONE); noCurrentWebsiteCertificateTextView.setVisibility(View.GONE); // Uncheck the radio buttons. @@ -1718,34 +1742,61 @@ public class DomainSettingsFragment extends Fragment { // Update the visibility of the saved SSL certificate. if (savedSslCertificateIssuedToCNameString == null) { - savedSslCertificateLinearLayout.setVisibility(View.GONE); + savedSslCertificateCardView.setVisibility(View.GONE); } else { - savedSslCertificateLinearLayout.setVisibility(View.VISIBLE); + savedSslCertificateCardView.setVisibility(View.VISIBLE); } // Update the visibility of the current website SSL certificate. if (currentWebsiteSslCertificate == null) { // Hide the SSL certificate. - currentWebsiteCertificateLinearLayout.setVisibility(View.GONE); + currentWebsiteCertificateCardView.setVisibility(View.GONE); // Show the instruction. noCurrentWebsiteCertificateTextView.setVisibility(View.VISIBLE); } else { // Show the SSL certificate. - currentWebsiteCertificateLinearLayout.setVisibility(View.VISIBLE); + currentWebsiteCertificateCardView.setVisibility(View.VISIBLE); // Hide the instruction. noCurrentWebsiteCertificateTextView.setVisibility(View.GONE); } // Set the status of the radio buttons. - if (savedSslCertificateLinearLayout.getVisibility() == View.VISIBLE) { // The saved SSL certificate is displayed. + if (savedSslCertificateCardView.getVisibility() == View.VISIBLE) { // The saved SSL certificate is displayed. + // Check the saved SSL certificate radio button. savedSslCertificateRadioButton.setChecked(true); + + // Uncheck the current website SSL certificate radio button. currentWebsiteCertificateRadioButton.setChecked(false); - } else if (currentWebsiteCertificateLinearLayout.getVisibility() == View.VISIBLE) { // The saved SSL certificate is hidden but the current website SSL certificate is visible. + + // Set the background of the saved SSL certificate linear layout to be transparent. + savedSslCertificateLinearLayout.setBackgroundResource(R.color.transparent); + + // Darken the background of the current website SSL certificate linear layout according to the theme. + if (MainWebViewActivity.darkTheme) { + currentWebsiteCertificateLinearLayout.setBackgroundResource(R.color.black_translucent_33); + } else { + currentWebsiteCertificateLinearLayout.setBackgroundResource(R.color.black_translucent_11); + } + } else if (currentWebsiteCertificateCardView.getVisibility() == View.VISIBLE) { // The saved SSL certificate is hidden but the current website SSL certificate is visible. + // Check the current website SSL certificate radio button. currentWebsiteCertificateRadioButton.setChecked(true); + + // Uncheck the saved SSL certificate radio button. savedSslCertificateRadioButton.setChecked(false); + + // Set the background of the current website SSL certificate linear layout to be transparent. + currentWebsiteCertificateLinearLayout.setBackgroundResource(R.color.transparent); + + // Darken the background of the saved SSL certificate linear layout according to the theme. + if (MainWebViewActivity.darkTheme) { + savedSslCertificateLinearLayout.setBackgroundResource(R.color.black_translucent_33); + } else { + savedSslCertificateLinearLayout.setBackgroundResource(R.color.black_translucent_11); + } } else { // Neither SSL certificate is visible. + // Uncheck both radio buttons. savedSslCertificateRadioButton.setChecked(false); currentWebsiteCertificateRadioButton.setChecked(false); } @@ -1758,8 +1809,8 @@ public class DomainSettingsFragment extends Fragment { } // Hide the SSl certificates and instructions. - savedSslCertificateLinearLayout.setVisibility(View.GONE); - currentWebsiteCertificateLinearLayout.setVisibility(View.GONE); + savedSslCertificateCardView.setVisibility(View.GONE); + currentWebsiteCertificateCardView.setVisibility(View.GONE); noCurrentWebsiteCertificateTextView.setVisibility(View.GONE); // Uncheck the radio buttons. @@ -1768,24 +1819,76 @@ public class DomainSettingsFragment extends Fragment { } }); - savedSslCertificateLinearLayout.setOnClickListener((View v) -> { + savedSslCertificateCardView.setOnClickListener((View v) -> { + // Check the saved SSL certificate radio button. savedSslCertificateRadioButton.setChecked(true); + + // Uncheck the current website SSL certificate radio button. currentWebsiteCertificateRadioButton.setChecked(false); + + // Set the background of the saved SSL certificate linear layout to be transparent. + savedSslCertificateLinearLayout.setBackgroundResource(R.color.transparent); + + // Darken the background of the current website SSL certificate linear layout according to the theme. + if (MainWebViewActivity.darkTheme) { + currentWebsiteCertificateLinearLayout.setBackgroundResource(R.color.black_translucent_33); + } else { + currentWebsiteCertificateLinearLayout.setBackgroundResource(R.color.black_translucent_11); + } }); savedSslCertificateRadioButton.setOnClickListener((View v) -> { + // Check the saved SSL certificate radio button. savedSslCertificateRadioButton.setChecked(true); + + // Uncheck the current website SSL certificate radio button. currentWebsiteCertificateRadioButton.setChecked(false); + + // Set the background of the saved SSL certificate linear layout to be transparent. + savedSslCertificateLinearLayout.setBackgroundResource(R.color.transparent); + + // Darken the background of the current website SSL certificate linear layout according to the theme. + if (MainWebViewActivity.darkTheme) { + currentWebsiteCertificateLinearLayout.setBackgroundResource(R.color.black_translucent_33); + } else { + currentWebsiteCertificateLinearLayout.setBackgroundResource(R.color.black_translucent_11); + } }); - currentWebsiteCertificateLinearLayout.setOnClickListener((View v) -> { + currentWebsiteCertificateCardView.setOnClickListener((View v) -> { + // Check the current website SSL certificate radio button. currentWebsiteCertificateRadioButton.setChecked(true); + + // Uncheck the saved SSL certificate radio button. savedSslCertificateRadioButton.setChecked(false); + + // Set the background of the current website SSL certificate linear layout to be transparent. + currentWebsiteCertificateLinearLayout.setBackgroundResource(R.color.transparent); + + // Darken the background of the saved SSL certificate linear layout according to the theme. + if (MainWebViewActivity.darkTheme) { + savedSslCertificateLinearLayout.setBackgroundResource(R.color.black_translucent_33); + } else { + savedSslCertificateLinearLayout.setBackgroundResource(R.color.black_translucent_11); + } }); currentWebsiteCertificateRadioButton.setOnClickListener((View v) -> { + // Check the current website SSL certificate radio button. currentWebsiteCertificateRadioButton.setChecked(true); + + // Uncheck the saved SSL certificate radio button. savedSslCertificateRadioButton.setChecked(false); + + // Set the background of the current website SSL certificate linear layout to be transparent. + currentWebsiteCertificateLinearLayout.setBackgroundResource(R.color.transparent); + + // Darken the background of the saved SSL certificate linear layout according to the theme. + if (MainWebViewActivity.darkTheme) { + savedSslCertificateLinearLayout.setBackgroundResource(R.color.black_translucent_33); + } else { + savedSslCertificateLinearLayout.setBackgroundResource(R.color.black_translucent_11); + } }); return domainSettingsView; diff --git a/app/src/main/res/layout/domain_settings_fragment.xml b/app/src/main/res/layout/domain_settings_fragment.xml index f2c8fb64..c44dd7bd 100644 --- a/app/src/main/res/layout/domain_settings_fragment.xml +++ b/app/src/main/res/layout/domain_settings_fragment.xml @@ -1,7 +1,7 @@ - - - + android:orientation="vertical" + android:padding="10dp" > - - - - + android:textColor="?android:textColorPrimary" /> - - - - - - - - - - - - - - - - - - - + android:layout_marginStart="32dp" + android:orientation="vertical" > + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - - - - - - - - - - - + android:orientation="vertical" + android:padding="10dp" > - - - - - - - - + android:textColor="?android:textColorPrimary" /> - - - - - - + android:layout_marginStart="32dp" + android:orientation="vertical" > + + + + + + + + + + + + + + + + + + + + + + + + + + - + Cerrar Dominio Dominio: + Direcciones IP: Emitido a Emitido por Nombre Común (CN): diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml index 3c3c1495..2929723f 100644 --- a/app/src/main/res/values-it/strings.xml +++ b/app/src/main/res/values-it/strings.xml @@ -71,6 +71,7 @@ Chiudi Dominio Dominio: + Indirizzi IP: Emesso a Emesso da Nome comune (NC): diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml index 3217b5dc..5796d029 100644 --- a/app/src/main/res/values-ru/strings.xml +++ b/app/src/main/res/values-ru/strings.xml @@ -68,6 +68,7 @@ Закрыть Домен Домен: + IP-адреса: Кому выдан Кем выдан Общепринятое имя (CN): diff --git a/app/src/main/res/values-tr/strings.xml b/app/src/main/res/values-tr/strings.xml index f0d42b2e..1dd52e19 100644 --- a/app/src/main/res/values-tr/strings.xml +++ b/app/src/main/res/values-tr/strings.xml @@ -68,6 +68,7 @@ Kapat Domain Domain: + IP Adresleri: Verilen Veren Ortak Ad (CN):