Ignore:
Timestamp:
Nov 5, 2013, 8:21:34 AM (10 years ago)
Author:
Jose Ruiz <joseruiz@…>
Branches:
master
Children:
6141013
Parents:
6f9915f
Message:

Agregando preferencias de imagen de firma y firma manuscrita con imagen predeterminada

File:
1 edited

Legend:

Unmodified
Added
Removed
  • TibisayMovil/src/ve/gob/cenditel/tibisaymovil/SignResultHandwrittenSignatureActivity.java

    rca6582b r67541a6  
    1212import android.view.View.OnClickListener;
    1313import android.view.Window;
     14import android.webkit.MimeTypeMap;
    1415import android.widget.LinearLayout;
    1516import android.widget.TextView;
     
    7677            }
    7778        });
     79       
     80       
     81        LinearLayout layoutDecryptedFileAndArror = (LinearLayout) this.findViewById(R.id.layout_decrypted_file_and_arrow);
     82       
     83        OnClickListener decryptedFileListener = new OnClickListener() {
     84            public void onClick(View v) {
     85              // do something when the button is clicked
     86                //Toast.makeText(getApplicationContext(), "**CLICK SOBRE EL TEXTVIEW***", Toast.LENGTH_LONG).show();
     87               
     88                openIt(pathFileSigned+fileSigned, getMimeType(pathFileSigned+fileSigned));
     89            }
     90        };
     91        layoutDecryptedFileAndArror.setOnClickListener(decryptedFileListener);
     92        }
     93
     94
     95        // funcion para lanzar un intent que abra un archivo
     96    private void openIt(String decryptedFile, String mimeType) {
     97               
     98                Intent shareIntent = new Intent();
     99                shareIntent.setAction(Intent.ACTION_VIEW);
     100                File file = new File(decryptedFile);
     101                Uri uri = Uri.fromFile(file);
     102                Log.i("DEBUG", file.getPath());
     103                shareIntent.setDataAndType(uri, mimeType);             
     104                startActivity(Intent.createChooser(shareIntent, getResources().getText(R.string.open_it_using)));
    78105        }
    79106       
     
    90117                startActivity(Intent.createChooser(shareIntent, "Compartir pdf usando"));
    91118        }
     119       
     120    // funcion para obtener el tipo mime de un archivo
     121    public static String getMimeType(String url)
     122    {
     123        String extension = url.substring(url.lastIndexOf("."));
     124        String mimeTypeMap = MimeTypeMap.getFileExtensionFromUrl(extension);
     125        String mimeType = MimeTypeMap.getSingleton().getMimeTypeFromExtension(mimeTypeMap);
     126        return mimeType;
     127    }
    92128}
Note: See TracChangeset for help on using the changeset viewer.