@Override public void onBibleSet(BibleEntry be) { if (mView == mPrimarykeyButton) { if (be != null) { Log.d( TAG, "onBibleSet for button: " + be.displayStr + " for field idx " + mCrmFieldIndex); ((Button) mView).setText(be.displayStr); if (mListener != null) { mListener.onXpressfilePrimarykeySet(be.entryKey); } } return; } CrmFileFieldDesc cfd = mCrmFieldDescs.get(mCrmFieldIndex); CrmFileFieldValue fv = mCrmFileRecord.recordData.get(cfd.fieldCode); if (be != null) { ((Button) mView).setText(be.displayStr); fv.displayStr = be.displayStr; fv.valueString = be.entryKey; } else { ((Button) mView).setText(""); fv.displayStr = ""; fv.valueString = ""; } }
private boolean fillModelFromUI() { // Champs dynamiques CRM boolean isComplete = true; boolean capturedBool; String capturedStr; int crmFieldIndex = 0; for (CrmFileFieldDesc fd : mCrmFieldDescs) { CrmFileFieldValue record = mCrmFileRecord.recordData.get(fd.fieldCode); switch (fd.fieldType) { case FIELD_BIBLE: // bible capturée en direct : BibleListener => rien à faire break; case FIELD_BOOLEAN: capturedBool = ((CheckBox) mCrmFieldViews.get(crmFieldIndex).findViewById(R.id.crm_checkbox)) .isChecked(); record.valueBoolean = capturedBool; record.displayStr = capturedBool ? "true" : "false"; break; case FIELD_TEXT: capturedStr = ((EditText) mCrmFieldViews.get(crmFieldIndex).findViewById(R.id.crm_text)) .getText() .toString(); if (fd.fieldIsMandatory && capturedStr.equals("")) { isComplete = false; } record.valueString = capturedStr; record.displayStr = capturedStr; break; case FIELD_NUMBER: capturedStr = ((EditText) mCrmFieldViews.get(crmFieldIndex).findViewById(R.id.crm_text)) .getText() .toString(); float num = Float.parseFloat(capturedStr); record.valueFloat = num; if (num == Math.ceil(num)) { record.displayStr = String.valueOf((int) num); } else { record.displayStr = String.valueOf(num); } break; default: // non supporté => skip break; } crmFieldIndex++; } return isComplete; }