use of android.graphics.DashPathEffect in project UltimateAndroid by cymcsg.
the class HomeDiagram method drawStraightLine.
/**
* 绘制竖线
*
* @param c
*/
public void drawStraightLine(Canvas c) {
paint_dottedline.setColor(fineLineColor);
int count_line = 0;
for (int i = 0; i < milliliter.size(); i++) {
if (count_line == 0) {
c.drawLine(interval_left_right * i, 0, interval_left_right * i, getHeight(), paint_date);
}
if (count_line == 2) {
c.drawLine(interval_left_right * i, tb * 1.5f, interval_left_right * i, getHeight(), paint_date);
}
if (count_line == 1 || count_line == 3) {
Path path = new Path();
path.moveTo(interval_left_right * i, tb * 1.5f);
path.lineTo(interval_left_right * i, getHeight());
PathEffect effects = new DashPathEffect(new float[] { tb * 0.3f, tb * 0.3f, tb * 0.3f, tb * 0.3f }, tb * 0.1f);
paint_dottedline.setPathEffect(effects);
c.drawPath(path, paint_dottedline);
}
count_line++;
if (count_line >= 4) {
count_line = 0;
}
}
c.drawLine(0, getHeight() - tb * 0.2f, getWidth(), getHeight() - tb * 0.2f, paint_brokenline_big);
}
use of android.graphics.DashPathEffect in project UltimateRecyclerView by cymcsg.
the class MultiViewTypesActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_loadmore);
toolbar = (Toolbar) findViewById(R.id.tool_bar);
setSupportActionBar(toolbar);
getSupportActionBar().setDisplayShowTitleEnabled(false);
ultimateRecyclerView = (UltimateRecyclerView) findViewById(R.id.ultimate_recycler_view);
ultimateRecyclerView.setHasFixedSize(false);
List<String> stringList = new ArrayList<>();
stringList.add("111");
stringList.add("aaa");
stringList.add("222");
stringList.add("33");
stringList.add("44");
stringList.add("55");
simpleRecyclerViewAdapter = new MultiViewTypesRecyclerViewAdapter(stringList);
simpleRecyclerViewAdapter.setCustomLoadMoreView(LayoutInflater.from(this).inflate(R.layout.custom_bottom_progressbar, null));
// stringList.add("66");
// stringList.add("11771");
linearLayoutManager = new LinearLayoutManager(this);
ultimateRecyclerView.setLayoutManager(linearLayoutManager);
// ultimateRecyclerView.setAdapter(simpleRecyclerViewAdapter);
ultimateRecyclerView.setAdapter(simpleRecyclerViewAdapter);
ultimateRecyclerView.setDefaultOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
@Override
public void onRefresh() {
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
simpleRecyclerViewAdapter.insert("Refresh things", 0);
ultimateRecyclerView.setRefreshing(false);
// ultimateRecyclerView.scrollBy(0, -50);
linearLayoutManager.scrollToPosition(0);
}
}, 1000);
}
});
Paint paint = new Paint();
paint.setStrokeWidth(5);
paint.setColor(Color.BLUE);
paint.setAntiAlias(true);
paint.setPathEffect(new DashPathEffect(new float[] { 25.0f, 25.0f }, 0));
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.HONEYCOMB) {
ultimateRecyclerView.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
}
ultimateRecyclerView.addItemDecoration(new HorizontalDividerItemDecoration.Builder(this).paint(paint).build());
// simpleRecyclerViewAdapter.ad
}
use of android.graphics.DashPathEffect in project WilliamChart by diogobernardino.
the class SandboxFragment method buildChart.
private static void buildChart(ChartView chart) {
mGridPaint = new Paint();
mGridPaint.setColor(mGridColorId);
mGridPaint.setStyle(Paint.Style.STROKE);
mGridPaint.setAntiAlias(true);
mGridPaint.setStrokeWidth(Tools.fromDpToPx(mGridThickness));
if (mIsGridDashed)
mGridPaint.setPathEffect(new DashPathEffect(mGridDashType, 0));
chart.setXAxis(mHasXAxis).setXLabels(mXLabelPosition).setYAxis(mHasYAxis).setYLabels(mYLabelPosition).setLabelsColor(mLabelColorId).setAxisColor(mAxisColorId);
if (mGridType != null) {
if (mGridType.compareTo(GridType.FULL) == 0)
chart.setGrid(5, 5, mGridPaint);
if (mGridType.compareTo(GridType.VERTICAL) == 0)
chart.setGrid(0, 5, mGridPaint);
if (mGridType.compareTo(GridType.HORIZONTAL) == 0)
chart.setGrid(5, 0, mGridPaint);
}
chart.setLabelsFormat(new DecimalFormat("#" + mLabelFormat));
chart.show(buildAnimation());
}
use of android.graphics.DashPathEffect in project WilliamChart by diogobernardino.
the class StackedFragment method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View layout = inflater.inflate(R.layout.fragment_stacked, container, false);
mChart = (StackBarChartView) layout.findViewById(R.id.chart);
mFirstStage = true;
layout.setOnClickListener(this);
mChart.setOnClickListener(this);
Paint thresPaint = new Paint();
thresPaint.setColor(Color.parseColor("#dad8d6"));
thresPaint.setPathEffect(new DashPathEffect(new float[] { 10, 20 }, 0));
thresPaint.setStyle(Paint.Style.STROKE);
thresPaint.setAntiAlias(true);
thresPaint.setStrokeWidth(Tools.fromDpToPx(.75f));
BarSet stackBarSet = new BarSet(mLabels, mValuesOne[0]);
stackBarSet.setColor(Color.parseColor("#a1d949"));
mChart.addData(stackBarSet);
stackBarSet = new BarSet(mLabels, mValuesOne[1]);
stackBarSet.setColor(Color.parseColor("#ffcc6a"));
mChart.addData(stackBarSet);
stackBarSet = new BarSet(mLabels, mValuesOne[2]);
stackBarSet.setColor(Color.parseColor("#ff7a57"));
mChart.addData(stackBarSet);
mChart.setBarSpacing(Tools.fromDpToPx(15));
mChart.setRoundCorners(Tools.fromDpToPx(1));
mChart.setXAxis(false).setXLabels(AxisRenderer.LabelPosition.OUTSIDE).setYAxis(false).setYLabels(AxisRenderer.LabelPosition.NONE).setValueThreshold(89.f, 89.f, thresPaint);
mChart.show(new Animation().setOverlap(.5f, new int[] { 0, 1, 2, 3, 4, 5, 6 }));
return layout;
}
use of android.graphics.DashPathEffect in project WilliamChart by diogobernardino.
the class LineCardTwo method show.
@Override
public void show(Runnable action) {
super.show(action);
LineSet dataset = new LineSet(mLabels, mValues[0]);
dataset.setColor(Color.parseColor("#004f7f")).setThickness(Tools.fromDpToPx(3)).setSmooth(true).beginAt(4).endAt(36);
for (int i = 0; i < mLabels.length; i += 5) {
Point point = (Point) dataset.getEntry(i);
point.setColor(Color.parseColor("#ffffff"));
point.setStrokeColor(Color.parseColor("#0290c3"));
if (i == 30 || i == 10)
point.setRadius(Tools.fromDpToPx(6));
}
mChart.addData(dataset);
Paint thresPaint = new Paint();
thresPaint.setColor(Color.parseColor("#0079ae"));
thresPaint.setStyle(Paint.Style.STROKE);
thresPaint.setAntiAlias(true);
thresPaint.setStrokeWidth(Tools.fromDpToPx(.75f));
thresPaint.setPathEffect(new DashPathEffect(new float[] { 10, 10 }, 0));
Paint gridPaint = new Paint();
gridPaint.setColor(Color.parseColor("#ffffff"));
gridPaint.setStyle(Paint.Style.STROKE);
gridPaint.setAntiAlias(true);
gridPaint.setStrokeWidth(Tools.fromDpToPx(.75f));
mChart.setBorderSpacing(Tools.fromDpToPx(0)).setXLabels(AxisRenderer.LabelPosition.OUTSIDE).setLabelsColor(Color.parseColor("#304a00")).setYLabels(AxisRenderer.LabelPosition.NONE).setXAxis(false).setYAxis(false).setGrid(0, 7, gridPaint).setValueThreshold(80f, 80f, thresPaint).setAxisBorderValues(0, 110);
Animation anim = new Animation().setStartPoint(0, .5f).setEndAction(action);
mChart.show(anim);
}
Aggregations