1 /* ownCloud Android client application
4 * @author David A. Velasco
5 * Copyright (C) 2012-2014 ownCloud Inc.
7 * This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2,
9 * as published by the Free Software Foundation.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 package com
.owncloud
.android
.ui
.adapter
;
22 import com
.owncloud
.android
.R
;
23 import com
.owncloud
.android
.ui
.dialog
.SslUntrustedCertDialog
;
24 import android
.net
.http
.SslError
;
25 import android
.view
.View
;
26 import android
.widget
.TextView
;
29 * Dialog to show an Untrusted Certificate
31 public class SslErrorViewAdapter
implements SslUntrustedCertDialog
.ErrorViewAdapter
{
33 //private final static String TAG = SslErrorViewAdapter.class.getSimpleName();
35 private SslError mSslError
;
37 public SslErrorViewAdapter(SslError sslError
) {
42 public void updateErrorView(View dialogView
) {
44 dialogView
.findViewById(R
.id
.reason_no_info_about_error
).setVisibility(View
.GONE
);
47 if (mSslError
.hasError(SslError
.SSL_UNTRUSTED
)) {
48 ((TextView
)dialogView
.findViewById(R
.id
.reason_cert_not_trusted
)).setVisibility(View
.VISIBLE
);
50 dialogView
.findViewById(R
.id
.reason_cert_not_trusted
).setVisibility(View
.GONE
);
53 if (mSslError
.hasError(SslError
.SSL_EXPIRED
)) {
54 ((TextView
)dialogView
.findViewById(R
.id
.reason_cert_expired
)).setVisibility(View
.VISIBLE
);
56 dialogView
.findViewById(R
.id
.reason_cert_expired
).setVisibility(View
.GONE
);
59 if (mSslError
.getPrimaryError() == SslError
.SSL_NOTYETVALID
) {
60 ((TextView
)dialogView
.findViewById(R
.id
.reason_cert_not_yet_valid
)).setVisibility(View
.VISIBLE
);
62 dialogView
.findViewById(R
.id
.reason_cert_not_yet_valid
).setVisibility(View
.GONE
);
65 if (mSslError
.getPrimaryError() == SslError
.SSL_IDMISMATCH
) {
66 ((TextView
)dialogView
.findViewById(R
.id
.reason_hostname_not_verified
)).setVisibility(View
.VISIBLE
);
68 dialogView
.findViewById(R
.id
.reason_hostname_not_verified
).setVisibility(View
.GONE
);