mirror of
https://github.com/whyorean/AuroraStore.git
synced 2026-06-19 04:58:47 -04:00
AppList : Remove duplicate search results due to ads
This commit is contained in:
@@ -45,7 +45,9 @@ import com.bumptech.glide.load.resource.drawable.DrawableTransitionOptions;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
@@ -95,6 +97,9 @@ public class InstalledAppsAdapter extends RecyclerView.Adapter<InstalledAppsAdap
|
||||
public void addData(List<App> appList) {
|
||||
this.appList.clear();
|
||||
this.appList = appList;
|
||||
final Set<App> appSet = new LinkedHashSet<>(appList);
|
||||
appList.clear();
|
||||
appList.addAll(appSet);
|
||||
if (listType == ListType.INSTALLED || listType == ListType.UPDATES)
|
||||
Collections.sort(appList, (App1, App2) ->
|
||||
App1.getDisplayName().compareToIgnoreCase(App2.getDisplayName()));
|
||||
|
||||
@@ -410,6 +410,19 @@ public class App implements Comparable<App> {
|
||||
return getDisplayName().compareToIgnoreCase(o.getDisplayName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (!(obj instanceof App))
|
||||
return false;
|
||||
|
||||
return getPackageName().equals(((App) obj).getPackageName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return (getPackageName().isEmpty()) ? 0 : getPackageName().hashCode();
|
||||
}
|
||||
|
||||
public enum Restriction {
|
||||
|
||||
GENERIC(-1),
|
||||
|
||||
Reference in New Issue
Block a user