From c89dc4ba5badcd4eea9e745f98a2026b66e8133f Mon Sep 17 00:00:00 2001 From: Christian Schabesberger Date: Sun, 20 Dec 2015 21:28:07 +0100 Subject: [PATCH] setup for version 0.7.0 --- README.md | 4 ++-- app/build.gradle | 4 ++-- .../org/schabi/newpipe/ActionBarHandler.java | 3 ++- .../org/schabi/newpipe/BackgroundPlayer.java | 23 ++++++++----------- .../schabi/newpipe/VideoItemListFragment.java | 17 +++++++------- 5 files changed, 25 insertions(+), 26 deletions(-) diff --git a/README.md b/README.md index 0a2e2e55c..44cd7b956 100644 --- a/README.md +++ b/README.md @@ -34,8 +34,8 @@ NewPipe does not use any Google framework libraries, or the YouTube API. It only * Watch YouTube videos * Listen to YouTube videos (audio only streaming) * Select the streaming player to watch the video with -* Download videos (working, but it could be better) -* Download audio only (working, but it could be better) +* Download videos (experimental) +* Download audio only (experimental) * Open a video in Kodi * Show Next/Related videos * Search YouTube in a specific language diff --git a/app/build.gradle b/app/build.gradle index 7cede827a..871a98a9d 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -8,8 +8,8 @@ android { applicationId "org.schabi.newpipe" minSdkVersion 15 targetSdkVersion 23 - versionCode 8 - versionName "0.6.2" + versionCode 9 + versionName "0.7.0" } buildTypes { release { diff --git a/app/src/main/java/org/schabi/newpipe/ActionBarHandler.java b/app/src/main/java/org/schabi/newpipe/ActionBarHandler.java index ab7bcef96..76955d824 100644 --- a/app/src/main/java/org/schabi/newpipe/ActionBarHandler.java +++ b/app/src/main/java/org/schabi/newpipe/ActionBarHandler.java @@ -301,7 +301,8 @@ class ActionBarHandler { boolean externalAudioPlayer = PreferenceManager.getDefaultSharedPreferences(activity) .getBoolean(activity.getString(R.string.useExternalAudioPlayer), false); Intent intent; - if (!externalAudioPlayer)//internal (background) music player: explicit intent + + if (!externalAudioPlayer && android.os.Build.VERSION.SDK_INT >= 18)//internal music player: explicit intent { intent = new Intent(activity, BackgroundPlayer.class); diff --git a/app/src/main/java/org/schabi/newpipe/BackgroundPlayer.java b/app/src/main/java/org/schabi/newpipe/BackgroundPlayer.java index 443f7f846..dfea0f1c3 100644 --- a/app/src/main/java/org/schabi/newpipe/BackgroundPlayer.java +++ b/app/src/main/java/org/schabi/newpipe/BackgroundPlayer.java @@ -221,14 +221,18 @@ public class BackgroundPlayer extends Service /*implements MediaPlayer.OnPrepare }; private void afterPlayCleanup() { - //noteBuilder.setProgress(0, 0, false);//remove progress bar - noteMgr.cancel(noteID);//remove notification + //noteBuilder.setProgress(0, 0, false); + //remove progress bar + //remove notification + noteMgr.cancel(noteID); unregisterReceiver(broadcastReceiver); - mediaPlayer.release();//release mediaPlayer's system resources + //release mediaPlayer's system resources + mediaPlayer.release(); - - wifiLock.release();//release wifilock - stopForeground(true);//remove foreground status of service; make us killable + //release wifilock + wifiLock.release(); + //remove foreground status of service; make us killable + stopForeground(true); stopSelf(); } @@ -245,11 +249,4 @@ public class BackgroundPlayer extends Service /*implements MediaPlayer.OnPrepare } } } -/* - private class ListenerThread extends Thread implements AudioManager.OnAudioFocusChangeListener { - @Override - public void onAudioFocusChange(int focusChange) { - - } - }*/ } diff --git a/app/src/main/java/org/schabi/newpipe/VideoItemListFragment.java b/app/src/main/java/org/schabi/newpipe/VideoItemListFragment.java index e3840468a..93c6074b2 100644 --- a/app/src/main/java/org/schabi/newpipe/VideoItemListFragment.java +++ b/app/src/main/java/org/schabi/newpipe/VideoItemListFragment.java @@ -116,14 +116,13 @@ public class VideoItemListFragment extends ListFragment { }); } getActivity().runOnUiThread(new Runnable() { - @Override - - public void run() { - getListView().removeFooterView(footer); - } - } - - ); + @Override + public void run() { + if (android.os.Build.VERSION.SDK_INT >= 19) { + getListView().removeFooterView(footer); + } + } + }); } } @@ -198,6 +197,8 @@ public class VideoItemListFragment extends ListFragment { videoListAdapter.clearVideoList(); setListShown(false); startSearch(query, lastPage); + //todo: Somehow this command is not working on older devices, + // although it was introduced with API level 8. Test this and find a solution. getListView().smoothScrollToPosition(0); }