X-Git-Url: https://git.ktnx.net/?a=blobdiff_plain;f=app%2Fsrc%2Fmain%2Fjava%2Fnet%2Fktnx%2Fmobileledger%2Fui%2Factivity%2FMainActivity.java;h=64d32be4797a45c16249ac77f9b49c8d93467f96;hb=9426344c9fb587ecb12926bd5802baa31c1aad33;hp=da5ac23a83709aafe75af8a358160993925b1d58;hpb=8fdd3749111b279678a472d41b7a7c0538690fdd;p=mobile-ledger.git diff --git a/app/src/main/java/net/ktnx/mobileledger/ui/activity/MainActivity.java b/app/src/main/java/net/ktnx/mobileledger/ui/activity/MainActivity.java index da5ac23a..64d32be4 100644 --- a/app/src/main/java/net/ktnx/mobileledger/ui/activity/MainActivity.java +++ b/app/src/main/java/net/ktnx/mobileledger/ui/activity/MainActivity.java @@ -325,9 +325,13 @@ public class MainActivity extends ProfileThemedActivity { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N_MR1) return; + ShortcutManager sm = getSystemService(ShortcutManager.class); List shortcuts = new ArrayList<>(); int i = 0; for (MobileLedgerProfile p : list) { + if (shortcuts.size() >= sm.getMaxShortcutCountPerActivity()) + break; + if (!p.isPostingPermitted()) continue; @@ -351,7 +355,6 @@ public class MainActivity extends ProfileThemedActivity { shortcuts.add(si); i++; } - ShortcutManager sm = getSystemService(ShortcutManager.class); sm.setDynamicShortcuts(shortcuts); } private void onProfileListChanged(List newList) { @@ -399,7 +402,7 @@ public class MainActivity extends ProfileThemedActivity { mProfileListAdapter.notifyDataSetChanged(); - int newProfileTheme = haveProfile ? profile.getThemeId() : -1; + int newProfileTheme = haveProfile ? profile.getThemeHue() : -1; if (newProfileTheme != Colors.profileThemeId) { debug("profiles", String.format(Locale.ENGLISH, "profile theme %d → %d", Colors.profileThemeId, @@ -426,7 +429,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(); } } @@ -458,7 +461,7 @@ public class MainActivity extends ProfileThemedActivity { Bundle bundle = new Bundle(); onSaveInstanceState(bundle); - storeThemeIdInPrefs(profile.getThemeId()); + storeThemeIdInPrefs(profile.getThemeHue()); // restart activity to reflect theme change finish();