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

Commit 73cc9c5d authored by Brandon Bennett's avatar Brandon Bennett
Browse files

Allow changing rotary radius values via overlay

This change move the rotary radius settings from constants to
config values that can be overridden by a device.  This is
required to support the larger radius background images
for tablet devices like the nook color.

This change also changes the hdpi assumed dpi settings from 160 to
180.  This will allow for the 161 dpi hack for the NookColor and
other tablets.

Change-Id: I47f8de0923d10833479e44228a9a614f11723d78
parent eed62260
Loading
Loading
Loading
Loading
+9 −6
Original line number Diff line number Diff line
@@ -174,8 +174,6 @@ public class RotarySelector extends View {
    /**
     * Dimensions of arc in background drawable.
     */
    static final int OUTER_ROTARY_RADIUS_DIP = 390;
    static final int ROTARY_STROKE_WIDTH_DIP = 83;
    static final int SNAP_BACK_ANIMATION_DURATION_MILLIS = 300;
    static final int SPIN_ANIMATION_DURATION_MILLIS = 800;
    static final int LENSE_DATE_SIZE_DIP = 18;
@@ -185,6 +183,8 @@ public class RotarySelector extends View {
    private int mDimpleWidth;
    private int mBackgroundWidth;
    private int mBackgroundHeight;
    private final int mRotaryOuterRadiusDIP;
    private final int mRotaryStrokeWidthDIP;
    private final int mOuterRadius;
    private final int mInnerRadius;
    private int mDimpleSpacing;
@@ -239,7 +239,7 @@ public class RotarySelector extends View {
         * phones. keep in mind changing build.prop and density
         * isnt officially supported, but this should do for most cases
         */
        if(densityDpi < 240 && densityDpi >160)
        if(densityDpi < 240 && densityDpi >180)
            mDensityScaleFactor=(float)(240.0 / densityDpi);
        if(densityDpi < 160 && densityDpi >120)
            mDensityScaleFactor=(float)(160.0 / densityDpi);
@@ -264,8 +264,11 @@ public class RotarySelector extends View {

        mBackgroundWidth = mBackground.getWidth();
        mBackgroundHeight = mBackground.getHeight();
        mOuterRadius = (int) (mDensity * mDensityScaleFactor * OUTER_ROTARY_RADIUS_DIP);
        mInnerRadius = (int) ((OUTER_ROTARY_RADIUS_DIP - ROTARY_STROKE_WIDTH_DIP) * mDensity * mDensityScaleFactor);

        mRotaryOuterRadiusDIP = context.getResources().getInteger(R.integer.config_rotaryOuterRadiusDIP);
        mRotaryStrokeWidthDIP = context.getResources().getInteger(R.integer.config_rotaryStrokeWidthDIP);
        mOuterRadius = (int) (mDensity * mDensityScaleFactor * mRotaryOuterRadiusDIP);
        mInnerRadius = (int) ((mRotaryOuterRadiusDIP - mRotaryStrokeWidthDIP) * mDensity * mDensityScaleFactor);

        final ViewConfiguration configuration = ViewConfiguration.get(mContext);
        mMinimumVelocity = configuration.getScaledMinimumFlingVelocity() * 2;
@@ -511,7 +514,7 @@ public class RotarySelector extends View {

        if (VISUAL_DEBUG) {
            // draw circle bounding arc drawable: good sanity check we're doing the math correctly
            float or = OUTER_ROTARY_RADIUS_DIP * mDensity;
            float or = mRotaryOuterRadiusDIP * mDensity;
            final int vOffset = mBackgroundWidth - height;
            final int midX = isHoriz() ? width / 2 : mBackgroundWidth / 2 - vOffset;
            if (isHoriz()) {
+6 −0
Original line number Diff line number Diff line
@@ -398,6 +398,12 @@
    <!-- Configure rotary bottom margin -->
    <integer name="config_rotaryMarginBottomDIP">60</integer>

    <!-- Configure rotary outer radius -->
    <integer name="config_rotaryOuterRadiusDIP">390</integer>

    <!-- Configure rotary stroke width -->
    <integer name="config_rotaryStrokeWidthDIP">83</integer>

    <!-- Do not translate. Defines the slots is Two Digit Number for dialing normally not USSD -->
    <string-array name="config_twoDigitNumberPattern">
    </string-array>