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

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

Allow specification of View theme override as a theme attribute

WE MUST GO DEEPER.

Change-Id: I492c3750e108d01d6f8d325ccc2bedb1ade5b91b
parent 8435cf0d
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -91,7 +91,8 @@ public abstract class LayoutInflater {
    private static final String TAG_1995 = "blink";
    private static final String TAG_REQUEST_FOCUS = "requestFocus";

    private static final String ATTR_THEME = "theme";
    private static final int[] ATTRS_THEME = new int[] {
            com.android.internal.R.attr.theme };

    /**
     * Hook to allow clients of the LayoutInflater to restrict the set of Views that are allowed
@@ -689,10 +690,12 @@ public abstract class LayoutInflater {
        }

        // Apply a theme wrapper, if requested.
        final int themeResId = attrs.getAttributeResourceValue(null, ATTR_THEME, 0);
        final TypedArray ta = viewContext.obtainStyledAttributes(attrs, ATTRS_THEME);
        final int themeResId = ta.getResourceId(0, 0);
        if (themeResId != 0) {
            viewContext = new ContextThemeWrapper(viewContext, themeResId);
        }
        ta.recycle();

        if (name.equals(TAG_1995)) {
            // Let's party like it's 1995!
+6 −0
Original line number Diff line number Diff line
@@ -2244,6 +2244,12 @@
             Hence, the TextView is a label for the EditText. -->
        <attr name="labelFor" format="integer" />

        <!-- Specifies a theme override for a view. When a theme override is set, the
             view will be inflated using a {@link android.content.Context} themed with
             the specified resource. During XML inflation, any child views under the
             view with a theme override will inherit the themed context. -->
        <attr name="theme" />

    </declare-styleable>

    <!-- Attributes that can be used with a {@link android.view.ViewGroup} or any