Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
9d773d6
removed dot menu where its no longer needed
kaminski-karol Jan 13, 2020
42ec6f0
ttml to srt conversion
kapodamy Jan 14, 2020
00eddcb
android 5 (lollipop) fixup
kapodamy Jan 8, 2020
a228e70
menu-item History visibility accordingly to settings
kaminski-karol Jan 14, 2020
b965f88
removed main_menu.xml
kaminski-karol Jan 14, 2020
a0ee1b1
Merge branch 'dev' into issue-#2254
Jan 14, 2020
570dded
Add field START_PAUSED to the Player Intent
raphj Jan 16, 2020
ef90493
Deduplicate code switching to another player into a function
raphj Jan 16, 2020
7dbb2b2
Simplify an if expression
raphj Jan 16, 2020
a0548fd
Merge branch 'dev' into android5-temp-dir-issue
kapodamy Jan 18, 2020
845767e
StandardCharsets.UTF_8 instead of Charset.forName("utf-8")
kapodamy Jan 18, 2020
ed18466
Merge branch 'dev' into subtitles
kapodamy Jan 18, 2020
a2d3e2c
2 typo fixup
kapodamy Jan 18, 2020
266c3d0
Merge branch 'dev' into issue-#2254
Stypox Jan 19, 2020
8c3be2c
Merge pull request #2960 from karkaminski/issue-#2254
Stypox Jan 19, 2020
776d8a4
Merge branch 'dev' into android5-temp-dir-issue
kapodamy Jan 21, 2020
afc362d
readability changes
kapodamy Jan 21, 2020
b8f7261
Merge branch 'dev' into subtitles
kapodamy Jan 21, 2020
5bc0d2c
Merge branch 'master' into dev
TobiGr Jan 24, 2020
7f7bf84
Add link to FAQ in README
TobiGr Jan 25, 2020
bf5e94f
Merge pull request #2957 from kapodamy/subtitles
TobiGr Jan 26, 2020
cc83991
Merge pull request #2958 from kapodamy/android5-temp-dir-issue
TobiGr Jan 26, 2020
609855f
Merge pull request #2917 from raphj/patch-1
TobiGr Jan 26, 2020
94403a9
Add send to Kodi button to player next to share button
christophehenry Apr 25, 2019
be92921
Merge pull request #2310 from christophehenry/add-kodi-share-player
TobiGr Jan 27, 2020
fd3d61c
fixes #3021, see also https://github.com/TeamNewPipe/NewPipe-legacy/p…
mqus Jan 29, 2020
0447e4e
Merge pull request #3032 from mqus/fix_subtitles
TobiGr Jan 29, 2020
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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
</p>
<hr>
<p align="center"><a href="#screenshots">Screenshots</a> &bull; <a href="#description">Description</a> &bull; <a href="#features">Features</a> &bull; <a href="#updates">Updates</a> &bull; <a href="#contribution">Contribution</a> &bull; <a href="#donate">Donate</a> &bull; <a href="#license">License</a></p>
<p align="center"><a href="https://newpipe.schabi.org">Website</a> &bull; <a href="https://newpipe.schabi.org/blog/">Blog</a> &bull; <a href="https://newpipe.schabi.org/press/">Press</a></p>
<p align="center"><a href="https://newpipe.schabi.org">Website</a> &bull; <a href="https://newpipe.schabi.org/blog/">Blog</a> &bull; <a href="https://newpipe.schabi.org/FAQ/">FAQ</a> &bull; <a href="https://newpipe.schabi.org/press/">Press</a></p>
<hr>

<b>WARNING: THIS IS A BETA VERSION, THEREFORE YOU MAY ENCOUNTER BUGS. IF YOU DO, OPEN AN ISSUE VIA OUR GITHUB REPOSITORY.</b>
Expand Down
20 changes: 10 additions & 10 deletions app/src/main/java/org/schabi/newpipe/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -449,6 +449,16 @@ protected void onResume() {
sharedPreferences.edit().putBoolean(Constants.KEY_MAIN_PAGE_CHANGE, false).apply();
NavigationHelper.openMainActivity(this);
}

if (sharedPreferences.getBoolean(Constants.KEY_ENABLE_WATCH_HISTORY, true)) {
if (DEBUG) Log.d(TAG, "do not show History-menu as its disabled in settings");
drawerItems.getMenu().findItem(ITEM_ID_HISTORY).setVisible(true);
}

if (!sharedPreferences.getBoolean(Constants.KEY_ENABLE_WATCH_HISTORY, true)) {
if (DEBUG) Log.d(TAG, "show History-menu as its enabled in settings");
drawerItems.getMenu().findItem(ITEM_ID_HISTORY).setVisible(false);
}
}

@Override
Expand Down Expand Up @@ -551,8 +561,6 @@ public boolean onCreateOptionsMenu(Menu menu) {
if (!(fragment instanceof SearchFragment)) {
findViewById(R.id.toolbar).findViewById(R.id.toolbar_search_container).setVisibility(View.GONE);

MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.main_menu, menu);
}

ActionBar actionBar = getSupportActionBar();
Expand All @@ -574,14 +582,6 @@ public boolean onOptionsItemSelected(MenuItem item) {
case android.R.id.home:
onHomeButtonPressed();
return true;
case R.id.action_show_downloads:
return NavigationHelper.openDownloads(this);
case R.id.action_history:
NavigationHelper.openStatisticFragment(getSupportFragmentManager());
return true;
case R.id.action_settings:
NavigationHelper.openSettings(this);
return true;
default:
return super.onOptionsItemSelected(item);
}
Expand Down
5 changes: 0 additions & 5 deletions app/src/main/java/org/schabi/newpipe/about/AboutActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,6 @@ public boolean onOptionsItemSelected(MenuItem item) {
case android.R.id.home:
finish();
return true;
case R.id.action_settings:
NavigationHelper.openSettings(this);
return true;
case R.id.action_show_downloads:
return NavigationHelper.openDownloads(this);
}

return super.onOptionsItemSelected(item);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,7 @@ public boolean onOptionsItemSelected(MenuItem item) {
onBackPressed();
return true;
}
case R.id.action_settings: {
Intent intent = new Intent(this, SettingsActivity.class);
startActivity(intent);
return true;
}

default:
return super.onOptionsItemSelected(item);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -832,7 +832,6 @@ private void continueSelectedDownload(@NonNull StoredFileHelper storage) {
psArgs = new String[]{
selectedStream.getFormat().getSuffix(),
"false",// ignore empty frames
"false",// detect youtube duplicate lines
};
}
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@
import org.schabi.newpipe.util.ExtractorHelper;
import org.schabi.newpipe.util.ImageDisplayConstants;
import org.schabi.newpipe.util.InfoCache;
import org.schabi.newpipe.util.KoreUtil;
import org.schabi.newpipe.util.ListHelper;
import org.schabi.newpipe.util.Localization;
import org.schabi.newpipe.util.NavigationHelper;
Expand Down Expand Up @@ -624,24 +625,14 @@ public boolean onOptionsItemSelected(MenuItem item) {
url.replace("https", "http")));
} catch (Exception e) {
if (DEBUG) Log.i(TAG, "Failed to start kore", e);
showInstallKoreDialog(activity);
KoreUtil.showInstallKoreDialog(activity);
}
return true;
default:
return super.onOptionsItemSelected(item);
}
}

private static void showInstallKoreDialog(final Context context) {
final AlertDialog.Builder builder = new AlertDialog.Builder(context);
builder.setMessage(R.string.kore_not_found)
.setPositiveButton(R.string.install, (DialogInterface dialog, int which) ->
NavigationHelper.installKore(context))
.setNegativeButton(R.string.cancel, (DialogInterface dialog, int which) -> {
});
builder.create().show();
}

private void setupActionBarOnError(final String url) {
if (DEBUG) Log.d(TAG, "setupActionBarHandlerOnError() called with: url = [" + url + "]");
Log.e("-----", "missing code");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,7 @@ public boolean onPlayerOptionSelected(MenuItem item) {
return true;
}

this.player.setRecovery();
getApplicationContext().sendBroadcast(getPlayerShutdownIntent());
getApplicationContext().startService(getSwitchIntent(PopupVideoPlayer.class));
return true;
return switchTo(PopupVideoPlayer.class);
}
return false;
}
Expand Down
10 changes: 6 additions & 4 deletions app/src/main/java/org/schabi/newpipe/player/BasePlayer.java
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,8 @@ public abstract class BasePlayer implements
@NonNull
public static final String RESUME_PLAYBACK = "resume_playback";
@NonNull
public static final String START_PAUSED = "start_paused";
@NonNull
public static final String SELECT_ON_APPEND = "select_on_append";

/*//////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -304,7 +306,7 @@ public void handleIntent(Intent intent) {
}
// Good to go...
initPlayback(queue, repeatMode, playbackSpeed, playbackPitch, playbackSkipSilence,
/*playOnInit=*/true);
/*playOnInit=*/!intent.getBooleanExtra(START_PAUSED, false));
}

protected void initPlayback(@NonNull final PlayQueue queue,
Expand Down Expand Up @@ -944,10 +946,10 @@ public void onPause() {
public void onPlayPause() {
if (DEBUG) Log.d(TAG, "onPlayPause() called");

if (!isPlaying()) {
onPlay();
} else {
if (isPlaying()) {
onPause();
} else {
onPlay();
}
}

Expand Down
27 changes: 25 additions & 2 deletions app/src/main/java/org/schabi/newpipe/player/MainVideoPlayer.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.media.AudioManager;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
Expand Down Expand Up @@ -75,6 +76,7 @@
import org.schabi.newpipe.player.resolver.MediaSourceTag;
import org.schabi.newpipe.player.resolver.VideoPlaybackResolver;
import org.schabi.newpipe.util.AnimationUtils;
import org.schabi.newpipe.util.KoreUtil;
import org.schabi.newpipe.util.ListHelper;
import org.schabi.newpipe.util.NavigationHelper;
import org.schabi.newpipe.util.PermissionHelper;
Expand Down Expand Up @@ -435,6 +437,7 @@ private class VideoPlayerImpl extends VideoPlayer {
private boolean queueVisible;

private ImageButton moreOptionsButton;
private ImageButton kodiButton;
private ImageButton shareButton;
private ImageButton toggleOrientationButton;
private ImageButton switchPopupButton;
Expand Down Expand Up @@ -471,6 +474,7 @@ public void initViews(View rootView) {

this.moreOptionsButton = rootView.findViewById(R.id.moreOptionsButton);
this.secondaryControls = rootView.findViewById(R.id.secondaryControls);
this.kodiButton = rootView.findViewById(R.id.kodi);
this.shareButton = rootView.findViewById(R.id.share);
this.toggleOrientationButton = rootView.findViewById(R.id.toggleOrientation);
this.switchBackgroundButton = rootView.findViewById(R.id.switchBackground);
Expand All @@ -482,6 +486,9 @@ public void initViews(View rootView) {

titleTextView.setSelected(true);
channelTextView.setSelected(true);
boolean showKodiButton = PreferenceManager.getDefaultSharedPreferences(this.context).getBoolean(
this.context.getString(R.string.show_play_with_kodi_key), false);
kodiButton.setVisibility(showKodiButton ? View.VISIBLE : View.GONE);

getRootView().setKeepScreenOn(true);
}
Expand Down Expand Up @@ -518,6 +525,7 @@ public void initListeners() {
closeButton.setOnClickListener(this);

moreOptionsButton.setOnClickListener(this);
kodiButton.setOnClickListener(this);
shareButton.setOnClickListener(this);
toggleOrientationButton.setOnClickListener(this);
switchBackgroundButton.setOnClickListener(this);
Expand Down Expand Up @@ -588,6 +596,17 @@ public void onPlaybackShutdown() {
finish();
}

public void onKodiShare() {
onPause();
try {
NavigationHelper.playWithKore(this.context, Uri.parse(
playerImpl.getVideoUrl().replace("https", "http")));
} catch (Exception e) {
if (DEBUG) Log.i(TAG, "Failed to start kore", e);
KoreUtil.showInstallKoreDialog(this.context);
}
}

/*//////////////////////////////////////////////////////////////////////////
// Player Overrides
//////////////////////////////////////////////////////////////////////////*/
Expand All @@ -614,7 +633,8 @@ public void onFullScreenButtonClicked() {
this.getPlaybackPitch(),
this.getPlaybackSkipSilence(),
this.getPlaybackQuality(),
false
false,
!isPlaying()
);
context.startService(intent);

Expand All @@ -637,7 +657,8 @@ public void onPlayBackgroundButtonClicked() {
this.getPlaybackPitch(),
this.getPlaybackSkipSilence(),
this.getPlaybackQuality(),
false
false,
!isPlaying()
);
context.startService(intent);

Expand Down Expand Up @@ -686,6 +707,8 @@ public void onClick(View v) {
} else if (v.getId() == closeButton.getId()) {
onPlaybackShutdown();
return;
} else if (v.getId() == kodiButton.getId()) {
onKodiShare();
}

if (getCurrentState() != STATE_COMPLETED) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -567,7 +567,8 @@ public void onFullScreenButtonClicked() {
this.getPlaybackPitch(),
this.getPlaybackSkipSilence(),
this.getPlaybackQuality(),
false
false,
!isPlaying()
);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(intent);
Expand Down Expand Up @@ -1123,4 +1124,4 @@ private boolean isInsideClosingRadius(MotionEvent popupMotionEvent) {
return distanceFromCloseButton(popupMotionEvent) <= getClosingRadius();
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,7 @@ public int getPlayerOptionMenuResource() {
@Override
public boolean onPlayerOptionSelected(MenuItem item) {
if (item.getItemId() == R.id.action_switch_background) {
this.player.setRecovery();
getApplicationContext().sendBroadcast(getPlayerShutdownIntent());
getApplicationContext().startService(getSwitchIntent(BackgroundPlayer.class));
return true;
return switchTo(BackgroundPlayer.class);
}
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,18 +157,11 @@ public boolean onOptionsItemSelected(MenuItem item) {
case R.id.action_append_playlist:
appendAllToPlaylist();
return true;
case R.id.action_settings:
NavigationHelper.openSettings(this);
redraw = true;
return true;
case R.id.action_system_audio:
startActivity(new Intent(Settings.ACTION_SOUND_SETTINGS));
return true;
case R.id.action_switch_main:
this.player.setRecovery();
getApplicationContext().sendBroadcast(getPlayerShutdownIntent());
getApplicationContext().startActivity(getSwitchIntent(MainVideoPlayer.class));
return true;
return switchTo(MainVideoPlayer.class);
}
return onPlayerOptionSelected(item) || super.onOptionsItemSelected(item);
}
Expand All @@ -189,8 +182,17 @@ protected Intent getSwitchIntent(final Class clazz) {
this.player.getPlaybackPitch(),
this.player.getPlaybackSkipSilence(),
null,
false,
false
).addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
).addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
.putExtra(BasePlayer.START_PAUSED, !this.player.isPlaying());
}

protected boolean switchTo(final Class clazz) {
this.player.setRecovery();
getApplicationContext().sendBroadcast(getPlayerShutdownIntent());
getApplicationContext().startActivity(getSwitchIntent(clazz));
return true;
}

////////////////////////////////////////////////////////////////////////////
Expand Down
Loading