tvAmount.setNextFocusForwardId(View.NO_ID); // magic!
tvDate.setOnFocusChangeListener((v, hasFocus) -> {
- if (hasFocus) pickTransactionDate();
+ if (hasFocus)
+ pickTransactionDate();
});
tvDate.setOnClickListener(v -> pickTransactionDate());
mProfile = Data.profile.getValue();
- if (mProfile == null) throw new AssertionError();
+ if (mProfile == null)
+ throw new AssertionError();
MLDB.hookAutocompletionAdapter(tvDescription.getContext(), tvDescription,
MLDB.DESCRIPTION_HISTORY_TABLE, "description", false, adapter, mProfile);
@Override
public void afterTextChanged(Editable s) {
// debug("input", "text changed");
- if (inUpdate) return;
+ if (inUpdate)
+ return;
Logger.debug("textWatcher", "calling syncData()");
syncData();
tvAmount.addTextChangedListener(tw);
dateObserver = date -> {
- if (syncingData) return;
+ if (syncingData)
+ return;
syncingData = true;
try {
tvDate.setText(item.getFormattedDate());
}
};
descriptionObserver = description -> {
- if (syncingData) return;
+ if (syncingData)
+ return;
syncingData = true;
try {
tvDescription.setText(description);
}
};
hintObserver = hint -> {
- if (syncingData) return;
+ if (syncingData)
+ return;
syncingData = true;
try {
tvAmount.setHint(hint);
//if (!tvDate.hasFocus()) tvDate.requestFocus();
boolean focused = tvDescription.requestFocus();
tvDescription.dismissDropDown();
- if (focused) Misc.showSoftKeyboard(
- (NewTransactionActivity) tvDescription.getContext());
+ if (focused)
+ Misc.showSoftKeyboard(
+ (NewTransactionActivity) tvDescription.getContext());
break;
case transactionRow:
focused = tvAccount.requestFocus();
item.getAccount()
.getAmount())
: "unset") : "")));
- if (adapterPosition == count) tvAmount.setImeOptions(EditorInfo.IME_ACTION_DONE);
- else tvAmount.setImeOptions(EditorInfo.IME_ACTION_NEXT);
+ if (adapterPosition == count)
+ tvAmount.setImeOptions(EditorInfo.IME_ACTION_DONE);
+ else
+ tvAmount.setImeOptions(EditorInfo.IME_ACTION_NEXT);
};
}
private void setEditable(Boolean editable) {
tvAmount.setEnabled(editable);
}
private void beginUpdates() {
- if (inUpdate) throw new RuntimeException("Already in update mode");
+ if (inUpdate)
+ throw new RuntimeException("Already in update mode");
inUpdate = true;
}
private void endUpdates() {
- if (!inUpdate) throw new RuntimeException("Not in update mode");
+ if (!inUpdate)
+ throw new RuntimeException("Not in update mode");
inUpdate = false;
}
/**
* Stores the data from the UI elements into the model item
*/
private void syncData() {
- if (item == null) return;
+ if (item == null)
+ return;
if (syncingData) {
Logger.debug("new-trans", "skipping syncData() loop");
.resetAmount();
}
}
- else item.getAccount()
- .resetAmount();
+ else
+ item.getAccount()
+ .resetAmount();
break;
case bottomFiller:
c.set(year, month, day);
item.setDate(c.getTime());
boolean focused = tvDescription.requestFocus();
- if (focused) Misc.showSoftKeyboard((NewTransactionActivity) tvAccount.getContext());
+ if (focused)
+ Misc.showSoftKeyboard((NewTransactionActivity) tvAccount.getContext());
}
@Override