Browse Source

Check if view is attached before animating controls. Should fix https://github.com/austinhuang0131/barinsta/issues/302

renovate/org.robolectric-robolectric-4.x
Ammar Githam 4 years ago
parent
commit
41e5fecbea
  1. 10
      app/src/main/java/awais/instagrabber/fragments/PostViewV2Fragment.java

10
app/src/main/java/awais/instagrabber/fragments/PostViewV2Fragment.java

@ -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…
Cancel
Save