From b7d10011ef9cf2f8f03e3c33392a7729cb1323ce Mon Sep 17 00:00:00 2001 From: Tanguy Herbron Date: Wed, 1 Aug 2018 13:08:16 +0200 Subject: [PATCH] Fix exchange type not being processed properly --- .../com/herbron/moodl/Activities/AddExchangeActivity.java | 1 + .../java/com/herbron/moodl/DataManagers/DatabaseManager.java | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/com/herbron/moodl/Activities/AddExchangeActivity.java b/app/src/main/java/com/herbron/moodl/Activities/AddExchangeActivity.java index 5dca0ed..424de9c 100644 --- a/app/src/main/java/com/herbron/moodl/Activities/AddExchangeActivity.java +++ b/app/src/main/java/com/herbron/moodl/Activities/AddExchangeActivity.java @@ -80,6 +80,7 @@ public class AddExchangeActivity extends AppCompatActivity { private void loadLayoutFor(int exchangeType) { setupExchangeLayout.removeAllViews(); + exchangeSpinner.setSelection(exchangeType); switch (exchangeType) { diff --git a/app/src/main/java/com/herbron/moodl/DataManagers/DatabaseManager.java b/app/src/main/java/com/herbron/moodl/DataManagers/DatabaseManager.java index ee5022c..b4a2f02 100644 --- a/app/src/main/java/com/herbron/moodl/DataManagers/DatabaseManager.java +++ b/app/src/main/java/com/herbron/moodl/DataManagers/DatabaseManager.java @@ -443,7 +443,7 @@ public class DatabaseManager extends SQLiteOpenHelper{ public List getHitBtcAccounts(Context context) { - String searchQuerry = "SELECT * FROM " + TABLE_EXCHANGE_KEYS + " WHERE " + KEY_EXCHANGE_TYPE + "='" + HITBTC_TYPE + "' AND " + KEY_EXCHANGE_IS_ENABLED + " = '1'"; + String searchQuerry = "SELECT * FROM " + TABLE_EXCHANGE_KEYS + " WHERE " + KEY_EXCHANGE_TYPE + " = " + HITBTC_TYPE + " AND " + KEY_EXCHANGE_IS_ENABLED + " = '1'"; SQLiteDatabase db = this.getWritableDatabase(); Cursor resultList = db.rawQuery(searchQuerry, null); @@ -466,7 +466,7 @@ public class DatabaseManager extends SQLiteOpenHelper{ public List getBinanceAccounts() { - String searchQuerry = "SELECT * FROM " + TABLE_EXCHANGE_KEYS + " WHERE " + KEY_EXCHANGE_TYPE + "='" + BINANCE_TYPE + "' AND " + KEY_EXCHANGE_IS_ENABLED + " = '1'"; + String searchQuerry = "SELECT * FROM " + TABLE_EXCHANGE_KEYS + " WHERE " + KEY_EXCHANGE_TYPE + " = " + BINANCE_TYPE + " AND " + KEY_EXCHANGE_IS_ENABLED + " = '1'"; SQLiteDatabase db = this.getWritableDatabase(); Cursor resultList = db.rawQuery(searchQuerry, null);