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:edu.htl3r.schoolplanner.gui.timetable.ViewPagerIndicator.java
/** * Create all views, build the layout//from w w w . j a v a2 s . c om */ private void addContent() { mFocusedTextColor = new int[] { 0, 0, 0 }; mUnfocusedTextColor = new int[] { 190, 190, 190 }; // Text views mPrevious = new TextView(getContext()); mCurrent = new TextView(getContext()); mNext = new TextView(getContext()); RelativeLayout.LayoutParams previousParams = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); previousParams.addRule(RelativeLayout.ALIGN_LEFT); RelativeLayout.LayoutParams currentParams = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); currentParams.addRule(RelativeLayout.CENTER_HORIZONTAL); RelativeLayout.LayoutParams nextParams = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); nextParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT); // Groups holding text and arrows mPreviousGroup = new LinearLayout(getContext()); mPreviousGroup.setOrientation(LinearLayout.HORIZONTAL); mNextGroup = new LinearLayout(getContext()); mNextGroup.setOrientation(LinearLayout.HORIZONTAL); mPreviousGroup.addView(mPrevious, new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT)); mNextGroup.addView(mNext, new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT)); addView(mPreviousGroup, previousParams); addView(mCurrent, currentParams); addView(mNextGroup, nextParams); mPrevious.setSingleLine(); mCurrent.setSingleLine(); mNext.setSingleLine(); mPrevious.setText("previous"); mCurrent.setText("current"); mNext.setText("next"); // Set colors mNext.setTextColor(Color.argb(255, mUnfocusedTextColor[0], mUnfocusedTextColor[1], mUnfocusedTextColor[2])); mPrevious.setTextColor( Color.argb(255, mUnfocusedTextColor[0], mUnfocusedTextColor[1], mUnfocusedTextColor[2])); updateColor(0); }
From source file:com.fancy.path_anim_lib.AnimatedSvgView.java
/** * /*from www . ja v a2 s . c o m*/ * */ public void setTraceColors(int alpha, int red, int green, int blue) { int traceColor = Color.argb(alpha, red, green, blue); int[] traceColors = new int[2]; // 4 glyphs for (int i = 0; i < traceColors.length; i++) { traceColors[i] = traceColor; } mTraceColors = traceColors; }
From source file:io.mpos.ui.shared.util.UiHelper.java
private static int setAlphaForColor(int color, float alphaFactor) { int alpha = Math.round(Color.alpha(color) * alphaFactor); int red = Color.red(color); int green = Color.green(color); int blue = Color.blue(color); return Color.argb(alpha, red, green, blue); }
From source file:com.jpventura.xyzreader.ui.ArticleDetailFragment.java
private void updateStatusBar() { int color = 0; if (mPhotoView != null && mTopInset != 0 && mScrollY > 0) { float f = progress(mScrollY, mStatusBarFullOpacityBottom - mTopInset * 3, mStatusBarFullOpacityBottom - mTopInset); color = Color.argb((int) (255 * f), (int) (Color.red(mMutedColor) * 0.9), (int) (Color.green(mMutedColor) * 0.9), (int) (Color.blue(mMutedColor) * 0.9)); }/* ww w. j a v a 2s. co m*/ mStatusBarColorDrawable.setColor(color); mDrawInsetsFrameLayout.setInsetBackground(mStatusBarColorDrawable); }
From source file:com.uws.campus_app.core.maps.BaseCustomMap.java
protected void placeUser() { GoogleMap googleMap = getMap();// w ww. j a v a 2 s. c om if (userMarker == null || userArea == null) return; userMarker.remove(); userMarker = googleMap .addMarker(new MarkerOptions().position(userMarker.getPosition()).title("Your Location")); userArea.remove(); userArea = googleMap.addCircle(new CircleOptions().center(userArea.getCenter()) .strokeColor(Color.argb(180, 7, 205, 227)).fillColor(Color.argb(100, 7, 205, 227)).radius(30.0)); }
From source file:com.jungle.toolbaractivity.layout.HorizontalSwipeBackLayout.java
private void updateSlideOffset(float offset) { int count = getChildCount(); if (count == 0) { return;//ww w . j av a 2s. c o m } mTranslationX = offset; for (int i = 0; i < count; ++i) { View child = getChildAt(0); child.setTranslationX(offset); } if (mDecorView != null) { int width = getMeasuredWidth(); int alpha = (int) (0xb0 - (0xb0 - 0x10) * offset / width); int color = Color.argb(alpha, 0x00, 0x00, 0x00); mDecorView.setBackgroundColor(color); } invalidate(); }
From source file:com.cryart.sabbathschool.ui.activity.SSMainActivity.java
public void setToolbarStatusBarAlpha(int alpha) { int color = _SSToolbarTitle.getCurrentTextColor(); SS_TOOLBAR_STATUS_BAR_ALPHA = alpha; _SSToolbar.getBackground().setAlpha(alpha); _SSStatusBar.getBackground().setAlpha(alpha); _SSToolbarTitle.setTextColor(Color.argb(alpha, Color.red(color), Color.green(color), Color.blue(color))); }
From source file:com.esri.android.mapsapp.tools.MeasuringTool.java
public MeasuringTool(MapView map) { this.mMap = map; mContext = mMap.getContext();//from w ww .j av a2s . c o m mMarkerSymbol = new SimpleMarkerSymbol(Color.RED, 10, STYLE.CIRCLE); mLineSymbol = new SimpleLineSymbol(Color.BLACK, 3); mDefaultLinearUnits = new Unit[] { Unit.create(LinearUnit.Code.METER), Unit.create(LinearUnit.Code.KILOMETER), Unit.create(LinearUnit.Code.FOOT), Unit.create(LinearUnit.Code.MILE_STATUTE) }; mDefaultAreaUnits = new Unit[] { Unit.create(AreaUnit.Code.SQUARE_METER), Unit.create(AreaUnit.Code.SQUARE_KILOMETER), Unit.create(AreaUnit.Code.SQUARE_FOOT), Unit.create(AreaUnit.Code.SQUARE_MILE_STATUTE) }; mFillSymbol = new SimpleFillSymbol(Color.argb(100, 225, 225, 0)); mFillSymbol.setOutline(new SimpleLineSymbol(Color.TRANSPARENT, 0)); }
From source file:com.github.pennyfive.cinemafinlando.ui.activity.EventActivity.java
@Override public void onScroll(int position) { float ratio = Math.max(0, Math.min(1, position / (float) eventImageView.getHeight())); /* Adjust action bar background alpha when scrolled. */ float interpolatedRatio = actionBarBackgroundAlphaInterpolator.getInterpolation(ratio); actionBarBackgroundDrawable.setAlpha((int) (interpolatedRatio * 255)); /* Adjust event image translation when scrolled to create parallax effect. */ eventImageView.setTranslationY(eventImageView.getHeight() * 0.4f * ratio); /* Hide action bar title shadow as the action bar background becomes visible */ int shadowColor = Color.argb((int) ((1 - ratio) * actionBarTitleMaxShadowAlpha), 0, 0, 0); actionBarCustomTextView.setShadowLayer(actionBarTitleShadowRadius, 0, 0, shadowColor); }
From source file:org.i_chera.wolfensteineditor.fragments.LevelFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, final Bundle savedInstanceState) { View v = inflater.inflate(R.layout.fragment_level, container, false); mDrawerLayout = (DrawerLayout) v;/*from w w w . j av a 2 s. co m*/ mGridLayout = (RelativeLayout) v.findViewById(R.id.grid_layout); mVerticalScroll = (VXScrollView) v.findViewById(R.id.vertical_scroll); mHorizontalScroll = (HXScrollView) v.findViewById(R.id.horizontal_scroll); mWallList = (ListView) v.findViewById(R.id.wall_list); mLeftDrawer = (LinearLayout) v.findViewById(R.id.left_drawer); mScrollLockCheck = (CheckBox) v.findViewById(R.id.scroll_lock_check); mCentralContent = (RelativeLayout) v.findViewById(R.id.central_content); mHorizontalScroll.setScrollingEnabled(false); mHorizontalScroll.setOnTouchListener(this); mVerticalScroll.setOnTouchListener(this); mVerticalScroll.setAlwaysInterceptMove(true); mCentralContent.setOnTouchListener(this); // mVerticalScroll.setClickable(true); // mHorizontalScroll.setOnClickListener(this); mHorizontalScroll.setScrollViewListener(this); mVerticalScroll.setScrollViewListener(this); mScrollLockCheck.setOnClickListener(this); mScrollLockCheck.setOnCheckedChangeListener(this); int tColor = MainActivity.FLOOR_COLOUR; tColor = Color.argb(200, Color.red(tColor), Color.green(tColor), Color.blue(tColor)); mScrollLockCheck.setBackgroundColor(tColor); mLeftDrawer.setBackgroundColor(MainActivity.FLOOR_COLOUR); mWallList.setAdapter(new WallListAdapter()); mWallList.setOnItemClickListener(this); mGridLayout.getLayoutParams().width = mGridLayout.getLayoutParams().height = LevelContainer.MAPSIZE * mTileSize; ViewTreeObserver observer = mVerticalScroll.getViewTreeObserver(); observer.addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() { // Can't get rid of warning otherwise. Can't use the recommended // function here @SuppressWarnings("deprecation") @Override public void onGlobalLayout() { mVerticalScroll.getViewTreeObserver().removeGlobalOnLayoutListener(this); mViewportSize = new Point(mVerticalScroll.getMeasuredWidth(), mVerticalScroll.getMeasuredHeight()); Bundle b = getActualState(savedInstanceState); if (b != null) { mHorizontalScroll.scrollTo(b.getInt(EXTRA_SCROLL_X), 0); mVerticalScroll.scrollTo(0, b.getInt(EXTRA_SCROLL_Y)); mCurrentWallChoice = b.getInt(EXTRA_CURRENT_WALL_CHOICE); boolean checked = b.getBoolean(EXTRA_SCROLL_LOCK); mScrollLockCheck.setChecked(checked); } updateData(); } }); return v; }