- Data.accounts.addObserver(new Observer() {
- @Override
- public void update(Observable o, Object arg) {
- mActivity.runOnUiThread(new Runnable() {
- @Override
- public void run() {
- modelAdapter.notifyDataSetChanged();
- }
- });
- }
- });
- update_account_table();
- }
-
- private void update_accounts(boolean force) {
- long now = new Date().getTime();
- if ((now > (account_list_last_updated + (24 * 3600 * 1000))) || force) {
- Log.d("db",
- "accounts last updated at " + account_list_last_updated + " and now is " + now +
- ". re-fetching");
- update_accounts();
- }
- }
-
- private void update_accounts() {
- RetrieveAccountsTask task = new RetrieveAccountsTask(new WeakReference<>(mActivity));
-
- task.setPref(PreferenceManager.getDefaultSharedPreferences(mActivity));
- task.execute();
-
- }
- private void update_account_table() {
- if (this.getContext() == null) return;
-
- model.scheduleAccountListReload(this.getContext());
+ Data.accounts.addObserver(
+ (o, arg) -> mActivity.runOnUiThread(() -> modelAdapter.notifyDataSetChanged()));