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


Java Resources.Theme方法代码示例

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


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

示例1: getDefaultTextAttribute

import android.content.res.Resources; //导入方法依赖的package包/类
private static ColorStateList getDefaultTextAttribute(Context context, int attribute) {
  Resources.Theme theme = context.getTheme();
  TypedArray textAppearances = null;
  try {
    textAppearances = theme.obtainStyledAttributes(new int[]{attribute});
    ColorStateList textColor = textAppearances.getColorStateList(0);
    return textColor;
  } finally {
    if (textAppearances != null) {
      textAppearances.recycle();
    }
  }
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:14,代码来源:DefaultStyleValuesUtil.java

示例2: onApplyThemeResource

import android.content.res.Resources; //导入方法依赖的package包/类
@Override
protected void onApplyThemeResource(Resources.Theme theme, @StyleRes int resid,
                                    boolean first) {
    if (mParent == null) {
        super.onApplyThemeResource(theme, resid, first);
    } else {
        try {
            theme.setTo(mParent.getTheme());
        } catch (Exception e) {
            // Empty
        }
        theme.applyStyle(resid, false);
    }

    // Get the primary color and update the TaskDescription for this activity
    TypedArray a = theme.obtainStyledAttributes(
            com.android.internal.R.styleable.ActivityTaskDescription);
    if (mTaskDescription.getPrimaryColor() == 0) {
        int colorPrimary = a.getColor(
                com.android.internal.R.styleable.ActivityTaskDescription_colorPrimary, 0);
        if (colorPrimary != 0 && Color.alpha(colorPrimary) == 0xFF) {
            mTaskDescription.setPrimaryColor(colorPrimary);
        }
    }
    // For dev-preview only.
    if (mTaskDescription.getBackgroundColor() == 0) {
        int colorBackground = a.getColor(
                com.android.internal.R.styleable.ActivityTaskDescription_colorBackground, 0);
        if (colorBackground != 0 && Color.alpha(colorBackground) == 0xFF) {
            mTaskDescription.setBackgroundColor(colorBackground);
        }
    }
    a.recycle();
    setTaskDescription(mTaskDescription);
}
 
开发者ID:JessYanCoding,项目名称:ProgressManager,代码行数:36,代码来源:a.java

示例3: init

import android.content.res.Resources; //导入方法依赖的package包/类
/**
 * Called from one of constructors of this view to perform its initialization.
 * <p>
 * Initialization is done via parsing of the specified <var>attrs</var> set and obtaining for
 * this view specific data from it that can be used to configure this new view instance. The
 * specified <var>defStyleAttr</var> and <var>defStyleRes</var> are used to obtain default data
 * from the current theme provided by the specified <var>context</var>.
 */
@SuppressWarnings("ConstantConditions")
private void init(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
	if (!isInEditMode()) {
		final Resources.Theme theme = context.getTheme();
		// Try to apply font presented within text appearance style.
		final TypedArray appearanceAttributes = theme.obtainStyledAttributes(attrs, new int[]{android.R.attr.textAppearance}, defStyleAttr, defStyleRes);
		final int appearance = appearanceAttributes.getResourceId(0, -1);
		if (appearance != -1) {
			FontApplier.DEFAULT.applyFont(this, appearance);
		}
		appearanceAttributes.recycle();
		// Try to apply font presented within xml attributes.
		FontApplier.DEFAULT.applyFont(this, attrs, defStyleAttr, defStyleRes);
	}
	// Default set up.
	this.mLocale = Locale.getDefault();
	this.handleLocaleChange();

	final TypedArray attributes = context.obtainStyledAttributes(attrs, R.styleable.Ui_MonthView, defStyleAttr, defStyleRes);
	this.processTintValues(context, attributes);
	for (int i = 0; i < attributes.getIndexCount(); i++) {
		final int index = attributes.getIndex(i);
		if (index == R.styleable.Ui_MonthView_android_horizontalSpacing) {
			this.mSpacingHorizontal = attributes.getDimensionPixelSize(index, mSpacingHorizontal);
		} else if (index == R.styleable.Ui_MonthView_android_verticalSpacing) {
			this.mSpacingVertical = attributes.getDimensionPixelSize(index, mSpacingVertical);
		} else if (index == R.styleable.Ui_MonthView_uiMonthDayLettersOffsetVertical) {
			this.mDayLettersOffsetVertical = attributes.getDimensionPixelSize(index, mDayLettersOffsetVertical);
		} else if (index == R.styleable.Ui_MonthView_uiMonthDayNumbersOffsetVertical) {
			this.mDayNumbersOffsetVertical = attributes.getDimensionPixelOffset(index, mDayNumbersOffsetVertical);
		} else if (index == R.styleable.Ui_MonthView_uiMonthTitleTextAppearance) {
			setTitleTextAppearance(attributes.getResourceId(index, 0));
		} else if (index == R.styleable.Ui_MonthView_uiMonthDayLetterTextAppearance) {
			setDayLetterTextAppearance(attributes.getResourceId(index, 0));
		} else if (index == R.styleable.Ui_MonthView_uiMonthDayNumberTextAppearance) {
			setDayNumberTextAppearance(attributes.getResourceId(index, 0));
		} else if (index == R.styleable.Ui_MonthView_uiMonthDaySelector) {
			setDaySelector(attributes.getResourceId(index, 0));
		} else if (index == R.styleable.Ui_MonthView_uiMonthDaySelectorRadius) {
			setDaySelectorRadius(attributes.getDimensionPixelSize(index, mDaySelectorRadius));
		} else if (index == R.styleable.Ui_MonthView_uiMonthCurrentDayTextColor) {
			setCurrentDayTextColor(attributes.getColorStateList(index));
		}
	}
	attributes.recycle();
	this.applyDaySelectorTint();
}
 
开发者ID:universum-studios,项目名称:android_ui,代码行数:56,代码来源:MonthView.java

示例4: selectableItemBackground

import android.content.res.Resources; //导入方法依赖的package包/类
/**
 * Applies to view default background drawable which contains focus and pressed states.
 *
 * @param view View whose background drawable should be changed.
 */
public static void selectableItemBackground(@NonNull final View view) {
    final Resources.Theme theme = view.getContext().getTheme();
    final TypedValue outValue = new TypedValue();
    if (theme.resolveAttribute(R.attr.selectableItemBackground, outValue, true)) {
        view.setBackgroundResource(outValue.resourceId);
    }
}
 
开发者ID:GlobusLTD,项目名称:recyclerview-android,代码行数:13,代码来源:TouchFeedback.java

示例5: createFromXmlInner

import android.content.res.Resources; //导入方法依赖的package包/类
@SuppressLint("NewApi")
@Override
public Drawable createFromXmlInner(@NonNull Context context, @NonNull XmlPullParser parser,
                                   @NonNull AttributeSet attrs, @Nullable Resources.Theme theme) {
    try {
        return VectorDrawableCompat
                .createFromXmlInner(context.getResources(), parser, attrs, theme);
    } catch (Exception e) {
        Log.e("VdcInflateDelegate", "Exception while inflating <vector>", e);
        return null;
    }
}
 
开发者ID:ximsfei,项目名称:Android-skin-support,代码行数:13,代码来源:SkinCompatDrawableManager.java

示例6: shouldBeFloatingWindow

import android.content.res.Resources; //导入方法依赖的package包/类
/**
 * Returns true if the theme sets the {@code R.attr.isFloatingWindow} flag to true.
 */
protected boolean shouldBeFloatingWindow() {
    Resources.Theme theme = getTheme();
    TypedValue floatingWindowFlag = new TypedValue();

    // Check isFloatingWindow flag is defined in theme.
    if (theme == null || !theme
            .resolveAttribute(R.attr.isFloatingWindow, floatingWindowFlag, true)) {
        return false;
    }

    return (floatingWindowFlag.data != 0);
}
 
开发者ID:dreaminglion,项目名称:iosched-reader,代码行数:16,代码来源:BaseActivity.java

示例7: theme

import android.content.res.Resources; //导入方法依赖的package包/类
/**
 * @see GlideOptions#theme(Resources.Theme)
 */
@CheckResult
public GlideRequest<TranscodeType> theme(@Nullable Resources.Theme arg0) {
  if (getMutableOptions() instanceof GlideOptions) {
    this.requestOptions = ((GlideOptions) getMutableOptions()).theme(arg0);
  } else {
    this.requestOptions = new GlideOptions().apply(this.requestOptions).theme(arg0);
  }
  return this;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:13,代码来源:GlideRequest.java

示例8: applyNavigationIcon

import android.content.res.Resources; //导入方法依赖的package包/类
public static void applyNavigationIcon(ThemeUiInterface ci, Resources.Theme theme, int paramInt) {
    TypedArray ta = theme.obtainStyledAttributes(new int[]{paramInt});
    int id = ta.getResourceId(0, 0);
    if(null != ci) {
        try {
            ((Toolbar)ci.getView()).setNavigationIcon(id);
        } catch (ClassCastException e){
            e.printStackTrace();
        }
    }
    ta.recycle();
}
 
开发者ID:vitaviva,项目名称:MultipleTheme,代码行数:13,代码来源:ViewAttributeUtil.java

示例9: makeChange

import android.content.res.Resources; //导入方法依赖的package包/类
private void makeChange(int themeId){
    Resources.Theme theme = mContext.getTheme();
    for(ViewSetter setter : mViewSetters){
        setter.setValue(theme, themeId);
    }

}
 
开发者ID:chengkun123,项目名称:ReadMark,代码行数:8,代码来源:MyThemeChanger.java

示例10: changeChildrenAttrs

import android.content.res.Resources; //导入方法依赖的package包/类
private void changeChildrenAttrs(ViewGroup targetViewGroup, Resources.Theme theme, int themeId){
    int count = targetViewGroup.getChildCount();
    //遍历到每一个item
    for(int i = 0; i<count; i++){
        View childView = targetViewGroup.getChildAt(i);
        for(ViewSetter setter : mItemChildViewSetters){
            setter.mTargetView = ((ViewGroup)childView).findViewById(setter.mTargetViewId);
            if(setter.mTargetView != null){
                setter.setValue(theme, themeId);
            }
        }
    }
}
 
开发者ID:chengkun123,项目名称:ReadMark,代码行数:14,代码来源:ListAndRecyclerSetter.java

示例11: getVectorDrawable

import android.content.res.Resources; //导入方法依赖的package包/类
public static Drawable getVectorDrawable(@NonNull Resources res, @DrawableRes int resId, @Nullable Resources.Theme theme) {
    if (Build.VERSION.SDK_INT >= 21) {
        return res.getDrawable(resId, theme);
    }
    return VectorDrawableCompat.create(res, resId, theme);
}
 
开发者ID:h4h13,项目名称:RetroMusicPlayer,代码行数:7,代码来源:Util.java

示例12: setTheme

import android.content.res.Resources; //导入方法依赖的package包/类
@Override
public void setTheme(Resources.Theme themeId) {
    if(attr_background != -1) {
        ViewAttributeUtil.applyBackgroundDrawable(this, themeId, attr_background);
    }
}
 
开发者ID:vitaviva,项目名称:MultipleTheme,代码行数:7,代码来源:ThemedCheckedBox.java

示例13: getPlaceholderRes

import android.content.res.Resources; //导入方法依赖的package包/类
@Override
public @DrawableRes int getPlaceholderRes(Resources.Theme theme) {
    return ResUtil.getDrawableRes(theme, R.attr.conversation_icon_attach_file);
}
 
开发者ID:XecureIT,项目名称:PeSanKita-android,代码行数:5,代码来源:FileSlide.java

示例14: getTheme

import android.content.res.Resources; //导入方法依赖的package包/类
@Override
public Resources.Theme getTheme() {
    return null;
}
 
开发者ID:scintill,项目名称:android-runas,代码行数:5,代码来源:CliContext.java

示例15: theme

import android.content.res.Resources; //导入方法依赖的package包/类
@Override
@CheckResult
public final GlideOptions theme(@Nullable Resources.Theme arg0) {
  return (GlideOptions) super.theme(arg0);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:6,代码来源:GlideOptions.java


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