2 * ownCloud Android client application
5 * @author David A. Velasco
6 * Copyright (C) 2015 ownCloud Inc.
8 * This program is free software: you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2,
10 * as published by the Free Software Foundation.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
21 package com
.owncloud
.android
.ui
.adapter
;
23 import com
.owncloud
.android
.R
;
24 import com
.owncloud
.android
.ui
.dialog
.SslUntrustedCertDialog
;
25 import android
.net
.http
.SslError
;
26 import android
.view
.View
;
27 import android
.widget
.TextView
;
30 * Dialog to show an Untrusted Certificate
32 public class SslErrorViewAdapter
implements SslUntrustedCertDialog
.ErrorViewAdapter
{
34 //private final static String TAG = SslErrorViewAdapter.class.getSimpleName();
36 private SslError mSslError
;
38 public SslErrorViewAdapter(SslError sslError
) {
43 public void updateErrorView(View dialogView
) {
45 dialogView
.findViewById(R
.id
.reason_no_info_about_error
).setVisibility(View
.GONE
);
48 if (mSslError
.hasError(SslError
.SSL_UNTRUSTED
)) {
49 ((TextView
)dialogView
.findViewById(R
.id
.reason_cert_not_trusted
)).setVisibility(View
.VISIBLE
);
51 dialogView
.findViewById(R
.id
.reason_cert_not_trusted
).setVisibility(View
.GONE
);
54 if (mSslError
.hasError(SslError
.SSL_EXPIRED
)) {
55 ((TextView
)dialogView
.findViewById(R
.id
.reason_cert_expired
)).setVisibility(View
.VISIBLE
);
57 dialogView
.findViewById(R
.id
.reason_cert_expired
).setVisibility(View
.GONE
);
60 if (mSslError
.getPrimaryError() == SslError
.SSL_NOTYETVALID
) {
61 ((TextView
)dialogView
.findViewById(R
.id
.reason_cert_not_yet_valid
)).setVisibility(View
.VISIBLE
);
63 dialogView
.findViewById(R
.id
.reason_cert_not_yet_valid
).setVisibility(View
.GONE
);
66 if (mSslError
.getPrimaryError() == SslError
.SSL_IDMISMATCH
) {
67 ((TextView
)dialogView
.findViewById(R
.id
.reason_hostname_not_verified
)).setVisibility(View
.VISIBLE
);
69 dialogView
.findViewById(R
.id
.reason_hostname_not_verified
).setVisibility(View
.GONE
);