Changeset 2387362 in dispositivos_moviles for TibisayMovil/src
- Timestamp:
- Oct 31, 2013, 2:30:02 PM (11 years ago)
- Branches:
- master
- Children:
- bb739b0
- Parents:
- 0d4fa20 (diff), 31cf7cf (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent. - Location:
- TibisayMovil/src/ve/gob/cenditel/tibisaymovil
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
TibisayMovil/src/ve/gob/cenditel/tibisaymovil/FilesToPDFSignActivity.java
r931bb65 r2ff9cec 269 269 //Si es un directorio el seleccionado se hace un llamado del fileBrowser del directorio 270 270 if (item.isDirectory()) { 271 parent.setAdapter(FilesToPDFSignActivity.this.listAdapter = new FileListAdapter(item.getAbsolutePath() ));271 parent.setAdapter(FilesToPDFSignActivity.this.listAdapter = new FileListAdapter(item.getAbsolutePath(), filterMImeType)); 272 272 } else { // Si es un archivo 273 273 -
TibisayMovil/src/ve/gob/cenditel/tibisaymovil/PreferencesActivity.java
r288126d r2ff9cec 1 1 package ve.gob.cenditel.tibisaymovil; 2 import java.io.File; 3 4 import android.content.Intent; 5 import android.content.SharedPreferences; 6 import android.database.Cursor; 7 import android.graphics.Bitmap; 8 import android.graphics.BitmapFactory; 9 import android.net.Uri; 2 10 import android.os.Bundle; 11 import android.preference.ListPreference; 12 import android.preference.Preference; 13 import android.preference.Preference.OnPreferenceChangeListener; 14 import android.preference.Preference.OnPreferenceClickListener; 3 15 import android.preference.PreferenceActivity; 16 import android.provider.MediaStore; 17 import android.view.Window; 18 import android.widget.Toast; 4 19 5 public class PreferencesActivity extends PreferenceActivity { 20 public class PreferencesActivity extends PreferenceActivity implements OnPreferenceClickListener,OnPreferenceChangeListener{ 21 22 static final int PICK_IMAGE = 33; 23 public static final String imageKey = "image"; 24 public static final String positionKey = "position"; 25 private static final int MAXWIDTH = 400; 26 private static final int MAXHEIGHT = 400; 27 private static final long SIZELIMIT = 1024 * 1024; 28 29 private SharedPreferences options; 30 private Preference imagePreference; 31 6 32 @Override 7 33 public void onCreate(Bundle savedInstanceState) { 34 //Estilando la barra de titulo 35 final boolean customTitleSupported = requestWindowFeature(Window.FEATURE_CUSTOM_TITLE); 36 8 37 super.onCreate(savedInstanceState); 9 38 10 39 addPreferencesFromResource(R.xml.preferences); 40 41 this.options = this.getPreferenceManager().getSharedPreferences(); 42 43 44 45 46 this.imagePreference = (Preference) findPreference(PreferencesActivity.imageKey); 47 this.imagePreference.setOnPreferenceClickListener(this); 48 this.imagePreference.setOnPreferenceChangeListener(this); 49 50 this.loadSummary(); 51 52 53 //Estilando Barra de titulo 54 if(customTitleSupported) 55 getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.title_bar); 56 11 57 } 58 59 private void loadSummary() { 60 String path = options.getString(PreferencesActivity.imageKey, ""); 61 if (!path.equals("")){ 62 this.imagePreference.setSummary(path); 63 } 64 65 } 66 67 68 69 @Override 70 public boolean onPreferenceChange(Preference preference, Object newValue) { 71 String summary=""; 72 73 74 if (summary!=null && !summary.equals("")){ 75 preference.setSummary((CharSequence) summary); 76 77 } 78 return true; 79 } 80 81 82 83 @Override 84 public boolean onPreferenceClick(Preference preference) { 85 86 if (preference.getKey().equals(PreferencesActivity.imageKey)){ 87 Intent i = new Intent( 88 Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI); 89 startActivityForResult(i, PreferencesActivity.PICK_IMAGE); 90 return true; 91 } 92 return false; 93 } 94 95 protected void onActivityResult(int requestCode, int resultCode, Intent data) { 96 super.onActivityResult(requestCode, resultCode, data); 97 98 99 if (requestCode == PreferencesActivity.PICK_IMAGE && resultCode == RESULT_OK){ 100 101 Uri selectedImage = data.getData(); 102 String[] filePathColumn = { MediaStore.Images.Media.DATA }; 103 104 Cursor cursor = getContentResolver().query(selectedImage,filePathColumn, null, null, null); 105 cursor.moveToFirst(); 106 107 int columnIndex = cursor.getColumnIndex(filePathColumn[0]); 108 String imageSelectedPath = cursor.getString(columnIndex); 109 cursor.close(); 110 111 //Filter images if wrong format. 112 boolean validImage = this.validateImage(imageSelectedPath); 113 114 if (validImage==true){ 115 //Save and edit summary text in user interface. 116 SharedPreferences.Editor editor = this.options.edit(); 117 editor.putString(PreferencesActivity.imageKey, imageSelectedPath); 118 editor.commit(); 119 this.imagePreference.setSummary(imageSelectedPath); 120 } 121 122 123 124 } 125 126 127 128 129 } 130 131 //Check image dimensions and format. 132 private boolean validateImage(String imageSelectedPath) { 133 File f = new File(imageSelectedPath); 134 long size = f.length(); 135 136 if (size <= (PreferencesActivity.SIZELIMIT)) { 137 138 Bitmap chosenImage = BitmapFactory.decodeFile(imageSelectedPath); 139 140 if (chosenImage !=null) 141 return this.checkDimensions(chosenImage); 142 else{ 143 Toast.makeText(this, this.getString(R.string.errorformat),Toast.LENGTH_SHORT).show(); 144 return false; 145 } 146 147 } else { 148 Toast.makeText(this, this.getString(R.string.errorsize)+" "+(PreferencesActivity.SIZELIMIT)/(1024*1024)+"MB",Toast.LENGTH_SHORT).show(); 149 return false; 150 } 151 152 153 154 } 155 156 157 private boolean checkDimensions(Bitmap chosenImage) { 158 159 int width = chosenImage.getWidth(); 160 int height = chosenImage.getHeight(); 161 162 if (width <= PreferencesActivity.MAXWIDTH && height <= PreferencesActivity.MAXHEIGHT) { 163 return true; 164 165 } else { 166 167 Toast.makeText( this,this.getString(R.string.errordimension) +" "+ PreferencesActivity.MAXWIDTH 168 + "x" + PreferencesActivity.MAXHEIGHT,Toast.LENGTH_SHORT).show(); 169 return false; 170 } 171 } 172 173 174 175 12 176 } -
TibisayMovil/src/ve/gob/cenditel/tibisaymovil/SignActivity.java
r288126d r2ff9cec 34 34 35 35 36 import com.lowagie.text.exceptions.InvalidPdfException; 36 37 // prueba de droidtext 37 38 import com.lowagie.text.pdf.*; … … 287 288 } 288 289 }); 289 290 } catch (Exception e) { 291 final Activity act = ((Activity) this.context); 292 Toast.makeText(act, "exception", Toast.LENGTH_SHORT).show(); 293 FsUtils.checkOutOfSpace(e, true); 294 this.cancel(true); 295 //throw new RuntimeException(e); 296 } 290 } catch (InvalidPdfException e) { 291 //empty 292 } catch (Exception e) { 293 final Activity act = ((Activity) this.context); 294 Toast.makeText(act, "exception", Toast.LENGTH_SHORT).show(); 295 FsUtils.checkOutOfSpace(e, true); 296 this.cancel(true); 297 //throw new RuntimeException(e); 298 } 297 299 298 300 -
TibisayMovil/src/ve/gob/cenditel/tibisaymovil/SignResultHandwrittenSignatureActivity.java
rc874484 rca6582b 44 44 getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.title_bar); 45 45 46 TextView archivo_para_firm = (TextView) this.findViewById(R.id.archivo_original_a_ descifrar);46 TextView archivo_para_firm = (TextView) this.findViewById(R.id.archivo_original_a_firmar); 47 47 TextView imagen_utlizada= (TextView) this.findViewById(R.id.archivo_descifrado); 48 48 TextView archivo_firmado = (TextView) this.findViewById(R.id.destinatario);
Note: See TracChangeset
for help on using the changeset viewer.