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

Commit b1e1dbfb authored by Alan Viverette's avatar Alan Viverette
Browse files

Update disabled states to be less opaque

Also adds Resources method for retrieving floating-point values.

BUG: 16374059
Change-Id: I68c6a40cbe5badfad624548b9abf2d657dbc2019
parent 5983b101
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -233,7 +233,7 @@ public class ColorStateList implements Parcelable {
            }

            if (alphaRes != 0) {
                alpha = r.getFraction(alphaRes, 1, 1);
                alpha = r.getFloat(alphaRes);
            }

            // Apply alpha modulation.
+28 −0
Original line number Diff line number Diff line
@@ -985,6 +985,34 @@ public class Resources {
        }
    }

    /**
     * Retrieve a floating-point value for a particular resource ID.
     *
     * @param id The desired resource identifier, as generated by the aapt
     *           tool. This integer encodes the package, type, and resource
     *           entry. The value 0 is an invalid identifier.
     *
     * @return Returns the floating-point value contained in the resource.
     *
     * @throws NotFoundException Throws NotFoundException if the given ID does
     *         not exist or is not a floating-point value.
     * @hide Pending API council approval.
     */
    public float getFloat(int id) {
        synchronized (mAccessLock) {
            TypedValue value = mTmpValue;
            if (value == null) {
                mTmpValue = value = new TypedValue();
            }
            getValue(id, value, true);
            if (value.type == TypedValue.TYPE_FLOAT) {
                return value.getFloat();
            }
            throw new NotFoundException("Resource ID #0x" + Integer.toHexString(id) + " type #0x"
                    + Integer.toHexString(value.type) + " is not valid");
        }
    }

    /**
     * Return an XmlResourceParser through which you can read a view layout
     * description for the given resource ID.  This parser has limited
+3 −1
Original line number Diff line number Diff line
@@ -15,6 +15,8 @@
-->

<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:state_enabled="false" android:alpha="0.5" android:color="@color/button_material_dark"/>
    <item android:state_enabled="false"
        android:alpha="@dimen/disabled_alpha_material"
        android:color="@color/button_material_dark"/>
    <item android:color="@color/button_material_dark"/>
</selector>
+3 −1
Original line number Diff line number Diff line
@@ -15,6 +15,8 @@
-->

<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:state_enabled="false" android:alpha="0.5" android:color="@color/button_material_light"/>
    <item android:state_enabled="false"
        android:alpha="@dimen/disabled_alpha_material"
        android:color="@color/button_material_light"/>
    <item android:color="@color/button_material_light"/>
</selector>
+4 −2
Original line number Diff line number Diff line
@@ -15,6 +15,8 @@
-->

<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:state_enabled="false" android:alpha="0.5" android:color="@android:color/bright_foreground_material_dark"/>
    <item android:color="@android:color/bright_foreground_material_dark"/>
    <item android:state_enabled="false"
        android:alpha="@dimen/disabled_alpha_material"
        android:color="@color/bright_foreground_material_dark"/>
    <item android:color="@color/bright_foreground_material_dark"/>
</selector>
Loading