Skip to content

Commit

Permalink
cleanup & comparison fix to use enum
Browse files Browse the repository at this point in the history
  • Loading branch information
Alen Siljak committed May 25, 2015
1 parent 78ae0c6 commit 758f05f
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/com/money/manager/ex/CheckingAccountActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -534,7 +534,7 @@ public void onClick(View v) {
intent.putExtra(SplitTransactionsActivity.KEY_DATASET_TYPE, TableSplitTransactions.class.getSimpleName());
// intent.putExtra(SplitTransactionsActivity.KEY_TRANSACTION_TYPE, mTransCode);
// int transactionType = TransactionTypes.valueOf(mTransCode).getCode();
intent.putExtra(SplitTransactionsActivity.KEY_TRANSACTION_TYPE, mTransactionType);
intent.putExtra(SplitTransactionsActivity.KEY_TRANSACTION_TYPE, mTransactionType.getCode());
intent.putParcelableArrayListExtra(SplitTransactionsActivity.KEY_SPLIT_TRANSACTION, mSplitTransactions);
intent.putParcelableArrayListExtra(SplitTransactionsActivity.KEY_SPLIT_TRANSACTION_DELETED, mSplitTransactionsDeleted);
startActivityForResult(intent, REQUEST_PICK_SPLIT_TRANSACTION);
Expand Down
3 changes: 2 additions & 1 deletion src/com/money/manager/ex/SplitTransactionsActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,10 @@ protected void onCreate(Bundle savedInstanceState) {
Intent intent = getIntent();
if (intent != null) {
this.EntityTypeName = intent.getStringExtra(KEY_DATASET_TYPE);
//this.mParentTransactionType = intent.getStringExtra(KEY_TRANSACTION_TYPE);

int transactionType = intent.getIntExtra(KEY_TRANSACTION_TYPE, 0);
mParentTransactionType = TransactionTypes.values()[transactionType];

mSplitTransactions = intent.getParcelableArrayListExtra(KEY_SPLIT_TRANSACTION);
mSplitDeleted = intent.getParcelableArrayListExtra(KEY_SPLIT_TRANSACTION_DELETED);
}
Expand Down
6 changes: 2 additions & 4 deletions src/com/money/manager/ex/fragment/SplitItemFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,7 @@ public ISplitTransactionsDataset getSplitTransaction(TransactionTypes parentTran
// otherwise figure out which sign to use for the amount.

// toString takes the localized text! Use value.
// Object selectedItem = spinTransCode.getSelectedItem();
// long id = spinTransCode.getSelectedItemId();
int position = spinTransCode.getSelectedItemPosition();
// String transactionType = spinTransCode.getSelectedItem().toString();
TransactionTypes transactionType = TransactionTypes.values()[position];

if(!parentTransactionType.equals(transactionType)){
Expand Down Expand Up @@ -220,7 +217,8 @@ private int getTransactionTypeSelection(){
int transactionTypeSelection;

SplitTransactionsActivity splitActivity = (SplitTransactionsActivity) getActivity();
boolean parentIsWithdrawal = splitActivity.mParentTransactionType.equals(getString(R.string.withdrawal));
// boolean parentIsWithdrawal = splitActivity.mParentTransactionType.equals(getString(R.string.withdrawal));
boolean parentIsWithdrawal = splitActivity.mParentTransactionType.equals(TransactionTypes.Withdrawal);
double amount = mSplitTransaction.getSplitTransAmount();
if(parentIsWithdrawal){
// parent is Withdrawal.
Expand Down

0 comments on commit 758f05f

Please sign in to comment.