Skip to content
This repository has been archived by the owner on Oct 26, 2024. It is now read-only.

Commit

Permalink
comments
Browse files Browse the repository at this point in the history
  • Loading branch information
LisoUseInAIKyrios committed Feb 19, 2024
1 parent 7f9cf00 commit 9e17c23
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions app/src/main/java/app/revanced/integrations/shared/Utils.java
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ public static void hideViewUnderCondition(BooleanSetting condition, View view) {
view.setVisibility(View.GONE);
}


/**
* General purpose pool for network calls and other background tasks.
* All tasks run at max thread priority.
Expand Down Expand Up @@ -403,7 +402,7 @@ public static void hideViewByLayoutParams(View view) {
}

/**
* PreferenceScreen and Group sorting styles.
* {@link PreferenceScreen} and {@link PreferenceGroup} sorting styles.
*/
private enum SortStyle {
/**
Expand All @@ -415,7 +414,7 @@ private enum SortStyle {
*/
KEY("_sort_key"),
/**
* Leaves everything unsorted, and retain the order created during patching.
* Keep everything unsorted, and retain the original preference order created during patching.
*/
UNSORTED("_sort_ignore");

Expand All @@ -426,7 +425,7 @@ private enum SortStyle {
}

/**
* Defaults to {@link #TITLE} if the key does not match.
* Defaults to {@link #TITLE} if key is null or has no sort suffix.
*/
@NonNull
static SortStyle sortForSuffix(@Nullable String key) {
Expand All @@ -452,12 +451,14 @@ public static String removePunctuationConvertToLowercase(@Nullable CharSequence
}

/**
* Sort the a PreferenceGroup based by either title, by key, or to retain the original order,
* based on the suffix of the key.
* Sort a PreferenceGroup and all it's sub groups, by either title, key.
*
* Sort order is determined by the preference key SortStyle suffix.
*
* If no suffix key is present, then the preferences are sorted by title.
* If a preference has no key or no SortStyle suffix,
* then the preferences are sorted by the localized title.
*/
public static void sortPreferenceGroups(PreferenceGroup group) {
public static void sortPreferenceGroups(@NonNull PreferenceGroup group) {
SortStyle sortToUse = SortStyle.sortForSuffix(group.getKey());

SortedMap<String, Preference> preferences = new TreeMap<>();
Expand Down

0 comments on commit 9e17c23

Please sign in to comment.