mirror of
https://github.com/TeamNewPipe/NewPipe
synced 2024-11-05 09:36:22 +00:00
Remove deprecated method calls in FocusAwareCoordinator.
This commit is contained in:
parent
cacce6d2d0
commit
f1dab11f1f
@ -27,6 +27,7 @@ import android.view.WindowInsets;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.coordinatorlayout.widget.CoordinatorLayout;
|
||||
import androidx.core.view.WindowInsetsCompat;
|
||||
|
||||
import org.schabi.newpipe.R;
|
||||
|
||||
@ -83,23 +84,22 @@ public final class FocusAwareCoordinator extends CoordinatorLayout {
|
||||
}
|
||||
}
|
||||
|
||||
if (consumed) {
|
||||
insets.consumeSystemWindowInsets();
|
||||
}
|
||||
return insets;
|
||||
return consumed ? WindowInsetsCompat.CONSUMED.toWindowInsets() : insets;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adjusts player's controls manually because fitsSystemWindows doesn't work when multiple
|
||||
* Adjusts player's controls manually because onApplyWindowInsets doesn't work when multiple
|
||||
* receivers adjust its bounds. So when two listeners are present (like in profile page)
|
||||
* the player's controls will not receive insets. This method fixes it
|
||||
*/
|
||||
@Override
|
||||
protected boolean fitSystemWindows(final Rect insets) {
|
||||
public WindowInsets onApplyWindowInsets(final WindowInsets windowInsets) {
|
||||
final var windowInsetsCompat = WindowInsetsCompat.toWindowInsetsCompat(windowInsets, this);
|
||||
final var insets = windowInsetsCompat.getInsets(WindowInsetsCompat.Type.systemBars());
|
||||
final ViewGroup controls = findViewById(R.id.playbackControlRoot);
|
||||
if (controls != null) {
|
||||
controls.setPadding(insets.left, insets.top, insets.right, insets.bottom);
|
||||
}
|
||||
return super.fitSystemWindows(insets);
|
||||
return super.onApplyWindowInsets(windowInsets);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user