Notification Improvements

- add MediaStyle notifications for Background and Popup playback
- reduce excessive notification updating ( / recreating of Notification.Builder object) when playing background / popup media
- add new buffering state indicator (can be disabled)
- upscale close icon / downscale replay icon
- add notification slot settings
- move notification settings to appearance
- fix Metadata (song title, artist and album art) sometimes not being set correctly
- other misc notification fixes

Co-authored-by: wb9688 <wb9688@users.noreply.github.com>
This commit is contained in:
cool-student 2020-03-03 00:35:44 +01:00 committed by wb9688
parent 917e5959b6
commit dc4a37b37e
19 changed files with 2025 additions and 481 deletions

View file

@ -11,6 +11,7 @@ import androidx.annotation.Nullable;
import androidx.preference.Preference;
import org.schabi.newpipe.R;
import org.schabi.newpipe.player.NotificationUtil;
import org.schabi.newpipe.util.Constants;
public class AppearanceSettingsFragment extends BasePreferenceFragment {
@ -52,8 +53,22 @@ public class AppearanceSettingsFragment extends BasePreferenceFragment {
final Preference captionSettings = findPreference(captionSettingsKey);
getPreferenceScreen().removePreference(captionSettings);
}
findPreference(getString(R.string.enable_old_notifications_key))
.setOnPreferenceChangeListener(oldNotificationsOnPreferenceChangeListener);
}
private Preference.OnPreferenceChangeListener oldNotificationsOnPreferenceChangeListener
= (preference, newValue) -> {
// NotificationUtil.getInstance().toast(getContext(),
// "Killed background / popup player notification(s) !");
NotificationUtil.getInstance()
.cancelNotification(NotificationUtil.NOTIFICATION_ID_BACKGROUND);
NotificationUtil.getInstance().cancelNotification(NotificationUtil.NOTIFICATION_ID_POPUP);
return true;
};
@Override
public void onCreatePreferences(final Bundle savedInstanceState, final String rootKey) {
addPreferencesFromResource(R.xml.appearance_settings);