Java 类android.content.res.Resources.Theme 实例源码

项目:q-mail    文件:FoldableLinearLayout.java   
/**
 * Load given attributes to inner variables,
 * 
 * @param context
 * @param attrs
 */
private void processAttributes(Context context, AttributeSet attrs) {
    Theme theme = context.getTheme();
    TypedValue outValue = new TypedValue();
    boolean found = theme.resolveAttribute(R.attr.iconActionCollapse, outValue, true);
    if (found) {
        mIconActionCollapseId = outValue.resourceId;
    }
    found = theme.resolveAttribute(R.attr.iconActionExpand, outValue, true);
    if (found) {
        mIconActionExpandId = outValue.resourceId;
    }
    if (attrs != null) {
        TypedArray a = context.obtainStyledAttributes(attrs,
                R.styleable.FoldableLinearLayout, 0, 0);
        mFoldedLabel = a.getString(R.styleable.FoldableLinearLayout_foldedLabel);
        mUnFoldedLabel = a.getString(R.styleable.FoldableLinearLayout_unFoldedLabel);
        a.recycle();
    }
    // If any attribute isn't found then set a default one
    mFoldedLabel = (mFoldedLabel == null) ? "No text!" : mFoldedLabel;
    mUnFoldedLabel = (mUnFoldedLabel == null) ? "No text!" : mUnFoldedLabel;
}
项目:MakiLite    文件:ThemeUtils.java   
@TargetApi(LOLLIPOP)
static int resolveAccentColor(Context context) {
  Theme theme = context.getTheme();

  // on Lollipop, grab system colorAccent attribute
  // pre-Lollipop, grab AppCompat colorAccent attribute
  // finally, check for custom mp_colorAccent attribute
  int attr = isAtLeastL() ? android.R.attr.colorAccent : R.attr.colorAccent;
  TypedArray typedArray = theme.obtainStyledAttributes(new int[] { attr, R.attr.mp_colorAccent });

  int accentColor = typedArray.getColor(0, FALLBACK_COLOR);
  accentColor = typedArray.getColor(1, accentColor);
  typedArray.recycle();

  return accentColor;
}
项目:GitHub    文件:DrawableDecoderCompat.java   
/**
 * Loads a Drawable using {@link AppCompatResources} if available and {@link ResourcesCompat}
 * otherwise, depending on whether or not the v7 support library is included in the application.
 *
 * @param theme Used instead of the {@link Theme} returned from the given {@link Context} if
 * non-null when loading the {@link Drawable}.
 */
public static Drawable getDrawable(Context context, @DrawableRes int id, @Nullable Theme theme) {
  try {
    // Race conditions may cause us to attempt to load using v7 more than once. That's ok since
    // this check is a modest optimization and the output will be correct anyway.
    if (shouldCallAppCompatResources) {
      return loadDrawableV7(context, id);
    }
  } catch (NoClassDefFoundError error) {
    shouldCallAppCompatResources = false;
  } catch (Resources.NotFoundException e) {
    // Ignored, this can be thrown when drawable compat attempts to decode a canary resource. If
    // that decode attempt fails, we still want to try with the v4 ResourcesCompat below.
  }

  return loadDrawableV4(context, id, theme != null ? theme : context.getTheme());
}
项目:letv    文件:JarMainBFragmentActivity.java   
public void setOverrideResources(JarResources myres) {
    JLog.i("clf", "setOverrideResources...myres=" + myres);
    if (myres == null) {
        this.myResources = null;
        this.resources = null;
        this.assetManager = null;
        this.theme = null;
        return;
    }
    this.myResources = myres;
    JLog.i("clf", "setOverrideResources...this.myResources=" + this.myResources);
    this.resources = myres.getResources();
    JLog.i("clf", "setOverrideResources...this.resources=" + this.resources);
    this.assetManager = myres.getAssets();
    JLog.i("clf", "setOverrideResources...this.assetManager=" + this.assetManager);
    Theme t = myres.getResources().newTheme();
    JLog.i("clf", "setOverrideResources...t=" + t);
    t.setTo(getTheme());
    this.theme = t;
    JLog.i("clf", "setOverrideResources...this.theme=" + this.theme);
}
项目:boohee_v5.6    文件:ToolbarActionBar.java   
private void ensureListMenuPresenter(Menu menu) {
    if (this.mListMenuPresenter == null && (menu instanceof MenuBuilder)) {
        MenuBuilder mb = (MenuBuilder) menu;
        Context context = this.mDecorToolbar.getContext();
        TypedValue outValue = new TypedValue();
        Theme widgetTheme = context.getResources().newTheme();
        widgetTheme.setTo(context.getTheme());
        widgetTheme.resolveAttribute(R.attr.actionBarPopupTheme, outValue, true);
        if (outValue.resourceId != 0) {
            widgetTheme.applyStyle(outValue.resourceId, true);
        }
        widgetTheme.resolveAttribute(R.attr.panelMenuListTheme, outValue, true);
        if (outValue.resourceId != 0) {
            widgetTheme.applyStyle(outValue.resourceId, true);
        } else {
            widgetTheme.applyStyle(R.style.Theme_AppCompat_CompactMenu, true);
        }
        Context context2 = new ContextThemeWrapper(context, 0);
        context2.getTheme().setTo(widgetTheme);
        this.mListMenuPresenter = new ListMenuPresenter(context2, R.layout.abc_list_menu_item_layout);
        this.mListMenuPresenter.setCallback(new PanelMenuPresenterCallback());
        mb.addMenuPresenter(this.mListMenuPresenter);
    }
}
项目:boohee_v5.6    文件:AppCompatDelegateImplV7.java   
void setStyle(Context context) {
    TypedValue outValue = new TypedValue();
    Theme widgetTheme = context.getResources().newTheme();
    widgetTheme.setTo(context.getTheme());
    widgetTheme.resolveAttribute(R.attr.actionBarPopupTheme, outValue, true);
    if (outValue.resourceId != 0) {
        widgetTheme.applyStyle(outValue.resourceId, true);
    }
    widgetTheme.resolveAttribute(R.attr.panelMenuListTheme, outValue, true);
    if (outValue.resourceId != 0) {
        widgetTheme.applyStyle(outValue.resourceId, true);
    } else {
        widgetTheme.applyStyle(R.style.Theme_AppCompat_CompactMenu, true);
    }
    Context context2 = new ContextThemeWrapper(context, 0);
    context2.getTheme().setTo(widgetTheme);
    this.listPresenterContext = context2;
    TypedArray a = context2.obtainStyledAttributes(R.styleable.AppCompatTheme);
    this.background = a.getResourceId(R.styleable.AppCompatTheme_panelBackground, 0);
    this.windowAnimations = a.getResourceId(R.styleable.AppCompatTheme_android_windowAnimationStyle, 0);
    a.recycle();
}
项目:boohee_v5.6    文件:AppCompatDelegateImplV7.java   
private boolean initializePanelMenu(PanelFeatureState st) {
    Context context = this.mContext;
    if ((st.featureId == 0 || st.featureId == 108) && this.mDecorContentParent != null) {
        TypedValue outValue = new TypedValue();
        Theme baseTheme = context.getTheme();
        baseTheme.resolveAttribute(R.attr.actionBarTheme, outValue, true);
        Theme widgetTheme = null;
        if (outValue.resourceId != 0) {
            widgetTheme = context.getResources().newTheme();
            widgetTheme.setTo(baseTheme);
            widgetTheme.applyStyle(outValue.resourceId, true);
            widgetTheme.resolveAttribute(R.attr.actionBarWidgetTheme, outValue, true);
        } else {
            baseTheme.resolveAttribute(R.attr.actionBarWidgetTheme, outValue, true);
        }
        if (outValue.resourceId != 0) {
            if (widgetTheme == null) {
                widgetTheme = context.getResources().newTheme();
                widgetTheme.setTo(baseTheme);
            }
            widgetTheme.applyStyle(outValue.resourceId, true);
        }
        if (widgetTheme != null) {
            Context context2 = new ContextThemeWrapper(context, 0);
            context2.getTheme().setTo(widgetTheme);
            context = context2;
        }
    }
    MenuBuilder menu = new MenuBuilder(context);
    menu.setCallback(this);
    st.setMenu(menu);
    return true;
}
项目:boohee_v5.6    文件:AppCompatSpinner.java   
public DropDownAdapter(@Nullable SpinnerAdapter adapter, @Nullable Theme dropDownTheme) {
    this.mAdapter = adapter;
    if (adapter instanceof ListAdapter) {
        this.mListAdapter = (ListAdapter) adapter;
    }
    if (dropDownTheme == null) {
        return;
    }
    if (AppCompatSpinner.IS_AT_LEAST_M && (adapter instanceof ThemedSpinnerAdapter)) {
        ThemedSpinnerAdapter themedAdapter = (ThemedSpinnerAdapter) adapter;
        if (themedAdapter.getDropDownViewTheme() != dropDownTheme) {
            themedAdapter.setDropDownViewTheme(dropDownTheme);
        }
    } else if (adapter instanceof ThemedSpinnerAdapter) {
        ThemedSpinnerAdapter themedAdapter2 = (ThemedSpinnerAdapter) adapter;
        if (themedAdapter2.getDropDownViewTheme() == null) {
            themedAdapter2.setDropDownViewTheme(dropDownTheme);
        }
    }
}
项目:MDPreference    文件:ThemeUtils.java   
@TargetApi(LOLLIPOP)
static int resolveAccentColor(Context context) {
    Theme theme = context.getTheme();

    // on Lollipop, grab system colorAccent attribute
    // pre-Lollipop, grab AppCompat colorAccent attribute
    // finally, check for custom mp_colorAccent attribute
    int attr = isAtLeastL() ? android.R.attr.colorAccent : R.attr.colorAccent;
    TypedArray typedArray = theme.obtainStyledAttributes(new int[]{attr, R.attr.mp_colorAccent});

    int accentColor = typedArray.getColor(0, FALLBACK_COLOR);
    accentColor = typedArray.getColor(1, accentColor);
    typedArray.recycle();

    return accentColor;
}
项目:solved-hacking-problem    文件:bi.java   
public bi(SpinnerAdapter spinnerAdapter, Theme theme) {
    this.f1367a = spinnerAdapter;
    if (spinnerAdapter instanceof ListAdapter) {
        this.f1368b = (ListAdapter) spinnerAdapter;
    }
    if (theme == null) {
        return;
    }
    if (bg.f1353a && (spinnerAdapter instanceof ThemedSpinnerAdapter)) {
        ThemedSpinnerAdapter themedSpinnerAdapter = (ThemedSpinnerAdapter) spinnerAdapter;
        if (themedSpinnerAdapter.getDropDownViewTheme() != theme) {
            themedSpinnerAdapter.setDropDownViewTheme(theme);
        }
    } else if (spinnerAdapter instanceof dd) {
        dd ddVar = (dd) spinnerAdapter;
        if (ddVar.m2705a() == null) {
            ddVar.m2706a(theme);
        }
    }
}
项目:CanDialog    文件:VectorDrawable.java   
@Override
public void applyTheme(Theme t) {
    super.applyTheme(t);

    final VectorDrawableState state = mVectorState;
    if (state != null && state.mThemeAttrs != null) {
        //TODO
        final TypedArray a = null;//t.resolveAttributes(state.mThemeAttrs, R.styleable.VectorDrawable);
        try {
            state.mCacheDirty = true;
            updateStateFromTypedArray(a);
        } catch (XmlPullParserException e) {
            throw new RuntimeException(e);
        } finally {
            a.recycle();
        }

        mTintFilter = updateTintFilter(mTintFilter, state.mTint, state.mTintMode);
    }

    final VPathRenderer path = state.mVPathRenderer;
    if (path != null && path.canApplyTheme()) {
        path.applyTheme(t);
    }
}
项目:freeotp-android    文件:ProgressCircle.java   
private void setup(Context context, AttributeSet attrs) {
    DisplayMetrics dm = getResources().getDisplayMetrics();
    mPadding = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 2, dm);
    mStrokeWidth = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 4, dm);

    mRectF = new RectF();
    mRect = new Rect();

    mPaint = new Paint();
    mPaint.setARGB(0x99, 0x33, 0x33, 0x33);
    mPaint.setAntiAlias(true);
    mPaint.setStrokeCap(Paint.Cap.BUTT);

    if (attrs != null) {
        Theme t = context.getTheme();
        TypedArray a = t.obtainStyledAttributes(attrs, R.styleable.ProgressCircle, 0, 0);

        try {
            setMax(a.getInteger(R.styleable.ProgressCircle_max, 100));
            setHollow(a.getBoolean(R.styleable.ProgressCircle_hollow, false));
        } finally {
            a.recycle();
        }
    }
}
项目:K9-MailClient    文件:FoldableLinearLayout.java   
/**
 * Load given attributes to inner variables,
 * 
 * @param context
 * @param attrs
 */
private void processAttributes(Context context, AttributeSet attrs) {
    Theme theme = context.getTheme();
    TypedValue outValue = new TypedValue();
    boolean found = theme.resolveAttribute(R.attr.iconActionCollapse, outValue, true);
    if (found) {
        mIconActionCollapseId = outValue.resourceId;
    }
    found = theme.resolveAttribute(R.attr.iconActionExpand, outValue, true);
    if (found) {
        mIconActionExpandId = outValue.resourceId;
    }
    if (attrs != null) {
        TypedArray a = context.obtainStyledAttributes(attrs,
                R.styleable.FoldableLinearLayout, 0, 0);
        mFoldedLabel = a.getString(R.styleable.FoldableLinearLayout_foldedLabel);
        mUnFoldedLabel = a.getString(R.styleable.FoldableLinearLayout_unFoldedLabel);
        a.recycle();
    }
    // If any attribute isn't found then set a default one
    mFoldedLabel = (mFoldedLabel == null) ? "No text!" : mFoldedLabel;
    mUnFoldedLabel = (mUnFoldedLabel == null) ? "No text!" : mUnFoldedLabel;
}
项目:solved-hacking-problem    文件:aq.java   
void m1771a(Context context) {
    TypedValue typedValue = new TypedValue();
    Theme newTheme = context.getResources().newTheme();
    newTheme.setTo(context.getTheme());
    newTheme.resolveAttribute(C0233b.actionBarPopupTheme, typedValue, true);
    if (typedValue.resourceId != 0) {
        newTheme.applyStyle(typedValue.resourceId, true);
    }
    newTheme.resolveAttribute(C0233b.panelMenuListTheme, typedValue, true);
    if (typedValue.resourceId != 0) {
        newTheme.applyStyle(typedValue.resourceId, true);
    } else {
        newTheme.applyStyle(C0242k.Theme_AppCompat_CompactMenu, true);
    }
    Context c0249e = new C0249e(context, 0);
    c0249e.getTheme().setTo(newTheme);
    this.f646l = c0249e;
    TypedArray obtainStyledAttributes = c0249e.obtainStyledAttributes(C0243l.AppCompatTheme);
    this.f636b = obtainStyledAttributes.getResourceId(C0243l.AppCompatTheme_panelBackground, 0);
    this.f640f = obtainStyledAttributes.getResourceId(C0243l.AppCompatTheme_android_windowAnimationStyle, 0);
    obtainStyledAttributes.recycle();
}
项目:apker    文件:JarMainBaseActivity.java   
@Override
public void setOverrideResources(ApkResources myres) {
    if (myres == null) {
        this.jarResources = null;
        this.resources = null;
        this.assetManager = null;
        this.theme = null;
    } else {
        this.jarResources = myres;
        this.resources = myres.getResources();
        this.assetManager = myres.getAssets();
        Theme t = myres.getResources().newTheme();
        t.setTo(getTheme());
        this.theme = t;
    }
}
项目:CanDialog    文件:VectorDrawable.java   
private void recursiveApplyTheme(VGroup currentGroup, Theme t) {
    // We can do a tree traverse here, apply theme to all paths which
    // can apply theme.
    final ArrayList<Object> children = currentGroup.mChildren;
    for (int i = 0; i < children.size(); i++) {
        Object child = children.get(i);
        if (child instanceof VGroup) {
            VGroup childGroup = (VGroup) child;
            if (childGroup.canApplyTheme()) {
                childGroup.applyTheme(t);
            }
            recursiveApplyTheme(childGroup, t);
        } else if (child instanceof VPath) {
            VPath childPath = (VPath) child;
            if (childPath.canApplyTheme()) {
                childPath.applyTheme(t);
            }
        }
    }
}
项目:SOS-The-Healthcare-Companion    文件:ContactBadge.java   
private void initOverlay(Context context, Shape shape) {
    // pressed state
    TypedValue typedValue = new TypedValue();
    Theme theme = context.getTheme();

    mPressedOverlay = new ShapeDrawable(shape);
    int overlayColor = Color.parseColor("#aa888888");
    if (theme.resolveAttribute(R.attr.cp_badgeOverlayColor, typedValue, true)) {
        overlayColor = typedValue.data;
    }
    Paint paint = mPressedOverlay.getPaint();
    paint.setColor(overlayColor);
    paint.setStyle(Paint.Style.FILL);
    paint.setAntiAlias(true);
}
项目:letv    文件:JarMainBaseActivity.java   
public void setOverrideResources(JarResources myres) {
    if (myres == null) {
        this.jarResources = null;
        this.resources = null;
        this.assetManager = null;
        this.theme = null;
        return;
    }
    this.jarResources = myres;
    this.resources = myres.getResources();
    this.assetManager = myres.getAssets();
    Theme t = myres.getResources().newTheme();
    t.setTo(getTheme());
    this.theme = t;
}
项目:letv    文件:ResourcesCompat.java   
@Nullable
public static Drawable getDrawable(@NonNull Resources res, @DrawableRes int id, @Nullable Theme theme) throws NotFoundException {
    if (VERSION.SDK_INT >= 21) {
        return ResourcesCompatApi21.getDrawable(res, id, theme);
    }
    return res.getDrawable(id);
}
项目:letv    文件:ResourcesCompat.java   
@Nullable
public static Drawable getDrawableForDensity(@NonNull Resources res, @DrawableRes int id, int density, @Nullable Theme theme) throws NotFoundException {
    if (VERSION.SDK_INT >= 21) {
        return ResourcesCompatApi21.getDrawableForDensity(res, id, density, theme);
    }
    if (VERSION.SDK_INT >= 15) {
        return ResourcesCompatIcsMr1.getDrawableForDensity(res, id, density);
    }
    return res.getDrawable(id);
}
项目:letv    文件:ResourcesCompat.java   
@ColorInt
public static int getColor(@NonNull Resources res, @ColorRes int id, @Nullable Theme theme) throws NotFoundException {
    if (VERSION.SDK_INT >= 23) {
        return ResourcesCompatApi23.getColor(res, id, theme);
    }
    return res.getColor(id);
}
项目:letv    文件:ResourcesCompat.java   
@Nullable
public static ColorStateList getColorStateList(@NonNull Resources res, @ColorRes int id, @Nullable Theme theme) throws NotFoundException {
    if (VERSION.SDK_INT >= 23) {
        return ResourcesCompatApi23.getColorStateList(res, id, theme);
    }
    return res.getColorStateList(id);
}
项目:respinner    文件:ReSpinner.java   
public ReSpinner(Context context,
        AttributeSet attrs,
        int defStyleAttr,
        int mode,
        Theme popupTheme) {
    super(context, attrs, defStyleAttr, mode, popupTheme);
}
项目:boohee_v5.6    文件:ContextThemeWrapper.java   
public Theme getTheme() {
    if (this.mTheme != null) {
        return this.mTheme;
    }
    if (this.mThemeResource == 0) {
        this.mThemeResource = R.style.Theme_AppCompat_Light;
    }
    initializeTheme();
    return this.mTheme;
}
项目:boohee_v5.6    文件:ContextThemeWrapper.java   
private void initializeTheme() {
    boolean first = this.mTheme == null;
    if (first) {
        this.mTheme = getResources().newTheme();
        Theme theme = getBaseContext().getTheme();
        if (theme != null) {
            this.mTheme.setTo(theme);
        }
    }
    onApplyThemeResource(this.mTheme, this.mThemeResource, first);
}
项目:boohee_v5.6    文件:AppCompatDrawableManager.java   
public Drawable createFromXmlInner(@NonNull Context context, @NonNull XmlPullParser parser, @NonNull AttributeSet attrs, @Nullable Theme theme) {
    try {
        return AnimatedVectorDrawableCompat.createFromXmlInner(context, context.getResources(), parser, attrs, theme);
    } catch (Exception e) {
        Log.e("AvdcInflateDelegate", "Exception while inflating <animated-vector>", e);
        return null;
    }
}
项目:boohee_v5.6    文件:AppCompatDrawableManager.java   
public Drawable createFromXmlInner(@NonNull Context context, @NonNull XmlPullParser parser, @NonNull AttributeSet attrs, @Nullable Theme theme) {
    try {
        return VectorDrawableCompat.createFromXmlInner(context.getResources(), parser, attrs, theme);
    } catch (Exception e) {
        Log.e("VdcInflateDelegate", "Exception while inflating <vector>", e);
        return null;
    }
}
项目:boohee_v5.6    文件:ThemedSpinnerAdapter.java   
public void setDropDownViewTheme(@Nullable Theme theme) {
    if (theme == null) {
        this.mDropDownInflater = null;
    } else if (theme == this.mContext.getTheme()) {
        this.mDropDownInflater = this.mInflater;
    } else {
        this.mDropDownInflater = LayoutInflater.from(new ContextThemeWrapper(this.mContext, theme));
    }
}
项目:boohee_v5.6    文件:VectorDrawableCompat.java   
public void inflate(Resources r, AttributeSet attrs, Theme theme, XmlPullParser parser) {
    if (TypedArrayUtils.hasAttribute(parser, "pathData")) {
        TypedArray a = VectorDrawableCommon.obtainAttributes(r, theme, attrs, AndroidResources.styleable_VectorDrawableClipPath);
        updateStateFromTypedArray(a);
        a.recycle();
    }
}
项目:boohee_v5.6    文件:VectorDrawableCompat.java   
@Nullable
public static VectorDrawableCompat create(@NonNull Resources res, @DrawableRes int resId, @Nullable Theme theme) {
    if (VERSION.SDK_INT >= 21) {
        VectorDrawableCompat drawable = new VectorDrawableCompat();
        drawable.mDelegateDrawable = ResourcesCompat.getDrawable(res, resId, theme);
        drawable.mCachedConstantStateDelegate = new VectorDrawableDelegateState(drawable.mDelegateDrawable.getConstantState());
        return drawable;
    }
    try {
        int type;
        XmlPullParser parser = res.getXml(resId);
        AttributeSet attrs = Xml.asAttributeSet(parser);
        do {
            type = parser.next();
            if (type == 2) {
                break;
            }
        } while (type != 1);
        if (type == 2) {
            return createFromXmlInner(res, parser, attrs, theme);
        }
        throw new XmlPullParserException("No start tag found");
    } catch (XmlPullParserException e) {
        Log.e(LOGTAG, "parser error", e);
        return null;
    } catch (IOException e2) {
        Log.e(LOGTAG, "parser error", e2);
        return null;
    }
}
项目:boohee_v5.6    文件:VectorDrawableCompat.java   
public void inflate(Resources res, XmlPullParser parser, AttributeSet attrs, Theme theme) throws XmlPullParserException, IOException {
    if (this.mDelegateDrawable != null) {
        DrawableCompat.inflate(this.mDelegateDrawable, res, parser, attrs, theme);
        return;
    }
    VectorDrawableCompatState state = this.mVectorState;
    state.mVPathRenderer = new VPathRenderer();
    TypedArray a = VectorDrawableCommon.obtainAttributes(res, theme, attrs, AndroidResources.styleable_VectorDrawableTypeArray);
    updateStateFromTypedArray(a, parser);
    a.recycle();
    state.mChangingConfigurations = getChangingConfigurations();
    state.mCacheDirty = true;
    inflateInternal(res, parser, attrs, theme);
    this.mTintFilter = updateTintFilter(this.mTintFilter, state.mTint, state.mTintMode);
}
项目:boohee_v5.6    文件:ResourcesCompat.java   
@Nullable
public static Drawable getDrawable(@NonNull Resources res, @DrawableRes int id, @Nullable Theme theme) throws NotFoundException {
    if (VERSION.SDK_INT >= 21) {
        return ResourcesCompatApi21.getDrawable(res, id, theme);
    }
    return res.getDrawable(id);
}
项目:boohee_v5.6    文件:ResourcesCompat.java   
@Nullable
public static Drawable getDrawableForDensity(@NonNull Resources res, @DrawableRes int id, int density, @Nullable Theme theme) throws NotFoundException {
    if (VERSION.SDK_INT >= 21) {
        return ResourcesCompatApi21.getDrawableForDensity(res, id, density, theme);
    }
    if (VERSION.SDK_INT >= 15) {
        return ResourcesCompatIcsMr1.getDrawableForDensity(res, id, density);
    }
    return res.getDrawable(id);
}
项目:boohee_v5.6    文件:ResourcesCompat.java   
@ColorInt
public static int getColor(@NonNull Resources res, @ColorRes int id, @Nullable Theme theme) throws NotFoundException {
    if (VERSION.SDK_INT >= 23) {
        return ResourcesCompatApi23.getColor(res, id, theme);
    }
    return res.getColor(id);
}
项目:boohee_v5.6    文件:ResourcesCompat.java   
@Nullable
public static ColorStateList getColorStateList(@NonNull Resources res, @ColorRes int id, @Nullable Theme theme) throws NotFoundException {
    if (VERSION.SDK_INT >= 23) {
        return ResourcesCompatApi23.getColorStateList(res, id, theme);
    }
    return res.getColorStateList(id);
}
项目:FlickLauncher    文件:PreloadIconDrawable.java   
public PreloadIconDrawable(Drawable icon, Theme theme) {
    mIcon = icon;

    mPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    mPaint.setStyle(Paint.Style.STROKE);
    mPaint.setStrokeCap(Paint.Cap.ROUND);

    setBounds(icon.getBounds());
    applyPreloaderTheme(theme);
    onLevelChange(0);
}
项目:FlickLauncher    文件:PreloadIconDrawable.java   
public void applyPreloaderTheme(Theme t) {
    TypedArray ta = t.obtainStyledAttributes(R.styleable.PreloadIconDrawable);
    mBgDrawable = ta.getDrawable(R.styleable.PreloadIconDrawable_background);
    mBgDrawable.setFilterBitmap(true);
    mPaint.setStrokeWidth(ta.getDimension(R.styleable.PreloadIconDrawable_indicatorSize, 0));
    mRingOutset = ta.getDimensionPixelSize(R.styleable.PreloadIconDrawable_ringOutset, 0);
    ta.recycle();
    onBoundsChange(getBounds());
    invalidateSelf();
}
项目:FlickLauncher    文件:BubbleTextView.java   
private Theme getPreloaderTheme() {
    Object tag = getTag();
    int style = ((tag != null) && (tag instanceof ShortcutInfo) &&
            (((ShortcutInfo) tag).container >= 0)) ? R.style.PreloadIcon_Folder
                    : R.style.PreloadIcon;
    Theme theme = sPreloaderThemes.get(style);
    if (theme == null) {
        theme = getResources().newTheme();
        theme.applyStyle(style, true);
        sPreloaderThemes.put(style, theme);
    }
    return theme;
}
项目:SimpleUILauncher    文件:PreloadIconDrawable.java   
public PreloadIconDrawable(Drawable icon, Theme theme) {
    mIcon = icon;

    mPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    mPaint.setStyle(Paint.Style.STROKE);
    mPaint.setStrokeCap(Paint.Cap.ROUND);

    setBounds(icon.getBounds());
    applyPreloaderTheme(theme);
    onLevelChange(0);
}
项目:SimpleUILauncher    文件:PreloadIconDrawable.java   
public void applyPreloaderTheme(Theme t) {
    TypedArray ta = t.obtainStyledAttributes(R.styleable.PreloadIconDrawable);
    mBgDrawable = ta.getDrawable(R.styleable.PreloadIconDrawable_background);
    mBgDrawable.setFilterBitmap(true);
    mPaint.setStrokeWidth(ta.getDimension(R.styleable.PreloadIconDrawable_indicatorSize, 0));
    mRingOutset = ta.getDimensionPixelSize(R.styleable.PreloadIconDrawable_ringOutset, 0);
    ta.recycle();
    onBoundsChange(getBounds());
    invalidateSelf();
}