1
0
mirror of https://github.com/KokaKiwi/BarInsta synced 2024-11-26 08:37:29 +00:00

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

This commit is contained in:
Ammar Githam 2020-11-15 21:47:32 +09:00
parent c3de020f0e
commit fececb5fd2
2 changed files with 10 additions and 2 deletions

View File

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

View File

@ -242,7 +242,16 @@ public class PostViewV2Fragment extends SharedElementTransitionDialogFragment {
@Nullable final ViewGroup container,
@Nullable final Bundle savedInstanceState) {
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