android.support.annotation.StyleRes Java Examples
The following examples show how to use
android.support.annotation.StyleRes.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AbstractAlertDialog.java From Common with Apache License 2.0 | 6 votes |
/** * Creates a dialog window that uses a custom dialog style. * * @param context Context * @param themeResId The dialog's layout resource * @param isSetWin Set the gravity of the window * @param gravity The desired gravity constant * @param width The dialog's width * @param heith The dialog's height */ protected AbstractAlertDialog(@NonNull Context context, @StyleRes int themeResId, boolean isSetWin, int gravity, int width, int heith) { super(context, themeResId); this.mContext = context; this.mRootView = LayoutInflater.from(context).inflate(getLayoutRes(), null); setContentView(this.mRootView); setCanceledOnTouchOutside(true); setCancelable(true); if (isSetWin) { Window dialogWindow = getWindow(); if (dialogWindow != null) { dialogWindow.setWindowAnimations(-1); dialogWindow.setBackgroundDrawableResource(android.R.color.transparent); dialogWindow.getDecorView().setPadding(0, 0, 0, 0); dialogWindow.setGravity(gravity); // Get the current layout param of the dialog WindowManager.LayoutParams p = dialogWindow.getAttributes(); // Set dialog's width p.width = width; // Set dialog's height p.height = heith; dialogWindow.setAttributes(p); } } init(this.mRootView); }
Example #2
Source File: NavigationMapRoute.java From graphhopper-navigation-android with MIT License | 6 votes |
/** * Construct an instance of {@link NavigationMapRoute}. * * @param navigation an instance of the {@link MapboxNavigation} object. Passing in null means * your route won't consider rerouting during a navigation session. * @param mapView the MapView to apply the route to * @param mapboxMap the MapboxMap to apply route with * @param styleRes a style resource with custom route colors, scale, etc. * @param belowLayer optionally pass in a layer id to place the route line below */ public NavigationMapRoute(@Nullable MapboxNavigation navigation, @NonNull MapView mapView, @NonNull MapboxMap mapboxMap, @StyleRes int styleRes, @Nullable String belowLayer) { this.styleRes = styleRes; this.mapView = mapView; this.mapboxMap = mapboxMap; this.navigation = navigation; this.belowLayer = belowLayer; featureCollections = new ArrayList<>(); directionsRoutes = new ArrayList<>(); routeLineStrings = new HashMap<>(); layerIds = new ArrayList<>(); initialize(); addListeners(); }
Example #3
Source File: SearchableSpinner.java From searchablespinner with Apache License 2.0 | 6 votes |
private void getAttributeSet(@Nullable AttributeSet attrs, @AttrRes int defStyleAttr, @StyleRes int defStyleRes) { if (attrs != null) { try { TypedArray attributes = mContext.getTheme().obtainStyledAttributes(attrs, R.styleable.SearchableSpinner, defStyleAttr, defStyleRes); mRevealViewBackgroundColor = attributes.getColor(R.styleable.SearchableSpinner_RevealViewBackgroundColor, Color.WHITE); mStartEditTintColor = attributes.getColor(R.styleable.SearchableSpinner_StartSearchTintColor, Color.GRAY); mEditViewBackgroundColor = attributes.getColor(R.styleable.SearchableSpinner_SearchViewBackgroundColor, Color.WHITE); mEditViewTextColor = attributes.getColor(R.styleable.SearchableSpinner_SearchViewTextColor, Color.BLACK); mDoneEditTintColor = attributes.getColor(R.styleable.SearchableSpinner_DoneSearchTintColor, Color.GRAY); mBordersSize = attributes.getDimensionPixelSize(R.styleable.SearchableSpinner_BordersSize, 4); mExpandSize = attributes.getDimensionPixelSize(R.styleable.SearchableSpinner_SpinnerExpandHeight, 0); mShowBorders = attributes.getBoolean(R.styleable.SearchableSpinner_ShowBorders, false); mBoarderColor = attributes.getColor(R.styleable.SearchableSpinner_BoarderColor, Color.GRAY); mAnimDuration = attributes.getColor(R.styleable.SearchableSpinner_AnimDuration, DefaultAnimationDuration); mKeepLastSearch = attributes.getBoolean(R.styleable.SearchableSpinner_KeepLastSearch, false); mRevealEmptyText = attributes.getString(R.styleable.SearchableSpinner_RevealEmptyText); mSearchHintText = attributes.getString(R.styleable.SearchableSpinner_SearchHintText); mNoItemsFoundText = attributes.getString(R.styleable.SearchableSpinner_NoItemsFoundText); mListItemDivider = attributes.getDrawable(R.styleable.SearchableSpinner_ItemsDivider); mListDividerSize = attributes.getDimensionPixelSize(R.styleable.SearchableSpinner_DividerHeight, 0); } catch (UnsupportedOperationException e) { Log.e("SearchableSpinner", "getAttributeSet --> " + e.getLocalizedMessage()); } } }
Example #4
Source File: SearchableSpinner.java From searchablespinner with Apache License 2.0 | 6 votes |
public SearchableSpinner(@NonNull Context context, @Nullable AttributeSet attrs, @AttrRes int defStyleAttr, @StyleRes int defStyleRes) { super(context, attrs, defStyleAttr, defStyleRes); mContext = context; getAttributeSet(attrs, defStyleAttr, defStyleRes); final LayoutInflater factory = LayoutInflater.from(context); factory.inflate(R.layout.view_searchable_spinner, this, true); mSpinnerListContainer = (LinearLayout) factory.inflate(R.layout.view_list, this, false); mSpinnerListView = (ListView) mSpinnerListContainer.findViewById(R.id.LstVw_SpinnerListView); if (mListItemDivider != null) { mSpinnerListView.setDivider(mListItemDivider); mSpinnerListView.setDividerHeight(mListDividerSize); } mEmptyTextView = (TextView) mSpinnerListContainer.findViewById(R.id.TxtVw_EmptyText); mSpinnerListView.setEmptyView(mEmptyTextView); }
Example #5
Source File: AbstractAlertDialog.java From DMusic with Apache License 2.0 | 6 votes |
/** * Creates a dialog window that uses a custom dialog style. * * @param context Context * @param themeResId The dialog's layout resource * @param isSetWin Set the gravity of the window * @param gravity The desired gravity constant * @param width The dialog's width * @param heith The dialog's height */ protected AbstractAlertDialog(@NonNull Context context, @StyleRes int themeResId, boolean isSetWin, int gravity, int width, int heith) { super(context, themeResId); this.mContext = context; this.mRootView = LayoutInflater.from(context).inflate(getLayoutRes(), null); setContentView(this.mRootView); setCanceledOnTouchOutside(true); setCancelable(true); if (isSetWin) { Window dialogWindow = getWindow(); if (dialogWindow != null) { dialogWindow.setWindowAnimations(-1); dialogWindow.setBackgroundDrawableResource(android.R.color.transparent); dialogWindow.getDecorView().setPadding(0, 0, 0, 0); dialogWindow.setGravity(gravity); // Get the current layout param of the dialog WindowManager.LayoutParams p = dialogWindow.getAttributes(); // Set dialog's width p.width = width; // Set dialog's height p.height = heith; dialogWindow.setAttributes(p); } } init(this.mRootView); }
Example #6
Source File: PreferenceUtil.java From RetroMusicPlayer with GNU General Public License v3.0 | 5 votes |
@StyleRes public static int getThemeResFromPrefValue(String themePrefValue) { switch (themePrefValue) { case "dark": return R.style.Theme_RetroMusic; case "black": return R.style.Theme_RetroMusic_Black; case "light": default: return R.style.Theme_RetroMusic_Light; } }
Example #7
Source File: CustomThemeModel.java From NumberPadTimePicker with Apache License 2.0 | 5 votes |
@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; } }
Example #8
Source File: CustomThemeModel.java From NumberPadTimePicker with Apache License 2.0 | 5 votes |
@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; } }
Example #9
Source File: SceneContextThemeWrapper.java From scene with Apache License 2.0 | 5 votes |
@Override public void setTheme(@StyleRes int resid) { if (mThemeResource != resid) { mThemeResource = resid; if (mIsThemeFromActivity) { //reset mTheme = null; mResources = null; } initializeTheme(); } }
Example #10
Source File: ThemeHelper.java From OpenHub with GNU General Public License v3.0 | 5 votes |
@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; case PrefUtils.AMOLED_DARK: return R.style.ThemeAmoledDark_AboutActivity; default: return R.style.ThemeLightTeal_AboutActivity; } }
Example #11
Source File: ThemableActivity.java From andela-crypto-app with Apache License 2.0 | 5 votes |
@StyleRes protected int getThemeRes(int index) { try { return themes[index]; } catch (Exception e) { Timber.e(e); return themes[0]; } }
Example #12
Source File: NumberPadTimePickerDialog.java From NumberPadTimePicker with Apache License 2.0 | 5 votes |
public NumberPadTimePickerDialog(@NonNull Context context, @StyleRes int themeResId, @Nullable OnTimeSetListener listener, boolean is24HourMode) { super(context, resolveDialogTheme(context, themeResId)); final View root = getLayoutInflater().inflate( R.layout.nptp_alert_numberpad_time_picker_dialog, null); final NumberPadTimePicker timePicker = (NumberPadTimePicker) root.findViewById(R.id.nptp_time_picker); final NumberPadTimePickerAlertComponent timePickerComponent = (NumberPadTimePickerAlertComponent) timePicker.getComponent(); final DialogPresenter presenter = new NumberPadTimePickerDialogPresenter( this, timePicker.getPresenter()); DialogViewInitializer.setupDialogView(this, presenter, getContext(), timePicker, timePickerComponent.getOkButton(), listener, is24HourMode); timePickerComponent.getCancelButton().setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { presenter.onCancelClick(); } }); mThemer = new NumberPadTimePickerDialogThemer(timePickerComponent); mIs24HourMode = is24HourMode; // Must be requested before adding content, or get an AndroidRuntimeException! supportRequestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(root); }
Example #13
Source File: ThemeDemo.java From scene with Apache License 2.0 | 5 votes |
public static TestTheme1Scene newInstance(@StyleRes int themeId) { TestTheme1Scene scene = new TestTheme1Scene(); Bundle bundle = new Bundle(); bundle.putInt("themeId", themeId); scene.setArguments(bundle); return scene; }
Example #14
Source File: ThemeDemo.java From scene with Apache License 2.0 | 5 votes |
public static TestTheme0Scene newInstance(@StyleRes int themeId) { TestTheme0Scene scene = new TestTheme0Scene(); Bundle bundle = new Bundle(); bundle.putInt("themeId", themeId); scene.setArguments(bundle); scene.setTheme(themeId); return scene; }
Example #15
Source File: NumberPadTimePickerDialogFragment.java From NumberPadTimePicker with Apache License 2.0 | 5 votes |
public static NumberPadTimePickerDialogFragment newInstance(OnTimeSetListener listener, @DialogMode int dialogMode, @StyleRes int themeResId, boolean customTheme) { NumberPadTimePickerDialogFragment f = new NumberPadTimePickerDialogFragment(); Bundle args = new Bundle(); args.putInt(KEY_THEME_RES_ID, themeResId); args.putInt(KEY_DIALOG_MODE, dialogMode); args.putBoolean(KEY_CUSTOM_THEME, customTheme); f.setArguments(args); f.listener = listener; return f; }
Example #16
Source File: Luhn.java From Luhn with MIT License | 5 votes |
public static void startLuhn(Context context, LuhnCallback luhnCallback, Bundle cardIOBundle, @StyleRes int style) { sLuhnCallback = luhnCallback; context.startActivity(new Intent(context, Luhn.class) .putExtra(STYLE_KEY, style) .putExtra(CARD_IO, cardIOBundle) ); }
Example #17
Source File: SkinMaterialTextInputLayout.java From Android-skin-support with MIT License | 5 votes |
private void loadErrorTextColorResFromAttributes(@StyleRes int resId) { if (resId != INVALID_ID) { TypedArray errorTA = getContext().obtainStyledAttributes(resId, skin.support.R.styleable.SkinTextAppearance); if (errorTA.hasValue(skin.support.R.styleable.SkinTextAppearance_android_textColor)) { mErrorTextColorResId = errorTA.getResourceId(skin.support.R.styleable.SkinTextAppearance_android_textColor, INVALID_ID); } errorTA.recycle(); } applyErrorTextColorResource(); }
Example #18
Source File: ExpandableButtonView.java From Expandable-Action-Button with MIT License | 5 votes |
@TargetApi(Build.VERSION_CODES.LOLLIPOP) public ExpandableButtonView(@NonNull Context context, @Nullable AttributeSet attrs, @AttrRes int defStyleAttr, @StyleRes int defStyleRes) { super(context, attrs, defStyleAttr, defStyleRes); init(context); initAttrs(attrs); }
Example #19
Source File: TransparentActivity.java From andela-crypto-app with Apache License 2.0 | 5 votes |
@StyleRes protected int getThemeRes(int index) { try { return themes[index]; } catch (Exception e) { Timber.e(e); return themes[0]; } }
Example #20
Source File: HoldingButtonLayout.java From HoldingButton with Apache License 2.0 | 5 votes |
@TargetApi(Build.VERSION_CODES.LOLLIPOP) public HoldingButtonLayout(@NonNull Context context, @Nullable AttributeSet attrs, @AttrRes int defStyleAttr, @StyleRes int defStyleRes) { super(context, attrs, defStyleAttr, defStyleRes); init(context, attrs, defStyleAttr, defStyleRes); }
Example #21
Source File: SkinMaterialNavigationView.java From Android-skin-support with MIT License | 5 votes |
@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(); } }
Example #22
Source File: ItemPickerViewAlertDialog.java From Companion-For-PUBG-Android with MIT License | 5 votes |
protected ItemPickerViewAlertDialog(@NonNull final Context context, @StyleRes final int themeResId, @NonNull final ViewGroup parent, @NonNull final Listener listener) { super(context, themeResId); final View view = LayoutInflater.from(context).inflate(R.layout.alert_dialog_item_picker_view, parent, false); setView(view); this.listener = listener; this.adapter = new ItemRecyclerViewAdapter<>(); this.recyclerView = (RecyclerView) view.findViewById(R.id.alert_dialog_item_picker_view_recycler); init(); }
Example #23
Source File: PreferenceUtil.java From Orin with GNU General Public License v3.0 | 5 votes |
@StyleRes public static int getThemeResFromPrefValue(String themePrefValue) { switch (themePrefValue) { case "dark": return R.style.Theme_Phonograph; case "black": return R.style.Theme_Phonograph_Black; case "light": default: return R.style.Theme_Phonograph_Light; } }
Example #24
Source File: GlobalSetting.java From AlbumCameraRecorder with MIT License | 4 votes |
@Override public GlobalSetting theme(@StyleRes int themeId) { mGlobalSpec.themeId = themeId; return this; }
Example #25
Source File: ChipWidget.java From relight with Apache License 2.0 | 4 votes |
public ChipWidget textAppearanceResource(@StyleRes int id) { view.setTextAppearanceResource(id); return self(); }
Example #26
Source File: ShowDialog.java From PocketEOS-Android with GNU Lesser General Public License v3.0 | 4 votes |
public ShowDialog(@NonNull Context context, @StyleRes int themeResId) { super(context, themeResId); }
Example #27
Source File: ToolbarEx.java From SimpleProject with MIT License | 4 votes |
/** * 设置右边TextVIew的文字样式 * @param styleId * @return */ public ToolbarEx setRightTextAppearance(@StyleRes int styleId) { initRightText(false); setTextStyle(rightText, styleId); return this; }
Example #28
Source File: LoadErrorView.java From FriendBook with GNU General Public License v3.0 | 4 votes |
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP) public LoadErrorView(@NonNull Context context, @Nullable AttributeSet attrs, @AttrRes int defStyleAttr, @StyleRes int defStyleRes) { super(context, attrs, defStyleAttr, defStyleRes); inflateView(context, context.obtainStyledAttributes(attrs, R.styleable.LoadErrorView, defStyleAttr, defStyleRes)); }
Example #29
Source File: ToolbarEx.java From SimpleProject with MIT License | 4 votes |
/** * 设置左边TextView的文字样式 * @param styleId * @return */ public ToolbarEx setLeftTextAppearance(@StyleRes int styleId) { initLeftText(false); setTextStyle(leftText, styleId); return this; }
Example #30
Source File: ToolbarEx.java From SimpleProject with MIT License | 4 votes |
/** * 设置标题样式 * @param styleId * @return */ public ToolbarEx setTitleTextAppearance(@StyleRes int styleId) { initTitleText(false); setTextStyle(titleText, styleId); return this; }