Skip to content

Commit

Permalink
fix(YouTube - Settings): Do not clip settings menus when using an And…
Browse files Browse the repository at this point in the history
…roid 15 device (#3999)
  • Loading branch information
LisoUseInAIKyrios authored Nov 27, 2024
1 parent 0baedef commit 7382a02
Showing 1 changed file with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,14 @@
import android.app.Dialog;
import android.content.Context;
import android.content.SharedPreferences;
import android.graphics.Insets;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.os.Bundle;
import android.preference.*;
import android.util.TypedValue;
import android.view.ViewGroup;
import android.view.WindowInsets;
import android.widget.TextView;
import android.widget.Toolbar;

Expand Down Expand Up @@ -310,6 +312,18 @@ private void setPreferenceScreenToolbar(PreferenceScreen parentScreen) {
.findViewById(android.R.id.content)
.getParent();

// Fix required for Android 15 and YT 19.45+
// FIXME:
// On Android 15 the text layout is not aligned the same as the parent
// screen and it looks a little off. Otherwise this works.
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
rootView.setOnApplyWindowInsetsListener((v, insets) -> {
Insets statusInsets = insets.getInsets(WindowInsets.Type.statusBars());
v.setPadding(0, statusInsets.top, 0, 0);
return insets;
});
}

Toolbar toolbar = new Toolbar(childScreen.getContext());
toolbar.setTitle(childScreen.getTitle());
toolbar.setNavigationIcon(getBackButtonDrawable());
Expand Down

0 comments on commit 7382a02

Please sign in to comment.