Fix RecordTransactionActivity crash

- The intent is now cleared after editing a transaction, avoiding a crash in certain scenarios
This commit is contained in:
Tanguy Herbron 2018-08-19 02:15:48 +02:00
parent 8ba9cc2ff9
commit 43171cd428
3 changed files with 25 additions and 2 deletions

View File

@ -87,6 +87,8 @@ public class RecordTransactionActivity extends AppCompatActivity implements Curr
private boolean isGlobalLayoutVisible; private boolean isGlobalLayoutVisible;
private Intent callingIntent;
private TextWatcher coinTextWatcher = new TextWatcher() { private TextWatcher coinTextWatcher = new TextWatcher() {
@Override @Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) { public void beforeTextChanged(CharSequence s, int start, int count, int after) {
@ -145,10 +147,20 @@ public class RecordTransactionActivity extends AppCompatActivity implements Curr
setupBackButton(); setupBackButton();
} }
@Override
protected void onStop() {
super.onStop();
if(callingIntent != null)
{
callingIntent.removeExtra("transactionId");
}
}
private void checkCallingIntent() private void checkCallingIntent()
{ {
Intent intent = getIntent(); callingIntent = getIntent();
int transactionId = intent.getIntExtra("transactionId", -1); int transactionId = callingIntent.getIntExtra("transactionId", -1);
if(transactionId != -1) if(transactionId != -1)
{ {

View File

@ -134,6 +134,11 @@
<item>Autre / Inconnu</item> <item>Autre / Inconnu</item>
</string-array> </string-array>
<string-array name="fees_options">
<item>Pourcentage</item>
<item>Fixe</item>
</string-array>
<string name="emitedPlaceholder">Pourcentage de coin émis : %1$s%%</string> <string name="emitedPlaceholder">Pourcentage de coin émis : %1$s%%</string>
<string name="edit_transaction">Edition d\'une transaction de %1$s</string> <string name="edit_transaction">Edition d\'une transaction de %1$s</string>
<string name="new_transaction">Nouvelle transaction</string> <string name="new_transaction">Nouvelle transaction</string>

View File

@ -174,6 +174,11 @@
<item>Other / Unknown</item> <item>Other / Unknown</item>
</string-array> </string-array>
<string-array name="fees_options">
<item>Percentage</item>
<item>Fixed</item>
</string-array>
<!--Cardview placeholders--> <!--Cardview placeholders-->
<string name="currencySymbolPlaceholder" translatable="false">(%1$s)</string> <string name="currencySymbolPlaceholder" translatable="false">(%1$s)</string>
<string name="currencyBalancePlaceholder" translatable="false">%1$s%2$s</string> <string name="currencyBalancePlaceholder" translatable="false">%1$s%2$s</string>
@ -291,5 +296,6 @@
<string name="activity_sell_price">Sell price</string> <string name="activity_sell_price">Sell price</string>
<string name="activity_sell_date">Sell date</string> <string name="activity_sell_date">Sell date</string>
<string name="activity_transfert_date">Date of transfert</string> <string name="activity_transfert_date">Date of transfert</string>
<string name="error_no_valid_from_to">This transaction is not valid</string>
</resources> </resources>