Changeset c95e4a6 in dispositivos_moviles for TibisayMovil
- Timestamp:
- Sep 30, 2013, 9:30:23 AM (11 years ago)
- Branches:
- master
- Children:
- 9572f49
- Parents:
- 8860b8f
- Location:
- TibisayMovil
- Files:
-
- 1 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
TibisayMovil/AndroidManifest.xml
r88eadd6 rc95e4a6 10 10 11 11 <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> 12 <uses-permission android:name="android.permission.INTERNET" /> 12 13 13 14 <application … … 42 43 android:name="ve.gob.cenditel.tibisaymovil.BDOCVerifyResultActivity" 43 44 android:label="@string/title_activity_bdocverify_result" > 45 46 <intent-filter> 47 <action android:name="android.intent.action.VIEW" /> 48 49 <category android:name="android.intent.category.DEFAULT" /> 50 51 <data android:scheme="file" /> 52 <data android:mimeType="*/*" /> 53 <data android:host="*" /> 54 <data android:pathPattern=".*\\.bdoc" /> 55 </intent-filter> 56 57 <intent-filter> 58 <action android:name="android.intent.action.VIEW" /> 59 60 <category android:name="android.intent.category.DEFAULT" /> 61 62 <data android:scheme="file" /> 63 <data android:mimeType="*/*" /> 64 <data android:host="*" /> 65 <data android:pathPattern=".*\\..*\\.bdoc" /> 66 </intent-filter> 67 68 69 <intent-filter> 70 <action android:name="android.intent.action.VIEW" /> 71 72 <category android:name="android.intent.category.BROWSABLE" /> 73 <category android:name="android.intent.category.DEFAULT" /> 74 75 <data android:scheme="https" /> 76 <data android:host="*" /> 77 <data android:pathPattern=".*\\.bdoc" /> 78 </intent-filter> 79 80 <intent-filter> 81 <action android:name="android.intent.action.VIEW" /> 82 83 <category android:name="android.intent.category.BROWSABLE" /> 84 <category android:name="android.intent.category.DEFAULT" /> 85 86 <data android:scheme="https" /> 87 <data android:host="*" /> 88 <data android:pathPattern=".*\\..*\\.bdoc" /> 89 </intent-filter> 90 91 44 92 </activity> 45 93 <activity … … 51 99 android:label="@string/title_activity_activity_signature_errors" > 52 100 </activity> 101 53 102 </application> 54 103 -
TibisayMovil/gen/ve/gob/cenditel/tibisaymovil/R.java
r8860b8f rc95e4a6 232 232 public static final int bdocverify_result=0x7f090002; 233 233 public static final int main=0x7f090003; 234 public static final int tibisay_movil=0x7f090004; 234 235 } 235 236 public static final class plurals { … … 321 322 public static final int title_activity_activity_signer_info=0x7f040050; 322 323 public static final int title_activity_bdocverify_result=0x7f040049; 324 public static final int title_activity_tibisay_movil=0x7f040059; 323 325 public static final int title_certificate_info=0x7f04004f; 324 326 public static final int title_progress_file_read=0x7f040039; -
TibisayMovil/res/values/strings.xml
r8860b8f rc95e4a6 84 84 <string name="verificar_titulo_lista_docs">Documento (s) firmado (s):</string> 85 85 <string name="verificar_titulo_lista_firmantes">Firmante (s):</string> 86 <string name="title_activity_bdocverify_result"> BDOCVerifyResultActivity</string>86 <string name="title_activity_bdocverify_result">Tibisay Móvil</string> 87 87 <string name="extracted_dir_files">ExtractedFiles</string> 88 88 <string name="open_it_using">Abrir usando:</string> … … 98 98 <string name="label_signature_errors">Errores en firmas:</string> 99 99 <string name="title_activity_activity_signature_errors">ActivitySignatureErrors</string> 100 101 100 <string name="string_valid_signature">Válida</string> 102 101 <string name="string_invalid_signature">Inválida</string> 103 104 105 102 <string name="title_activity_tibisay_movil">TibisayMovil</string> 103 106 104 </resources> -
TibisayMovil/src/ve/gob/cenditel/tibisaymovil/BDOCVerifyResultActivity.java
r8860b8f rc95e4a6 5 5 import java.io.FileInputStream; 6 6 import java.io.FileOutputStream; 7 import java.io.IOException; 7 8 import java.io.InputStream; 9 import java.io.OutputStream; 10 import java.net.HttpURLConnection; 11 import java.net.MalformedURLException; 12 import java.net.URL; 13 import java.net.URLConnection; 8 14 import java.util.ArrayList; 15 16 import javax.net.ssl.HttpsURLConnection; 9 17 10 18 … … 16 24 import ee.sk.utils.ConfigManager; 17 25 import android.net.Uri; 26 import android.os.AsyncTask; 18 27 import android.os.Bundle; 19 28 import android.os.Environment; 29 import android.os.Looper; 20 30 import android.app.Activity; 31 import android.app.Dialog; 32 import android.app.ProgressDialog; 21 33 import android.content.Context; 22 34 import android.content.Intent; … … 66 78 private ArrayList<SignatureErrorDetail> errorList; 67 79 80 // Progress Dialog 81 private ProgressDialog pDialog; 82 83 // Progress dialog type (0 - for Horizontal progress bar) 84 public static final int progress_bar_type = 0; 85 68 86 @Override 69 87 protected void onCreate(Bundle savedInstanceState) { … … 86 104 button_finish = (LinearLayout) this.findViewById(R.id.button_finish_zone); 87 105 88 Bundle bundle=getIntent().getExtras(); 89 fileToVerify = bundle.getString("fileToVerify"); 90 fileToVerifyExtension = bundle.getString("fileExtension"); 91 mimeTypeFileToVerify = getMimeType(fileToVerify); 92 93 // inicializa la lista de objetos de errores de firma 106 // inicializa la lista de objetos de errores de firma 94 107 errorList = new ArrayList<SignatureErrorDetail>(); 95 96 97 98 if (fileToVerifyExtension.equals("bdoc")){ 99 // ejecutar la verificacion 100 doBdocVerification(fileToVerify); 101 }else{ 102 Toast.makeText(getApplicationContext(), "¡Por Implementar!", Toast.LENGTH_SHORT).show(); 103 104 } 105 108 106 109 107 110 // habilita el click sobre la acción de finalizar la verificacion de firma y regresar … … 147 150 148 151 }); 152 153 // chequear si intent tiene data 154 final android.content.Intent intent = getIntent(); 155 156 final Bundle bundle = getIntent().getExtras(); 157 158 if (intent != null) { 159 Toast.makeText(getApplicationContext(), "intent != null", Toast.LENGTH_SHORT).show(); 160 161 final android.net.Uri data = intent.getData (); 162 163 if (data != null) { 164 Toast.makeText(getApplicationContext(), "data != null", Toast.LENGTH_SHORT).show(); 165 166 // verificar el tipo de scheme 167 String scheme = data.getScheme(); 168 169 // verificacion de un archivo que esta en el dispositivo 170 if (scheme.equals("file")) { 171 Toast.makeText(getApplicationContext(), "file: "+data.getPath(), Toast.LENGTH_SHORT).show(); 172 173 // verificar el archivo 174 if (data.getPath().endsWith("bdoc")){ 175 // ejecutar la verificacion 176 doBdocVerification(data.getPath()); 177 }else{ 178 Toast.makeText(getApplicationContext(), "¡Por Implementar!", Toast.LENGTH_SHORT).show(); 179 180 } 181 182 } 183 184 // verificacion de un archivo que se debe descargar 185 if (scheme.equals("https")) { 186 Toast.makeText(getApplicationContext(), "scheme: "+data.toString(), Toast.LENGTH_SHORT).show(); 187 188 Toast.makeText(getApplicationContext(), "externalStorage: "+Environment.getExternalStorageDirectory().toString(), Toast.LENGTH_SHORT).show(); 189 190 191 new DownloadFileFromURL().execute(data.toString()); 192 //new DownloadFileFromURL().execute("http://farm1.static.flickr.com/114/298125983_0e4bf66782_b.jpg"); 193 194 //Toast.makeText(getApplicationContext(), "****despues de execute()", Toast.LENGTH_SHORT).show(); 195 // verificar el archivo 196 } 197 198 199 return; 200 } 201 202 // verificacion de archivo desde la Activity principal 203 if (bundle != null) { 204 fileToVerify = bundle.getString("fileToVerify"); 205 fileToVerifyExtension = bundle.getString("fileExtension"); 206 mimeTypeFileToVerify = getMimeType(fileToVerify); 207 208 Toast.makeText(getApplicationContext(), "fileToVerify: "+fileToVerify, Toast.LENGTH_SHORT).show(); 209 210 if (fileToVerifyExtension.equals("bdoc")){ 211 // ejecutar la verificacion 212 doBdocVerification(fileToVerify); 213 }else{ 214 Toast.makeText(getApplicationContext(), "¡Por Implementar!", Toast.LENGTH_SHORT).show(); 215 216 } 217 218 //return; 219 } 220 221 }else{ 222 Toast.makeText(getApplicationContext(), "intent == null", Toast.LENGTH_SHORT).show(); 223 } 224 225 226 //Bundle bundle=getIntent().getExtras(); 227 //fileToVerify = bundle.getString("fileToVerify"); 228 //fileToVerifyExtension = bundle.getString("fileExtension"); 229 //mimeTypeFileToVerify = getMimeType(fileToVerify); 230 //Toast.makeText(getApplicationContext(), "fileToVerify: "+fileToVerify, Toast.LENGTH_SHORT).show(); 231 232 233 /* 234 if (fileToVerifyExtension.equals("bdoc")){ 235 // ejecutar la verificacion 236 doBdocVerification(fileToVerify); 237 }else{ 238 Toast.makeText(getApplicationContext(), "¡Por Implementar!", Toast.LENGTH_SHORT).show(); 239 240 } 241 */ 242 243 149 244 150 245 } … … 152 247 153 248 249 250 251 @Override 252 public void onStart () { 253 254 android.util.Log.d ("**onStart(): ", " onStart"); 255 super.onStart (); 256 257 258 final android.content.Intent intent = getIntent (); 259 260 if (intent != null) 261 { 262 android.util.Log.d ("**onStart(): ", "> Got intent : " + intent); 263 264 final android.net.Uri data = intent.getData (); 265 266 if (data != null) 267 { 268 android.util.Log.d ("**onStart(): ", "> Got data : " + data); 269 270 final String filePath = data.getEncodedPath (); 271 272 android.util.Log.d ("**onStart(): ", "> Open file : " + filePath); 273 274 // file loading comes here. 275 } // if 276 } // if 277 android.util.Log.d ("**onStart(): ", "- saliendo onStart"); 278 return; 279 280 } 154 281 155 282 … … 308 435 signerListView.setOnItemClickListener(new android.widget.AdapterView.OnItemClickListener() { 309 436 310 String ss = "hola mundo";437 311 438 @Override 312 439 public void onItemClick(AdapterView<?> parent, View view, … … 690 817 } 691 818 819 /** 820 * Showing Dialog for downloading file 821 * */ 822 @Override 823 protected Dialog onCreateDialog(int id) { 824 switch (id) { 825 case progress_bar_type: // we set this to 0 826 pDialog = new ProgressDialog(this); 827 pDialog.setMessage("Downloading file. Please wait..."); 828 pDialog.setIndeterminate(false); 829 pDialog.setMax(100); 830 pDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL); 831 pDialog.setCancelable(true); 832 pDialog.show(); 833 return pDialog; 834 default: 835 return null; 836 } 837 } 838 839 // clase para descargar archivo 840 private class DownloadFileFromURL extends AsyncTask<String, String, String> { 841 842 843 /** 844 * Before starting background thread 845 * Show Progress Bar Dialog 846 * */ 847 @Override 848 protected void onPreExecute() { 849 super.onPreExecute(); 850 showDialog(progress_bar_type); 851 } 852 853 854 /** 855 * Downloading file in background thread 856 * */ 857 @Override 858 protected String doInBackground(String... f_url) { 859 860 // para solventar error: 861 // Can't create handler inside thread that has not called Looper.prepare() 862 Looper.prepare(); 863 864 int count; 865 866 String outputString = null; 867 try { 868 Toast.makeText(getApplicationContext(), "doInBackground", Toast.LENGTH_SHORT).show(); 869 Log.d("doInBackground", "log"); 870 871 URL url = new URL(f_url[0]); 872 //URLConnection conection = url.openConnection(); 873 HttpURLConnection conection = (HttpURLConnection) url.openConnection(); 874 conection.connect(); 875 876 877 878 // this will be useful so that you can show a tipical 0-100% progress bar 879 int lenghtOfFile = conection.getContentLength(); 880 881 // download the file 882 //InputStream input = new BufferedInputStream(url.openStream(), 8192); 883 InputStream input = new BufferedInputStream(url.openStream()); 884 885 886 File rootDir = Environment.getExternalStorageDirectory(); 887 // Output stream 888 //OutputStream output = new FileOutputStream("/sdcard/downloaded.jpg"); 889 OutputStream output = new FileOutputStream(new File(rootDir+"/TibisayMovil/", "descarga.bdoc")); 890 891 byte data[] = new byte[1024]; 892 893 long total = 0; 894 895 while ((count = input.read(data)) != -1) { 896 total += count; 897 // publishing the progress.... 898 // After this onProgressUpdate will be called 899 publishProgress(""+(int)((total*100)/lenghtOfFile)); 900 901 // writing data to file 902 //output.write(data, 0, count); 903 } 904 905 // flushing output 906 output.flush(); 907 908 // closing streams 909 output.close(); 910 911 input.close(); 912 913 914 } catch (Exception e) { 915 916 Log.e("Error: ", e.getMessage()); 917 outputString = e.getMessage(); 918 919 920 } 921 922 //return null; 923 return outputString; 924 925 } 926 927 /** 928 * Updating progress bar 929 * */ 930 protected void onProgressUpdate(String... progress) { 931 // setting progress percentage 932 pDialog.setProgress(Integer.parseInt(progress[0])); 933 } 934 935 /** 936 * After completing background task 937 * Dismiss the progress dialog 938 * **/ 939 @Override 940 protected void onPostExecute(String file_url) { 941 // dismiss the dialog after the file was downloaded 942 dismissDialog(progress_bar_type); 943 944 // Displaying downloaded image into image view 945 // Reading image path from sdcard 946 //String filePath = Environment.getExternalStorageDirectory().toString() + "/TibisayMovil" +"/downloaded.bdoc"; 947 Toast.makeText(getApplicationContext(), "onPostExecute " , Toast.LENGTH_SHORT).show(); 948 Toast.makeText(getApplicationContext(), file_url , Toast.LENGTH_LONG).show(); 949 // setting downloaded into image view 950 //my_image.setImageDrawable(Drawable.createFromPath(imagePath)); 951 } 952 953 954 955 } 956 957 958 959 692 960 693 961 } -
TibisayMovil/src/ve/gob/cenditel/tibisaymovil/CertificateRepositoryActivity.java
r09c6eb7 rc95e4a6 9 9 import android.content.Intent; 10 10 import android.os.Bundle; 11 import android.util.Log; 11 12 import android.view.View; 12 13 import android.view.View.OnClickListener; … … 50 51 } 51 52 }; 53 54 @Override 55 protected void onActivityResult(int requestCode, int resultCode, 56 Intent data) { 57 if (resultCode == RESULT_OK) { 58 59 //startActivity(new Intent(Intent.ACTION_VIEW, data)); 60 Log.d("CertificateRepositoryActivity: ", "onActivityResult -> RESULT_OK"); 61 62 } 63 } 52 64 53 65 -
TibisayMovil/src/ve/gob/cenditel/tibisaymovil/PKCS12FilePickerActivity.java
r09c6eb7 rc95e4a6 160 160 161 161 if (file.isDirectory()) { 162 image.setImageResource(R.drawable.ico_carpeta); 163 } else { 164 image.setImageResource(R.drawable.ico_archivo); 162 //image.setImageResource(R.drawable.ico_carpeta); 163 image.setImageResource(R.drawable.ic_carpeta); 164 } else { 165 //image.setImageResource(R.drawable.ico_archivo); 166 image.setImageResource(R.drawable.ic_archivo); 165 167 } 166 168
Note: See TracChangeset
for help on using the changeset viewer.