Browse Source

Fix post open animation bug occurring on specific Android 10 devices. Should fix pt. 7 mentioned in https://github.com/austinhuang0131/barinsta/issues/264

renovate/org.robolectric-robolectric-4.x
Ammar Githam 4 years ago
parent
commit
fececb5fd2
  1. 1
      app/src/main/java/awais/instagrabber/customviews/SharedElementTransitionDialogFragment.java
  2. 11
      app/src/main/java/awais/instagrabber/fragments/PostViewV2Fragment.java

1
app/src/main/java/awais/instagrabber/customviews/SharedElementTransitionDialogFragment.java

@ -138,7 +138,6 @@ public abstract class SharedElementTransitionDialogFragment extends DialogFragme
final int initY = location[1]; final int initY = location[1];
destView.setX(initX); destView.setX(initX);
destView.setY(initY - Utils.getStatusBarHeight(getContext())); destView.setY(initY - Utils.getStatusBarHeight(getContext()));
destView.requestLayout();
boundsCalculatedCount++; boundsCalculatedCount++;
if (startCalled) { if (startCalled) {
startPostponedEnterTransition(); startPostponedEnterTransition();

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

@ -242,7 +242,16 @@ public class PostViewV2Fragment extends SharedElementTransitionDialogFragment {
@Nullable final ViewGroup container, @Nullable final ViewGroup container,
@Nullable final Bundle savedInstanceState) { @Nullable final Bundle savedInstanceState) {
binding = DialogPostViewBinding.inflate(inflater, container, false); binding = DialogPostViewBinding.inflate(inflater, container, false);
return binding.getRoot();
final ConstraintLayout root = binding.getRoot();
final ViewTreeObserver.OnPreDrawListener preDrawListener = new ViewTreeObserver.OnPreDrawListener() {
@Override
public boolean onPreDraw() {
root.getViewTreeObserver().removeOnPreDrawListener(this);
return false;
}
};
root.getViewTreeObserver().addOnPreDrawListener(preDrawListener);
return root;
} }
@Override @Override

Loading…
Cancel
Save