Fix transaction history not displaying correctly
- Fix deducted transactions not being displayed - Fix pairs not displayed properly
This commit is contained in:
parent
7623012353
commit
9395ec7425
@ -140,12 +140,12 @@ public class TransactionListAdapter extends ArrayAdapter<Object> {
|
|||||||
case "b":
|
case "b":
|
||||||
transactionIndicator.setBackgroundColor(context.getResources().getColor(R.color.increaseCandle));
|
transactionIndicator.setBackgroundColor(context.getResources().getColor(R.color.increaseCandle));
|
||||||
topLeftTextView.setText(transaction.getSource());
|
topLeftTextView.setText(transaction.getSource());
|
||||||
bottomLeftTextView.setText(PlaceholderUtils.getToPairString(transaction.getSymbol(), transaction.getSymPair(), context));
|
bottomLeftTextView.setText(PlaceholderUtils.getToPairString(transaction.getSymPair(), transaction.getSymbol(), context));
|
||||||
break;
|
break;
|
||||||
case "s":
|
case "s":
|
||||||
transactionIndicator.setBackgroundColor(context.getResources().getColor(R.color.decreaseCandle));
|
transactionIndicator.setBackgroundColor(context.getResources().getColor(R.color.decreaseCandle));
|
||||||
topLeftTextView.setText(transaction.getSource());
|
topLeftTextView.setText(transaction.getSource());
|
||||||
bottomLeftTextView.setText(PlaceholderUtils.getToPairString(transaction.getSymPair(), transaction.getSymbol(), context));
|
bottomLeftTextView.setText(PlaceholderUtils.getToPairString(transaction.getSymbol(), transaction.getSymPair(), context));
|
||||||
break;
|
break;
|
||||||
case "t":
|
case "t":
|
||||||
transactionIndicator.setBackgroundColor(context.getResources().getColor(R.color.blue));
|
transactionIndicator.setBackgroundColor(context.getResources().getColor(R.color.blue));
|
||||||
|
@ -725,7 +725,8 @@ public class DatabaseManager extends SQLiteOpenHelper{
|
|||||||
|
|
||||||
public ArrayList<Transaction> getCurrencyTransactionsForSymbol(String symbol)
|
public ArrayList<Transaction> getCurrencyTransactionsForSymbol(String symbol)
|
||||||
{
|
{
|
||||||
String searchQuerry = "SELECT * FROM " + TABLE_MANUAL_TRANSACTIONS + " WHERE " + KEY_TRANSACTION_SYMBOL + "='" + symbol.toUpperCase() + "'";
|
String searchQuerry = "SELECT * FROM " + TABLE_MANUAL_TRANSACTIONS + " WHERE " + KEY_TRANSACTION_SYMBOL + "='" + symbol.toUpperCase()
|
||||||
|
+ "' OR " + KEY_TRANSACTION_PAIR + "='" + symbol.toUpperCase() + "' AND " + KEY_TRANSACTION_DEDUCT + "=1";
|
||||||
SQLiteDatabase db = this.getWritableDatabase();
|
SQLiteDatabase db = this.getWritableDatabase();
|
||||||
Cursor resultatList = db.rawQuery(searchQuerry, null);
|
Cursor resultatList = db.rawQuery(searchQuerry, null);
|
||||||
|
|
||||||
@ -733,16 +734,38 @@ public class DatabaseManager extends SQLiteOpenHelper{
|
|||||||
|
|
||||||
while (resultatList.moveToNext())
|
while (resultatList.moveToNext())
|
||||||
{
|
{
|
||||||
boolean deduct = false;
|
String type = "t";
|
||||||
|
String pair = resultatList.getString(resultatList.getColumnIndex(KEY_TRANSACTION_PAIR));
|
||||||
|
String sym = resultatList.getString(resultatList.getColumnIndex(KEY_TRANSACTION_SYMBOL));
|
||||||
|
|
||||||
if(!resultatList.isNull(resultatList.getColumnIndex(KEY_TRANSACTION_DEDUCT)))
|
if(resultatList.getString(resultatList.getColumnIndex(KEY_TRANSACTION_SYMBOL)).equals(symbol.toUpperCase()))
|
||||||
{
|
{
|
||||||
deduct = resultatList.getInt(resultatList.getColumnIndex(KEY_TRANSACTION_DEDUCT)) == 1;
|
type = resultatList.getString(resultatList.getColumnIndex(KEY_TRANSACTION_TYPE));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if(resultatList.getString(resultatList.getColumnIndex(KEY_TRANSACTION_TYPE)).equals("s"))
|
||||||
|
{
|
||||||
|
type = "b";
|
||||||
|
|
||||||
|
pair = sym;
|
||||||
|
sym = resultatList.getString(resultatList.getColumnIndex(KEY_TRANSACTION_PAIR));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if(resultatList.getString(resultatList.getColumnIndex(KEY_TRANSACTION_TYPE)).equals("b"))
|
||||||
|
{
|
||||||
|
type = "s";
|
||||||
|
|
||||||
|
pair = sym;
|
||||||
|
sym = resultatList.getString(resultatList.getColumnIndex(KEY_TRANSACTION_PAIR));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
transactionList.add(new Transaction(resultatList.getInt(resultatList.getColumnIndex(KEY_TRANSACTION_ID))
|
transactionList.add(new Transaction(resultatList.getInt(resultatList.getColumnIndex(KEY_TRANSACTION_ID))
|
||||||
, resultatList.getString(resultatList.getColumnIndex(KEY_TRANSACTION_SYMBOL))
|
, sym
|
||||||
, resultatList.getString(resultatList.getColumnIndex(KEY_TRANSACTION_PAIR))
|
, pair
|
||||||
, resultatList.getDouble(resultatList.getColumnIndex(KEY_TRANSACTION_AMOUNT))
|
, resultatList.getDouble(resultatList.getColumnIndex(KEY_TRANSACTION_AMOUNT))
|
||||||
, resultatList.getLong(resultatList.getColumnIndex(KEY_TRANSACTION_DATE))
|
, resultatList.getLong(resultatList.getColumnIndex(KEY_TRANSACTION_DATE))
|
||||||
, resultatList.getDouble(resultatList.getColumnIndex(KEY_TRANSACTION_PURCHASE_PRICE))
|
, resultatList.getDouble(resultatList.getColumnIndex(KEY_TRANSACTION_PURCHASE_PRICE))
|
||||||
@ -751,9 +774,9 @@ public class DatabaseManager extends SQLiteOpenHelper{
|
|||||||
, resultatList.getString(resultatList.getColumnIndex(KEY_TRANSACTION_FEE_CURRENCY))
|
, resultatList.getString(resultatList.getColumnIndex(KEY_TRANSACTION_FEE_CURRENCY))
|
||||||
, resultatList.getString(resultatList.getColumnIndex(KEY_TRANSACTION_SOURCE))
|
, resultatList.getString(resultatList.getColumnIndex(KEY_TRANSACTION_SOURCE))
|
||||||
, resultatList.getString(resultatList.getColumnIndex(KEY_TRANSACTION_DESTINATION))
|
, resultatList.getString(resultatList.getColumnIndex(KEY_TRANSACTION_DESTINATION))
|
||||||
, resultatList.getString(resultatList.getColumnIndex(KEY_TRANSACTION_TYPE))
|
, 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));
|
||||||
}
|
}
|
||||||
|
|
||||||
resultatList.close();
|
resultatList.close();
|
||||||
|
Loading…
Reference in New Issue
Block a user