public void drawCircleOnDyn(Point2D point2D, float azimuth, double q) { if (point2D.getX() == 0 || point2D.getY() == 0) { MyApplication.getInstance().showInfo("定位点为空"); return; } m_locateDynamicView.removeElement(m_LocationID); m_locateDynamicView.removeElement(m_LocationPolygonID); // 构造精度范围 if (q == 0) { q = 60; } GeoCircle geoCircle = new GeoCircle(point2D, q); GeoRegion geoRegion = geoCircle.convertToRegion(50 * 4); // 绘制精度范围 DynamicPolygon dynPolygon = new DynamicPolygon(); dynPolygon.fromGeometry(geoRegion); DynamicStyle style = new DynamicStyle(); style.setBackColor(android.graphics.Color.rgb(128, 128, 255)); style.setLineColor(android.graphics.Color.rgb(128, 255, 255)); // 224, 224, 224 style.setAlpha(65); // 95 // style.setSize(3.0f);//6.0f dynPolygon.setStyle(style); m_locateDynamicView.addElement(dynPolygon); m_LocationPolygonID = dynPolygon.getID(); drawPoint(point2D, azimuth); }
public void findPath(int indexPOI) { m_locServicePoint = new LocPoint(0, 0, Color.rgb(240, 20, 20)); m_LocServiceLine = new LocLine(10, 0, 100, 0, Color.rgb(240, 20, 20)); m_map.addDrawable(m_locServicePoint, 3); m_map.addDrawable(m_LocServiceLine, 3); m_path = m_map.findPath(indexPOI); }
public void handle() { if (AdViewTargeting.getRunMode() == RunMode.TEST) Log.d(AdViewUtil.ADVIEW, "Into Wooboo"); AdViewLayout adViewLayout = adViewLayoutReference.get(); if (adViewLayout == null) { return; } Extra extra = adViewLayout.extra; int bgColor = Color.rgb(extra.bgRed, extra.bgGreen, extra.bgBlue); int fgColor = Color.rgb(extra.fgRed, extra.fgGreen, extra.fgBlue); WoobooAdView adView = null; if (AdViewTargeting.getRunMode() == RunMode.TEST) adView = new WoobooAdView( adViewLayout.getContext(), ration.key, bgColor, fgColor, true, 120, null); else if (AdViewTargeting.getRunMode() == RunMode.NORMAL) adView = new WoobooAdView( adViewLayout.getContext(), ration.key, bgColor, fgColor, false, 120, null); else { adView = new WoobooAdView( adViewLayout.getContext(), ration.key, bgColor, fgColor, false, 120, null); } adView.setHorizontalScrollBarEnabled(false); adView.setVerticalScrollBarEnabled(false); adView.setAdListener(this); // adViewLayout.adViewManager.resetRollover(); // adViewLayout.handler.post(new ViewAdRunnable(adViewLayout, adView)); // adViewLayout.rotateThreadedDelayed(); }
private void addTableRow(TableLayout table, String parameter, String value) { TableRow row = new TableRow(table.getContext()); TableRow.LayoutParams trParams = new TableRow.LayoutParams(); trParams.setMargins(2, 2, 2, 1); row.setLayoutParams(trParams); row.setBackgroundColor(Color.rgb(0x00, 0x00, 0x00)); TextView text1 = new TextView(row.getContext()); text1.setTextSize(18); text1.setText(parameter); text1.setBackgroundColor(Color.rgb(0x18, 0x18, 0x18)); text1.setLayoutParams(trParams); text1.setPadding(5, 0, 0, 0); row.addView(text1); TextView text2 = new TextView(row.getContext()); text2.setTextSize(18); text2.setText(value); text2.setBackgroundColor(Color.rgb(0x18, 0x18, 0x18)); text2.setLayoutParams(trParams); text2.setPadding(5, 0, 0, 0); row.addView(text2); table.addView(row); }
@Override public View getView(int position, View convertView, ViewGroup parent) { ViewHolder holder1; if (convertView == null) { holder1 = new ViewHolder(); convertView = LayoutInflater.from(context) .inflate(R.layout.common_views_popup_window_item, parent, false); convertView.setBackgroundResource(R.drawable.popup_window_left_item_bg); holder1.tvName = (TextView) convertView.findViewById(R.id.popup_window_item_name_tv); holder1.vDivider = convertView.findViewById(R.id.popup_window_item_divider); convertView.setTag(holder1); } else { holder1 = (ViewHolder) convertView.getTag(); } // TextView tvName = (TextView) convertView.findViewById(R.id.popup_window_item_name_tv); holder1.tvName.setBackgroundResource(R.drawable.popup_window_left_item_bg); // 设置左侧List 点击效果 // View vDivider = convertView.findViewById(R.id.shop_sort_item_divider); holder1.vDivider.setVisibility(View.GONE); String sortName = (String) getItem(position); // if (position == curPositionLeft) { holder1.tvName.setBackgroundColor(Color.rgb(0xff, 0xff, 0xff)); // vDivider.setBackgroundColor(Color.rgb(235, 65, 62)); } else { holder1.tvName.setBackgroundColor(Color.rgb(0xf0, 0xf0, 0xf0)); // vDivider.setBackgroundColor(Color.rgb(217, 217, 217)); } holder1.tvName.setText(sortName); return convertView; }
private void addData() { ArrayList<BarEntry> yVals1 = new ArrayList<BarEntry>(); for (int i = 0; i < yData.length; i++) yVals1.add(new BarEntry(yData[i], i)); ArrayList<String> xVals = new ArrayList<String>(); for (int i = 0; i < xData.length; i++) xVals.add(xData[i]); // create pie data set BarDataSet dataSet = new BarDataSet(yVals1, "Stock"); // dataSet.setSliceSpace(5); // dataSet.setSelectionShift(5); // add many colors ArrayList<Integer> colors = new ArrayList<Integer>(); colors.add(Color.rgb(0, 204, 68)); colors.add(Color.rgb(230, 0, 0)); dataSet.setColors(colors); // instantiate pie data object BarData data = new BarData(xVals, dataSet); data.setValueTextSize(16); data.setValueTextColor(Color.BLACK); mChart.setData(data); // undo highlights mChart.highlightValue(null); // update pie chart mChart.invalidate(); }
private void chartDataSet() { // 标签对应的柱形数据集 List<Double> dataSeriesA = new LinkedList<Double>(); dataSeriesA.add(2400d); dataSeriesA.add(2400d); dataSeriesA.add(2400d); dataSeriesA.add(2400d); dataSeriesA.add(2400d); BarData BarDataA = new BarData("流动资产", dataSeriesA, Color.rgb(58, 191, 247)); List<Double> dataSeriesB = new LinkedList<Double>(); dataSeriesB.add(2000d); dataSeriesB.add(2000d); dataSeriesB.add(2000d); dataSeriesB.add(2000d); dataSeriesB.add(2000d); BarData BarDataB = new BarData("非流动资产", dataSeriesB, Color.rgb(20, 181, 251)); chartData.add(BarDataA); chartData.add(BarDataB); List<Double> dataSeriesAA = new LinkedList<Double>(); dataSeriesAA.add(0d); BarData BarDataAA = new BarData("负债", dataSeriesAA, Color.rgb(38, 137, 176)); List<Double> dataSeriesBB = new LinkedList<Double>(); dataSeriesBB.add(0d); BarData BarDataBB = new BarData("所有者权益", dataSeriesBB, Color.rgb(13, 116, 161)); chartData.add(BarDataAA); chartData.add(BarDataBB); }
public CenterOffsetView(Context context, AttributeSet attrs) { super(context, attrs); // TODO: not doing anything with the XML properties yet. emptyCirclePaint = new Paint(Paint.ANTI_ALIAS_FLAG); emptyCirclePaint.setColor(Color.rgb(63, 63, 63)); emptyCirclePaint.setStrokeWidth(0); emptyCirclePaint.setStyle(Paint.Style.STROKE); filledRedCirclePaint = new Paint(Paint.ANTI_ALIAS_FLAG); filledRedCirclePaint.setColor(Color.rgb(200, 0, 0)); filledRedCirclePaint.setStyle(Paint.Style.FILL); filledGreenCirclePaint = new Paint(Paint.ANTI_ALIAS_FLAG); filledGreenCirclePaint.setColor(Color.rgb(40, 255, 40)); filledGreenCirclePaint.setStyle(Paint.Style.FILL); centAnnotationPaint = new Paint(); centAnnotationPaint.setColor(Color.rgb(255, 255, 255)); centAnnotationPaint.setTextSize((int) (kHeight * 0.8)); centAnnotationPaint.setTextAlign(Paint.Align.CENTER); markPaint = new Paint(Paint.ANTI_ALIAS_FLAG); markPaint.setColor(Color.rgb(200, 0, 0)); markPaint.setStrokeWidth(5); setRange(25); setMarkAt(20); setQuantization(2.5f); setValue(0); setDataValid(true); }
/** * Adds the lat lng points returned from the query to the map. * * @param heatmap The Heatmap object encapsulating data returned from the server */ private void addPointsToMapWithWeight(Heatmap heatmap) { ArrayList<WeightedLatLng> list = new ArrayList<WeightedLatLng>(); for (Heatmap.Response response : heatmap.response) { int weight = response.weight * response.value / 10; list.add( new WeightedLatLng( new LatLng(response.loc.coordinates[1], response.loc.coordinates[0]), weight)); // System.out.println("Adding " + response.loc.coordinates[1] + ", " + // response.loc.coordinates[0] + ": " + weight); } HeatmapTileProvider mProvider; if (heatmap.positive) { mProvider = new HeatmapTileProvider.Builder() .weightedData(list) .radius(RADIUS) .opacity(OPACITY) .build(); } else { int[] colors = { Color.rgb(0, 235, 255), // blue Color.rgb(175, 0, 255) // violet }; float[] startPoints = {0.2f, 1f}; Gradient gradient = new Gradient(colors, startPoints); mProvider = new HeatmapTileProvider.Builder() .weightedData(list) .radius(RADIUS) .opacity(OPACITY) .gradient(gradient) .build(); } mGoogleMap.addTileOverlay(new TileOverlayOptions().tileProvider(mProvider)).setZIndex(10); }
private void addHeatMap() { // ArrayList of type LatLng required for HeatmapTileProvider ArrayList<LatLng> locList = new ArrayList<LatLng>() {}; for (int i = 0; i < parkedCarLocations.size(); i++) { locList.add( new LatLng( parkedCarLocations.get(i).getLatitude(), parkedCarLocations.get(i).getLongitude())); } // Parameters for heat map customization (Gradient) int[] colors = {Color.rgb(102, 225, 0), Color.rgb(255, 0, 0)}; float[] startingPoints = {0.2f, 1f}; Gradient gradient = new Gradient(colors, startingPoints); // Setting up the overlay that will be added to the map HeatmapTileProvider mProvider = new HeatmapTileProvider.Builder().data(locList).gradient(gradient).build(); TileOverlay mOverlay = map.addTileOverlay(new TileOverlayOptions().tileProvider(mProvider)); }
@Override public View getView(int position, View convertView, ViewGroup parent) { ViewHolder holder2; if (convertView == null) { holder2 = new ViewHolder(); convertView = LayoutInflater.from(context) .inflate(R.layout.common_views_popup_window_item, parent, false); holder2.tvName = (TextView) convertView.findViewById(R.id.popup_window_item_name_tv); holder2.vDivider = convertView.findViewById(R.id.popup_window_item_divider); convertView.setTag(holder2); } else { holder2 = (ViewHolder) convertView.getTag(); } // TextView tvName = (TextView) convertView.findViewById(R.id.popup_window_item_name_tv); // // tvName.setBackgroundResource(R.drawable.popup_window_left_item_bg);//设置左侧List 点击效果 // View vDivider = convertView.findViewById(R.id.popup_window_item_divider); String sortName = (String) getItem(position); // if (position == curPositionRight && curNameRight.equals(sortName) /* * &&! * leftPositionIsChange */) { // isFirstInRight=false; holder2.tvName.setTextColor(Color.rgb(235, 65, 62)); holder2.vDivider.setBackgroundColor(Color.rgb(235, 65, 62)); } else { holder2.tvName.setTextColor(Color.rgb(50, 50, 50)); holder2.vDivider.setBackgroundColor(Color.rgb(217, 217, 217)); } holder2.tvName.setText(sortName); return convertView; }
private void setData(int start, int count, float range) { ArrayList<String> xVals = new ArrayList<String>(); for (int i = 0; i < count; i++) { xVals.add((start + i) + "日"); } ArrayList<Entry> vals1 = new ArrayList<Entry>(); for (int i = 0; i < count; i++) { vals1.add(new Entry(TurnControl.PunchPerDay[9 - i], i)); } // create a dataset and give it a type LineDataSet set1 = new LineDataSet(vals1, "近期打卡情况"); set1.setDrawCubic(true); set1.setCubicIntensity(0.2f); set1.setDrawFilled(true); set1.setDrawCircles(true); set1.setLineWidth(2f); set1.setCircleSize(5f); set1.setHighLightColor(Color.rgb(244, 117, 117)); set1.setColor(Color.rgb(104, 241, 175)); set1.setFillColor(ColorTemplate.getHoloBlue()); // create a data object with the datasets LineData data = new LineData(xVals, set1); data.setValueTypeface(tf); data.setValueTextSize(9f); data.setDrawValues(false); // set data mChart.setData(data); }
@SuppressWarnings("deprecation") public void drawGraph( XYPlot plot, List<Number> xseries, List<Number> yseries, String datatitle, String title) { // Log.d(SystemInfo.TIG, TAG + "::drawGraph()"); // set up data series plot.removeSeries(series); series = new SimpleXYSeries(xseries, yseries, datatitle); // create a formatter // TODO solve deprecation waring LineAndPointFormatter format = new LineAndPointFormatter( Color.rgb(0, 200, 0) // line color , Color.rgb(0, 100, 0) // point color , Color.rgb(150, 190, 150)); // fill color (optional) // add series1 and series2 to the XYPlot plot.addSeries(series, format); // Reduce the number of range labels plot.setTicksPerRangeLabel(3); plot.getBackgroundPaint().setAlpha(0); plot.getGraphWidget().getBackgroundPaint().setAlpha(0); plot.getGraphWidget().getGridBackgroundPaint().setAlpha(0); // TODO implement an on-the-fly refresh of the plot // this is just a small "stubbed" redraw for demonstration purposes plot.setDomainStepMode(XYStepMode.SUBDIVIDE); plot.setDomainStepValue(1); plot.setGridPadding(0, 5, 0, 5); plot.setDomainLabel("Time [s]"); if (title.equals(SystemInfo.DB_TABLENAME_BATTERY)) { plot.setTitle(SystemInfo.DB_TABLENAME_BATTERY); plot.setRangeLabel("[%]"); plot.setRangeBoundaries(0, 100, BoundaryMode.FIXED); } else if (title.equals(SystemInfo.DB_TABLENAME_WIFI)) { plot.setTitle(SystemInfo.DB_TABLENAME_WIFI); plot.setRangeLabel("[~mW]"); plot.setRangeBoundaries(0, 500, BoundaryMode.FIXED); } else if (title.equals(SystemInfo.DB_TABLENAME_THREEG)) { plot.setTitle(SystemInfo.DB_TABLENAME_THREEG); plot.setRangeLabel("[~mW]"); plot.setRangeBoundaries(0, 500, BoundaryMode.FIXED); } else if (title.equals(SystemInfo.DB_TABLENAME_BLUETOOTH)) { plot.setTitle(SystemInfo.DB_TABLENAME_BLUETOOTH); plot.setRangeLabel("[~mW]"); plot.setRangeBoundaries(0, 500, BoundaryMode.FIXED); // XXX scale } plot.redraw(); }
@Override public void onSurfaceCreated(GL10 glUnused, EGLConfig config) { glClearColor(0.0f, 0.0f, 0.0f, 0.0f); glEnable(GL_DEPTH_TEST); glEnable(GL_CULL_FACE); heightmapProgram = new HeightmapShaderProgram(context); heightmap = new Heightmap( ((BitmapDrawable) context.getResources().getDrawable(R.drawable.heightmap)) .getBitmap()); skyboxProgram = new SkyboxShaderProgram(context); skybox = new Skybox(); particleProgram = new ParticleShaderProgram(context); particleSystem = new ParticleSystem(10000); globalStartTime = System.nanoTime(); final Vector particleDirection = new Vector(0f, 0.5f, 0f); final float angleVarianceInDegrees = 5f; final float speedVariance = 1f; redParticleShooter = new ParticleShooter( new Point(-1f, 0f, 0f), particleDirection, Color.rgb(255, 50, 5), angleVarianceInDegrees, speedVariance); greenParticleShooter = new ParticleShooter( new Point(0f, 0f, 0f), particleDirection, Color.rgb(25, 255, 25), angleVarianceInDegrees, speedVariance); blueParticleShooter = new ParticleShooter( new Point(1f, 0f, 0f), particleDirection, Color.rgb(5, 50, 255), angleVarianceInDegrees, speedVariance); particleTexture = TextureHelper.loadTexture(context, R.drawable.particle_texture); skyboxTexture = TextureHelper.loadCubeMap( context, new int[] { R.drawable.left, R.drawable.right, R.drawable.bottom, R.drawable.top, R.drawable.front, R.drawable.back }); }
@Override public void onClick(View v) { Intent i; EditText textBox = (EditText) findViewById(R.id.editTextPkmName); InputMethodManager imm = (InputMethodManager) getSystemService(QuestionActivity.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(textBox.getWindowToken(), 0); SharedPreferences settings = getSharedPreferences(Constants.SETTINGS, 0); int dificult = settings.getInt(Constants.DIFFICULTY, 2); switch (v.getId()) { case R.id.btnCheck: String pkmName = textBox.getText().toString().toLowerCase().trim(); if (pkmName.length() == 0) return; Log.d("Pokemon ans", pkmName); Log.d("Pokemon", pokemon.getName()); TextView txtAnswer = (TextView) findViewById(R.id.txtAnswer); if (pkmName.compareTo(pokemon.getName().toLowerCase()) == 0) { txtAnswer.setText("Correct"); txtAnswer.setTextColor(Color.rgb(0, 200, 0)); ImageView imgPkm = (ImageView) findViewById(R.id.imgPokemon); int pkmImgId = getResources() .getIdentifier( pokemon.getImage1() + "_1", "drawable", getBaseContext().getPackageName()); imgPkm.setImageResource(pkmImgId); if (dificult > pokemon.getResp()) { updateRespPokemonFromDb(dificult, pokemon.getNumber()); } } else { txtAnswer.setText("Wrong\nTry again"); txtAnswer.setTextColor(Color.rgb(200, 0, 0)); } LinearLayout rl1 = (LinearLayout) findViewById(R.id.QuestLayout); rl1.setVisibility(View.INVISIBLE); LinearLayout rl2 = (LinearLayout) findViewById(R.id.ansLayout); rl2.setVisibility(View.VISIBLE); break; case R.id.btnBack: case R.id.btnNext: i = new Intent(this, PokemonSelectActivity.class); startActivityForResult(i, Constants.PLAYBUTTON); finish(); break; } }
public PaintableBoxedText(String txtInit, float fontSizeInit, float maxWidth) { this( txtInit, fontSizeInit, maxWidth, Color.rgb(255, 255, 255), Color.argb(128, 0, 0, 0), Color.rgb(255, 255, 255)); }
@Override public void onCreate(Bundle savedInstanceState) { // android boilerplate stuff super.onCreate(savedInstanceState); setContentView(R.layout.dynamicxyplot_example); // get handles to our View defined in layout.xml: dynamicPlot = (XYPlot) findViewById(R.id.dynamicXYPlot); plotUpdater = new MyPlotUpdater(dynamicPlot); // only display whole numbers in domain labels dynamicPlot.getGraphWidget().setDomainValueFormat(new DecimalFormat("0")); // getInstance and position datasets: data = new SampleDynamicXYDatasource(); SampleDynamicSeries sine1Series = new SampleDynamicSeries(data, 0, "Sine 1"); SampleDynamicSeries sine2Series = new SampleDynamicSeries(data, 1, "Sine 2"); LineAndPointFormatter formatter1 = new LineAndPointFormatter(Color.rgb(0, 0, 0), null, null, null); formatter1.getLinePaint().setStrokeJoin(Paint.Join.ROUND); formatter1.getLinePaint().setStrokeWidth(10); dynamicPlot.addSeries(sine1Series, formatter1); LineAndPointFormatter formatter2 = new LineAndPointFormatter(Color.rgb(0, 0, 200), null, null, null); formatter2.getLinePaint().setStrokeWidth(10); formatter2.getLinePaint().setStrokeJoin(Paint.Join.ROUND); // formatter2.getFillPaint().setAlpha(220); dynamicPlot.addSeries(sine2Series, formatter2); // hook up the plotUpdater to the data model: data.addObserver(plotUpdater); // thin out domain tick labels so they dont overlap each other: dynamicPlot.setDomainStepMode(XYStepMode.INCREMENT_BY_VAL); dynamicPlot.setDomainStepValue(5); dynamicPlot.setRangeStepMode(XYStepMode.INCREMENT_BY_VAL); dynamicPlot.setRangeStepValue(10); dynamicPlot.setRangeValueFormat(new DecimalFormat("###.#")); // uncomment this line to freeze the range boundaries: dynamicPlot.setRangeBoundaries(-100, 100, BoundaryMode.FIXED); // create a dash effect for domain and range grid lines: DashPathEffect dashFx = new DashPathEffect(new float[] {PixelUtils.dpToPix(3), PixelUtils.dpToPix(3)}, 0); dynamicPlot.getGraphWidget().getDomainGridLinePaint().setPathEffect(dashFx); dynamicPlot.getGraphWidget().getRangeGridLinePaint().setPathEffect(dashFx); }
public static Map<Integer, Button> getAllColorButton(RelativeLayout colorPanelLayout) { Map<Integer, Button> buttonMap = new HashMap<Integer, Button>(); buttonMap.put( Color.rgb(230, 0, 18), (Button) colorPanelLayout.findViewById(R.id.draw_panel_pen_color_red_button)); buttonMap.put( Color.rgb(248, 182, 45), (Button) colorPanelLayout.findViewById(R.id.draw_panel_pen_color_croci_button)); buttonMap.put( Color.rgb(250, 230, 0), (Button) colorPanelLayout.findViewById(R.id.draw_panel_pen_color_yellow_button)); buttonMap.put( Color.rgb(0, 154, 62), (Button) colorPanelLayout.findViewById(R.id.draw_panel_pen_color_green_button)); buttonMap.put( Color.rgb(46, 167, 224), (Button) colorPanelLayout.findViewById(R.id.draw_panel_pen_color_blue_button)); buttonMap.put( Color.rgb(126, 49, 142), (Button) colorPanelLayout.findViewById(R.id.draw_panel_pen_color_purple_button)); buttonMap.put( Color.rgb(181, 181, 182), (Button) colorPanelLayout.findViewById(R.id.draw_panel_pen_color_gray_button)); buttonMap.put( Color.rgb(255, 255, 255), (Button) colorPanelLayout.findViewById(R.id.draw_panel_pen_color_white_button)); buttonMap.put( Color.rgb(0, 0, 0), (Button) colorPanelLayout.findViewById(R.id.draw_panel_pen_color_black_button)); return buttonMap; }
private void setup() { if (!mReady) { mSetupPending = true; return; } if (mBitmap == null) { return; } mBitmapShader = new BitmapShader(mBitmap, Shader.TileMode.CLAMP, Shader.TileMode.CLAMP); mBitmapPaint.setAntiAlias(true); mBitmapPaint.setShader(mBitmapShader); mBorderPaint.setStyle(Paint.Style.STROKE); mBorderPaint.setAntiAlias(true); mBorderPaint.setColor(mBorderColor); mBorderPaint.setStrokeWidth(mBorderWidth); mBitmapHeight = mBitmap.getHeight(); mBitmapWidth = mBitmap.getWidth(); mBorderRect.set(0, 0, getWidth(), getHeight()); mBorderRadius = Math.min( (mBorderRect.height() - mBorderWidth) / 2, (mBorderRect.width() - mBorderWidth) / 2); mDrawableRect.set( mBorderWidth, mBorderWidth, mBorderRect.width() - mBorderWidth, mBorderRect.height() - mBorderWidth); mDrawableRadius = Math.min(mDrawableRect.height() / 2, mDrawableRect.width() / 2); mFlagBackgroundPaint.setColor(Color.BLACK & 0x66FFFFFF); mFlagBackgroundPaint.setFlags(TextPaint.ANTI_ALIAS_FLAG); mFlagTextPaint.setFlags(TextPaint.ANTI_ALIAS_FLAG); mFlagTextPaint.setTextAlign(Align.CENTER); mFlagTextPaint.setColor(Color.WHITE); mFlagTextPaint.setTextSize(getResources().getDisplayMetrics().density * 18); mSweepGradient = new SweepGradient( getWidth() / 2, getHeight() / 2, new int[] {Color.rgb(255, 255, 255), Color.rgb(1, 209, 255)}, null); mBorderPaint.setShader(mSweepGradient); updateShaderMatrix(); invalidate(); }
private void initpaints() { barPaint = new Paint(Paint.ANTI_ALIAS_FLAG); barPaint.setStyle(Paint.Style.FILL); barPaint.setColor(Color.rgb(0, 0, 0)); barPaint.setAntiAlias(true); backgroundPaint = new Paint(Paint.ANTI_ALIAS_FLAG); backgroundPaint.setStyle(Paint.Style.FILL); backgroundPaint.setColor(Color.rgb(255, 255, 255)); backgroundPaint.setAntiAlias(true); }
@Override public View getView(int position, View convertView, ViewGroup parent) { // TODO Auto-generated method stub ViewHolder holder; // TODO Auto-generated method stub- if (convertView == null) { holder = new ViewHolder(); convertView = mInflater.inflate(R.layout.alubumlistviewitem, null); holder.imageview = (NetworkImageView) convertView.findViewById(R.id.albumlistviewitemImageview); holder.imageview.setImageResource(R.drawable.multi_user_icon); holder.textview = (TextView) convertView.findViewById(R.id.albumlistviewitemTextView); holder.photocount = (TextView) convertView.findViewById(R.id.photocount); holder.textview.setTypeface(HelveticaLTStd_Light); holder.photocount.setTypeface(HelveticaLTStd_Light); holder.textview.setTextColor(Color.rgb(105, 105, 105)); holder.photocount.setTextColor(Color.rgb(153, 153, 153)); // holder.alubumitemimageViewParent = // (RelativeLayout)convertView.findViewById(R.id.alubumitemimageViewParent); convertView.setTag(holder); } else { holder = (ViewHolder) convertView.getTag(); holder.imageview.setImageResource(R.drawable.multi_user_icon); } holder.textview.setId(position); holder.imageview.setId(position); holder.photocount.setId(position); // holder.alubumitemimageViewParent.setId(position); // holder.imageview.setLayoutParams(params); holder.photocount.setText("" + getItem(position).getPhotoCount() + " Photos"); holder.textview.setText("" + getItem(position).getAlubumName()); holder.imageview.setImageResource(R.drawable.multi_user_icon); // holder.imageview.setImageUrl(getItem(position).getPickUrl(), // imageLoader,"AlubumLisView",AlbumListView.this); holder.imageview.setImageUrl(getItem(position).getPickUrl(), imageLoader); // if (getItem(position).getmBitmap()!=null) // { // // // holder.mProgressBar.setVisibility(View.GONE); // holder.imageview.setImageBitmap( // Bitmap.createScaledBitmap(getItem(position).getmBitmap(), // imageHeigthAndWidth[1], imageHeigthAndWidth[0], false)); // } // else // { // // } return convertView; }
private void createMenu(SwipeMenu menu) { SwipeMenuItem item1 = new SwipeMenuItem(getActivity().getApplicationContext()); item1.setBackground(new ColorDrawable(Color.rgb(0xE5, 0x18, 0x5E))); item1.setWidth(dp2px(90)); item1.setIcon(R.drawable.ic_action_share); menu.addMenuItem(item1); SwipeMenuItem item2 = new SwipeMenuItem(getActivity().getApplicationContext()); item2.setBackground(new ColorDrawable(Color.rgb(0xE5, 0xE0, 0x3F))); item2.setWidth(dp2px(90)); item2.setIcon(R.drawable.ic_action_important); menu.addMenuItem(item2); }
public Paint getDefaultFacePaint() { final Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG); paint.setShader( new RadialGradient( 0.5f, 0.5f, mFaceRect.width() / 2, new int[] {Color.rgb(50, 132, 206), Color.rgb(36, 89, 162), Color.rgb(27, 59, 131)}, new float[] {0.5f, 0.96f, 0.99f}, TileMode.MIRROR)); return paint; }
public ObsBall(int x, int y, int Rad, int sideDiff, int type) { this.x = x; this.y = y; this.rad = Rad; this.sideDiff = sideDiff; this.type = type; // hero 위치에 이만큼을 더해서, 그 범위 내에서는 장애물 생성 안되게 막으려고 offsetFromHero = Rad * 25; // 속도 조절 speed[0] = MainActivity.unitSpeed * 4; speed[1] = (int) (MainActivity.unitSpeed * 8); speed[2] = (int) (MainActivity.unitSpeed * 12); idx_speed = 0; // vx 정하기. vx = speed[idx_speed]; vy = speed[idx_speed]; if (Rnd.nextInt(1) == 0) vx *= -1; if (Rnd.nextInt(1) == 0) vy *= -1; // inCirclePnt = new Paint(); inCirclePnt.setAntiAlias(true); if (type == TYPE_OBSTACLE) { // 장애물 볼 red[0] = 135; green[0] = 206; blue[0] = 235; red[1] = 28; green[1] = 160; blue[1] = 217; red[2] = 16; green[2] = 94; blue[2] = 126; inCirclePnt.setColor(Color.rgb(red[idx_color], green[idx_color], blue[idx_color])); } else if (type == TYPE_ENERGY) { // 노란색 볼 inCirclePnt.setColor(Color.rgb(243, 218, 150)); } else if (type == ICE_OBSTACLE) { // 얼음 볼 inCirclePnt.setColor(Color.WHITE); } outCirclePnt = new Paint(); outCirclePnt.setAntiAlias(true); outCirclePnt.setColor(Color.BLACK); outCirclePnt.setStyle(Paint.Style.STROKE); outCirclePnt.setStrokeWidth(rad / 5); }
public void setLayoutColorSimilarToImageBackground( Bitmap bitmap) { // задание цвета для бэкграунда int pixel = bitmap.getPixel(0, 0); int redValue = Color.red(pixel); int greenValue = Color.green(pixel); int blueValue = Color.blue(pixel); if (orientation == Configuration.ORIENTATION_PORTRAIT) { linearLayout.setBackgroundColor(Color.rgb(redValue, greenValue, blueValue)); } else { relativeLayout.setBackgroundColor(Color.rgb(redValue, greenValue, blueValue)); } progressBar.setBackgroundColor(Color.rgb(redValue, greenValue, blueValue)); }
private Material getMaterialForMesh(Object3D o, String name) { Material mat = new Material(); FBXMaterial material = null; Stack<Connect> conns = mFbx.connections.connections; int num = conns.size(); String materialName = null; for (int i = 0; i < num; ++i) { if (conns.get(i).object2.equals(name)) { materialName = conns.get(i).object1; break; } } if (materialName != null) { Stack<FBXMaterial> materials = mFbx.objects.materials; num = materials.size(); for (int i = 0; i < num; ++i) { if (materials.get(i).name.equals(materialName)) { material = materials.get(i); break; } } } if (material != null) { mat.setDiffuseMethod(new DiffuseMethod.Lambert()); mat.enableLighting(true); Vector3 color = material.properties.diffuseColor; mat.setColor( Color.rgb((int) (color.x * 255.f), (int) (color.y * 255.f), (int) (color.z * 255.f))); color = material.properties.ambientColor; mat.setAmbientColor( Color.rgb((int) (color.x * 255.f), (int) (color.y * 255.f), (int) (color.z * 255.f))); float intensity = material.properties.ambientFactor.floatValue(); mat.setAmbientIntensity(intensity, intensity, intensity); if (material.shadingModel.equals("phong")) { SpecularMethod.Phong method = new SpecularMethod.Phong(); if (material.properties.specularColor != null) { color = material.properties.specularColor; method.setSpecularColor( Color.rgb((int) (color.x * 255.f), (int) (color.y * 255.f), (int) (color.z * 255.f))); } if (material.properties.shininess != null) method.setShininess(material.properties.shininess); } } return mat; }
public int changeBackgroundColor(int id) { int color = Color.rgb(103, 58, 183); switch (id) { case 0: color = Color.rgb(103, 58, 183); break; case 1: color = Color.rgb(63, 81, 181); break; case 2: color = Color.rgb(0, 150, 136); } return color; }
private LightingColorFilter calculateLight(final float rotation) { final double cosRotation = Math.cos(Math.PI * rotation / 180); int intensity = AMBIENT_LIGHT + (int) (DIFFUSE_LIGHT * cosRotation); int highlightIntensity = (int) (SPECULAR_LIGHT * Math.pow(cosRotation, SHININESS)); if (intensity > MAX_INTENSITY) { intensity = MAX_INTENSITY; } if (highlightIntensity > MAX_INTENSITY) { highlightIntensity = MAX_INTENSITY; } final int light = Color.rgb(intensity, intensity, intensity); final int highlight = Color.rgb(highlightIntensity, highlightIntensity, highlightIntensity); return new LightingColorFilter(light, highlight); }
private void drawEstimationGraph() { double output[] = estimator.getEstimataion(); GraphViewData data[] = new GraphViewData[output.length]; for (int i = 0; i < output.length; ++i) { data[i] = new GraphViewData(i, output[i]); } // init example series data GraphViewSeries exampleSeries = new GraphViewSeries(data); // granica hiperglikemiczna data = new GraphViewData[output.length]; for (int i = 0; i < output.length; ++i) { data[i] = new GraphViewData(i, 130); } GraphViewSeries hyperglycemicSeries1 = new GraphViewSeries("Hiperglikemia 1", Color.rgb(200, 50, 00), data); data = new GraphViewData[output.length]; for (int i = 0; i < output.length; ++i) { data[i] = new GraphViewData(i, 180); } GraphViewSeries hyperglycemicSeries2 = new GraphViewSeries("Hiperglikemia 2", Color.rgb(220, 20, 60), data); data = new GraphViewData[output.length]; for (int i = 0; i < output.length; ++i) { data[i] = new GraphViewData(i, 50); } GraphViewSeries lowSeries = new GraphViewSeries("Dolna granica", Color.rgb(255, 215, 00), data); GraphView graphView = new LineGraphView(this, "Poziom cukru [mg/dl]"); graphView.setHorizontalLabels(new String[] {"0h", "1h", "2h", "3h", "4h", "5h", "6h"}); graphView.addSeries(hyperglycemicSeries1); graphView.addSeries(hyperglycemicSeries2); graphView.addSeries(lowSeries); graphView.addSeries(exampleSeries); // data graphView.setViewPort(0, 360); LinearLayout layout = (LinearLayout) findViewById(R.id.graph1); layout.addView(graphView); }
private boolean setCurrentBtn(TextView btn) { if (currentBtn == null) { currentBtn = btn; } else if (currentBtn.equals(btn)) { return false; } else { currentBtn.setTextColor(Color.rgb(208, 190, 185)); currentBtn.setCompoundDrawablesWithIntrinsicBounds(null, null, null, null); } Drawable myImage = getResources().getDrawable(R.drawable.select_icon); btn.setTextColor(Color.rgb(255, 255, 255)); btn.setCompoundDrawablesWithIntrinsicBounds(null, null, null, myImage); currentBtn = btn; return true; }