From 3827329ca90ce6beb6a82b84180bd3eb446b4311 Mon Sep 17 00:00:00 2001 From: Tanguy Herbron Date: Tue, 12 Jun 2018 23:28:07 +0200 Subject: [PATCH] Fix delete animation in listview | Add input security while registering a transaction --- .../Activities/DetailsActivityFragments/Transactions.java | 4 ++-- .../moodl/Activities/RecordTransactionActivity.java | 8 +++++++- .../DataManagers/ExchangeManager/BinanceManager.java | 8 ++++++++ app/src/main/res/layout/custom_currency_row.xml | 5 ----- app/src/main/res/layout/custom_trade_row.xml | 7 +++++++ app/src/main/res/layout/custom_transaction_row.xml | 6 ++++++ .../res/layout/fragment_transactions_detailsactivity.xml | 8 ++++++-- app/src/main/res/values-fr/strings.xml | 1 + app/src/main/res/values/strings.xml | 1 + 9 files changed, 38 insertions(+), 10 deletions(-) diff --git a/app/src/main/java/com/herbron/moodl/Activities/DetailsActivityFragments/Transactions.java b/app/src/main/java/com/herbron/moodl/Activities/DetailsActivityFragments/Transactions.java index 966dbc8..4ab12ad 100644 --- a/app/src/main/java/com/herbron/moodl/Activities/DetailsActivityFragments/Transactions.java +++ b/app/src/main/java/com/herbron/moodl/Activities/DetailsActivityFragments/Transactions.java @@ -60,8 +60,6 @@ public class Transactions extends Fragment { flag_loading = false; - - TransactionUpdater transactionUpdater = new TransactionUpdater(); transactionUpdater.execute(); @@ -197,6 +195,8 @@ public class Transactions extends Fragment { Looper.prepare(); } + //binanceManager.updateTransactions(currency.getSymbol()); + final ArrayList transactionList = databaseManager.getCurrencyTransactionsForSymbol(currency.getSymbol()); getActivity().runOnUiThread(new Runnable() { @Override diff --git a/app/src/main/java/com/herbron/moodl/Activities/RecordTransactionActivity.java b/app/src/main/java/com/herbron/moodl/Activities/RecordTransactionActivity.java index 23ac447..3646eaa 100644 --- a/app/src/main/java/com/herbron/moodl/Activities/RecordTransactionActivity.java +++ b/app/src/main/java/com/herbron/moodl/Activities/RecordTransactionActivity.java @@ -98,9 +98,15 @@ public class RecordTransactionActivity extends AppCompatActivity { private boolean checkPriceText() { String purchasedPriceText = purchasedPriceEditText.getText().toString(); + double purchasedPrice; try { - Double.parseDouble(purchasedPriceText); + purchasedPrice = Double.parseDouble(purchasedPriceText); + + if(purchasedPrice < 0) + { + purchasedPriceEditText.setError(getResources().getString(R.string.field_negative)); + } } catch (NumberFormatException e) { purchasedPriceEditText.setError(getResources().getString(R.string.field_nan)); diff --git a/app/src/main/java/com/herbron/moodl/DataManagers/ExchangeManager/BinanceManager.java b/app/src/main/java/com/herbron/moodl/DataManagers/ExchangeManager/BinanceManager.java index 65fdc7a..3007b2d 100644 --- a/app/src/main/java/com/herbron/moodl/DataManagers/ExchangeManager/BinanceManager.java +++ b/app/src/main/java/com/herbron/moodl/DataManagers/ExchangeManager/BinanceManager.java @@ -1,5 +1,7 @@ package com.herbron.moodl.DataManagers.ExchangeManager; +import android.util.Log; + import com.binance.api.client.BinanceApiClientFactory; import com.binance.api.client.BinanceApiRestClient; import com.binance.api.client.domain.account.Account; @@ -98,6 +100,12 @@ public class BinanceManager { callBack.onSuccess(); } + public void updateTransactions(String symbol) + { + BinanceApiClientFactory factory = BinanceApiClientFactory.newInstance(publicKey, privateKey); + BinanceApiRestClient client = factory.newRestClient(); + } + public List updateTrades(String symbol, String pairSymbol) { diff --git a/app/src/main/res/layout/custom_currency_row.xml b/app/src/main/res/layout/custom_currency_row.xml index f38db39..acce1cf 100644 --- a/app/src/main/res/layout/custom_currency_row.xml +++ b/app/src/main/res/layout/custom_currency_row.xml @@ -46,10 +46,5 @@ - \ No newline at end of file diff --git a/app/src/main/res/layout/custom_trade_row.xml b/app/src/main/res/layout/custom_trade_row.xml index 26ad64c..cbab56d 100644 --- a/app/src/main/res/layout/custom_trade_row.xml +++ b/app/src/main/res/layout/custom_trade_row.xml @@ -67,4 +67,11 @@ + + + \ No newline at end of file diff --git a/app/src/main/res/layout/custom_transaction_row.xml b/app/src/main/res/layout/custom_transaction_row.xml index fa60b6e..c2fd90e 100644 --- a/app/src/main/res/layout/custom_transaction_row.xml +++ b/app/src/main/res/layout/custom_transaction_row.xml @@ -98,4 +98,10 @@ + + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_transactions_detailsactivity.xml b/app/src/main/res/layout/fragment_transactions_detailsactivity.xml index d115ffb..2d2560f 100644 --- a/app/src/main/res/layout/fragment_transactions_detailsactivity.xml +++ b/app/src/main/res/layout/fragment_transactions_detailsactivity.xml @@ -20,7 +20,9 @@ android:id="@+id/listTransactions" android:layout_width="match_parent" android:layout_height="wrap_content" - android:orientation="vertical"/> + android:orientation="vertical" + android:divider="@null" + android:dividerHeight="0dp"/> @@ -59,7 +61,9 @@ android:id="@+id/listTrades" android:layout_width="match_parent" android:layout_height="match_parent" - android:orientation="vertical"/> + android:orientation="vertical" + android:divider="@null" + android:dividerHeight="0dp"/> diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index e754f53..fbf3e5e 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -88,4 +88,5 @@ Edition Ce champ en peut pas être vide Ce champ doit être un nombre + Ce champ doit être positif \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index daba12a..bf6c00c 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -188,5 +188,6 @@ This field cannot be blank This field must be a number + This field must be positive