From 09c432414fa98b287d7f98137855bcd859eee6be Mon Sep 17 00:00:00 2001 From: stom79 Date: Sun, 16 Dec 2018 15:11:58 +0100 Subject: [PATCH] Some fixes --- .../etalab/mastodon/activities/BaseMainActivity.java | 4 ++-- .../etalab/mastodon/fragments/SettingsFragment.java | 10 +++++----- .../java/fr/gouv/etalab/mastodon/helper/Helper.java | 11 +---------- 3 files changed, 8 insertions(+), 17 deletions(-) diff --git a/app/src/main/java/fr/gouv/etalab/mastodon/activities/BaseMainActivity.java b/app/src/main/java/fr/gouv/etalab/mastodon/activities/BaseMainActivity.java index 1ff2dd7f2..77d8d4088 100644 --- a/app/src/main/java/fr/gouv/etalab/mastodon/activities/BaseMainActivity.java +++ b/app/src/main/java/fr/gouv/etalab/mastodon/activities/BaseMainActivity.java @@ -147,7 +147,7 @@ import fr.gouv.etalab.mastodon.sqlite.Sqlite; import static fr.gouv.etalab.mastodon.asynctasks.ManageFiltersAsyncTask.action.GET_ALL_FILTER; import static fr.gouv.etalab.mastodon.helper.Helper.ADD_USER_INTENT; import static fr.gouv.etalab.mastodon.helper.Helper.BACKUP_INTENT; -import static fr.gouv.etalab.mastodon.helper.Helper.CHANGE_THEME_INTENT; +import static fr.gouv.etalab.mastodon.helper.Helper.BACK_TO_SETTINGS; import static fr.gouv.etalab.mastodon.helper.Helper.CHANGE_USER_INTENT; import static fr.gouv.etalab.mastodon.helper.Helper.EXTERNAL_STORAGE_REQUEST_CODE; import static fr.gouv.etalab.mastodon.helper.Helper.HOME_TIMELINE_INTENT; @@ -1825,7 +1825,7 @@ public abstract class BaseMainActivity extends BaseActivity toolbarTitle.setText(instance); }else if( extras.getInt(INTENT_ACTION) == HOME_TIMELINE_INTENT){ changeUser(BaseMainActivity.this, userIdIntent, true); //Connects the account which is related to the notification - }else if( extras.getInt(INTENT_ACTION) == CHANGE_THEME_INTENT){ + }else if( extras.getInt(INTENT_ACTION) == BACK_TO_SETTINGS){ unCheckAllMenuItems(navigationView); navigationView.setCheckedItem(R.id.nav_settings); navigationView.getMenu().performIdentifierAction(R.id.nav_settings, 0); diff --git a/app/src/main/java/fr/gouv/etalab/mastodon/fragments/SettingsFragment.java b/app/src/main/java/fr/gouv/etalab/mastodon/fragments/SettingsFragment.java index 2d06196de..8a35c0a1c 100644 --- a/app/src/main/java/fr/gouv/etalab/mastodon/fragments/SettingsFragment.java +++ b/app/src/main/java/fr/gouv/etalab/mastodon/fragments/SettingsFragment.java @@ -63,7 +63,7 @@ import fr.gouv.etalab.mastodon.sqlite.AccountDAO; import fr.gouv.etalab.mastodon.sqlite.Sqlite; import static android.app.Activity.RESULT_OK; -import static fr.gouv.etalab.mastodon.helper.Helper.CHANGE_THEME_INTENT; +import static fr.gouv.etalab.mastodon.helper.Helper.BACK_TO_SETTINGS; import static fr.gouv.etalab.mastodon.helper.Helper.INTENT_ACTION; import static fr.gouv.etalab.mastodon.helper.Helper.SET_YANDEX_API_KEY; import static fr.gouv.etalab.mastodon.helper.Helper.changeDrawableColor; @@ -404,7 +404,7 @@ public class SettingsFragment extends Fragment { if( getActivity() != null) getActivity().recreate(); Intent intent = new Intent(context, MainActivity.class); - intent.putExtra(INTENT_ACTION, CHANGE_THEME_INTENT); + intent.putExtra(INTENT_ACTION, BACK_TO_SETTINGS); if(getActivity() != null) getActivity().finish(); startActivity(intent); @@ -425,7 +425,7 @@ public class SettingsFragment extends Fragment { if( getActivity() != null) getActivity().recreate(); Intent intent = new Intent(context, MainActivity.class); - intent.putExtra(INTENT_ACTION, CHANGE_THEME_INTENT); + intent.putExtra(INTENT_ACTION, BACK_TO_SETTINGS); if(getActivity() != null) getActivity().finish(); startActivity(intent); @@ -624,7 +624,7 @@ public class SettingsFragment extends Fragment { if (getActivity() != null) getActivity().recreate(); Intent intent = new Intent(context, MainActivity.class); - intent.putExtra(INTENT_ACTION, CHANGE_THEME_INTENT); + intent.putExtra(INTENT_ACTION, BACK_TO_SETTINGS); startActivity(intent); } count1++; @@ -955,7 +955,7 @@ public class SettingsFragment extends Fragment { if( getActivity() != null) getActivity().recreate(); Intent intent = new Intent(context, MainActivity.class); - intent.putExtra(INTENT_ACTION, CHANGE_THEME_INTENT); + intent.putExtra(INTENT_ACTION, BACK_TO_SETTINGS); startActivity(intent); } count3++; diff --git a/app/src/main/java/fr/gouv/etalab/mastodon/helper/Helper.java b/app/src/main/java/fr/gouv/etalab/mastodon/helper/Helper.java index 504742f10..fa8b741a4 100644 --- a/app/src/main/java/fr/gouv/etalab/mastodon/helper/Helper.java +++ b/app/src/main/java/fr/gouv/etalab/mastodon/helper/Helper.java @@ -239,7 +239,7 @@ public class Helper { //Notifications public static final int NOTIFICATION_INTENT = 1; public static final int HOME_TIMELINE_INTENT = 2; - public static final int CHANGE_THEME_INTENT = 3; + public static final int BACK_TO_SETTINGS = 3; public static final int CHANGE_USER_INTENT = 4; public static final int ADD_USER_INTENT = 5; public static final int BACKUP_INTENT = 6; @@ -1447,9 +1447,6 @@ public class Helper { editor.putInt(Helper.SET_THEME, Helper.THEME_LIGHT); editor.apply(); activity.recreate(); - Intent intent = new Intent(activity, MainActivity.class); - activity.finish(); - activity.startActivity(intent); } }); buttonDark.setOnClickListener(new View.OnClickListener() { @@ -1460,9 +1457,6 @@ public class Helper { editor.putInt(Helper.SET_THEME, Helper.THEME_DARK); editor.apply(); activity.recreate(); - Intent intent = new Intent(activity, MainActivity.class); - activity.finish(); - activity.startActivity(intent); } }); buttonBlack.setOnClickListener(new View.OnClickListener() { @@ -1473,9 +1467,6 @@ public class Helper { editor.putInt(Helper.SET_THEME, Helper.THEME_BLACK); editor.apply(); activity.recreate(); - Intent intent = new Intent(activity, MainActivity.class); - activity.finish(); - activity.startActivity(intent); } });