source: dispositivos_moviles/TibisayMovil/src/ve/gob/cenditel/tibisaymovil/FilesToPDFSignConfirmationActivity.java @ 931bb65

Last change on this file since 931bb65 was 931bb65, checked in by Jose Ruiz <joseruiz@…>, 11 years ago

firma electronica pdf

  • Property mode set to 100644
File size: 3.2 KB
Line 
1package ve.gob.cenditel.tibisaymovil;
2
3import java.util.ArrayList;
4import java.util.List;
5
6import android.app.Activity;
7import android.content.Intent;
8import android.os.Bundle;
9import android.util.SparseBooleanArray;
10import android.view.View;
11import android.view.Window;
12import android.view.View.OnClickListener;
13import android.widget.AdapterView;
14import android.widget.AdapterView.OnItemClickListener;
15import android.widget.ArrayAdapter;
16import android.widget.Button;
17import android.widget.LinearLayout;
18import android.widget.ListView;
19
20public class FilesToPDFSignConfirmationActivity extends Activity implements OnClickListener, OnItemClickListener {
21
22        private List<String> uris;
23        private ListView listView;
24        private LinearLayout next;
25        private LinearLayout back;
26        private ArrayAdapter<String> listAdapter;
27
28        public void onCreate(Bundle savedInstanceState) {
29                super.onCreate(savedInstanceState);
30               
31                final boolean customTitleSupported = requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);         
32                this.setContentView(R.layout.confirmationlist);     
33                if(customTitleSupported)
34                        getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.title_bar);
35               
36               
37                this.next = (LinearLayout) this.findViewById(R.id.button_next_zone);
38                this.next.setOnClickListener(this);
39               
40                this.back = (LinearLayout) this.findViewById(R.id.button_back_zone);
41                this.back.setOnClickListener(this);
42               
43               
44        this.uris = getIntent().getStringArrayListExtra(IntentExtraField.FILES);
45        this.listAdapter = new ArrayAdapter<String>(this,R.layout.confirmation_item, this.uris);
46       
47       
48        this.listView = (ListView) this.findViewById(R.id.confirmation_list);
49        this.listView.setAdapter(this.listAdapter);
50        this.listView.setOnItemClickListener(this);
51
52        this.listAdapter.notifyDataSetChanged();
53       
54        //Estilando Barra de titulo
55                if(customTitleSupported)
56                        getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.title_bar);
57
58       
59        }
60       
61
62        @Override
63        public void onStart(){
64                super.onStart();
65               
66                for (int i=0;i<this.listView.getCount();i++)
67                        this.listView.setItemChecked(i, true);
68        }
69       
70
71        @Override
72        public void onClick(View v) {
73                switch (v.getId())
74                {                       
75                        case R.id.button_back_zone:
76                                finish();
77                                break;
78                        case R.id.button_next_zone:
79                               
80                                Intent intent = new Intent();
81                                SparseBooleanArray sparse = this.listView.getCheckedItemPositions();
82                                ArrayList<String> sublist = new ArrayList<String>();
83                               
84                                for (int i = 0; i < sparse.size(); i++) {
85                                        if( sparse.valueAt(i)== true){
86                                                sublist.add((String)this.listAdapter.getItem(sparse.keyAt(i)));
87                                        }
88                                }
89                               
90                                if (sublist.size()>0){
91                                        intent.putStringArrayListExtra(IntentExtraField.FILES, sublist);
92                                        this.setResult(RESULT_OK, intent);
93                                        finish();
94                                }else{}
95                               
96                                break;
97       
98               
99                }
100       
101       
102       
103       
104        }
105
106
107        @Override
108        public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
109
110               
111                SparseBooleanArray checked =  this.listView.getCheckedItemPositions();
112                boolean found=false;           
113               
114                for (int i=0; i<checked.size() && found == false; i++) {
115                        if (checked.valueAt(i))
116                                found=true;
117       
118        }
119       
120       
121                if (found==false)
122                        this.next.setEnabled(false);
123                else
124                        this.next.setEnabled(true);
125               
126        }
127       
128       
129       
130
131
132       
133       
134}
135
Note: See TracBrowser for help on using the repository browser.