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

Commit 3dbb2cf5 authored by Josh Guilfoyle's avatar Josh Guilfoyle
Browse files

Removed unused TypedArray#getDrawableWithContext method

This feature originally was used to read color attributes from XML
drawables to produce dynamic highlights.  This functionality is no
longer utilized by themes.
parent 6297a62b
Loading
Loading
Loading
Loading
+0 −11
Original line number Diff line number Diff line
@@ -35,7 +35,6 @@ import android.util.SparseArray;
import android.util.TypedValue;
import android.util.LongSparseArray;
import android.view.Display;
import android.content.Context;

import java.io.IOException;
import java.io.InputStream;
@@ -107,8 +106,6 @@ public class Resources {
        return (LongSparseArray<T>) EMPTY_ARRAY;
    }

    private Context mContext;

    /**
     * This exception is thrown by the resource APIs when a requested resource
     * can not be found.
@@ -925,14 +922,6 @@ public class Resources {
        throw new NotFoundException("String resource name " + name);
    }

    Context getContext() {
        return mContext;
    }
    
    void setContext(Context context) {
        mContext = context;
    }

    /**
     * This class holds the current attribute values for a particular theme.
     * In other words, a Theme is a set of values for resource attributes;
+2 −23
Original line number Diff line number Diff line
package android.content.res;

import com.android.internal.util.XmlUtils;

import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
import android.util.DisplayMetrics;
import android.util.Log;
import android.util.TypedValue;
import android.content.Context;
import android.content.res.Resources.NotFoundException;

import com.android.internal.util.XmlUtils;

import java.util.Arrays;

@@ -271,9 +269,6 @@ public class TypedArray {
                return csl.getDefaultColor();
            }
            return defValue;
        } else if (type == TypedValue.TYPE_ATTRIBUTE && mResources.getContext() != null) {
            mResources.getContext().getTheme().resolveAttribute(data[index+AssetManager.STYLE_DATA], mValue, true);
            return mValue.data;
        }

        throw new UnsupportedOperationException("Can't convert to color: type=0x"
@@ -556,22 +551,6 @@ public class TypedArray {
        return null;
    }

    /**
     * Very crude hack to allow {@link #getColor} to succeed in looking up
     * values from the current theme. This method is necessary as we use
     * LayerDrawables which use color attribute references.
     * 
     * @hide
     */
    public Drawable getDrawableWithContext(Context context, int id) throws NotFoundException {
        mResources.setContext(context);
        try {
            return getDrawable(id);
        } finally {
            mResources.setContext(null);
        }
    }

    /**
     * Retrieve the CharSequence[] for the attribute at <var>index</var>.
     * This gets the resource ID of the selected attribute, and uses
+1 −1
Original line number Diff line number Diff line
@@ -1847,7 +1847,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility
            int attr = a.getIndex(i);
            switch (attr) {
                case com.android.internal.R.styleable.View_background:
                    background = a.getDrawableWithContext(context, attr);
                    background = a.getDrawable(attr);
                    break;
                case com.android.internal.R.styleable.View_padding:
                    padding = a.getDimensionPixelSize(attr, -1);
+1 −1
Original line number Diff line number Diff line
@@ -511,7 +511,7 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te
        TypedArray a = context.obtainStyledAttributes(attrs,
                com.android.internal.R.styleable.AbsListView, defStyle, 0);

        Drawable d = a.getDrawableWithContext(context, com.android.internal.R.styleable.AbsListView_listSelector);
        Drawable d = a.getDrawable(com.android.internal.R.styleable.AbsListView_listSelector);
        if (d != null) {
            setSelector(d);
        }
+1 −1
Original line number Diff line number Diff line
@@ -59,7 +59,7 @@ public class CheckedTextView extends TextView implements Checkable {
        TypedArray a = context.obtainStyledAttributes(attrs,
                R.styleable.CheckedTextView, defStyle, 0);

        Drawable d = a.getDrawableWithContext(context, R.styleable.CheckedTextView_checkMark);
        Drawable d = a.getDrawable(R.styleable.CheckedTextView_checkMark);
        if (d != null) {
            setCheckMarkDrawable(d);
        }
Loading