List of usage examples for android.graphics Color argb
@ColorInt public static int argb(float alpha, float red, float green, float blue)
From source file:eu.faircode.netguard.AdapterRule.java
public AdapterRule(Activity context) { SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); this.context = context; if (prefs.getBoolean("dark_theme", false)) colorChanged = Color.argb(128, Color.red(Color.DKGRAY), Color.green(Color.DKGRAY), Color.blue(Color.DKGRAY)); else//w ww. j a va2 s. c o m colorChanged = Color.argb(128, Color.red(Color.LTGRAY), Color.green(Color.LTGRAY), Color.blue(Color.LTGRAY)); TypedArray ta = context.getTheme().obtainStyledAttributes(new int[] { android.R.attr.textColorSecondary }); try { colorText = ta.getColor(0, 0); } finally { ta.recycle(); } TypedValue tv = new TypedValue(); context.getTheme().resolveAttribute(R.attr.colorOn, tv, true); colorOn = tv.data; context.getTheme().resolveAttribute(R.attr.colorOff, tv, true); colorOff = tv.data; colorGrayed = ContextCompat.getColor(context, R.color.colorGrayed); iconSize = Util.dips2pixels(48, context); }
From source file:org.floens.chan.controller.ui.NavigationControllerContainerLayout.java
@Override protected void dispatchDraw(Canvas canvas) { super.dispatchDraw(canvas); if (tracking) { float alpha = Math.min(1f, Math.max(0f, SHADOW_MIN_ALPHA - (shadowPosition / (float) getWidth()) * SHADOW_MIN_ALPHA)); shadowPaint.setColor(Color.argb((int) (alpha * 255f), 0, 0, 0)); shadowRect.set(0, 0, shadowPosition, getHeight()); canvas.drawRect(shadowRect, shadowPaint); }/*from w w w. j av a 2 s . com*/ }
From source file:com.xiaosu.lib.base.widget.PagerSlidingTabStrip.java
public PagerSlidingTabStrip(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); setFillViewport(true);//w w w . j a v a2 s . c o m setWillNotDraw(false); mTabsContainer = new LinearLayout(context); mTabsContainer.setOrientation(LinearLayout.HORIZONTAL); addView(mTabsContainer); mRectPaint = new Paint(); mRectPaint.setAntiAlias(true); mRectPaint.setStyle(Style.FILL); DisplayMetrics dm = getResources().getDisplayMetrics(); mScrollOffset = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, mScrollOffset, dm); mIndicatorHeight = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, mIndicatorHeight, dm); mUnderlineHeight = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, mUnderlineHeight, dm); mDividerPadding = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, mDividerPadding, dm); mTabPadding = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, mTabPadding, dm); mDividerWidth = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, mDividerWidth, dm); mTabTextSize = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, mTabTextSize, dm); mDividerPaint = new Paint(); mDividerPaint.setAntiAlias(true); mDividerPaint.setStrokeWidth(mDividerWidth); // get system attrs for container TypedArray a = context.obtainStyledAttributes(attrs, ANDROID_ATTRS); int textPrimaryColor = a.getColor(TEXT_COLOR_PRIMARY, getResources().getColor(android.R.color.black)); mUnderlineColor = textPrimaryColor; mDividerColor = textPrimaryColor; int padding = a.getDimensionPixelSize(PADDING_INDEX, 0); mPaddingLeft = padding > 0 ? padding : a.getDimensionPixelSize(PADDING_LEFT_INDEX, 0); mPaddingRight = padding > 0 ? padding : a.getDimensionPixelSize(PADDING_RIGHT_INDEX, 0); a.recycle(); String tabTextTypefaceName = "sans-serif"; // Use Roboto Medium as the default typeface from API 21 onwards if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { tabTextTypefaceName = "sans-serif-medium"; mTabTextTypefaceStyle = Typeface.NORMAL; } // get custom attrs for tabs and container a = context.obtainStyledAttributes(attrs, R.styleable.PagerSlidingTabStrip); mIndicatorColor = a.getColor(R.styleable.PagerSlidingTabStrip_pstsIndicatorColor, 0xFF00CFA5); mIndicatorHeight = a.getDimensionPixelSize(R.styleable.PagerSlidingTabStrip_pstsIndicatorHeight, mIndicatorHeight); mIndicatorPadding = a.getDimensionPixelSize(R.styleable.PagerSlidingTabStrip_pstsIndicatorPadding, mIndicatorPadding); mUnderlineColor = a.getColor(R.styleable.PagerSlidingTabStrip_pstsUnderlineColor, mUnderlineColor); mUnderlineHeight = a.getDimensionPixelSize(R.styleable.PagerSlidingTabStrip_pstsUnderlineHeight, mUnderlineHeight); mDividerColor = a.getColor(R.styleable.PagerSlidingTabStrip_pstsDividerColor, mDividerColor); mDividerWidth = a.getDimensionPixelSize(R.styleable.PagerSlidingTabStrip_pstsDividerWidth, mDividerWidth); mDividerPadding = a.getDimensionPixelSize(R.styleable.PagerSlidingTabStrip_pstsDividerPadding, mDividerPadding); isExpandTabs = a.getBoolean(R.styleable.PagerSlidingTabStrip_pstsShouldExpand, isExpandTabs); mScrollOffset = a.getDimensionPixelSize(R.styleable.PagerSlidingTabStrip_pstsScrollOffset, mScrollOffset); isPaddingMiddle = a.getBoolean(R.styleable.PagerSlidingTabStrip_pstsPaddingMiddle, isPaddingMiddle); mTabPadding = a.getDimensionPixelSize(R.styleable.PagerSlidingTabStrip_pstsTabPaddingLeftRight, mTabPadding); mTabBackgroundResId = a.getResourceId(R.styleable.PagerSlidingTabStrip_pstsTabBackground, mTabBackgroundResId); mTabTextSize = a.getDimensionPixelSize(R.styleable.PagerSlidingTabStrip_pstsTabTextSize, (int) (getResources().getDisplayMetrics().density * 14)); mTabTextColor = a.hasValue(R.styleable.PagerSlidingTabStrip_pstsTabTextColor) ? a.getColorStateList(R.styleable.PagerSlidingTabStrip_pstsTabTextColor) : createColorStateList(0xFF00CFA5, 0xFF00CFA5, Color.BLACK); mTabTextTypefaceStyle = a.getInt(R.styleable.PagerSlidingTabStrip_pstsTabTextStyle, mTabTextTypefaceStyle); isTabTextAllCaps = a.getBoolean(R.styleable.PagerSlidingTabStrip_pstsTabTextAllCaps, isTabTextAllCaps); int tabTextAlpha = a.getInt(R.styleable.PagerSlidingTabStrip_pstsTabTextAlpha, DEF_VALUE_TAB_TEXT_ALPHA); String fontFamily = a.getString(R.styleable.PagerSlidingTabStrip_pstsTabTextFontFamily); a.recycle(); //Tab text color selector if (mTabTextColor == null) { mTabTextColor = createColorStateList(textPrimaryColor, textPrimaryColor, Color.argb(tabTextAlpha, Color.red(textPrimaryColor), Color.green(textPrimaryColor), Color.blue(textPrimaryColor))); } //Tab text typeface and style if (fontFamily != null) { tabTextTypefaceName = fontFamily; } mTabTextTypeface = Typeface.create(tabTextTypefaceName, mTabTextTypefaceStyle); //Bottom padding for the tabs container parent view to show indicator and underline setTabsContainerParentViewPaddings(); //Configure tab's container LayoutParams for either equal divided space or just wrap tabs mTabLayoutParams = isExpandTabs ? new LinearLayout.LayoutParams(0, LayoutParams.MATCH_PARENT, 1.0f) : new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT); }
From source file:org.deviceconnect.android.deviceplugin.hitoe.fragment.HitoeProfileDeviceOrientationFragment.java
/** * Build chart's renderer.//w w w . jav a 2s . c o m * @return chart renderer */ private XYMultipleSeriesRenderer buildRenderer() { XYMultipleSeriesRenderer renderer = new XYMultipleSeriesRenderer(); for (int i = 0; i < DATA_COUNT; i++) { XYSeriesRenderer r = new XYSeriesRenderer(); r.setColor(COLORS[i]); r.setLineWidth(4f); r.setPointStyle(PointStyle.CIRCLE); r.setFillPoints(true); r.setPointStrokeWidth(1f); renderer.addSeriesRenderer(r); } renderer.setPointSize(1f); renderer.setChartTitle(""); renderer.setChartTitleTextSize(CHART_TITLE_SIZE); renderer.setXTitle("? [ms]"); renderer.setYTitle(" [G]"); renderer.setLabelsTextSize(LABELS_SIZE); renderer.setLabelsColor(TITLE_COLOR); renderer.setXLabelsAlign(Paint.Align.LEFT); renderer.setYLabelsAlign(Paint.Align.RIGHT); renderer.setXLabelsColor(XLABEL_COLOR); renderer.setYLabelsColor(0, YLABEL_COLOR); renderer.setAxisTitleTextSize(AXIS_TITLE_SIZE); renderer.setAxesColor(AXIS_COLOR); renderer.setXAxisMin(mMinX); renderer.setXAxisMax(mMaxX); renderer.setYAxisMin(-3.0); renderer.setYAxisMax(3.0); renderer.setShowGridX(true); renderer.setShowGridY(true); renderer.setGridColor(GRID_COLOR); renderer.setApplyBackgroundColor(true); renderer.setBackgroundColor(Color.WHITE); renderer.setMargins(new int[] { 16, 48, 16, 8 }); renderer.setMarginsColor(Color.argb(0, 255, 255, 255)); renderer.setPanEnabled(false, false); renderer.setShowLegend(true); renderer.setLegendTextSize(15); renderer.setFitLegend(false); renderer.setZoomButtonsVisible(false); renderer.setZoomEnabled(false, false); return renderer; }
From source file:com.github.shareme.gwspagerslidingtabstrip.library.PagerSlidingTabStrip.java
@SuppressWarnings("deprecation") public PagerSlidingTabStrip(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); setFillViewport(true);/*w w w .j a va 2s . c om*/ setWillNotDraw(false); mTabsContainer = new LinearLayout(context); mTabsContainer.setOrientation(LinearLayout.HORIZONTAL); addView(mTabsContainer); mRectPaint = new Paint(); mRectPaint.setAntiAlias(true); mRectPaint.setStyle(Style.FILL); DisplayMetrics dm = getResources().getDisplayMetrics(); mScrollOffset = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, mScrollOffset, dm); mIndicatorHeight = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, mIndicatorHeight, dm); mUnderlineHeight = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, mUnderlineHeight, dm); mDividerPadding = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, mDividerPadding, dm); mTabPadding = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, mTabPadding, dm); mDividerWidth = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, mDividerWidth, dm); mTabTextSize = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, mTabTextSize, dm); mDividerPaint = new Paint(); mDividerPaint.setAntiAlias(true); mDividerPaint.setStrokeWidth(mDividerWidth); // get system attrs for container TypedArray a = context.obtainStyledAttributes(attrs, ANDROID_ATTRS); //TODO: getColor(int) depreciated fix int textPrimaryColor = a.getColor(TEXT_COLOR_PRIMARY, getResources().getColor(android.R.color.black)); mUnderlineColor = textPrimaryColor; mDividerColor = textPrimaryColor; mIndicatorColor = textPrimaryColor; int padding = a.getDimensionPixelSize(PADDING_INDEX, 0); mPaddingLeft = padding > 0 ? padding : a.getDimensionPixelSize(PADDING_LEFT_INDEX, 0); mPaddingRight = padding > 0 ? padding : a.getDimensionPixelSize(PADDING_RIGHT_INDEX, 0); a.recycle(); String tabTextTypefaceName = "sans-serif"; // Use Roboto Medium as the default typeface from API 21 onwards if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { tabTextTypefaceName = "sans-serif-medium"; mTabTextTypefaceStyle = Typeface.NORMAL; } // get custom attrs for tabs and container a = context.obtainStyledAttributes(attrs, R.styleable.PagerSlidingTabStrip); mIndicatorColor = a.getColor(R.styleable.PagerSlidingTabStrip_pstsIndicatorColor, mIndicatorColor); mIndicatorHeight = a.getDimensionPixelSize(R.styleable.PagerSlidingTabStrip_pstsIndicatorHeight, mIndicatorHeight); mUnderlineColor = a.getColor(R.styleable.PagerSlidingTabStrip_pstsUnderlineColor, mUnderlineColor); mUnderlineHeight = a.getDimensionPixelSize(R.styleable.PagerSlidingTabStrip_pstsUnderlineHeight, mUnderlineHeight); mDividerColor = a.getColor(R.styleable.PagerSlidingTabStrip_pstsDividerColor, mDividerColor); mDividerWidth = a.getDimensionPixelSize(R.styleable.PagerSlidingTabStrip_pstsDividerWidth, mDividerWidth); mDividerPadding = a.getDimensionPixelSize(R.styleable.PagerSlidingTabStrip_pstsDividerPadding, mDividerPadding); isExpandTabs = a.getBoolean(R.styleable.PagerSlidingTabStrip_pstsShouldExpand, isExpandTabs); mScrollOffset = a.getDimensionPixelSize(R.styleable.PagerSlidingTabStrip_pstsScrollOffset, mScrollOffset); isPaddingMiddle = a.getBoolean(R.styleable.PagerSlidingTabStrip_pstsPaddingMiddle, isPaddingMiddle); mTabPadding = a.getDimensionPixelSize(R.styleable.PagerSlidingTabStrip_pstsTabPaddingLeftRight, mTabPadding); mTabBackgroundResId = a.getResourceId(R.styleable.PagerSlidingTabStrip_pstsTabBackground, mTabBackgroundResId); mTabTextSize = a.getDimensionPixelSize(R.styleable.PagerSlidingTabStrip_pstsTabTextSize, mTabTextSize); mTabTextColor = a.hasValue(R.styleable.PagerSlidingTabStrip_pstsTabTextColor) ? a.getColorStateList(R.styleable.PagerSlidingTabStrip_pstsTabTextColor) : null; mTabTextTypefaceStyle = a.getInt(R.styleable.PagerSlidingTabStrip_pstsTabTextStyle, mTabTextTypefaceStyle); isTabTextAllCaps = a.getBoolean(R.styleable.PagerSlidingTabStrip_pstsTabTextAllCaps, isTabTextAllCaps); int tabTextAlpha = a.getInt(R.styleable.PagerSlidingTabStrip_pstsTabTextAlpha, DEF_VALUE_TAB_TEXT_ALPHA); String fontFamily = a.getString(R.styleable.PagerSlidingTabStrip_pstsTabTextFontFamily); a.recycle(); //Tab text color selector if (mTabTextColor == null) { mTabTextColor = createColorStateList(textPrimaryColor, textPrimaryColor, Color.argb(tabTextAlpha, Color.red(textPrimaryColor), Color.green(textPrimaryColor), Color.blue(textPrimaryColor))); } //Tab text typeface and style if (fontFamily != null) { tabTextTypefaceName = fontFamily; } mTabTextTypeface = Typeface.create(tabTextTypefaceName, mTabTextTypefaceStyle); //Bottom padding for the tabs container parent view to show indicator and underline setTabsContainerParentViewPaddings(); //Configure tab's container LayoutParams for either equal divided space or just wrap tabs mTabLayoutParams = isExpandTabs ? new LinearLayout.LayoutParams(0, LayoutParams.MATCH_PARENT, 1.0f) : new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT); }
From source file:com.tsroad.map.SetFenceActivity.java
private void SetUpMap2() { ArrayList<BitmapDescriptor> giflist = new ArrayList<BitmapDescriptor>(); giflist.add(BitmapDescriptorFactory.fromResource(R.drawable.point1)); giflist.add(BitmapDescriptorFactory.fromResource(R.drawable.point2)); giflist.add(BitmapDescriptorFactory.fromResource(R.drawable.point3)); giflist.add(BitmapDescriptorFactory.fromResource(R.drawable.point4)); giflist.add(BitmapDescriptorFactory.fromResource(R.drawable.point5)); // giflist.add(BitmapDescriptorFactory.fromResource(R.drawable.point6)); marker = mapView.getMap().addMarker(new MarkerOptions().anchor(0.5f, 0.5f).icons(giflist).period(50)); // ???/* w w w . j ava 2 s .c om*/ MyLocationStyle myLocationStyle = new MyLocationStyle(); // myLocationStyle.myLocationIcon(BitmapDescriptorFactory // .fromResource(R.drawable.location_marker));// ?? myLocationStyle.strokeColor(Color.BLACK);// myLocationStyle.radiusFillColor(Color.argb(100, 0, 0, 180));// // myLocationStyle.anchor(int,int)//?? myLocationStyle.strokeWidth(0.1f);// aMap.setMyLocationStyle(myLocationStyle); // aMap.setMyLocationRotateAngle(180); aMap.getUiSettings().setCompassEnabled(true);// ?? }
From source file:com.bei.test.view.tab.PagerSlidingTabStrip.java
public PagerSlidingTabStrip(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); setFillViewport(true);//from ww w .j a va 2 s . c o m setWillNotDraw(false); mTabsContainer = new LinearLayout(context); mTabsContainer.setOrientation(LinearLayout.HORIZONTAL); addView(mTabsContainer); mRectPaint = new Paint(); mRectPaint.setAntiAlias(true); mRectPaint.setStyle(Style.FILL); DisplayMetrics dm = getResources().getDisplayMetrics(); mScrollOffset = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, mScrollOffset, dm); mIndicatorHeight = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, mIndicatorHeight, dm); mUnderlineHeight = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, mUnderlineHeight, dm); mDividerPadding = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, mDividerPadding, dm); mTabPadding = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, mTabPadding, dm); mDividerWidth = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, mDividerWidth, dm); mTabNormalTextSize = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, mTabNormalTextSize, dm); mTabSelectTextSize = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, mTabSelectTextSize, dm); mDividerPaint = new Paint(); mDividerPaint.setAntiAlias(true); mDividerPaint.setStrokeWidth(mDividerWidth); // get system attrs for container TypedArray a = context.obtainStyledAttributes(attrs, ANDROID_ATTRS); int textPrimaryColor = a.getColor(TEXT_COLOR_PRIMARY, getResources().getColor(android.R.color.black)); mUnderlineColor = textPrimaryColor; mDividerColor = textPrimaryColor; mIndicatorColor = textPrimaryColor; int padding = a.getDimensionPixelSize(PADDING_INDEX, 0); mPaddingLeft = padding > 0 ? padding : a.getDimensionPixelSize(PADDING_LEFT_INDEX, 0); mPaddingRight = padding > 0 ? padding : a.getDimensionPixelSize(PADDING_RIGHT_INDEX, 0); a.recycle(); String tabTextTypefaceName = "sans-serif"; // Use Roboto Medium as the default typeface from API 21 onwards if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { tabTextTypefaceName = "sans-serif-medium"; mTabTextTypefaceStyle = Typeface.NORMAL; } // get custom attrs for tabs and container a = context.obtainStyledAttributes(attrs, R.styleable.PagerSlidingTabStrip); mIndicatorColor = a.getColor(R.styleable.PagerSlidingTabStrip_pstsIndicatorColor, mIndicatorColor); mIndicatorHeight = a.getDimensionPixelSize(R.styleable.PagerSlidingTabStrip_pstsIndicatorHeight, mIndicatorHeight); mUnderlineColor = a.getColor(R.styleable.PagerSlidingTabStrip_pstsUnderlineColor, mUnderlineColor); mUnderlineHeight = a.getDimensionPixelSize(R.styleable.PagerSlidingTabStrip_pstsUnderlineHeight, mUnderlineHeight); mDividerColor = a.getColor(R.styleable.PagerSlidingTabStrip_pstsDividerColor, mDividerColor); mDividerWidth = a.getDimensionPixelSize(R.styleable.PagerSlidingTabStrip_pstsDividerWidth, mDividerWidth); mDividerPadding = a.getDimensionPixelSize(R.styleable.PagerSlidingTabStrip_pstsDividerPadding, mDividerPadding); isExpandTabs = a.getBoolean(R.styleable.PagerSlidingTabStrip_pstsShouldExpand, isExpandTabs); mScrollOffset = a.getDimensionPixelSize(R.styleable.PagerSlidingTabStrip_pstsScrollOffset, mScrollOffset); isPaddingMiddle = a.getBoolean(R.styleable.PagerSlidingTabStrip_pstsPaddingMiddle, isPaddingMiddle); mTabPadding = a.getDimensionPixelSize(R.styleable.PagerSlidingTabStrip_pstsTabPaddingLeftRight, mTabPadding); mTabBackgroundResId = a.getResourceId(R.styleable.PagerSlidingTabStrip_pstsTabBackground, mTabBackgroundResId); mTabNormalTextSize = a.getDimensionPixelSize(R.styleable.PagerSlidingTabStrip_pstsTabNormalTextSize, mTabNormalTextSize); mTabSelectTextSize = a.getDimensionPixelSize(R.styleable.PagerSlidingTabStrip_pstsTabSelectTextSize, mTabSelectTextSize); mTabTextColor = a.hasValue(R.styleable.PagerSlidingTabStrip_pstsTabTextColor) ? a.getColorStateList(R.styleable.PagerSlidingTabStrip_pstsTabTextColor) : null; mTabTextTypefaceStyle = a.getInt(R.styleable.PagerSlidingTabStrip_pstsTabTextStyle, mTabTextTypefaceStyle); isTabTextAllCaps = a.getBoolean(R.styleable.PagerSlidingTabStrip_pstsTabTextAllCaps, isTabTextAllCaps); int tabTextAlpha = a.getInt(R.styleable.PagerSlidingTabStrip_pstsTabTextAlpha, DEF_VALUE_TAB_TEXT_ALPHA); String fontFamily = a.getString(R.styleable.PagerSlidingTabStrip_pstsTabTextFontFamily); a.recycle(); //Tab text color selector if (mTabTextColor == null) { mTabTextColor = createColorStateList(textPrimaryColor, textPrimaryColor, Color.argb(tabTextAlpha, Color.red(textPrimaryColor), Color.green(textPrimaryColor), Color.blue(textPrimaryColor))); } //Tab text typeface and style if (fontFamily != null) { tabTextTypefaceName = fontFamily; } mTabTextTypeface = Typeface.create(tabTextTypefaceName, mTabTextTypefaceStyle); //Bottom padding for the tabs container parent view to show indicator and underline setTabsContainerParentViewPaddings(); //Configure tab's container LayoutParams for either equal divided space or just wrap tabs mTabLayoutParams = isExpandTabs ? new LinearLayout.LayoutParams(0, LayoutParams.MATCH_PARENT, 1.0f) : new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT); }
From source file:edu.htl3r.schoolplanner.gui.timetable.ViewPagerIndicator.java
/** * Fade "currently showing" color depending on it's position * //w w w. jav a2 s. c om * @param offset */ void updateColor(int offset) { offset = Math.abs(offset); float fraction = offset / ((float) this.getWidth() / 4.0f); fraction = Math.min(1, fraction); int r = (int) (mUnfocusedTextColor[0] * fraction + mFocusedTextColor[0] * (1 - fraction)); int g = (int) (mUnfocusedTextColor[1] * fraction + mFocusedTextColor[1] * (1 - fraction)); int b = (int) (mUnfocusedTextColor[2] * fraction + mFocusedTextColor[2] * (1 - fraction)); mCurrent.setTextColor(Color.argb(255, r, g, b)); }
From source file:jp.morihirosoft.twwb.TwwbService.java
private void blockScreen() { if (DEBUG)//from w ww . jav a2 s .c o m Log.d(TAG, "blockScreen"); if (mBlockScreen == null) { if (mIsCalling) { return; } if (SystemClock.uptimeMillis() - mStartTime < mSettings.getPending() * 1000) { return; } mBlockScreen = LayoutInflater.from(this).inflate(R.layout.view_block, null); int alpha = 255 * mSettings.getAlpha() / 100; mBlockScreen.setBackgroundColor(Color.argb(alpha, 0, 0, 0)); ((ImageView) mBlockScreen.findViewById(R.id.img_logo)).setAlpha(alpha); ((Button) mBlockScreen.findViewById(R.id.btn_unblock)).setOnClickListener(this); WindowManager.LayoutParams params = new WindowManager.LayoutParams(); params.width = WindowManager.LayoutParams.MATCH_PARENT; params.height = WindowManager.LayoutParams.MATCH_PARENT; params.type = WindowManager.LayoutParams.TYPE_SYSTEM_ALERT; params.flags = 0; params.format = PixelFormat.TRANSLUCENT; WindowManager wm = (WindowManager) getSystemService(Context.WINDOW_SERVICE); wm.addView(mBlockScreen, params); } }
From source file:iSoron.HistoryChart.java
private void initColors() { if (isBackgroundTransparent) primaryColor = InterfaceUtils.setMinValue(primaryColor, 0.75f); int red = Color.red(primaryColor); int green = Color.green(primaryColor); int blue = Color.blue(primaryColor); if (isBackgroundTransparent) { colors = new int[3]; colors[0] = Color.argb(16, 255, 255, 255); colors[1] = Color.argb(128, red, green, blue); colors[2] = primaryColor;/*from w ww . j a va 2s.c o m*/ textColor = Color.WHITE; reverseTextColor = Color.WHITE; } else { colors = new int[3]; /* colors[0] = InterfaceUtils.getStyledColor(getContext(), R.attr.lowContrastTextColor); colors[1] = ContextCompat.getColor(getContext(), R.color.schemethree_darkerred); colors[2] = primaryColor; */ //ABUSIVEGYMREMINDER: Don't have an easy interface for custom colors, so this is my customization colors[0] = InterfaceUtils.getStyledColor(getContext(), R.attr.implicitHitColor); colors[1] = InterfaceUtils.getStyledColor(getContext(), R.attr.missColor); colors[2] = InterfaceUtils.getStyledColor(getContext(), R.attr.explicitHitColor); textColor = InterfaceUtils.getStyledColor(getContext(), R.attr.mediumContrastTextColor); reverseTextColor = InterfaceUtils.getStyledColor(getContext(), R.attr.highContrastReverseTextColor); } }