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()
}
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
}
release {
resValue "string", "provider_authority", "de.danoeh.antennapod.provider"
minifyEnabled true
proguardFile "proguard.cfg"
signingConfig signingConfigs.releaseConfig
@ -127,13 +128,6 @@ android {
}
}
configurations {
freeDebugImplementation
freeReleaseImplementation
playDebugImplementation
playReleaseImplementation
}
dependencies {
freeImplementation project(":core")
// free build hack: skip some dependencies
@ -169,7 +163,7 @@ dependencies {
transitive = true
}
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"
}

View File

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

View File

@ -7,7 +7,7 @@ buildscript {
google()
}
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"
// Exclude the version that the android plugin depends on.
configurations.classpath.exclude group: "com.android.tools.external.lombok"
@ -53,13 +53,13 @@ project.ext {
jsoupVersion = "1.11.2"
materialDialogsVersion = "0.9.0.2"
okhttpVersion = "3.9.0"
okioVersion = "1.13.0"
recyclerviewFlexibledividerVersion = "1.2.6"
okioVersion = "1.14.0"
recyclerviewFlexibledividerVersion = "1.4.0"
robotiumSoloVersion = "5.6.3"
rxAndroidVersion = "1.2.1"
rxJavaVersion = "1.3.2"
rxJavaRulesVersion = "1.3.2.0"
triangleLabelViewVersion = "1.1.0"
rxJavaVersion = "1.3.8"
rxJavaRulesVersion = "1.3.3.0"
triangleLabelViewVersion = "1.1.2"
audioPlayerVersion = "v1.0.17"

View File

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

View File

@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
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