Code cleaning / sorting

This commit is contained in:
Tanguy Herbron 2018-08-19 02:46:53 +02:00
parent 43171cd428
commit 40210fdbf0
12 changed files with 81 additions and 61 deletions

View File

@ -69,7 +69,7 @@ public class Watchlist extends Fragment implements CryptocompareNotifierInterfac
@Override
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
{
view = inflater.inflate(R.layout.fragment_watchlist_homeactivity, container, false);
view = inflater.inflate(R.layout.homeactivity_fragment_watchlist, container, false);
refreshLayout = view.findViewById(R.id.swiperefreshwatchlist);
dragLinearLayout = view.findViewById(R.id.linearLayoutWatchlist);

View File

@ -243,6 +243,7 @@ public class BuyFragment extends CustomRecordFragment {
, note
, fragmentPair.getFrom().equals(fragmentCurrency.getSymbol()) ? fragmentPair.getTo() : fragmentPair.getFrom()
, feeCurrency
, ""
, fragmentExchange.getName()
, "b"
, feesCurrencySpinner.getSelectedItemPosition() % 2 == 0 ? "p" : "f");
@ -261,6 +262,7 @@ public class BuyFragment extends CustomRecordFragment {
, note
, fragmentPair.getFrom().equals(fragmentCurrency.getSymbol()) ? fragmentPair.getTo() : fragmentPair.getFrom()
, feeCurrency
, ""
, fragmentExchange.getName()
,"b"
, feesCurrencySpinner.getSelectedItemPosition() % 2 == 0 ? "p" : "f");
@ -378,13 +380,9 @@ public class BuyFragment extends CustomRecordFragment {
private double getFees(String feeCurrency, double amount, double purchasedPrice)
{
double fees;
double fees = 0;
if(fees_editText.getText().toString().equals(""))
{
fees = 0;
}
else
if(!fees_editText.getText().toString().equals(""))
{
fees = Double.parseDouble(fees_editText.getText().toString());
@ -534,11 +532,6 @@ public class BuyFragment extends CustomRecordFragment {
}
});
if(preferenceManager == null)
{
preferenceManager = new PreferencesManager(getSecureContext());
}
if(calendar == null)
{
calendar = Calendar.getInstance();

View File

@ -215,6 +215,7 @@ public class SellFragment extends CustomRecordFragment {
, note
, fragmentPair.getFrom().equals(fragmentCurrency.getSymbol()) ? fragmentPair.getTo() : fragmentPair.getFrom()
, feeCurrency
, ""
, fragmentExchange.getName()
, "s"
, feesCurrencySpinner.getSelectedItemPosition() % 2 == 0 ? "p" : "f");
@ -233,6 +234,7 @@ public class SellFragment extends CustomRecordFragment {
, note
, fragmentPair.getFrom().equals(fragmentCurrency.getSymbol()) ? fragmentPair.getTo() : fragmentPair.getFrom()
, feeCurrency
, ""
, fragmentExchange.getName()
,"s"
, feesCurrencySpinner.getSelectedItemPosition() % 2 == 0 ? "p" : "f");
@ -350,13 +352,9 @@ public class SellFragment extends CustomRecordFragment {
private double getFees(String feeCurrency, double amount, double purchasedPrice)
{
double fees;
double fees = 0;
if(fees_editText.getText().toString().equals(""))
{
fees = 0;
}
else
if(!fees_editText.getText().toString().equals(""))
{
fees = Double.parseDouble(fees_editText.getText().toString());

View File

@ -79,7 +79,7 @@ public class BalanceManager implements BinanceUpdateNotifierInterface, HitBTCUpd
balanceCounter = 0;
manualBalances = databaseManager.getAllCurrenciesFromManualCurrency();
manualBalances = databaseManager.getAllCurrenciesFromTransactions();
if(binanceManagers.size() > 0)
{

View File

@ -0,0 +1,5 @@
<vector android:height="24dp" android:tint="@color/separationColor"
android:viewportHeight="24.0" android:viewportWidth="24.0"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#FF000000" android:pathData="M7,10l5,5 5,-5z"/>
</vector>

View File

@ -0,0 +1,5 @@
<vector android:height="24dp" android:tint="@color/separationColor"
android:viewportHeight="24.0" android:viewportWidth="24.0"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#FF000000" android:pathData="M7,14l5,-5 5,5z"/>
</vector>

View File

@ -4,43 +4,16 @@
<layer-list>
<item>
<shape android:shape="rectangle">
<solid android:color="@color/hardWhite"/>
<corners
android:topLeftRadius="5dp"
android:topRightRadius="5dp"/>
<padding
android:left="3dp"
android:right="3dp"
android:top="3dp"
android:bottom="3dp"/>
<solid android:color="@color/transparent"/>
<corners android:radius="2dp"/>
<stroke
android:color="@color/separationColor"
android:width="1dp"/>
</shape>
</item>
<item
android:gravity="center_vertical|right"
android:drawable="@drawable/ic_arrow_drop_down_white_24dp"/>
</layer-list>
</item>
<item android:state_enabled="false">
<layer-list>
<item>
<shape android:shape="rectangle">
<solid android:color="@color/softWhite"/>
<corners
android:topLeftRadius="5dp"
android:topRightRadius="5dp"/>
<padding
android:left="3dp"
android:right="3dp"
android:top="3dp"
android:bottom="3dp"/>
</shape>
</item>
<item
android:gravity="center_vertical|right"
android:drawable="@drawable/ic_arrow_drop_down_white_24dp"/>
android:drawable="@drawable/ic_arrow_drop_down_24dp"/>
</layer-list>
</item>
</selector>

View File

@ -0,0 +1,46 @@
<?xml version="1.0" encoding="utf-8" ?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_enabled="true">
<layer-list>
<item>
<shape android:shape="rectangle">
<solid android:color="@color/hardWhite"/>
<corners
android:topLeftRadius="5dp"
android:topRightRadius="5dp"/>
<padding
android:left="3dp"
android:right="3dp"
android:top="3dp"
android:bottom="3dp"/>
</shape>
</item>
<item
android:gravity="center_vertical|right"
android:drawable="@drawable/ic_arrow_drop_down_white_24dp"/>
</layer-list>
</item>
<item android:state_enabled="false">
<layer-list>
<item>
<shape android:shape="rectangle">
<solid android:color="@color/softWhite"/>
<corners
android:topLeftRadius="5dp"
android:topRightRadius="5dp"/>
<padding
android:left="3dp"
android:right="3dp"
android:top="3dp"
android:bottom="3dp"/>
</shape>
</item>
<item
android:gravity="center_vertical|right"
android:drawable="@drawable/ic_arrow_drop_down_white_24dp"/>
</layer-list>
</item>
</selector>

View File

@ -55,7 +55,7 @@
android:layout_marginEnd="12dp"
android:layout_marginStart="12dp"
android:layout_marginTop="12dp"
android:background="@drawable/spinner_background"
android:background="@drawable/spinner_background_header"
android:gravity="center"
android:textSize="18sp" />

View File

@ -58,7 +58,7 @@
android:id="@+id/coin_autoCompleteTextView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/spinner_background"
android:background="@drawable/spinner_background_header"
android:textSize="18sp"
android:hint="@string/select_coin"
android:inputType="textNoSuggestions"
@ -87,7 +87,7 @@
android:layout_weight="1.7"
android:layout_marginEnd="12dp"
android:layout_height="@dimen/spinner_toolbar_height"
android:background="@drawable/spinner_background"
android:background="@drawable/spinner_background_header"
android:hint="@string/select_exchange"
android:inputType="textNoSuggestions"
android:gravity="center"
@ -98,7 +98,7 @@
android:layout_width="0dp"
android:layout_height="@dimen/spinner_toolbar_height"
android:layout_weight="1.2"
android:background="@drawable/spinner_background"
android:background="@drawable/spinner_background_header"
android:hint="@string/select_pair"
android:inputType="textNoSuggestions"
android:gravity="center"