Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(accident - ignore) Release/0.21.10 #7117

Closed
wants to merge 17 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 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"
minSdkVersion 19
targetSdkVersion 29
versionCode 975
versionName "0.21.9"
versionCode 976
versionName "0.21.10"

multiDexEnabled true

Expand Down Expand Up @@ -184,7 +184,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:62b87552f51022be76804f3bed65447aeb9fce9b'
implementation 'com.github.TeamNewPipe:NewPipeExtractor:v0.21.10'

/** Checkstyle **/
checkstyle "com.puppycrawl.tools:checkstyle:${checkstyleVersion}"
Expand Down Expand Up @@ -254,6 +254,9 @@ dependencies {
// Crash reporting
implementation "ch.acra:acra-core:5.7.0"

// Properly restarting
implementation 'com.jakewharton:process-phoenix:2.1.2'

// Reactive extensions for Java VM
implementation "io.reactivex.rxjava3:rxjava:3.0.7"
implementation "io.reactivex.rxjava3:rxandroid:3.0.0"
Expand Down
8 changes: 8 additions & 0 deletions app/src/main/java/org/schabi/newpipe/App.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
import androidx.multidex.MultiDexApplication;
import androidx.preference.PreferenceManager;

import com.jakewharton.processphoenix.ProcessPhoenix;

import org.acra.ACRA;
import org.acra.config.ACRAConfigurationException;
import org.acra.config.CoreConfiguration;
Expand Down Expand Up @@ -86,6 +88,12 @@ public void onCreate() {

app = this;

if (ProcessPhoenix.isPhoenixProcess(this)) {
Log.i(TAG, "This is a phoenix process! "
+ "Aborting initialization of App[onCreate]");
return;
}

// Initialize settings first because others inits can use its values
NewPipeSettings.initSettings(this);

Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/org/schabi/newpipe/BaseFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

public abstract class BaseFragment extends Fragment {
protected final String TAG = getClass().getSimpleName() + "@" + Integer.toHexString(hashCode());
protected final boolean DEBUG = MainActivity.DEBUG;
protected static final boolean DEBUG = MainActivity.DEBUG;
protected AppCompatActivity activity;
//These values are used for controlling fragments when they are part of the frontpage
@State
Expand Down
4 changes: 4 additions & 0 deletions app/src/main/java/org/schabi/newpipe/about/AboutActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,10 @@ class AboutActivity : AppCompatActivity() {
"PrettyTime", "2012 - 2020", "Lincoln Baxter, III",
"https://github.com/ocpsoft/prettytime", StandardLicenses.APACHE2
),
SoftwareComponent(
"ProcessPhoenix", "2015", "Jake Wharton",
"https://github.com/JakeWharton/ProcessPhoenix", StandardLicenses.APACHE2
),
SoftwareComponent(
"RxAndroid", "2015", "The RxAndroid authors",
"https://github.com/ReactiveX/RxAndroid", StandardLicenses.APACHE2
Expand Down
51 changes: 30 additions & 21 deletions app/src/main/java/org/schabi/newpipe/error/ErrorPanelHelper.kt
Original file line number Diff line number Diff line change
Expand Up @@ -121,27 +121,14 @@ class ErrorPanelHelper(
ErrorActivity.reportError(context, errorInfo)
}

errorTextView.setText(
when (errorInfo.throwable) {
is AgeRestrictedContentException -> R.string.restricted_video_no_stream
is GeographicRestrictionException -> R.string.georestricted_content
is PaidContentException -> R.string.paid_content
is PrivateContentException -> R.string.private_content
is SoundCloudGoPlusContentException -> R.string.soundcloud_go_plus_content
is YoutubeMusicPremiumContentException -> R.string.youtube_music_premium_content
is ContentNotAvailableException -> R.string.content_not_available
is ContentNotSupportedException -> R.string.content_not_supported
else -> {
// show retry button only for content which is not unavailable or unsupported
errorRetryButton.isVisible = true
if (errorInfo.throwable != null && errorInfo.throwable!!.isNetworkRelated) {
R.string.network_error
} else {
R.string.error_snackbar_message
}
}
}
)
errorTextView.setText(getExceptionDescription(errorInfo.throwable))

if (errorInfo.throwable !is ContentNotAvailableException &&
errorInfo.throwable !is ContentNotSupportedException
) {
// show retry button only for content which is not unavailable or unsupported
errorRetryButton.isVisible = true
}
}

setRootVisible()
Expand Down Expand Up @@ -189,5 +176,27 @@ class ErrorPanelHelper(
companion object {
val TAG: String = ErrorPanelHelper::class.simpleName!!
val DEBUG: Boolean = MainActivity.DEBUG

@StringRes
public fun getExceptionDescription(throwable: Throwable?): Int {
return when (throwable) {
is AgeRestrictedContentException -> R.string.restricted_video_no_stream
is GeographicRestrictionException -> R.string.georestricted_content
is PaidContentException -> R.string.paid_content
is PrivateContentException -> R.string.private_content
is SoundCloudGoPlusContentException -> R.string.soundcloud_go_plus_content
is YoutubeMusicPremiumContentException -> R.string.youtube_music_premium_content
is ContentNotAvailableException -> R.string.content_not_available
is ContentNotSupportedException -> R.string.content_not_supported
else -> {
// show retry button only for content which is not unavailable or unsupported
if (throwable != null && throwable.isNetworkRelated) {
R.string.network_error
} else {
R.string.error_snackbar_message
}
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.schabi.newpipe.error;

import android.annotation.SuppressLint;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Build;
Expand Down Expand Up @@ -66,6 +67,7 @@ public static String sanitizeRecaptchaUrl(@Nullable final String url) {
private ActivityRecaptchaBinding recaptchaBinding;
private String foundCookies = "";

@SuppressLint("SetJavaScriptEnabled")
@Override
protected void onCreate(final Bundle savedInstanceState) {
ThemeHelper.setTheme(this);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ public void onSharedPreferenceChanged(final SharedPreferences sharedPreferences,
showRelatedItems = sharedPreferences.getBoolean(key, true);
tabSettingsChanged = true;
} else if (key.equals(getString(R.string.show_description_key))) {
showComments = sharedPreferences.getBoolean(key, true);
showDescription = sharedPreferences.getBoolean(key, true);
tabSettingsChanged = true;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@ public View onCreateView(final LayoutInflater inflater, @Nullable final ViewGrou

@Override
public void onViewCreated(@NonNull final View rootView, final Bundle savedInstanceState) {
searchBinding = FragmentSearchBinding.bind(rootView);
super.onViewCreated(rootView, savedInstanceState);
showSearchOnStart();
initSearchListeners();
Expand Down Expand Up @@ -341,7 +342,6 @@ public void onActivityResult(final int requestCode, final int resultCode, final
@Override
protected void initViews(final View rootView, final Bundle savedInstanceState) {
super.initViews(rootView, savedInstanceState);
searchBinding = FragmentSearchBinding.bind(rootView);

searchBinding.suggestionsList.setAdapter(suggestionListAdapter);
new ItemTouchHelper(new ItemTouchHelper.Callback() {
Expand Down Expand Up @@ -807,18 +807,21 @@ private void initSuggestionObserver() {
})
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(listNotification -> {
if (listNotification.isOnNext()) {
if (listNotification.getValue() != null) {
handleSuggestions(listNotification.getValue());
}
} else if (listNotification.isOnError()
&& listNotification.getError() != null
&& !ExceptionUtils.isInterruptedCaused(listNotification.getError())) {
showSnackBarError(new ErrorInfo(listNotification.getError(),
UserAction.GET_SUGGESTIONS, searchString, serviceId));
}
});
.subscribe(
listNotification -> {
if (listNotification.isOnNext()) {
if (listNotification.getValue() != null) {
handleSuggestions(listNotification.getValue());
}
} else if (listNotification.isOnError()
&& listNotification.getError() != null
&& !ExceptionUtils.isInterruptedCaused(
listNotification.getError())) {
showSnackBarError(new ErrorInfo(listNotification.getError(),
UserAction.GET_SUGGESTIONS, searchString, serviceId));
}
}, throwable -> showSnackBarError(new ErrorInfo(
throwable, UserAction.GET_SUGGESTIONS, searchString, serviceId)));
}

@Override
Expand Down
10 changes: 5 additions & 5 deletions app/src/main/java/org/schabi/newpipe/player/Player.java
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ public final class Player implements
//////////////////////////////////////////////////////////////////////////*/

public static final int PLAY_PREV_ACTIVATION_LIMIT_MILLIS = 5000; // 5 seconds
public static final int PROGRESS_LOOP_INTERVAL_MILLIS = 500; // 500 millis
public static final int PROGRESS_LOOP_INTERVAL_MILLIS = 1000; // 1 second
public static final int DEFAULT_CONTROLS_DURATION = 300; // 300 millis
public static final int DEFAULT_CONTROLS_HIDE_TIME = 2000; // 2 Seconds
public static final int DPAD_CONTROLS_HIDE_TIME = 7000; // 7 Seconds
Expand Down Expand Up @@ -614,7 +614,7 @@ public void handleIntent(@NonNull final Intent intent) {
playQueue.append(newQueue.getStreams());

if ((intent.getBooleanExtra(SELECT_ON_APPEND, false)
|| currentState == STATE_COMPLETED) && newQueue.getStreams().size() > 0) {
|| currentState == STATE_COMPLETED) && !newQueue.getStreams().isEmpty()) {
playQueue.setIndex(sizeBeforeAppend);
}

Expand Down Expand Up @@ -2326,7 +2326,7 @@ public void onRepeatModeChanged(@RepeatMode final int repeatMode) {
Log.d(TAG, "ExoPlayer - onRepeatModeChanged() called with: "
+ "repeatMode = [" + repeatMode + "]");
}
setRepeatModeButton(((AppCompatImageButton) binding.repeatButton), repeatMode);
setRepeatModeButton(binding.repeatButton, repeatMode);
onShuffleOrRepeatModeChanged();
}

Expand Down Expand Up @@ -3189,7 +3189,7 @@ public void onScrolledDown(final RecyclerView recyclerView) {
private StreamSegmentAdapter.StreamSegmentListener getStreamSegmentListener() {
return (item, seconds) -> {
segmentAdapter.selectSegment(item);
seekTo(seconds * 1000);
seekTo(seconds * 1000L);
triggerProgressUpdate();
};
}
Expand All @@ -3199,7 +3199,7 @@ private int getNearestStreamSegmentPosition(final long playbackPosition) {
final List<StreamSegment> segments = currentMetadata.getMetadata().getStreamSegments();

for (int i = 0; i < segments.size(); i++) {
if (segments.get(i).getStartTimeSeconds() * 1000 > playbackPosition) {
if (segments.get(i).getStartTimeSeconds() * 1000L > playbackPosition) {
break;
}
nearestPosition++;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@

import static org.schabi.newpipe.util.external_communication.ShareUtils.installApp;

import com.jakewharton.processphoenix.ProcessPhoenix;

public final class NavigationHelper {
public static final String MAIN_FRAGMENT_TAG = "main_fragment_tag";
public static final String SEARCH_FRAGMENT_TAG = "search_fragment_tag";
Expand Down Expand Up @@ -360,7 +362,7 @@ public static void openVideoDetailFragment(@NonNull final Context context,
autoPlay = false;
}

final RunnableWithVideoDetailFragment onVideoDetailFragmentReady = (detailFragment) -> {
final RunnableWithVideoDetailFragment onVideoDetailFragmentReady = detailFragment -> {
expandMainPlayer(detailFragment.requireActivity());
detailFragment.setAutoPlay(autoPlay);
if (switchingPlayers) {
Expand Down Expand Up @@ -607,8 +609,7 @@ public static void playWithKore(final Context context, final Uri videoURL) {
*/
public static void restartApp(final Activity activity) {
NewPipeDatabase.close();
activity.finishAffinity();
final Intent intent = new Intent(activity, MainActivity.class);
activity.startActivity(intent);

ProcessPhoenix.triggerRebirth(activity.getApplicationContext());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ public static boolean checkSystemAlertWindowPermission(final Context context) {

public static boolean isPopupEnabled(final Context context) {
return Build.VERSION.SDK_INT < Build.VERSION_CODES.M
|| PermissionHelper.checkSystemAlertWindowPermission(context);
|| checkSystemAlertWindowPermission(context);
}

public static void showPopupEnablementToast(final Context context) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
package org.schabi.newpipe.util.external_communication;

import android.content.Context;
import android.util.Log;

import androidx.annotation.NonNull;
import androidx.appcompat.app.AlertDialog;

import org.schabi.newpipe.MainActivity;
import org.schabi.newpipe.R;
import org.schabi.newpipe.error.ErrorPanelHelper;
import org.schabi.newpipe.extractor.NewPipe;
import org.schabi.newpipe.extractor.StreamingService;
import org.schabi.newpipe.extractor.exceptions.ExtractionException;
Expand All @@ -24,6 +29,9 @@
import io.reactivex.rxjava3.schedulers.Schedulers;

public final class InternalUrlsHandler {
private static final String TAG = InternalUrlsHandler.class.getSimpleName();
private static final boolean DEBUG = MainActivity.DEBUG;

private static final Pattern AMPERSAND_TIMESTAMP_PATTERN = Pattern.compile("(.*)&t=(\\d+)");
private static final Pattern HASHTAG_TIMESTAMP_PATTERN =
Pattern.compile("(.*)#timestamp=(\\d+)");
Expand Down Expand Up @@ -93,7 +101,12 @@ private static boolean handleUrl(final Context context,
return false;
}
final String matchedUrl = matcher.group(1);
final int seconds = Integer.parseInt(matcher.group(2));
final int seconds;
if (matcher.group(2) == null) {
seconds = -1;
} else {
seconds = Integer.parseInt(matcher.group(2));
}

final StreamingService service;
final StreamingService.LinkType linkType;
Expand Down Expand Up @@ -146,8 +159,18 @@ public static boolean playOnPopup(final Context context,
.observeOn(AndroidSchedulers.mainThread())
.subscribe(info -> {
final PlayQueue playQueue
= new SinglePlayQueue(info, seconds * 1000);
= new SinglePlayQueue(info, seconds * 1000L);
NavigationHelper.playOnPopupPlayer(context, playQueue, false);
}, throwable -> {
if (DEBUG) {
Log.e(TAG, "Could not play on popup: " + url, throwable);
}
new AlertDialog.Builder(context)
.setTitle(R.string.player_stream_failure)
.setMessage(
ErrorPanelHelper.Companion.getExceptionDescription(throwable))
.setPositiveButton(R.string.ok, (v, b) -> { })
.show();
}));
return true;
}
Expand Down
8 changes: 3 additions & 5 deletions app/src/main/res/values-b+zh+HANS+CN/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -647,14 +647,12 @@
<string name="remote_search_suggestions">远程搜索建议</string>
<string name="local_search_suggestions">本地搜索建议</string>
<plurals name="deleted_downloads_toast">
<item quantity="one">删除了 %1$s 个下载</item>
<item quantity="other"/>
<item quantity="other">删除了 %1$s 个下载</item>
</plurals>
<plurals name="download_finished_notification">
<item quantity="one">完成了 %s 个下载</item>
<item quantity="other"/>
<item quantity="other">完成了 %s 个下载</item>
</plurals>
<string name="main_page_content_swipe_remove">滑动项目以删除它们</string>
<string name="start_main_player_fullscreen_summary">若自动旋转被锁定,不在以小窗播放器形式中播放视频,而直接切换到全屏模式。仍可以通过退出全屏以切换至小窗播放器</string>
<string name="start_main_player_fullscreen_summary">若自动旋转被锁定,不在以小窗播放器形式中播放视频,而直接切换到全屏模式。仍可以通过退出全屏以切换至小窗播放器</string>
<string name="start_main_player_fullscreen_title">以全屏启动主播放器</string>
</resources>
2 changes: 1 addition & 1 deletion app/src/main/res/values-cs/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -603,7 +603,7 @@
<string name="crash_the_app">Zbořit aplikaci</string>
<string name="download_has_started">Stahování bylo zahájeno</string>
<string name="select_night_theme_toast">Můžete si zvolit svůj oblíbený motiv níže</string>
<string name="night_theme_summary">Zvolte si svůj oblíbený noční motiv -- %s</string>
<string name="night_theme_summary">Zvolte si svůj oblíbený noční motiv - %s</string>
<string name="auto_device_theme_title">Automatický (motiv zařízení)</string>
<string name="radio">Radio</string>
<string name="featured">Představujeme</string>
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values-de/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -665,6 +665,6 @@
<item quantity="other">%s Downloads abgeschlossen</item>
</plurals>
<string name="main_page_content_swipe_remove">Wische über Elemente, um sie zu entfernen</string>
<string name="start_main_player_fullscreen_summary">Videos nicht im Miniplayer starten, sondern direkt in den Vollbildmodus schalten, wenn die automatische Drehung gesperrt ist. Du kannst immer noch auf den Miniplayer zugreifen, wenn du den Vollbildmodus verlässt.</string>
<string name="start_main_player_fullscreen_summary">Videos nicht im Miniplayer starten, sondern direkt in den Vollbildmodus schalten, wenn die automatische Drehung gesperrt ist. Du kannst immer noch auf den Miniplayer zugreifen, wenn du den Vollbildmodus verlässt</string>
<string name="start_main_player_fullscreen_title">Hauptplayer im Vollbildmodus starten</string>
</resources>
Loading