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 Project: DMusic Author: Dsiner File: AbstractAlertDialog.java License: 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 Project: Common Author: Dsiner File: AbstractAlertDialog.java License: 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 #3
Source Project: graphhopper-navigation-android Author: graphhopper File: NavigationMapRoute.java License: 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 #4
Source Project: searchablespinner Author: michaelprimez File: SearchableSpinner.java License: 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 Project: searchablespinner Author: michaelprimez File: SearchableSpinner.java License: 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 #6
Source Project: scene Author: bytedance File: ThemeDemo.java License: 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 #7
Source Project: scene Author: bytedance File: ThemeDemo.java License: 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 #8
Source Project: scene Author: bytedance File: SceneContextThemeWrapper.java License: 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 #9
Source Project: andela-crypto-app Author: jumaallan File: TransparentActivity.java License: 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 #10
Source Project: Android-skin-support Author: ximsfei File: SkinMaterialNavigationView.java License: 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 #11
Source Project: RetroMusicPlayer Author: deepshooter File: PreferenceUtil.java License: 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 #12
Source Project: Luhn Author: KingsMentor File: Luhn.java License: 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 #13
Source Project: Companion-For-PUBG-Android Author: ZafraniTechLLC File: ItemPickerViewAlertDialog.java License: 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 #14
Source Project: Orin Author: aliumujib File: PreferenceUtil.java License: 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 #15
Source Project: HoldingButton Author: hluhovskyi File: HoldingButtonLayout.java License: 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 #16
Source Project: Expandable-Action-Button Author: vpaliy File: ExpandableButtonView.java License: 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 #17
Source Project: Android-skin-support Author: ximsfei File: SkinMaterialTextInputLayout.java License: 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 Project: NumberPadTimePicker Author: philliphsu File: NumberPadTimePickerDialogFragment.java License: 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 #19
Source Project: NumberPadTimePicker Author: philliphsu File: CustomThemeModel.java License: 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 #20
Source Project: NumberPadTimePicker Author: philliphsu File: CustomThemeModel.java License: 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 #21
Source Project: OpenHub Author: ThirtyDegreesRay File: ThemeHelper.java License: 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 #22
Source Project: andela-crypto-app Author: jumaallan File: ThemableActivity.java License: 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 #23
Source Project: NumberPadTimePicker Author: philliphsu File: NumberPadTimePickerDialog.java License: 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 #24
Source Project: star-zone-android Author: bootsrc File: ProgressDialog.java License: Apache License 2.0 | 4 votes |
private ProgressDialog(@NonNull Activity activity, @StyleRes int theme) { super(activity, theme); setContentView(R.layout.dialog_progress); ButterKnife.bind(this); }
Example #25
Source Project: star-zone-android Author: bootsrc File: ProgressDialogHelper.java License: Apache License 2.0 | 4 votes |
public ProgressDialogHelper(@NonNull Context context, @StyleRes int themeResId) { super(context, themeResId); }
Example #26
Source Project: scene Author: bytedance File: SceneNavigator.java License: Apache License 2.0 | 4 votes |
public SceneNavigator(@NonNull Context context, @StyleRes int themeResId) { this(context, themeResId, new ArrayList<SceneNavigationContainer>()); }
Example #27
Source Project: scene Author: bytedance File: SceneNavigator.java License: Apache License 2.0 | 4 votes |
public SceneNavigator(@NonNull Context context, @StyleRes int themeResId, @Nullable SceneNavigationContainer container) { this(context, themeResId, toList(container)); }
Example #28
Source Project: SETransitionDemo Author: mingdroid File: DismissFrameLayout.java License: Apache License 2.0 | 4 votes |
@TargetApi(21) public DismissFrameLayout(@NonNull Context context, @Nullable AttributeSet attrs, @AttrRes int defStyleAttr, @StyleRes int defStyleRes) { super(context, attrs, defStyleAttr, defStyleRes); init(); }
Example #29
Source Project: scene Author: bytedance File: BottomSheetDialogScene.java License: Apache License 2.0 | 4 votes |
public BottomSheetDialogScene(@StyleRes int theme) { this.mTheme = theme; }
Example #30
Source Project: YCAudioPlayer Author: yangchong211 File: BaseActivity.java License: Apache License 2.0 | 4 votes |
@StyleRes protected int getDarkTheme() { return R.style.AppThemeDark; }