mirror of
https://github.com/oliexdev/openScale.git
synced 2025-08-16 05:34:05 +02:00
update hellochart library to version 1.5.5
This commit is contained in:
@@ -85,6 +85,7 @@
|
|||||||
<orderEntry type="sourceFolder" forTests="false" />
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
<orderEntry type="library" exported="" name="support-annotations-21.0.3" level="project" />
|
<orderEntry type="library" exported="" name="support-annotations-21.0.3" level="project" />
|
||||||
<orderEntry type="library" exported="" name="support-v4-21.0.3" level="project" />
|
<orderEntry type="library" exported="" name="support-v4-21.0.3" level="project" />
|
||||||
|
<orderEntry type="library" exported="" name="hellocharts-library-1.5.5" level="project" />
|
||||||
<orderEntry type="library" exported="" name="hellocharts-library-1.2" level="project" />
|
<orderEntry type="library" exported="" name="hellocharts-library-1.2" level="project" />
|
||||||
<orderEntry type="library" exported="" name="appcompat-v7-21.0.0" level="project" />
|
<orderEntry type="library" exported="" name="appcompat-v7-21.0.0" level="project" />
|
||||||
</component>
|
</component>
|
||||||
|
@@ -22,4 +22,5 @@ dependencies {
|
|||||||
compile 'com.android.support:support-v4:21.0.3'
|
compile 'com.android.support:support-v4:21.0.3'
|
||||||
compile 'com.android.support:appcompat-v7:21.0.0'
|
compile 'com.android.support:appcompat-v7:21.0.0'
|
||||||
compile files('libs/hellocharts-library-1.2.jar')
|
compile files('libs/hellocharts-library-1.2.jar')
|
||||||
|
compile files('libs/hellocharts-library-1.5.5.jar')
|
||||||
}
|
}
|
||||||
|
Binary file not shown.
BIN
android_app/app/libs/hellocharts-library-1.5.5.jar
Normal file
BIN
android_app/app/libs/hellocharts-library-1.5.5.jar
Normal file
Binary file not shown.
@@ -40,19 +40,21 @@ import java.util.Calendar;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
||||||
|
import lecho.lib.hellocharts.formatter.SimpleLineChartValueFormatter;
|
||||||
import lecho.lib.hellocharts.gesture.ZoomType;
|
import lecho.lib.hellocharts.gesture.ZoomType;
|
||||||
|
import lecho.lib.hellocharts.listener.ColumnChartOnValueSelectListener;
|
||||||
|
import lecho.lib.hellocharts.listener.LineChartOnValueSelectListener;
|
||||||
import lecho.lib.hellocharts.model.Axis;
|
import lecho.lib.hellocharts.model.Axis;
|
||||||
import lecho.lib.hellocharts.model.AxisValue;
|
import lecho.lib.hellocharts.model.AxisValue;
|
||||||
import lecho.lib.hellocharts.model.Column;
|
import lecho.lib.hellocharts.model.Column;
|
||||||
import lecho.lib.hellocharts.model.ColumnChartData;
|
import lecho.lib.hellocharts.model.ColumnChartData;
|
||||||
import lecho.lib.hellocharts.model.ColumnValue;
|
|
||||||
import lecho.lib.hellocharts.model.Line;
|
import lecho.lib.hellocharts.model.Line;
|
||||||
import lecho.lib.hellocharts.model.LineChartData;
|
import lecho.lib.hellocharts.model.LineChartData;
|
||||||
import lecho.lib.hellocharts.model.PointValue;
|
import lecho.lib.hellocharts.model.PointValue;
|
||||||
import lecho.lib.hellocharts.model.SelectedValue;
|
import lecho.lib.hellocharts.model.SelectedValue;
|
||||||
import lecho.lib.hellocharts.model.SimpleValueFormatter;
|
import lecho.lib.hellocharts.model.SubcolumnValue;
|
||||||
import lecho.lib.hellocharts.model.Viewport;
|
import lecho.lib.hellocharts.model.Viewport;
|
||||||
import lecho.lib.hellocharts.util.Utils;
|
import lecho.lib.hellocharts.util.ChartUtils;
|
||||||
import lecho.lib.hellocharts.view.ColumnChartView;
|
import lecho.lib.hellocharts.view.ColumnChartView;
|
||||||
import lecho.lib.hellocharts.view.LineChartView;
|
import lecho.lib.hellocharts.view.LineChartView;
|
||||||
|
|
||||||
@@ -162,21 +164,21 @@ public class GraphFragment extends Fragment implements FragmentUpdateListener {
|
|||||||
|
|
||||||
|
|
||||||
Line lineWeight = new Line(valuesWeight).
|
Line lineWeight = new Line(valuesWeight).
|
||||||
setColor(Utils.COLOR_VIOLET).
|
setColor(ChartUtils.COLOR_VIOLET).
|
||||||
setHasLabels(prefs.getBoolean("labelsEnable", true)).
|
setHasLabels(prefs.getBoolean("labelsEnable", true)).
|
||||||
setFormatter(new SimpleValueFormatter(1, false, null, null));
|
setFormatter(new SimpleLineChartValueFormatter(1));
|
||||||
Line lineFat = new Line(valuesFat).
|
Line lineFat = new Line(valuesFat).
|
||||||
setColor(Utils.COLOR_ORANGE).
|
setColor(ChartUtils.COLOR_ORANGE).
|
||||||
setHasLabels(prefs.getBoolean("labelsEnable", true)).
|
setHasLabels(prefs.getBoolean("labelsEnable", true)).
|
||||||
setFormatter(new SimpleValueFormatter(1, false, null, null));
|
setFormatter(new SimpleLineChartValueFormatter(1));
|
||||||
Line lineWater = new Line(valuesWater).
|
Line lineWater = new Line(valuesWater).
|
||||||
setColor(Utils.COLOR_BLUE).
|
setColor(ChartUtils.COLOR_BLUE).
|
||||||
setHasLabels(prefs.getBoolean("labelsEnable", true)).
|
setHasLabels(prefs.getBoolean("labelsEnable", true)).
|
||||||
setFormatter(new SimpleValueFormatter(1, false, null, null));
|
setFormatter(new SimpleLineChartValueFormatter(1));
|
||||||
Line lineMuscle = new Line(valuesMuscle).
|
Line lineMuscle = new Line(valuesMuscle).
|
||||||
setColor(Utils.COLOR_GREEN).
|
setColor(ChartUtils.COLOR_GREEN).
|
||||||
setHasLabels(prefs.getBoolean("labelsEnable", true)).
|
setHasLabels(prefs.getBoolean("labelsEnable", true)).
|
||||||
setFormatter(new SimpleValueFormatter(1, false, null, null));
|
setFormatter(new SimpleLineChartValueFormatter(1));
|
||||||
|
|
||||||
activeLines = new ArrayList<lines>();
|
activeLines = new ArrayList<lines>();
|
||||||
|
|
||||||
@@ -225,7 +227,7 @@ public class GraphFragment extends Fragment implements FragmentUpdateListener {
|
|||||||
|
|
||||||
Viewport v = new Viewport(0, (int)maxValue, maxDays-1, 0);
|
Viewport v = new Viewport(0, (int)maxValue, maxDays-1, 0);
|
||||||
chartTop.setMaximumViewport(v);
|
chartTop.setMaximumViewport(v);
|
||||||
chartTop.setCurrentViewport(v, true);
|
chartTop.setCurrentViewport(v);
|
||||||
|
|
||||||
chartTop.setZoomType(ZoomType.HORIZONTAL);
|
chartTop.setZoomType(ZoomType.HORIZONTAL);
|
||||||
}
|
}
|
||||||
@@ -246,8 +248,8 @@ public class GraphFragment extends Fragment implements FragmentUpdateListener {
|
|||||||
String month_name = month_date.format(calMonths.getTime());
|
String month_name = month_date.format(calMonths.getTime());
|
||||||
|
|
||||||
axisValues.add(new AxisValue(i, month_name.toCharArray()));
|
axisValues.add(new AxisValue(i, month_name.toCharArray()));
|
||||||
List<ColumnValue> values = new ArrayList<ColumnValue>();
|
List<SubcolumnValue> values = new ArrayList<SubcolumnValue>();
|
||||||
values.add(new ColumnValue(numOfMonth[i], Utils.COLORS[i % Utils.COLORS.length]));
|
values.add(new SubcolumnValue(numOfMonth[i], ChartUtils.COLORS[i % ChartUtils.COLORS.length]));
|
||||||
|
|
||||||
columns.add(new Column(values).setHasLabelsOnlyForSelected(true));
|
columns.add(new Column(values).setHasLabelsOnlyForSelected(true));
|
||||||
|
|
||||||
@@ -261,15 +263,15 @@ public class GraphFragment extends Fragment implements FragmentUpdateListener {
|
|||||||
chartBottom.setColumnChartData(columnData);
|
chartBottom.setColumnChartData(columnData);
|
||||||
chartBottom.setValueSelectionEnabled(true);
|
chartBottom.setValueSelectionEnabled(true);
|
||||||
chartBottom.setZoomEnabled(false);
|
chartBottom.setZoomEnabled(false);
|
||||||
chartBottom.selectValue(new SelectedValue(calLastSelected.get(Calendar.MONTH), 0, 0));
|
chartBottom.selectValue(new SelectedValue(calLastSelected.get(Calendar.MONTH), 0, SelectedValue.SelectedValueType.COLUMN));
|
||||||
|
|
||||||
|
|
||||||
generateLineData(calLastSelected);
|
generateLineData(calLastSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
private class ChartBottomValueTouchListener implements ColumnChartView.ColumnChartOnValueTouchListener {
|
private class ChartBottomValueTouchListener implements ColumnChartOnValueSelectListener {
|
||||||
@Override
|
@Override
|
||||||
public void onValueTouched(int selectedLine, int selectedValue, ColumnValue value) {
|
public void onValueSelected(int selectedLine, int selectedValue, SubcolumnValue value) {
|
||||||
Calendar cal = Calendar.getInstance();
|
Calendar cal = Calendar.getInstance();
|
||||||
cal.set(Calendar.MONTH, Calendar.JANUARY);
|
cal.set(Calendar.MONTH, Calendar.JANUARY);
|
||||||
cal.add(Calendar.MONTH, selectedLine);
|
cal.add(Calendar.MONTH, selectedLine);
|
||||||
@@ -280,14 +282,14 @@ public class GraphFragment extends Fragment implements FragmentUpdateListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onNothingTouched() {
|
public void onValueDeselected() {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class ChartTopValueTouchListener implements LineChartView.LineChartOnValueTouchListener {
|
private class ChartTopValueTouchListener implements LineChartOnValueSelectListener {
|
||||||
@Override
|
@Override
|
||||||
public void onValueTouched(int lineIndex, int pointIndex, PointValue pointValue) {
|
public void onValueSelected(int lineIndex, int pointIndex, PointValue pointValue) {
|
||||||
ScaleData scaleData = scaleDataList.get(pointIndex);
|
ScaleData scaleData = scaleDataList.get(pointIndex);
|
||||||
lines selectedLine = activeLines.get(lineIndex);
|
lines selectedLine = activeLines.get(lineIndex);
|
||||||
|
|
||||||
@@ -296,7 +298,7 @@ public class GraphFragment extends Fragment implements FragmentUpdateListener {
|
|||||||
switch (selectedLine) {
|
switch (selectedLine) {
|
||||||
case WEIGHT:
|
case WEIGHT:
|
||||||
Toast.makeText(getActivity(), getResources().getString(R.string.info_your_weight) + " " + scaleData.weight + ScaleUser.UNIT_STRING[OpenScale.getInstance(graphView.getContext()).getSelectedScaleUser().scale_unit] + " " + getResources().getString(R.string.info_on_date) + " " + date_time, Toast.LENGTH_SHORT).show();
|
Toast.makeText(getActivity(), getResources().getString(R.string.info_your_weight) + " " + scaleData.weight + ScaleUser.UNIT_STRING[OpenScale.getInstance(graphView.getContext()).getSelectedScaleUser().scale_unit] + " " + getResources().getString(R.string.info_on_date) + " " + date_time, Toast.LENGTH_SHORT).show();
|
||||||
break;
|
break;
|
||||||
case FAT:
|
case FAT:
|
||||||
Toast.makeText(getActivity(), getResources().getString(R.string.info_your_fat) + " " + scaleData.fat + "% " + getResources().getString(R.string.info_on_date) + " " + date_time, Toast.LENGTH_SHORT).show();
|
Toast.makeText(getActivity(), getResources().getString(R.string.info_your_fat) + " " + scaleData.fat + "% " + getResources().getString(R.string.info_on_date) + " " + date_time, Toast.LENGTH_SHORT).show();
|
||||||
break;
|
break;
|
||||||
@@ -310,7 +312,7 @@ public class GraphFragment extends Fragment implements FragmentUpdateListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onNothingTouched() {
|
public void onValueDeselected() {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -42,15 +42,16 @@ import java.util.Calendar;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import lecho.lib.hellocharts.model.ArcValue;
|
import lecho.lib.hellocharts.formatter.SimpleLineChartValueFormatter;
|
||||||
|
import lecho.lib.hellocharts.listener.PieChartOnValueSelectListener;
|
||||||
import lecho.lib.hellocharts.model.Axis;
|
import lecho.lib.hellocharts.model.Axis;
|
||||||
import lecho.lib.hellocharts.model.AxisValue;
|
import lecho.lib.hellocharts.model.AxisValue;
|
||||||
import lecho.lib.hellocharts.model.Line;
|
import lecho.lib.hellocharts.model.Line;
|
||||||
import lecho.lib.hellocharts.model.LineChartData;
|
import lecho.lib.hellocharts.model.LineChartData;
|
||||||
import lecho.lib.hellocharts.model.PieChartData;
|
import lecho.lib.hellocharts.model.PieChartData;
|
||||||
import lecho.lib.hellocharts.model.PointValue;
|
import lecho.lib.hellocharts.model.PointValue;
|
||||||
import lecho.lib.hellocharts.model.SimpleValueFormatter;
|
import lecho.lib.hellocharts.model.SliceValue;
|
||||||
import lecho.lib.hellocharts.util.Utils;
|
import lecho.lib.hellocharts.util.ChartUtils;
|
||||||
import lecho.lib.hellocharts.view.LineChartView;
|
import lecho.lib.hellocharts.view.LineChartView;
|
||||||
import lecho.lib.hellocharts.view.PieChartView;
|
import lecho.lib.hellocharts.view.PieChartView;
|
||||||
|
|
||||||
@@ -348,21 +349,21 @@ public class OverviewFragment extends Fragment implements FragmentUpdateListener
|
|||||||
}
|
}
|
||||||
|
|
||||||
Line lineWeight = new Line(valuesWeight).
|
Line lineWeight = new Line(valuesWeight).
|
||||||
setColor(Utils.COLOR_VIOLET).
|
setColor(ChartUtils.COLOR_VIOLET).
|
||||||
setHasLabels(prefs.getBoolean("labelsEnable", true)).
|
setHasLabels(prefs.getBoolean("labelsEnable", true)).
|
||||||
setFormatter(new SimpleValueFormatter(1, false, null, null));
|
setFormatter(new SimpleLineChartValueFormatter(1));
|
||||||
Line lineFat = new Line(valuesFat).
|
Line lineFat = new Line(valuesFat).
|
||||||
setColor(Utils.COLOR_ORANGE).
|
setColor(ChartUtils.COLOR_ORANGE).
|
||||||
setHasLabels(prefs.getBoolean("labelsEnable", true)).
|
setHasLabels(prefs.getBoolean("labelsEnable", true)).
|
||||||
setFormatter(new SimpleValueFormatter(1, false, null, null));
|
setFormatter(new SimpleLineChartValueFormatter(1));
|
||||||
Line lineWater = new Line(valuesWater).
|
Line lineWater = new Line(valuesWater).
|
||||||
setColor(Utils.COLOR_BLUE).
|
setColor(ChartUtils.COLOR_BLUE).
|
||||||
setHasLabels(prefs.getBoolean("labelsEnable", true)).
|
setHasLabels(prefs.getBoolean("labelsEnable", true)).
|
||||||
setFormatter(new SimpleValueFormatter(1, false, null, null));
|
setFormatter(new SimpleLineChartValueFormatter(1));
|
||||||
Line lineMuscle = new Line(valuesMuscle).
|
Line lineMuscle = new Line(valuesMuscle).
|
||||||
setColor(Utils.COLOR_GREEN).
|
setColor(ChartUtils.COLOR_GREEN).
|
||||||
setHasLabels(prefs.getBoolean("labelsEnable", true)).
|
setHasLabels(prefs.getBoolean("labelsEnable", true)).
|
||||||
setFormatter(new SimpleValueFormatter(1, false, null, null));
|
setFormatter(new SimpleLineChartValueFormatter(1));
|
||||||
|
|
||||||
if(prefs.getBoolean("weightEnable", true)) {
|
if(prefs.getBoolean("weightEnable", true)) {
|
||||||
lines.add(lineWeight);
|
lines.add(lineWeight);
|
||||||
@@ -402,15 +403,14 @@ public class OverviewFragment extends Fragment implements FragmentUpdateListener
|
|||||||
|
|
||||||
private void updateLastPieChart() {
|
private void updateLastPieChart() {
|
||||||
|
|
||||||
List<ArcValue> arcValuesLast = new ArrayList<ArcValue>();
|
List<SliceValue> arcValuesLast = new ArrayList<SliceValue>();
|
||||||
|
|
||||||
arcValuesLast.add(new ArcValue(lastScaleData.fat, Utils.COLOR_ORANGE));
|
arcValuesLast.add(new SliceValue(lastScaleData.fat, ChartUtils.COLOR_ORANGE));
|
||||||
arcValuesLast.add(new ArcValue(lastScaleData.water, Utils.COLOR_BLUE));
|
arcValuesLast.add(new SliceValue(lastScaleData.water, ChartUtils.COLOR_BLUE));
|
||||||
arcValuesLast.add(new ArcValue(lastScaleData.muscle, Utils.COLOR_GREEN));
|
arcValuesLast.add(new SliceValue(lastScaleData.muscle, ChartUtils.COLOR_GREEN));
|
||||||
|
|
||||||
PieChartData pieChartData = new PieChartData(arcValuesLast);
|
PieChartData pieChartData = new PieChartData(arcValuesLast);
|
||||||
pieChartData.setHasLabels(false);
|
pieChartData.setHasLabels(false);
|
||||||
pieChartData.setFormatter(new SimpleValueFormatter(1, false, null, " %".toCharArray()));
|
|
||||||
pieChartData.setHasCenterCircle(true);
|
pieChartData.setHasCenterCircle(true);
|
||||||
pieChartData.setCenterText1(Float.toString(lastScaleData.weight) + " " + ScaleUser.UNIT_STRING[currentScaleUser.scale_unit]);
|
pieChartData.setCenterText1(Float.toString(lastScaleData.weight) + " " + ScaleUser.UNIT_STRING[currentScaleUser.scale_unit]);
|
||||||
pieChartData.setCenterText2(new SimpleDateFormat("dd. MMM yyyy").format(lastScaleData.date_time));
|
pieChartData.setCenterText2(new SimpleDateFormat("dd. MMM yyyy").format(lastScaleData.date_time));
|
||||||
@@ -442,11 +442,10 @@ public class OverviewFragment extends Fragment implements FragmentUpdateListener
|
|||||||
startActivityForResult(intent, 1);
|
startActivityForResult(intent, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
private class PieChartLastTouchListener implements PieChartView.PieChartOnValueTouchListener
|
private class PieChartLastTouchListener implements PieChartOnValueSelectListener
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public void onValueTouched(int i, ArcValue arcValue)
|
public void onValueSelected(int i, SliceValue arcValue) {
|
||||||
{
|
|
||||||
if (lastScaleData == null) {
|
if (lastScaleData == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -468,8 +467,7 @@ public class OverviewFragment extends Fragment implements FragmentUpdateListener
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onNothingTouched()
|
public void onValueDeselected() {
|
||||||
{
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user