Skip to content

Commit

Permalink
Multiple fixs
Browse files Browse the repository at this point in the history
[DetailsActivity]
- Fix crash when finishing the activity before all transactions and trades are updated

[MarketCapitalizationActivity]
- Fix some views not visible for little screens

[RecordTransactionActivity]
- Fix crash when editing a sell transaction
  • Loading branch information
TanguyHerbron committed Aug 21, 2018
1 parent ac7fb54 commit 518df66
Show file tree
Hide file tree
Showing 11 changed files with 324 additions and 251 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -161,15 +161,18 @@ public int compare(Object o1, Object o2) {
}
});

TransactionListAdapter transactionListAdapter = new TransactionListAdapter(getActivity(), transactions);
if(getActivity() != null)
{
TransactionListAdapter transactionListAdapter = new TransactionListAdapter(getActivity(), transactions);

getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
transactionLayout.setAdapter(transactionListAdapter);
transactionLayout.setTextFilterEnabled(false);
}
});
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
transactionLayout.setAdapter(transactionListAdapter);
transactionLayout.setTextFilterEnabled(false);
}
});
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import android.os.Bundle;
import android.support.v4.view.GravityCompat;
import android.support.v4.widget.DrawerLayout;
import android.support.v4.widget.NestedScrollView;
import android.support.v4.widget.SwipeRefreshLayout;
import android.support.v7.graphics.Palette;
import android.text.SpannableString;
Expand Down Expand Up @@ -54,6 +55,7 @@ public class MarketCapitalization extends Fragment implements CryptocompareNotif
private PreferencesManager preferencesManager;
private CoinmarketCapAPIManager coinmarketCapAPIManager;
private SwipeRefreshLayout refreshLayout;
private NestedScrollView nestedScrollView;
private long lastTimestamp;
private String defaultCurrency;
private CryptocompareApiManager cryptocompareApiManager;
Expand Down Expand Up @@ -89,6 +91,8 @@ public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
defaultCurrency = preferencesManager.getDefaultCurrency();
lastTimestamp = 0;

nestedScrollView = view.findViewById(R.id.nestedMarketCap);

setupRefreshLayout();

setupDrawerButton();
Expand Down Expand Up @@ -304,12 +308,12 @@ public boolean onTouch(View view, MotionEvent motionEvent) {
switch (motionEvent.getAction())
{
case MotionEvent.ACTION_DOWN:
refreshLayout.setEnabled(false);
nestedScrollView.setEnabled(false);
break;
case MotionEvent.ACTION_MOVE:
break;
default:
refreshLayout.setEnabled(true);
nestedScrollView.setEnabled(true);
break;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -296,8 +296,8 @@ public void onClick(View v) {
});
feesCurrencySpinner = view.findViewById(R.id.feesCurrency_editText_buy);

currencyFeeAdapter = new ArrayAdapter<String>(getSecureContext(), android.R.layout.simple_spinner_item, new ArrayList<>());
currencyFeeAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
currencyFeeAdapter = new ArrayAdapter<String>(getActivity(), android.R.layout.simple_spinner_item, new ArrayList<>());
currencyFeeAdapter.setDropDownViewResource(R.layout.spinner_dropdown_black);
feesCurrencySpinner.setAdapter(currencyFeeAdapter);

deductHoldingsSwitch = view.findViewById(R.id.deductHoldingsBuy);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ public void onClick(View v) {
feesCurrencySpinner = view.findViewById(R.id.feesCurrency_editText_sell);

currencyFeeAdapter = new ArrayAdapter<String>(getSecureContext(), android.R.layout.simple_spinner_item, new ArrayList<>());
currencyFeeAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
currencyFeeAdapter.setDropDownViewResource(R.layout.spinner_dropdown_black);
feesCurrencySpinner.setAdapter(currencyFeeAdapter);

if(fragmentPair != null)
Expand Down Expand Up @@ -522,6 +522,8 @@ public void onExchangeUpdated() {

public void updatePair(Pair pair)
{
fragmentPair = pair;

currencyFeeAdapter = new ArrayAdapter<String>(getSecureContext(), android.R.layout.simple_spinner_item, new ArrayList<>());
currencyFeeAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
feesCurrencySpinner.setAdapter(currencyFeeAdapter);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -262,15 +262,15 @@ private void setupToSpinner()
private void setupSpinnesr()
{
ArrayAdapter<String> fromAdapter = new ArrayAdapter<String>(getContext(), android.R.layout.simple_spinner_item, getResources().getStringArray(R.array.from_transfer_options_string_array));
fromAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
fromAdapter.setDropDownViewResource(R.layout.spinner_dropdown_black);
fromSpinner.setAdapter(fromAdapter);

ArrayAdapter<String> toAdapter = new ArrayAdapter<String>(getContext(), android.R.layout.simple_spinner_item, getResources().getStringArray(R.array.to_transfer_options_string_array));
toAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
toAdapter.setDropDownViewResource(R.layout.spinner_dropdown_black);
toSpinner.setAdapter(toAdapter);

ArrayAdapter<String> feeAdapter = new ArrayAdapter<String>(getContext(), android.R.layout.simple_spinner_item, getResources().getStringArray(R.array.fees_options));
feeAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
feeAdapter.setDropDownViewResource(R.layout.spinner_dropdown_black);
feeSpinner.setAdapter(feeAdapter);

fromSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
Expand Down
46 changes: 46 additions & 0 deletions app/src/main/res/drawable-v21/spinner_background_header.xml
Original file line number Diff line number Diff line change
@@ -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>
6 changes: 0 additions & 6 deletions app/src/main/res/drawable/spinner_background_header.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@
android:bottom="3dp"/>
</shape>
</item>
<item
android:gravity="center_vertical|right"
android:drawable="@drawable/ic_arrow_drop_down_white_24dp"/>
</layer-list>
</item>

Expand All @@ -38,9 +35,6 @@
android:bottom="3dp"/>
</shape>
</item>
<item
android:gravity="center_vertical|right"
android:drawable="@drawable/ic_arrow_drop_down_white_24dp"/>
</layer-list>
</item>
</selector>
Loading

0 comments on commit 518df66

Please sign in to comment.