@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_pay_now); rowAmount = (RowEditTextOmegaFi) findViewById(R.id.rowEditTextAmount); rowDate = (RowInformation) findViewById(R.id.rowSelectDatePay); Date today = Calendar.getInstance().getTime(); rowDate.setValueInfo( today.getMonth() + 1 + "/" + today.getDate() + "/" + (today.getYear() + 1900)); rowPaymentMethod = (RowInformation) findViewById(R.id.selectPaymentMethod); infoCurrent = (LabelInfoVertical) findViewById(R.id.currentBalancePayNow); infoDueOn = (LabelInfoVertical) findViewById(R.id.dueOnPayNow); idAccount = getIntent().getExtras().getInt("id"); backIsHome = getIntent().getExtras().containsKey("home") ? getIntent().getExtras().getBoolean("home") : false; methodTemp = getIntent().getExtras().containsKey("temp") ? (PaymentMethodTemp) getIntent().getSerializableExtra("temp") : null; if (idAccount != -1) { this.chargePayNow(); } }
private boolean validateFieldsPayNow() { boolean validate = true; Calendar cal = Calendar.getInstance(); cal.set(Calendar.HOUR_OF_DAY, 0); cal.set(Calendar.MINUTE, 0); cal.set(Calendar.SECOND, 0); if (rowAmount.getValueInfo1().isEmpty() || !OmegaFiActivity.isDouble(rowAmount.getValueInfo1())) { validate = false; } else if (!CalendarEvent.getDateFromString(rowDate.getValueInfo(), "MM/dd/yyyy") .after(cal.getTime())) { validate = false; } return validate; }
public void selectDatePayment(View view) { int[] dayMonthYear = rowDate.getDayMonthYear(); DatePickerDialog date = new DatePickerDialog( this, new DatePickerDialog.OnDateSetListener() { @Override public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) { rowDate.setValueInfo((monthOfYear + 1) + "/" + dayOfMonth + "/" + year); } }, dayMonthYear[2], dayMonthYear[0] - 1, dayMonthYear[1]); date.getDatePicker().setCalendarViewShown(false); Calendar cal = Calendar.getInstance(); cal.set( cal.get(Calendar.YEAR), cal.get(Calendar.MONTH), cal.get(Calendar.DAY_OF_MONTH), 0, 0, 0); date.getDatePicker().setMinDate(cal.getTimeInMillis()); date.show(); }