List of usage examples for android.content.res Resources getBoolean
public boolean getBoolean(@BoolRes int id) throws NotFoundException
From source file:com.maedi.user.godok.v1.viewpagerindicator.UnderlinePageIndicator.java
@SuppressWarnings("deprecation") public UnderlinePageIndicator(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); if (isInEditMode()) return;/*from w ww . j a v a2s .co m*/ final Resources res = getResources(); //Load defaults from resources final boolean defaultFades = res .getBoolean(com.viewpagerindicator.R.bool.default_underline_indicator_fades); final int defaultFadeDelay = res .getInteger(com.viewpagerindicator.R.integer.default_underline_indicator_fade_delay); final int defaultFadeLength = res .getInteger(com.viewpagerindicator.R.integer.default_underline_indicator_fade_length); final int defaultSelectedColor = res .getColor(com.viewpagerindicator.R.color.default_underline_indicator_selected_color); //Retrieve styles attributes TypedArray a = context.obtainStyledAttributes(attrs, com.viewpagerindicator.R.styleable.UnderlinePageIndicator, defStyle, 0); setFades(a.getBoolean(com.viewpagerindicator.R.styleable.UnderlinePageIndicator_fades, defaultFades)); setSelectedColor(a.getColor(com.viewpagerindicator.R.styleable.UnderlinePageIndicator_selectedColor, defaultSelectedColor)); setFadeDelay(a.getInteger(com.viewpagerindicator.R.styleable.UnderlinePageIndicator_fadeDelay, defaultFadeDelay)); setFadeLength(a.getInteger(com.viewpagerindicator.R.styleable.UnderlinePageIndicator_fadeLength, defaultFadeLength)); Drawable background = a .getDrawable(com.viewpagerindicator.R.styleable.UnderlinePageIndicator_android_background); if (background != null) { setBackgroundDrawable(background); } a.recycle(); final ViewConfiguration configuration = ViewConfiguration.get(context); mTouchSlop = ViewConfigurationCompat.getScaledPagingTouchSlop(configuration); }
From source file:com.halloon.android.util.UnderLinePageIndicator.java
public UnderLinePageIndicator(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); if (isInEditMode()) return;//ww w. ja v a2 s . co m final Resources res = getResources(); // Load defaults from resources final boolean defaultFades = res.getBoolean(R.bool.default_underline_indicator_fades); final int defaultFadeDelay = res.getInteger(R.integer.default_underline_indicator_fade_delay); final int defaultFadeLength = res.getInteger(R.integer.default_underline_indicator_fade_length); final int defaultSelectedColor = res.getColor(R.color.default_underline_indicator_selected_color); setFades(defaultFades); setSelectedColor(defaultSelectedColor); setFadeDelay(defaultFadeDelay); setFadeLength(defaultFadeLength); final ViewConfiguration configuration = ViewConfiguration.get(context); mTouchSlop = ViewConfigurationCompat.getScaledPagingTouchSlop(configuration); }
From source file:com.android.core.view.indicator.UnderlinePageIndicator.java
public UnderlinePageIndicator(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); if (isInEditMode()) return;/* w ww. j av a 2 s . c o m*/ final Resources res = getResources(); //Load defaults from resources final boolean defaultFades = res.getBoolean(R.bool.default_underline_indicator_fades); final int defaultFadeDelay = res.getInteger(R.integer.default_underline_indicator_fade_delay); final int defaultFadeLength = res.getInteger(R.integer.default_underline_indicator_fade_length); final int defaultSelectedColor = res.getColor(R.color.default_underline_indicator_selected_color); final float defaultLineWidth = 0f; //Retrieve styles attributes TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.UnderlinePageIndicator, defStyle, 0); setFades(a.getBoolean(R.styleable.UnderlinePageIndicator_fades, defaultFades)); setSelectedColor(a.getColor(R.styleable.UnderlinePageIndicator_selectedColor, defaultSelectedColor)); setFadeDelay(a.getInteger(R.styleable.UnderlinePageIndicator_fadeDelay, defaultFadeDelay)); setFadeLength(a.getInteger(R.styleable.UnderlinePageIndicator_fadeLength, defaultFadeLength)); setLineWidth(a.getDimension(R.styleable.UnderlinePageIndicator_line_width, defaultLineWidth)); Drawable background = a.getDrawable(R.styleable.UnderlinePageIndicator_android_background); if (background != null) { setBackgroundDrawable(background); } a.recycle(); final ViewConfiguration configuration = ViewConfiguration.get(context); mTouchSlop = ViewConfigurationCompat.getScaledPagingTouchSlop(configuration); }
From source file:com.adkdevelopment.e_contact.utils.UnderlinePageIndicator.java
@TargetApi(Build.VERSION_CODES.M) public UnderlinePageIndicator(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); if (isInEditMode()) return;/*from w ww. j a v a2s. co m*/ final Resources res = getResources(); //Load defaults from resources final boolean defaultFades = res.getBoolean(R.bool.default_underline_indicator_fades); final int defaultFadeDelay = res.getInteger(R.integer.default_underline_indicator_fade_delay); final int defaultFadeLength = res.getInteger(R.integer.default_underline_indicator_fade_length); int defaultSelectedColor; if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { defaultSelectedColor = res.getColor(R.color.white, context.getTheme()); } else { //noinspection deprecation defaultSelectedColor = res.getColor(R.color.white); } //Retrieve styles attributes TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.UnderlinePageIndicator, defStyle, 0); setFades(a.getBoolean(R.styleable.UnderlinePageIndicator_fades, defaultFades)); setSelectedColor(a.getColor(R.styleable.UnderlinePageIndicator_selectedColor, defaultSelectedColor)); setFadeDelay(a.getInteger(R.styleable.UnderlinePageIndicator_fadeDelay, defaultFadeDelay)); setFadeLength(a.getInteger(R.styleable.UnderlinePageIndicator_fadeLength, defaultFadeLength)); mCornerRadius = a.getDimension(R.styleable.UnderlinePageIndicator_vpi_corner_radius, 0); Drawable background = a.getDrawable(R.styleable.UnderlinePageIndicator_android_background); if (background != null) { setBackground(background); } a.recycle(); final ViewConfiguration configuration = ViewConfiguration.get(context); mTouchSlop = ViewConfigurationCompat.getScaledPagingTouchSlop(configuration); }
From source file:com.e.common.widget.viewpager.UnderlinePageIndicator.java
public UnderlinePageIndicator(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); if (isInEditMode()) return;//ww w . j a va2 s. c o m final Resources res = getResources(); // Load defaults from resources final boolean defaultFades = res.getBoolean(R.bool.default_underline_indicator_fades); final int defaultFadeDelay = res.getInteger(R.integer.default_underline_indicator_fade_delay); final int defaultFadeLength = res.getInteger(R.integer.default_underline_indicator_fade_length); final int defaultSelectedColor = res.getColor(R.color.default_underline_indicator_selected_color); // Retrieve styles attributes TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.UnderlinePageIndicator, defStyle, 0); setFades(a.getBoolean(R.styleable.UnderlinePageIndicator_fades, defaultFades)); setSelectedColor(a.getColor(R.styleable.UnderlinePageIndicator_selectedColor, defaultSelectedColor)); setFadeDelay(a.getInteger(R.styleable.UnderlinePageIndicator_fadeDelay, defaultFadeDelay)); setFadeLength(a.getInteger(R.styleable.UnderlinePageIndicator_fadeLength, defaultFadeLength)); isRound = a.getBoolean(R.styleable.UnderlinePageIndicator_round, false); Drawable background = a.getDrawable(R.styleable.UnderlinePageIndicator_android_background); if (background != null) { setBackgroundDrawable(background); } a.recycle(); final ViewConfiguration configuration = ViewConfiguration.get(context); mTouchSlop = ViewConfigurationCompat.getScaledPagingTouchSlop(configuration); if (isRound) { mPaint.setStrokeJoin(Paint.Join.ROUND); // mPaint.setStrokeCap(Paint.Cap.ROUND); mPaint.setStyle(Paint.Style.FILL); } }
From source file:com.tandong.sa.vpic.UnderlinePageIndicator.java
public UnderlinePageIndicator(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); if (isInEditMode()) return;// ww w . j av a 2 s. c o m final Resources res = getResources(); // Load defaults from resources final boolean defaultFades = res.getBoolean(getResources() .getIdentifier("default_underline_indicator_fades", "bool", context.getPackageName())); // final boolean defaultFades = res // .getBoolean(R.bool.default_underline_indicator_fades); final int defaultFadeDelay = res.getInteger(getResources() .getIdentifier("default_underline_indicator_fade_delay", "integer", context.getPackageName())); // final int defaultFadeDelay = res // .getInteger(R.integer.default_underline_indicator_fade_delay); final int defaultFadeLength = res.getInteger(getResources() .getIdentifier("default_underline_indicator_fade_length", "integer", context.getPackageName())); // final int defaultFadeLength = res // .getInteger(R.integer.default_underline_indicator_fade_length); final int defaultSelectedColor = res.getColor(getResources() .getIdentifier("default_underline_indicator_selected_color", "color", context.getPackageName())); // final int defaultSelectedColor = res // .getColor(R.color.default_underline_indicator_selected_color); // Retrieve styles attributes TypedArray a = context.obtainStyledAttributes(attrs, new int[] { getResources().getIdentifier("UnderlinePageIndicator", "styleable", context.getPackageName()) }, defStyle, 0); // TypedArray a = context.obtainStyledAttributes(attrs, // R.styleable.UnderlinePageIndicator, defStyle, 0); setFades(a.getBoolean( getResources().getIdentifier("UnderlinePageIndicator_fades", "styleable", context.getPackageName()), defaultFades)); // setFades(a.getBoolean(R.styleable.UnderlinePageIndicator_fades, // defaultFades)); setSelectedColor(a.getColor(getResources().getIdentifier("UnderlinePageIndicator_selectedColor", "styleable", context.getPackageName()), defaultSelectedColor)); // setSelectedColor(a.getColor( // R.styleable.UnderlinePageIndicator_selectedColor, // defaultSelectedColor)); setFadeDelay(a.getInteger(getResources().getIdentifier("UnderlinePageIndicator_fadeDelay", "styleable", context.getPackageName()), defaultFadeDelay)); // setFadeDelay(a.getInteger(R.styleable.UnderlinePageIndicator_fadeDelay, // defaultFadeDelay)); setFadeLength(a.getInteger(getResources().getIdentifier("UnderlinePageIndicator_fadeLength", "styleable", context.getPackageName()), defaultFadeLength)); // setFadeLength(a.getInteger( // R.styleable.UnderlinePageIndicator_fadeLength, // defaultFadeLength)); Drawable background = a.getDrawable(getResources() .getIdentifier("UnderlinePageIndicator_android_background", "styleable", context.getPackageName())); // Drawable background = a // .getDrawable(R.styleable.UnderlinePageIndicator_android_background); if (background != null) { setBackgroundDrawable(background); } a.recycle(); final ViewConfiguration configuration = ViewConfiguration.get(context); mTouchSlop = ViewConfigurationCompat.getScaledPagingTouchSlop(configuration); }
From source file:com.viewpagerindicator.as.library.indicator.RecyclerUnderlinePageIndicator.java
public RecyclerUnderlinePageIndicator(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); if (isInEditMode()) return;// ww w . j av a 2 s .c o m final Resources res = getResources(); //Load defaults from resources final boolean defaultFades = res.getBoolean(R.bool.default_underline_indicator_fades); final int defaultFadeDelay = res.getInteger(R.integer.default_underline_indicator_fade_delay); final int defaultFadeLength = res.getInteger(R.integer.default_underline_indicator_fade_length); defaultSelectedColor = res.getColor(R.color.default_underline_indicator_selected_color); //Retrieve styles attributes TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.UnderlinePageIndicator, defStyle, 0); setFades(a.getBoolean(R.styleable.UnderlinePageIndicator_fades, defaultFades)); setSelectedColor(a.getColor(R.styleable.UnderlinePageIndicator_selectedColor, defaultSelectedColor)); setFadeDelay(a.getInteger(R.styleable.UnderlinePageIndicator_fadeDelay, defaultFadeDelay)); setFadeLength(a.getInteger(R.styleable.UnderlinePageIndicator_fadeLength, defaultFadeLength)); Drawable background = a.getDrawable(R.styleable.UnderlinePageIndicator_android_background); if (background != null) { setBackgroundDrawable(background); } a.recycle(); final ViewConfiguration configuration = ViewConfiguration.get(context); mTouchSlop = ViewConfigurationCompat.getScaledPagingTouchSlop(configuration); }
From source file:com.example.test2969mediabrowser.UnderlinePageIndicator.java
public UnderlinePageIndicator(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); if (isInEditMode()) return;/*from w w w . j a v a 2 s .c o m*/ final Resources res = getResources(); //Load defaults from resources final boolean defaultFades = res.getBoolean(R.bool.default_underline_indicator_fades); final int defaultFadeDelay = res.getInteger(R.integer.default_underline_indicator_fade_delay); final int defaultFadeLength = res.getInteger(R.integer.default_underline_indicator_fade_length); final int defaultSelectedColor = res.getColor(R.color.default_underline_indicator_selected_color); //Retrieve styles attributes TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.UnderlinePageIndicator, defStyle, 0); setFades(a.getBoolean(R.styleable.UnderlinePageIndicator_fades, defaultFades)); mColorSelected = a.getColor(R.styleable.UnderlinePageIndicator_selectedColor, defaultSelectedColor);//joe setSelectedColor(a.getColor(R.styleable.UnderlinePageIndicator_selectedColor, defaultSelectedColor)); setFadeDelay(a.getInteger(R.styleable.UnderlinePageIndicator_fadeDelay, defaultFadeDelay)); setFadeLength(a.getInteger(R.styleable.UnderlinePageIndicator_fadeLength, defaultFadeLength)); //==================joe add 20150918=============== defaultFooterLineHeight = res.getDimension(R.dimen.default_title_indicator_footer_line_height);//joe mPaintText.setTextSize(res.getDimension(R.dimen.default_title_indicator_text_size)); mPaintText.setAntiAlias(true); mPaintFooterLine.setStyle(Paint.Style.FILL_AND_STROKE); mPaintFooterLine.setStrokeWidth(defaultFooterLineHeight); mPaintFooterLine.setColor(getResources().getColor(R.color.blue_select)); //==================joe add 20150918 end=============== Drawable background = a.getDrawable(R.styleable.UnderlinePageIndicator_android_background); if (background != null) { setBackgroundDrawable(background); } a.recycle(); final ViewConfiguration configuration = ViewConfiguration.get(context); mTouchSlop = ViewConfigurationCompat.getScaledPagingTouchSlop(configuration); }
From source file:net.czlee.debatekeeper.AlertManager.java
/** * Constructor.//from ww w . ja v a 2s .com * @param debatingTimerService The instance of {@link DebatingTimerService} to which this * AlertManager relates */ public AlertManager(Service debatingTimerService) { mService = debatingTimerService; // System services mNotificationManager = (NotificationManager) debatingTimerService .getSystemService(Context.NOTIFICATION_SERVICE); mVibrator = (Vibrator) debatingTimerService.getSystemService(Context.VIBRATOR_SERVICE); mPowerManager = (PowerManager) mService.getSystemService(Context.POWER_SERVICE); // Create a PendingIntent for the notification we raise while the timer is running. Intent intent = new Intent(debatingTimerService, DebatingActivity.class); // This flag prevents the activity from having multiple instances on the back stack, // so that when the user presses the notification while already in Debatekeeper, pressing // back won't make the user go through several instances of Debatekeeper on the back stack. intent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP); mIntentForOngoingNotification = PendingIntent.getActivity(debatingTimerService, 0, intent, 0); // Set up defaults Resources res = mService.getResources(); mSilentMode = res.getBoolean(R.bool.prefDefault_silentMode); mVibrateMode = res.getBoolean(R.bool.prefDefault_vibrateMode); createWakeLock(); }
From source file:fr.tvbarthel.apps.simpleweatherforcast.MainActivity.java
private void initRootPadding() { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { final Resources resources = getResources(); final boolean isPortrait = resources.getBoolean(R.bool.is_portrait); final ActionBar actionBar = getSupportActionBar(); final ViewTreeObserver vto = mRootView.getViewTreeObserver(); if (vto.isAlive()) { vto.addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() { @Override/*from w ww.j av a 2s . c o m*/ public boolean onPreDraw() { mRootView.getViewTreeObserver().removeOnPreDrawListener(this); int paddingBottom = mRootView.getPaddingBottom(); int paddingTop = mRootView.getPaddingTop(); int paddingRight = mRootView.getPaddingRight(); int paddingLeft = mRootView.getPaddingLeft(); // Add the status bar height to the top padding. int resourceId = resources.getIdentifier("status_bar_height", "dimen", "android"); if (resourceId > 0) { paddingTop += resources.getDimensionPixelSize(resourceId); } if (isPortrait) { // Add the navigation bar height to the bottom padding. resourceId = resources.getIdentifier("navigation_bar_height", "dimen", "android"); if (resourceId > 0) { paddingBottom += resources.getDimensionPixelSize(resourceId); } } else { // Add the navigation bar width to the right padding. resourceId = resources.getIdentifier("navigation_bar_width", "dimen", "android"); if (resourceId > 0) { paddingRight += resources.getDimensionPixelSize(resourceId); } } mRootView.setPadding(paddingLeft, paddingTop, paddingRight, paddingBottom); return true; } }); } } }