Skip to content
This repository has been archived by the owner on Jan 21, 2024. It is now read-only.

Commit

Permalink
Merge branch 'master' into sponsorblock
Browse files Browse the repository at this point in the history
# Conflicts:
#	README.es.md
#	README.ko.md
#	README.md
#	README.pt_BR.md
#	README.ro.md
#	README.so.md
#	README.tr.md
#	app/src/main/java/org/schabi/newpipe/CheckForNewAppVersion.java
#	app/src/main/java/org/schabi/newpipe/player/Player.java
#	app/src/main/res/layout-large-land/player.xml
#	app/src/main/res/layout/player.xml
#	app/src/main/res/values/strings.xml
  • Loading branch information
polymorphicshade committed Oct 18, 2021
2 parents c5a4900 + 7eb13a9 commit 063cfbc
Show file tree
Hide file tree
Showing 103 changed files with 1,148 additions and 788 deletions.
34 changes: 6 additions & 28 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@ labels: enhancement
assignees: ''

---
<!-- IF YOU DON'T FILL IN THE TEMPLATE PROPERLY, YOUR ISSUE IS LIABLE TO BE CLOSED. If you feel tired/lazy right now, open your issue some other time. We'll wait. -->
<!-- IF YOU DON'T FILL IN THE TEMPLATE PROPERLY, YOUR ISSUE IS LIABLE TO BE CLOSED. If you are currently unable to do so for any reason, open your issue some other time. We'll wait. -->


<!-- The comments between these brackets won't show up in the submitted issue (as you can see in the Preview). -->
<!-- The comments between these brackets won't show up in the submitted issue (as you can see in the Preview tab). -->

### Checklist
<!-- This checklist is COMPULSORY. The first box has been checked for you to show you how it is done. -->
Expand All @@ -18,30 +17,9 @@ assignees: ''
- [ ] I have read the contribution guidelines given at https://github.com/TeamNewPipe/NewPipe/blob/HEAD/.github/CONTRIBUTING.md.
- [ ] This issue contains only one feature request. I will open one issue for every feature I want to request.

#### What feature do you want?
<!-- Explain how you want the app's look or behavior to change to suit your needs. -->

#### Describe the feature you want
<!-- A clear and concise description of what you wish should happen.
Example: *I think it would be nice if you add feature Y which makes X possible.*
Optionally, also describe alternatives you've considered.
Example: *Z is also a good alternative. Not as good as Y, but at least...* or *I considered Z, but that didn't turn out to be a good idea because...* -->



#### Is your feature request related to a problem? Please describe it
<!-- A clear and concise description of what the problem is. Maybe the developers and the community could brainstorm and come up with a better solution to your problem. If they exist, link to related Issues and/or PRs for developers to keep track easier.
Example: *I want to do X, but there is no way to do it.* -->



#### Additional context
<!-- Add any other context, like screenshots, about the feature request here.
Example: *Here's a photo of my cat!* -->



#### How will you/everyone benefit from this feature?
<!-- Convince us! How does it change your NewPipe experience and/or your life?
The better this paragraph is, the more likely a developer will think about working on it.
Example: *This feature will help us colonize the galaxy! -->

#### Why do you want this feature?
<!-- Describe any problem or limitation you come across while using the app which would be solved by this feature. -->
8 changes: 4 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ jobs:
if: github.event_name == 'pull_request'
run: git checkout -B ${{ github.head_ref }}

- name: set up JDK 8
- name: set up JDK 11
uses: actions/setup-java@v2
with:
java-version: 8
java-version: 11
distribution: "temurin"
cache: 'gradle'

Expand All @@ -59,10 +59,10 @@ jobs:
steps:
- uses: actions/checkout@v2

- name: set up JDK 8
- name: set up JDK 11
uses: actions/setup-java@v2
with:
java-version: 8
java-version: 11
distribution: "temurin"
cache: 'gradle'

Expand Down
13 changes: 9 additions & 4 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ android {
resValue "string", "app_name", "NewPipe SponsorBlock"
minSdkVersion 19
targetSdkVersion 29
versionCode 976
versionName "0.21.10"
versionCode 978
versionName "0.21.12"

multiDexEnabled true

Expand Down Expand Up @@ -54,6 +54,11 @@ android {
// debug build. This seems to be a Gradle bug, therefore
// TODO: update Gradle version
release {
if (System.properties.containsKey('packageSuffix')) {
applicationIdSuffix System.getProperty('packageSuffix')
resValue "string", "app_name", "NewPipe " + System.getProperty('packageSuffix')
archivesBaseName = 'NewPipe_' + System.getProperty('packageSuffix')
}
minifyEnabled true
shrinkResources false // disabled to fix F-Droid's reproducible build
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
Expand Down Expand Up @@ -102,7 +107,7 @@ ext {
icepickVersion = '3.2.0'
exoPlayerVersion = '2.12.3'
googleAutoServiceVersion = '1.0'
groupieVersion = '2.8.1'
groupieVersion = '2.9.0'
markwonVersion = '4.6.2'

leakCanaryVersion = '2.5'
Expand Down Expand Up @@ -184,7 +189,7 @@ dependencies {
// name and the commit hash with the commit hash of the (pushed) commit you want to test
// This works thanks to JitPack: https://jitpack.io/
implementation 'com.github.TeamNewPipe:nanojson:1d9e1aea9049fc9f85e68b43ba39fe7be1c1f751'
implementation 'com.github.TeamNewPipe:NewPipeExtractor:v0.21.10'
implementation 'com.github.TeamNewPipe:NewPipeExtractor:v0.21.11'

/** Checkstyle **/
checkstyle "com.puppycrawl.tools:checkstyle:${checkstyleVersion}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,11 @@ class LocalPlaylistManagerTest {

@Test
fun createPlaylist() {
val NEWPIPE_URL = "https://newpipe.net/"
val stream = StreamEntity(
serviceId = 1, url = "https://newpipe.net/", title = "title",
serviceId = 1, url = NEWPIPE_URL, title = "title",
streamType = StreamType.VIDEO_STREAM, duration = 1, uploader = "uploader",
uploaderUrl = "https://newpipe.net/"
uploaderUrl = NEWPIPE_URL
)

val result = manager.createPlaylist("name", listOf(stream))
Expand Down
6 changes: 6 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@
<data android:pathPrefix="/embed/" />
<data android:pathPrefix="/watch" />
<data android:pathPrefix="/attribution_link" />
<data android:pathPrefix="/shorts/" />
<!-- channel prefix -->
<data android:pathPrefix="/channel/" />
<data android:pathPrefix="/user/" />
Expand Down Expand Up @@ -221,6 +222,7 @@

<data android:scheme="http" />
<data android:scheme="https" />
<data android:host="tubus.eduvid.org" />
<data android:host="invidio.us" />
<data android:host="dev.invidio.us" />
<data android:host="www.invidio.us" />
Expand Down Expand Up @@ -306,6 +308,7 @@
<data android:scheme="http" />
<data android:scheme="https" />

<data android:host="eduvid.org" />
<data android:host="framatube.org" />
<data android:host="media.assassinate-you.net" />
<data android:host="peertube.co.uk" />
Expand Down Expand Up @@ -363,6 +366,9 @@
<service
android:name=".RouterActivity$FetcherService"
android:exported="false" />
<service
android:name=".CheckForNewAppVersion"
android:exported="false" />

<!-- opting out of sending metrics to Google in Android System WebView -->
<meta-data android:name="android.webkit.WebView.MetricsOptOut" android:value="true" />
Expand Down
11 changes: 0 additions & 11 deletions app/src/main/java/org/schabi/newpipe/App.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import android.util.Log;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.core.app.NotificationChannelCompat;
import androidx.core.app.NotificationManagerCompat;
import androidx.multidex.MultiDexApplication;
Expand Down Expand Up @@ -37,7 +36,6 @@
import java.util.Collections;
import java.util.List;

import io.reactivex.rxjava3.disposables.Disposable;
import io.reactivex.rxjava3.exceptions.CompositeException;
import io.reactivex.rxjava3.exceptions.MissingBackpressureException;
import io.reactivex.rxjava3.exceptions.OnErrorNotImplementedException;
Expand Down Expand Up @@ -68,9 +66,6 @@ public class App extends MultiDexApplication {
private static final String TAG = App.class.toString();
private static App app;

@Nullable
private Disposable disposable = null;

@NonNull
public static App getApp() {
return app;
Expand Down Expand Up @@ -116,16 +111,10 @@ public void onCreate() {
&& prefs.getBoolean(getString(R.string.show_image_indicators_key), false));

configureRxJavaErrorHandler();

// Check for new version
disposable = CheckForNewAppVersion.checkNewVersion(this);
}

@Override
public void onTerminate() {
if (disposable != null) {
disposable.dispose();
}
super.onTerminate();
PicassoHelper.terminate();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,9 @@ private static boolean isConnected(@NonNull final App app) {
}

@Nullable
public static Disposable checkNewVersion(@NonNull final App app) {
public static Disposable checkNewVersion() {
final App app = App.getApp();

final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(app);

// Check if user has enabled/disabled update checking
Expand Down
5 changes: 5 additions & 0 deletions app/src/main/java/org/schabi/newpipe/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@

package org.schabi.newpipe;

import static org.schabi.newpipe.CheckForNewAppVersion.checkNewVersion;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
Expand Down Expand Up @@ -163,6 +165,9 @@ protected void onCreate(final Bundle savedInstanceState) {
FocusOverlayView.setupFocusObserver(this);
}
openMiniPlayerUponPlayerStarted();

// Check for new version
checkNewVersion();
}

private void setupDrawer() throws Exception {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@
import org.schabi.newpipe.local.dialog.PlaylistCreationDialog;
import org.schabi.newpipe.local.history.HistoryRecordManager;
import org.schabi.newpipe.player.MainPlayer;
import org.schabi.newpipe.player.MainPlayer.PlayerType;
import org.schabi.newpipe.player.Player;
import org.schabi.newpipe.player.event.OnKeyDownListener;
import org.schabi.newpipe.player.event.PlayerServiceExtendedEventListener;
Expand Down Expand Up @@ -1103,8 +1104,8 @@ private void openPopupPlayer(final boolean append) {
toggleFullscreenIfInFullscreenMode();

final PlayQueue queue = setupPlayQueueForIntent(append);
if (append) {
NavigationHelper.enqueueOnPopupPlayer(activity, queue, false);
if (append) { //resumePlayback: false
NavigationHelper.enqueueOnPlayer(activity, queue, PlayerType.POPUP);
} else {
replaceQueueIfUserConfirms(() -> NavigationHelper
.playOnPopupPlayer(activity, queue, true));
Expand Down Expand Up @@ -1162,7 +1163,7 @@ private void openNormalBackgroundPlayer(final boolean append) {

final PlayQueue queue = setupPlayQueueForIntent(append);
if (append) {
NavigationHelper.enqueueOnBackgroundPlayer(activity, queue, false);
NavigationHelper.enqueueOnPlayer(activity, queue, PlayerType.AUDIO);
} else {
replaceQueueIfUserConfirms(() -> NavigationHelper
.playOnBackgroundPlayer(activity, queue, true));
Expand All @@ -1188,7 +1189,7 @@ private void openMainPlayer() {
addVideoPlayerView();

final Intent playerIntent = NavigationHelper.getPlayerIntent(requireContext(),
MainPlayer.class, queue, true, autoPlayEnabled);
MainPlayer.class, queue, autoPlayEnabled);
ContextCompat.startForegroundService(activity, playerIntent);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -350,12 +350,16 @@ protected void showStreamDialog(final StreamInfoItem item) {
if (context == null || context.getResources() == null || activity == null) {
return;
}

final List<StreamDialogEntry> entries = new ArrayList<>();

if (PlayerHolder.getInstance().getType() != null) {
if (PlayerHolder.getInstance().isPlayerOpen()) {
entries.add(StreamDialogEntry.enqueue);

if (PlayerHolder.getInstance().getQueueSize() > 1) {
entries.add(StreamDialogEntry.enqueue_next);
}
}

if (item.getStreamType() == StreamType.AUDIO_STREAM) {
entries.addAll(Arrays.asList(
StreamDialogEntry.start_here_on_background,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
import org.schabi.newpipe.fragments.list.BaseListInfoFragment;
import org.schabi.newpipe.ktx.AnimationType;
import org.schabi.newpipe.local.subscription.SubscriptionManager;
import org.schabi.newpipe.player.MainPlayer.PlayerType;
import org.schabi.newpipe.player.playqueue.ChannelPlayQueue;
import org.schabi.newpipe.player.playqueue.PlayQueue;
import org.schabi.newpipe.util.ExtractorHelper;
Expand Down Expand Up @@ -495,12 +496,12 @@ public void handleResult(@NonNull final ChannelInfo result) {
.playOnBackgroundPlayer(activity, getPlayQueue(), false));

playlistControlBinding.playlistCtrlPlayPopupButton.setOnLongClickListener(view -> {
NavigationHelper.enqueueOnPopupPlayer(activity, getPlayQueue(), true);
NavigationHelper.enqueueOnPlayer(activity, getPlayQueue(), PlayerType.POPUP);
return true;
});

playlistControlBinding.playlistCtrlPlayBgButton.setOnLongClickListener(view -> {
NavigationHelper.enqueueOnBackgroundPlayer(activity, getPlayQueue(), true);
NavigationHelper.enqueueOnPlayer(activity, getPlayQueue(), PlayerType.AUDIO);
return true;
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
import org.schabi.newpipe.fragments.list.BaseListInfoFragment;
import org.schabi.newpipe.info_list.InfoItemDialog;
import org.schabi.newpipe.local.playlist.RemotePlaylistManager;
import org.schabi.newpipe.player.MainPlayer.PlayerType;
import org.schabi.newpipe.player.helper.PlayerHolder;
import org.schabi.newpipe.player.playqueue.PlayQueue;
import org.schabi.newpipe.player.playqueue.PlaylistPlayQueue;
Expand Down Expand Up @@ -148,9 +149,14 @@ protected void showStreamDialog(final StreamInfoItem item) {

final ArrayList<StreamDialogEntry> entries = new ArrayList<>();

if (PlayerHolder.getInstance().getType() != null) {
if (PlayerHolder.getInstance().isPlayerOpen()) {
entries.add(StreamDialogEntry.enqueue);

if (PlayerHolder.getInstance().getQueueSize() > 1) {
entries.add(StreamDialogEntry.enqueue_next);
}
}

if (item.getStreamType() == StreamType.AUDIO_STREAM) {
entries.addAll(Arrays.asList(
StreamDialogEntry.start_here_on_background,
Expand Down Expand Up @@ -347,12 +353,12 @@ public void handleResult(@NonNull final PlaylistInfo result) {
NavigationHelper.playOnBackgroundPlayer(activity, getPlayQueue(), false));

playlistControlBinding.playlistCtrlPlayPopupButton.setOnLongClickListener(view -> {
NavigationHelper.enqueueOnPopupPlayer(activity, getPlayQueue(), true);
NavigationHelper.enqueueOnPlayer(activity, getPlayQueue(), PlayerType.POPUP);
return true;
});

playlistControlBinding.playlistCtrlPlayBgButton.setOnLongClickListener(view -> {
NavigationHelper.enqueueOnBackgroundPlayer(activity, getPlayQueue(), true);
NavigationHelper.enqueueOnPlayer(activity, getPlayQueue(), PlayerType.AUDIO);
return true;
});
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
package org.schabi.newpipe.info_list

import android.util.Log
import com.xwray.groupie.GroupAdapter
import com.xwray.groupie.GroupieViewHolder
import com.xwray.groupie.GroupieAdapter
import org.schabi.newpipe.extractor.stream.StreamInfo
import kotlin.math.max

Expand All @@ -11,7 +10,7 @@ import kotlin.math.max
*/
class StreamSegmentAdapter(
private val listener: StreamSegmentListener
) : GroupAdapter<GroupieViewHolder>() {
) : GroupieAdapter() {

var currentIndex: Int = 0
private set
Expand Down
Loading

0 comments on commit 063cfbc

Please sign in to comment.