X-Git-Url: https://git.ktnx.net/?a=blobdiff_plain;f=app%2Fsrc%2Fmain%2Fjava%2Fnet%2Fktnx%2Fmobileledger%2Fui%2Factivity%2FMainActivity.java;h=21ed55884181b8814a5e8e33fd358f4134e770c5;hb=a5a04fc34d4c885730ecf7a11f77b16055f3491e;hp=3fd2a7c7f1740ea3c552c776273844ad61fe7d09;hpb=ee2c4c516e65741094e37098362a3130988579d9;p=mobile-ledger-staging.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 3fd2a7c7..21ed5588 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 @@ -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 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 newList) { @@ -399,7 +404,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 +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(); } } @@ -458,7 +463,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(); @@ -505,11 +510,6 @@ public class MainActivity extends ProfileThemedActivity { startActivity(intent); overridePendingTransition(R.anim.slide_in_up, R.anim.dummy); } - public void navSettingsClicked(View view) { - Intent intent = new Intent(this, SettingsActivity.class); - startActivity(intent); - drawer.closeDrawers(); - } public void markDrawerItemCurrent(int id) { TextView item = drawer.findViewById(id); item.setBackgroundColor(Colors.tableRowDarkBG);