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

Commit 57c15042 authored by Kunhung Li's avatar Kunhung Li
Browse files

Fix dynamic color page indicator not adapt RTL

- Assign page indicator index based on current layout is RTL or not.
- Video:
  https://drive.google.com/file/d/1Cs911iJfCD_deVfOO_OhHrbS7ZzvZ_Yn/

Bug: 220267389
Test: manual
Change-Id: I1f33f11d4cbc733173a4ed68cfda3b26ad7d241c
parent 896011b2
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -256,14 +256,19 @@ public class ColorSectionController implements CustomizationSectionController<Co
            @Override
            public void onPageSelected(int position) {
                super.onPageSelected(position);
                pageIndicator.setLocation(position);
                pageIndicator.setLocation(getPagePosition(pageIndicator, position));
            }

            @Override
            public void onPageScrolled(int position, float positionOffset,
                    int positionOffsetPixels) {
                super.onPageScrolled(position, positionOffset, positionOffsetPixels);
                pageIndicator.setLocation(position);
                pageIndicator.setLocation(getPagePosition(pageIndicator, position));
            }

            private int getPagePosition(PageIndicator pageIndicator, int position) {
                return pageIndicator.isLayoutRtl() ? pageIndicator.getChildCount() - 1 - position
                        : position;
            }
        });
    }