package ve.gob.cenditel.tibisaymovil; import java.io.File; import android.app.Activity; import android.content.Intent; import android.net.Uri; import android.os.Bundle; import android.util.Log; import android.view.View; import android.view.View.OnClickListener; import android.view.Window; import android.widget.LinearLayout; import android.widget.TextView; import android.widget.Toast; public class SignResultHandwrittenSignatureActivity extends Activity{ private String fileToSign; private String imageCaptured; private String fileSigned; private String pathFileSigned; private LinearLayout button_share; private LinearLayout button_finish; @Override protected void onCreate(Bundle savedInstanceState) { //Capturando archivo que serĂ¡ firmado fileToSign = getIntent().getExtras().getString("FILE_TO_SIGN"); //Capturando imagen de firma imageCaptured = getIntent().getExtras().getString("IMAGE_CAPTURED"); //Capturando archivo firmado fileSigned = getIntent().getExtras().getString("FILE_SIGNED"); pathFileSigned = getIntent().getExtras().getString("PATH_FILE_SIGNED"); //Estilando la barra de titulo final boolean customTitleSupported = requestWindowFeature(Window.FEATURE_CUSTOM_TITLE); super.onCreate(savedInstanceState); setContentView(R.layout.activity_sign_result_handwritten_signature); //Estilando Barra de titulo if(customTitleSupported) getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.title_bar); TextView archivo_para_firm = (TextView) this.findViewById(R.id.archivo_original_a_firmar); TextView imagen_utlizada= (TextView) this.findViewById(R.id.archivo_descifrado); TextView archivo_firmado = (TextView) this.findViewById(R.id.destinatario); archivo_para_firm.setText(fileToSign); imagen_utlizada.setText(imageCaptured); archivo_firmado.setText(pathFileSigned+fileSigned); button_share = (LinearLayout) this.findViewById(R.id.button_remove_certificate_zone); button_finish = (LinearLayout) this.findViewById(R.id.button_add_certificate_zone); button_finish.setOnClickListener(new OnClickListener() { public void onClick(View v) { Intent oIntent = new Intent(SignResultHandwrittenSignatureActivity.this, TibisayMovilActivity.class); oIntent.setAction(Intent.ACTION_VIEW); oIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(oIntent); finish(); } }); button_share.setOnClickListener(new OnClickListener() { public void onClick(View v) { shareIt(); } }); } private void shareIt() { Intent shareIntent = new Intent(); shareIntent.setAction(Intent.ACTION_SEND); Toast.makeText(SignResultHandwrittenSignatureActivity.this,pathFileSigned + fileSigned,Toast.LENGTH_LONG).show(); File file = new File(pathFileSigned + fileSigned); Uri pdf_uri = Uri.fromFile(file); Log.i("DEBUG", file.getPath()); shareIntent.putExtra(Intent.EXTRA_STREAM, pdf_uri); shareIntent.setType("application/pdf "); startActivity(Intent.createChooser(shareIntent, "Compartir pdf usando")); } }