cpp-120: Graph plotter looks bad with Material Light theme on tablets
Fixes #120
This commit is contained in:
parent
d1b45f8cb2
commit
ddde5945c9
@ -27,6 +27,7 @@ import android.content.Context;
|
|||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
|
import android.graphics.Color;
|
||||||
import android.graphics.Paint;
|
import android.graphics.Paint;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
@ -109,13 +110,11 @@ public abstract class AbstractCalculatorPlotFragment extends CalculatorFragment
|
|||||||
@Override
|
@Override
|
||||||
public void onCreate(@Nullable Bundle in) {
|
public void onCreate(@Nullable Bundle in) {
|
||||||
super.onCreate(in);
|
super.onCreate(in);
|
||||||
|
|
||||||
if (isPaneFragment()) {
|
if (isPaneFragment()) {
|
||||||
this.bgColor = getResources().getColor(R.color.cpp_pane_bg);
|
bgColor = getResources().getColor(App.getTheme().isLight() ? R.color.cpp_pane_bg_light : R.color.cpp_pane_bg);
|
||||||
} else {
|
} else {
|
||||||
this.bgColor = getResources().getColor(android.R.color.transparent);
|
bgColor = getResources().getColor(App.getTheme().isLight() ? R.color.cpp_main_bg_light : R.color.cpp_main_bg);
|
||||||
}
|
}
|
||||||
|
|
||||||
setHasOptionsMenu(true);
|
setHasOptionsMenu(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -206,8 +205,10 @@ public abstract class AbstractCalculatorPlotFragment extends CalculatorFragment
|
|||||||
**********************************************************************
|
**********************************************************************
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public int getBgColor() {
|
public int getBgColor(boolean d3) {
|
||||||
return bgColor;
|
// 3d plotter should always set a background color
|
||||||
|
// 2d plotter can leave with transparent background
|
||||||
|
return !d3 ? Color.TRANSPARENT : bgColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nonnull
|
@Nonnull
|
||||||
|
@ -63,14 +63,15 @@ public class CalculatorPlotFragment extends AbstractCalculatorPlotFragment {
|
|||||||
graphContainer.removeView((View) graphView);
|
graphContainer.removeView((View) graphView);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (plotData.isPlot3d()) {
|
final boolean d3 = plotData.isPlot3d();
|
||||||
|
if (d3) {
|
||||||
graphView = new CalculatorGraph3dView(getActivity());
|
graphView = new CalculatorGraph3dView(getActivity());
|
||||||
} else {
|
} else {
|
||||||
graphView = new CalculatorGraph2dView(getActivity());
|
graphView = new CalculatorGraph2dView(getActivity());
|
||||||
}
|
}
|
||||||
|
|
||||||
final int color = App.getTheme().getTextColor(getActivity()).normal;
|
final int color = App.getTheme().getTextColor(getActivity()).normal;
|
||||||
graphView.init(PlotViewDef.newInstance(color, color, Color.DKGRAY, getBgColor()));
|
graphView.init(PlotViewDef.newInstance(color, color, Color.DKGRAY, getBgColor(d3)));
|
||||||
|
|
||||||
final PlotBoundaries boundaries = plotData.getBoundaries();
|
final PlotBoundaries boundaries = plotData.getBoundaries();
|
||||||
graphView.setXRange(boundaries.getXMin(), boundaries.getXMax());
|
graphView.setXRange(boundaries.getXMin(), boundaries.getXMax());
|
||||||
|
Loading…
Reference in New Issue
Block a user