wear adopt basal to light theme

This commit is contained in:
AdrianLxM 2016-11-27 04:14:46 +01:00
parent d53217dfe0
commit 299e235f4b
5 changed files with 30 additions and 13 deletions

View file

@ -56,6 +56,8 @@ public class BIGChart extends WatchFace implements SharedPreferences.OnSharedPre
public int lowColor = Color.RED;
public int midColor = Color.WHITE;
public int gridColour = Color.WHITE;
public int basalBackgroundColor = Color.BLUE;
public int basalCenterColor = Color.BLUE;
public int pointSize = 2;
public boolean singleLine = false;
public boolean layoutSet = false;
@ -495,6 +497,8 @@ public class BIGChart extends WatchFace implements SharedPreferences.OnSharedPre
lowColor = ContextCompat.getColor(getApplicationContext(), R.color.dark_lowColor);
midColor = ContextCompat.getColor(getApplicationContext(), R.color.dark_midColor);
gridColour = ContextCompat.getColor(getApplicationContext(), R.color.dark_gridColor);
basalBackgroundColor = ContextCompat.getColor(getApplicationContext(), R.color.basal_dark);
basalCenterColor = ContextCompat.getColor(getApplicationContext(), R.color.basal_light);
singleLine = false;
pointSize = 2;
setupCharts();
@ -534,6 +538,8 @@ public class BIGChart extends WatchFace implements SharedPreferences.OnSharedPre
lowColor = ContextCompat.getColor(getApplicationContext(), R.color.light_lowColor);
midColor = ContextCompat.getColor(getApplicationContext(), R.color.light_midColor);
gridColour = ContextCompat.getColor(getApplicationContext(), R.color.light_gridColor);
basalBackgroundColor = ContextCompat.getColor(getApplicationContext(), R.color.basal_light);
basalCenterColor = ContextCompat.getColor(getApplicationContext(), R.color.basal_dark);
singleLine = false;
pointSize = 2;
setupCharts();
@ -595,9 +601,9 @@ public class BIGChart extends WatchFace implements SharedPreferences.OnSharedPre
if(bgDataList.size() > 0) { //Dont crash things just because we dont have values, people dont like crashy things
int timeframe = Integer.parseInt(sharedPrefs.getString("chart_timeframe", "3"));
if (singleLine) {
bgGraphBuilder = new BgGraphBuilder(getApplicationContext(), bgDataList, tempWatchDataList, basalWatchDataList, pointSize, midColor, gridColour, timeframe);
bgGraphBuilder = new BgGraphBuilder(getApplicationContext(), bgDataList, tempWatchDataList, basalWatchDataList, pointSize, midColor, gridColour, basalBackgroundColor, basalCenterColor, timeframe);
} else {
bgGraphBuilder = new BgGraphBuilder(getApplicationContext(), bgDataList, tempWatchDataList, basalWatchDataList, pointSize, highColor, lowColor, midColor, gridColour, timeframe);
bgGraphBuilder = new BgGraphBuilder(getApplicationContext(), bgDataList, tempWatchDataList, basalWatchDataList, pointSize, highColor, lowColor, midColor, gridColour, basalBackgroundColor, basalCenterColor, timeframe);
}
chart.setLineChartData(bgGraphBuilder.lineData());

View file

@ -51,6 +51,8 @@ public abstract class BaseWatchFace extends WatchFace implements SharedPreferen
public int lowColor = Color.RED;
public int midColor = Color.WHITE;
public int gridColor = Color.WHITE;
public int basalBackgroundColor = Color.BLUE;
public int basalCenterColor = Color.BLUE;
public int pointSize = 2;
public boolean singleLine = false;
public boolean layoutSet = false;
@ -387,9 +389,9 @@ protected abstract void setColorDark();
if(bgDataList.size() > 0) { //Dont crash things just because we dont have values, people dont like crashy things
int timeframe = Integer.parseInt(sharedPrefs.getString("chart_timeframe", "3"));
if (singleLine) {
bgGraphBuilder = new BgGraphBuilder(getApplicationContext(), bgDataList, tempWatchDataList, basalWatchDataList, pointSize, midColor, gridColor, timeframe);
bgGraphBuilder = new BgGraphBuilder(getApplicationContext(), bgDataList, tempWatchDataList, basalWatchDataList, pointSize, midColor, gridColor, basalBackgroundColor, basalCenterColor, timeframe);
} else {
bgGraphBuilder = new BgGraphBuilder(getApplicationContext(), bgDataList, tempWatchDataList, basalWatchDataList, pointSize, highColor, lowColor, midColor, gridColor, timeframe);
bgGraphBuilder = new BgGraphBuilder(getApplicationContext(), bgDataList, tempWatchDataList, basalWatchDataList, pointSize, highColor, lowColor, midColor, gridColor, basalBackgroundColor, basalCenterColor, timeframe);
}
chart.setLineChartData(bgGraphBuilder.lineData());

View file

@ -41,6 +41,8 @@ public class BgGraphBuilder {
public int lowColor;
public int midColor;
public int gridColour;
public int basalCenterColor;
public int basalBackgroundColor;
public boolean singleLine = false;
private double endHour;
@ -50,7 +52,7 @@ public class BgGraphBuilder {
public Viewport viewport;
public BgGraphBuilder(Context context, List<BgWatchData> aBgList, List<TempWatchData> tempWatchDataList, ArrayList<BasalWatchData> basalWatchDataList, int aPointSize, int aMidColor, int gridColour, int timespan) {
public BgGraphBuilder(Context context, List<BgWatchData> aBgList, List<TempWatchData> tempWatchDataList, ArrayList<BasalWatchData> basalWatchDataList, int aPointSize, int aMidColor, int gridColour, int basalBackgroundColor, int basalCenterColor, int timespan) {
end_time = new Date().getTime() + (1000 * 60 * 6 * timespan); //Now plus 30 minutes padding (for 5 hours. Less if less.)
start_time = new Date().getTime() - (1000 * 60 * 60 * timespan); //timespan hours ago
this.bgDataList = aBgList;
@ -66,9 +68,12 @@ public class BgGraphBuilder {
this.tempWatchDataList = tempWatchDataList;
this.basalWatchDataList = basalWatchDataList;
this.gridColour = gridColour;
this.basalCenterColor = basalCenterColor;
this.basalBackgroundColor = basalBackgroundColor;
}
public BgGraphBuilder(Context context, List<BgWatchData> aBgList, List<TempWatchData> tempWatchDataList, ArrayList<BasalWatchData> basalWatchDataList, int aPointSize, int aHighColor, int aLowColor, int aMidColor, int gridColour, int timespan) {
// TODO: use for ambient mode!
public BgGraphBuilder(Context context, List<BgWatchData> aBgList, List<TempWatchData> tempWatchDataList, ArrayList<BasalWatchData> basalWatchDataList, int aPointSize, int aHighColor, int aLowColor, int aMidColor, int gridColour, int basalBackgroundColor, int basalCenterColor, int timespan) {
end_time = new Date().getTime() + (1000 * 60 * 6 * timespan); //Now plus 30 minutes padding (for 5 hours. Less if less.)
start_time = new Date().getTime() - (1000 * 60 * 60 * timespan); //timespan hours ago
this.bgDataList = aBgList;
@ -83,6 +88,8 @@ public class BgGraphBuilder {
this.tempWatchDataList = tempWatchDataList;
this.basalWatchDataList = basalWatchDataList;
this.gridColour = gridColour;
this.basalCenterColor = basalCenterColor;
this.basalBackgroundColor = basalBackgroundColor;
}
public LineChartData lineData() {
@ -163,7 +170,7 @@ public class BgGraphBuilder {
Line basalLine = new Line(pointValues);
basalLine.setHasPoints(false);
basalLine.setColor(ContextCompat.getColor(context, R.color.basalLine_primary));
basalLine.setColor(basalCenterColor);
basalLine.setPathEffect(new DashPathEffect(new float[]{4f, 3f}, 4f));
basalLine.setStrokeWidth(highlight?2:1);
return basalLine;
@ -215,10 +222,10 @@ public class BgGraphBuilder {
Line valueLine = new Line(lineValues);
valueLine.setHasPoints(false);
if (isHighlightLine){
valueLine.setColor(ContextCompat.getColor(context, R.color.tempbasal_highlight));
valueLine.setColor(basalCenterColor);
valueLine.setStrokeWidth(1);
}else {
valueLine.setColor(ContextCompat.getColor(context, R.color.tempbasal_primary));
valueLine.setColor(basalBackgroundColor);
valueLine.setStrokeWidth(strokeWidth);
}
return valueLine;

View file

@ -93,7 +93,8 @@ public class Home extends BaseWatchFace {
lowColor = ContextCompat.getColor(getApplicationContext(), R.color.dark_lowColor);
midColor = ContextCompat.getColor(getApplicationContext(), R.color.dark_midColor);
gridColor = ContextCompat.getColor(getApplicationContext(), R.color.dark_gridColor);
basalBackgroundColor = ContextCompat.getColor(getApplicationContext(), R.color.basal_dark);
basalCenterColor = ContextCompat.getColor(getApplicationContext(), R.color.basal_light);
singleLine = false;
pointSize = 2;
setupCharts();
@ -139,6 +140,8 @@ public class Home extends BaseWatchFace {
lowColor = ContextCompat.getColor(getApplicationContext(), R.color.light_lowColor);
midColor = ContextCompat.getColor(getApplicationContext(), R.color.light_midColor);
gridColor = ContextCompat.getColor(getApplicationContext(), R.color.light_gridColor);
basalBackgroundColor = ContextCompat.getColor(getApplicationContext(), R.color.basal_light);
basalCenterColor = ContextCompat.getColor(getApplicationContext(), R.color.basal_dark);
singleLine = false;
pointSize = 2;
setupCharts();

View file

@ -44,9 +44,8 @@
<color name="dark_gridColor">@color/grey_50</color>
<!-- basal colors -->
<color name="basalLine_primary">@color/blue_300</color>
<color name="tempbasal_highlight">@color/blue_300</color>
<color name="tempbasal_primary">@color/BLUE</color>
<color name="basal_light">@color/blue_300</color>
<color name="basal_dark">@color/BLUE</color>
<!-- Material Design - Color Palette -->