/** * @param flag * @param bgColor * @param baseUrl * @param mEBrowserView * @author wanglei * @createAt 20151124 * @ps 与原EBrowserView的setBrwViewBackground类似,原方法只设置EBrowserView的背景 * 当网页设置弹动效果后,上下滑动到边缘后,会露出EBrowserView下面的网页,故应给EBrowserView 父对象EBounceView设置背景, * EBrowserView背景设成透明。 */ public void setBounceViewBackground( boolean flag, String bgColor, String baseUrl, EBrowserView mEBrowserView) { if (flag) { if (bgColor.startsWith("#") || bgColor.startsWith("rgb")) { int color = BUtility.parseColor(bgColor); setBackgroundColor(color); } else { String path = BUtility.makeRealPath( BUtility.makeUrl(mEBrowserView.getCurrentUrl(baseUrl), bgColor), mEBrowserView.getCurrentWidget().m_widgetPath, mEBrowserView.getCurrentWidget().m_wgtType); Bitmap bitmap = BUtility.getLocalImg(mContext, path); Drawable d = null; if (bitmap != null) { d = new BitmapDrawable(mContext.getResources(), bitmap); } int version = Build.VERSION.SDK_INT; if (version < 16) { setBackgroundDrawable(d); setBackgroundColor(Color.argb(0, 0, 0, 0)); } else { setBackground(d); setBackgroundColor(Color.argb(0, 0, 0, 0)); } } } else { setBackgroundColor(Color.TRANSPARENT); } }
private void setData(PieChartVO chart) { List<PieUnit> list = chart.getData(); if (list == null || list.size() == 0) { return; } int length = list.size(); String[] titles = new String[length]; ArrayList<Entry> entrys = new ArrayList<Entry>(); int[] colors = new int[length]; for (int i = 0; i < length; i++) { PieUnit bean = list.get(i); titles[i] = bean.getTitle(); entrys.add(new Entry(bean.getValue(), i)); colors[i] = BUtility.parseColor(bean.getColor()); } PieDataSet set1 = new PieDataSet(entrys, ""); set1.setSliceSpace(3f); set1.setDrawValues(chart.isShowValue()); set1.setValueTextColor(chart.getValueTextColor()); set1.setValueTextSize(chart.getValueTextSize()); set1.setColors(colors); if (chart.isShowPercent()) { set1.setValueFormatter(new PercentFormatter()); } else { if (chart.isShowUnit()) { set1.setValueFormatter(new ValueUnitFormatter(chart.getUnit())); } } PieData data = new PieData(titles, set1); mChart.setData(data); // undo all highlights mChart.highlightValues(null); mChart.invalidate(); }
public void setCustomButton(final CustomButtonVO dataVO) { CustomButtonResultVO resultVO = new CustomButtonResultVO(); resultVO.setId(dataVO.getId()); if (!isAlreadyAdded(dataVO.getId())) { FrameLayout.LayoutParams lpParams = new FrameLayout.LayoutParams(dataVO.getWidth(), dataVO.getHeight()); lpParams.leftMargin = dataVO.getX(); lpParams.topMargin = dataVO.getY(); Button btn = new Button(this); btn.setLayoutParams(lpParams); btn.setPadding(0, 0, 0, 0); if (!TextUtils.isEmpty(dataVO.getTitle())) { btn.setText(dataVO.getTitle()); } if (dataVO.getTextSize() > 0) { btn.setTextSize(dataVO.getTextSize()); } if (!TextUtils.isEmpty(dataVO.getTitleColor())) { btn.setTextColor(BUtility.parseColor(dataVO.getTitleColor())); } if (!TextUtils.isEmpty(dataVO.getBgImage())) { Drawable bg = new BitmapDrawable(GaodeUtils.getImage(this, dataVO.getBgImage())); int version = Build.VERSION.SDK_INT; if (version < 16) { btn.setBackgroundDrawable(bg); } else { btn.setBackground(bg); } } mContent.addView(btn); btn.setVisibility(View.GONE); btn.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { if (mListener != null) { EUExGaodeMap gaodeMap = mButtons.get(dataVO.getId()).getGaodeMap(); mListener.onButtonClick(dataVO.getId(), gaodeMap); } } }); CustomButtonBean button = new CustomButtonBean(); button.setButton(btn); mButtons.put(dataVO.getId(), button); resultVO.setIsSuccess(true); } else { resultVO.setIsSuccess(false); } if (mListener != null) { mListener.cbSetCustomButton(resultVO); } }
private void initPieChartView(PieChartVO chart) { mChart.animateXY(chart.getDuration(), chart.getDuration()); String centerText = chart.getCenterTitle() + "\n" + chart.getCenterSummary(); if (!centerText.equals("\n")) mChart.setCenterText(centerText); mChart.setCenterTextSize(chart.getDescTextSize()); mChart.setCenterTextColor(chart.getDescTextColor()); mChart.setDescription(chart.getDesc()); mChart.setDescriptionColor(chart.getDescTextColor()); mChart.setDescriptionTextSize(chart.getDescTextSize()); mChart.setDrawHoleEnabled(chart.isShowCenter()); // center circle part mChart.setDrawCenterText(chart.isShowCenter()); mChart.setDrawSliceText(chart.isShowTitle()); // is show title // mChart.setDrawUnitsInChart(chart.isShowUint()); // mChart.setUnit(chart.getUnit()); mChart.setBackgroundColor(chart.getBgColor()); mChart.setHoleRadius(chart.getCenterRadius()); mChart.setTransparentCircleRadius(chart.getCenterTransRadius()); if (BUtility.parseColor(chart.getCenterColor()) == Color.TRANSPARENT) { mChart.setHoleColorTransparent(true); } else { mChart.setHoleColor(BUtility.parseColor(chart.getCenterColor())); } mChart.setUsePercentValues(chart.isShowPercent()); // add a selection listener mChart.setOnChartValueSelectedListener(this); mChart.setRotationAngle(0); setData(chart); Legend l = mChart.getLegend(); l.setEnabled(chart.isShowLegend()); // is show legend(tuli) l.setTextColor(chart.getDescTextColor()); l.setTextSize(chart.getDescTextSize()); l.setPosition(chart.getLegendPosition()); l.setXEntrySpace(7f); l.setYEntrySpace(5f); }