diff --git a/app/src/main/java/io/github/subhamtyagi/lastlauncher/LauncherActivity.java b/app/src/main/java/io/github/subhamtyagi/lastlauncher/LauncherActivity.java index eef5f096..e9a11865 100644 --- a/app/src/main/java/io/github/subhamtyagi/lastlauncher/LauncherActivity.java +++ b/app/src/main/java/io/github/subhamtyagi/lastlauncher/LauncherActivity.java @@ -1291,12 +1291,6 @@ protected void onPostExecute(Void aVoid) { } - /**So this is where you sort your apps. - * We modified this method so that when the first sorting condition fails, it can sort by the frequency of use, which makes it easier for users to find the app they want to use. - * - * @param integers - * @return - */ @Override protected Void doInBackground(final Integer... integers) { final int type = integers[0]; @@ -1310,24 +1304,10 @@ protected Void doInBackground(final Integer... integers) { switch (type) { case SORT_BY_SIZE://descending - Collections.sort(mAppsList, (apps, t1) -> { - //CS304 Issue link: https://github.com/SubhamTyagi/Last-Launcher/issues/162 - if (apps.getSize() != t1.getSize()) { - return t1.getSize() - apps.getSize(); - } else { - return -t1.getRecentUsedWeight() + apps.getRecentUsedWeight(); - } - }); + Collections.sort(mAppsList, (apps, t1) -> (t1.getSize() - apps.getSize())); break; case SORT_BY_OPENING_COUNTS://descending - Collections.sort(mAppsList, (apps, t1) -> { - //CS304 Issue link: https://github.com/SubhamTyagi/Last-Launcher/issues/162 - if (t1.getOpeningCounts() != apps.getOpeningCounts()) { - return t1.getOpeningCounts() - apps.getOpeningCounts(); - }else { - return -t1.getRecentUsedWeight() + apps.getRecentUsedWeight(); - } - }); + Collections.sort(mAppsList, (apps, t1) -> t1.getOpeningCounts() - apps.getOpeningCounts()); break; case SORT_BY_COLOR: Collections.sort(mAppsList, (apps, t1) -> { @@ -1340,19 +1320,11 @@ protected Void doInBackground(final Integer... integers) { return (hsv[i] < another[i]) ? -1 : 1; } } - //CS304 Issue link: https://github.com/SubhamTyagi/Last-Launcher/issues/162 - return -t1.getRecentUsedWeight() + apps.getRecentUsedWeight(); + return 0; }); break; case SORT_BY_UPDATE_TIME://descending - Collections.sort(mAppsList, (apps, t1) -> { - //CS304 Issue link: https://github.com/SubhamTyagi/Last-Launcher/issues/162 - if (t1.getUpdateTime()!=apps.getUpdateTime()){ - return t1.getUpdateTime() - apps.getUpdateTime(); - }else { - return -t1.getRecentUsedWeight() + apps.getRecentUsedWeight(); - } - }); + Collections.sort(mAppsList, (apps, t1) -> t1.getUpdateTime() - apps.getUpdateTime()); break; case SORT_BY_RECENT_OPEN://descending Collections.sort(mAppsList, (apps, t1) -> (t1.getRecentUsedWeight() - apps.getRecentUsedWeight())); 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 2c2b114f..d5af5435 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,11 +169,6 @@ 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 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 b07821b3..23a4a47f 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 @@ -47,8 +47,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/test/java/io/github/subhamtyagi/lastlauncher/utils/ConstantsTest.java b/app/src/test/java/io/github/subhamtyagi/lastlauncher/utils/ConstantsTest.java deleted file mode 100644 index 853f0c71..00000000 --- a/app/src/test/java/io/github/subhamtyagi/lastlauncher/utils/ConstantsTest.java +++ /dev/null @@ -1,27 +0,0 @@ -package io.github.subhamtyagi.lastlauncher.utils; - -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; - -public class ConstantsTest { - - private Constants constantsUnderTest; - - @Before - public void setUp() { - constantsUnderTest = new Constants(); - } - - //CS304 Issue link: https://github.com/SubhamTyagi/Last-Launcher/issues/162 - @Test - public void testSortByName() { - Assert.assertEquals(Constants.SORT_BY_NAME, 1); - } - - //CS304 Issue link: https://github.com/SubhamTyagi/Last-Launcher/issues/162 - @Test - public void testSortBySize() { - Assert.assertEquals(Constants.SORT_BY_SIZE, 2); - } -}