Merge pull request #2618 from hannesa2/AndroidStudio_3.1

update to AndroidStudio 3.1
This commit is contained in:
Martin Fietz 2018-04-07 17:49:24 +02:00 committed by GitHub
commit ccd29a9991
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 72 additions and 76 deletions

View File

@ -14,7 +14,7 @@ buildscript {
jcenter() jcenter()
} }
dependencies { dependencies {
classpath 'com.getkeepsafe.dexcount:dexcount-gradle-plugin:0.8.1' classpath 'com.getkeepsafe.dexcount:dexcount-gradle-plugin:0.8.2'
} }
} }
@ -86,6 +86,7 @@ android {
buildConfigField STRING, FLATTR_APP_SECRET, mFlattrAppSecret buildConfigField STRING, FLATTR_APP_SECRET, mFlattrAppSecret
} }
release { release {
resValue "string", "provider_authority", "de.danoeh.antennapod.provider"
minifyEnabled true minifyEnabled true
proguardFile "proguard.cfg" proguardFile "proguard.cfg"
signingConfig signingConfigs.releaseConfig signingConfig signingConfigs.releaseConfig
@ -127,13 +128,6 @@ android {
} }
} }
configurations {
freeDebugImplementation
freeReleaseImplementation
playDebugImplementation
playReleaseImplementation
}
dependencies { dependencies {
freeImplementation project(":core") freeImplementation project(":core")
// free build hack: skip some dependencies // free build hack: skip some dependencies
@ -169,7 +163,7 @@ dependencies {
transitive = true transitive = true
} }
implementation "com.yqritc:recyclerview-flexibledivider:$recyclerviewFlexibledividerVersion" implementation "com.yqritc:recyclerview-flexibledivider:$recyclerviewFlexibledividerVersion"
implementation("com.githang:viewpagerindicator:2.5@aar") { implementation("com.githang:viewpagerindicator:2.5.1@aar") {
exclude module: "support-v4" exclude module: "support-v4"
} }

View File

@ -4,7 +4,7 @@ package de.danoeh.antennapod.activity;
import android.content.Intent; import android.content.Intent;
import android.net.Uri; import android.net.Uri;
import android.os.Bundle; import android.os.Bundle;
import android.support.v7.app.ActionBarActivity; import android.support.v7.app.AppCompatActivity;
import android.util.Log; import android.util.Log;
import android.view.Menu; import android.view.Menu;
import android.view.MenuItem; import android.view.MenuItem;
@ -21,7 +21,7 @@ import de.danoeh.antennapod.core.util.flattr.FlattrUtils;
/** Guides the user through the authentication process */ /** Guides the user through the authentication process */
public class FlattrAuthActivity extends ActionBarActivity { public class FlattrAuthActivity extends AppCompatActivity {
private static final String TAG = "FlattrAuthActivity"; private static final String TAG = "FlattrAuthActivity";
private TextView txtvExplanation; private TextView txtvExplanation;

View File

@ -7,7 +7,7 @@ buildscript {
google() google()
} }
dependencies { dependencies {
classpath "com.android.tools.build:gradle:3.0.1" classpath 'com.android.tools.build:gradle:3.1.0'
classpath "com.github.triplet.gradle:play-publisher:1.2.0" classpath "com.github.triplet.gradle:play-publisher:1.2.0"
// Exclude the version that the android plugin depends on. // Exclude the version that the android plugin depends on.
configurations.classpath.exclude group: "com.android.tools.external.lombok" configurations.classpath.exclude group: "com.android.tools.external.lombok"
@ -53,13 +53,13 @@ project.ext {
jsoupVersion = "1.11.2" jsoupVersion = "1.11.2"
materialDialogsVersion = "0.9.0.2" materialDialogsVersion = "0.9.0.2"
okhttpVersion = "3.9.0" okhttpVersion = "3.9.0"
okioVersion = "1.13.0" okioVersion = "1.14.0"
recyclerviewFlexibledividerVersion = "1.2.6" recyclerviewFlexibledividerVersion = "1.4.0"
robotiumSoloVersion = "5.6.3" robotiumSoloVersion = "5.6.3"
rxAndroidVersion = "1.2.1" rxAndroidVersion = "1.2.1"
rxJavaVersion = "1.3.2" rxJavaVersion = "1.3.8"
rxJavaRulesVersion = "1.3.2.0" rxJavaRulesVersion = "1.3.3.0"
triangleLabelViewVersion = "1.1.0" triangleLabelViewVersion = "1.1.2"
audioPlayerVersion = "v1.0.17" audioPlayerVersion = "v1.0.17"

View File

@ -263,30 +263,21 @@ public class PlaybackService extends MediaBrowserServiceCompat {
Log.d(TAG, "Service created."); Log.d(TAG, "Service created.");
isRunning = true; isRunning = true;
registerReceiver(autoStateUpdated, new IntentFilter( registerReceiver(autoStateUpdated, new IntentFilter("com.google.android.gms.car.media.STATUS"));
"com.google.android.gms.car.media.STATUS")); registerReceiver(headsetDisconnected, new IntentFilter(Intent.ACTION_HEADSET_PLUG));
registerReceiver(headsetDisconnected, new IntentFilter( registerReceiver(shutdownReceiver, new IntentFilter(ACTION_SHUTDOWN_PLAYBACK_SERVICE));
Intent.ACTION_HEADSET_PLUG)); registerReceiver(bluetoothStateUpdated, new IntentFilter(BluetoothA2dp.ACTION_CONNECTION_STATE_CHANGED));
registerReceiver(shutdownReceiver, new IntentFilter( registerReceiver(audioBecomingNoisy, new IntentFilter(AudioManager.ACTION_AUDIO_BECOMING_NOISY));
ACTION_SHUTDOWN_PLAYBACK_SERVICE)); registerReceiver(skipCurrentEpisodeReceiver, new IntentFilter(ACTION_SKIP_CURRENT_EPISODE));
registerReceiver(bluetoothStateUpdated, new IntentFilter( registerReceiver(pausePlayCurrentEpisodeReceiver, new IntentFilter(ACTION_PAUSE_PLAY_CURRENT_EPISODE));
BluetoothA2dp.ACTION_CONNECTION_STATE_CHANGED)); registerReceiver(pauseResumeCurrentEpisodeReceiver, new IntentFilter(ACTION_RESUME_PLAY_CURRENT_EPISODE));
registerReceiver(audioBecomingNoisy, new IntentFilter(
AudioManager.ACTION_AUDIO_BECOMING_NOISY));
registerReceiver(skipCurrentEpisodeReceiver, new IntentFilter(
ACTION_SKIP_CURRENT_EPISODE));
registerReceiver(pausePlayCurrentEpisodeReceiver, new IntentFilter(
ACTION_PAUSE_PLAY_CURRENT_EPISODE));
registerReceiver(pauseResumeCurrentEpisodeReceiver, new IntentFilter(
ACTION_RESUME_PLAY_CURRENT_EPISODE));
taskManager = new PlaybackServiceTaskManager(this, taskManagerCallback); taskManager = new PlaybackServiceTaskManager(this, taskManagerCallback);
flavorHelper = new PlaybackServiceFlavorHelper(PlaybackService.this, flavorHelperCallback); flavorHelper = new PlaybackServiceFlavorHelper(PlaybackService.this, flavorHelperCallback);
PreferenceManager.getDefaultSharedPreferences(this) PreferenceManager.getDefaultSharedPreferences(this)
.registerOnSharedPreferenceChangeListener(prefListener); .registerOnSharedPreferenceChangeListener(prefListener);
ComponentName eventReceiver = new ComponentName(getApplicationContext(), ComponentName eventReceiver = new ComponentName(getApplicationContext(), MediaButtonReceiver.class);
MediaButtonReceiver.class);
Intent mediaButtonIntent = new Intent(Intent.ACTION_MEDIA_BUTTON); Intent mediaButtonIntent = new Intent(Intent.ACTION_MEDIA_BUTTON);
mediaButtonIntent.setComponent(eventReceiver); mediaButtonIntent.setComponent(eventReceiver);
PendingIntent buttonReceiverIntent = PendingIntent.getBroadcast(this, 0, mediaButtonIntent, PendingIntent.FLAG_UPDATE_CURRENT); PendingIntent buttonReceiverIntent = PendingIntent.getBroadcast(this, 0, mediaButtonIntent, PendingIntent.FLAG_UPDATE_CURRENT);
@ -309,7 +300,7 @@ public class PlaybackService extends MediaBrowserServiceCompat {
List<MediaSessionCompat.QueueItem> queueItems = new ArrayList<>(); List<MediaSessionCompat.QueueItem> queueItems = new ArrayList<>();
try { try {
for (FeedItem feedItem : taskManager.getQueue()) { for (FeedItem feedItem : taskManager.getQueue()) {
if(feedItem.getMedia() != null) { if (feedItem.getMedia() != null) {
MediaDescriptionCompat mediaDescription = feedItem.getMedia().getMediaItem().getDescription(); MediaDescriptionCompat mediaDescription = feedItem.getMedia().getMediaItem().getDescription();
queueItems.add(new MediaSessionCompat.QueueItem(mediaDescription, feedItem.getId())); queueItems.add(new MediaSessionCompat.QueueItem(mediaDescription, feedItem.getId()));
} }
@ -375,10 +366,10 @@ public class PlaybackService extends MediaBrowserServiceCompat {
.setTitle(feed.getTitle()) .setTitle(feed.getTitle())
.setDescription(feed.getDescription()) .setDescription(feed.getDescription())
.setSubtitle(feed.getCustomTitle()); .setSubtitle(feed.getCustomTitle());
if(feed.getImageLocation() != null) { if (feed.getImageLocation() != null) {
builder.setIconUri(Uri.parse(feed.getImageLocation())); builder.setIconUri(Uri.parse(feed.getImageLocation()));
} }
if(feed.getLink() != null) { if (feed.getLink() != null) {
builder.setMediaUri(Uri.parse(feed.getLink())); builder.setMediaUri(Uri.parse(feed.getLink()));
} }
MediaDescriptionCompat description = builder.build(); MediaDescriptionCompat description = builder.build();
@ -401,13 +392,13 @@ public class PlaybackService extends MediaBrowserServiceCompat {
e.printStackTrace(); e.printStackTrace();
} }
List<Feed> feeds = DBReader.getFeedList(); List<Feed> feeds = DBReader.getFeedList();
for (Feed feed: feeds) { for (Feed feed : feeds) {
mediaItems.add(createBrowsableMediaItemForFeed(feed)); mediaItems.add(createBrowsableMediaItemForFeed(feed));
} }
} else if (parentId.equals(getResources().getString(R.string.queue_label))){ } else if (parentId.equals(getResources().getString(R.string.queue_label))) {
// Child List // Child List
try { try {
for (FeedItem feedItem: taskManager.getQueue()) { for (FeedItem feedItem : taskManager.getQueue()) {
mediaItems.add(feedItem.getMedia().getMediaItem()); mediaItems.add(feedItem.getMedia().getMediaItem());
} }
} catch (InterruptedException e) { } catch (InterruptedException e) {
@ -416,8 +407,8 @@ public class PlaybackService extends MediaBrowserServiceCompat {
} else if (parentId.startsWith("FeedId:")) { } else if (parentId.startsWith("FeedId:")) {
Long feedId = Long.parseLong(parentId.split(":")[1]); Long feedId = Long.parseLong(parentId.split(":")[1]);
List<FeedItem> feedItems = DBReader.getFeedItemList(DBReader.getFeed(feedId)); List<FeedItem> feedItems = DBReader.getFeedItemList(DBReader.getFeed(feedId));
for (FeedItem feedItem: feedItems) { for (FeedItem feedItem : feedItems) {
if(feedItem.getMedia() != null && feedItem.getMedia().getMediaItem() != null) { if (feedItem.getMedia() != null && feedItem.getMedia().getMediaItem() != null) {
mediaItems.add(feedItem.getMedia().getMediaItem()); mediaItems.add(feedItem.getMedia().getMediaItem());
} }
} }
@ -428,7 +419,7 @@ public class PlaybackService extends MediaBrowserServiceCompat {
@Override @Override
public IBinder onBind(Intent intent) { public IBinder onBind(Intent intent) {
Log.d(TAG, "Received onBind event"); Log.d(TAG, "Received onBind event");
if(intent.getAction() != null && TextUtils.equals(intent.getAction(), MediaBrowserServiceCompat.SERVICE_INTERFACE)) { if (intent.getAction() != null && TextUtils.equals(intent.getAction(), MediaBrowserServiceCompat.SERVICE_INTERFACE)) {
return super.onBind(intent); return super.onBind(intent);
} else { } else {
return mBinder; return mBinder;
@ -467,8 +458,8 @@ public class PlaybackService extends MediaBrowserServiceCompat {
sendNotificationBroadcast(NOTIFICATION_TYPE_RELOAD, 0); sendNotificationBroadcast(NOTIFICATION_TYPE_RELOAD, 0);
//If the user asks to play External Media, the casting session, if on, should end. //If the user asks to play External Media, the casting session, if on, should end.
flavorHelper.castDisconnect(playable instanceof ExternalMedia); flavorHelper.castDisconnect(playable instanceof ExternalMedia);
if(playable instanceof FeedMedia){ if (playable instanceof FeedMedia) {
playable = DBReader.getFeedMedia(((FeedMedia)playable).getId()); playable = DBReader.getFeedMedia(((FeedMedia) playable).getId());
} }
mediaPlayer.playMediaObject(playable, stream, startWhenPrepared, prepareImmediately); mediaPlayer.playMediaObject(playable, stream, startWhenPrepared, prepareImmediately);
} }
@ -514,7 +505,7 @@ public class PlaybackService extends MediaBrowserServiceCompat {
return true; return true;
case KeyEvent.KEYCODE_MEDIA_NEXT: case KeyEvent.KEYCODE_MEDIA_NEXT:
if(source == InputDevice.SOURCE_CLASS_NONE || if (source == InputDevice.SOURCE_CLASS_NONE ||
UserPreferences.shouldHardwareButtonSkip()) { UserPreferences.shouldHardwareButtonSkip()) {
// assume the skip command comes from a notification or the lockscreen // assume the skip command comes from a notification or the lockscreen
// a >| skip button should actually skip // a >| skip button should actually skip
@ -529,7 +520,7 @@ public class PlaybackService extends MediaBrowserServiceCompat {
mediaPlayer.seekDelta(UserPreferences.getFastForwardSecs() * 1000); mediaPlayer.seekDelta(UserPreferences.getFastForwardSecs() * 1000);
return true; return true;
case KeyEvent.KEYCODE_MEDIA_PREVIOUS: case KeyEvent.KEYCODE_MEDIA_PREVIOUS:
if(UserPreferences.shouldHardwarePreviousButtonRestart()) { if (UserPreferences.shouldHardwarePreviousButtonRestart()) {
// user wants to restart current episode // user wants to restart current episode
mediaPlayer.seekTo(0); mediaPlayer.seekTo(0);
} else { } else {
@ -657,7 +648,7 @@ public class PlaybackService extends MediaBrowserServiceCompat {
setupNotification(newInfo); setupNotification(newInfo);
started = true; started = true;
// set sleep timer if auto-enabled // set sleep timer if auto-enabled
if(newInfo.oldPlayerStatus != null && newInfo.oldPlayerStatus != PlayerStatus.SEEKING && if (newInfo.oldPlayerStatus != null && newInfo.oldPlayerStatus != PlayerStatus.SEEKING &&
SleepTimerPreferences.autoEnable() && !sleepTimerActive()) { SleepTimerPreferences.autoEnable() && !sleepTimerActive()) {
setSleepTimer(SleepTimerPreferences.timerMillis(), SleepTimerPreferences.shakeToReset(), setSleepTimer(SleepTimerPreferences.timerMillis(), SleepTimerPreferences.shakeToReset(),
SleepTimerPreferences.vibrate()); SleepTimerPreferences.vibrate());
@ -801,7 +792,7 @@ public class PlaybackService extends MediaBrowserServiceCompat {
Log.e(TAG, "Error handling the queue in order to retrieve the next item", e); Log.e(TAG, "Error handling the queue in order to retrieve the next item", e);
return null; return null;
} }
return (nextItem != null)? nextItem.getMedia() : null; return (nextItem != null) ? nextItem.getMedia() : null;
} }
@ -830,7 +821,7 @@ public class PlaybackService extends MediaBrowserServiceCompat {
/** /**
* This method processes the media object after its playback ended, either because it completed * This method processes the media object after its playback ended, either because it completed
* or because a different media object was selected for playback. * or because a different media object was selected for playback.
* * <p>
* Even though these tasks aren't supposed to be resource intensive, a good practice is to * Even though these tasks aren't supposed to be resource intensive, a good practice is to
* usually call this method on a background thread. * usually call this method on a background thread.
* *
@ -1030,6 +1021,7 @@ public class PlaybackService extends MediaBrowserServiceCompat {
/** /**
* Updates the Media Session for the corresponding status. * Updates the Media Session for the corresponding status.
*
* @param playerStatus the current {@link PlayerStatus} * @param playerStatus the current {@link PlayerStatus}
*/ */
private void updateMediaSession(final PlayerStatus playerStatus) { private void updateMediaSession(final PlayerStatus playerStatus) {
@ -1105,8 +1097,8 @@ public class PlaybackService extends MediaBrowserServiceCompat {
// showRewindOnCompactNotification() corresponds to the "Set Lockscreen Buttons" // showRewindOnCompactNotification() corresponds to the "Set Lockscreen Buttons"
// Settings in UI. // Settings in UI.
// Hence, from user perspective, he/she is setting the buttons for Lockscreen // Hence, from user perspective, he/she is setting the buttons for Lockscreen
return ( UserPreferences.showRewindOnCompactNotification() && return (UserPreferences.showRewindOnCompactNotification() &&
(Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) ); (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP));
} }
/** /**
@ -1255,7 +1247,7 @@ public class PlaybackService extends MediaBrowserServiceCompat {
notificationBuilder.addAction(android.R.drawable.ic_media_rew, notificationBuilder.addAction(android.R.drawable.ic_media_rew,
getString(R.string.rewind_label), getString(R.string.rewind_label),
rewindButtonPendingIntent); rewindButtonPendingIntent);
if(UserPreferences.showRewindOnCompactNotification()) { if (UserPreferences.showRewindOnCompactNotification()) {
compactActionList.add(numActions); compactActionList.add(numActions);
} }
numActions++; numActions++;
@ -1282,7 +1274,7 @@ public class PlaybackService extends MediaBrowserServiceCompat {
notificationBuilder.addAction(android.R.drawable.ic_media_ff, notificationBuilder.addAction(android.R.drawable.ic_media_ff,
getString(R.string.fast_forward_label), getString(R.string.fast_forward_label),
ffButtonPendingIntent); ffButtonPendingIntent);
if(UserPreferences.showFastForwardOnCompactNotification()) { if (UserPreferences.showFastForwardOnCompactNotification()) {
compactActionList.add(numActions); compactActionList.add(numActions);
} }
numActions++; numActions++;
@ -1293,7 +1285,7 @@ public class PlaybackService extends MediaBrowserServiceCompat {
notificationBuilder.addAction(android.R.drawable.ic_media_next, notificationBuilder.addAction(android.R.drawable.ic_media_next,
getString(R.string.skip_episode_label), getString(R.string.skip_episode_label),
skipButtonPendingIntent); skipButtonPendingIntent);
if(UserPreferences.showSkipOnCompactNotification()) { if (UserPreferences.showSkipOnCompactNotification()) {
compactActionList.add(numActions); compactActionList.add(numActions);
} }
numActions++; numActions++;
@ -1416,7 +1408,7 @@ public class PlaybackService extends MediaBrowserServiceCompat {
String status = intent.getStringExtra("media_connection_status"); String status = intent.getStringExtra("media_connection_status");
boolean isConnectedToCar = "media_connected".equals(status); boolean isConnectedToCar = "media_connected".equals(status);
Log.d(TAG, "Received Auto Connection update: " + status); Log.d(TAG, "Received Auto Connection update: " + status);
if(!isConnectedToCar) { if (!isConnectedToCar) {
Log.d(TAG, "Car was unplugged during playback."); Log.d(TAG, "Car was unplugged during playback.");
pauseIfPauseOnDisconnect(); pauseIfPauseOnDisconnect();
} else { } else {
@ -1506,10 +1498,10 @@ public class PlaybackService extends MediaBrowserServiceCompat {
transientPause = false; transientPause = false;
if (!bluetooth && UserPreferences.isUnpauseOnHeadsetReconnect()) { if (!bluetooth && UserPreferences.isUnpauseOnHeadsetReconnect()) {
mediaPlayer.resume(); mediaPlayer.resume();
} else if (bluetooth && UserPreferences.isUnpauseOnBluetoothReconnect()){ } else if (bluetooth && UserPreferences.isUnpauseOnBluetoothReconnect()) {
// let the user know we've started playback again... // let the user know we've started playback again...
Vibrator v = (Vibrator) getApplicationContext().getSystemService(Context.VIBRATOR_SERVICE); Vibrator v = (Vibrator) getApplicationContext().getSystemService(Context.VIBRATOR_SERVICE);
if(v != null) { if (v != null) {
v.vibrate(500); v.vibrate(500);
} }
mediaPlayer.resume(); mediaPlayer.resume();
@ -1590,7 +1582,9 @@ public class PlaybackService extends MediaBrowserServiceCompat {
return mediaPlayer.getPlayerStatus(); return mediaPlayer.getPlayerStatus();
} }
public Playable getPlayable() { return mediaPlayer.getPlayable(); } public Playable getPlayable() {
return mediaPlayer.getPlayable();
}
public boolean canSetSpeed() { public boolean canSetSpeed() {
return mediaPlayer.canSetSpeed(); return mediaPlayer.canSetSpeed();
@ -1685,19 +1679,19 @@ public class PlaybackService extends MediaBrowserServiceCompat {
public void onPlayFromMediaId(String mediaId, Bundle extras) { public void onPlayFromMediaId(String mediaId, Bundle extras) {
Log.d(TAG, "onPlayFromMediaId: mediaId: " + mediaId + " extras: " + extras.toString()); Log.d(TAG, "onPlayFromMediaId: mediaId: " + mediaId + " extras: " + extras.toString());
FeedMedia p = DBReader.getFeedMedia(Long.parseLong(mediaId)); FeedMedia p = DBReader.getFeedMedia(Long.parseLong(mediaId));
if(p != null) { if (p != null) {
mediaPlayer.playMediaObject(p, !p.localFileAvailable(), true, true); mediaPlayer.playMediaObject(p, !p.localFileAvailable(), true, true);
} }
} }
@Override @Override
public void onPlayFromSearch (String query, Bundle extras) { public void onPlayFromSearch(String query, Bundle extras) {
Log.d(TAG, "onPlayFromSearch query=" + query + " extras=" + extras.toString()); Log.d(TAG, "onPlayFromSearch query=" + query + " extras=" + extras.toString());
List<SearchResult> results = FeedSearcher.performSearch(getBaseContext(),query,0); List<SearchResult> results = FeedSearcher.performSearch(getBaseContext(), query, 0);
for( SearchResult result : results) { for (SearchResult result : results) {
try { try {
FeedMedia p = ((FeedItem)(result.getComponent())).getMedia(); FeedMedia p = ((FeedItem) (result.getComponent())).getMedia();
mediaPlayer.playMediaObject(p, !p.localFileAvailable(), true, true); mediaPlayer.playMediaObject(p, !p.localFileAvailable(), true, true);
return; return;
} catch (Exception e) { } catch (Exception e) {
@ -1707,7 +1701,6 @@ public class PlaybackService extends MediaBrowserServiceCompat {
} }
} }
onPlay(); onPlay();
return;
} }
@Override @Override
@ -1745,7 +1738,7 @@ public class PlaybackService extends MediaBrowserServiceCompat {
@Override @Override
public void onSkipToNext() { public void onSkipToNext() {
Log.d(TAG, "onSkipToNext()"); Log.d(TAG, "onSkipToNext()");
if(UserPreferences.shouldHardwareButtonSkip()) { if (UserPreferences.shouldHardwareButtonSkip()) {
mediaPlayer.skip(); mediaPlayer.skip();
} else { } else {
seekDelta(UserPreferences.getFastForwardSecs() * 1000); seekDelta(UserPreferences.getFastForwardSecs() * 1000);
@ -1766,7 +1759,7 @@ public class PlaybackService extends MediaBrowserServiceCompat {
KeyEvent keyEvent = (KeyEvent) mediaButton.getExtras().get(Intent.EXTRA_KEY_EVENT); KeyEvent keyEvent = (KeyEvent) mediaButton.getExtras().get(Intent.EXTRA_KEY_EVENT);
if (keyEvent != null && if (keyEvent != null &&
keyEvent.getAction() == KeyEvent.ACTION_DOWN && keyEvent.getAction() == KeyEvent.ACTION_DOWN &&
keyEvent.getRepeatCount() == 0){ keyEvent.getRepeatCount() == 0) {
return handleKeycode(keyEvent.getKeyCode(), keyEvent.getSource()); return handleKeycode(keyEvent.getKeyCode(), keyEvent.getSource());
} }
} }
@ -1795,14 +1788,23 @@ public class PlaybackService extends MediaBrowserServiceCompat {
interface FlavorHelperCallback { interface FlavorHelperCallback {
PlaybackServiceMediaPlayer.PSMPCallback getMediaPlayerCallback(); PlaybackServiceMediaPlayer.PSMPCallback getMediaPlayerCallback();
void setMediaPlayer(PlaybackServiceMediaPlayer mediaPlayer); void setMediaPlayer(PlaybackServiceMediaPlayer mediaPlayer);
PlaybackServiceMediaPlayer getMediaPlayer(); PlaybackServiceMediaPlayer getMediaPlayer();
void setIsCasting(boolean isCasting); void setIsCasting(boolean isCasting);
void sendNotificationBroadcast(int type, int code); void sendNotificationBroadcast(int type, int code);
void saveCurrentPosition(boolean fromMediaPlayer, Playable playable, int position); void saveCurrentPosition(boolean fromMediaPlayer, Playable playable, int position);
void setupNotification(boolean connected, PlaybackServiceMediaPlayer.PSMPInfo info); void setupNotification(boolean connected, PlaybackServiceMediaPlayer.PSMPInfo info);
MediaSessionCompat getMediaSession(); MediaSessionCompat getMediaSession();
Intent registerReceiver(BroadcastReceiver receiver, IntentFilter filter); Intent registerReceiver(BroadcastReceiver receiver, IntentFilter filter);
void unregisterReceiver(BroadcastReceiver receiver); void unregisterReceiver(BroadcastReceiver receiver);
} }
@ -1849,7 +1851,7 @@ public class PlaybackService extends MediaBrowserServiceCompat {
UserPreferences.isPersistNotify()) && UserPreferences.isPersistNotify()) &&
android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
PlaybackService.this.setupNotification(info); PlaybackService.this.setupNotification(info);
} else if (!UserPreferences.isPersistNotify()){ } else if (!UserPreferences.isPersistNotify()) {
PlaybackService.this.stopForeground(true); PlaybackService.this.stopForeground(true);
} }
} }

View File

@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4.1-bin.zip distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-bin.zip