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

Added sort by installer app #1255

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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 @@ -117,6 +117,9 @@ public class App implements Serializable {
@ColumnInfo(name = "last_action_time", defaultValue = "0")
public long lastActionTime;

@ColumnInfo(name = "installer_app", defaultValue = "")
public String installerApp;

public boolean isSystemApp() {
return (flags & ApplicationInfo.FLAG_SYSTEM) != 0;
}
Expand Down Expand Up @@ -150,6 +153,7 @@ public static App fromPackageInfo(@NonNull Context context, @NonNull PackageInfo
app.rulesCount = 0;
app.trackerCount = ComponentUtils.getTrackerComponentsForPackage(packageInfo).size();
app.lastActionTime = System.currentTimeMillis();
app.installerApp = applicationInfo.installerApp;
return app;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ public class MainListOptions extends ListOptions {
SORT_BY_OPEN_COUNT,
SORT_BY_SCREEN_TIME,
SORT_BY_LAST_USAGE_TIME,
SORT_BY_INSTALLER_APP
})
@Retention(RetentionPolicy.SOURCE)
public @interface SortOrder {
Expand All @@ -75,6 +76,7 @@ public class MainListOptions extends ListOptions {
public static final int SORT_BY_OPEN_COUNT = 15;
public static final int SORT_BY_SCREEN_TIME = 16;
public static final int SORT_BY_LAST_USAGE_TIME = 17;
public static final int SORT_BY_INSTALLER_APP = 18;

@IntDef(flag = true, value = {
FILTER_NO_FILTER,
Expand Down Expand Up @@ -226,6 +228,7 @@ public LinkedHashMap<Integer, Integer> getSortIdLocaleMap() {
put(SORT_BY_TRACKERS, R.string.trackers);
put(SORT_BY_LAST_ACTION, R.string.last_actions);
put(SORT_BY_INSTALLATION_DATE, R.string.sort_by_installation_date);
put(SORT_BY_INSTALLER_APP, R.string.sort_by_installer_app);
if (FeatureController.isUsageAccessEnabled()) {
put(SORT_BY_TOTAL_SIZE, R.string.sort_by_total_size);
put(SORT_BY_DATA_USAGE, R.string.sort_by_data_usage);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -581,6 +581,8 @@ private void sortApplicationList(@MainListOptions.SortOrder int sortBy, boolean
return -mode * o1.lastActionTime.compareTo(o2.lastActionTime);
case MainListOptions.SORT_BY_TRACKERS:
return -mode * o1.trackerCount.compareTo(o2.trackerCount);
case MainListOptions.SORT_BY_INSTALLER_APP:
return mode * o1.installerApp.compareTo(o2.installerApp);
}
return 0;
});
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1193,6 +1193,7 @@
<string name="regenerate_auth_key_warning">Are you sure? All the third-party apps have to be reconfigured with the new authorization key.</string>
<string name="shortcut_icon">Shortcut Icon</string>
<string name="sort_by_installation_date">Installation date</string>
<string name="sort_by_installer_app">Installer app</string>
<string name="backup_volume_unavailable_warning">The selected backup volume is not currently available. If it is located in an external storage, please insert it, or change the backup volume.</string>
<string name="change_backup_volume">Change volume</string>
<string name="external">External</string>
Expand Down