List of usage examples for android.graphics Color rgb
@ColorInt public static int rgb(float red, float green, float blue)
From source file:com.terraremote.terrafieldreport.OpenGroundReport.java
private void loadSharedPreferences() { SharedPreferences preferences = getSharedPreferences(COMMON_SHARED_PREFERENCES, Context.MODE_PRIVATE); mMobNumber.setText(preferences.getString("mobNumber", "")); mName.setText(preferences.getString("name", "")); mPhoneNumber.setText(preferences.getString("cellPhoneNumber", "")); // initiate SharedPreferences SharedPreferences settings = getSharedPreferences(OPEN_GROUND_SHARED_PREFERENCES, Context.MODE_PRIVATE); // put in default/saved values showDate.setText(settings.getString("groundSubmissionDate", "")); if (settings.getBoolean("workingAloneGround", false)) { mWorkingAlone.setChecked(true);/*from ww w.j ava2 s .com*/ tvColleaguesTextView.setVisibility(View.GONE); mColleagues.setVisibility(View.GONE); } mColleagues.setText(settings.getString("colleaguesGround", "")); // Transit Day if (settings.getBoolean("transitDayOpenGround", false)) { mTransitDay.setChecked(true); workLocationCard.setVisibility(View.GONE); workDescriptionCard.setVisibility(View.GONE); transitDayCard.setBackgroundColor(Color.rgb(210, 51, 224)); transitDayText.setTextColor(Color.WHITE); } // Location Details mLocationStart.setText(settings.getString("locationStart", "")); mGpsLatitude.setText(settings.getString("gpsLatitudeOpenGround", "")); mGpsLongitude.setText(settings.getString("gpsLongitudeOpenGround", "")); // PPE Checklist if (settings.getBoolean("hiVisApparelGround", false)) { mHiVisApparel.setChecked(true); } if (settings.getBoolean("clothingForSeasonGround", false)) { mClothingForSeason.setChecked(true); } if (settings.getBoolean("safetyRatedFootwearGround", false)) { mSafetyRatedFootwear.setChecked(true); } if (settings.getBoolean("personalSurvivalKitGround", false)) { mPersonalSurvivalKit.setChecked(true); } if (settings.getBoolean("hearingProtectionGround", false)) { mHearingProtection.setChecked(true); } if (settings.getBoolean("hardHatGround", false)) { mHardHat.setChecked(true); } mPpeComments.setText(settings.getString("ppeCommentsGround", "")); // Vehicle Details if (settings.getBoolean("hasRentalVehicle", false)) { mRentalVehicle.setChecked(true); tvRentalAgencyTv.setVisibility(View.VISIBLE); mRentalAgency.setVisibility(View.VISIBLE); } mRentalAgency.setText(settings.getString("rentalAgency", "")); mVehicleMake.setText(settings.getString("vehicleMake", "")); mVehicleModel.setText(settings.getString("vehicleModel", "")); mVehicleColour.setText(settings.getString("vehicleColor", "")); mVehicleLicensePlate.setText(settings.getString("vehicleLicensePlate", "")); mVehicleOperatorName.setText(settings.getString("vehicleOperatorName", "")); // Ground Operations Information mCityOfDeparture.setText(settings.getString("cityOfDepartureGround", "")); mCityOfArrival.setText(settings.getString("cityOfArrivalGround", "")); mProjectLocation.setText(settings.getString("projectLocationGround", "")); mProjectDescription.setText(settings.getString("workDescriptionGround", "")); mEstimatedWorkDuration.setText(settings.getString("estimatedWorkDurationGround", "")); // Check in Contact mCheckInContactRoleSpinner.setSelection(settings.getInt("checkInContactRolePositionGround", 0)); mCheckInContactNameSpinner.setSelection(settings.getInt("checkInContactDataCheckerPositionGround", 0)); mOtherContactName.setText(settings.getString("checkInContactOtherNameGround", "")); if (settings.getBoolean("satellitePhoneGround", false)) { mSatellitePhone.setChecked(true); mSatellitePhoneNumberTableRow.setVisibility(View.VISIBLE); mSatPhoneNumberListSpinner.setSelection(settings.getInt("satellitePhoneNumberPositionGround", 0)); if (mSatPhoneNumberListSpinner.getSelectedItem() == getString(R.string.satPhoneOther)) { mSatellitePhoneNumber.setText(settings.getString("satellitePhoneNumberOtherGround", "")); } } if (settings.getBoolean("radioGround", false)) { mRadio.setChecked(true); } if (settings.getBoolean("firstAidKitGround", false)) { mFirstAidKit.setChecked(true); } if (settings.getBoolean("fireExtinguisherGround", false)) { mFireExtinguisher.setChecked(true); } if (settings.getBoolean("transportingFuelGround", false)) { mTransportingFuel.setChecked(true); } if (settings.getBoolean("tdgPlacardsGround", false)) { mTdgPlacards.setChecked(true); } if (settings.getBoolean("spillKitGround", false)) { mSpillKit.setChecked(true); } if (settings.getBoolean("workingInTrafficGround", false)) { mWorkingInTraffic.setChecked(true); } if (settings.getBoolean("pylonsGround", false)) { mPylons.setChecked(true); } if (settings.getBoolean("trafficSignsGround", false)) { mTrafficSigns.setChecked(true); } if (settings.getBoolean("appropriateVehicleGround", false)) { mAppropriateVehicle.setChecked(true); } // Hazard / Risk Assessment if (settings.getBoolean("remoteAreaGround", false)) { mRemoteArea.setChecked(true); } if (settings.getBoolean("workingInIsolationGround", false)) { mWorkingInIsolation.setChecked(true); } if (settings.getBoolean("extremeWeatherGround", false)) { mExtremeWeather.setChecked(true); } if (settings.getBoolean("transmissionLinesGround", false)) { mTransmissionLines.setChecked(true); } if (settings.getBoolean("activeMineSiteGround", false)) { mActiveMineSite.setChecked(true); } if (settings.getBoolean("activeLoggingAreaGround", false)) { mActiveLoggingArea.setChecked(true); } if (settings.getBoolean("wildLifeGround", false)) { mWildlife.setChecked(true); } if (settings.getBoolean("fatigueGround", false)) { mFatigue.setChecked(true); } if (settings.getBoolean("politicalConflictGround", false)) { mPoliticalConflict.setChecked(true); } // Perception of Risk Radio Group Buttons if (settings.getBoolean("minimalRisk", false)) { mMinimalRisk.setChecked(true); } if (settings.getBoolean("lowRisk", false)) { mLowRisk.setChecked(true); } if (settings.getBoolean("mediumRisk", false)) { mMediumRisk.setChecked(true); } if (settings.getBoolean("highRisk", false)) { mHighRisk.setChecked(true); } if (settings.getBoolean("veryHighRisk", false)) { mVeryHighRisk.setChecked(true); } mPreventionMeasures.setText(settings.getString("preventionMeasuresGround", "")); // Post Prevention Measures - Perception of Risk Radio Group Buttons if (settings.getBoolean("postMinimalRisk", false)) { mPostMinimalRisk.setChecked(true); } if (settings.getBoolean("postLowRisk", false)) { mPostLowRisk.setChecked(true); } if (settings.getBoolean("postMediumRisk", false)) { mPostMediumRisk.setChecked(true); } if (settings.getBoolean("postHighRisk", false)) { mPostHighRisk.setChecked(true); safetyNotice.setVisibility(View.VISIBLE); } if (settings.getBoolean("postVeryHighRisk", false)) { mPostVeryHighRisk.setChecked(true); safetyNotice.setVisibility(View.VISIBLE); } mGeneralComments.setText(settings.getString("generalCommentsGround", "")); }
From source file:com.skytree.epubtest.BookViewActivity.java
public void makeSearchBox() { int boxColor = Color.rgb(241, 238, 229); int innerBoxColor = Color.rgb(246, 244, 239); int inlineColor = Color.rgb(133, 105, 75); RelativeLayout.LayoutParams param = new RelativeLayout.LayoutParams( RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT); // width,height searchBox = new SkyBox(this); searchBox.setBoxColor(boxColor);/*from w ww . ja v a 2 s . c o m*/ searchBox.setArrowHeight(ps(25)); searchBox.setArrowDirection(false); param.leftMargin = ps(50); param.topMargin = ps(400); param.width = ps(400); param.height = ps(300); searchBox.setLayoutParams(param); searchBox.setArrowDirection(false); searchEditor = new EditText(this); this.setFrame(searchEditor, ps(20), ps(20), ps(400 - 140), ps(50)); searchEditor.setTextSize(15f); searchEditor.setEllipsize(TruncateAt.END); searchEditor.setBackgroundColor(innerBoxColor); Drawable icon = getResources().getDrawable(R.drawable.search2x); Bitmap bitmap = ((BitmapDrawable) icon).getBitmap(); Drawable fd = new BitmapDrawable(getResources(), Bitmap.createScaledBitmap(bitmap, ps(28), ps(28), true)); searchEditor.setCompoundDrawablesWithIntrinsicBounds(fd, null, null, null); RoundRectShape rrs = new RoundRectShape( new float[] { ps(15), ps(15), ps(15), ps(15), ps(15), ps(15), ps(15), ps(15) }, null, null); SkyDrawable sd = new SkyDrawable(rrs, innerBoxColor, inlineColor, 2); searchEditor.setBackgroundDrawable(sd); searchEditor.setHint(getString(R.string.searchhint)); searchEditor.setPadding(ps(20), ps(5), ps(10), ps(5)); searchEditor.setLines(1); searchEditor.setImeOptions(EditorInfo.IME_ACTION_SEARCH); searchEditor.setSingleLine(); searchEditor.setOnEditorActionListener(new OnEditorActionListener() { @Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { if (actionId == EditorInfo.IME_ACTION_DONE || actionId == EditorInfo.IME_ACTION_GO || actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_NEXT) { String key = searchEditor.getText().toString(); if (key != null && key.length() > 1) { showIndicator(); clearSearchBox(1); makeFullScreen(); rv.searchKey(key); } } return false; } }); searchBox.contentView.addView(searchEditor); Button cancelButton = new Button(this); this.setFrame(cancelButton, ps(290), ps(20), ps(90), ps(50)); cancelButton.setText(getString(R.string.cancel)); cancelButton.setId(3001); RoundRectShape crs = new RoundRectShape( new float[] { ps(5), ps(5), ps(5), ps(5), ps(5), ps(5), ps(5), ps(5) }, null, null); SkyDrawable cd = new SkyDrawable(crs, innerBoxColor, inlineColor, 2); cancelButton.setBackgroundDrawable(cd); cancelButton.setTextSize(12); cancelButton.setOnClickListener(listener); cancelButton.setOnTouchListener(new ButtonHighlighterOnTouchListener(cancelButton)); searchBox.contentView.addView(cancelButton); searchScrollView = new ScrollView(this); RoundRectShape rvs = new RoundRectShape( new float[] { ps(5), ps(5), ps(5), ps(5), ps(5), ps(5), ps(5), ps(5) }, null, null); SkyDrawable rd = new SkyDrawable(rvs, innerBoxColor, inlineColor, 2); searchScrollView.setBackgroundDrawable(rd); this.setFrame(searchScrollView, ps(20), ps(100), ps(360), ps(200)); this.searchBox.contentView.addView(searchScrollView); searchResultView = new LinearLayout(this); searchResultView.setOrientation(LinearLayout.VERTICAL); searchScrollView.addView(searchResultView, new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT)); this.ePubView.addView(searchBox); this.hideSearchBox(); }
From source file:org.totschnig.myexpenses.fragment.CategoryList.java
private ArrayList<Integer> getTints(int color) { ArrayList<Integer> result = new ArrayList<>(); int red = Color.red(color); int redIncrement = (int) Math.round((255 - red) * 0.1); int green = Color.green(color); int greenIncrement = (int) Math.round((255 - green) * 0.1); int blue = Color.blue(color); int blueIncrement = (int) Math.round((255 - blue) * 0.1); for (int i = 0; i < 10; i++) { red = red + redIncrement;/*from w ww . ja v a 2 s.com*/ if (red >= 255) { red = 255; } green = green + greenIncrement; if (green >= 255) { red = 255; } blue = blue + blueIncrement; if (blue >= 255) { red = 255; } result.add(Color.rgb(red, green, blue)); } result.add(Color.WHITE); return result; }
From source file:in.andres.kandroid.kanboard.KanboardAPI.java
@Nullable public static Integer parseColorString(String colorstring) { try {// w ww . j av a2 s.c o m return Color.parseColor(colorstring); } catch (IllegalArgumentException e) { Pattern c = Pattern.compile("rgb *\\( *([0-9]+), *([0-9]+), *([0-9]+) *\\)"); Matcher m = c.matcher(colorstring); if (m.matches()) { return Color.rgb(Integer.valueOf(m.group(1)), // r Integer.valueOf(m.group(2)), // g Integer.valueOf(m.group(3))); // b } } return null; }
From source file:com.FluksoViz.FluksoVizActivity.java
private void make_graph_pretty(XYPlot p) { p.setDomainStep(XYStepMode.INCREMENT_BY_VAL, 56); // Reduce the number // of range labels // Plot1.setTicksPerDomainLabel(1); p.setDomainValueFormat(new DateFormat_p1()); p.setRangeStep(XYStepMode.SUBDIVIDE, 5);// Skala Y pionowa // Plot1.setRangeStep(XYStepMode.INCREMENT_BY_VAL, 1); // Plot1.setTicksPerRangeLabel(1); p.getTitleWidget().setClippingEnabled(false); p.getTitleWidget().pack();//from ww w. j ava 2s .c o m int axis_font_size = 15; int title_font_size = 15; int domain_font_size = 12; if (screen_width == 320) { axis_font_size = 12; title_font_size = 9; domain_font_size = 10; } p.getTitleWidget().getLabelPaint().setTextSize(title_font_size); p.getGraphWidget().getDomainLabelPaint().setTextSize(domain_font_size); p.getGraphWidget().getDomainLabelPaint().setColor(Color.WHITE); p.getGraphWidget().getRangeLabelPaint().setColor(Color.WHITE); p.getGraphWidget().getRangeLabelPaint().setTextSize(axis_font_size); p.getGraphWidget().getDomainOriginLabelPaint().setTextSize(domain_font_size); p.getGraphWidget().getRangeOriginLabelPaint().setTextSize(axis_font_size); p.getGraphWidget().setClippingEnabled(false); p.setDomainValueFormat(new DecimalFormat("#")); p.getLegendWidget().setVisible(false); p.getDomainLabelWidget().setVisible(false); p.getRangeLabelWidget().setVisible(false); p.getGraphWidget().getGridLinePaint().setPathEffect(new DashPathEffect(new float[] { 1, 2, 1, 2 }, 0)); p.getBackgroundPaint().setColor(Color.TRANSPARENT); p.getGraphWidget().getBackgroundPaint().setColor(Color.TRANSPARENT); p.getGraphWidget().getGridBackgroundPaint().setColor(Color.TRANSPARENT); p.setGridPadding(0, 10, 0, 0); // left top right bottom p.getGraphWidget().getGridLinePaint().setColor(Color.TRANSPARENT); if (sensor_number != 4) { p.setRangeLowerBoundary(0, BoundaryMode.GROW);// to ustawia } if (sensor_number == 4) { p.addMarker(new YValueMarker(0, "0", new XPositionMetric(-11, XLayoutStyle.ABSOLUTE_FROM_LEFT), Color.WHITE, Color.WHITE)); p.setRangeStep(XYStepMode.SUBDIVIDE, 2); p.getGraphWidget().getRangeOriginLinePaint().setAlpha(0); series1mFormat = new LineAndPointFormatter( // FAZA Color.rgb(0, 220, 0), // line color Color.rgb(0, 150, 0), // point color null); line1mFill.setShader( new LinearGradient(0, 0, 0, 200, Color.rgb(0, 200, 0), Color.BLACK, Shader.TileMode.MIRROR)); series1mFormat.getLinePaint().setStrokeWidth(4); series1mFormat.setFillPaint(line1mFill); series2mFormat = new LineAndPointFormatter( // faza 2 solar Color.rgb(200, 200, 0), // line Color.rgb(100, 100, 0), // point color null); line2mFill.setShader( new LinearGradient(0, 150, 0, 120, Color.rgb(250, 250, 0), Color.BLACK, Shader.TileMode.CLAMP)); series2mFormat.setFillDirection(FillDirection.TOP); series2mFormat.setFillPaint(line2mFill); series2mFormat.getLinePaint().setStrokeWidth(5); series3mFormat = new LineAndPointFormatter( // FAZA 3 formater Color.rgb(0, 220, 0), // line color Color.rgb(0, 150, 0), // point color null); line3mFill.setAlpha(255); line3mFill.setShader(new LinearGradient(0, 0, 0, 50, Color.BLACK, Color.BLACK, Shader.TileMode.MIRROR)); series3mFormat.getLinePaint().setStrokeWidth(7); series3mFormat.setFillPaint(line3mFill); series4mFormat = new LineAndPointFormatter(Color.rgb(0, 140, 220), // line Color.rgb(0, 120, 190), // point color null); line4mFill = new Paint(); line4mFill.setAlpha(190); line4mFill.setShader(new LinearGradient(0, 0, 0, 50, Color.BLACK, Color.BLACK, Shader.TileMode.MIRROR)); series4mFormat.getLinePaint().setStrokeWidth(5); series4mFormat.setFillPaint(line4mFill); series4mFormat.setFillDirection(FillDirection.TOP); // XYRegionFormatter region4Formatter = new // XYRegionFormatter(Color.BLUE); // series4mFormat.addRegion(new RectRegion(Double.NEGATIVE_INFINITY, // Double.POSITIVE_INFINITY, 0, -1000, "R1"), region4Formatter); } // p.setRangeLowerBoundary(0, BoundaryMode.GROW);// to ustawia // min i max // Plot1.setRangeUpperBoundary(11, BoundaryMode.FIXED); p.setRangeValueFormat(new DecimalFormat("#")); p.setBorderStyle(Plot.BorderStyle.SQUARE, null, null); p.setBorderPaint(null); p.disableAllMarkup(); // To get rid of them call disableAllMarkup(): }
From source file:com.skytree.epubtest.BookViewActivity.java
public View makeResultItem(SearchResult sr, int mode) { int inlineColor = Color.rgb(133, 105, 75); int headColor = Color.rgb(94, 61, 34); int textColor = Color.rgb(50, 40, 40); SkyLayout view = new SkyLayout(this); int itemWidth = ps(370); int itemHeight = ps(190); this.setFrame(view, 0, 0, itemWidth, itemHeight); TextView chapterLabel = null;/*from w ww. j ava 2 s. c o m*/ TextView positionLabel = null; TextView textLabel = null; Button itemButton = null; itemButton = new Button(this); itemButton.setBackgroundColor(Color.TRANSPARENT); itemButton.setOnClickListener(listener); this.setFrame(itemButton, 0, 0, itemWidth, itemHeight); if (mode == 0) { // Normal case int ci = sr.chapterIndex; String chapterText = ""; chapterText = sr.chapterTitle; String positionText = String.format("%d/%d", sr.pageIndex + 1, sr.numberOfPagesInChapter); if (chapterText == null || chapterText.isEmpty()) { chapterText = "Chapter " + ci; } if (sr.pageIndex < 0 || sr.numberOfPagesInChapter < 0) { positionText = ""; } chapterLabel = this.makeLabel(3090, chapterText, Gravity.LEFT, 15, headColor); positionLabel = this.makeLabel(3091, positionText, Gravity.LEFT, 15, headColor); textLabel = this.makeLabel(3092, sr.text, Gravity.LEFT, 15, textColor); itemButton.setId(100000 + searchResults.size()); } else if (mode == 1) { // Paused chapterLabel = this.makeLabel(3090, getString(R.string.searchmore) + "....", Gravity.CENTER, 18, headColor); // positionLabel = this.makeLabel(3091, String.format("%d/%d",sr.pageIndex+1,sr.numberOfPagesInChapter), Gravity.LEFT, 15, headColor); textLabel = this.makeLabel(3092, sr.numberOfSearched + " " + getString(R.string.searchfound) + ".", Gravity.CENTER, 16, textColor); itemButton.setId(3093); } else if (mode == 2) { // finished chapterLabel = this.makeLabel(3090, getString(R.string.searchfinished), Gravity.CENTER, 18, headColor); // positionLabel = this.makeLabel(3091, String.format("%d/%d",sr.pageIndex+1,sr.numberOfPagesInChapter), Gravity.LEFT, 15, headColor); textLabel = this.makeLabel(3092, sr.numberOfSearched + " " + getString(R.string.searchfound) + ".", Gravity.CENTER, 16, textColor); itemButton.setId(3094); } textLabel.setMaxLines(3); if (mode == 0) { this.setFrame(chapterLabel, ps(20), ps(20), ps(270), ps(30)); this.setFrame(positionLabel, itemWidth - ps(85), ps(20), ps(70), ps(30)); this.setFrame(textLabel, ps(20), ps(80), itemWidth - ps(40), itemHeight - ps(80 + 20)); } else { this.setFrame(chapterLabel, ps(20), ps(20), ps(350), ps(40)); // this.setFrame(positionLabel, itemWidth-ps(80), ps(20),ps(70),ps(30)); this.setFrame(textLabel, ps(20), ps(80), itemWidth - ps(40), itemHeight - ps(80 + 20)); } view.addView(chapterLabel); if (mode == 0) view.addView(positionLabel); view.addView(textLabel); view.addView(itemButton); RectShape crs = new RectShape(); SkyDrawable cd = new SkyDrawable(crs, Color.TRANSPARENT, inlineColor, 1); view.setBackgroundDrawable(cd); return view; }
From source file:com.skytree.epubtest.BookViewActivity.java
public void makeFontBox() { int boxColor = Color.rgb(241, 238, 229); int innerBoxColor = Color.rgb(246, 244, 239); int inlineColor = Color.rgb(133, 105, 75); int width = 450; int height = 500; fontBox = new SkyBox(this); fontBox.setBoxColor(boxColor);//w w w .ja v a 2s . c o m fontBox.setArrowHeight(ps(25)); fontBox.setArrowDirection(false); setFrame(fontBox, ps(50), ps(200), ps(width), ps(height)); ScrollView fontBoxScrollView = new ScrollView(this); this.setFrame(fontBoxScrollView, ps(5), ps(10), ps(440), ps(height - 50)); fontBox.contentView.addView(fontBoxScrollView); // NEW SkyLayout contentLayout = new SkyLayout(this); fontBoxScrollView.addView(contentLayout, new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT)); // #1 first make brightness controller // brView is the box containing the bright slider. int FY = 10; View brView = new View(this); RoundRectShape rrs = new RoundRectShape( new float[] { ps(5), ps(5), ps(5), ps(5), ps(5), ps(5), ps(5), ps(5) }, null, null); SkyDrawable srd = new SkyDrawable(rrs, innerBoxColor, inlineColor, 1); brView.setBackgroundDrawable(srd); setFrame(brView, ps(20), ps(FY), ps(width - 40), ps(53)); contentLayout.addView(brView); // darker and brighter icons int SBS = 60; ImageButton sbb = this.makeImageButton(9005, R.drawable.brightness2x, ps(SBS), ps(SBS)); setFrame(sbb, ps(50), ps(FY), ps(SBS), ps(SBS)); sbb.setAlpha(200); int BBS = 70; ImageButton bbb = this.makeImageButton(9006, R.drawable.brightness2x, ps(BBS), ps(BBS)); setFrame(bbb, ps(width - 110), ps(FY - 5), ps(BBS), ps(BBS)); bbb.setAlpha(200); contentLayout.addView(sbb); contentLayout.addView(bbb); // making bright slider brightBar = new SeekBar(this); brightBar.setMax(999); brightBar.setId(997); brightBar.setBackgroundColor(Color.TRANSPARENT); brightBar.setOnSeekBarChangeListener(new SeekBarDelegate()); brightBar.setProgressDrawable(new LineDrawable(Color.rgb(160, 160, 160), ps(10))); brightBar.setThumbOffset(-1); setFrame(brightBar, ps(100), ps(FY + 4), ps(width - 210), ps(50)); contentLayout.addView(brightBar); // #2 second make decrese/increse font size buttons // decrease font size Button int FBY = 80; decreaseButton = new Button(this); setFrame(decreaseButton, ps(20), ps(FBY), ps(width - 40 - 20) / 2, ps(60)); decreaseButton.setText(getString(R.string.chara)); decreaseButton.setGravity(Gravity.CENTER); decreaseButton.setTextSize(14); decreaseButton.setId(5000); RoundRectShape drs = new RoundRectShape( new float[] { ps(5), ps(5), ps(5), ps(5), ps(5), ps(5), ps(5), ps(5) }, null, null); SkyDrawable drd = new SkyDrawable(drs, innerBoxColor, inlineColor, 1); decreaseButton.setBackgroundDrawable(drd); decreaseButton.setOnClickListener(listener); decreaseButton.setOnTouchListener(new ButtonHighlighterOnTouchListener(decreaseButton)); contentLayout.addView(decreaseButton); // inccrease font size Button increaseButton = new Button(this); setFrame(increaseButton, ps(10 + width / 2), ps(FBY), ps(width - 40 - 20) / 2, ps(60)); increaseButton.setText(getString(R.string.chara)); increaseButton.setTextSize(18); increaseButton.setGravity(Gravity.CENTER); increaseButton.setId(5001); RoundRectShape irs = new RoundRectShape( new float[] { ps(5), ps(5), ps(5), ps(5), ps(5), ps(5), ps(5), ps(5) }, null, null); SkyDrawable ird = new SkyDrawable(irs, innerBoxColor, inlineColor, 1); increaseButton.setBackgroundDrawable(ird); increaseButton.setOnClickListener(listener); increaseButton.setOnTouchListener(new ButtonHighlighterOnTouchListener(increaseButton)); contentLayout.addView(increaseButton); // # 3 make the button to increase/decrese line spacing. int LBY = 145; // deccrease line space Button decreaseLineSpaceButton = this.makeImageButton(9005, R.drawable.decline2x, ps(30), ps(30)); setFrame(decreaseLineSpaceButton, ps(20), ps(LBY), ps(width - 40 - 20) / 2, ps(60)); decreaseLineSpaceButton.setId(4000); drs = new RoundRectShape(new float[] { ps(5), ps(5), ps(5), ps(5), ps(5), ps(5), ps(5), ps(5) }, null, null); drd = new SkyDrawable(drs, innerBoxColor, inlineColor, 1); decreaseLineSpaceButton.setBackgroundDrawable(drd); decreaseLineSpaceButton.setOnClickListener(listener); decreaseLineSpaceButton .setOnTouchListener(new ImageButtonHighlighterOnTouchListener(decreaseLineSpaceButton)); contentLayout.addView(decreaseLineSpaceButton); // inccrease line space Button increaseLineSpaceButton = this.makeImageButton(9005, R.drawable.incline2x, ps(30), ps(30)); setFrame(increaseLineSpaceButton, ps(10 + width / 2), ps(LBY), ps(width - 40 - 20) / 2, ps(60)); increaseLineSpaceButton.setId(4001); irs = new RoundRectShape(new float[] { ps(5), ps(5), ps(5), ps(5), ps(5), ps(5), ps(5), ps(5) }, null, null); ird = new SkyDrawable(irs, innerBoxColor, inlineColor, 1); increaseLineSpaceButton.setBackgroundDrawable(ird); increaseLineSpaceButton.setOnClickListener(listener); increaseLineSpaceButton .setOnTouchListener(new ImageButtonHighlighterOnTouchListener(increaseLineSpaceButton)); contentLayout.addView(increaseLineSpaceButton); // #4 make themes selector. int TY = 220; int TH = 70; int TW = (width - 40 - 20) / 3; HorizontalScrollView themeScrollView = new HorizontalScrollView(this); themesView = new LinearLayout(this); themesView.setOrientation(LinearLayout.HORIZONTAL); themeScrollView.addView(themesView, new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT)); for (int i = 0; i < this.themes.size(); i++) { Theme theme = themes.get(i); Button themeButton = new Button(this); LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(ps(TW), ps(TH)); layoutParams.setMargins(0, 0, 24, 0); themesView.addView(themeButton, layoutParams); RoundRectShape rs = new RoundRectShape( new float[] { ps(5), ps(5), ps(5), ps(5), ps(5), ps(5), ps(5), ps(5) }, null, null); SkyDrawable brd = new SkyDrawable(rs, theme.backgroundColor, Color.BLACK, 1); themeButton.setBackgroundDrawable(brd); themeButton.setText(theme.name); themeButton.setTextColor(theme.foregroundColor); themeButton.setId(7000 + i); themeButton.setOnClickListener(listener); } this.setFrame(themeScrollView, ps(20), ps(TY), ps(width - 40), ps(90)); contentLayout.addView(themeScrollView); // #5 font list box int SY = 310; int fontButtonHeight = 80; int fontListHeight; fontListHeight = fontButtonHeight * fonts.size(); fontListView = new LinearLayout(this); fontListView.setOrientation(LinearLayout.VERTICAL); contentLayout.addView(fontListView); this.setFrame(fontListView, ps(20), ps(SY), ps(width - 40), ps(fontListHeight)); int inlineColor2 = Color.argb(140, 133, 105, 75); for (int i = 0; i < fonts.size(); i++) { CustomFont customFont = fonts.get(i); Button fontButton = new Button(this); fontButton.setText(customFont.fontFaceName); fontButton.setTextSize(20); Typeface tf = null; if (customFont.fontFileName == null || customFont.fontFileName.isEmpty()) { tf = this.getTypeface(customFont.fontFaceName, Typeface.BOLD); } else { tf = Typeface.createFromAsset(getAssets(), "fonts/" + customFont.fontFileName); } if (tf != null) fontButton.setTypeface(tf); fontButton.setId(5100 + i); RoundRectShape rs = new RoundRectShape( new float[] { ps(5), ps(5), ps(5), ps(5), ps(5), ps(5), ps(5), ps(5) }, null, null); SkyDrawable brd = new SkyDrawable(rs, innerBoxColor, inlineColor2, 1); fontButton.setBackgroundDrawable(brd); this.setFrame(fontButton, ps(0), ps(0), ps(width - 40), ps(fontButtonHeight)); fontListView.addView(fontButton); fontButton.setOnClickListener(listener); fontButton.setOnTouchListener(new ButtonHighlighterOnTouchListener(fontButton)); } this.ePubView.addView(fontBox); this.hideFontBox(); }
From source file:org.telegram.ui.ProfileActivity.java
public void setAnimationProgress(float progress) { animationProgress = progress;/*from w w w . j a v a 2 s.c o m*/ listView.setAlpha(progress); listView.setTranslationX(AndroidUtilities.dp(48) - AndroidUtilities.dp(48) * progress); int color = AvatarDrawable.getProfileBackColorForId( user_id != 0 || ChatObject.isChannel(chat_id) && !currentChat.megagroup ? 5 : chat_id); int r = Color.red(Theme.ACTION_BAR_COLOR); int g = Color.green(Theme.ACTION_BAR_COLOR); int b = Color.blue(Theme.ACTION_BAR_COLOR); int rD = (int) ((Color.red(color) - r) * progress); int gD = (int) ((Color.green(color) - g) * progress); int bD = (int) ((Color.blue(color) - b) * progress); topView.setBackgroundColor(Color.rgb(r + rD, g + gD, b + bD)); color = AvatarDrawable.getProfileTextColorForId( user_id != 0 || ChatObject.isChannel(chat_id) && !currentChat.megagroup ? 5 : chat_id); r = Color.red(Theme.ACTION_BAR_SUBTITLE_COLOR); g = Color.green(Theme.ACTION_BAR_SUBTITLE_COLOR); b = Color.blue(Theme.ACTION_BAR_SUBTITLE_COLOR); rD = (int) ((Color.red(color) - r) * progress); gD = (int) ((Color.green(color) - g) * progress); bD = (int) ((Color.blue(color) - b) * progress); for (int a = 0; a < 2; a++) { if (onlineTextView[a] == null) { continue; } onlineTextView[a].setTextColor(Color.rgb(r + rD, g + gD, b + bD)); } extraHeight = (int) (initialAnimationExtraHeight * progress); color = AvatarDrawable.getProfileColorForId(user_id != 0 ? user_id : chat_id); int color2 = AvatarDrawable.getColorForId(user_id != 0 ? user_id : chat_id); if (color != color2) { rD = (int) ((Color.red(color) - Color.red(color2)) * progress); gD = (int) ((Color.green(color) - Color.green(color2)) * progress); bD = (int) ((Color.blue(color) - Color.blue(color2)) * progress); avatarDrawable .setColor(Color.rgb(Color.red(color2) + rD, Color.green(color2) + gD, Color.blue(color2) + bD)); avatarImage.invalidate(); } needLayout(); }
From source file:com.bookkos.bircle.CaptureActivity.java
private void setHelpView() { int helpViewButton_width = displayWidth / 5; int helpViewButton_height = displayHeight / 16; helpViewButton.setText(""); helpViewButton.setTextSize(textSize * 7 / 10); helpViewButton.setBackgroundColor(Color.rgb(230, 126, 34)); helpViewButton.setLayoutParams(/*from w w w. ja v a 2 s.c o m*/ new FrameLayout.LayoutParams(helpViewButton_width, helpViewButton_height, Gravity.BOTTOM)); helpViewButton.setTranslationX(displayWidth - helpViewButton_width * 1.3f); helpViewFlag = false; /* * helpViewButton??, ???View???? * animateTranslationY?View????, ???????? * ?????, titleBarHeight / 4 ??????????? */ helpViewButton.setOnClickListener(new OnClickListener() { public void onClick(View v) { if (helpViewFlag == true) { animateTranslationY(registHelpView, titleBarHeight / 4, displayHeight / 5 + titleBarHeight); animateTranslationY(returnBorrowHelpView, titleBarHeight / 4, displayHeight / 5 + titleBarHeight); animateTranslationY(helpViewButton, -displayHeight / 5 + (titleBarHeight / 3), 0); helpViewButton.setText(""); helpViewFlag = false; } else if (helpViewFlag == false) { animateTranslationY(registHelpView, displayHeight / 5 + titleBarHeight, titleBarHeight / 4); animateTranslationY(returnBorrowHelpView, displayHeight / 5 + titleBarHeight, titleBarHeight / 4); animateTranslationY(helpViewButton, 0, -displayHeight / 5 + (titleBarHeight / 3)); helpViewButton.setText("?"); helpViewFlag = true; } } }); }