public void formAction(BaseActivity activity, Forms form, boolean apply) { if (apply) { final String text = form.getTextFieldValue(TEXT); final String phone = getPhone(); if ((0 < text.length()) && (0 < phone.length())) { int agent = (0 < agents.indexOf('|')) ? form.getSelectorValue(AGENT) : 0; sendSms((Protocol) protocols.elementAt(agent), phone, text); } } form.back(); }
public void show(BaseActivity activity) { if (0 == agents.length()) { return; } form = new Forms(R.string.send_sms, this, true); if (null == phones) { form.addTextField(PHONE, R.string.phone, ""); } else { form.addSelector(PHONE, "phone", phones.replace(',', '|'), 0); } if (0 < agents.indexOf('|')) { form.addSelector(AGENT, R.string.send_via, agents, 0); } else { form.addString(R.string.send_via, agents); } form.addTextField(TEXT, R.string.message, " "); form.show(activity); }
private String getPhone() { if (null != phones) { return form.getSelectorString(PHONE); } return form.getTextFieldValue(PHONE); }