diff options
author | Tom Hennen <TomHennen@users.noreply.github.com> | 2015-09-26 15:10:11 -0400 |
---|---|---|
committer | Tom Hennen <TomHennen@users.noreply.github.com> | 2015-09-26 15:10:11 -0400 |
commit | a083a0cc7a2eb3b025c8f905df7b91ce48d91ca8 (patch) | |
tree | eef819322c895759c4d77c26ec94d3e9d9db0722 | |
parent | 281885b1f4d0318dd0baa1c688a9e3bee80797c6 (diff) | |
parent | 7af9b9a0df11cedeb9f2de277920243fc9d251cd (diff) | |
download | AntennaPod-1.3.4.zip |
Merge pull request #1224 from AntennaPod/version_1.31.3.4
Version 1.3.4
3 files changed, 30 insertions, 21 deletions
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index ebd1c9bfc..7ee5c880a 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -1,8 +1,8 @@ <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="de.danoeh.antennapod" - android:versionCode="1030300" - android:versionName="1.3.3.0"> + android:versionCode="1030401" + android:versionName="1.3.4.1"> <!-- Version code schema: "1.2.3-SNAPSHOT" -> 1020300 diff --git a/app/src/main/java/de/danoeh/antennapod/adapter/ChapterListAdapter.java b/app/src/main/java/de/danoeh/antennapod/adapter/ChapterListAdapter.java index 67fb4c3b1..22c15949a 100644 --- a/app/src/main/java/de/danoeh/antennapod/adapter/ChapterListAdapter.java +++ b/app/src/main/java/de/danoeh/antennapod/adapter/ChapterListAdapter.java @@ -163,9 +163,11 @@ public class ChapterListAdapter extends ArrayAdapter<Chapter> { public int getCount() { // ignore invalid chapters int counter = 0; - for (Chapter chapter : chapters) { - if (!ignoreChapter(chapter)) { - counter++; + if (chapters != null) { + for (Chapter chapter : chapters) { + if (!ignoreChapter(chapter)) { + counter++; + } } } return counter; diff --git a/core/src/main/java/com/aocate/media/ServiceBackedMediaPlayer.java b/core/src/main/java/com/aocate/media/ServiceBackedMediaPlayer.java index 0e27a8014..2e3b9d28e 100644 --- a/core/src/main/java/com/aocate/media/ServiceBackedMediaPlayer.java +++ b/core/src/main/java/com/aocate/media/ServiceBackedMediaPlayer.java @@ -20,8 +20,6 @@ package com.aocate.media; -import java.io.IOException; - import android.content.ComponentName; import android.content.Context; import android.content.Intent; @@ -30,8 +28,8 @@ import android.media.AudioManager; import android.net.Uri; import android.os.IBinder; import android.os.PowerManager; -import android.os.RemoteException; import android.os.PowerManager.WakeLock; +import android.os.RemoteException; import android.util.Log; import com.aocate.media.MediaPlayer.State; @@ -46,6 +44,8 @@ import com.aocate.presto.service.IOnSeekCompleteListenerCallback_0_8; import com.aocate.presto.service.IOnSpeedAdjustmentAvailableChangedListenerCallback_0_8; import com.aocate.presto.service.IPlayMedia_0_8; +import java.io.IOException; + import de.danoeh.antennapod.core.BuildConfig; /** @@ -60,7 +60,7 @@ import de.danoeh.antennapod.core.BuildConfig; public class ServiceBackedMediaPlayer extends MediaPlayerImpl { static final String INTENT_NAME = "com.aocate.intent.PLAY_AUDIO_ADJUST_SPEED_0_8"; - private static final String SBMP_TAG = "AocateServiceBackedMediaPlayer"; + private static final String SBMP_TAG = "ServiceBackedMediaPlaye"; private ServiceConnection mPlayMediaServiceConnection = null; protected IPlayMedia_0_8 pmInterface = null; @@ -874,19 +874,24 @@ public class ServiceBackedMediaPlayer extends MediaPlayerImpl { // the client app's responsibility to request that permission public void setWakeMode(Context context, int mode) { Log.d(SBMP_TAG, "setWakeMode(context, " + mode + ")"); - if ((this.mWakeLock != null) - && (this.mWakeLock.isHeld())) { - this.mWakeLock.release(); + boolean wasHeld = false; + if (mWakeLock != null) { + if(mWakeLock.isHeld()) { + wasHeld = true; + Log.d(SBMP_TAG, "Releasing wakelock"); + mWakeLock.release(); + } + mWakeLock = null; } if (mode != 0) { - if (this.mWakeLock == null) { - PowerManager pm = (PowerManager) context.getSystemService(Context.POWER_SERVICE); - // Since mode can't be changed on the fly, we have to allocate a new one - this.mWakeLock = pm.newWakeLock(mode, this.getClass().getName()); - this.mWakeLock.setReferenceCounted(false); - } + PowerManager pm = (PowerManager) context.getSystemService(Context.POWER_SERVICE); + mWakeLock = pm.newWakeLock(mode, this.getClass().getName()); + mWakeLock.setReferenceCounted(false); - this.mWakeLock.acquire(); + if(wasHeld) { + Log.d(SBMP_TAG, "Acquiring wakelock"); + mWakeLock.acquire(); + } } } @@ -898,9 +903,11 @@ public class ServiceBackedMediaPlayer extends MediaPlayerImpl { if (BuildConfig.DEBUG) Log.d(SBMP_TAG, "stayAwake(" + awake + ")"); if (mWakeLock != null) { if (awake && !mWakeLock.isHeld()) { - mWakeLock.acquire(); + Log.d(SBMP_TAG, "Acquiring wakelock"); + mWakeLock.acquire(); } else if (!awake && mWakeLock.isHeld()) { - mWakeLock.release(); + Log.d(SBMP_TAG, "Releasing wakelock"); + mWakeLock.release(); } } } |