Remove deprecated method calls in FocusAwareCoordinator.
This commit is contained in:
parent
cacce6d2d0
commit
f1dab11f1f
1 changed files with 7 additions and 7 deletions
|
@ -27,6 +27,7 @@ import android.view.WindowInsets;
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.coordinatorlayout.widget.CoordinatorLayout;
|
import androidx.coordinatorlayout.widget.CoordinatorLayout;
|
||||||
|
import androidx.core.view.WindowInsetsCompat;
|
||||||
|
|
||||||
import org.schabi.newpipe.R;
|
import org.schabi.newpipe.R;
|
||||||
|
|
||||||
|
@ -83,23 +84,22 @@ public final class FocusAwareCoordinator extends CoordinatorLayout {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (consumed) {
|
return consumed ? WindowInsetsCompat.CONSUMED.toWindowInsets() : insets;
|
||||||
insets.consumeSystemWindowInsets();
|
|
||||||
}
|
|
||||||
return 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)
|
* 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
|
* the player's controls will not receive insets. This method fixes it
|
||||||
*/
|
*/
|
||||||
@Override
|
@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);
|
final ViewGroup controls = findViewById(R.id.playbackControlRoot);
|
||||||
if (controls != null) {
|
if (controls != null) {
|
||||||
controls.setPadding(insets.left, insets.top, insets.right, insets.bottom);
|
controls.setPadding(insets.left, insets.top, insets.right, insets.bottom);
|
||||||
}
|
}
|
||||||
return super.fitSystemWindows(insets);
|
return super.onApplyWindowInsets(windowInsets);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue