Ver código fonte

Merge c5260199a8f927712fff7625caffa55be79915b3 into a1a1102db1af463dc4c24c8debc1a7c8fc9e782e

Andy Scherzinger 6 anos atrás
pai
commit
4b88bf60f4

+ 58 - 0
lint.xml

@@ -143,5 +143,63 @@
         <ignore path="**/values-cs-rCZ/strings.xml"/>
         <ignore path="**/values-en-rGB/strings.xml"/>
     </issue>
+	
+	<issue id="Typos">
+        <ignore path="**/values-b+en+001/strings.xml"/>
+        <ignore path="**/values-pt-rPT/strings.xml"/>
+        <ignore path="**/values-ro/strings.xml"/>
+        <ignore path="**/values-zh-rCN/strings.xml"/>
+        <ignore path="**/values-bg-rBG/strings.xml"/>
+        <ignore path="**/values-nb-rNO/strings.xml"/>
+        <ignore path="**/values-es/strings.xml"/>
+        <ignore path="**/values-fa/strings.xml"/>
+        <ignore path="**/values-ko/strings.xml"/>
+        <ignore path="**/values-ru/strings.xml"/>
+        <ignore path="**/values-ast/strings.xml"/>
+        <ignore path="**/values-es-rCO/strings.xml"/>
+        <ignore path="**/values-es-rCL/strings.xml"/>
+        <ignore path="**/values-es-rSV/strings.xml"/>
+        <ignore path="**/values-sv/strings.xml"/>
+        <ignore path="**/values-tr/strings.xml"/>
+        <ignore path="**/values-es-rUY/strings.xml"/>
+        <ignore path="**/values-es-rGT/strings.xml"/>
+        <ignore path="**/values-fr/strings.xml"/>
+        <ignore path="**/values-es-rMX/strings.xml"/>
+        <ignore path="**/values-fi-rFI/strings.xml"/>
+        <ignore path="**/values-ar/strings.xml"/>
+        <ignore path="**/values-es-rAR/strings.xml"/>
+        <ignore path="**/values-de-rDE/strings.xml"/>
+        <ignore path="**/values-ca/strings.xml"/>
+        <ignore path="**/values-is/strings.xml"/>
+        <ignore path="**/values-es-rNI/strings.xml"/>
+        <ignore path="**/values-es-rPR/strings.xml"/>
+        <ignore path="**/values-es-rDO/strings.xml"/>
+        <ignore path="**/values-sq/strings.xml"/>
+        <ignore path="**/values-pt-rBR/strings.xml"/>
+        <ignore path="**/values-ja-rJP/strings.xml"/>
+        <ignore path="**/values-sr/strings.xml"/>
+        <ignore path="**/values-it/strings.xml"/>
+        <ignore path="**/values-hu-rHU/strings.xml"/>
+        <ignore path="**/values-pl/strings.xml"/>
+        <ignore path="**/values-es-rHN/strings.xml"/>
+        <ignore path="**/values-lt-rLT/strings.xml"/>
+        <ignore path="**/values-es-rPA/strings.xml"/>
+        <ignore path="**/values-nl/strings.xml"/>
+        <ignore path="**/values-sk-rSK/strings.xml"/>
+        <ignore path="**/values-ka-rGE/strings.xml"/>
+        <ignore path="**/values-eu/strings.xml"/>
+        <ignore path="**/values-es-rCR/strings.xml"/>
+        <ignore path="**/values-da/strings.xml"/>
+        <ignore path="**/values-es-rEC/strings.xml"/>
+        <ignore path="**/values-de/strings.xml"/>
+        <ignore path="**/values-sl/strings.xml"/>
+        <ignore path="**/values-es-rPY/strings.xml"/>
+        <ignore path="**/values-es-rPE/strings.xml"/>
+        <ignore path="**/values-zh-rTW/strings.xml"/>
+        <ignore path="**/values-el/strings.xml"/>
+        <ignore path="**/values-id/strings.xml"/>
+        <ignore path="**/values-cs-rCZ/strings.xml"/>
+        <ignore path="**/values-en-rGB/strings.xml"/>
+    </issue>
 
 </lint>

+ 17 - 17
src/main/java/com/owncloud/android/ui/adapter/X509CertificateViewAdapter.java

@@ -1,4 +1,4 @@
-/**
+/*
  *   ownCloud Android client application
  *
  *   @author masensio
@@ -20,6 +20,8 @@
  */
 package com.owncloud.android.ui.adapter;
 
+import android.content.Context;
+import android.support.annotation.NonNull;
 import android.util.Log;
 import android.view.View;
 import android.widget.TextView;
@@ -39,13 +41,11 @@ import java.util.Map;
 import javax.security.auth.x500.X500Principal;
 
 /**
- *
+ * Show certificate information.
  */
 public class X509CertificateViewAdapter implements SslUntrustedCertDialog.CertificateViewAdapter {
     
-    //private final static String TAG = X509CertificateViewAdapter.class.getSimpleName();
-    
-    private X509Certificate mCertificate = null;
+    private X509Certificate mCertificate;
 
     private static final String TAG = X509CertificateViewAdapter.class.getSimpleName();
 
@@ -55,7 +55,7 @@ public class X509CertificateViewAdapter implements SslUntrustedCertDialog.Certif
     
     @Override
     public void updateCertificateView(View dialogView) {
-        TextView nullCerView = (TextView) dialogView.findViewById(R.id.null_cert);
+        TextView nullCerView = dialogView.findViewById(R.id.null_cert);
         
         if (mCertificate != null) {
             nullCerView.setVisibility(View.GONE);
@@ -90,32 +90,32 @@ public class X509CertificateViewAdapter implements SslUntrustedCertDialog.Certif
         try {
             cert = mCertificate.getEncoded();
             if (cert == null) {
-
                 certFingerprintView.setText(R.string.certificate_load_problem);
                 algorithmView.setText(R.string.certificate_load_problem);
-
             } else {
-
-                certFingerprintView.setText(
-                        getDigestHexBytesWithColonsAndNewLines(dialogView, "SHA-256", cert)
-                                + getDigestHexBytesWithColonsAndNewLines(dialogView, "SHA-1", cert)
-                                + getDigestHexBytesWithColonsAndNewLines(dialogView, "MD5", cert));
+                certFingerprintView.setText(getDigestString(dialogView.getContext(), cert));
                 algorithmView.setText(mCertificate.getSigAlgName());
-
             }
         } catch (CertificateEncodingException e) {
             Log.e(TAG, "Problem while trying to decode the certificate.");
         }
     }
-    
-    private String getDigestHexBytesWithColonsAndNewLines(View dialogView, final String digestType, final byte [] cert) {
+
+    @NonNull
+    private String getDigestString(Context context, byte[] cert) {
+        return getDigestHexBytesWithColonsAndNewLines(context, "SHA-256", cert)
+                + getDigestHexBytesWithColonsAndNewLines(context, "SHA-1", cert)
+                + getDigestHexBytesWithColonsAndNewLines(context, "MD5", cert);
+    }
+
+    private String getDigestHexBytesWithColonsAndNewLines(Context context, final String digestType, final byte [] cert) {
         final byte[] rawDigest;
         final String newLine = System.getProperty("line.separator");
 
         rawDigest = getDigest(digestType, cert);
 
         if ( rawDigest == null) {
-            return digestType + ":" + newLine + dialogView.getContext().getString(R.string.digest_algorithm_not_available) + newLine + newLine;
+            return digestType + ":" + newLine + context.getString(R.string.digest_algorithm_not_available) + newLine + newLine;
         }
 
         final StringBuilder hex = new StringBuilder(3 * rawDigest.length);