Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 13a00970 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "After filtering Permissions Hub by permission, make the back button...

Merge "After filtering Permissions Hub by permission, make the back button return to the unfiltered view."
parents 615f6e0d 6165e8f5
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -344,7 +344,7 @@
    <string name="app_permission_usage_filter_label">Filtered by: <xliff:g id="perm" example="Location">%1$s</xliff:g> </string>

    <!-- Label for the text that removes the filter by permission to view all usages [CHAR LIMIT=none] -->
    <string name="app_permission_usage_remove_filter">Remove filter</string>
    <string name="app_permission_usage_remove_filter">See all in Dashboard</string>

    <!-- Label for the title of the dialog allowing filtering by permissions [CHAR LIMIT=none] -->
    <string name="filter_by_title">Filter by</string>
+10 −12
Original line number Diff line number Diff line
@@ -50,6 +50,7 @@ import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.StringRes;
import androidx.fragment.app.DialogFragment;
import androidx.fragment.app.Fragment;
import androidx.preference.PreferenceCategory;
import androidx.preference.PreferenceScreen;

@@ -202,6 +203,8 @@ public class PermissionUsageFragment extends SettingsWithLargeHeader implements
            setProgressBarVisible(true);
        }

        hideHeader();

        reloadData();
    }

@@ -427,7 +430,6 @@ public class PermissionUsageFragment extends SettingsWithLargeHeader implements
        // Update header.
        if (mFilterGroup == null) {
            screen.addPreference(createBarChart(usages, timeFilterItem, context));
            hideHeader();
        } else {
            AppPermissionGroup group = getGroup(mFilterGroup);
            if (group != null) {
@@ -436,9 +438,7 @@ public class PermissionUsageFragment extends SettingsWithLargeHeader implements
                        context.getString(R.string.app_permission_usage_filter_label,
                                group.getLabel()), null, true);
                setSummary(context.getString(R.string.app_permission_usage_remove_filter), v -> {
                    mFilterGroup = null;
                    // We already loaded all data, so don't reload
                    updateUI();
                    onPermissionGroupSelected(null);
                });
            }
        }
@@ -612,11 +612,7 @@ public class PermissionUsageFragment extends SettingsWithLargeHeader implements
            BarViewInfo barViewInfo = new BarViewInfo(icon, count, group.getLabel(),
                    context.getResources().getQuantityString(R.plurals.permission_usage_bar_label,
                            count, count), group.getLabel());
            barViewInfo.setClickListener(v -> {
                mFilterGroup = group.getName();
                // We already loaded all data, so don't reload
                updateUI();
            });
            barViewInfo.setClickListener(v -> onPermissionGroupSelected(group.getName()));
            builder.addBarViewInfo(barViewInfo);
        }

@@ -883,9 +879,11 @@ public class PermissionUsageFragment extends SettingsWithLargeHeader implements
     *                      all entries.
     */
    private void onPermissionGroupSelected(@Nullable String selectedGroup) {
        mFilterGroup = selectedGroup;
        // We already loaded all data, so don't reload
        updateUI();
        Fragment frag = newInstance(selectedGroup, mFilterTimes.get(mFilterTimeIndex).getTime());
        getFragmentManager().beginTransaction()
                .replace(android.R.id.content, frag)
                .addToBackStack("PermissionUsage")
                .commit();
    }

    /**