List of usage examples for android.content.res Resources getBoolean
public boolean getBoolean(@BoolRes int id) throws NotFoundException
From source file:yang.mobile.widget.viewpager.LoopPageIndicator.java
public LoopPageIndicator(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); if (isInEditMode()) return;/*from w ww.j av a 2 s .c om*/ //Load defaults from resources final Resources res = getResources(); final int defaultPageColor = res.getColor(R.color.default_circle_indicator_page_color); final int defaultFillColor = res.getColor(R.color.default_circle_indicator_fill_color); final int defaultOrientation = res.getInteger(R.integer.default_circle_indicator_orientation); final float defaultStrokeWidth = res.getDimension(R.dimen.default_circle_indicator_stroke_width); stokenWidth = defaultStrokeWidth; final float defaultRadius = res.getDimension(R.dimen.default_circle_indicator_radius); final boolean defaultCentered = res.getBoolean(R.bool.default_circle_indicator_centered); final boolean defaultSnap = res.getBoolean(R.bool.default_circle_indicator_snap); //Retrieve styles attributes TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.CirclePageIndicator, defStyle, 0); mCentered = a.getBoolean(R.styleable.CirclePageIndicator_centered, defaultCentered); mOrientation = a.getInt(R.styleable.CirclePageIndicator_android_orientation, defaultOrientation); mPaintPageFill.setStyle(Style.FILL); mPaintPageFill.setColor(a.getColor(R.styleable.CirclePageIndicator_pageColor, defaultPageColor)); stokenWidth = a.getDimension(R.styleable.CirclePageIndicator_strokeWidth, defaultStrokeWidth); mPaintFill.setStyle(Style.FILL); mPaintFill.setColor(a.getColor(R.styleable.CirclePageIndicator_fillColor, defaultFillColor)); mRadius = a.getDimension(R.styleable.CirclePageIndicator_radius, defaultRadius); mSnap = a.getBoolean(R.styleable.CirclePageIndicator_snap, defaultSnap); Drawable background = a.getDrawable(R.styleable.CirclePageIndicator_android_background); if (background != null) { setBackgroundDrawable(background); } a.recycle(); final ViewConfiguration configuration = ViewConfiguration.get(context); mTouchSlop = ViewConfigurationCompat.getScaledPagingTouchSlop(configuration); }
From source file:com.sadostrich.nomansskyjournal.Views.CirclePageIndicator.java
@SuppressWarnings("deprecation") public CirclePageIndicator(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); if (isInEditMode()) return;//from w w w . jav a 2s.c om // Load defaults from resources final Resources res = getResources(); final int defaultPageColor = res.getColor(R.color.default_page_indicator_page_color); final int defaultFillColor = res.getColor(R.color.default_page_indicator_fill_color); final int defaultOrientation = res.getInteger(R.integer.default_page_indicator_orientation); final int defaultStrokeColor = res.getColor(R.color.default_page_indicator_stroke_color); final float defaultStrokeWidth = res.getDimension(R.dimen.d2); final float defaultRadius = res.getDimension(R.dimen.d5); final boolean defaultCentered = res.getBoolean(R.bool.default_page_indicator_centered); final boolean defaultSnap = res.getBoolean(R.bool.default_page_indicator_snap); // Retrieve styles attributes TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.CirclePageIndicator, defStyle, 0); mCentered = a.getBoolean(R.styleable.CirclePageIndicator_isCentered, defaultCentered); mOrientation = a.getInt(R.styleable.CirclePageIndicator_android_orientation, defaultOrientation); mPaintPageFill.setStyle(Style.FILL); mPaintPageFill.setColor(a.getColor(R.styleable.CirclePageIndicator_pageColor, defaultPageColor)); mPaintStroke.setStyle(Style.STROKE); mPaintStroke.setColor(a.getColor(R.styleable.CirclePageIndicator_strokeColor, defaultStrokeColor)); mPaintStroke .setStrokeWidth(a.getDimension(R.styleable.CirclePageIndicator_strokeWidth, defaultStrokeWidth)); mPaintFill.setStyle(Style.FILL); mPaintFill.setColor(a.getColor(R.styleable.CirclePageIndicator_fillColor, defaultFillColor)); mRadius = a.getDimension(R.styleable.CirclePageIndicator_radius, defaultRadius); mSnap = a.getBoolean(R.styleable.CirclePageIndicator_snap, defaultSnap); setBackgroundResource(a.getResourceId(R.styleable.CirclePageIndicator_android_background, 0)); a.recycle(); final ViewConfiguration configuration = ViewConfiguration.get(context); mTouchSlop = ViewConfigurationCompat.getScaledPagingTouchSlop(configuration); }
From source file:com.cyou.cma.clockscreen.widget.LinePageIndicator.java
public LinePageIndicator(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); if (isInEditMode()) return;/* w w w. j av a 2 s . c o m*/ final Resources res = getResources(); mDrawableUnselected = res.getDrawable(R.drawable.indicator_normal); mDrawableSelected = res.getDrawable(R.drawable.indicator_selected); // Load defaults from resources final int defaultSelectedColor = res.getColor(R.color.default_line_indicator_selected_color); final int defaultUnselectedColor = res.getColor(R.color.default_line_indicator_unselected_color); final float defaultLineWidth = res.getDimension(R.dimen.default_line_indicator_line_width); final float defaultGapWidth = res.getDimension(R.dimen.default_line_indicator_gap_width); final float defaultStrokeWidth = res.getDimension(R.dimen.default_line_indicator_stroke_width); final boolean defaultCentered = res.getBoolean(R.bool.default_line_indicator_centered); // Retrieve styles attributes // TypedArray a = context.obtainStyledAttributes(attrs, // R.styleable.LinePageIndicator, defStyle, 0); mCentered = defaultCentered; mLineWidth = defaultLineWidth; mGapWidth = defaultGapWidth; setStrokeWidth(defaultStrokeWidth); mPaintUnselected.setColor(defaultUnselectedColor); mPaintSelected.setColor(defaultSelectedColor); // Drawable background = a // .getDrawable(R.styleable.LinePageIndicator_android_background); // if (background != null) { // setBackgroundDrawable(background); // } // a.recycle(); final ViewConfiguration configuration = ViewConfiguration.get(context); mTouchSlop = ViewConfigurationCompat.getScaledPagingTouchSlop(configuration); }
From source file:com.valtech.androidtoolkit.view.indicator.RectPageIndicator.java
@SuppressWarnings("unused") public RectPageIndicator(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); // Load defaults from resources final Resources res = getResources(); final int defaultPageColor = res.getColor(R.color.default_circle_indicator_page_color); final int defaultFillColor = res.getColor(R.color.default_circle_indicator_fill_color); final int defaultOrientation = res.getInteger(R.integer.default_circle_indicator_orientation); final int defaultStrokeColor = res.getColor(R.color.default_circle_indicator_stroke_color); final float defaultStrokeWidth = res.getDimension(R.dimen.default_circle_indicator_stroke_width); final float defaultRadius = res.getDimension(R.dimen.default_circle_indicator_radius); final boolean defaultCentered = res.getBoolean(R.bool.default_circle_indicator_centered); final boolean defaultSnap = res.getBoolean(R.bool.default_circle_indicator_snap); // Retrieve styles attributes TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.CirclePageIndicator, defStyle, R.style.Widget_CirclePageIndicator); mCentered = a.getBoolean(R.styleable.CirclePageIndicator_centered, defaultCentered); mOrientation = a.getInt(R.styleable.CirclePageIndicator_orientation, defaultOrientation); mPaintPageFill = new Paint(Paint.ANTI_ALIAS_FLAG); mPaintPageFill.setStyle(Style.FILL); mPaintPageFill.setColor(a.getColor(R.styleable.CirclePageIndicator_pageColor, defaultPageColor)); mPaintStroke = new Paint(Paint.ANTI_ALIAS_FLAG); mPaintStroke.setStyle(Style.STROKE); mPaintStroke.setColor(Color.TRANSPARENT); mPaintStroke// ww w . ja v a2s . c o m .setStrokeWidth(a.getDimension(R.styleable.CirclePageIndicator_strokeWidth, defaultStrokeWidth)); mPaintFill = new Paint(Paint.ANTI_ALIAS_FLAG); mPaintFill.setStyle(Style.FILL); mPaintFill.setColor(getResources().getColor(R.color.header_color)); mSnap = a.getBoolean(R.styleable.CirclePageIndicator_snap, defaultSnap); a.recycle(); final ViewConfiguration configuration = ViewConfiguration.get(context); mTouchSlop = ViewConfigurationCompat.getScaledPagingTouchSlop(configuration); }
From source file:com.aksalj.viewpagerslideshow.LinePageIndicator.java
public LinePageIndicator(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); if (isInEditMode()) return;// www. j a v a 2 s . c om final Resources res = getResources(); //Load defaults from resources final int defaultLineStyle = res.getInteger(R.integer.default_line_style); final int defaultSelectedColor = res.getColor(R.color.default_line_indicator_selected_color); final int defaultUnselectedColor = res.getColor(R.color.default_line_indicator_unselected_color); final float defaultLineWidth = res.getDimension(R.dimen.default_line_indicator_line_width); final float defaultGapWidth = res.getDimension(R.dimen.default_line_indicator_gap_width); final float defaultStrokeWidth = res.getDimension(R.dimen.default_line_indicator_stroke_width); final boolean defaultCentered = res.getBoolean(R.bool.default_line_indicator_centered); //Retrieve styles attributes TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.LinePageIndicator, defStyle, 0); mBoxStyle = a.getInt(R.styleable.LinePageIndicator_lineStyle, defaultLineStyle) == 1; mCentered = a.getBoolean(R.styleable.LinePageIndicator_centered, mBoxStyle ? false : defaultCentered); mLineWidth = a.getDimension(R.styleable.LinePageIndicator_lineWidth, defaultLineWidth); mGapWidth = a.getDimension(R.styleable.LinePageIndicator_gapWidth, mBoxStyle ? 0.0f : defaultGapWidth); setStrokeWidth(a.getDimension(R.styleable.LinePageIndicator_strokeWidth, defaultStrokeWidth)); mPaintUnselected .setColor(a.getColor(R.styleable.LinePageIndicator_unselectedColor, defaultUnselectedColor)); mPaintSelected.setColor(a.getColor(R.styleable.LinePageIndicator_selectedColor, defaultSelectedColor)); Drawable background = a.getDrawable(R.styleable.LinePageIndicator_android_background); if (background != null) { setBackgroundDrawable(background); } a.recycle(); final ViewConfiguration configuration = ViewConfiguration.get(context); mTouchSlop = ViewConfigurationCompat.getScaledPagingTouchSlop(configuration); }
From source file:j2w.team.common.widget.infiniteviewpager.InfiniteCirclePageIndicator.java
public InfiniteCirclePageIndicator(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); if (isInEditMode()) return;// ww w.j av a 2 s. c o m // Load defaults from resources final Resources res = getResources(); final int defaultPageColor = res.getColor(R.color.default_circle_indicator_page_color); final int defaultFillColor = res.getColor(R.color.default_circle_indicator_fill_color); final int defaultOrientation = res.getInteger(R.integer.default_circle_indicator_orientation); final int defaultStrokeColor = res.getColor(R.color.default_circle_indicator_stroke_color); final float defaultStrokeWidth = res.getDimension(R.dimen.default_circle_indicator_stroke_width); final float defaultRadius = res.getDimension(R.dimen.default_circle_indicator_radius); final boolean defaultCentered = res.getBoolean(R.bool.default_circle_indicator_centered); final boolean defaultSnap = res.getBoolean(R.bool.default_circle_indicator_snap); // Retrieve styles attributes TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.CirclePageIndicator, defStyle, 0); mCentered = a.getBoolean(R.styleable.CirclePageIndicator_centered, defaultCentered); mOrientation = a.getInt(R.styleable.CirclePageIndicator_android_orientation, defaultOrientation); mPaintPageFill.setStyle(Style.FILL); mPaintPageFill.setColor(a.getColor(R.styleable.CirclePageIndicator_pageColor, defaultPageColor)); mPaintStroke.setStyle(Style.STROKE); mPaintStroke.setColor(a.getColor(R.styleable.CirclePageIndicator_strokeColor, defaultStrokeColor)); mPaintStroke .setStrokeWidth(a.getDimension(R.styleable.CirclePageIndicator_strokeWidth, defaultStrokeWidth)); mPaintFill.setStyle(Style.FILL); mPaintFill.setColor(a.getColor(R.styleable.CirclePageIndicator_fillColor, defaultFillColor)); mRadius = a.getDimension(R.styleable.CirclePageIndicator_radius, defaultRadius); mSnap = a.getBoolean(R.styleable.CirclePageIndicator_snap, defaultSnap); Drawable background = a.getDrawable(R.styleable.CirclePageIndicator_android_background); if (background != null) { setBackgroundDrawable(background); } a.recycle(); final ViewConfiguration configuration = ViewConfiguration.get(context); // mTouchSlop = // ViewConfigurationCompat.getScaledPagingTouchSlop(configuration); }
From source file:com.huyingbao.hyb.widgets.circleindicator.CirclePageIndicator.java
@SuppressWarnings("deprecation") public CirclePageIndicator(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); if (isInEditMode()) return;//from ww w .j a v a 2 s . co m // Load defaults from resources final Resources res = getResources(); final int defaultPageColor = res.getColor(R.color.primary_background); final int defaultFillColor = res.getColor(R.color.primary); final int defaultOrientation = res.getInteger(R.integer.default_circle_indicator_orientation); final int defaultStrokeColor = res.getColor(R.color.default_circle_indicator_stroke_color); final float defaultStrokeWidth = res.getDimension(R.dimen.default_circle_indicator_stroke_width); final float defaultRadius = res.getDimension(R.dimen.default_circle_indicator_radius); final boolean defaultCentered = res.getBoolean(R.bool.default_circle_indicator_centered); final boolean defaultSnap = res.getBoolean(R.bool.default_circle_indicator_snap); // Retrieve styles attributes TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.CirclePageIndicator, defStyle, 0); mCentered = a.getBoolean(R.styleable.CirclePageIndicator_centered, defaultCentered); mOrientation = a.getInt(R.styleable.CirclePageIndicator_android_orientation, defaultOrientation); mPaintPageFill.setStyle(Style.FILL); mPaintPageFill.setColor(a.getColor(R.styleable.CirclePageIndicator_pageColor, defaultPageColor)); mPaintStroke.setStyle(Style.STROKE); mPaintStroke.setColor(a.getColor(R.styleable.CirclePageIndicator_strokeColor, defaultStrokeColor)); mPaintStroke .setStrokeWidth(a.getDimension(R.styleable.CirclePageIndicator_strokeWidth, defaultStrokeWidth)); mPaintFill.setStyle(Style.FILL); mPaintFill.setColor(a.getColor(R.styleable.CirclePageIndicator_fillColor, defaultFillColor)); mRadius = a.getDimension(R.styleable.CirclePageIndicator_radius, defaultRadius); mSnap = a.getBoolean(R.styleable.CirclePageIndicator_snap, defaultSnap); Drawable background = a.getDrawable(R.styleable.CirclePageIndicator_android_background); if (background != null) setBackgroundDrawable(background); a.recycle(); final ViewConfiguration configuration = ViewConfiguration.get(context); mTouchSlop = ViewConfigurationCompat.getScaledPagingTouchSlop(configuration); }
From source file:com.androzic.MainActivity.java
@Override public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) { Resources resources = getResources(); if (getString(R.string.pref_exit).equals(key)) { exitConfirmation = Integer.parseInt(sharedPreferences.getString(key, "0")); initializeDrawerItems();//w w w . j a v a 2 s . c o m secondBack = false; } else if (getString(R.string.pref_hidestatusbar).equals(key)) { if (sharedPreferences.getBoolean(key, resources.getBoolean(R.bool.def_hidestatusbar))) getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); else getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN); } else if (getString(R.string.pref_orientation).equals(key)) { //noinspection ResourceType setRequestedOrientation(Integer.parseInt(sharedPreferences.getString(key, "-1"))); } }
From source file:org.smart.library.widget.CircleIndicator.java
@SuppressWarnings("deprecation") public CircleIndicator(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); if (isInEditMode()) return;/*w w w. j a v a 2s . c om*/ // Load defaults from resources final Resources res = getResources(); final int defaultPageColor = res.getColor(R.color.default_circle_indicator_page_color); final int defaultFillColor = res.getColor(R.color.default_circle_indicator_fill_color); final int defaultOrientation = res.getInteger(R.integer.default_circle_indicator_orientation); final int defaultStrokeColor = res.getColor(R.color.default_circle_indicator_stroke_color); final float defaultStrokeWidth = res.getDimension(R.dimen.default_circle_indicator_stroke_width); final float defaultRadius = res.getDimension(R.dimen.default_circle_indicator_radius); final boolean defaultCentered = res.getBoolean(R.bool.default_circle_indicator_centered); final boolean defaultSnap = res.getBoolean(R.bool.default_circle_indicator_snap); // Retrieve styles attributes TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.CircleIndicator, defStyle, 0); mCentered = a.getBoolean(R.styleable.CircleIndicator_centered, defaultCentered); mOrientation = a.getInt(R.styleable.CircleIndicator_android_orientation, defaultOrientation); mPaintPageFill.setStyle(Style.FILL); mPaintPageFill.setColor(a.getColor(R.styleable.CircleIndicator_pageColor, defaultPageColor)); mPaintStroke.setStyle(Style.STROKE); mPaintStroke.setColor(a.getColor(R.styleable.CircleIndicator_strokeColor, defaultStrokeColor)); mPaintStroke.setStrokeWidth(a.getDimension(R.styleable.CircleIndicator_strokeWidth, defaultStrokeWidth)); mPaintFill.setStyle(Style.FILL); mPaintFill.setColor(a.getColor(R.styleable.CircleIndicator_fillColor, defaultFillColor)); mRadius = a.getDimension(R.styleable.CircleIndicator_radius, defaultRadius); mSnap = a.getBoolean(R.styleable.CircleIndicator_snap, defaultSnap); Drawable background = a.getDrawable(R.styleable.CircleIndicator_android_background); if (background != null) { setBackgroundDrawable(background); } a.recycle(); final ViewConfiguration configuration = ViewConfiguration.get(context); mTouchSlop = ViewConfigurationCompat.getScaledPagingTouchSlop(configuration); }
From source file:net.hadifar.dope.ui.widget.pagerIndicator.NumericPageIndicator.java
@SuppressWarnings("deprecation") public NumericPageIndicator(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); if (isInEditMode()) { return;//from ww w . j a v a2 s. co m } // Load defaults from resources final Resources res = getResources(); final int defaultTextColor = res.getColor(R.color.default_page_number_indicator_text_color); final int defaultPageNumberTextColor = res .getColor(R.color.default_page_number_indicator_page_number_text_color); final boolean defaultPageNumberTextBold = res .getBoolean(R.bool.default_page_number_indicator_page_number_text_bold); final int defaultButtonPressedColor = res .getColor(R.color.default_page_number_indicator_pressed_button_color); final float defaultTopPadding = res.getDimension(R.dimen.default_page_number_indicator_top_padding); final float defaultBottomPadding = res.getDimension(R.dimen.default_page_number_indicator_bottom_padding); final float defaultTextSize = res.getDimension(R.dimen.default_page_number_indicator_text_size); final boolean defaultShowChangePageButtons = res .getBoolean(R.bool.default_page_number_indicator_show_change_page_buttons); final boolean defaultShowStartEndButtons = res .getBoolean(R.bool.default_page_number_indicator_show_start_end_buttons); // Retrieve styles attributes final TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.NumericPageIndicator, defStyle, 0); mTextTemplate = a.getString(R.styleable.NumericPageIndicator_textTemplate); if (mTextTemplate == null) { mTextTemplate = res.getString(R.string.default_page_number_indicator_text_template); } parseTextTemplate(); mTextPreviousButton = a.getString(R.styleable.NumericPageIndicator_previousButtonText); if (mTextPreviousButton == null) { mTextPreviousButton = res.getString(R.string.default_page_number_indicator_previous_button_text); } mTextNextButton = a.getString(R.styleable.NumericPageIndicator_nextButtonText); if (mTextNextButton == null) { mTextNextButton = res.getString(R.string.default_page_number_indicator_next_button_text); } mColorText = a.getColor(R.styleable.NumericPageIndicator_android_textColor, defaultTextColor); mColorPageNumberText = a.getColor(R.styleable.NumericPageIndicator_pageNumberTextColor, defaultPageNumberTextColor); mPageNumberTextBold = a.getBoolean(R.styleable.NumericPageIndicator_pageNumberTextBold, defaultPageNumberTextBold); mColorPressedButton = a.getColor(R.styleable.NumericPageIndicator_pressedButtonColor, defaultButtonPressedColor); mPaddingTop = a.getDimension(R.styleable.NumericPageIndicator_android_paddingTop, defaultTopPadding); mPaddingBottom = a.getDimension(R.styleable.NumericPageIndicator_android_paddingBottom, defaultBottomPadding); mPaintText.setColor(mColorText); mShowChangePageButtons = a.getBoolean(R.styleable.NumericPageIndicator_showChangePageButtons, defaultShowChangePageButtons); mShowStartEndButtons = a.getBoolean(R.styleable.NumericPageIndicator_showStartEndButtons, defaultShowStartEndButtons); mPaintButtonBackground.setColor(mColorPressedButton); final float textSize = a.getDimension(R.styleable.NumericPageIndicator_android_textSize, defaultTextSize); mPaintText.setTextSize(textSize); mPaintText.setAntiAlias(true); mPaintPageNumberText.setColor(mColorPageNumberText); mPaintPageNumberText.setTextSize(textSize); mPaintPageNumberText.setAntiAlias(true); if (mPageNumberTextBold) { mPaintPageNumberText.setTypeface(Typeface.DEFAULT_BOLD); } final Drawable background = a.getDrawable(R.styleable.NumericPageIndicator_android_background); if (background != null) { setBackgroundDrawable(background); } a.recycle(); }