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:com.peapod.matchflare.GCMIntentService.java
private void dumpEvent(String event, Intent message) { if (event.equals("onMessage")) { //Handled received remote notification Intent intent = new Intent("com.peapod.matchflare.push_notification"); String jsonData = message.getStringExtra("data"); Gson gson = new Gson(); try {/* ww w.ja va 2s. c om*/ Notification notification = gson.fromJson(jsonData, Notification.class); if (notification != null) { intent.putExtra("notification", notification); String notificationTitle = "Matchflare Notification!"; //Set notifcation title based on notification type if (notification.notification_type != null) { if (notification.notification_type.equals("USER_REMINDER")) { notificationTitle = "What do you think of them?"; } else if (notification.notification_type.equals("MATCHER_ONE_MATCH_ACCEPTED")) { notificationTitle = "Match Accepted!"; } else if (notification.notification_type.equals("MATCHER_MESSAGING_STARTED")) { notificationTitle = "They started talking!"; } else if (notification.notification_type.equals("MATCHER_QUESTION_ASKED")) { notificationTitle = "New Question?"; } else if (notification.notification_type.equals("MATCHEE_NEW_MATCH")) { notificationTitle = "New Match!"; } else if (notification.notification_type.equals("MATCHEE_MATCH_ACCEPTED")) { notificationTitle = "Match made!"; } else if (notification.notification_type.equals("MATCHEE_QUESTION_ANSWERED")) { notificationTitle = "Question Answered!"; } else if (notification.notification_type.equals("MATCHEE_MESSAGE_SENT")) { notificationTitle = "New Message!"; } } //If no local activity received the notification, then set phone notification if (!LocalBroadcastManager.getInstance(this).sendBroadcast(intent)) { NotificationCompat.Builder b = new NotificationCompat.Builder(this); Intent ui = new Intent(this, SplashActivity.class); ui.putExtra("notification", notification); ui.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); long[] vibrate = { 0, 100 }; b.setAutoCancel(true).setContentTitle(notificationTitle) .setContentText(notification.push_message).setSmallIcon(R.drawable.ic_launcher) .setTicker(notification.push_message) .setLights(Color.argb(255, 250, 69, 118), 2000, 500).setVibrate(vibrate) .setContentIntent( PendingIntent.getActivity(this, 0, ui, PendingIntent.FLAG_UPDATE_CURRENT)); NotificationManager mgr = (NotificationManager) getSystemService(NOTIFICATION_SERVICE); mgr.notify(NOTIFY_ID, b.build()); } } } catch (Error e) { Log.e("Cant parse notification", e.toString()); //Google Analytics Tracker t = ((Global) getApplication()).getTracker(); t.send(new HitBuilders.ExceptionBuilder() .setDescription("(GCMIntentService) Could not parse notification push message: " + new StandardExceptionParser(this, null) .getDescription(Thread.currentThread().getName(), e)) .setFatal(false).build()); } } }
From source file:cc.kenai.common.AnimatedSvgView.java
private void loadConfig() { setGlyphStrings(LoadingPath.STUDIO_PATH); // ARGB values for each glyph setFillPaints(new int[] { 210, 210 }, new int[] { 50, 50 }, new int[] { 180, 180 }, new int[] { 230, 230 }); int traceColor = Color.argb(255, 50, 180, 230); int[] traceColors = new int[2]; // 4 glyphs int residueColor = Color.argb(80, 50, 180, 230); int[] residueColors = new int[2]; // 4 glyphs // Every glyph will have the same trace/residue for (int i = 0; i < traceColors.length; i++) { traceColors[i] = traceColor;//from w ww .j ava 2s. c o m residueColors[i] = residueColor; } setTraceColors(traceColors); setTraceResidueColors(residueColors); }
From source file:nf.frex.android.FrexActivity.java
/** * Called when the activity is first created. *//*w w w .jav a 2s. c o m*/ @Override public void onCreate(Bundle savedInstanceState) { //Log.d(TAG, "onCreate(savedInstanceState=" + savedInstanceState + ")"); super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_ACTION_BAR); requestWindowFeature(Window.FEATURE_ACTION_BAR_OVERLAY); requestWindowFeature(Window.FEATURE_ACTION_MODE_OVERLAY); if (PRE_SDK14) { requestWindowFeature(Window.FEATURE_NO_TITLE); // Fix: Frex to stop working on screen orientation changes (Android 2.3.x only) if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) { setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); } else if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT) { setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); } } else { getActionBar().setBackgroundDrawable(new PaintDrawable(Color.argb(128, 0, 0, 0))); } view = new FractalView(this); setContentView(view); if (!tryReadingFrexDocIntent(getIntent())) { if (savedInstanceState != null) { view.restoreInstanceState(new BundlePropertySet(savedInstanceState)); } else { PropertySet propertySet = (PropertySet) getLastNonConfigurationInstance(); if (propertySet != null) { view.restoreInstanceState(propertySet); } } } }
From source file:com.sckftr.android.app.view.InsetFrameLayout.java
public void setInsetBackgroundColor(int color) { // Resources r = getResources(); setInsetBackgroundColorRaw(/* ww w .j av a 2 s .c om*/ Color.argb(Color.alpha(color), Color.red(color), Color.green(color), Color.blue(color))); }
From source file:com.microsoft.rightsmanagement.ui.widget.UserPolicyViewerFragment.java
/** * Called when the view is created. Here we will fill inflate our view contained by the fragment according to the * XML layout./*w ww . j a v a 2 s . c o m*/ * * @param inflater the inflater * @param container the container * @param savedInstanceState the saved instance state * @return the view */ @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { Logger.ms(TAG, "onCreateView"); int backGroundColor = R.color.black; int color = Color.argb(ALPHA_VALUE, Color.red(backGroundColor), Color.green(backGroundColor), Color.blue(backGroundColor)); View view = inflater.inflate(R.layout.user_policy_viewer_fragment_layout, container, false); view.setBackgroundColor(color); // lets set all the view members and fragment members in the fragment mOwnerNameTextView = (TextView) view.findViewById(R.id.policy_viewer_owner_txt_view); mUpperTitleTextView = (TextView) view.findViewById(R.id.policy_viewer_main_title_top); mPolicyDescTextView = (TextView) view.findViewById(R.id.policy_viewer_policy_decription_txt_view); mPolicyNameTextView = (TextView) view.findViewById(R.id.policy_viewer_policy_name_txt_view); mRightLayout = (LinearLayout) view.findViewById(R.id.list_layout); mEditBtnContainer = (ViewGroup) view.findViewById(R.id.edit_btn_container); mEditBtn = (Button) view.findViewById(R.id.edit_btn_policy_viewer); mEditBtn.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Logger.d(TAG, "Edit button onClick called"); mUserPolicyViewerFragmentEventListener.onEditButtonClicked(); } }); // Use information in storage if it exists and is the latest info. if (savedInstanceState != null) { // TODO restore state } drawUI(); Logger.me(TAG, "onCreateView"); return view; }
From source file:net.bither.util.ChartsUtil.java
public synchronized static void initMACandleStickChart(MACandleStickChart macandlestickchart, List<IStickEntity> ohlc, boolean isRefresh) { List<LineEntity<DateValueEntity>> lines = new ArrayList<LineEntity<DateValueEntity>>(); LineEntity<DateValueEntity> MA10 = new LineEntity<DateValueEntity>(); MA10.setTitle("MA10"); MA10.setLineColor(BitherApplication.mContext.getResources().getColor(R.color.ten_kline)); MA10.setLineData(initMA(ohlc, 10));//from w w w . j a v a2 s .c om lines.add(MA10); LineEntity<DateValueEntity> MA30 = new LineEntity<DateValueEntity>(); MA30.setTitle("MA25"); MA30.setLineColor(BitherApplication.mContext.getResources().getColor(R.color.thrity_kline)); MA30.setLineData(initMA(ohlc, 30)); lines.add(MA30); int lineColor = Color.argb(30, 255, 255, 255); macandlestickchart.setLongitudeFontSize(14); macandlestickchart.setLatitudeFontSize(14); macandlestickchart.setLatitudeColor(lineColor); macandlestickchart.setLongitudeColor(lineColor); macandlestickchart.setLongitudeFontColor(Color.WHITE); macandlestickchart.setLatitudeFontColor(Color.WHITE); double maxValue = getMaxValue(ohlc); double minValue = getMinValue(ohlc); if (maxValue - minValue > 50) { macandlestickchart.setGraduation(10); } else { macandlestickchart.setGraduation(1); } macandlestickchart.setMaxSticksNum(ohlc.size()); macandlestickchart.setLatitudeNum(5); macandlestickchart.setLongitudeNum(5); macandlestickchart.setMaxValue(getMaxValue(ohlc)); macandlestickchart.setMinValue(getMinValue(ohlc)); macandlestickchart.setDisplayBorder(false); macandlestickchart.setDisplayLongitudeTitle(true); macandlestickchart.setDisplayLatitudeTitle(true); macandlestickchart.setDisplayLatitude(true); macandlestickchart.setDisplayLongitude(true); macandlestickchart.setDataQuadrantPaddingTop(5); macandlestickchart.setDataQuadrantPaddingBottom(5); macandlestickchart.setDataQuadrantPaddingLeft(5); macandlestickchart.setDataQuadrantPaddingRight(5); macandlestickchart.setAxisYTitleQuadrantWidth(50); macandlestickchart.setAxisXTitleQuadrantHeight(20); macandlestickchart.setAxisXPosition(GridChart.AXIS_X_POSITION_BOTTOM); macandlestickchart.setAxisYPosition(GridChart.AXIS_Y_POSITION_RIGHT); macandlestickchart.setLinesData(lines); macandlestickchart.setStickData(new ListChartData<IStickEntity>(ohlc)); if (isRefresh) { macandlestickchart.invalidate(); } }
From source file:com.raja.knowme.FragmentWorkExp.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View mHolderView = inflater.inflate(R.layout.fragment_work_exp, null); shake = AnimationUtils.loadAnimation(getActivity(), R.anim.shake); functions = new AppCommonFunctions(getActivity()); pref = new AppPreferences(getActivity()); knowmeData = new KnowMeDataObject(getActivity()); mProgressDialog = new ProgressDialog(getActivity()); mProgressDialog.setCancelable(false); mProgressDialog.setMessage(getString(R.string.loading)); mCompanyNameSwitcher = (TextSwitcher) mHolderView.findViewById(R.id.work_company_name_text); mCompanySpanSwitcher = (TextSwitcher) mHolderView.findViewById(R.id.work_company_span_text); mCompanySummarySwitcher = (TextSwitcher) mHolderView.findViewById(R.id.work_company_summary_text); mScrollContainer = (ScrollView) mHolderView.findViewById(R.id.work_scrollview); mInstructionBtn = (RelativeLayout) mHolderView.findViewById(R.id.instrunstions_layout); if (!pref.getWorkFirstRun()) { mInstructionBtn.setVisibility(RelativeLayout.GONE); }/*from w w w . j a v a 2 s .c om*/ mInstructionBtn.setOnClickListener(new OnClickListener() { public void onClick(View v) { pref.setWorkRunned(); mInstructionBtn.setVisibility(RelativeLayout.GONE); } }); /* Multiple Screen Size Condition */ // Small Size if ((getContext().getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_SMALL) { // Toast.makeText(getActivity(), "small", Toast.LENGTH_SHORT).show(); mCompanyNameSwitcher.setFactory(new ViewFactory() { public View makeView() { /** Set up the custom auto scrolling text view class for lengthy album names */ AppTextView textSwitcher_text = new AppTextView(getActivity()); textSwitcher_text.setTextColor(Color.argb(225, 245, 242, 11)); textSwitcher_text.setTextSize(24 * functions.getScreenDPI()); textSwitcher_text.setSingleLine(true); textSwitcher_text.setEllipsize(TruncateAt.MARQUEE); textSwitcher_text.setMarqueeRepeatLimit(-1); textSwitcher_text.setHorizontallyScrolling(true); return textSwitcher_text; } }); mCompanySpanSwitcher.setFactory(new ViewFactory() { public View makeView() { /** Set up the custom auto scrolling text view class for lengthy album names */ AppTextView textSwitcher_text = new AppTextView(getActivity()); textSwitcher_text.setTextColor(Color.argb(225, 245, 242, 11)); textSwitcher_text.setTextSize(12 * functions.getScreenDPI()); textSwitcher_text.setSingleLine(true); textSwitcher_text.setEllipsize(TruncateAt.MARQUEE); textSwitcher_text.setMarqueeRepeatLimit(-1); textSwitcher_text.setHorizontallyScrolling(true); return textSwitcher_text; } }); mCompanySummarySwitcher.setFactory(new ViewFactory() { public View makeView() { /** Set up the custom auto scrolling text view class for lengthy album names */ AppTextView textSwitcher_text = new AppTextView(getActivity()); textSwitcher_text.setTextColor(Color.argb(225, 225, 225, 225)); textSwitcher_text.setTextSize(6 * functions.getScreenDPI()); return textSwitcher_text; } }); } //Normal Size else if ((getContext().getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_NORMAL) { // Toast.makeText(getActivity(), "normal", Toast.LENGTH_SHORT).show(); mCompanyNameSwitcher.setFactory(new ViewFactory() { public View makeView() { /** Set up the custom auto scrolling text view class for lengthy album names */ AppTextView textSwitcher_text = new AppTextView(getActivity()); textSwitcher_text.setTextColor(Color.argb(225, 245, 242, 11)); textSwitcher_text.setTextSize(14 * functions.getScreenDPI()); textSwitcher_text.setSingleLine(true); textSwitcher_text.setEllipsize(TruncateAt.MARQUEE); textSwitcher_text.setMarqueeRepeatLimit(-1); textSwitcher_text.setHorizontallyScrolling(true); return textSwitcher_text; } }); mCompanySpanSwitcher.setFactory(new ViewFactory() { public View makeView() { /** Set up the custom auto scrolling text view class for lengthy album names */ AppTextView textSwitcher_text = new AppTextView(getActivity()); textSwitcher_text.setTextColor(Color.argb(225, 245, 242, 11)); textSwitcher_text.setTextSize(10 * functions.getScreenDPI()); textSwitcher_text.setSingleLine(true); textSwitcher_text.setEllipsize(TruncateAt.MARQUEE); textSwitcher_text.setMarqueeRepeatLimit(-1); textSwitcher_text.setHorizontallyScrolling(true); return textSwitcher_text; } }); mCompanySummarySwitcher.setFactory(new ViewFactory() { public View makeView() { /** Set up the custom auto scrolling text view class for lengthy album names */ AppTextView textSwitcher_text = new AppTextView(getActivity()); textSwitcher_text.setTextColor(Color.argb(225, 225, 225, 225)); textSwitcher_text.setTextSize(9 * functions.getScreenDPI()); return textSwitcher_text; } }); } // Large Size else if ((getContext().getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_LARGE) { // Toast.makeText(getActivity(), "large", Toast.LENGTH_SHORT).show(); mCompanyNameSwitcher.setFactory(new ViewFactory() { public View makeView() { /** Set up the custom auto scrolling text view class for lengthy album names */ AppTextView textSwitcher_text = new AppTextView(getActivity()); textSwitcher_text.setTextColor(Color.argb(225, 245, 242, 11)); textSwitcher_text.setTextSize(32 * functions.getScreenDPI()); textSwitcher_text.setSingleLine(true); textSwitcher_text.setEllipsize(TruncateAt.MARQUEE); textSwitcher_text.setMarqueeRepeatLimit(-1); textSwitcher_text.setHorizontallyScrolling(true); return textSwitcher_text; } }); mCompanySpanSwitcher.setFactory(new ViewFactory() { public View makeView() { /** Set up the custom auto scrolling text view class for lengthy album names */ AppTextView textSwitcher_text = new AppTextView(getActivity()); textSwitcher_text.setTextColor(Color.argb(225, 245, 242, 11)); textSwitcher_text.setTextSize(24 * functions.getScreenDPI()); textSwitcher_text.setSingleLine(true); textSwitcher_text.setEllipsize(TruncateAt.MARQUEE); textSwitcher_text.setMarqueeRepeatLimit(-1); textSwitcher_text.setHorizontallyScrolling(true); return textSwitcher_text; } }); mCompanySummarySwitcher.setFactory(new ViewFactory() { public View makeView() { /** Set up the custom auto scrolling text view class for lengthy album names */ AppTextView textSwitcher_text = new AppTextView(getActivity()); textSwitcher_text.setTextColor(Color.argb(225, 225, 225, 225)); textSwitcher_text.setTextSize(18 * functions.getScreenDPI()); return textSwitcher_text; } }); } //X-large Size else if ((getContext().getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_XLARGE) { // Toast.makeText(getActivity(), "xlarge", Toast.LENGTH_SHORT).show(); mCompanyNameSwitcher.setFactory(new ViewFactory() { public View makeView() { /** Set up the custom auto scrolling text view class for lengthy album names */ AppTextView textSwitcher_text = new AppTextView(getActivity()); textSwitcher_text.setTextColor(Color.argb(225, 245, 242, 11)); textSwitcher_text.setTextSize(48 * functions.getScreenDPI()); textSwitcher_text.setSingleLine(true); textSwitcher_text.setEllipsize(TruncateAt.MARQUEE); textSwitcher_text.setMarqueeRepeatLimit(-1); textSwitcher_text.setHorizontallyScrolling(true); return textSwitcher_text; } }); mCompanySpanSwitcher.setFactory(new ViewFactory() { public View makeView() { /** Set up the custom auto scrolling text view class for lengthy album names */ AppTextView textSwitcher_text = new AppTextView(getActivity()); textSwitcher_text.setTextColor(Color.argb(225, 245, 242, 11)); textSwitcher_text.setTextSize(32 * functions.getScreenDPI()); textSwitcher_text.setSingleLine(true); textSwitcher_text.setEllipsize(TruncateAt.MARQUEE); textSwitcher_text.setMarqueeRepeatLimit(-1); textSwitcher_text.setHorizontallyScrolling(true); return textSwitcher_text; } }); mCompanySummarySwitcher.setFactory(new ViewFactory() { public View makeView() { /** Set up the custom auto scrolling text view class for lengthy album names */ AppTextView textSwitcher_text = new AppTextView(getActivity()); textSwitcher_text.setTextColor(Color.argb(225, 225, 225, 225)); textSwitcher_text.setTextSize(24 * functions.getScreenDPI()); return textSwitcher_text; } }); } //Undefined Size else { // Toast.makeText(getActivity(), "undefined", Toast.LENGTH_SHORT).show(); mCompanyNameSwitcher.setFactory(new ViewFactory() { public View makeView() { /** Set up the custom auto scrolling text view class for lengthy album names */ AppTextView textSwitcher_text = new AppTextView(getActivity()); textSwitcher_text.setTextColor(Color.argb(225, 245, 242, 11)); textSwitcher_text.setTextSize(19 * functions.getScreenDPI()); textSwitcher_text.setSingleLine(true); textSwitcher_text.setEllipsize(TruncateAt.MARQUEE); textSwitcher_text.setMarqueeRepeatLimit(-1); textSwitcher_text.setHorizontallyScrolling(true); return textSwitcher_text; } }); mCompanySpanSwitcher.setFactory(new ViewFactory() { public View makeView() { /** Set up the custom auto scrolling text view class for lengthy album names */ AppTextView textSwitcher_text = new AppTextView(getActivity()); textSwitcher_text.setTextColor(Color.argb(225, 245, 242, 11)); textSwitcher_text.setTextSize(12 * functions.getScreenDPI()); textSwitcher_text.setSingleLine(true); textSwitcher_text.setEllipsize(TruncateAt.MARQUEE); textSwitcher_text.setMarqueeRepeatLimit(-1); textSwitcher_text.setHorizontallyScrolling(true); return textSwitcher_text; } }); mCompanySummarySwitcher.setFactory(new ViewFactory() { public View makeView() { /** Set up the custom auto scrolling text view class for lengthy album names */ AppTextView textSwitcher_text = new AppTextView(getActivity()); textSwitcher_text.setTextColor(Color.argb(225, 225, 225, 225)); textSwitcher_text.setTextSize(12 * functions.getScreenDPI()); return textSwitcher_text; } }); } mProgressDialog.show(); new LoadData().execute(); // Gesture detection gestureDetector = new GestureDetector(getActivity(), new OnGestureListener() { public boolean onSingleTapUp(MotionEvent e) { return false; } public void onShowPress(MotionEvent e) { } public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) { return false; } public void onLongPress(MotionEvent e) { } public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) { try { if (Math.abs(e1.getY() - e2.getY()) > AppGlobalVariables.SWIPE_MAX_OFF_PATH) return false; /** Left swipe */ if (e1.getX() - e2.getX() > AppGlobalVariables.SWIPE_MIN_DISTANCE && Math.abs(velocityX) > AppGlobalVariables.SWIPE_THRESHOLD_VELOCITY) { if (count < (MAX_COUNT - 1)) nextCompany(); else { mCompanyNameSwitcher.startAnimation(shake); mCompanySpanSwitcher.startAnimation(shake); mCompanySummarySwitcher.startAnimation(shake); } /** Right Swipe */ } else if (e2.getX() - e1.getX() > AppGlobalVariables.SWIPE_MIN_DISTANCE && Math.abs(velocityX) > AppGlobalVariables.SWIPE_THRESHOLD_VELOCITY) { if (count != 0) previousComapny(); else { mCompanyNameSwitcher.startAnimation(shake); mCompanySpanSwitcher.startAnimation(shake); mCompanySummarySwitcher.startAnimation(shake); } } } catch (Exception e) { } return false; } public boolean onDown(MotionEvent e) { return false; } }); gestureListener = new View.OnTouchListener() { public boolean onTouch(View v, MotionEvent event) { return gestureDetector.onTouchEvent(event); } }; mScrollContainer.setOnTouchListener(gestureListener); return mHolderView; }
From source file:com.google.fpl.liquidfunpaint.renderer.ParticleRenderer.java
@Override public void onSurfaceCreated(GL10 gl, EGLConfig config) { // Create the render surfaces for (int i = 0; i < mRenderSurface.length; i++) { mRenderSurface[i] = new RenderSurface(FB_SIZE, FB_SIZE); mRenderSurface[i].setClearColor(Color.argb(0, 255, 255, 255)); }/*from ww w.j a v a2 s .c o m*/ // Create the blur renderer mBlurRenderer = new BlurRenderer(); try { JSONObject json = new JSONObject(materialFile); initializeWaterParticleMaterial(json); initializeNonWaterParticleMaterial(json); // Scrolling texture when we copy water particles from FBO to screen mWaterScreenRenderer = new ScreenRenderer(json.getJSONObject("waterParticleToScreen"), mRenderSurface[0].getTexture()); // Scrolling texture when we copy water particles from FBO to screen mScreenRenderer = new ScreenRenderer(json.getJSONObject("otherParticleToScreen"), mRenderSurface[1].getTexture()); } catch (JSONException ex) { Log.e(TAG, "Cannot parse " + JSON_FILE + "\n" + ex.getMessage()); } }
From source file:org.mklab.mikity.android.editor.AbstractObjectEditor.java
private void createColorBoxes(TableLayout parameters) { final ColorModel color = this.object.getColor(); this.colorValue = Color.argb(color.getAlpha(), color.getR(), color.getG(), color.getB()); final TableRow colorParameter = new TableRow(getContext()); parameters.addView(colorParameter);// w w w .j a va 2 s.c om final TextView colorLabel = new TextView(getContext()); colorLabel.setText(getString(R.string.color)); colorLabel.setTextColor(Color.BLACK); colorParameter.addView(colorLabel); this.colorButton = new Button(getContext()); updateColorButton(); colorParameter.addView(this.colorButton); this.colorButton.setOnClickListener(new OnClickListener() { /** * {@inheritDoc} */ public void onClick(View v) { openColorPicker(AbstractObjectEditor.this.colorValue); } }); this.colorAlpha = new ParameterInputBox(getContext(), this, this); parameters.addView(this.colorAlpha); this.colorAlpha.setName(R.string.color_alpha); this.colorAlpha.setValue("" + color.getAlpha()); //$NON-NLS-1$ this.colorAlpha.setUnit(""); //$NON-NLS-1$ }
From source file:com.thatkawaiiguy.meleehandbook.activity.VideoInfoActivity.java
public int adjustAlpha(int color, float factor) { int alpha = Math.round(Color.alpha(color) * factor); int red = Color.red(color); int green = Color.green(color); int blue = Color.blue(color); return Color.argb(alpha, red, green, blue); }