Skip to content

Commit

Permalink
codinguser#876 - Renaming toggleAmountInputEntryMode() to setAllowAmo…
Browse files Browse the repository at this point in the history
…untEdit
  • Loading branch information
JeanGarf committed Jun 14, 2020
1 parent 978a5eb commit b8d58a7
Showing 1 changed file with 23 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -521,7 +521,7 @@ private void initializeViewsWithTransaction(){

final boolean isSimpleSplit = mSplitsList.size() <= 2;

toggleAmountInputEntryMode(isSimpleSplit);
setAllowAmountEdit(isSimpleSplit);

if (mSplitsList.size() == 2){
for (Split split : mSplitsList) {
Expand Down Expand Up @@ -618,15 +618,25 @@ private void setDoubleEntryViewsVisibility(int visibility) {
mTransactionTypeSwitch.setVisibility(visibility);
}

private void toggleAmountInputEntryMode(boolean enabled){
if (enabled){
private void setAllowAmountEdit(boolean isAmountEditAllowed){

if (isAmountEditAllowed){
// Amount is allowed to be edited using keyboard

mAmountEditText.setFocusable(true);

// Use Keyboard to edit amount
mAmountEditText.bindListeners(mKeyboardView);

} else {
// Amount is not allowed to be edited, but can be clicked to open SplitEditor

mAmountEditText.setFocusable(false);

mAmountEditText.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {

openSplitEditor();
}
});
Expand Down Expand Up @@ -1272,15 +1282,22 @@ public void onRecurrenceSet(String rrule) {
public void onActivityResult(int requestCode, int resultCode, Intent data) {

if (resultCode == Activity.RESULT_OK){
// Splits have been saved => Use

// Once split editor has been used and saved, only allow editing through it
toggleAmountInputEntryMode(false);

// Do not allow keyboard anymore to edit amount
setAllowAmountEdit(false);

// Display Split Editor button
mOpenSplitEditor.setVisibility(View.VISIBLE);

// Hide double Entry
setDoubleEntryViewsVisibility(View.GONE);

// Set Split list from intent data coming from Split Editor
List<Split> splitList = data.getParcelableArrayListExtra(UxArgument.SPLIT_LIST);
setSplitList(splitList);

mOpenSplitEditor.setVisibility(View.VISIBLE);
}
}
}

0 comments on commit b8d58a7

Please sign in to comment.