diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 07cb9f66c..574c87ad3 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -5,11 +5,14 @@ PLEASE READ THESE GUIDELINES CAREFULLY BEFORE ANY CONTRIBUTION! ## Crash reporting -Do not report crashes in the GitHub issue tracker. NewPipe has an automated crash report system that will ask you to send a report via e-mail when a crash occurs. This contains all the data we need for debugging, and allows you to even add a comment to it. You'll see exactly what is sent, the system is 100% transparent. +Do not report crashes in the GitHub issue tracker. NewPipe has an automated crash report system that will ask you to +send a report via e-mail when a crash occurs. This contains all the data we need for debugging, and allows you to even +add a comment to it. You'll see exactly what is sent, the system is 100% transparent. ## Issue reporting/feature requests -* Search the [existing issues](https://github.com/TeamNewPipe/NewPipe/issues) first to make sure your issue/feature hasn't been reported/requested before +* Search the [existing issues](https://github.com/TeamNewPipe/NewPipe/issues) first to make sure your issue/feature +hasn't been reported/requested before * Check whether your issue/feature is already fixed/implemented * Check if the issue still exists in the latest release/beta version * If you are an Android/Java developer, you are always welcome to fix/implement an issue/a feature yourself. PRs welcome! @@ -19,30 +22,47 @@ Do not report crashes in the GitHub issue tracker. NewPipe has an automated cras * Issues that only contain a generated bug report, but no describtion might be closed. ## Bug Fixing -* If you want to help NewPipe to become free of bugs (this is our utopic goal for NewPipe), you can send us an email to tnp@newpipe.schabi.org to let me know that you intend to help. We'll send you further instructions. You may, on request, register at our [Sentry](https://sentry.schabi.org) instance (see section "Crash reporting" for more information. +* If you want to help NewPipe to become free of bugs (this is our utopic goal for NewPipe), you can send us an email to +tnp@newpipe.schabi.org to let me know that you intend to help. We'll send you further instructions. You may, on request, +register at our [Sentry](https://sentry.schabi.org) instance (see section "Crash reporting" for more information. ## Translation -* NewPipe can be translated via [Weblate](https://hosted.weblate.org/projects/newpipe/strings/). You can log in there with your GitHub account. +* NewPipe can be translated via [Weblate](https://hosted.weblate.org/projects/newpipe/strings/). You can log in there +with your GitHub account. ## Code contribution * Stick to NewPipe's style conventions (well, just look the other code and then do it the same way :)) -* Do not bring non-free software (e.g., binary blobs) into the project. Also, make sure you do not introduce Google libraries. +* Do not bring non-free software (e.g., binary blobs) into the project. Also, make sure you do not introduce Google + libraries. * Stick to [F-Droid contribution guidelines](https://f-droid.org/wiki/page/Inclusion_Policy) -* Make changes on a separate branch, not on the master branch. This is commonly known as *feature branch workflow*. You may then send your changes as a pull request on GitHub. Patches to the email address mentioned in this document might not be considered, GitHub is the primary platform. (This only affects you if you are a member of TeamNewPipe) -* When submitting changes, you confirm that your code is licensed under the terms of the [GNU General Public License v3](https://www.gnu.org/licenses/gpl-3.0.html). -* Please test (compile and run) your code before you submit changes! Ideally, provide test feedback in the PR description. Untested code will **not** be merged! +* Make changes on a separate branch, not on the master branch. This is commonly known as *feature branch workflow*. You + may then send your changes as a pull request on GitHub. Patches to the email address mentioned in this document might + not be considered, GitHub is the primary platform. (This only affects you if you are a member of TeamNewPipe) +* When submitting changes, you confirm that your code is licensed under the terms of the + [GNU General Public License v3](https://www.gnu.org/licenses/gpl-3.0.html). +* Please test (compile and run) your code before you submit changes! Ideally, provide test feedback in the PR + description. Untested code will **not** be merged! * Try to figure out yourself why builds on our CI fail. -* Make sure your PR is up-to-date with the rest of the code. Often, a simple click on "Update branch" will do the job, but if not, you are asked to merge the master branch manually and resolve the problems on your own. That will make the maintainers' jobs way easier. -* Please show intention to maintain your features and code after you contributed it. Unmaintained code is a hassle for the core developers, and just adds work. If you do not intend to maintain features you contributed, please think again about submission, or clearly state that in the description of your PR. +* Make sure your PR is up-to-date with the rest of the code. Often, a simple click on "Update branch" will do the job, + but if not, you are asked to merge the master branch manually and resolve the problems on your own. That will make the + maintainers' jobs way easier. +* Please show intention to maintain your features and code after you contributed it. Unmaintained code is a hassle for + the core developers, and just adds work. If you do not intend to maintain features you contributed, please think again + about submission, or clearly state that in the description of your PR. * Respond yourselves if someone requests changes or otherwise raises issues about your PRs. * Check if your contributions align with the [fdroid inclusion guidelines](https://f-droid.org/en/docs/Inclusion_Policy/). * Check if your submission can be build with the current fdroid build server setup. +* Send PR that only cover one specific issue/solution/bug. Do not send PRs that are huge and consists of multiple + independent solutions. ## Communication * WE DO NOW HAVE A MAILING LIST: [newpipe@list.schabi.org](https://list.schabi.org/cgi-bin/mailman/listinfo/newpipe). -* There is an IRC channel on Freenode which is regularly visited by the core team and other developers: [#newpipe](irc:irc.freenode.net/newpipe). [Click here for Webchat](https://webchat.freenode.net/?channels=newpipe)! -* If you want to get in touch with the core team or one of our other contributors you can send an email to tnp(at)schabi.org. Please do not send issue reports, they will be ignored and remain unanswered! Use the GitHub issue tracker described above! +* There is an IRC channel on Freenode which is regularly visited by the core team and other developers: + [#newpipe](irc:irc.freenode.net/newpipe). [Click here for Webchat](https://webchat.freenode.net/?channels=newpipe)! +* If you want to get in touch with the core team or one of our other contributors you can send an email to + tnp(at)schabi.org. Please do not send issue reports, they will be ignored and remain unanswered! Use the GitHub issue + tracker described above! * Feel free to post suggestions, changes, ideas etc. on GitHub, IRC or the mailing list! diff --git a/.travis.yml b/.travis.yml index d5d3aed9c..d6f97ab55 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,13 +5,13 @@ android: components: # The BuildTools version used by NewPipe - tools - - build-tools-27.0.3 + - build-tools-28.0.3 # The SDK version used to compile NewPipe - - android-27 + - android-28 before_install: - - yes | sdkmanager "platforms;android-27" + - yes | sdkmanager "platforms;android-28" script: ./gradlew -Dorg.gradle.jvmargs=-Xmx1536m assembleDebug lintDebug testDebugUnitTest licenses: diff --git a/README.md b/README.md index b154fad58..15ba3d04b 100644 --- a/README.md +++ b/README.md @@ -1,74 +1,77 @@ -
+Screenshots • Description • Features • Contribution • Donate • License
-- | + | + | 16A9J59ahMRqkLSZjhYj33n9j3fMztFxnh | ||
- | - | + | + | + | |
- | - | + | + | + |
* {@link ExoPlaybackException#TYPE_SOURCE TYPE_SOURCE}:
- *
+ *
* {@link ExoPlaybackException#TYPE_UNEXPECTED TYPE_UNEXPECTED}:
* If a runtime error occurred, then we can try to recover it by restarting the playback
* after setting the timestamp recovery.
- *
+ *
* {@link ExoPlaybackException#TYPE_RENDERER TYPE_RENDERER}:
* If the renderer failed, treat the error as unrecoverable.
*
* @see #processSourceError(IOException)
* @see Player.EventListener#onPlayerError(ExoPlaybackException)
- * */
+ */
@Override
public void onPlayerError(ExoPlaybackException error) {
if (DEBUG) Log.d(TAG, "ExoPlayer - onPlayerError() called with: " +
@@ -899,8 +926,8 @@ public abstract class BasePlayer implements
if (DEBUG) Log.d(TAG, "onPlayPrevious() called");
/* If current playback has run for PLAY_PREV_ACTIVATION_LIMIT_MILLIS milliseconds,
- * restart current track. Also restart the track if the current track
- * is the first in a queue.*/
+ * restart current track. Also restart the track if the current track
+ * is the first in a queue.*/
if (simpleExoPlayer.getCurrentPosition() > PLAY_PREV_ACTIVATION_LIMIT_MILLIS ||
playQueue.getIndex() == 0) {
seekToDefault();
@@ -1009,8 +1036,8 @@ public abstract class BasePlayer implements
try {
metadata = (MediaSourceTag) simpleExoPlayer.getCurrentTag();
} catch (IndexOutOfBoundsException | ClassCastException error) {
- if(DEBUG) Log.d(TAG, "Could not update metadata: " + error.getMessage());
- if(DEBUG) error.printStackTrace();
+ if (DEBUG) Log.d(TAG, "Could not update metadata: " + error.getMessage());
+ if (DEBUG) error.printStackTrace();
return;
}
@@ -1074,7 +1101,9 @@ public abstract class BasePlayer implements
currentThumbnail;
}
- /** Checks if the current playback is a livestream AND is playing at or beyond the live edge */
+ /**
+ * Checks if the current playback is a livestream AND is playing at or beyond the live edge
+ */
@SuppressWarnings("BooleanMethodIsAlwaysInverted")
public boolean isLiveEdge() {
if (simpleExoPlayer == null || !isLive()) return false;
@@ -1098,13 +1127,14 @@ public abstract class BasePlayer implements
} catch (@NonNull IndexOutOfBoundsException ignored) {
// Why would this even happen =(
// But lets log it anyway. Save is save
- if(DEBUG) Log.d(TAG, "Could not update metadata: " + ignored.getMessage());
- if(DEBUG) ignored.printStackTrace();
+ if (DEBUG) Log.d(TAG, "Could not update metadata: " + ignored.getMessage());
+ if (DEBUG) ignored.printStackTrace();
return false;
}
}
public boolean isPlaying() {
+ if (simpleExoPlayer == null) return false;
final int state = simpleExoPlayer.getPlaybackState();
return (state == Player.STATE_READY || state == Player.STATE_BUFFERING)
&& simpleExoPlayer.getPlayWhenReady();
@@ -1112,7 +1142,9 @@ public abstract class BasePlayer implements
@Player.RepeatMode
public int getRepeatMode() {
- return simpleExoPlayer == null ? Player.REPEAT_MODE_OFF : simpleExoPlayer.getRepeatMode();
+ return simpleExoPlayer == null
+ ? Player.REPEAT_MODE_OFF
+ : simpleExoPlayer.getRepeatMode();
}
public void setRepeatMode(@Player.RepeatMode final int repeatMode) {
@@ -1178,4 +1210,8 @@ public abstract class BasePlayer implements
if (DEBUG) Log.d(TAG, "Setting recovery, queue: " + queuePos + ", pos: " + windowPos);
playQueue.setRecovery(queuePos, windowPos);
}
+
+ public boolean gotDestroyed() {
+ return simpleExoPlayer == null;
+ }
}
diff --git a/app/src/main/java/org/schabi/newpipe/player/MainVideoPlayer.java b/app/src/main/java/org/schabi/newpipe/player/MainVideoPlayer.java
index 4e8398ff2..f4fea5165 100644
--- a/app/src/main/java/org/schabi/newpipe/player/MainVideoPlayer.java
+++ b/app/src/main/java/org/schabi/newpipe/player/MainVideoPlayer.java
@@ -175,6 +175,10 @@ public final class MainVideoPlayer extends AppCompatActivity
setLandscape(lastOrientationWasLandscape);
}
+ final int lastResizeMode = defaultPreferences.getInt(
+ getString(R.string.last_resize_mode), AspectRatioFrameLayout.RESIZE_MODE_FIT);
+ playerImpl.setResizeMode(lastResizeMode);
+
// Upon going in or out of multiwindow mode, isInMultiWindow will always be false,
// since the first onResume needs to restore the player.
// Subsequent onResume calls while multiwindow mode remains the same and the player is
@@ -213,10 +217,9 @@ public final class MainVideoPlayer extends AppCompatActivity
if (playerImpl == null) return;
playerImpl.setRecovery();
- playerState = new PlayerState(playerImpl.getPlayQueue(), playerImpl.getRepeatMode(),
- playerImpl.getPlaybackSpeed(), playerImpl.getPlaybackPitch(),
- playerImpl.getPlaybackQuality(), playerImpl.getPlaybackSkipSilence(),
- playerImpl.isPlaying());
+ if(!playerImpl.gotDestroyed()) {
+ playerState = createPlayerState();
+ }
StateSaver.tryToSave(isChangingConfigurations(), null, outState, this);
}
@@ -231,6 +234,7 @@ public final class MainVideoPlayer extends AppCompatActivity
if (!isBackPressed) {
playerImpl.minimize();
}
+ playerState = createPlayerState();
playerImpl.destroy();
isInMultiWindow = false;
@@ -241,6 +245,13 @@ public final class MainVideoPlayer extends AppCompatActivity
// State Saving
//////////////////////////////////////////////////////////////////////////*/
+ private PlayerState createPlayerState() {
+ return new PlayerState(playerImpl.getPlayQueue(), playerImpl.getRepeatMode(),
+ playerImpl.getPlaybackSpeed(), playerImpl.getPlaybackPitch(),
+ playerImpl.getPlaybackQuality(), playerImpl.getPlaybackSkipSilence(),
+ playerImpl.isPlaying());
+ }
+
@Override
public String generateSuffix() {
return "." + UUID.randomUUID().toString() + ".player";
@@ -705,14 +716,27 @@ public final class MainVideoPlayer extends AppCompatActivity
@Override
protected int nextResizeMode(int currentResizeMode) {
+ final int newResizeMode;
switch (currentResizeMode) {
case AspectRatioFrameLayout.RESIZE_MODE_FIT:
- return AspectRatioFrameLayout.RESIZE_MODE_FILL;
+ newResizeMode = AspectRatioFrameLayout.RESIZE_MODE_FILL;
+ break;
case AspectRatioFrameLayout.RESIZE_MODE_FILL:
- return AspectRatioFrameLayout.RESIZE_MODE_ZOOM;
+ newResizeMode = AspectRatioFrameLayout.RESIZE_MODE_ZOOM;
+ break;
default:
- return AspectRatioFrameLayout.RESIZE_MODE_FIT;
+ newResizeMode = AspectRatioFrameLayout.RESIZE_MODE_FIT;
+ break;
}
+
+ storeResizeMode(newResizeMode);
+ return newResizeMode;
+ }
+
+ private void storeResizeMode(@AspectRatioFrameLayout.ResizeMode int resizeMode) {
+ defaultPreferences.edit()
+ .putInt(getString(R.string.last_resize_mode), resizeMode)
+ .apply();
}
@Override
@@ -876,6 +900,11 @@ public final class MainVideoPlayer extends AppCompatActivity
public void onMove(int sourceIndex, int targetIndex) {
if (playQueue != null) playQueue.move(sourceIndex, targetIndex);
}
+
+ @Override
+ public void onSwiped(int index) {
+ if(index != -1) playQueue.remove(index);
+ }
};
}
@@ -989,12 +1018,14 @@ public final class MainVideoPlayer extends AppCompatActivity
private static final int MOVEMENT_THRESHOLD = 40;
- private final boolean isPlayerGestureEnabled = PlayerHelper.isPlayerGestureEnabled(getApplicationContext());
+ private final boolean isVolumeGestureEnabled = PlayerHelper.isVolumeGestureEnabled(getApplicationContext());
+ private final boolean isBrightnessGestureEnabled = PlayerHelper.isBrightnessGestureEnabled(getApplicationContext());
+
private final int maxVolume = playerImpl.getAudioReactor().getMaxVolume();
@Override
public boolean onScroll(MotionEvent initialEvent, MotionEvent movingEvent, float distanceX, float distanceY) {
- if (!isPlayerGestureEnabled) return false;
+ if (!isVolumeGestureEnabled && !isBrightnessGestureEnabled) return false;
//noinspection PointlessBooleanExpression
if (DEBUG && false) Log.d(TAG, "MainVideoPlayer.onScroll = " +
@@ -1010,7 +1041,11 @@ public final class MainVideoPlayer extends AppCompatActivity
isMoving = true;
- if (initialEvent.getX() > playerImpl.getRootView().getWidth() / 2) {
+ boolean acceptAnyArea = isVolumeGestureEnabled != isBrightnessGestureEnabled;
+ boolean acceptVolumeArea = acceptAnyArea || initialEvent.getX() > playerImpl.getRootView().getWidth() / 2;
+ boolean acceptBrightnessArea = acceptAnyArea || !acceptVolumeArea;
+
+ if (isVolumeGestureEnabled && acceptVolumeArea) {
playerImpl.getVolumeProgressBar().incrementProgressBy((int) distanceY);
float currentProgressPercent =
(float) playerImpl.getVolumeProgressBar().getProgress() / playerImpl.getMaxGestureLength();
@@ -1035,7 +1070,7 @@ public final class MainVideoPlayer extends AppCompatActivity
if (playerImpl.getBrightnessRelativeLayout().getVisibility() == View.VISIBLE) {
playerImpl.getBrightnessRelativeLayout().setVisibility(View.GONE);
}
- } else {
+ } else if (isBrightnessGestureEnabled && acceptBrightnessArea) {
playerImpl.getBrightnessProgressBar().incrementProgressBy((int) distanceY);
float currentProgressPercent =
(float) playerImpl.getBrightnessProgressBar().getProgress() / playerImpl.getMaxGestureLength();
diff --git a/app/src/main/java/org/schabi/newpipe/player/PopupVideoPlayer.java b/app/src/main/java/org/schabi/newpipe/player/PopupVideoPlayer.java
index a36a0576c..f5c731ed9 100644
--- a/app/src/main/java/org/schabi/newpipe/player/PopupVideoPlayer.java
+++ b/app/src/main/java/org/schabi/newpipe/player/PopupVideoPlayer.java
@@ -68,7 +68,6 @@ import org.schabi.newpipe.extractor.stream.VideoStream;
import org.schabi.newpipe.player.event.PlayerEventListener;
import org.schabi.newpipe.player.helper.LockManager;
import org.schabi.newpipe.player.helper.PlayerHelper;
-import org.schabi.newpipe.player.old.PlayVideoActivity;
import org.schabi.newpipe.player.resolver.MediaSourceTag;
import org.schabi.newpipe.player.resolver.VideoPlaybackResolver;
import org.schabi.newpipe.util.ListHelper;
@@ -80,7 +79,6 @@ import java.util.List;
import static org.schabi.newpipe.player.BasePlayer.STATE_PLAYING;
import static org.schabi.newpipe.player.VideoPlayer.DEFAULT_CONTROLS_DURATION;
import static org.schabi.newpipe.player.VideoPlayer.DEFAULT_CONTROLS_HIDE_TIME;
-import static org.schabi.newpipe.player.helper.PlayerHelper.isUsingOldPlayer;
import static org.schabi.newpipe.util.AnimationUtils.animateView;
/**
@@ -554,27 +552,17 @@ public final class PopupVideoPlayer extends Service {
if (DEBUG) Log.d(TAG, "onFullScreenButtonClicked() called");
setRecovery();
- Intent intent;
- if (!isUsingOldPlayer(getApplicationContext())) {
- intent = NavigationHelper.getPlayerIntent(
- context,
- MainVideoPlayer.class,
- this.getPlayQueue(),
- this.getRepeatMode(),
- this.getPlaybackSpeed(),
- this.getPlaybackPitch(),
- this.getPlaybackSkipSilence(),
- this.getPlaybackQuality()
- );
- intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
- } else {
- intent = new Intent(PopupVideoPlayer.this, PlayVideoActivity.class)
- .putExtra(PlayVideoActivity.VIDEO_TITLE, getVideoTitle())
- .putExtra(PlayVideoActivity.STREAM_URL, getSelectedVideoStream().getUrl())
- .putExtra(PlayVideoActivity.VIDEO_URL, getVideoUrl())
- .putExtra(PlayVideoActivity.START_POSITION, Math.round(getPlayer().getCurrentPosition() / 1000f));
- intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
- }
+ final Intent intent = NavigationHelper.getPlayerIntent(
+ context,
+ MainVideoPlayer.class,
+ this.getPlayQueue(),
+ this.getRepeatMode(),
+ this.getPlaybackSpeed(),
+ this.getPlaybackPitch(),
+ this.getPlaybackSkipSilence(),
+ this.getPlaybackQuality()
+ );
+ intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(intent);
closePopup();
}
diff --git a/app/src/main/java/org/schabi/newpipe/player/ServicePlayerActivity.java b/app/src/main/java/org/schabi/newpipe/player/ServicePlayerActivity.java
index 94305e6c4..2ec4275fc 100644
--- a/app/src/main/java/org/schabi/newpipe/player/ServicePlayerActivity.java
+++ b/app/src/main/java/org/schabi/newpipe/player/ServicePlayerActivity.java
@@ -375,6 +375,11 @@ public abstract class ServicePlayerActivity extends AppCompatActivity
public void onMove(int sourceIndex, int targetIndex) {
if (player != null) player.getPlayQueue().move(sourceIndex, targetIndex);
}
+
+ @Override
+ public void onSwiped(int index) {
+ if (index != -1) player.getPlayQueue().remove(index);
+ }
};
}
diff --git a/app/src/main/java/org/schabi/newpipe/player/VideoPlayer.java b/app/src/main/java/org/schabi/newpipe/player/VideoPlayer.java
index 8e7db0dae..d30d9b8be 100644
--- a/app/src/main/java/org/schabi/newpipe/player/VideoPlayer.java
+++ b/app/src/main/java/org/schabi/newpipe/player/VideoPlayer.java
@@ -683,12 +683,17 @@ public abstract class VideoPlayer extends BasePlayer
if (getAspectRatioFrameLayout() != null) {
final int currentResizeMode = getAspectRatioFrameLayout().getResizeMode();
final int newResizeMode = nextResizeMode(currentResizeMode);
- getAspectRatioFrameLayout().setResizeMode(newResizeMode);
- getResizeView().setText(PlayerHelper.resizeTypeOf(context, newResizeMode));
+ setResizeMode(newResizeMode);
}
}
+ protected void setResizeMode(@AspectRatioFrameLayout.ResizeMode final int resizeMode) {
+ getAspectRatioFrameLayout().setResizeMode(resizeMode);
+ getResizeView().setText(PlayerHelper.resizeTypeOf(context, resizeMode));
+ }
+
protected abstract int nextResizeMode(@AspectRatioFrameLayout.ResizeMode final int resizeMode);
+
/*//////////////////////////////////////////////////////////////////////////
// SeekBar Listener
//////////////////////////////////////////////////////////////////////////*/
diff --git a/app/src/main/java/org/schabi/newpipe/player/helper/PlayerHelper.java b/app/src/main/java/org/schabi/newpipe/player/helper/PlayerHelper.java
index 05afe2859..bd174eb45 100644
--- a/app/src/main/java/org/schabi/newpipe/player/helper/PlayerHelper.java
+++ b/app/src/main/java/org/schabi/newpipe/player/helper/PlayerHelper.java
@@ -19,11 +19,11 @@ import com.google.android.exoplayer2.util.MimeTypes;
import org.schabi.newpipe.R;
import org.schabi.newpipe.extractor.InfoItem;
-import org.schabi.newpipe.extractor.Subtitles;
+import org.schabi.newpipe.extractor.MediaFormat;
import org.schabi.newpipe.extractor.stream.AudioStream;
import org.schabi.newpipe.extractor.stream.StreamInfo;
import org.schabi.newpipe.extractor.stream.StreamInfoItem;
-import org.schabi.newpipe.extractor.stream.SubtitlesFormat;
+import org.schabi.newpipe.extractor.stream.SubtitlesStream;
import org.schabi.newpipe.extractor.stream.VideoStream;
import org.schabi.newpipe.player.playqueue.PlayQueue;
import org.schabi.newpipe.player.playqueue.PlayQueueItem;
@@ -87,7 +87,7 @@ public class PlayerHelper {
return pitchFormatter.format(pitch);
}
- public static String mimeTypesOf(final SubtitlesFormat format) {
+ public static String mimeTypesOf(final MediaFormat format) {
switch (format) {
case VTT: return MimeTypes.TEXT_VTT;
case TTML: return MimeTypes.APPLICATION_TTML;
@@ -97,7 +97,7 @@ public class PlayerHelper {
@NonNull
public static String captionLanguageOf(@NonNull final Context context,
- @NonNull final Subtitles subtitles) {
+ @NonNull final SubtitlesStream subtitles) {
final String displayName = subtitles.getLocale().getDisplayName(subtitles.getLocale());
return displayName + (subtitles.isAutoGenerated() ? " (" + context.getString(R.string.caption_auto_generated)+ ")" : "");
}
@@ -169,12 +169,12 @@ public class PlayerHelper {
return isResumeAfterAudioFocusGain(context, false);
}
- public static boolean isPlayerGestureEnabled(@NonNull final Context context) {
- return isPlayerGestureEnabled(context, true);
+ public static boolean isVolumeGestureEnabled(@NonNull final Context context) {
+ return isVolumeGestureEnabled(context, true);
}
- public static boolean isUsingOldPlayer(@NonNull final Context context) {
- return isUsingOldPlayer(context, false);
+ public static boolean isBrightnessGestureEnabled(@NonNull final Context context) {
+ return isBrightnessGestureEnabled(context, true);
}
public static boolean isRememberingPopupDimensions(@NonNull final Context context) {
@@ -306,12 +306,12 @@ public class PlayerHelper {
return getPreferences(context).getBoolean(context.getString(R.string.resume_on_audio_focus_gain_key), b);
}
- private static boolean isPlayerGestureEnabled(@NonNull final Context context, final boolean b) {
- return getPreferences(context).getBoolean(context.getString(R.string.player_gesture_controls_key), b);
+ private static boolean isVolumeGestureEnabled(@NonNull final Context context, final boolean b) {
+ return getPreferences(context).getBoolean(context.getString(R.string.volume_gesture_control_key), b);
}
- private static boolean isUsingOldPlayer(@NonNull final Context context, final boolean b) {
- return getPreferences(context).getBoolean(context.getString(R.string.use_old_player_key), b);
+ private static boolean isBrightnessGestureEnabled(@NonNull final Context context, final boolean b) {
+ return getPreferences(context).getBoolean(context.getString(R.string.brightness_gesture_control_key), b);
}
private static boolean isRememberingPopupDimensions(@NonNull final Context context, final boolean b) {
diff --git a/app/src/main/java/org/schabi/newpipe/player/old/PlayVideoActivity.java b/app/src/main/java/org/schabi/newpipe/player/old/PlayVideoActivity.java
deleted file mode 100644
index 092f82aad..000000000
--- a/app/src/main/java/org/schabi/newpipe/player/old/PlayVideoActivity.java
+++ /dev/null
@@ -1,369 +0,0 @@
-package org.schabi.newpipe.player.old;
-
-import android.content.Context;
-import android.content.Intent;
-import android.content.SharedPreferences;
-import android.content.pm.ActivityInfo;
-import android.content.res.Configuration;
-import android.media.AudioManager;
-import android.media.MediaPlayer;
-import android.net.Uri;
-import android.os.Build;
-import android.os.Bundle;
-import android.os.Handler;
-import android.support.v7.app.ActionBar;
-import android.support.v7.app.AppCompatActivity;
-import android.util.DisplayMetrics;
-import android.util.Log;
-import android.view.Display;
-import android.view.KeyEvent;
-import android.view.Menu;
-import android.view.MenuInflater;
-import android.view.MenuItem;
-import android.view.View;
-import android.view.WindowManager;
-import android.widget.Button;
-import android.widget.MediaController;
-import android.widget.ProgressBar;
-import android.widget.VideoView;
-
-import org.schabi.newpipe.R;
-
-/*
- * Copyright (C) Christian Schabesberger 2015 > suggestionsFor(final int serviceId,
- final String query,
- final String contentCountry) {
+ final String query) {
checkServiceId(serviceId);
return Single.fromCallable(() ->
NewPipe.getService(serviceId)
.getSuggestionExtractor()
- .suggestionList(query, contentCountry));
+ .suggestionList(query));
}
public static Single