Skip to content

Commit

Permalink
Sorted apps
Browse files Browse the repository at this point in the history
  • Loading branch information
patri9ck committed Dec 14, 2022
1 parent 1485446 commit c361852
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions app/src/main/java/dev/patri9ck/a2ln/app/AppsFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import android.content.Context;
import android.content.SharedPreferences;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.os.Bundle;
import android.view.LayoutInflater;
Expand All @@ -28,6 +29,7 @@
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.LinearLayoutManager;

import java.util.Comparator;
import java.util.List;
import java.util.concurrent.CompletableFuture;
import java.util.stream.Collectors;
Expand Down Expand Up @@ -94,6 +96,7 @@ private void loadAppsRecyclerView() {
.stream()
.filter(applicationInfo -> packageManager.getLaunchIntentForPackage(applicationInfo.packageName) != null)
.map(applicationInfo -> new App(applicationInfo.loadLabel(packageManager).toString(), applicationInfo.packageName, applicationInfo.loadIcon(packageManager), !disabledApps.contains(applicationInfo.packageName)))
.sorted(Comparator.comparing(App::isEnabled).thenComparing(App::getName))
.collect(Collectors.toList()))
.thenAccept(apps -> requireActivity().runOnUiThread(() -> {
fragmentAppsBinding.loadingProgressIndicator.setVisibility(View.INVISIBLE);
Expand Down

0 comments on commit c361852

Please sign in to comment.