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


Java StyleRes类代码示例

本文整理汇总了Java中android.support.annotation.StyleRes的典型用法代码示例。如果您正苦于以下问题:Java StyleRes类的具体用法?Java StyleRes怎么用?Java StyleRes使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: DatePickerDialog

import android.support.annotation.StyleRes; //导入依赖的package包/类
private DatePickerDialog(@NonNull Context context, @StyleRes int themeResId,
                         @Nullable OnDateSetListener listener, @Nullable Calendar calendar, int year,
                         int monthOfYear, int dayOfMonth) {
    super(context, resolveDialogTheme(context, themeResId));

    final Context themeContext = getContext();
    final LayoutInflater inflater = LayoutInflater.from(themeContext);
    final View view = inflater.inflate(R.layout.date_picker_dialog, null);
    setView(view);

    setButton(BUTTON_POSITIVE, themeContext.getString(android.R.string.ok), this);
    setButton(BUTTON_NEGATIVE, themeContext.getString(android.R.string.cancel), this);
    // FIXME ? setButtonPanelLayoutHint(LAYOUT_HINT_SIDE);

    if (calendar != null) {
        year = calendar.get(Calendar.YEAR);
        monthOfYear = calendar.get(Calendar.MONTH);
        dayOfMonth = calendar.get(Calendar.DAY_OF_MONTH);
    }

    mDatePicker = view.findViewById(R.id.datePicker);
    mDatePicker.init(year, monthOfYear, dayOfMonth, this);
    mDatePicker.setValidationCallback(mValidationCallback);

    mDateSetListener = listener;
}
 
开发者ID:Gericop,项目名称:DateTimePicker,代码行数:27,代码来源:DatePickerDialog.java

示例2: AppMarketsDialog

import android.support.annotation.StyleRes; //导入依赖的package包/类
public AppMarketsDialog(@NonNull Context context, @StyleRes int theme, List<AppMarket> appMarkets,
                        final OnAppMarketSelectedListener listener) {
    super(context, theme);
    View view = LayoutInflater.from(context).inflate(R.layout.dialog_app_markets, null);
    RecyclerView recyclerView = (RecyclerView) view.findViewById(R.id.recycler_view);
    recyclerView.setLayoutManager(new GridLayoutManager(context, 3));
    OnAppMarketSelectedListener mChooseListener = new OnAppMarketSelectedListener() {
        @Override
        public void onSelected(int position) {
            dismiss();
            listener.onSelected(position);
        }
    };
    recyclerView.setAdapter(new MarketsAdapter(appMarkets, mChooseListener));
    setContentView(view);
}
 
开发者ID:nukc,项目名称:AppMarketUpdater,代码行数:17,代码来源:AppMarketsDialog.java

示例3: registerThemeRes

import android.support.annotation.StyleRes; //导入依赖的package包/类
public static void registerThemeRes(String group, String key, @StyleRes int resid, boolean isDefault) {
    if (sThemeResMap.get(group) == null) {
        sThemeResMap.put(group, new HashMap<String, Integer>());
    }
    sThemeResMap.get(group).put(key, resid);
    if (TextUtils.isEmpty(SharedPreferencesMgr.getString(group, "")) && isDefault) {
        SharedPreferencesMgr.setString(group, key);
    }
}
 
开发者ID:vitaviva,项目名称:MultipleTheme,代码行数:10,代码来源:ThemeManager.java

示例4: fromStyle

import android.support.annotation.StyleRes; //导入依赖的package包/类
/**
 * Set ups this text appearance holder with text appearance values from the specified <var>resId</var>
 * style.
 *
 * @param context Context used to parse text appearance attributes from the specified style resource.
 * @param resId   Resource id of the desired TextAppearance style from which to parse attributes.
 * @return {@code True} if some of attributes of this text appearance has changed, {@code false}
 * otherwise.
 */
public boolean fromStyle(@NonNull Context context, @StyleRes int resId) {
	this.reset();
	final TypedArray typedArray = context.obtainStyledAttributes(resId, R.styleable.Ui_TextAppearance);
	if (typedArray != null) {
		final int n = typedArray.getIndexCount();
		for (int i = 0; i < n; i++) {
			final int index = typedArray.getIndex(i);
			if (index == R.styleable.Ui_TextAppearance_android_textSize) {
				this.mTextSize = typedArray.getDimensionPixelSize(index, (int) mTextSize);
			} else if (index == R.styleable.Ui_TextAppearance_android_textColor) {
				this.mTextColors = typedArray.getColorStateList(index);
			} else if (index == R.styleable.Ui_TextAppearance_android_textStyle) {
				this.mTextStyle = typedArray.getInt(index, mTextStyle);
			} else if (index == R.styleable.Ui_TextAppearance_android_typeface) {
				this.mTypefaceIndex = typedArray.getInt(index, mTypefaceIndex);
			} else if (index == R.styleable.Ui_TextAppearance_android_fontFamily) {
				this.mFontFamily = typedArray.getString(index);
			} else if (index == R.styleable.Ui_TextAppearance_uiFont) {
				final String fontPath = typedArray.getString(index);
				if (!TextUtils.isEmpty(fontPath)) {
					this.mTypeface = Font.create(fontPath).getTypeface(context);
				}
			}
		}
		typedArray.recycle();
		return n > 0;
	}
	return false;
}
 
开发者ID:universum-studios,项目名称:android_ui,代码行数:39,代码来源:TextAppearance.java

示例5: setTextAppearance

import android.support.annotation.StyleRes; //导入依赖的package包/类
/**
 */
@Override
@SuppressWarnings("deprecation")
public void setTextAppearance(@NonNull Context context, @StyleRes int resId) {
	super.setTextAppearance(context, resId);
	this.ensureDecorator();
	mDecorator.setFontFromStyle(resId);
}
 
开发者ID:universum-studios,项目名称:android_ui,代码行数:10,代码来源:CheckBoxWidget.java

示例6: getBaseBottomSheetTheme

import android.support.annotation.StyleRes; //导入依赖的package包/类
@StyleRes
public int getBaseBottomSheetTheme() {
    switch (getBaseThemeValue(sharedPrefs)) {
        case 0:
        default:
            return R.style.Theme_Design_Light_BottomSheetDialog;
        case 1:
            return R.style.Theme_Design_BottomSheetDialog;
    }
}
 
开发者ID:philliphsu,项目名称:NumberPadTimePicker,代码行数:11,代码来源:CustomThemeModel.java

示例7: setStyle

import android.support.annotation.StyleRes; //导入依赖的package包/类
public void setStyle(int style, @StyleRes int theme) {
    this.mStyle = style;
    if (this.mStyle == 2 || this.mStyle == 3) {
        this.mTheme = 16973913;
    }
    if (theme != 0) {
        this.mTheme = theme;
    }
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:10,代码来源:DialogFragment.java

示例8: getBaseAlertTheme

import android.support.annotation.StyleRes; //导入依赖的package包/类
@StyleRes
public int getBaseAlertTheme() {
    switch (getBaseThemeValue(sharedPrefs)) {
        case 0:
        default:
            return R.style.Theme_AppCompat_Light_Dialog_Alert;
        case 1:
            return R.style.Theme_AppCompat_Dialog_Alert;
    }
}
 
开发者ID:philliphsu,项目名称:NumberPadTimePicker,代码行数:11,代码来源:CustomThemeModel.java

示例9: LocationLayer

import android.support.annotation.StyleRes; //导入依赖的package包/类
LocationLayer(MapView mapView, MapboxMap mapboxMap, @StyleRes int styleRes) {
  this.mapboxMap = mapboxMap;
  this.context = mapView.getContext();
  addSources();
  addLayers();
  applyStyle(styleRes);
}
 
开发者ID:mapbox,项目名称:mapbox-plugins-android,代码行数:8,代码来源:LocationLayer.java

示例10: setItemTextAppearance

import android.support.annotation.StyleRes; //导入依赖的package包/类
@Override
public void setItemTextAppearance(@StyleRes int resId) {
    super.setItemTextAppearance(resId);
    if (resId != INVALID_ID) {
        TypedArray a = getContext().obtainStyledAttributes(resId, R.styleable.SkinTextAppearance);
        if (a.hasValue(R.styleable.SkinTextAppearance_android_textColor)) {
            mTextColorResId = a.getResourceId(R.styleable.SkinTextAppearance_android_textColor, INVALID_ID);
        }
        a.recycle();
        applyItemTextColorResource();
    }
}
 
开发者ID:ximsfei,项目名称:Android-skin-support,代码行数:13,代码来源:SkinMaterialNavigationView.java

示例11: setTextAppearance

import android.support.annotation.StyleRes; //导入依赖的package包/类
/**
 * Set the Text's text appearance of the Title
 *
 * @param textAppearance The style resource id
 */
public void setTextAppearance(@StyleRes final int textAppearance) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
        tvText.setTextAppearance(textAppearance);
    } else {
        tvText.setTextAppearance(tvText.getContext(), textAppearance);
    }
}
 
开发者ID:Tapadoo,项目名称:Alerter,代码行数:13,代码来源:Alert.java

示例12: getAboutTheme

import android.support.annotation.StyleRes; //导入依赖的package包/类
@StyleRes
public static int getAboutTheme(String theme){
    switch (theme){
        case PrefUtils.LIGHT_TEAL:
            return R.style.ThemeLightTeal_AboutActivity;
        case PrefUtils.LIGHT_INDIGO:
            return R.style.ThemeLight_AboutActivity;
        case PrefUtils.DARK:
            return R.style.ThemeDark_AboutActivity;
        default:
            return R.style.ThemeLightTeal_AboutActivity;
    }
}
 
开发者ID:ThirtyDegreesRay,项目名称:OpenHub,代码行数:14,代码来源:ThemeHelper.java

示例13: setUpFromAttrs

import android.support.annotation.StyleRes; //导入依赖的package包/类
/**
 * Performs configuration of this controller from the given <var>attrs</var>.
 *
 * @param context      Context used to obtain values for the given attributes.
 * @param attrs        Set of attributes with values to be used to set up this controller.
 * @param defStyleAttr An attribute which contains a reference to a default style resource, for
 *                     the view attached to this controller, within a theme of the given context.
 * @param defStyleRes  Resource id of the default style for the view attached to this controller.
 * @return {@code True} if some setting of this controller has been changed, {@code false} otherwise.
 */
@SuppressWarnings("ResourceType")
public boolean setUpFromAttrs(@NonNull Context context, AttributeSet attrs, @AttrRes int defStyleAttr, @StyleRes int defStyleRes) {
	final TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.Ui_PullController, defStyleAttr, defStyleRes);
	if (typedArray != null) {
		this.ensurePullHelper();
		final int n = typedArray.getIndexCount();
		for (int i = 0; i < n; i++) {
			final int index = typedArray.getIndex(i);
			if (index == R.styleable.Ui_PullController_uiPullMode) {
				setPullMode(typedArray.getInteger(index, mPullHelper.getPullMode()));
			} else if (index == R.styleable.Ui_PullController_uiPullMinVelocity) {
				setPullMinVelocity(typedArray.getFloat(index, getPullMinVelocity()));
			} else if (index == R.styleable.Ui_PullController_uiPullDistanceFraction) {
				setPullDistanceFraction(typedArray.getFloat(index, getPullDistanceFraction()));
			} else if (index == R.styleable.Ui_PullController_uiPullDistance) {
				setPullDistance(typedArray.getDimensionPixelSize(index, (int) getPullDistance()));
			} else if (index == R.styleable.Ui_PullController_uiPullCollapseDuration) {
				setPullCollapseDuration(typedArray.getInt(index, (int) mAnimations.pullCollapseDuration));
			} else if (index == R.styleable.Ui_PullController_uiPullCollapseDelay) {
				setPullCollapseDelay(typedArray.getInt(index, (int) mAnimations.pullCollapseDelay));
			}
		}
		typedArray.recycle();
		return n > 0;
	}
	return false;
}
 
开发者ID:universum-studios,项目名称:android_ui,代码行数:38,代码来源:PullController.java

示例14: activityTheme

import android.support.annotation.StyleRes; //导入依赖的package包/类
@Override
public Config activityTheme(@StyleRes int theme) {
    final Resources r = mContext.getResources();
    final String name = r.getResourceName(theme);
    final String defType = r.getResourceTypeName(theme);
    mEditor.putString(KEY_ACTIVITY_THEME, name);
    mEditor.putString(KEY_ACTIVITY_THEME_DEFTYPE, defType);
    return this;
}
 
开发者ID:RajneeshSingh007,项目名称:MusicX-music-player,代码行数:10,代码来源:Config.java

示例15: LocationLayerPlugin

import android.support.annotation.StyleRes; //导入依赖的package包/类
/**
 * Construct a {@code LocationLayerPlugin}
 *
 * @param mapView        the MapView to apply the My Location layer plugin to
 * @param mapboxMap      the MapboxMap to apply the My Location layer plugin with
 * @param locationEngine the {@link LocationEngine} this plugin should use to update
 * @param styleRes       customize the user location icons inside your apps {@code style.xml}
 * @since 0.1.0
 */
public LocationLayerPlugin(@NonNull MapView mapView, @NonNull MapboxMap mapboxMap,
                           @Nullable LocationEngine locationEngine, @StyleRes int styleRes) {
  this.locationEngine = locationEngine;
  this.mapboxMap = mapboxMap;
  this.mapView = mapView;
  this.styleRes = styleRes;
  mapView.addOnMapChangedListener(this);
  initialize();
}
 
开发者ID:mapbox,项目名称:mapbox-plugins-android,代码行数:19,代码来源:LocationLayerPlugin.java


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