当前位置: 首页>>代码示例>>Java>>正文


Java Theme.resolveAttribute方法代码示例

本文整理汇总了Java中android.content.res.Resources.Theme.resolveAttribute方法的典型用法代码示例。如果您正苦于以下问题:Java Theme.resolveAttribute方法的具体用法?Java Theme.resolveAttribute怎么用?Java Theme.resolveAttribute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.content.res.Resources.Theme的用法示例。


在下文中一共展示了Theme.resolveAttribute方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: processAttributes

import android.content.res.Resources.Theme; //导入方法依赖的package包/类
/**
 * 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;
}
 
开发者ID:philipwhiuk,项目名称:q-mail,代码行数:29,代码来源:FoldableLinearLayout.java

示例2: ensureListMenuPresenter

import android.content.res.Resources.Theme; //导入方法依赖的package包/类
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);
    }
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:25,代码来源:ToolbarActionBar.java

示例3: setStyle

import android.content.res.Resources.Theme; //导入方法依赖的package包/类
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();
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:23,代码来源:AppCompatDelegateImplV7.java

示例4: initializePanelMenu

import android.content.res.Resources.Theme; //导入方法依赖的package包/类
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;
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:34,代码来源:AppCompatDelegateImplV7.java

示例5: getColor

import android.content.res.Resources.Theme; //导入方法依赖的package包/类
private static int getColor(Context context, int id, int defaultValue) {
    if (value == null)
        value = new TypedValue();

    try {
        Theme theme = context.getTheme();
        if (theme != null && theme.resolveAttribute(id, value, true)) {
            if (value.type >= TypedValue.TYPE_FIRST_INT && value.type <= TypedValue.TYPE_LAST_INT)
                return value.data;
            else if (value.type == TypedValue.TYPE_STRING)
                return context.getResources().getColor(value.resourceId);
        }
    } catch (Exception ex) {
        return defaultValue;
    }

    return defaultValue;
}
 
开发者ID:XhinLiang,项目名称:MDPreference,代码行数:19,代码来源:ThemeUtil.java

示例6: m1771a

import android.content.res.Resources.Theme; //导入方法依赖的package包/类
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();
}
 
开发者ID:Qwaz,项目名称:solved-hacking-problem,代码行数:23,代码来源:aq.java

示例7: getColor

import android.content.res.Resources.Theme; //导入方法依赖的package包/类
private static int getColor(Context context, int id, int defaultValue){
	if(value == null)
		value = new TypedValue();
	
	try{
		Theme theme = context.getTheme();
		if(theme != null && theme.resolveAttribute(id, value, true)){
               if (value.type >= TypedValue.TYPE_FIRST_INT && value.type <= TypedValue.TYPE_LAST_INT)
                   return value.data;
               else if (value.type == TypedValue.TYPE_STRING)
                   return context.getResources().getColor(value.resourceId);
           }
	}
	catch(Exception ex){

	}
	
	return defaultValue;
}
 
开发者ID:Runly,项目名称:CircularProgressView,代码行数:20,代码来源:ThemeUtil.java

示例8: getColor

import android.content.res.Resources.Theme; //导入方法依赖的package包/类
private static int getColor(Context context, int id, int defaultValue){
	if(value == null)
		value = new TypedValue();

	try{
		Theme theme = context.getTheme();
		if(theme != null && theme.resolveAttribute(id, value, true)){
               if (value.type >= TypedValue.TYPE_FIRST_INT && value.type <= TypedValue.TYPE_LAST_INT)
                   return value.data;
               else if (value.type == TypedValue.TYPE_STRING)
                   return context.getResources().getColor(value.resourceId);
           }
	}
	catch(Exception ex){}

	return defaultValue;
}
 
开发者ID:mobvoi,项目名称:ticdesign,代码行数:18,代码来源:ThemeUtils.java

示例9: initOverlay

import android.content.res.Resources.Theme; //导入方法依赖的package包/类
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);
}
 
开发者ID:adithya321,项目名称:SOS-The-Healthcare-Companion,代码行数:16,代码来源:ContactBadge.java

示例10: initSquare

import android.content.res.Resources.Theme; //导入方法依赖的package包/类
private void initSquare(Context context) {
    if (mTriangle == null) {
        TypedValue typedValue = new TypedValue();
        Theme theme = context.getTheme();

        // triangle
        Path chipPath = new Path();
        chipPath.moveTo(500f, 0f);
        chipPath.lineTo(500f, 500f);
        chipPath.lineTo(0f, 500f);
        chipPath.close();
        mTriangle = new ShapeDrawable(new PathShape(chipPath, 500f, 500f));
        mTriangle.setDither(true);
        int triangleColor = Color.parseColor("#cc1f1f1f");
        if (theme.resolveAttribute(R.attr.cp_badgeTriangleColor, typedValue, true)) {
            triangleColor = typedValue.data;
        }
        mTriangle.getPaint().setColor(triangleColor);

        // line
        mLinePaint = new Paint();
        int lineColor = Color.parseColor("#ffffffff");
        if (theme.resolveAttribute(R.attr.cp_badgeLineColor, typedValue, true)) {
            lineColor = typedValue.data;
        }
        mLinePaint.setColor(lineColor);
        mOffset = 1.5f * mDensity;
        mLinePaint.setStrokeWidth(mOffset);
    }

    initOverlay(context, new RectShape());
}
 
开发者ID:hwding,项目名称:templated-messaging,代码行数:33,代码来源:ContactBadge.java

示例11: m1681b

import android.content.res.Resources.Theme; //导入方法依赖的package包/类
private boolean m1681b(aq aqVar) {
    Context c0249e;
    C0264i c0264i;
    Context context = this.a;
    if ((aqVar.f635a == 0 || aqVar.f635a == C0243l.AppCompatTheme_ratingBarStyleSmall) && this.f597r != null) {
        TypedValue typedValue = new TypedValue();
        Theme theme = context.getTheme();
        theme.resolveAttribute(C0233b.actionBarTheme, typedValue, true);
        Theme theme2 = null;
        if (typedValue.resourceId != 0) {
            theme2 = context.getResources().newTheme();
            theme2.setTo(theme);
            theme2.applyStyle(typedValue.resourceId, true);
            theme2.resolveAttribute(C0233b.actionBarWidgetTheme, typedValue, true);
        } else {
            theme.resolveAttribute(C0233b.actionBarWidgetTheme, typedValue, true);
        }
        if (typedValue.resourceId != 0) {
            if (theme2 == null) {
                theme2 = context.getResources().newTheme();
                theme2.setTo(theme);
            }
            theme2.applyStyle(typedValue.resourceId, true);
        }
        Theme theme3 = theme2;
        if (theme3 != null) {
            c0249e = new C0249e(context, 0);
            c0249e.getTheme().setTo(theme3);
            c0264i = new C0264i(c0249e);
            c0264i.m2109a((C0203j) this);
            aqVar.m1772a(c0264i);
            return true;
        }
    }
    c0249e = context;
    c0264i = new C0264i(c0249e);
    c0264i.m2109a((C0203j) this);
    aqVar.m1772a(c0264i);
    return true;
}
 
开发者ID:Qwaz,项目名称:solved-hacking-problem,代码行数:41,代码来源:ae.java

示例12: getStyledColor

import android.content.res.Resources.Theme; //导入方法依赖的package包/类
@ColorInt
@UiThread
public static int getStyledColor(Theme theme, @AttrRes int attr) {
    theme.resolveAttribute(attr, TYPED_VALUE, true);
    return TYPED_VALUE.data;
}
 
开发者ID:philipwhiuk,项目名称:q-mail,代码行数:7,代码来源:ThemeUtils.java

示例13: getDrawableRes

import android.content.res.Resources.Theme; //导入方法依赖的package包/类
public static int getDrawableRes(Theme theme, @AttrRes int attr) {
  final TypedValue out = new TypedValue();
  theme.resolveAttribute(attr, out, true);
  return out.resourceId;
}
 
开发者ID:XecureIT,项目名称:PeSanKita-android,代码行数:6,代码来源:ResUtil.java

示例14: getColor

import android.content.res.Resources.Theme; //导入方法依赖的package包/类
/**
 * @param newTheme
 * @return
 */
protected int getColor(Theme newTheme) {
    TypedValue typedValue = new TypedValue();
    newTheme.resolveAttribute(mAttrResId, typedValue, true);
    return typedValue.data;
}
 
开发者ID:liuhui19991,项目名称:CloudMusicLH,代码行数:10,代码来源:ViewSetter.java

示例15: getColor

import android.content.res.Resources.Theme; //导入方法依赖的package包/类
/**
 * 
 * @param newTheme
 * @return
 */
protected int getColor(Theme newTheme) {
	TypedValue typedValue = new TypedValue();
	newTheme.resolveAttribute(mAttrResId, typedValue, true);
	return typedValue.data;
}
 
开发者ID:CarpOrange,项目名称:CloudMusic,代码行数:11,代码来源:ViewSetter.java


注:本文中的android.content.res.Resources.Theme.resolveAttribute方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。