Fix watchlist loading

- Watchlist was no longer refreshing
- No loading indicator when first loading the fragment
This commit is contained in:
Tanguy Herbron 2018-05-23 17:17:33 +02:00
parent 54e6bb4e9e
commit a46ad91f79
3 changed files with 21 additions and 18 deletions

View File

@ -74,7 +74,7 @@ public class Watchlist extends Fragment {
defaultCurrency = preferencesManager.getDefaultCurrency();
currencyTickerList = new CurrencyTickerList(getActivity());
tickerUpdated = false;
checkUpdatedData();
updateTickerList();
editModeEnabled = false;
@ -98,6 +98,25 @@ public class Watchlist extends Fragment {
return view;
}
private void updateTickerList()
{
AsyncTask<Void, Integer, Void> updater = new AsyncTask<Void, Integer, Void>() {
@Override
protected Void doInBackground(Void... voids) {
currencyTickerList.update(new BalanceManager.IconCallBack() {
@Override
public void onSuccess() {
tickerUpdated = true;
checkUpdatedData();
}
});
return null;
}
};
updater.execute();
}
private void setupEditButton()
{
ImageButton editButton = view.findViewById(R.id.edit_button);

View File

@ -216,22 +216,6 @@ public class SettingsActivity extends AppCompatPreferenceActivity {
addPreferencesFromResource(R.xml.pref_general);
setHasOptionsMenu(true);
/*findPreference("hide_balance").setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
boolean isChecked = ((SwitchPreference) findPreference("hide_balance")).isChecked();
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(getContext());
SharedPreferences.Editor editor = preferences.edit();
editor.putBoolean("hide_balance", isChecked);
editor.apply();
return isChecked;
}
});*/
findPreference("version").setSummary(BuildConfig.VERSION_NAME);
bindPreferenceSummaryToValue(findPreference("default_currency"));

View File

@ -91,7 +91,7 @@
style="?android:attr/progressBarStyleLarge"
android:layout_gravity="center"
android:background="@drawable/circular_progress_bar"
android:visibility="gone"/>
android:visibility="visible"/>
</LinearLayout>