[Cleanup] Code Cleanup, Removed some unused methods

This commit is contained in:
Prathamesh More 2021-11-28 22:25:18 +05:30
parent 3df5a77ee8
commit 6ae4c3cae4
32 changed files with 122 additions and 301 deletions

View file

@ -75,6 +75,7 @@ import java.util.List;
import java.util.Objects;
import java.util.Random;
import code.name.monkey.appthemehelper.util.VersionUtils;
import code.name.monkey.retromusic.R;
import code.name.monkey.retromusic.activities.LockScreenActivity;
import code.name.monkey.retromusic.appwidgets.AppWidgetBig;
@ -1155,7 +1156,7 @@ public class MusicService extends MediaBrowserServiceCompat
playback.setNextDataSource(getTrackUri(Objects.requireNonNull(getSongAt(nextPosition))));
}
this.nextPosition = nextPosition;
} catch (Exception e) {
} catch (Exception ignored) {
}
}
}
@ -1591,11 +1592,8 @@ public class MusicService extends MediaBrowserServiceCompat
mediaButtonIntent.setComponent(mediaButtonReceiverComponentName);
PendingIntent mediaButtonReceiverPendingIntent;
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.S) {
mediaButtonReceiverPendingIntent = PendingIntent.getBroadcast(getApplicationContext(), 0, mediaButtonIntent, PendingIntent.FLAG_MUTABLE);
} else {
mediaButtonReceiverPendingIntent = PendingIntent.getBroadcast(getApplicationContext(), 0, mediaButtonIntent, 0);
}
mediaButtonReceiverPendingIntent = PendingIntent.getBroadcast(getApplicationContext(), 0, mediaButtonIntent,
VersionUtils.INSTANCE.hasMarshmallow() ? PendingIntent.FLAG_IMMUTABLE : 0);
mediaSession = new MediaSessionCompat(
this,
@ -1604,9 +1602,6 @@ public class MusicService extends MediaBrowserServiceCompat
mediaButtonReceiverPendingIntent);
MediaSessionCallback mediasessionCallback =
new MediaSessionCallback(getApplicationContext(), this);
mediaSession.setFlags(
MediaSessionCompat.FLAG_HANDLES_MEDIA_BUTTONS
| MediaSessionCompat.FLAG_HANDLES_TRANSPORT_CONTROLS);
mediaSession.setCallback(mediasessionCallback);
mediaSession.setActive(true);
mediaSession.setMediaButtonReceiver(mediaButtonReceiverPendingIntent);

View file

@ -70,15 +70,11 @@ class PlayingNotificationImpl : PlayingNotification(), KoinComponent {
action.putExtra(MainActivity.EXPAND_PANEL, PreferenceUtil.isExpandPanel)
action.flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TOP
val clickIntent =
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
PendingIntent.getActivity(
PendingIntent.getActivity(
service, 0, action, if (VersionUtils.hasMarshmallow())
PendingIntent.FLAG_IMMUTABLE
else 0
else 0 or PendingIntent.FLAG_UPDATE_CURRENT
)
} else {
PendingIntent.getActivity(service, 0, action, PendingIntent.FLAG_UPDATE_CURRENT)
}
val serviceName = ComponentName(service, MusicService::class.java)
val intent = Intent(ACTION_QUIT)