1 | package ve.gob.cenditel.tibisaymovil; |
---|
2 | |
---|
3 | |
---|
4 | |
---|
5 | |
---|
6 | |
---|
7 | import android.app.Activity; |
---|
8 | import android.content.Context; |
---|
9 | import android.content.Intent; |
---|
10 | import android.os.Bundle; |
---|
11 | import android.util.Log; |
---|
12 | import android.view.View; |
---|
13 | import android.view.View.OnClickListener; |
---|
14 | import android.widget.AdapterView; |
---|
15 | import android.widget.Button; |
---|
16 | import android.widget.Toast; |
---|
17 | import android.widget.AdapterView.OnItemClickListener; |
---|
18 | |
---|
19 | public class CertificateRepositoryActivity extends Activity implements OnClickListener, OnItemClickListener { |
---|
20 | |
---|
21 | |
---|
22 | |
---|
23 | @Override |
---|
24 | public void onCreate(Bundle savedInstanceState) { |
---|
25 | |
---|
26 | super.onCreate(savedInstanceState); |
---|
27 | this.setContentView(R.layout.certificate_chooser); |
---|
28 | |
---|
29 | |
---|
30 | findViewById(R.id.cert_chooser_install_button).setOnClickListener(mGlobal_OnClickListener); |
---|
31 | |
---|
32 | |
---|
33 | |
---|
34 | } |
---|
35 | |
---|
36 | //On click listener for button1 |
---|
37 | final OnClickListener mGlobal_OnClickListener = new OnClickListener() { |
---|
38 | public void onClick(final View v) { |
---|
39 | |
---|
40 | switch(v.getId()) { |
---|
41 | case R.id.cert_chooser_install_button: |
---|
42 | Toast.makeText(CertificateRepositoryActivity.this, "install", Toast.LENGTH_SHORT).show(); |
---|
43 | Intent intent = new Intent(CertificateRepositoryActivity.this.getBaseContext(), PKCS12FilePickerActivity.class); |
---|
44 | startActivity(intent); |
---|
45 | break; |
---|
46 | |
---|
47 | } |
---|
48 | |
---|
49 | |
---|
50 | |
---|
51 | } |
---|
52 | }; |
---|
53 | |
---|
54 | @Override |
---|
55 | protected void onActivityResult(int requestCode, int resultCode, |
---|
56 | Intent data) { |
---|
57 | if (resultCode == RESULT_OK) { |
---|
58 | |
---|
59 | //startActivity(new Intent(Intent.ACTION_VIEW, data)); |
---|
60 | Log.d("CertificateRepositoryActivity: ", "onActivityResult -> RESULT_OK"); |
---|
61 | |
---|
62 | } |
---|
63 | } |
---|
64 | |
---|
65 | |
---|
66 | |
---|
67 | @Override |
---|
68 | public void onClick(View view) { |
---|
69 | |
---|
70 | Context context = getApplicationContext(); |
---|
71 | //CharSequence text = "Click!"; |
---|
72 | int duration = Toast.LENGTH_SHORT; |
---|
73 | |
---|
74 | Toast.makeText(context, "**onClick()**", duration).show(); |
---|
75 | |
---|
76 | |
---|
77 | switch (view.getId()) { |
---|
78 | |
---|
79 | case R.id.cert_chooser_install_button: |
---|
80 | Intent intent = new Intent(context, PKCS12FilePickerActivity.class); |
---|
81 | Toast.makeText(context, "cert_chooser_install_button", duration).show(); |
---|
82 | |
---|
83 | break; |
---|
84 | |
---|
85 | case R.id.button_delete: |
---|
86 | Toast.makeText(context, "button_delete", duration).show(); |
---|
87 | break; |
---|
88 | |
---|
89 | case R.id.button_open: |
---|
90 | Toast.makeText(context, "button_open", duration).show(); |
---|
91 | break; |
---|
92 | |
---|
93 | case R.id.change_password: |
---|
94 | Toast.makeText(context, "change_password", duration).show(); |
---|
95 | break; |
---|
96 | } |
---|
97 | } |
---|
98 | |
---|
99 | @Override |
---|
100 | public void onItemClick(AdapterView<?> parent, View view, int item, long id) { |
---|
101 | Context context = getApplicationContext(); |
---|
102 | //CharSequence text = "Click!"; |
---|
103 | int duration = Toast.LENGTH_SHORT; |
---|
104 | Toast.makeText(context, "**onItemClick()**", duration).show(); |
---|
105 | |
---|
106 | } |
---|
107 | |
---|
108 | |
---|
109 | } |
---|