public void update(Observable o, Object arg) {
if (mActivity == null) return;
if (swiper == null) return;
- mActivity.runOnUiThread(new Runnable() {
- @Override
- public void run() {
- int cnt = Data.backgroundTaskCount.get();
- Log.d("acc", String.format("background task count changed to %d", cnt));
- swiper.setRefreshing(cnt > 0);
- }
+ mActivity.runOnUiThread(() -> {
+ int cnt = Data.backgroundTaskCount.get();
+ Log.d("acc", String.format("background task count changed to %d", cnt));
+ swiper.setRefreshing(cnt > 0);
});
}
});
Data.accounts.addObserver(new Observer() {
@Override
public void update(Observable o, Object arg) {
- mActivity.runOnUiThread(new Runnable() {
- @Override
- public void run() {
- modelAdapter.notifyDataSetChanged();
- }
- });
+ mActivity.runOnUiThread(() -> modelAdapter.notifyDataSetChanged());
}
});
update_account_table();
@Override
public void update(Observable o, Object arg) {
Log.d("main", "lastUpdateDate changed");
- runOnUiThread(new Runnable() {
- @Override
- public void run() {
- Date date = Data.lastUpdateDate.get();
- if (date == null) {
- tvLastUpdate.setText(R.string.transaction_last_update_never);
+ runOnUiThread(() -> {
+ Date date = Data.lastUpdateDate.get();
+ if (date == null) {
+ tvLastUpdate.setText(R.string.transaction_last_update_never);
+ }
+ else {
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
+ tvLastUpdate.setText(date.toInstant().atZone(ZoneId.systemDefault())
+ .format(DateTimeFormatter.ISO_LOCAL_DATE_TIME));
}
else {
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
- tvLastUpdate.setText(date.toInstant().atZone(ZoneId.systemDefault())
- .format(DateTimeFormatter.ISO_LOCAL_DATE_TIME));
- }
- else {
- tvLastUpdate.setText(date.toLocaleString());
- }
+ tvLastUpdate.setText(date.toLocaleString());
}
}
});
Data.backgroundTaskCount.addObserver(backgroundTaskCountObserver = new Observer() {
@Override
public void update(Observable o, Object arg) {
- mActivity.runOnUiThread(new Runnable() {
- @Override
- public void run() {
- int cnt = Data.backgroundTaskCount.get();
- Log.d("trl", String.format("background task count changed to %d", cnt));
- swiper.setRefreshing(cnt > 0);
- }
+ mActivity.runOnUiThread(() -> {
+ int cnt = Data.backgroundTaskCount.get();
+ Log.d("trl", String.format("background task count changed to %d", cnt));
+ swiper.setRefreshing(cnt > 0);
});
}
});
Data.transactions.addObserver(new Observer() {
@Override
public void update(Observable o, Object arg) {
- mActivity.runOnUiThread(new Runnable() {
- @Override
- public void run() {
- modelAdapter.notifyDataSetChanged();
- }
- });
+ mActivity.runOnUiThread(() -> modelAdapter.notifyDataSetChanged());
}
});