import java.util.Observer;
public class MainActivity extends AppCompatActivity {
+ public MobileLedgerListFragment currentFragment = null;
DrawerLayout drawer;
private AccountSummaryFragment accountSummaryFragment;
private TransactionListFragment transactionListFragment;
- public MobileLedgerListFragment currentFragment = null;
private FragmentManager fragmentManager;
private TextView tvLastUpdate;
private RetrieveTransactionsTask retrieveTransactionsTask;
tvLastUpdate = findViewById(R.id.transactions_last_update);
- bTransactionListCancelDownload =
- findViewById(R.id.transaction_list_cancel_download);
+ bTransactionListCancelDownload = findViewById(R.id.transaction_list_cancel_download);
progressBar = findViewById(R.id.transaction_list_progress_bar);
if (progressBar == null)
throw new RuntimeException("Can't get hold on the transaction value progress bar");
@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());
}
}
});