1 /* ownCloud Android client application
2 * Copyright (C) 2012-2014 ownCloud Inc.
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2,
6 * as published by the Free Software Foundation.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 package com
.owncloud
.android
.ui
.adapter
;
19 import com
.owncloud
.android
.R
;
20 import com
.owncloud
.android
.lib
.common
.network
.CertificateCombinedException
;
21 import com
.owncloud
.android
.ui
.dialog
.SslUntrustedCertDialog
;
23 import android
.view
.View
;
24 import android
.widget
.TextView
;
30 * @author David A. Velasco
33 public class CertificateCombinedExceptionViewAdapter
implements SslUntrustedCertDialog
.ErrorViewAdapter
{
35 //private final static String TAG = CertificateCombinedExceptionViewAdapter.class.getSimpleName();
37 private CertificateCombinedException mSslException
= null
;
39 public CertificateCombinedExceptionViewAdapter(CertificateCombinedException sslException
) {
40 mSslException
= sslException
;
44 public void updateErrorView(View dialogView
) {
46 dialogView
.findViewById(R
.id
.reason_no_info_about_error
).setVisibility(View
.GONE
);
49 if (mSslException
.getCertPathValidatorException() != null
) {
50 ((TextView
)dialogView
.findViewById(R
.id
.reason_cert_not_trusted
)).setVisibility(View
.VISIBLE
);
52 dialogView
.findViewById(R
.id
.reason_cert_not_trusted
).setVisibility(View
.GONE
);
55 if (mSslException
.getCertificateExpiredException() != null
) {
56 ((TextView
)dialogView
.findViewById(R
.id
.reason_cert_expired
)).setVisibility(View
.VISIBLE
);
58 dialogView
.findViewById(R
.id
.reason_cert_expired
).setVisibility(View
.GONE
);
61 if (mSslException
.getCertificateNotYetValidException() != null
) {
62 ((TextView
)dialogView
.findViewById(R
.id
.reason_cert_not_yet_valid
)).setVisibility(View
.VISIBLE
);
64 dialogView
.findViewById(R
.id
.reason_cert_not_yet_valid
).setVisibility(View
.GONE
);
67 if (mSslException
.getSslPeerUnverifiedException() != null
) {
68 ((TextView
)dialogView
.findViewById(R
.id
.reason_hostname_not_verified
)).setVisibility(View
.VISIBLE
);
70 dialogView
.findViewById(R
.id
.reason_hostname_not_verified
).setVisibility(View
.GONE
);