android:textAppearance="?android:attr/textAppearanceSmall"
/>
+ <TextView
+ android:id="@+id/reason_no_info_about_error"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="left"
+ android:paddingLeft="20dp"
+ android:text="@string/ssl_validator_no_info_about_error"
+ android:textAppearance="?android:attr/textAppearanceSmall"
+ />
+
<ScrollView
android:id="@+id/details_scroll"
android:visibility="gone"
// Create a view by inflating desired layout
mView = inflater.inflate(R.layout.ssl_untrusted_cert_layout, container, false);
- updateException(mException);
+ updateMessageException(mException, mError);
Button ok = (Button) mView.findViewById(R.id.ok);
ok.setOnClickListener(new OnClickListener() {
}
- private void updateException(CertificateCombinedException exception) {
+ private void updateMessageException(CertificateCombinedException exception, SslError error) {
/// clean
mView.findViewById(R.id.reason_cert_not_trusted).setVisibility(View.GONE);
mView.findViewById(R.id.reason_cert_expired).setVisibility(View.GONE);
mView.findViewById(R.id.reason_cert_not_yet_valid).setVisibility(View.GONE);
mView.findViewById(R.id.reason_hostname_not_verified).setVisibility(View.GONE);
+ mView.findViewById(R.id.reason_no_info_about_error).setVisibility(View.GONE);
mView.findViewById(R.id.details_scroll).setVisibility(View.GONE);
-
- if (mException != null) {
+
+ if (exception != null) {
/// refresh
- if (mException.getCertPathValidatorException() != null) {
+ if (exception.getCertPathValidatorException() != null) {
((TextView)mView.findViewById(R.id.reason_cert_not_trusted)).setVisibility(View.VISIBLE);
}
- if (mException.getCertificateExpiredException() != null) {
+ if (exception.getCertificateExpiredException() != null) {
((TextView)mView.findViewById(R.id.reason_cert_expired)).setVisibility(View.VISIBLE);
}
- if (mException.getCertificateNotYetValidException() != null) {
+ if (exception.getCertificateNotYetValidException() != null) {
((TextView)mView.findViewById(R.id.reason_cert_not_yet_valid)).setVisibility(View.VISIBLE);
}
- if (mException.getSslPeerUnverifiedException() != null ) {
+ if (exception.getSslPeerUnverifiedException() != null) {
((TextView)mView.findViewById(R.id.reason_hostname_not_verified)).setVisibility(View.VISIBLE);
}
+ } else if ( error != null) {
+ /// refresh
+ if (error.getPrimaryError() == SslError.SSL_UNTRUSTED) {
+ ((TextView)mView.findViewById(R.id.reason_cert_not_trusted)).setVisibility(View.VISIBLE);
+
+ } else if (error.getPrimaryError() == SslError.SSL_EXPIRED) {
+ ((TextView)mView.findViewById(R.id.reason_cert_expired)).setVisibility(View.VISIBLE);
+
+ } else if (error.getPrimaryError() == SslError.SSL_NOTYETVALID) {
+ ((TextView)mView.findViewById(R.id.reason_cert_not_yet_valid)).setVisibility(View.VISIBLE);
+
+ } else if (error.getPrimaryError() == SslError.SSL_IDMISMATCH) {
+ ((TextView)mView.findViewById(R.id.reason_hostname_not_verified)).setVisibility(View.VISIBLE);
+ }
}
}
((ViewGroup)mView.getParent()).removeView(mView);
}
+ showNoMessageError();
+
Button ok = (Button) mView.findViewById(R.id.ok);
ok.setOnClickListener(new OnClickListener() {
((TextView)mView.findViewById(R.id.value_signature)).setVisibility(View.GONE);
}
+ private void showNoMessageError() {
+ /// clean
+ mView.findViewById(R.id.reason_cert_not_trusted).setVisibility(View.GONE);
+ mView.findViewById(R.id.reason_cert_expired).setVisibility(View.GONE);
+ mView.findViewById(R.id.reason_cert_not_yet_valid).setVisibility(View.GONE);
+ mView.findViewById(R.id.reason_hostname_not_verified).setVisibility(View.GONE);
+ mView.findViewById(R.id.details_scroll).setVisibility(View.GONE);
+
+ mView.findViewById(R.id.reason_no_info_about_error).setVisibility(View.VISIBLE);
+
+ }
}