forked from codinguser/gnucash-android
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
codinguser#876 - Create setViewsToColorize(...) to initialize views t…
…o colorize in red/green
- Loading branch information
Showing
1 changed file
with
26 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,7 +33,11 @@ | |
|
||
/** | ||
* A special type of {@link android.widget.ToggleButton} which displays the appropriate DEBIT/CREDIT labels for the | ||
* different account types. | ||
* linked account type | ||
* | ||
* checked means CREDIT | ||
* unchecked means DEBIT | ||
* | ||
* @author Ngewi Fet <[email protected]> | ||
*/ | ||
// TODO TW C 2020-03-03 : A renommer SplitTypeSwitch (AC) | ||
|
@@ -69,6 +73,23 @@ public TransactionTypeSwitch(Context context) { | |
super(context); | ||
} | ||
|
||
/** | ||
* Store views to colorize (green/red) accordingly to TransactionType and AccountType | ||
* in addition to the current switch button | ||
* | ||
* @param amountEditText | ||
* EditText displaying the amount value | ||
* | ||
* @param currencyTextView | ||
* Currency symbol text view | ||
*/ | ||
public void setViewsToColorize(CalculatorEditText amountEditText, | ||
TextView currencyTextView) { | ||
|
||
mAmountEditText = amountEditText; | ||
mCurrencyTextView = currencyTextView; | ||
} | ||
|
||
/** | ||
* Store the accountType | ||
* and define switch on/off texts accordingly | ||
|
@@ -77,7 +98,7 @@ public TransactionTypeSwitch(Context context) { | |
*/ | ||
public void setAccountType(AccountType accountType) { | ||
|
||
this.mAccountType = accountType; | ||
mAccountType = accountType; | ||
|
||
Context context = getContext().getApplicationContext(); | ||
|
||
|
@@ -148,15 +169,10 @@ public void setAccountType(AccountType accountType) { | |
* Bind a ColorizeOnTransactionTypeChangeListener as a switch checked change listener | ||
* to update the signum of amount view, colorize amount, | ||
* currency and switch views accordingly | ||
* | ||
* @param amoutView Amount string {@link android.widget.EditText} | ||
* @param currencyTextView Currency symbol text view | ||
*/ | ||
public void setColorizeOnCheckedChangeListener(CalculatorEditText amoutView, | ||
TextView currencyTextView) { | ||
public void setColorizeOnCheckedChangeListener() { | ||
|
||
setOnCheckedChangeListener(new ColorizeOnTransactionTypeChangeListener(amoutView, | ||
currencyTextView)); | ||
setOnCheckedChangeListener(new ColorizeOnTransactionTypeChangeListener()); | ||
} | ||
|
||
/** | ||
|
@@ -260,13 +276,9 @@ private class ColorizeOnTransactionTypeChangeListener | |
|
||
/** | ||
* Constructor with the amount view | ||
* @param amountEditText EditText displaying the amount value | ||
* @param currencyTextView Currency symbol text view | ||
*/ | ||
public ColorizeOnTransactionTypeChangeListener(CalculatorEditText amountEditText, TextView currencyTextView){ | ||
public ColorizeOnTransactionTypeChangeListener(){ | ||
|
||
mAmountEditText = amountEditText; | ||
mCurrencyTextView = currencyTextView; | ||
} | ||
|
||
@Override | ||
|