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

Commit b33db3f6 authored by Robert Snoeberger's avatar Robert Snoeberger
Browse files

Get dimens values from resources in pixels

This helps keep the indicator dots evenly distributed.

Fixes: 152093000
Test: manual - swipe between pages in QS and look at placement of dots
Change-Id: Idd474aff43d383c88290bf97e2adb711839bc076
parent 993254c8
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -504,6 +504,10 @@
    <dimen name="qs_header_tile_margin_bottom">18dp</dimen>
    <dimen name="qs_page_indicator_width">16dp</dimen>
    <dimen name="qs_page_indicator_height">8dp</dimen>
    <!-- The size of a single dot in relation to the whole animation.
         Scaled @dimen/qs_page_indicator-width by .4f.
    -->
    <dimen name="qs_page_indicator_dot_width">6.4dp</dimen>
    <dimen name="qs_tile_icon_size">24dp</dimen>
    <dimen name="qs_tile_text_size">12sp</dimen>
    <dimen name="qs_tile_divider_height">1dp</dimen>
+5 −8
Original line number Diff line number Diff line
@@ -2,6 +2,7 @@ package com.android.systemui.qs;

import android.content.Context;
import android.content.res.ColorStateList;
import android.content.res.Resources;
import android.content.res.TypedArray;
import android.graphics.drawable.Animatable2;
import android.graphics.drawable.AnimatedVectorDrawable;
@@ -31,9 +32,6 @@ public class PageIndicator extends ViewGroup {

    private static final long ANIMATION_DURATION = 250;

    // The size of a single dot in relation to the whole animation.
    private static final float SINGLE_SCALE = .4f;

    private static final float MINOR_ALPHA = .42f;

    private final ArrayList<Integer> mQueuedPositions = new ArrayList<>();
@@ -75,11 +73,10 @@ public class PageIndicator extends ViewGroup {
        }
        array.recycle();

        mPageIndicatorWidth =
                (int) mContext.getResources().getDimension(R.dimen.qs_page_indicator_width);
        mPageIndicatorHeight =
                (int) mContext.getResources().getDimension(R.dimen.qs_page_indicator_height);
        mPageDotWidth = (int) (mPageIndicatorWidth * SINGLE_SCALE);
        Resources res = context.getResources();
        mPageIndicatorWidth = res.getDimensionPixelSize(R.dimen.qs_page_indicator_width);
        mPageIndicatorHeight = res.getDimensionPixelSize(R.dimen.qs_page_indicator_height);
        mPageDotWidth = res.getDimensionPixelSize(R.dimen.qs_page_indicator_dot_width);
    }

    public void setNumPages(int numPages) {