Fix 'infinity' balance percentage when hiding the balance
This commit is contained in:
parent
9395ec7425
commit
2a4ba215e6
BIN
.idea/caches/build_file_checksums.ser
generated
BIN
.idea/caches/build_file_checksums.ser
generated
Binary file not shown.
@ -228,7 +228,7 @@ public class Summary extends Fragment implements BalanceSwitchManagerInterface,
|
|||||||
for(int i = 0; i < renderedCurrencies.size(); i++)
|
for(int i = 0; i < renderedCurrencies.size(); i++)
|
||||||
{
|
{
|
||||||
//currencyLayout.addView(currencyView.get(i));
|
//currencyLayout.addView(currencyView.get(i));
|
||||||
currencyLayout.addView(new CurrencyCardview(getActivity(), renderedCurrencies.get(i), getActivity(), totalValue, preferencesManager.isBalanceHidden()));
|
currencyLayout.addView(new CurrencyCardview(getActivity(), renderedCurrencies.get(i), getActivity(), preferencesManager.isBalanceHidden()));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(loadingDialog.isShowing())
|
if(loadingDialog.isShowing())
|
||||||
@ -478,6 +478,14 @@ public class Summary extends Fragment implements BalanceSwitchManagerInterface,
|
|||||||
totalFluctuation += ((CurrencyCardview) currencyLayout.getChildAt(i)).getFluctuation();
|
totalFluctuation += ((CurrencyCardview) currencyLayout.getChildAt(i)).getFluctuation();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for(int i = 0; i < currencyLayout.getChildCount(); i++)
|
||||||
|
{
|
||||||
|
if(currencyLayout.getChildAt(i) instanceof CurrencyCardview)
|
||||||
|
{
|
||||||
|
((CurrencyCardview) currencyLayout.getChildAt(i)).updateCardViewInfos(totalValue, preferencesManager.isBalanceHidden());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void updateTitle()
|
protected void updateTitle()
|
||||||
|
@ -126,7 +126,7 @@ public class CurrencyCardview extends CardView implements CurrencyInfoUpdateNoti
|
|||||||
updateColor(currency);
|
updateColor(currency);
|
||||||
}
|
}
|
||||||
|
|
||||||
public CurrencyCardview(@NonNull final Context context, final Currency currency, Activity activity, float totalValue, boolean isBalanceHidden)
|
public CurrencyCardview(@NonNull final Context context, final Currency currency, Activity activity, boolean isBalanceHidden)
|
||||||
{
|
{
|
||||||
super(context);
|
super(context);
|
||||||
|
|
||||||
@ -166,8 +166,6 @@ public class CurrencyCardview extends CardView implements CurrencyInfoUpdateNoti
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
updateCardViewInfos(currency, totalValue, isBalanceHidden);
|
|
||||||
|
|
||||||
findViewById(R.id.linearLayoutSubCharts).setOnClickListener(detailsClickListener);
|
findViewById(R.id.linearLayoutSubCharts).setOnClickListener(detailsClickListener);
|
||||||
findViewById(R.id.LineChartView).setOnClickListener(detailsClickListener);
|
findViewById(R.id.LineChartView).setOnClickListener(detailsClickListener);
|
||||||
|
|
||||||
@ -250,7 +248,7 @@ public class CurrencyCardview extends CardView implements CurrencyInfoUpdateNoti
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateCardViewInfos(Currency currency, float totalValue, boolean isBalanceHidden)
|
public void updateCardViewInfos(float totalValue, boolean isBalanceHidden)
|
||||||
{
|
{
|
||||||
double value = currency.getValue() * currency.getBalance();
|
double value = currency.getValue() * currency.getBalance();
|
||||||
double percentage = value / totalValue * 100;
|
double percentage = value / totalValue * 100;
|
||||||
|
Loading…
Reference in New Issue
Block a user