From 8101d7468de000327525b187501f21319c53abbe Mon Sep 17 00:00:00 2001 From: TIANGeng708 <1012721175@qq.com> Date: Sat, 23 Apr 2022 16:31:58 +0800 Subject: [PATCH] bug --- .../dialogs/GlobalSettingsDialog.java | 13 +++- .../lastlauncher/utils/Constants.java | 6 +- app/src/main/res/menu/sort_apps_popups.xml | 8 ++- app/src/main/res/values-zh-rCN/strings.xml | 1 + app/src/main/res/values/strings.xml | 2 + .../lastlauncher/LauncherActivityTest.java | 68 +++++++++++++++++++ .../lastlauncher/utils/ConstantsTest.java | 23 +++++++ 7 files changed, 115 insertions(+), 6 deletions(-) create mode 100644 app/src/test/java/io/github/subhamtyagi/lastlauncher/LauncherActivityTest.java create mode 100644 app/src/test/java/io/github/subhamtyagi/lastlauncher/utils/ConstantsTest.java diff --git a/app/src/main/java/io/github/subhamtyagi/lastlauncher/dialogs/GlobalSettingsDialog.java b/app/src/main/java/io/github/subhamtyagi/lastlauncher/dialogs/GlobalSettingsDialog.java index d5af5435..3a3b0f9d 100644 --- a/app/src/main/java/io/github/subhamtyagi/lastlauncher/dialogs/GlobalSettingsDialog.java +++ b/app/src/main/java/io/github/subhamtyagi/lastlauncher/dialogs/GlobalSettingsDialog.java @@ -169,6 +169,11 @@ public void onClick(View view) { } } + /**This method is used to control the order of apps. + * The code block we added is to give the newly added buttons the ability to sort them by name. + * + * @param view + */ private void sortApps(View view) { Context context; // set theme @@ -184,8 +189,12 @@ private void sortApps(View view) { popupMenu.setOnMenuItemClickListener(menuItem -> { cancel(); switch (menuItem.getItemId()) { - case R.id.menu_sort_by_name: - launcherActivity.sortApps(Constants.SORT_BY_NAME); +// case R.id.menu_sort_by_name: +// launcherActivity.sortApps(Constants.SORT_BY_NAME); +// break; + //CS304 Issue link: https://github.com/SubhamTyagi/Last-Launcher/issues/165 + case R.id.menu_sort_by_name_modify: + launcherActivity.sortApps(Constants.SORT_BY_NAME_MODIFY); break; case R.id.menu_sort_by_opening_counts: launcherActivity.sortApps(Constants.SORT_BY_OPENING_COUNTS); diff --git a/app/src/main/java/io/github/subhamtyagi/lastlauncher/utils/Constants.java b/app/src/main/java/io/github/subhamtyagi/lastlauncher/utils/Constants.java index 23a4a47f..96c5bfe5 100644 --- a/app/src/main/java/io/github/subhamtyagi/lastlauncher/utils/Constants.java +++ b/app/src/main/java/io/github/subhamtyagi/lastlauncher/utils/Constants.java @@ -32,6 +32,8 @@ public class Constants { public static final int SORT_BY_CUSTOM = 5; public static final int SORT_BY_UPDATE_TIME = 6; public static final int SORT_BY_RECENT_OPEN = 7; + //CS304 Issue link: https://github.com/SubhamTyagi/Last-Launcher/issues/165 + public static final int SORT_BY_NAME_MODIFY = 1; public static final int RESTORE_REQUEST = 125; public static final int FONTS_REQUEST = 126; @@ -47,8 +49,8 @@ public class Constants { public static int dynamicHeight = 20; public static final int DEFAULT_TEXT_SIZE_NORMAL_APPS = dynamicHeight; public static final int DEFAULT_TEXT_SIZE_OFTEN_APPS = dynamicHeight * 9 / 5; - public static final int MAX_TEXT_SIZE_FOR_APPS=90; - public static final int MIN_TEXT_SIZE_FOR_APPS=14; + public static final int MAX_TEXT_SIZE_FOR_APPS = 90; + public static final int MIN_TEXT_SIZE_FOR_APPS = 14; } diff --git a/app/src/main/res/menu/sort_apps_popups.xml b/app/src/main/res/menu/sort_apps_popups.xml index dcb155c1..d5d95068 100644 --- a/app/src/main/res/menu/sort_apps_popups.xml +++ b/app/src/main/res/menu/sort_apps_popups.xml @@ -19,8 +19,12 @@