[a8ff2b6] | 1 | package ve.gob.cenditel.tibisaymovil; |
---|
| 2 | |
---|
| 3 | |
---|
| 4 | |
---|
| 5 | |
---|
| 6 | |
---|
| 7 | import java.io.BufferedInputStream; |
---|
| 8 | import java.io.File; |
---|
| 9 | import java.io.FileInputStream; |
---|
| 10 | import java.io.FileNotFoundException; |
---|
| 11 | import java.io.IOException; |
---|
| 12 | import java.io.InputStream; |
---|
| 13 | |
---|
| 14 | import android.os.Bundle; |
---|
| 15 | import android.app.Activity; |
---|
| 16 | import android.content.Context; |
---|
| 17 | import android.content.Intent; |
---|
| 18 | import android.security.KeyChain; |
---|
| 19 | import android.util.Log; |
---|
| 20 | import android.view.Menu; |
---|
| 21 | import android.view.View; |
---|
| 22 | import android.view.View.OnClickListener; |
---|
| 23 | import android.widget.AdapterView; |
---|
| 24 | import android.widget.AdapterView.OnItemClickListener; |
---|
| 25 | import android.widget.ListView; |
---|
| 26 | import android.widget.RelativeLayout; |
---|
| 27 | import android.widget.TextView; |
---|
| 28 | import android.widget.Toast; |
---|
| 29 | |
---|
| 30 | //public class TibisayMovilActivity extends KeyChainClientActivity { |
---|
| 31 | //implements OnItemClickListener, OnClickListener { |
---|
| 32 | public class TibisayMovilActivity extends Activity { |
---|
| 33 | |
---|
| 34 | |
---|
| 35 | private String privateKeyAlias; |
---|
| 36 | |
---|
| 37 | @Override |
---|
| 38 | protected void onCreate(Bundle savedInstanceState) { |
---|
| 39 | super.onCreate(savedInstanceState); |
---|
| 40 | setContentView(R.layout.activity_main); |
---|
| 41 | |
---|
| 42 | |
---|
| 43 | // listview de funciones |
---|
| 44 | final ListView listViewFunctions = (ListView) findViewById(R.id.listViewFunctions); |
---|
| 45 | |
---|
| 46 | String[] values = new String[] {"Firmar", "Verificar", "Cifrar", "Descifrar", "Compartir Archivos", "Certificados" }; |
---|
| 47 | |
---|
| 48 | |
---|
| 49 | // KeyChain |
---|
| 50 | //KeyChainStrategy.getInstance().setClientActivity(this); |
---|
| 51 | |
---|
| 52 | |
---|
| 53 | FunctionListAdapter ad = new FunctionListAdapter(this, values); |
---|
| 54 | listViewFunctions.setAdapter(ad); |
---|
| 55 | |
---|
| 56 | listViewFunctions.setOnItemClickListener(new OnItemClickListener(){ |
---|
| 57 | |
---|
| 58 | @Override |
---|
| 59 | public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, |
---|
| 60 | long arg3) { |
---|
| 61 | // TODO Auto-generated method stub |
---|
| 62 | Context context = getApplicationContext(); |
---|
| 63 | //CharSequence text = "Click!"; |
---|
| 64 | int duration = Toast.LENGTH_SHORT; |
---|
| 65 | //Toast.makeText(context, text, duration).show(); |
---|
| 66 | |
---|
| 67 | View curr = arg0.getChildAt((int) arg3); |
---|
| 68 | TextView c = (TextView)curr.findViewById(R.id.textView1); |
---|
| 69 | String function = c.getText().toString(); |
---|
| 70 | //Toast.makeText(context, function, duration).show(); |
---|
| 71 | |
---|
| 72 | if (function.equals("Certificados")){ |
---|
| 73 | Toast.makeText(context, "Gestionar repositorio", duration).show(); |
---|
| 74 | |
---|
| 75 | |
---|
| 76 | manageKeyChain(); |
---|
| 77 | |
---|
| 78 | // lanzar activity de gestion de repositorio |
---|
| 79 | //testRepository(); |
---|
| 80 | |
---|
| 81 | } |
---|
| 82 | |
---|
| 83 | |
---|
| 84 | |
---|
| 85 | } |
---|
| 86 | }); |
---|
| 87 | |
---|
| 88 | |
---|
| 89 | |
---|
| 90 | |
---|
| 91 | |
---|
| 92 | |
---|
| 93 | |
---|
| 94 | } |
---|
| 95 | |
---|
| 96 | @Override |
---|
| 97 | public boolean onCreateOptionsMenu(Menu menu) { |
---|
| 98 | // Inflate the menu; this adds items to the action bar if it is present. |
---|
| 99 | getMenuInflater().inflate(R.menu.main, menu); |
---|
| 100 | return true; |
---|
| 101 | } |
---|
| 102 | |
---|
| 103 | /* |
---|
| 104 | @Override |
---|
| 105 | public void setAlias(String alias) { |
---|
| 106 | |
---|
| 107 | if (alias == null) { |
---|
| 108 | finish(); |
---|
| 109 | return; |
---|
| 110 | } |
---|
| 111 | |
---|
| 112 | this.privateKeyAlias = alias; |
---|
| 113 | |
---|
| 114 | //Intent intent = new Intent(this, CertValidatorActivity.class); |
---|
| 115 | //intent.putExtra(IntentExtraField.ALIAS, alias); |
---|
| 116 | //intent.putParcelableArrayListExtra(IntentExtraField.FILES, TypeUtils.convertToUriArrayList(this.selected)); |
---|
| 117 | //startActivityForResult(intent, ActivityResult.CHECK_CERTIFICATE_VALIDITY); |
---|
| 118 | |
---|
| 119 | } |
---|
| 120 | */ |
---|
| 121 | |
---|
| 122 | private void manageKeyChain(){ |
---|
| 123 | // |
---|
| 124 | //Intent intent = new Intent(this, PKCS12FilePickerActivity.class); |
---|
| 125 | //startActivityForResult(intent, ActivityResult.IMPORT_CERTIFICATE); |
---|
| 126 | |
---|
| 127 | |
---|
| 128 | //KeyChainStrategy.getInstance().choosePrivateKeyAlias(); |
---|
| 129 | } |
---|
| 130 | |
---|
| 131 | private void testRepository(){ |
---|
| 132 | |
---|
| 133 | } |
---|
| 134 | |
---|
| 135 | |
---|
| 136 | |
---|
| 137 | |
---|
| 138 | |
---|
| 139 | } |
---|