From 7dd231ee957d36d694c5509efe5d5fa989709e26 Mon Sep 17 00:00:00 2001 From: M M Arif Date: Wed, 12 Aug 2020 09:31:39 +0200 Subject: [PATCH] Set notifications as home srceen (#644) --- .../org/mian/gitnex/activities/MainActivity.java | 14 ++++++++++++++ .../activities/SettingsAppearanceActivity.java | 7 +++++++ 2 files changed, 21 insertions(+) diff --git a/app/src/main/java/org/mian/gitnex/activities/MainActivity.java b/app/src/main/java/org/mian/gitnex/activities/MainActivity.java index da65e6f9..4dcb7645 100644 --- a/app/src/main/java/org/mian/gitnex/activities/MainActivity.java +++ b/app/src/main/java/org/mian/gitnex/activities/MainActivity.java @@ -319,6 +319,14 @@ public class MainActivity extends BaseActivity implements NavigationView.OnNavig if(savedInstanceState == null) { + if(!new Version(tinyDb.getString("giteaVersion")).higherOrEqual("1.12.3")) { + + if(tinyDb.getInt("homeScreenId") == 7) { + + tinyDb.putInt("homeScreenId", 0); + } + } + switch(tinyDb.getInt("homeScreenId")) { case 1: @@ -357,6 +365,12 @@ public class MainActivity extends BaseActivity implements NavigationView.OnNavig navigationView.setCheckedItem(R.id.nav_comments_draft); break; + case 7: + toolbarTitle.setText(getResources().getString(R.string.pageTitleNotifications)); + getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container, new NotificationsFragment()).commit(); + navigationView.setCheckedItem(R.id.nav_notifications); + break; + default: toolbarTitle.setText(getResources().getString(R.string.pageTitleMyRepos)); getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container, new MyRepositoriesFragment()).commit(); diff --git a/app/src/main/java/org/mian/gitnex/activities/SettingsAppearanceActivity.java b/app/src/main/java/org/mian/gitnex/activities/SettingsAppearanceActivity.java index 20653cee..e763a23b 100644 --- a/app/src/main/java/org/mian/gitnex/activities/SettingsAppearanceActivity.java +++ b/app/src/main/java/org/mian/gitnex/activities/SettingsAppearanceActivity.java @@ -11,6 +11,7 @@ import androidx.appcompat.app.AlertDialog; import org.mian.gitnex.R; import org.mian.gitnex.helpers.TinyDB; import org.mian.gitnex.helpers.Toasty; +import org.mian.gitnex.helpers.Version; /** * Author M M Arif @@ -28,6 +29,7 @@ public class SettingsAppearanceActivity extends BaseActivity { private static int codeBlockSelectedChoice = 0; private static String[] homeScreenList = {"My Repositories", "Starred Repositories", "Organizations", "Repositories", "Profile", "Explore", "Drafts"}; + private static String[] homeScreenListNew = {"My Repositories", "Starred Repositories", "Organizations", "Repositories", "Profile", "Explore", "Drafts", "Notifications"}; private static int homeScreenSelectedChoice = 0; private static String[] customFontList = {"Roboto", "Manrope", "Source Code Pro"}; @@ -69,6 +71,11 @@ public class SettingsAppearanceActivity extends BaseActivity { initCloseListener(); closeActivity.setOnClickListener(onClickListener); + if(new Version(tinyDb.getString("giteaVersion")).higherOrEqual("1.12.3")) { + + homeScreenList = homeScreenListNew; + } + if(!tinyDb.getString("timeStr").isEmpty()) { tvDateTimeSelected.setText(tinyDb.getString("timeStr")); }