Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "Solution for #162" #176

Merged
merged 4 commits into from
Apr 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand All @@ -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) -> {
Expand All @@ -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()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;


}

This file was deleted.