Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e749d5d5 authored by chihhangchuang's avatar chihhangchuang
Browse files

Remove the OnLayoutChangeListener once the set radius to preview card

Test: Manually
Bug: 155354505
Change-Id: Ia631d3afd940157decc1ce362935200de6b79c7a
parent 6d4cde2a
Loading
Loading
Loading
Loading
+10 −4
Original line number Diff line number Diff line
@@ -113,11 +113,17 @@ public class BasePreviewAdapter<T extends PreviewPage> extends PagerAdapter {
        }

        public void setCard(CardView card) {
            this.card = card;
            this.card.addOnLayoutChangeListener(
                    (v, left, top, right, bottom, oldLeft, oldTop, oldRight, oldBottom) ->
            card.addOnLayoutChangeListener(
                    new View.OnLayoutChangeListener() {
                        @Override
                        public void onLayoutChange(View v, int left, int top, int right, int bottom,
                                int oldLeft, int oldTop, int oldRight, int oldBottom) {
                            card.setRadius(TileSizeCalculator.getPreviewCornerRadius(
                                    mActivity, card.getMeasuredWidth())));
                                    mActivity, card.getMeasuredWidth()));
                            card.removeOnLayoutChangeListener(this);
                        }
                    });
            this.card = card;
        }

        public abstract void bindPreviewContent();