Show localized channel names

Test: manual
Change-Id: I85d60e564aeff8074cdb8138fe7ac1c078be986a
This commit is contained in:
Julia Reynolds
2017-03-01 16:59:10 -05:00
parent 6d3947e2c1
commit 3327eac198
4 changed files with 21 additions and 10 deletions

View File

@@ -248,4 +248,17 @@ abstract public class NotificationSettingsBase extends SettingsPreferenceFragmen
return getContext().getString(R.string.notification_importance_high);
}
}
protected CharSequence getNotificationChannelLabel(NotificationChannel channel) {
if (channel.getName() != null) {
return channel.getName();
}
try {
ApplicationInfo info = mPm.getApplicationInfoAsUser(mAppRow.pkg, 0, mAppRow.userId);
return mPm.getText(mAppRow.pkg, channel.getNameResId(), info);
} catch (NameNotFoundException e) {
e.printStackTrace();
}
return null;
}
}