Fix transaction edition
- Fee format was not displayed correctly in Buy and Sell tabs
This commit is contained in:
parent
10c3a0a67b
commit
b25e44d3ef
@ -64,7 +64,7 @@ public class BuyFragment extends CustomRecordFragment {
|
|||||||
private List<String> symbolStrings;
|
private List<String> symbolStrings;
|
||||||
|
|
||||||
private int transactionId;
|
private int transactionId;
|
||||||
private Transaction transaction;
|
private static Transaction transaction;
|
||||||
|
|
||||||
private boolean isAmountLastUpdated;
|
private boolean isAmountLastUpdated;
|
||||||
|
|
||||||
@ -523,6 +523,8 @@ public class BuyFragment extends CustomRecordFragment {
|
|||||||
|
|
||||||
public void updatePair(Pair pair)
|
public void updatePair(Pair pair)
|
||||||
{
|
{
|
||||||
|
fragmentPair = pair;
|
||||||
|
|
||||||
currencyFeeAdapter = new ArrayAdapter<String>(getSecureContext(), android.R.layout.simple_spinner_item, new ArrayList<>());
|
currencyFeeAdapter = new ArrayAdapter<String>(getSecureContext(), android.R.layout.simple_spinner_item, new ArrayList<>());
|
||||||
currencyFeeAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
currencyFeeAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
||||||
feesCurrencySpinner.setAdapter(currencyFeeAdapter);
|
feesCurrencySpinner.setAdapter(currencyFeeAdapter);
|
||||||
@ -532,6 +534,32 @@ public class BuyFragment extends CustomRecordFragment {
|
|||||||
symbolStrings.addAll(PlaceholderManager.getFeeOptionsForSymbol(pair.getTo(), getSecureContext()));
|
symbolStrings.addAll(PlaceholderManager.getFeeOptionsForSymbol(pair.getTo(), getSecureContext()));
|
||||||
currencyFeeAdapter.addAll(symbolStrings);
|
currencyFeeAdapter.addAll(symbolStrings);
|
||||||
currencyFeeAdapter.notifyDataSetChanged();
|
currencyFeeAdapter.notifyDataSetChanged();
|
||||||
|
|
||||||
|
if(transaction != null)
|
||||||
|
{
|
||||||
|
if(transaction.getFeeCurrency().equals(fragmentPair.getFrom()))
|
||||||
|
{
|
||||||
|
if(transaction.getFeeFormat().equals("p"))
|
||||||
|
{
|
||||||
|
feesCurrencySpinner.setSelection(0);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
feesCurrencySpinner.setSelection(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if(transaction.getFeeFormat().equals("p"))
|
||||||
|
{
|
||||||
|
feesCurrencySpinner.setSelection(2);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
feesCurrencySpinner.setSelection(3);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -63,7 +63,7 @@ public class SellFragment extends CustomRecordFragment {
|
|||||||
private List<String> symbolStrings;
|
private List<String> symbolStrings;
|
||||||
|
|
||||||
private int transactionId;
|
private int transactionId;
|
||||||
private Transaction transaction;
|
private static Transaction transaction;
|
||||||
|
|
||||||
private boolean isAmountLastUpdated;
|
private boolean isAmountLastUpdated;
|
||||||
|
|
||||||
@ -531,6 +531,32 @@ public class SellFragment extends CustomRecordFragment {
|
|||||||
symbolStrings.addAll(PlaceholderManager.getFeeOptionsForSymbol(pair.getTo(), getSecureContext()));
|
symbolStrings.addAll(PlaceholderManager.getFeeOptionsForSymbol(pair.getTo(), getSecureContext()));
|
||||||
currencyFeeAdapter.addAll(symbolStrings);
|
currencyFeeAdapter.addAll(symbolStrings);
|
||||||
currencyFeeAdapter.notifyDataSetChanged();
|
currencyFeeAdapter.notifyDataSetChanged();
|
||||||
|
|
||||||
|
if(transaction != null)
|
||||||
|
{
|
||||||
|
if(transaction.getFeeCurrency().equals(fragmentPair.getFrom()))
|
||||||
|
{
|
||||||
|
if(transaction.getFeeFormat().equals("p"))
|
||||||
|
{
|
||||||
|
feesCurrencySpinner.setSelection(0);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
feesCurrencySpinner.setSelection(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if(transaction.getFeeFormat().equals("p"))
|
||||||
|
{
|
||||||
|
feesCurrencySpinner.setSelection(2);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
feesCurrencySpinner.setSelection(3);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -497,8 +497,6 @@ public class DatabaseManager extends SQLiteOpenHelper{
|
|||||||
Log.d("moodl", "Error while inserting transaction " + e.getMessage());
|
Log.d("moodl", "Error while inserting transaction " + e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
Log.d("mood", "Raw " + rawValues.toString());
|
|
||||||
|
|
||||||
db.insert(TABLE_MANUAL_TRANSACTIONS, null, values);
|
db.insert(TABLE_MANUAL_TRANSACTIONS, null, values);
|
||||||
db.close();
|
db.close();
|
||||||
}
|
}
|
||||||
@ -690,15 +688,6 @@ public class DatabaseManager extends SQLiteOpenHelper{
|
|||||||
|
|
||||||
if(resultatList.moveToFirst())
|
if(resultatList.moveToFirst())
|
||||||
{
|
{
|
||||||
boolean deduct = false;
|
|
||||||
|
|
||||||
if(!resultatList.isNull(resultatList.getColumnIndex(KEY_TRANSACTION_DEDUCT)))
|
|
||||||
{
|
|
||||||
deduct = resultatList.getInt(resultatList.getColumnIndex(KEY_TRANSACTION_DEDUCT)) == 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
Log.d("moodl", "> " + resultatList.getString(resultatList.getColumnIndex(KEY_TRANSACTION_TYPE)));
|
|
||||||
|
|
||||||
transaction = new Transaction(resultatList.getInt(resultatList.getColumnIndex(KEY_TRANSACTION_ID))
|
transaction = new Transaction(resultatList.getInt(resultatList.getColumnIndex(KEY_TRANSACTION_ID))
|
||||||
, resultatList.getString(resultatList.getColumnIndex(KEY_TRANSACTION_SYMBOL))
|
, resultatList.getString(resultatList.getColumnIndex(KEY_TRANSACTION_SYMBOL))
|
||||||
, resultatList.getString(resultatList.getColumnIndex(KEY_TRANSACTION_PAIR))
|
, resultatList.getString(resultatList.getColumnIndex(KEY_TRANSACTION_PAIR))
|
||||||
@ -712,11 +701,9 @@ public class DatabaseManager extends SQLiteOpenHelper{
|
|||||||
, resultatList.getString(resultatList.getColumnIndex(KEY_TRANSACTION_DESTINATION))
|
, resultatList.getString(resultatList.getColumnIndex(KEY_TRANSACTION_DESTINATION))
|
||||||
, resultatList.getString(resultatList.getColumnIndex(KEY_TRANSACTION_TYPE))
|
, resultatList.getString(resultatList.getColumnIndex(KEY_TRANSACTION_TYPE))
|
||||||
, resultatList.getString(resultatList.getColumnIndex(KEY_TRANSACTION_FEE_FORMAT))
|
, resultatList.getString(resultatList.getColumnIndex(KEY_TRANSACTION_FEE_FORMAT))
|
||||||
, deduct);
|
, resultatList.getInt(resultatList.getColumnIndex(KEY_TRANSACTION_DEDUCT)) == 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
Log.d("moodl", "> " + DatabaseUtils.dumpCurrentRowToString(resultatList));
|
|
||||||
|
|
||||||
resultatList.close();
|
resultatList.close();
|
||||||
|
|
||||||
db.close();
|
db.close();
|
||||||
|
Loading…
Reference in New Issue
Block a user