Persist "show all" state in currency selector in trade charts view

This commit is contained in:
Manfred Karrer 2018-09-26 10:26:06 -05:00
parent ede420375f
commit b5454b3b92
No known key found for this signature in database
GPG Key ID: 401250966A6B2C46

View File

@ -129,7 +129,10 @@ class TradesChartsViewModel extends ActivatableViewModel {
fillTradeCurrencies(); fillTradeCurrencies();
}; };
Optional<TradeCurrency> tradeCurrencyOptional = CurrencyUtil.getTradeCurrency(preferences.getTradeChartsScreenCurrencyCode()); String tradeChartsScreenCurrencyCode = preferences.getTradeChartsScreenCurrencyCode();
showAllTradeCurrenciesProperty.set(isShowAllEntry(tradeChartsScreenCurrencyCode));
Optional<TradeCurrency> tradeCurrencyOptional = CurrencyUtil.getTradeCurrency(tradeChartsScreenCurrencyCode);
if (tradeCurrencyOptional.isPresent()) if (tradeCurrencyOptional.isPresent())
selectedTradeCurrencyProperty.set(tradeCurrencyOptional.get()); selectedTradeCurrencyProperty.set(tradeCurrencyOptional.get());
else else
@ -186,8 +189,8 @@ class TradesChartsViewModel extends ActivatableViewModel {
showAllTradeCurrenciesProperty.set(showAllEntry); showAllTradeCurrenciesProperty.set(showAllEntry);
if (!showAllEntry) { if (!showAllEntry) {
selectedTradeCurrencyProperty.set(tradeCurrency); selectedTradeCurrencyProperty.set(tradeCurrency);
preferences.setTradeChartsScreenCurrencyCode(code);
} }
preferences.setTradeChartsScreenCurrencyCode(code);
updateChartData(); updateChartData();