]> git.ktnx.net Git - mobile-ledger.git/blobdiff - app/src/main/java/net/ktnx/mobileledger/ui/activity/MainActivity.java
add a copy of the navigation drawer header to the welcome screen
[mobile-ledger.git] / app / src / main / java / net / ktnx / mobileledger / ui / activity / MainActivity.java
index 876f8da8c4e60f8f411f4eeba803ba3b5fdbac03..21ed55884181b8814a5e8e33fd358f4134e770c5 100644 (file)
@@ -185,12 +185,14 @@ public class MainActivity extends ProfileThemedActivity {
         }
         barDrawerToggle.syncState();
 
-        TextView ver = drawer.findViewById(R.id.drawer_version_text);
 
         try {
             PackageInfo pi = getApplicationContext().getPackageManager()
                                                     .getPackageInfo(getPackageName(), 0);
-            ver.setText(pi.versionName);
+            ((TextView) findViewById(R.id.nav_upper).findViewById(
+                    R.id.drawer_version_text)).setText(pi.versionName);
+            ((TextView) findViewById(R.id.no_profiles_layout).findViewById(
+                    R.id.drawer_version_text)).setText(pi.versionName);
         }
         catch (Exception e) {
             e.printStackTrace();
@@ -325,9 +327,13 @@ public class MainActivity extends ProfileThemedActivity {
         if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N_MR1)
             return;
 
+        ShortcutManager sm = getSystemService(ShortcutManager.class);
         List<ShortcutInfo> shortcuts = new ArrayList<>();
         int i = 0;
         for (MobileLedgerProfile p : list) {
+            if (shortcuts.size() >= sm.getMaxShortcutCountPerActivity())
+                break;
+
             if (!p.isPostingPermitted())
                 continue;
 
@@ -351,7 +357,6 @@ public class MainActivity extends ProfileThemedActivity {
             shortcuts.add(si);
             i++;
         }
-        ShortcutManager sm = getSystemService(ShortcutManager.class);
         sm.setDynamicShortcuts(shortcuts);
     }
     private void onProfileListChanged(List<MobileLedgerProfile> newList) {
@@ -426,7 +431,7 @@ public class MainActivity extends ProfileThemedActivity {
                 fab.show();
             }
             else {
-                mToolbar.setSubtitle(R.string.profile_subitlte_read_only);
+                mToolbar.setSubtitle(R.string.profile_subtitle_read_only);
                 fab.hide();
             }
         }