1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
|
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.moredetails_infos);
Cursor = Fab.getFab(this);
emptyMessage = (TextView) findViewById(R.id.empty_message);
tab1 = (TableLayout) findViewById(R.id.tabLayout1);
saveBtn = (Button) findViewById(R.id.validateButton);
if(Cursor==null){
emptyMessage.setVisibility(View.VISIBLE);
tab1.setVisibility(View.GONE);
saveBtn.setVisibility(View.GONE);
}else{
startManagingCursor(Cursor);
if (Cursor.moveToFirst()) {
faMap = new HashMap<Long, View>();
fabs = new ArrayList<Fab>();
do {
long id = Cursor.getLong(Cursor.getColumnIndex(Const.COL_ID));
View view = LayoutInflater.from(this.getParent()).inflate(R.layout.patient_moredetails_infos_row_layout, null);
view.setId((int) id);
cb = (CheckBox) view.findViewById(R.id.patient_moredetails_infos);
cb.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
View v = (View) buttonView.getParent();
MatrixCursor MatrixCursor = Fab.getFabById(MoreDetailsInfosFab.this, v.getId());
startManagingCursor(faMatrixCursor);
faMatrixCursor.moveToPosition(0);
if (cb.isChecked()) {
montant.setEnabled(false);
} else if (!cb.isChecked()) {
montant.setEnabled(true);
}
calcul();
}});
view.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
Intent intent = null;
intent = new Intent(MoreDetails.this, MoreDetails.class);
intent.putExtra("FAB_ID", v.getId());
startActivity(intent);
}
});
tab1.addView(view);
faMap.put(Cursor.getLong(Cursor.getColumnIndex(Const.COL_ID)), view);
Fab fab = new Fab(); fab.setMontant(Cursor.getDouble(Cursor.getColumnIndex(Const.COL_MONTANT)));
fabs.add(fab);
} while (Cursor.moveToNext());
}
}
} |
Partager