Fix delete animation in listview | Add input security while registering a transaction

This commit is contained in:
Tanguy Herbron 2018-06-12 23:28:07 +02:00
parent cff73dac49
commit 3827329ca9
9 changed files with 38 additions and 10 deletions

View File

@ -60,8 +60,6 @@ public class Transactions extends Fragment {
flag_loading = false; flag_loading = false;
TransactionUpdater transactionUpdater = new TransactionUpdater(); TransactionUpdater transactionUpdater = new TransactionUpdater();
transactionUpdater.execute(); transactionUpdater.execute();
@ -197,6 +195,8 @@ public class Transactions extends Fragment {
Looper.prepare(); Looper.prepare();
} }
//binanceManager.updateTransactions(currency.getSymbol());
final ArrayList<Transaction> transactionList = databaseManager.getCurrencyTransactionsForSymbol(currency.getSymbol()); final ArrayList<Transaction> transactionList = databaseManager.getCurrencyTransactionsForSymbol(currency.getSymbol());
getActivity().runOnUiThread(new Runnable() { getActivity().runOnUiThread(new Runnable() {
@Override @Override

View File

@ -98,9 +98,15 @@ public class RecordTransactionActivity extends AppCompatActivity {
private boolean checkPriceText() private boolean checkPriceText()
{ {
String purchasedPriceText = purchasedPriceEditText.getText().toString(); String purchasedPriceText = purchasedPriceEditText.getText().toString();
double purchasedPrice;
try { try {
Double.parseDouble(purchasedPriceText); purchasedPrice = Double.parseDouble(purchasedPriceText);
if(purchasedPrice < 0)
{
purchasedPriceEditText.setError(getResources().getString(R.string.field_negative));
}
} catch (NumberFormatException e) { } catch (NumberFormatException e) {
purchasedPriceEditText.setError(getResources().getString(R.string.field_nan)); purchasedPriceEditText.setError(getResources().getString(R.string.field_nan));

View File

@ -1,5 +1,7 @@
package com.herbron.moodl.DataManagers.ExchangeManager; package com.herbron.moodl.DataManagers.ExchangeManager;
import android.util.Log;
import com.binance.api.client.BinanceApiClientFactory; import com.binance.api.client.BinanceApiClientFactory;
import com.binance.api.client.BinanceApiRestClient; import com.binance.api.client.BinanceApiRestClient;
import com.binance.api.client.domain.account.Account; import com.binance.api.client.domain.account.Account;
@ -98,6 +100,12 @@ public class BinanceManager {
callBack.onSuccess(); callBack.onSuccess();
} }
public void updateTransactions(String symbol)
{
BinanceApiClientFactory factory = BinanceApiClientFactory.newInstance(publicKey, privateKey);
BinanceApiRestClient client = factory.newRestClient();
}
public List<com.herbron.moodl.DataManagers.CurrencyData.Trade> updateTrades(String symbol, String pairSymbol) public List<com.herbron.moodl.DataManagers.CurrencyData.Trade> updateTrades(String symbol, String pairSymbol)
{ {

View File

@ -46,10 +46,5 @@
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="2dp"
android:background="@color/separationColor"
/>
</LinearLayout> </LinearLayout>

View File

@ -67,4 +67,11 @@
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="@dimen/separationLineSize"
android:layout_gravity="center_vertical"
android:background="@color/separationColor" />
</LinearLayout> </LinearLayout>

View File

@ -98,4 +98,10 @@
<!-- Surface View End --> <!-- Surface View End -->
</com.daimajia.swipe.SwipeLayout> </com.daimajia.swipe.SwipeLayout>
<View
android:layout_width="match_parent"
android:layout_height="@dimen/separationLineSize"
android:layout_gravity="center_vertical"
android:background="@color/separationColor" />
</LinearLayout> </LinearLayout>

View File

@ -20,7 +20,9 @@
android:id="@+id/listTransactions" android:id="@+id/listTransactions"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical"/> android:orientation="vertical"
android:divider="@null"
android:dividerHeight="0dp"/>
</LinearLayout> </LinearLayout>
@ -59,7 +61,9 @@
android:id="@+id/listTrades" android:id="@+id/listTrades"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:orientation="vertical"/> android:orientation="vertical"
android:divider="@null"
android:dividerHeight="0dp"/>
</LinearLayout> </LinearLayout>

View File

@ -88,4 +88,5 @@
<string name="action_edit_mode">Edition</string> <string name="action_edit_mode">Edition</string>
<string name="field_empty">Ce champ en peut pas être vide</string> <string name="field_empty">Ce champ en peut pas être vide</string>
<string name="field_nan">Ce champ doit être un nombre</string> <string name="field_nan">Ce champ doit être un nombre</string>
<string name="field_negative">Ce champ doit être positif</string>
</resources> </resources>

View File

@ -188,5 +188,6 @@
<string name="field_empty">This field cannot be blank</string> <string name="field_empty">This field cannot be blank</string>
<string name="field_nan">This field must be a number</string> <string name="field_nan">This field must be a number</string>
<string name="field_negative">This field must be positive</string>
</resources> </resources>