mirror of
https://github.com/KokaKiwi/BarInsta
synced 2024-11-22 14:47:29 +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.constraintlayout.widget.ConstraintLayout;
|
||||
import androidx.core.content.PermissionChecker;
|
||||
import androidx.core.view.ViewCompat;
|
||||
import androidx.core.widget.NestedScrollView;
|
||||
import androidx.fragment.app.DialogFragment;
|
||||
import androidx.navigation.NavController;
|
||||
@ -1055,9 +1056,12 @@ public class PostViewV2Fragment extends SharedElementTransitionDialogFragment {
|
||||
|
||||
private void showPlayerControls() {
|
||||
hideCaption();
|
||||
|
||||
// previously invisible view
|
||||
View view = binding.playerControls.getRoot();
|
||||
if (!ViewCompat.isAttachedToWindow(view)) {
|
||||
view.setVisibility(View.VISIBLE);
|
||||
return;
|
||||
}
|
||||
// get the center for the clipping circle
|
||||
int cx = view.getWidth() / 2;
|
||||
// int cy = view.getHeight() / 2;
|
||||
@ -1078,6 +1082,10 @@ public class PostViewV2Fragment extends SharedElementTransitionDialogFragment {
|
||||
private void hidePlayerControls() {
|
||||
// previously visible view
|
||||
final View view = binding.playerControls.getRoot();
|
||||
if (!ViewCompat.isAttachedToWindow(view)) {
|
||||
view.setVisibility(View.GONE);
|
||||
return;
|
||||
}
|
||||
|
||||
// get the center for the clipping circle
|
||||
int cx = view.getWidth() / 2;
|
||||
|
Loading…
Reference in New Issue
Block a user