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

Commit 2194f3db authored by Julia Reynolds's avatar Julia Reynolds
Browse files

Display channel/group names only.

Test: manual
Change-Id: I7da68f71ddb78f3150ebc64af40310de65cd010c
parent 8ba1bf34
Loading
Loading
Loading
Loading
+7 −7
Original line number Diff line number Diff line
@@ -145,7 +145,7 @@ public class AppNotificationSettings extends NotificationSettingsBase {
                            ? R.string.notification_channels_other
                            : R.string.notification_channels);
                } else {
                    groupCategory.setTitle(getNotificationGroupLabel(group));
                    groupCategory.setTitle(group.getName());
                }
                groupCategory.setKey(group.getId());
                groupCategory.setOrderingAsAdded(true);
@@ -161,13 +161,13 @@ public class AppNotificationSettings extends NotificationSettingsBase {
                            getPrefContext());
                    channelPref.setDisabledByAdmin(mSuspendedAppsAdmin);
                    channelPref.setKey(channel.getId());
                    channelPref.setTitle(getNotificationChannelLabel(channel));
                    channelPref.setTitle(channel.getName());
                    channelPref.setChecked(channel.getImportance() != IMPORTANCE_NONE);
                    channelPref.setMultiLine(true);

                    if (channel.isDeleted()) {
                        channelPref.setTitle(getString(R.string.deleted_channel_name,
                                getNotificationChannelLabel(channel)));
                                channel.getName()));
                        channelPref.setEnabled(false);
                    } else {
                        channelPref.setSummary(getImportanceSummary(channel.getImportance()));
@@ -257,8 +257,8 @@ public class AppNotificationSettings extends NotificationSettingsBase {
            if (left.isDeleted() != right.isDeleted()) {
                return Boolean.compare(left.isDeleted(), right.isDeleted());
            }
            CharSequence leftName = getNotificationChannelLabel(left);
            CharSequence rightName = getNotificationChannelLabel(right);
            CharSequence leftName = left.getName();
            CharSequence rightName = right.getName();
            if (!Objects.equals(leftName, rightName)) {
                return sCollator.compare(leftName.toString(), rightName.toString());
            }
@@ -278,8 +278,8 @@ public class AppNotificationSettings extends NotificationSettingsBase {
                    } else if (right.getId() == null && left.getId() != null) {
                        return -1;
                    }
                    CharSequence leftName = getNotificationGroupLabel(left);
                    CharSequence rightName = getNotificationGroupLabel(right);
                    CharSequence leftName = left.getName();
                    CharSequence rightName = right.getName();
                    // sort rest of the groups by name
                    if (!Objects.equals(leftName, rightName)) {
                        return sCollator.compare(leftName.toString(), rightName.toString());
+1 −1
Original line number Diff line number Diff line
@@ -113,7 +113,7 @@ public class ChannelNotificationSettings extends NotificationSettingsBase {
            .getApplicationFeatureProvider(activity)
            .newAppHeaderController(this /* fragment */, null /* appHeader */)
            .setIcon(mAppRow.icon)
            .setLabel(getNotificationChannelLabel(mChannel))
            .setLabel(mChannel.getName())
            .setSummary(mAppRow.label)
            .setPackageName(mAppRow.pkg)
            .setUid(mAppRow.uid)
+0 −21
Original line number Diff line number Diff line
@@ -251,25 +251,4 @@ abstract public class NotificationSettingsBase extends SettingsPreferenceFragmen
                return getContext().getString(R.string.notification_importance_high);
        }
    }

    protected CharSequence getNotificationGroupLabel(NotificationChannelGroup group) {
        return getLabel(group.getName(), group.getNameResId());
    }

    protected CharSequence getNotificationChannelLabel(NotificationChannel channel) {
        return getLabel(channel.getName(), channel.getNameResId());
    }

    private CharSequence getLabel(CharSequence name, int nameResId) {
        if (!TextUtils.isEmpty(name)) {
            return name;
        }
        try {
            ApplicationInfo info = mPm.getApplicationInfoAsUser(mAppRow.pkg, 0, mAppRow.userId);
            return mPm.getText(mAppRow.pkg, nameResId, info);
        } catch (NameNotFoundException e) {
            e.printStackTrace();
        }
        return null;
    }
}