Changeset 647bb1f in dispositivos_moviles
- Timestamp:
- Oct 24, 2013, 10:29:58 AM (11 years ago)
- Branches:
- master
- Children:
- e68708b
- Parents:
- 8fcfbf1
- Location:
- TibisayMovil
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
TibisayMovil/AndroidManifest.xml
rc874484 r647bb1f 189 189 android:name="ve.gob.cenditel.tibisaymovil.PKCS12ToDecryptActivity" 190 190 android:label="@string/title_activity_pkcs12_to_decrypt" > 191 192 <intent-filter> 193 <action android:name="android.intent.action.VIEW" /> 194 195 <category android:name="android.intent.category.DEFAULT" /> 196 197 <data android:scheme="file" /> 198 <data android:mimeType="*/*" /> 199 <data android:host="*" /> 200 <data android:pathPattern=".*\\.cdoc" /> 201 </intent-filter> 202 <intent-filter> 203 <action android:name="android.intent.action.VIEW" /> 204 205 <category android:name="android.intent.category.DEFAULT" /> 206 207 <data android:scheme="file" /> 208 <data android:mimeType="*/*" /> 209 <data android:host="*" /> 210 <data android:pathPattern=".*\\..*\\.cdoc" /> 211 </intent-filter> 212 191 213 </activity> 192 214 <activity -
TibisayMovil/res/values/strings.xml
rc874484 r647bb1f 171 171 <string name="title_activity_file_to_decrypt">FileToDecryptActivity</string> 172 172 <string name="decrypt_description">Seleccione el archivo a descifrar</string> 173 <string name="title_activity_pkcs12_to_decrypt"> PKCS12ToDecryptActivity</string>173 <string name="title_activity_pkcs12_to_decrypt">Tibisay Móvil</string> 174 174 <string name="pkcs12_to_decrypt_description">Seleccione el archivo .p12 que protege su clave</string> 175 175 <string name="decrypted_dir_files">DecryptedFiles</string> … … 183 183 184 184 185 185 186 </resources> -
TibisayMovil/src/ve/gob/cenditel/tibisaymovil/PKCS12ToDecryptActivity.java
rfd4a5b9 r647bb1f 116 116 117 117 118 //Capturando archivo original que se debe descifrar 119 fileToDecrypt = getIntent().getExtras().getString("fileToDecrypt"); 120 121 118 // chequear si intent tiene data 119 final android.content.Intent intent = getIntent(); 120 final android.net.Uri data = intent.getData(); 121 122 123 if (data != null) { 124 // verificar el tipo de scheme 125 String scheme = data.getScheme(); 126 127 // descifrar un archivo que esta en el dispositivo 128 if (scheme.equals("file")) { 129 Log.d("PKCS12ToDecryptActivity: ", "scheme == file"); 130 Toast.makeText(getApplicationContext(), "Descifrar archivo: "+data.getPath(), Toast.LENGTH_SHORT).show(); 131 132 // obtener archivo a descifrar 133 if (data.getPath().endsWith("cdoc")){ 134 fileToDecrypt = data.getPath(); 135 136 137 }else{ 138 Toast.makeText(getApplicationContext(), "¡Intentando descifrar un archivo distinto de .cdoc!", Toast.LENGTH_SHORT).show(); 139 Log.d("PKCS12ToDecryptActivity: ", "¡Intentando descifrar un archivo distinto de .cdoc!"); 140 finish(); 141 } 142 } 143 }else{ 144 145 final Bundle bundle = getIntent().getExtras(); 146 // verificacion de archivo desde la Activity principal 147 if (bundle != null) { 148 Log.d("PKCS12ToDecryptActivity: ", "bundle != null"); 149 // Capturando archivo original que se debe descifrar 150 fileToDecrypt = getIntent().getExtras().getString("fileToDecrypt"); 151 } 152 153 } 154 //Capturando archivo original que se debe descifrar 155 //fileToDecrypt = getIntent().getExtras().getString("fileToDecrypt"); 156 122 157 } 123 158 … … 691 726 Toast.makeText(getApplicationContext(), ex.getMessage(), Toast.LENGTH_SHORT).show(); 692 727 693 showDialog("Error:", ex.getMessage() );728 showDialog("Error:", ex.getMessage(), false); 694 729 return; 695 730 } … … 730 765 // el pasword del PKCS12 no es correcto 731 766 showDialog(getResources().getString(R.string.msg_encryption_error), 732 "password incorrecto" );767 "password incorrecto", false); 733 768 return; 734 769 } 735 showDialog(getResources().getString(R.string.msg_encryption_error), ex.getMessage() );770 showDialog(getResources().getString(R.string.msg_encryption_error), ex.getMessage(), false); 736 771 return; 737 772 738 773 } catch(ArrayIndexOutOfBoundsException ex) { 739 774 showDialog(getResources().getString(R.string.msg_encryption_error), 740 getResources().getString(R.string.error_decrypting_file_index_out_of_bounds) );775 getResources().getString(R.string.error_decrypting_file_index_out_of_bounds), false); 741 776 return; 742 777 } … … 798 833 System.err.println("DataFile has no data!"); 799 834 showDialog(getResources().getString(R.string.msg_encryption_error), 800 "DataFile has no data!" );835 "DataFile has no data!", false); 801 836 return; 802 837 } … … 817 852 Toast.makeText(getApplicationContext(), "Descifrado correctamente: " + decryptedFile, Toast.LENGTH_SHORT).show(); 818 853 819 showDialog("Información:", "Archivo descifrado exitosamente." );854 showDialog("Información:", "Archivo descifrado exitosamente.", true); 820 855 821 856 // TODO lanzar la actividad para mostrar el resultado del cifrado … … 827 862 828 863 showDialog(getResources().getString(R.string.msg_encryption_error), 829 e.getMessage() );864 e.getMessage(), false); 830 865 return; 831 866 } … … 833 868 catch (FileNotFoundException e) { 834 869 showDialog(getResources().getString(R.string.msg_encryption_error), 835 e.getMessage() );870 e.getMessage(), false); 836 871 return; 837 872 } catch (IOException e) { 838 873 showDialog(getResources().getString(R.string.msg_encryption_error), 839 e.getMessage() );874 e.getMessage(), false); 840 875 return; 841 876 } … … 852 887 * @return void 853 888 */ 854 public void showDialog(String title, String msg ) {889 public void showDialog(String title, String msg, final boolean success) { 855 890 856 891 // 1. Instantiate an AlertDialog.Builder with its constructor … … 868 903 869 904 // TODO lanzar la actividad para mostrar el resultado del cifrado 870 showDecryptionResults(fileToDecrypt, decryptedFile); 905 if (success){ 906 showDecryptionResults(fileToDecrypt, decryptedFile); 907 } 871 908 } 872 909 });
Note: See TracChangeset
for help on using the changeset viewer.