private boolean updateExactlyTimes(View v, Recur r) {
   EditText e = (EditText) v.findViewById(R.id.edTimes);
   if (Utils.isEmpty(e)) {
     showError(e, R.string.recur_error_specify_times);
     return false;
   }
   r.periodParam = Long.parseLong(Utils.text(e));
   return true;
 }
 private boolean updateEveryXDay(View v, Recur r) {
   EveryXDay x = (EveryXDay) r;
   EditText t = (EditText) v.findViewById(R.id.edEveryXDays);
   if (Utils.isEmpty(t)) {
     showError(t, R.string.recur_error_specify_days);
     return false;
   }
   x.days = Integer.parseInt(Utils.text(t));
   return true;
 }
 private boolean updateSemiMonthly(View v, Recur r) {
   SemiMonthly sm = (SemiMonthly) r;
   EditText t1 = (EditText) v.findViewById(R.id.edFirstDay);
   if (Utils.isEmpty(t1)) {
     showError(t1, R.string.recur_error_specify_first_day);
     return false;
   }
   sm.firstDay = Integer.parseInt(Utils.text(t1));
   EditText t2 = (EditText) v.findViewById(R.id.edSecondDay);
   if (Utils.isEmpty(t2)) {
     showError(t2, R.string.recur_error_specify_second_day);
     return false;
   }
   sm.secondDay = Integer.parseInt(Utils.text(t2));
   return true;
 }
Example #4
0
 private static RemoteViews updateWidgetFromAccount(
     Context context, int widgetId, int layoutId, Class providerClass, Account a) {
   RemoteViews updateViews = new RemoteViews(context.getPackageName(), layoutId);
   updateViews.setTextViewText(R.id.line1, a.title);
   AccountType type = AccountType.valueOf(a.type);
   if (type.isCard && a.cardIssuer != null) {
     CardIssuer cardIssuer = CardIssuer.valueOf(a.cardIssuer);
     updateViews.setImageViewResource(R.id.account_icon, cardIssuer.iconId);
   } else {
     updateViews.setImageViewResource(R.id.account_icon, type.iconId);
   }
   long amount = a.totalAmount;
   updateViews.setTextViewText(R.id.note, Utils.amountToString(a.currency, amount));
   Utils u = new Utils(context);
   int amountColor = u.getAmountColor(amount);
   updateViews.setTextColor(R.id.note, amountColor);
   addScrollOnClick(context, updateViews, widgetId, providerClass);
   addTapOnClick(context, updateViews);
   addButtonsClick(context, updateViews);
   saveAccountForWidget(context, widgetId, a.id);
   return updateViews;
 }