Skip to content

Commit

Permalink
Fix split editor button hidden in some scenarios
Browse files Browse the repository at this point in the history
Also, if more than 2 splits are present, show split editor button even if in single-entry mode
  • Loading branch information
codinguser committed Oct 11, 2015
1 parent b2d8ef0 commit 2ef6999
Showing 1 changed file with 12 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,11 @@ public class TransactionFormFragment extends Fragment implements
*/
@Bind(R.id.btn_split_editor) ImageView mOpenSplitEditor;

/**
* Layout for transfer account and associated views
*/
@Bind(R.id.layout_double_entry) View mDoubleEntryLayout;

/**
* Flag to note if double entry accounting is in use or not
*/
Expand Down Expand Up @@ -417,10 +422,10 @@ public void onItemClick(AdapterView<?> adapterView, View view, int position, lon
} else {
if (amountEntered){ //if user entered own amount, clear loaded splits and use the user value
mSplitsList.clear();
setAmountEditViewVisible(View.VISIBLE);
setDoubleEntryViewsVisibility(View.VISIBLE);
} else {
if (mUseDoubleEntry) { //don't hide the view in single entry mode
setAmountEditViewVisible(View.GONE);
setDoubleEntryViewsVisibility(View.GONE);
}
}
}
Expand Down Expand Up @@ -477,9 +482,7 @@ private void initializeViewsWithTransaction(){
}
}
} else {
if (mUseDoubleEntry) {
setAmountEditViewVisible(View.GONE);
}
setDoubleEntryViewsVisibility(View.GONE);
}

String currencyCode = mTransactionsDbAdapter.getAccountCurrencyCode(mAccountUID);
Expand All @@ -496,10 +499,9 @@ private void initializeViewsWithTransaction(){
}
}

private void setAmountEditViewVisible(int visibility) {
getView().findViewById(R.id.layout_double_entry).setVisibility(visibility);
private void setDoubleEntryViewsVisibility(int visibility) {
mDoubleEntryLayout.setVisibility(visibility);
mTransactionTypeSwitch.setVisibility(visibility);
mOpenSplitEditor.setVisibility(visibility);
}

private void toggleAmountInputEntryMode(boolean enabled){
Expand Down Expand Up @@ -932,7 +934,8 @@ public void setSplitList(List<Split> splitList, List<String> removedSplitUIDs){
//once we set the split list, do not allow direct editing of the total
if (mSplitsList.size() > 1){
toggleAmountInputEntryMode(false);
setAmountEditViewVisible(View.GONE);
setDoubleEntryViewsVisibility(View.GONE);
mOpenSplitEditor.setVisibility(View.VISIBLE);
}
}

Expand Down

0 comments on commit 2ef6999

Please sign in to comment.