Skip to content
Open
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
2 changes: 2 additions & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,8 @@ dependencies {
implementation "androidx.car.app:app:1.7.0"

/** Third-party libraries **/
implementation 'org.lsposed.hiddenapibypass:hiddenapibypass:6.1'

// HTML parser
implementation "org.jsoup:jsoup:1.14.3"

Expand Down
1 change: 0 additions & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@
android:logo="@mipmap/ic_launcher"
android:theme="@style/OpeningTheme"
android:resizeableActivity="true"
android:enableOnBackInvokedCallback="false"
tools:ignore="AllowBackup">
Comment on lines 54 to 56
<activity
android:name=".MainActivity"
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/org/schabi/newpipe/App.java
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ protected void attachBaseContext(final Context base) {
@Override
public void onCreate() {
super.onCreate();
EdgeToEdgeWorkaround.apply();

app = this;

Expand All @@ -104,7 +105,6 @@ public void onChanged(Integer connectionState) {

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

// Initialize Android Auto component state based on preference
DeviceUtils.updateAndroidAutoComponentState(this);
Expand Down
6 changes: 0 additions & 6 deletions app/src/main/java/org/schabi/newpipe/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -152,12 +152,6 @@ protected void onCreate(final Bundle savedInstanceState) {
toolbarLayoutBinding = mainBinding.toolbarLayout;
setContentView(mainBinding.getRoot());

WindowInsetsHelper.applyStatusBarInsets(this, toolbarLayoutBinding.toolbar,
mainBinding.fragmentHolder);
// Edge-to-edge (targetSdk 35+): keep the main content (feed/search/channel/playlist lists,
// and the bottom tab strip) above the system navigation bar.
WindowInsetsHelper.applyNavigationBarInsets(mainBinding.fragmentHolder);

if (getSupportFragmentManager().getBackStackEntryCount() == 0) {
initFragments();
}
Expand Down
4 changes: 0 additions & 4 deletions app/src/main/java/org/schabi/newpipe/about/AboutActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import org.schabi.newpipe.databinding.ActivityAboutBinding
import org.schabi.newpipe.databinding.FragmentAboutBinding
import org.schabi.newpipe.util.Localization
import org.schabi.newpipe.util.ThemeHelper
import org.schabi.newpipe.util.WindowInsetsHelper
import org.schabi.newpipe.util.external_communication.ShareUtils

class AboutActivity : AppCompatActivity() {
Expand All @@ -32,7 +31,6 @@ class AboutActivity : AppCompatActivity() {
setContentView(aboutBinding.root)
setSupportActionBar(aboutBinding.aboutToolbar)

WindowInsetsHelper.applyStatusBarInsets(this, aboutBinding.aboutToolbar)
supportActionBar?.setDisplayHomeAsUpEnabled(true)

// Create the adapter that will return a fragment for each of the three
Expand Down Expand Up @@ -79,8 +77,6 @@ class AboutActivity : AppCompatActivity() {
aboutAppVersion.text = BuildConfig.VERSION_NAME
aboutGithubLink.openLink(R.string.github_url)
aboutDonationLink.openLink(R.string.donation_url)
// Edge-to-edge (targetSdk 35+): keep the bottom of the page above the nav bar.
WindowInsetsHelper.applyNavigationBarInsets(root)
return root
}
}
Expand Down
3 changes: 0 additions & 3 deletions app/src/main/java/org/schabi/newpipe/about/LicenseFragment.kt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import org.schabi.newpipe.R
import org.schabi.newpipe.about.LicenseFragmentHelper.showLicense
import org.schabi.newpipe.databinding.FragmentLicensesBinding
import org.schabi.newpipe.databinding.ItemSoftwareComponentBinding
import org.schabi.newpipe.util.WindowInsetsHelper

/**
* Fragment containing the software licenses.
Expand Down Expand Up @@ -68,8 +67,6 @@ class LicenseFragment : Fragment() {
registerForContextMenu(root)
}
activeLicense?.let { compositeDisposable.add(showLicense(activity, it)) }
// Edge-to-edge (targetSdk 35+): keep the bottom of the licenses list above the nav bar.
WindowInsetsHelper.applyNavigationBarInsets(binding.root)
return binding.root
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.ViewGroup;
import android.view.ViewTreeObserver;

import androidx.appcompat.app.ActionBar;
Expand All @@ -16,7 +15,6 @@
import org.schabi.newpipe.databinding.ActivityDownloaderBinding;
import org.schabi.newpipe.util.DeviceUtils;
import org.schabi.newpipe.util.ThemeHelper;
import org.schabi.newpipe.util.WindowInsetsHelper;
import org.schabi.newpipe.views.FocusOverlayView;

import us.shandian.giga.service.DownloadManagerService;
Expand Down Expand Up @@ -46,10 +44,6 @@ protected void onCreate(final Bundle savedInstanceState) {

setSupportActionBar(downloaderBinding.toolbarLayout.toolbar);

WindowInsetsHelper.applyStatusBarInsets(this, downloaderBinding.toolbarLayout.toolbar);
// Edge-to-edge (targetSdk 35+): keep the bottom of the downloads list above the nav bar.
WindowInsetsHelper.applyNavigationBarInsets(downloaderBinding.frame);

final ActionBar actionBar = getSupportActionBar();
if (actionBar != null) {
actionBar.setDisplayHomeAsUpEnabled(true);
Expand Down
8 changes: 0 additions & 8 deletions app/src/main/java/org/schabi/newpipe/error/ErrorActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.ViewGroup;
import androidx.annotation.Nullable;
import androidx.appcompat.app.ActionBar;
import androidx.appcompat.app.AlertDialog;
Expand All @@ -28,7 +27,6 @@
import org.schabi.newpipe.util.ErrorMatcher;
import org.schabi.newpipe.util.Localization;
import org.schabi.newpipe.util.ThemeHelper;
import org.schabi.newpipe.util.WindowInsetsHelper;
import org.schabi.newpipe.util.external_communication.ShareUtils;
import org.schabi.newpipe.util.utils;

Expand Down Expand Up @@ -105,12 +103,6 @@ protected void onCreate(final Bundle savedInstanceState) {

setSupportActionBar(activityErrorBinding.toolbarLayout.toolbar);

WindowInsetsHelper.applyStatusBarInsets(this,
activityErrorBinding.toolbarLayout.toolbar,
activityErrorBinding.scrollView);
// Edge-to-edge (targetSdk 35+): keep the bottom of a long error report above the nav bar.
WindowInsetsHelper.applyNavigationBarInsets(activityErrorBinding.scrollView);

final ActionBar actionBar = getSupportActionBar();
if (actionBar != null) {
actionBar.setDisplayHomeAsUpEnabled(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.ViewGroup;
import android.webkit.CookieManager;
import android.webkit.WebSettings;
import android.webkit.WebView;
Expand All @@ -26,7 +25,6 @@
import org.schabi.newpipe.MainActivity;
import org.schabi.newpipe.R;
import org.schabi.newpipe.util.ThemeHelper;
import org.schabi.newpipe.util.WindowInsetsHelper;

import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
Expand Down Expand Up @@ -79,11 +77,6 @@ protected void onCreate(final Bundle savedInstanceState) {
setContentView(recaptchaBinding.getRoot());
setSupportActionBar(recaptchaBinding.toolbar);

WindowInsetsHelper.applyStatusBarInsets(this, recaptchaBinding.toolbar,
recaptchaBinding.reCaptchaWebView);
// Edge-to-edge (targetSdk 35+): keep the captcha web view content above the nav bar.
WindowInsetsHelper.applyNavigationBarInsets(recaptchaBinding.reCaptchaWebView);

final String url = sanitizeRecaptchaUrl(getIntent().getStringExtra(RECAPTCHA_URL_EXTRA));
// set return to Cancel by default
setResult(RESULT_CANCELED);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,6 @@
import androidx.appcompat.widget.Toolbar;
import androidx.coordinatorlayout.widget.CoordinatorLayout;
import androidx.core.content.ContextCompat;
import androidx.core.view.ViewCompat;
import androidx.core.view.WindowInsetsCompat;
import androidx.core.view.WindowInsetsControllerCompat;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.preference.PreferenceManager;
Expand Down Expand Up @@ -225,7 +222,6 @@ private void onSharedPreferencesChanged(final SharedPreferences sharedPreference

private List<VideoStream> sortedVideoStreams;
private int selectedVideoStreamIndex = -1;
private int statusBarInset;
private BottomSheetBehavior<FrameLayout> bottomSheetBehavior;
private BroadcastReceiver broadcastReceiver;

Expand Down Expand Up @@ -807,20 +803,6 @@ protected void initListeners() {
});

setupBottomPlayer();
final View bottomSheetLayout = activity.findViewById(R.id.fragment_player_holder);
ViewCompat.setOnApplyWindowInsetsListener(bottomSheetLayout, (v, insets) -> {
final int statusBarHeight = insets.getInsets(
WindowInsetsCompat.Type.statusBars()).top;
statusBarInset = insets.getInsetsIgnoringVisibility(
WindowInsetsCompat.Type.statusBars()).top;
final int topPadding = isPlayerAvailable() && player.isFullscreen()
? 0 : statusBarHeight;
v.setPadding(v.getPaddingLeft(), topPadding,
v.getPaddingRight(), v.getPaddingBottom());
updateBottomSheetPeekHeight();
return insets;
});
ViewCompat.requestApplyInsets(bottomSheetLayout);
if (!playerHolder.isBound()) {
setHeightThumbnail();
} else {
Expand Down Expand Up @@ -2278,14 +2260,6 @@ public void onFullscreenStateChanged(final boolean fullscreen) {
scrollToTop();

addVideoPlayerView();
final View bottomSheetLayout = requireActivity().findViewById(R.id.fragment_player_holder);
if (fullscreen) {
bottomSheetLayout.setPadding(bottomSheetLayout.getPaddingLeft(), 0,
bottomSheetLayout.getPaddingRight(), bottomSheetLayout.getPaddingBottom());
} else {
bottomSheetLayout.setPadding(bottomSheetLayout.getPaddingLeft(), statusBarInset,
bottomSheetLayout.getPaddingRight(), bottomSheetLayout.getPaddingBottom());
}
}

@Override
Expand Down Expand Up @@ -2356,11 +2330,6 @@ private void showSystemUi() {
WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_DEFAULT;
}
activity.getWindow().getDecorView().setSystemUiVisibility(0);
final WindowInsetsControllerCompat controller = ViewCompat.getWindowInsetsController(
activity.getWindow().getDecorView());
if (controller != null) {
controller.show(WindowInsetsCompat.Type.systemBars());
}
activity.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
activity.getWindow().setStatusBarColor(ThemeHelper.resolveColorFromAttr(
requireContext(), android.R.attr.colorPrimary));
Expand Down Expand Up @@ -2393,24 +2362,19 @@ private void hideSystemUi() {
visibility |= View.SYSTEM_UI_FLAG_FULLSCREEN;
}
activity.getWindow().getDecorView().setSystemUiVisibility(visibility);
final WindowInsetsControllerCompat controller = ViewCompat.getWindowInsetsController(
activity.getWindow().getDecorView());
if (controller != null) {
controller.setSystemBarsBehavior(
WindowInsetsControllerCompat.BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE);
controller.hide(WindowInsetsCompat.Type.systemBars());
}

if (isInMultiWindow || isPlayerAvailable() && player.isFullscreen()) {
activity.getWindow().setStatusBarColor(Color.TRANSPARENT);
activity.getWindow().setNavigationBarColor(Color.TRANSPARENT);
}
activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
activity.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
}

// Listener implementation
public void hideSystemUiIfNeeded() {
if (isPlayerAvailable() && player.isFullscreen()) {
if (isPlayerAvailable()
&& player.isFullscreen()
&& bottomSheetBehavior.getState() == BottomSheetBehavior.STATE_EXPANDED) {
Comment on lines +2375 to +2377
hideSystemUi();
}
}
Expand Down Expand Up @@ -2618,13 +2582,6 @@ private void manageSpaceAtTheBottom(final boolean showMore) {
newBottomPadding);
}

private void updateBottomSheetPeekHeight() {
final int peekHeight = getResources().getDimensionPixelSize(R.dimen.mini_player_height)
+ statusBarInset;
bottomSheetBehavior.setPeekHeight(bottomSheetState == BottomSheetBehavior.STATE_HIDDEN
? 0 : peekHeight);
}

private void setupBottomPlayer() {
final CoordinatorLayout.LayoutParams params =
(CoordinatorLayout.LayoutParams) binding.appBarLayout.getLayoutParams();
Expand All @@ -2633,9 +2590,10 @@ private void setupBottomPlayer() {
final FrameLayout bottomSheetLayout = activity.findViewById(R.id.fragment_player_holder);
bottomSheetBehavior = BottomSheetBehavior.from(bottomSheetLayout);
bottomSheetBehavior.setState(bottomSheetState);
final int peekHeight = getResources().getDimensionPixelSize(R.dimen.mini_player_height);
if (bottomSheetState != BottomSheetBehavior.STATE_HIDDEN) {
manageSpaceAtTheBottom(false);
updateBottomSheetPeekHeight();
bottomSheetBehavior.setPeekHeight(peekHeight);
if (bottomSheetState == BottomSheetBehavior.STATE_COLLAPSED) {
binding.overlayLayout.setAlpha(MAX_OVERLAY_ALPHA);
} else if (bottomSheetState == BottomSheetBehavior.STATE_EXPANDED) {
Expand Down Expand Up @@ -2663,7 +2621,7 @@ public void onStateChanged(@NonNull final View bottomSheet, final int newState)
moveFocusToMainFragment(false);
manageSpaceAtTheBottom(false);

updateBottomSheetPeekHeight();
bottomSheetBehavior.setPeekHeight(peekHeight);
// Disable click because overlay buttons located on top of buttons
// from the player
setOverlayElementsClickable(false);
Expand All @@ -2689,7 +2647,7 @@ && isPlayerAvailable()
moveFocusToMainFragment(true);
manageSpaceAtTheBottom(false);

updateBottomSheetPeekHeight();
bottomSheetBehavior.setPeekHeight(peekHeight);

// Re-enable clicks
setOverlayElementsClickable(true);
Expand Down
34 changes: 0 additions & 34 deletions app/src/main/java/org/schabi/newpipe/player/PlayQueueActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import android.os.IBinder;
import android.provider.Settings;
import android.util.Log;
import android.util.TypedValue;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
Expand All @@ -18,11 +17,8 @@

import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.view.ViewCompat;
import androidx.core.view.WindowInsetsCompat;
import androidx.recyclerview.widget.ItemTouchHelper;

import com.google.android.material.appbar.AppBarLayout;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

Expand Down Expand Up @@ -82,36 +78,6 @@ protected void onCreate(final Bundle savedInstanceState) {

setSupportActionBar(queueControlBinding.toolbar);

queueControlBinding.appbar.setStatusBarForeground(null);
getWindow().setStatusBarColor(android.graphics.Color.TRANSPARENT);

WindowInsetsHelper.applyStatusBarInsets(this, queueControlBinding.toolbar);

ViewCompat.setOnApplyWindowInsetsListener(queueControlBinding.getRoot(), (v, insets) -> {
final int navBarHeight = insets.getInsets(
WindowInsetsCompat.Type.navigationBars()).bottom;
final int twelveDp = (int) (12 * getResources()
.getDisplayMetrics().density + 0.5f);

if (queueControlBinding.playbackControls != null) {
final ViewGroup.MarginLayoutParams controlsParams =
(ViewGroup.MarginLayoutParams) queueControlBinding
.playbackControls.getLayoutParams();
controlsParams.bottomMargin = twelveDp + navBarHeight;
queueControlBinding.playbackControls.setLayoutParams(controlsParams);
}

if (queueControlBinding.playbackControlsBottom != null) {
queueControlBinding.playbackControlsBottom.setPadding(
queueControlBinding.playbackControlsBottom.getPaddingLeft(),
queueControlBinding.playbackControlsBottom.getPaddingTop(),
queueControlBinding.playbackControlsBottom.getPaddingRight(),
navBarHeight);
}

return insets;
});

if (getSupportActionBar() != null) {
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setTitle(R.string.title_activity_play_queue);
Expand Down
Loading