mirror of
https://github.com/KokaKiwi/BarInsta
synced 2024-11-04 14:17:30 +00:00
Check if view is attached before animating controls. Should fix https://github.com/austinhuang0131/barinsta/issues/302
This commit is contained in:
parent
e449594253
commit
41e5fecbea
@ -35,6 +35,7 @@ import androidx.annotation.NonNull;
|
|||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.constraintlayout.widget.ConstraintLayout;
|
import androidx.constraintlayout.widget.ConstraintLayout;
|
||||||
import androidx.core.content.PermissionChecker;
|
import androidx.core.content.PermissionChecker;
|
||||||
|
import androidx.core.view.ViewCompat;
|
||||||
import androidx.core.widget.NestedScrollView;
|
import androidx.core.widget.NestedScrollView;
|
||||||
import androidx.fragment.app.DialogFragment;
|
import androidx.fragment.app.DialogFragment;
|
||||||
import androidx.navigation.NavController;
|
import androidx.navigation.NavController;
|
||||||
@ -1055,9 +1056,12 @@ public class PostViewV2Fragment extends SharedElementTransitionDialogFragment {
|
|||||||
|
|
||||||
private void showPlayerControls() {
|
private void showPlayerControls() {
|
||||||
hideCaption();
|
hideCaption();
|
||||||
|
|
||||||
// previously invisible view
|
// previously invisible view
|
||||||
View view = binding.playerControls.getRoot();
|
View view = binding.playerControls.getRoot();
|
||||||
|
if (!ViewCompat.isAttachedToWindow(view)) {
|
||||||
|
view.setVisibility(View.VISIBLE);
|
||||||
|
return;
|
||||||
|
}
|
||||||
// get the center for the clipping circle
|
// get the center for the clipping circle
|
||||||
int cx = view.getWidth() / 2;
|
int cx = view.getWidth() / 2;
|
||||||
// int cy = view.getHeight() / 2;
|
// int cy = view.getHeight() / 2;
|
||||||
@ -1078,6 +1082,10 @@ public class PostViewV2Fragment extends SharedElementTransitionDialogFragment {
|
|||||||
private void hidePlayerControls() {
|
private void hidePlayerControls() {
|
||||||
// previously visible view
|
// previously visible view
|
||||||
final View view = binding.playerControls.getRoot();
|
final View view = binding.playerControls.getRoot();
|
||||||
|
if (!ViewCompat.isAttachedToWindow(view)) {
|
||||||
|
view.setVisibility(View.GONE);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// get the center for the clipping circle
|
// get the center for the clipping circle
|
||||||
int cx = view.getWidth() / 2;
|
int cx = view.getWidth() / 2;
|
||||||
|
Loading…
Reference in New Issue
Block a user