set axisWidth based on dpi

This commit is contained in:
Milos Kozak 2018-03-26 10:53:14 +02:00
parent 8e6953cc92
commit f0e779cb1f

View file

@ -288,8 +288,20 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
llm = new LinearLayoutManager(view.getContext()); llm = new LinearLayoutManager(view.getContext());
notificationsView.setLayoutManager(llm); notificationsView.setLayoutManager(llm);
float scaledDensity = getResources().getDisplayMetrics().scaledDensity; int axisWidth = 50;
int axisWidth = (int) Math.round(scaledDensity * scaledDensity * scaledDensity * 6);
if (dm.densityDpi <= 120)
axisWidth = 3;
else if (dm.densityDpi <= 160)
axisWidth = 10;
else if (dm.densityDpi <= 320)
axisWidth = 35;
else if (dm.densityDpi <= 420)
axisWidth = 50;
else if (dm.densityDpi <= 560)
axisWidth = 70;
else
axisWidth = 80;
bgGraph.getGridLabelRenderer().setGridColor(MainApp.sResources.getColor(R.color.graphgrid)); bgGraph.getGridLabelRenderer().setGridColor(MainApp.sResources.getColor(R.color.graphgrid));
bgGraph.getGridLabelRenderer().reloadStyles(); bgGraph.getGridLabelRenderer().reloadStyles();