1 | package ve.gob.cenditel.tibisaymovil; |
---|
2 | |
---|
3 | |
---|
4 | import java.io.File; |
---|
5 | |
---|
6 | import android.app.Activity; |
---|
7 | import android.content.Intent; |
---|
8 | import android.net.Uri; |
---|
9 | import android.os.Bundle; |
---|
10 | import android.util.Log; |
---|
11 | import android.view.View; |
---|
12 | import android.view.View.OnClickListener; |
---|
13 | import android.view.Window; |
---|
14 | import android.widget.LinearLayout; |
---|
15 | import android.widget.TextView; |
---|
16 | import android.widget.Toast; |
---|
17 | |
---|
18 | public class SignResultHandwrittenSignatureActivity extends Activity{ |
---|
19 | private String fileToSign; |
---|
20 | private String imageCaptured; |
---|
21 | private String fileSigned; |
---|
22 | private String pathFileSigned; |
---|
23 | private LinearLayout button_share; |
---|
24 | private LinearLayout button_finish; |
---|
25 | |
---|
26 | @Override |
---|
27 | protected void onCreate(Bundle savedInstanceState) { |
---|
28 | |
---|
29 | //Capturando archivo que será firmado |
---|
30 | fileToSign = getIntent().getExtras().getString("FILE_TO_SIGN"); |
---|
31 | //Capturando imagen de firma |
---|
32 | imageCaptured = getIntent().getExtras().getString("IMAGE_CAPTURED"); |
---|
33 | //Capturando archivo firmado |
---|
34 | fileSigned = getIntent().getExtras().getString("FILE_SIGNED"); |
---|
35 | pathFileSigned = getIntent().getExtras().getString("PATH_FILE_SIGNED"); |
---|
36 | |
---|
37 | //Estilando la barra de titulo |
---|
38 | final boolean customTitleSupported = requestWindowFeature(Window.FEATURE_CUSTOM_TITLE); |
---|
39 | |
---|
40 | super.onCreate(savedInstanceState); |
---|
41 | setContentView(R.layout.activity_sign_result_handwritten_signature); |
---|
42 | //Estilando Barra de titulo |
---|
43 | if(customTitleSupported) |
---|
44 | getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.title_bar); |
---|
45 | |
---|
46 | TextView archivo_para_firm = (TextView) this.findViewById(R.id.archivo_original_a_firmar); |
---|
47 | TextView imagen_utlizada= (TextView) this.findViewById(R.id.archivo_descifrado); |
---|
48 | TextView archivo_firmado = (TextView) this.findViewById(R.id.destinatario); |
---|
49 | |
---|
50 | archivo_para_firm.setText(fileToSign); |
---|
51 | imagen_utlizada.setText(imageCaptured); |
---|
52 | archivo_firmado.setText(pathFileSigned+fileSigned); |
---|
53 | |
---|
54 | button_share = (LinearLayout) this.findViewById(R.id.button_remove_certificate_zone); |
---|
55 | button_finish = (LinearLayout) this.findViewById(R.id.button_add_certificate_zone); |
---|
56 | |
---|
57 | |
---|
58 | |
---|
59 | button_finish.setOnClickListener(new OnClickListener() |
---|
60 | { |
---|
61 | public void onClick(View v) |
---|
62 | { |
---|
63 | Intent oIntent = new Intent(SignResultHandwrittenSignatureActivity.this, TibisayMovilActivity.class); |
---|
64 | oIntent.setAction(Intent.ACTION_VIEW); |
---|
65 | oIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); |
---|
66 | startActivity(oIntent); |
---|
67 | finish(); |
---|
68 | } |
---|
69 | }); |
---|
70 | |
---|
71 | button_share.setOnClickListener(new OnClickListener() |
---|
72 | { |
---|
73 | public void onClick(View v) |
---|
74 | { |
---|
75 | shareIt(); |
---|
76 | } |
---|
77 | }); |
---|
78 | } |
---|
79 | |
---|
80 | private void shareIt() { |
---|
81 | |
---|
82 | Intent shareIntent = new Intent(); |
---|
83 | shareIntent.setAction(Intent.ACTION_SEND); |
---|
84 | Toast.makeText(SignResultHandwrittenSignatureActivity.this,pathFileSigned + fileSigned,Toast.LENGTH_LONG).show(); |
---|
85 | File file = new File(pathFileSigned + fileSigned); |
---|
86 | Uri pdf_uri = Uri.fromFile(file); |
---|
87 | Log.i("DEBUG", file.getPath()); |
---|
88 | shareIntent.putExtra(Intent.EXTRA_STREAM, pdf_uri); |
---|
89 | shareIntent.setType("application/pdf "); |
---|
90 | startActivity(Intent.createChooser(shareIntent, "Compartir pdf usando")); |
---|
91 | } |
---|
92 | } |
---|