]> git.ktnx.net Git - mobile-ledger.git/blobdiff - app/src/main/java/net/ktnx/mobileledger/ui/activity/MainActivity.java
move profile name from the sub-title to the title
[mobile-ledger.git] / app / src / main / java / net / ktnx / mobileledger / ui / activity / MainActivity.java
index 0991a694a3b28d2ea0f5000d5ae4d9a3e4185ed4..1218d0cf3d5cc37a5b4f6c1081f82b83e591d566 100644 (file)
@@ -51,8 +51,6 @@ import net.ktnx.mobileledger.utils.MLDB;
 
 import java.lang.ref.WeakReference;
 import java.text.DateFormat;
-import java.time.ZoneId;
-import java.time.format.DateTimeFormatter;
 import java.util.Date;
 
 public class MainActivity extends AppCompatActivity {
@@ -97,8 +95,8 @@ public class MainActivity extends AppCompatActivity {
         Data.profile.addObserver((o, arg) -> {
             MobileLedgerProfile profile = Data.profile.get();
             runOnUiThread(() -> {
-                if (profile == null) toolbar.setSubtitle("");
-                else toolbar.setSubtitle(profile.getName());
+                if (profile == null) setTitle(R.string.app_name);
+                else setTitle(profile.getName());
             });
         });
 
@@ -163,13 +161,9 @@ public class MainActivity extends AppCompatActivity {
                     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 {
-                        tvLastUpdate.setText(DateFormat.getDateTimeInstance().format(date));
-                    }
+                    final String text = DateFormat.getDateTimeInstance().format(date);
+                    tvLastUpdate.setText(text);
+                    Log.d("despair", String.format("Date formatted: %s", text));
                 }
             });
         });
@@ -246,8 +240,6 @@ public class MainActivity extends AppCompatActivity {
             item.setBackgroundColor(getResources().getColor(R.color.table_row_even_bg));
         }
 
-        setTitle(item.getText());
-
         @ColorInt int transparent = getResources().getColor(android.R.color.transparent);
 
         LinearLayout actions = drawer.findViewById(R.id.nav_actions);