Commit cb2ba72a7e49da54339fed07eec14d148bd173f2

Authored by chudinhbka@gmail.com
1 parent 383e854984
Exists in master and in 1 other branch development

update handle count step

Showing 8 changed files with 46 additions and 24 deletions Inline Diff

app/src/main/java/com/dinhcv/lifelogpedometer/activity/TopFragment.java
1 package com.dinhcv.lifelogpedometer.activity; 1 package com.dinhcv.lifelogpedometer.activity;
2 2
3 import android.content.Context; 3 import android.content.Context;
4 import android.os.Bundle; 4 import android.os.Bundle;
5 import android.support.annotation.Nullable; 5 import android.support.annotation.Nullable;
6 import android.support.v4.app.FragmentManager; 6 import android.support.v4.app.FragmentManager;
7 import android.support.v4.app.FragmentTransaction; 7 import android.support.v4.app.FragmentTransaction;
8 import android.view.LayoutInflater; 8 import android.view.LayoutInflater;
9 import android.view.View; 9 import android.view.View;
10 import android.view.ViewGroup; 10 import android.view.ViewGroup;
11 import android.widget.FrameLayout; 11 import android.widget.FrameLayout;
12 12
13 import com.dinhcv.lifelogpedometer.R; 13 import com.dinhcv.lifelogpedometer.R;
14 import com.dinhcv.lifelogpedometer.utils.Debug;
14 15
15 public class TopFragment extends FragmentBase implements SettingFragmentPresenter { 16 public class TopFragment extends FragmentBase implements SettingFragmentPresenter {
16 public enum TopFragmentTag { 17 public enum TopFragmentTag {
17 TOP_DATE, 18 TOP_DATE,
18 TOP_TODAY, 19 TOP_TODAY,
19 } 20 }
20 21
21 private FragmentTransaction mFragmentTransaction; 22 private FragmentTransaction mFragmentTransaction;
22 private FragmentManager mFragmentManager; 23 private FragmentManager mFragmentManager;
23 24
24 private View mRootView; 25 private View mRootView;
25 private FrameLayout mTopLayout; 26 private FrameLayout mTopLayout;
26 private TopDateFragment mTopDateFragment; 27 private TopDateFragment mTopDateFragment;
27 private TopTodayFragment mTopTodayFragment; 28 private TopTodayFragment mTopTodayFragment;
28 29
29 public static final String TOP_DATE_TAG = "top_date"; 30 public static final String TOP_DATE_TAG = "top_date";
30 public static final String TOP_TODAY_TAG = "top_today"; 31 public static final String TOP_TODAY_TAG = "top_today";
31 32
32 public TopFragmentTag mCurrentFragment = TopFragmentTag.TOP_DATE; 33 public TopFragmentTag mCurrentFragment = TopFragmentTag.TOP_DATE;
33 34
34 @Override 35 @Override
35 public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle 36 public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle
36 savedInstanceState) { 37 savedInstanceState) {
37 // Inflate the layout for this fragment 38 // Inflate the layout for this fragment
38 mRootView = inflater.inflate(R.layout.fragment_top, container, false); 39 mRootView = inflater.inflate(R.layout.fragment_top, container, false);
39 mFragmentManager = getFragmentManager(); 40 mFragmentManager = getFragmentManager();
40 mFragmentTransaction = mFragmentManager.beginTransaction(); 41 mFragmentTransaction = mFragmentManager.beginTransaction();
41 42
42 initView(); 43 initView();
43 initData(); 44 initData();
44 45
45 return mRootView; 46 return mRootView;
46 } 47 }
47 48
48 /** 49 /**
49 */ 50 */
50 private void initView() { 51 private void initView() {
51 mTopLayout = (FrameLayout) mRootView.findViewById(R.id.layout_top); 52 mTopLayout = (FrameLayout) mRootView.findViewById(R.id.layout_top);
52 53
53 mTopDateFragment = new TopDateFragment(); 54 mTopDateFragment = new TopDateFragment();
54 mTopDateFragment.setRootFragment(this); 55 mTopDateFragment.setRootFragment(this);
55 mTopTodayFragment = new TopTodayFragment(); 56 mTopTodayFragment = new TopTodayFragment();
56 mTopTodayFragment.setRootFragment(this); 57 mTopTodayFragment.setRootFragment(this);
57 58
58 showContentFragment(); 59 showContentFragment();
59 } 60 }
60 61
61 public void showContentFragment() { 62 public void showContentFragment() {
62 ((PedometerActivity) getActivity()).setVisibleIconHome(false); 63 ((PedometerActivity) getActivity()).setVisibleIconHome(false);
63 mCurrentFragment = TopFragmentTag.TOP_DATE; 64 mCurrentFragment = TopFragmentTag.TOP_DATE;
64 mFragmentTransaction = mFragmentManager.beginTransaction(); 65 mFragmentTransaction = mFragmentManager.beginTransaction();
65 mFragmentTransaction.replace(mTopLayout.getId(), mTopDateFragment, TOP_DATE_TAG); 66 mFragmentTransaction.replace(mTopLayout.getId(), mTopDateFragment, TOP_DATE_TAG);
66 mFragmentTransaction.commit(); 67 mFragmentTransaction.commit();
67 } 68 }
68 69
69 public void showDetailFragment() { 70 public void showDetailFragment() {
70 ((PedometerActivity) getActivity()).setVisibleIconHome(true); 71 ((PedometerActivity) getActivity()).setVisibleIconHome(true);
71 mCurrentFragment = TopFragmentTag.TOP_TODAY; 72 mCurrentFragment = TopFragmentTag.TOP_TODAY;
72 mFragmentTransaction = mFragmentManager.beginTransaction(); 73 mFragmentTransaction = mFragmentManager.beginTransaction();
73 mFragmentTransaction.replace(mTopLayout.getId(), mTopTodayFragment, TOP_TODAY_TAG); 74 mFragmentTransaction.replace(mTopLayout.getId(), mTopTodayFragment, TOP_TODAY_TAG);
74 mFragmentTransaction.commit(); 75 mFragmentTransaction.commit();
75 } 76 }
76 77
77 public void clickBackToHome(){ 78 public void clickBackToHome(){
78 switch (mCurrentFragment) { 79 switch (mCurrentFragment) {
79 case TOP_DATE: 80 case TOP_DATE:
80 break; 81 break;
81 case TOP_TODAY: 82 case TOP_TODAY:
82 showContentFragment(); 83 showContentFragment();
83 break; 84 break;
84 default: 85 default:
85 break; 86 break;
86 } 87 }
87 } 88 }
88 89
89 /** 90 /**
90 * Init data 91 * Init data
91 */ 92 */
92 private void initData() { 93 private void initData() {
93 94 Debug.normal("Current fragment : "+ mCurrentFragment);
95 if (mCurrentFragment == TopFragmentTag.TOP_DATE){
96 ((PedometerActivity) getActivity()).setVisibleIconHome(false);
97 }else {
98 ((PedometerActivity) getActivity()).setVisibleIconHome(true);
99 }
94 } 100 }
95 101
96 @Override 102 @Override
97 public void onAttach(Context context) { 103 public void onAttach(Context context) {
98 super.onAttach(context); 104 super.onAttach(context);
99 105
100 } 106 }
101 107
102 /** 108 /**
103 * Save data 109 * Save data
104 */ 110 */
105 @Override 111 @Override
106 public void onSaveData() { 112 public void onSaveData() {
107 } 113 }
108 114
109 @Override 115 @Override
110 public void onInvalidate(boolean isInit) { 116 public void onInvalidate(boolean isInit) {
111 initData(); 117 initData();
112 } 118 }
113 119
114 120
115 @Override 121 @Override
116 public void onViewStateRestored(@Nullable Bundle savedInstanceState) { 122 public void onViewStateRestored(@Nullable Bundle savedInstanceState) {
117 super.onViewStateRestored(savedInstanceState); 123 super.onViewStateRestored(savedInstanceState);
118 124
119 initData(); 125 initData();
120 } 126 }
121 127
122 } 128 }
123 129
app/src/main/java/com/dinhcv/lifelogpedometer/activity/TopTodayFragment.java
1 package com.dinhcv.lifelogpedometer.activity; 1 package com.dinhcv.lifelogpedometer.activity;
2 2
3 import android.app.DatePickerDialog; 3 import android.app.DatePickerDialog;
4 import android.app.ProgressDialog;
4 import android.content.Context; 5 import android.content.Context;
5 import android.graphics.Color; 6 import android.graphics.Color;
6 import android.hardware.Sensor; 7 import android.hardware.Sensor;
7 import android.hardware.SensorEvent; 8 import android.hardware.SensorEvent;
8 import android.hardware.SensorEventListener; 9 import android.hardware.SensorEventListener;
9 import android.hardware.SensorManager; 10 import android.hardware.SensorManager;
10 import android.os.Bundle; 11 import android.os.Bundle;
11 import android.support.annotation.Nullable; 12 import android.support.annotation.Nullable;
12 import android.view.LayoutInflater; 13 import android.view.LayoutInflater;
13 import android.view.Menu; 14 import android.view.Menu;
14 import android.view.MenuInflater; 15 import android.view.MenuInflater;
15 import android.view.View; 16 import android.view.View;
16 import android.view.ViewGroup; 17 import android.view.ViewGroup;
17 import android.widget.DatePicker; 18 import android.widget.DatePicker;
18 import android.widget.ImageView; 19 import android.widget.ImageView;
19 import android.widget.LinearLayout; 20 import android.widget.LinearLayout;
20 import android.widget.TextView; 21 import android.widget.TextView;
21 import android.widget.Toast; 22 import android.widget.Toast;
22 23
23 import com.dinhcv.lifelogpedometer.R; 24 import com.dinhcv.lifelogpedometer.R;
24 import com.dinhcv.lifelogpedometer.interfaces.LLAPIManagerListener; 25 import com.dinhcv.lifelogpedometer.interfaces.LLAPIManagerListener;
25 import com.dinhcv.lifelogpedometer.model.StepModel; 26 import com.dinhcv.lifelogpedometer.model.StepModel;
26 import com.dinhcv.lifelogpedometer.model.structure.top.StepItemInfo; 27 import com.dinhcv.lifelogpedometer.model.structure.top.StepItemInfo;
27 import com.dinhcv.lifelogpedometer.model.structure.top.TopInfo; 28 import com.dinhcv.lifelogpedometer.model.structure.top.TopInfo;
28 import com.dinhcv.lifelogpedometer.portal.LLAPIManager; 29 import com.dinhcv.lifelogpedometer.portal.LLAPIManager;
29 import com.dinhcv.lifelogpedometer.utils.Const; 30 import com.dinhcv.lifelogpedometer.utils.Const;
30 import com.dinhcv.lifelogpedometer.utils.DayAxisValueFormatter; 31 import com.dinhcv.lifelogpedometer.utils.DayAxisValueFormatter;
31 import com.dinhcv.lifelogpedometer.utils.Debug; 32 import com.dinhcv.lifelogpedometer.utils.Debug;
32 import com.dinhcv.lifelogpedometer.utils.Utils; 33 import com.dinhcv.lifelogpedometer.utils.Utils;
33 import com.github.mikephil.charting.components.XAxis; 34 import com.github.mikephil.charting.components.XAxis;
34 import com.github.mikephil.charting.components.YAxis; 35 import com.github.mikephil.charting.components.YAxis;
35 36
36 import com.github.mikephil.charting.charts.BarChart; 37 import com.github.mikephil.charting.charts.BarChart;
37 import com.github.mikephil.charting.data.BarData; 38 import com.github.mikephil.charting.data.BarData;
38 import com.github.mikephil.charting.data.BarDataSet; 39 import com.github.mikephil.charting.data.BarDataSet;
39 import com.github.mikephil.charting.data.BarEntry; 40 import com.github.mikephil.charting.data.BarEntry;
40 import com.github.mikephil.charting.interfaces.datasets.IBarDataSet; 41 import com.github.mikephil.charting.interfaces.datasets.IBarDataSet;
41 42
42 import org.eazegraph.lib.charts.PieChart; 43 import org.eazegraph.lib.charts.PieChart;
43 import org.eazegraph.lib.models.PieModel; 44 import org.eazegraph.lib.models.PieModel;
44 import org.json.JSONArray; 45 import org.json.JSONArray;
45 import org.json.JSONException; 46 import org.json.JSONException;
46 import org.json.JSONObject; 47 import org.json.JSONObject;
47 48
48 import java.text.NumberFormat; 49 import java.text.NumberFormat;
49 import java.util.ArrayList; 50 import java.util.ArrayList;
50 import java.util.Arrays; 51 import java.util.Arrays;
51 import java.util.Calendar; 52 import java.util.Calendar;
52 import java.util.Date; 53 import java.util.Date;
53 import java.util.List; 54 import java.util.List;
54 import java.util.Locale; 55 import java.util.Locale;
55 56
56 import static com.github.mikephil.charting.utils.ColorTemplate.rgb; 57 import static com.github.mikephil.charting.utils.ColorTemplate.rgb;
57 58
58 59
59 public class TopTodayFragment extends FragmentBase implements SettingFragmentPresenter, SensorEventListener { 60 public class TopTodayFragment extends FragmentBase implements SettingFragmentPresenter, SensorEventListener {
60 61
61 private TextView stepsView; 62 private TextView stepsView;
62 private TextView tvStepGoal; 63 private TextView tvStepGoal;
63 private TextView tvDistance; 64 private TextView tvDistance;
64 private TextView tvTime; 65 private TextView tvTime;
65 private TextView tvStepRemain; 66 private TextView tvStepRemain;
66 private TextView tvStepRateDone; 67 private TextView tvStepRateDone;
67 private boolean showSteps = true; 68 private boolean showSteps = true;
68 private PieModel sliceGoal, sliceCurrent; 69 private PieModel sliceGoal, sliceCurrent;
69 private PieChart pg; 70 private PieChart pg;
70 private TextView tvDate; 71 private TextView tvDate;
71 private ImageView ivBack; 72 private ImageView ivBack;
72 private ImageView ivNext; 73 private ImageView ivNext;
73 74
74 private LinearLayout llBike; 75 private LinearLayout llBike;
75 private LinearLayout llWalking; 76 private LinearLayout llWalking;
76 private LinearLayout llRunning; 77 private LinearLayout llRunning;
77 private Const.STEP_TYPE stepType; 78 private Const.STEP_TYPE stepType;
78 79
79 private Date mAnaDate; 80 private Date mAnaDate;
80 private Calendar mCalendar; 81 private Calendar mCalendar;
81 82
82 private int mAnaDay; 83 private int mAnaDay;
83 private int mAnaMonth; 84 private int mAnaMonth;
84 private int mAnaYear; 85 private int mAnaYear;
85 86
86 public static int STEP_SIZE = 75; 87 public static int STEP_SIZE = 75;
87 private StepModel mStepModel; 88 private StepModel mStepModel;
88 private TextView tvSmallStepGoal; 89 private TextView tvSmallStepGoal;
89 private TextView tvSmallRemain; 90 private TextView tvSmallRemain;
90 private Context mContext; 91 private Context mContext;
91 92
92 public final static NumberFormat formatter = NumberFormat.getInstance(Locale.getDefault()); 93 public final static NumberFormat formatter = NumberFormat.getInstance(Locale.getDefault());
93 private SensorManager sensorManager; 94 private SensorManager sensorManager;
94 private boolean activityRunning; 95 private boolean activityRunning;
95 private int stepTotal = 0; 96 private int stepTotal = 0;
96 private int stepRemain = 0; 97 private int stepGoal = 0;
97 private int stepCount = 0; 98 private int stepCount = 0;
98 99
99 private Date mFromDate; 100 private Date mFromDate;
100 private Date mToDate; 101 private Date mToDate;
101 102
102 private TopInfo mTopInfo = new TopInfo(); 103 private TopInfo mTopInfo = new TopInfo();
103 private BarChart mChart; 104 private BarChart mChart;
104 105
105 private List<String> dateList; 106 private List<String> dateList;
106 private String[] mParties; 107 private String[] mParties;
107 private Integer[] mStep; 108 private Integer[] mStep;
109 private ProgressDialog progress;
108 110
109 private TopFragment mTopFragment; 111 private TopFragment mTopFragment;
110 public void setRootFragment(TopFragment frag) { 112 public void setRootFragment(TopFragment frag) {
111 this.mTopFragment = frag; 113 this.mTopFragment = frag;
112 } 114 }
113 115
114 @Override 116 @Override
115 public void onCreate(final Bundle savedInstanceState) { 117 public void onCreate(final Bundle savedInstanceState) {
116 super.onCreate(savedInstanceState); 118 super.onCreate(savedInstanceState);
117 setHasOptionsMenu(true); 119 setHasOptionsMenu(true);
118 } 120 }
119 121
120 @Override 122 @Override
121 public View onCreateView(final LayoutInflater inflater, final ViewGroup container, 123 public View onCreateView(final LayoutInflater inflater, final ViewGroup container,
122 final Bundle savedInstanceState) { 124 final Bundle savedInstanceState) {
123 final View v = inflater.inflate(R.layout.fragment_top_today, null); 125 final View v = inflater.inflate(R.layout.fragment_top_today, null);
124 mContext = getActivity(); 126 mContext = getActivity();
125 sensorManager = (SensorManager) mContext.getSystemService(Context.SENSOR_SERVICE); 127 sensorManager = (SensorManager) mContext.getSystemService(Context.SENSOR_SERVICE);
126 128
127 initView(v); 129 initView(v);
128 130
129 // slice for the steps taken today 131 // slice for the steps taken today
130 sliceCurrent = new PieModel("", 0, Color.parseColor("#6FE7F7")); 132 sliceCurrent = new PieModel("", 0, Color.parseColor("#6FE7F7"));
131 pg.addPieSlice(sliceCurrent); 133 pg.addPieSlice(sliceCurrent);
132 134
133 // slice for the "missing" steps until reaching the goal 135 // slice for the "missing" steps until reaching the goal
134 sliceGoal = new PieModel("", Const.STEP_GOAL, Color.parseColor("#B7B8B6")); 136 sliceGoal = new PieModel("", Const.STEP_GOAL, Color.parseColor("#B7B8B6"));
135 pg.addPieSlice(sliceGoal); 137 pg.addPieSlice(sliceGoal);
136 pg.setDrawValueInPie(false); 138 pg.setDrawValueInPie(false);
137 pg.setUsePieRotation(false); 139 pg.setUsePieRotation(false);
138 pg.startAnimation(); 140 pg.startAnimation();
139 pg.setAutoCenterInSlice(false); 141 pg.setAutoCenterInSlice(false);
140 142
141 mCalendar = Calendar.getInstance(); 143 mCalendar = Calendar.getInstance();
142 mCalendar.setTime(new Date()); 144 mCalendar.setTime(new Date());
143 mAnaDate = mCalendar.getTime(); 145 mAnaDate = mCalendar.getTime();
144 mAnaYear = mCalendar.get(Calendar.YEAR); 146 mAnaYear = mCalendar.get(Calendar.YEAR);
145 mAnaMonth = mCalendar.get(Calendar.MONTH); 147 mAnaMonth = mCalendar.get(Calendar.MONTH);
146 mAnaDay = mCalendar.get(Calendar.DAY_OF_MONTH); 148 mAnaDay = mCalendar.get(Calendar.DAY_OF_MONTH);
147 149
148 mFromDate = new Date(); 150 mFromDate = new Date();
149 151
150 tvDate.setText(Utils.dateToStringFormatDayMonthYearJp(mAnaDate)); 152 tvDate.setText(Utils.dateToStringFormatDayMonthYearJp(mAnaDate));
151 153
152 initData(); 154 initData();
153 155
154 handleEvent(); 156 handleEvent();
155 157
156 getTopPage(mAnaDate, stepType); 158 getTopPage(mAnaDate, stepType);
157 159
158 return v; 160 return v;
159 } 161 }
160 162
161 private void initView(View v){ 163 private void initView(View v){
162 stepsView = (TextView) v.findViewById(R.id.steps); 164 stepsView = (TextView) v.findViewById(R.id.steps);
163 tvDistance = (TextView) v.findViewById(R.id.tv_distance); 165 tvDistance = (TextView) v.findViewById(R.id.tv_distance);
164 tvStepGoal = (TextView) v.findViewById(R.id.tv_stepGoal); 166 tvStepGoal = (TextView) v.findViewById(R.id.tv_stepGoal);
165 tvStepRemain = (TextView) v.findViewById(R.id.tv_stepRemain); 167 tvStepRemain = (TextView) v.findViewById(R.id.tv_stepRemain);
166 tvStepRateDone = (TextView) v.findViewById(R.id.tv_stepRateDone); 168 tvStepRateDone = (TextView) v.findViewById(R.id.tv_stepRateDone);
167 tvSmallStepGoal = (TextView) v.findViewById(R.id.tv_smallStepGoal); 169 tvSmallStepGoal = (TextView) v.findViewById(R.id.tv_smallStepGoal);
168 tvSmallRemain = (TextView) v.findViewById(R.id.tv_smallRemain); 170 tvSmallRemain = (TextView) v.findViewById(R.id.tv_smallRemain);
169 tvTime = (TextView) v.findViewById(R.id.tv_time); 171 tvTime = (TextView) v.findViewById(R.id.tv_time);
170 tvDate = (TextView) v.findViewById(R.id.tv_date); 172 tvDate = (TextView) v.findViewById(R.id.tv_date);
171 ivBack = (ImageView) v.findViewById(R.id.iv_back); 173 ivBack = (ImageView) v.findViewById(R.id.iv_back);
172 ivNext = (ImageView) v.findViewById(R.id.iv_next); 174 ivNext = (ImageView) v.findViewById(R.id.iv_next);
173 175
174 mChart = (BarChart) v.findViewById(R.id.chart); 176 mChart = (BarChart) v.findViewById(R.id.chart);
175 pg = (PieChart) v.findViewById(R.id.graph); 177 pg = (PieChart) v.findViewById(R.id.graph);
176 178
177 llRunning = (LinearLayout) v.findViewById(R.id.ll_running); 179 llRunning = (LinearLayout) v.findViewById(R.id.ll_running);
178 llWalking = (LinearLayout) v.findViewById(R.id.ll_walking); 180 llWalking = (LinearLayout) v.findViewById(R.id.ll_walking);
179 llBike = (LinearLayout) v.findViewById(R.id.ll_bike); 181 llBike = (LinearLayout) v.findViewById(R.id.ll_bike);
180 } 182 }
181 183
182 private void initData(){ 184 private void initData(){
183 mCalendar = Calendar.getInstance(); 185 mCalendar = Calendar.getInstance();
184 mCalendar.setTime(new Date()); 186 mCalendar.setTime(new Date());
185 mAnaDate = mCalendar.getTime(); 187 mAnaDate = mCalendar.getTime();
186 mAnaYear = mCalendar.get(Calendar.YEAR); 188 mAnaYear = mCalendar.get(Calendar.YEAR);
187 mAnaMonth = mCalendar.get(Calendar.MONTH); 189 mAnaMonth = mCalendar.get(Calendar.MONTH);
188 mAnaDay = mCalendar.get(Calendar.DAY_OF_MONTH); 190 mAnaDay = mCalendar.get(Calendar.DAY_OF_MONTH);
189 191
190 192
191 stepType = Const.STEP_TYPE.WALKING; 193 stepType = Const.STEP_TYPE.WALKING;
192 updateUiStepType(false, true, false); 194 updateUiStepType(false, true, false);
193 195
194 tvDate.setText(Utils.dateToStringFormatDayMonthYearJp(mAnaDate)); 196 tvDate.setText(Utils.dateToStringFormatDayMonthYearJp(mAnaDate));
195 } 197 }
196 198
197 private void updateUiStepType(boolean b1, boolean b2, boolean b3) { 199 private void updateUiStepType(boolean b1, boolean b2, boolean b3) {
198 llBike.setSelected(b1); 200 llBike.setSelected(b1);
199 llWalking.setSelected(b2); 201 llWalking.setSelected(b2);
200 llRunning.setSelected(b3); 202 llRunning.setSelected(b3);
201 } 203 }
202 204
203 private void stepsDistanceChanged() { 205 private void stepsDistanceChanged() {
206 if (progress != null){
207 progress.dismiss();
208 }
204 updatePie(); 209 updatePie();
205 updateBars(); 210 updateBars();
206 } 211 }
207 212
208 213
209 @Override 214 @Override
210 public void onCreateOptionsMenu(final Menu menu, final MenuInflater inflater) { 215 public void onCreateOptionsMenu(final Menu menu, final MenuInflater inflater) {
211 inflater.inflate(R.menu.main, menu); 216 inflater.inflate(R.menu.main, menu);
212 } 217 }
213 218
214 private void getTopPage(Date date, Const.STEP_TYPE stepType){ 219 private void getTopPage(Date date, Const.STEP_TYPE stepType){
215 220
216 showDialog(mContext); 221 progress = new ProgressDialog(mContext);
222 progress.setMessage(getString(R.string.loading));
223 progress.setCancelable(false);
224 progress.show();
217 LLAPIManager.topInfo(date, stepType, new LLAPIManagerListener() { 225 LLAPIManager.topInfo(date, stepType, new LLAPIManagerListener() {
218 @Override 226 @Override
219 public void onError(Error error) { 227 public void onError(Error error) {
220 Debug.error("Get data history error"); 228 Debug.error("Get data history error");
221 hiddenDialog(); 229 hiddenDialog();
222 showDialogNotData(); 230 showDialogNotData();
223 } 231 }
224 232
225 @Override 233 @Override
226 public void onSuccess(String json) { 234 public void onSuccess(String json) {
227 Debug.error("Get data history success"); 235 Debug.error("Get data history success");
228 hiddenDialog();
229 loadDataDone(json); 236 loadDataDone(json);
230 } 237 }
231 238
232 @Override 239 @Override
233 public void onSuccess(JSONObject object) { 240 public void onSuccess(JSONObject object) {
234 Debug.error("Get data history success"); 241 Debug.error("Get data history success");
235 hiddenDialog(); 242 hiddenDialog();
236 } 243 }
237 }); 244 });
238 } 245 }
239 246
240 private void showDialogNotData(){ 247 private void showDialogNotData(){
241 showAlerDialog(mContext, getResources().getString(R.string.can_not_get_data)); 248 showAlerDialog(mContext, getResources().getString(R.string.can_not_get_data));
242 } 249 }
243 250
244 private void loadDataDone(String jsonString) { 251 private void loadDataDone(String jsonString) {
245 JSONObject jsonObject = null; 252 JSONObject jsonObject = null;
246 try { 253 try {
247 jsonObject = new JSONObject(jsonString); 254 jsonObject = new JSONObject(jsonString);
248 int status = jsonObject.optInt("status"); 255 int status = jsonObject.optInt("status");
249 if (status == 1) { 256 if (status == 1) {
250 JSONObject jsonObject1 = jsonObject.optJSONObject("result"); 257 JSONObject jsonObject1 = jsonObject.optJSONObject("result");
251 JSONObject targetInf = jsonObject1.getJSONObject("targetInf"); 258 JSONObject targetInf = jsonObject1.getJSONObject("targetInf");
252 259
253 if (targetInf != null){ 260 if (targetInf != null){
254 String target = targetInf.optString("target_step"); 261 String target = targetInf.optString("target_step");
255 Debug.normal("Target: "+ target); 262 Debug.normal("Target: "+ target);
256 mTopInfo.setTaget(targetInf.optString("target_step")); 263 mTopInfo.setTaget(targetInf.optString("target_step"));
257 mTopInfo.setSteps(targetInf.optString("num_step")); 264 mTopInfo.setSteps(targetInf.optString("num_step"));
258 mTopInfo.setStepRemain(targetInf.optString("remaining_step")); 265 mTopInfo.setStepRemain(targetInf.optString("remaining_step"));
259 mTopInfo.setCompletePercent(targetInf.optString("complete_percent")); 266 mTopInfo.setCompletePercent(targetInf.optString("complete_percent"));
260 } 267 }
261 268
262 mTopInfo.setKcalo(jsonObject1.optString("kcal")); 269 mTopInfo.setKcalo(jsonObject1.optString("kcal"));
263 mTopInfo.setDistance(jsonObject1.optString("distance")); 270 mTopInfo.setDistance(jsonObject1.optString("distance"));
264 mTopInfo.setTime(jsonObject1.optString("time")); 271 mTopInfo.setTime(jsonObject1.optString("time"));
265 JSONArray stepArr = jsonObject1.optJSONArray("dataChart"); 272 JSONArray stepArr = jsonObject1.optJSONArray("dataChart");
266 273
267 274
268 if (stepArr != null && stepArr.length() > 0) { 275 if (stepArr != null && stepArr.length() > 0) {
269 List<StepItemInfo> infoLists = new ArrayList<>(); 276 List<StepItemInfo> infoLists = new ArrayList<>();
270 for (int i = 0; i < stepArr.length(); i++){ 277 for (int i = 0; i < stepArr.length(); i++){
271 StepItemInfo stepItemInfo = new StepItemInfo(); 278 StepItemInfo stepItemInfo = new StepItemInfo();
272 JSONObject ob = (JSONObject) stepArr.get(i); 279 JSONObject ob = (JSONObject) stepArr.get(i);
273 stepItemInfo.setHour(ob.optInt("hour")); 280 stepItemInfo.setHour(ob.optInt("hour"));
274 stepItemInfo.setNumStep(ob.optInt("numStep")); 281 stepItemInfo.setNumStep(ob.optInt("numStep"));
275 infoLists.add(stepItemInfo); 282 infoLists.add(stepItemInfo);
276 } 283 }
277 284
278 mTopInfo.setStepList(infoLists); 285 mTopInfo.setStepList(infoLists);
279 } 286 }
280 287
281 } 288 }
282 } catch (JSONException e) { 289 } catch (JSONException e) {
283 e.printStackTrace(); 290 e.printStackTrace();
284 mTopInfo = new TopInfo();; 291 mTopInfo = new TopInfo();;
285 } 292 }
286 293
287 stepsDistanceChanged(); 294 stepsDistanceChanged();
288 } 295 }
289 296
290 private void updatePie() { 297 private void updatePie() {
291 // todayOffset might still be Integer.MIN_VALUE on first start 298 // todayOffset might still be Integer.MIN_VALUE on first start
292 int stepsToday = 0; 299 int stepsToday = 0;
293 int stepTarget = 0; 300 int stepTarget = 0;
294 if (mTopInfo != null) { 301 if (mTopInfo != null) {
295 stepsToday = Integer.valueOf(mTopInfo.getSteps()); 302 if (mTopInfo.getSteps().contains(",")){
303 stepsToday = Integer.valueOf(mTopInfo.getSteps().replace(",", ""));
304 }else {
305 stepsToday = Integer.valueOf(mTopInfo.getSteps());
306 }
307
296 if (mTopInfo.getTaget().contains(",")) { 308 if (mTopInfo.getTaget().contains(",")) {
297 stepTarget = Integer.valueOf(mTopInfo.getTaget().replace(",", "")); 309 stepTarget = Integer.valueOf(mTopInfo.getTaget().replace(",", ""));
298 }else { 310 }else {
299 stepTarget = Integer.valueOf(mTopInfo.getTaget()); 311 stepTarget = Integer.valueOf(mTopInfo.getTaget());
300 } 312 }
301 } 313 }
302 sliceCurrent.setValue(stepsToday); 314 sliceCurrent.setValue(stepsToday);
303 if (stepTarget - stepsToday > 0) { 315 if (stepTarget - stepsToday > 0) {
304 // goal not reached yet 316 // goal not reached yet
305 if (pg.getData().size() == 1) { 317 if (pg.getData().size() == 1) {
306 pg.addPieSlice(sliceGoal); 318 pg.addPieSlice(sliceGoal);
307 } 319 }
308 sliceGoal.setValue(stepTarget - stepsToday); 320 sliceGoal.setValue(stepTarget - stepsToday);
309 } else { 321 } else {
310 // goal reached 322 // goal reached
311 pg.clearChart(); 323 pg.clearChart();
312 pg.addPieSlice(sliceCurrent); 324 pg.addPieSlice(sliceCurrent);
313 } 325 }
314 pg.update(); 326 pg.update();
315 327 stepGoal = stepTarget;
316 tvDistance.setText(mTopInfo.getDistance()); 328 stepTotal = stepsToday;
317 tvTime.setText(mTopInfo.getTime());
318
319 stepsView.setText(formatter.format(stepsToday)); 329 stepsView.setText(formatter.format(stepsToday));
320 int remain = stepTarget - stepsToday; 330 int stepRemain = stepTarget - stepsToday;
321 tvStepRemain.setText(String.valueOf(remain)); 331 tvStepRemain.setText(String.valueOf(stepRemain));
322 tvStepRateDone.setText(getResources().getString(R.string.percent_unit, Utils.convert2String2Decimal(stepsToday *100/ Const.STEP_GOAL))); 332 tvStepRateDone.setText(getResources().getString(R.string.percent_unit, Utils.convert2String2Decimal(stepsToday *100/ stepTarget)));
323 tvSmallRemain.setText(getResources().getString(R.string.pie_text_content3a, remain)); 333 tvSmallRemain.setText(getResources().getString(R.string.pie_text_content3a, stepRemain));
324 tvStepGoal.setText(mTopInfo.getTaget()); 334 tvStepGoal.setText(mTopInfo.getTaget());
325 tvSmallStepGoal.setText(mTopInfo.getTaget()); 335 tvSmallStepGoal.setText(mTopInfo.getTaget());
336
326 tvDistance.setText(mTopInfo.getDistance()); 337 tvDistance.setText(mTopInfo.getDistance());
327 tvTime.setText(mTopInfo.getTime()); 338 tvTime.setText(mTopInfo.getTime());
328 339
329 double distanceToday = stepsToday * STEP_SIZE; 340 double distanceToday = stepsToday * STEP_SIZE;
330 distanceToday /= 100000; 341 distanceToday /= 100000;
331 tvDistance.setText(Utils.convert2String2Decimal(distanceToday)); 342 tvDistance.setText(Utils.convert2String2Decimal(distanceToday));
332 343
333 } 344 }
334 345
335 /** 346 /**
336 * Updates the bar graph to show the steps/distance of the last week. Should 347 * Updates the bar graph to show the steps/distance of the last week. Should
337 * be called when switching from step count to distance. 348 * be called when switching from step count to distance.
338 */ 349 */
339 private void updateBars() { 350 private void updateBars() {
340 351
341 dateList = new ArrayList<>(); 352 dateList = new ArrayList<>();
342 List<String> dateList = new ArrayList<>(); 353 List<String> dateList = new ArrayList<>();
343 List<Integer> stepList = new ArrayList<>(); 354 List<Integer> stepList = new ArrayList<>();
344 List<StepItemInfo> stepItemInfos = mTopInfo.getStepList(); 355 List<StepItemInfo> stepItemInfos = mTopInfo.getStepList();
345 if (stepItemInfos != null && stepItemInfos.size() >0) { 356 if (stepItemInfos != null && stepItemInfos.size() >0) {
346 for (int i = 0; i < stepItemInfos.size(); i++){ 357 for (int i = 0; i < stepItemInfos.size(); i++){
347 dateList.add(String.valueOf(stepItemInfos.get(i).getHour())); 358 dateList.add(String.valueOf(stepItemInfos.get(i).getHour()));
348 stepList.add(stepItemInfos.get(i).getNumStep()); 359 stepList.add(stepItemInfos.get(i).getNumStep());
349 } 360 }
350 } 361 }
351 362
352 mStep = stepList.toArray(new Integer[0]); 363 mStep = stepList.toArray(new Integer[0]);
353 mParties = dateList.toArray(new String[0]); 364 mParties = dateList.toArray(new String[0]);
354 365
355 initGraph(); 366 initGraph();
356 } 367 }
357 368
358 private void initGraph(){ 369 private void initGraph(){
359 370
360 mChart.setDrawBarShadow(false); 371 mChart.setDrawBarShadow(false);
361 mChart.setDrawValueAboveBar(true); 372 mChart.setDrawValueAboveBar(true);
362 373
363 // if more than 60 entries are displayed in the chart, no values will be 374 // if more than 60 entries are displayed in the chart, no values will be
364 // drawn 375 // drawn
365 mChart.setMaxVisibleValueCount(60); 376 mChart.setMaxVisibleValueCount(60);
366 377
367 mChart.getDescription().setEnabled(false); 378 mChart.getDescription().setEnabled(false);
368 // scaling can now only be done on x- and y-axis separately 379 // scaling can now only be done on x- and y-axis separately
369 mChart.setPinchZoom(false); 380 mChart.setPinchZoom(false);
370 381
371 mChart.setDrawGridBackground(false); 382 mChart.setDrawGridBackground(false);
372 // mChart.setDrawYLabels(false); 383 // mChart.setDrawYLabels(false);
373 List<String> listx = Arrays.asList(mParties); 384 List<String> listx = Arrays.asList(mParties);
374 DayAxisValueFormatter xValueFormatter = new DayAxisValueFormatter(listx); 385 DayAxisValueFormatter xValueFormatter = new DayAxisValueFormatter(listx);
375 386
376 XAxis xAxis = mChart.getXAxis(); 387 XAxis xAxis = mChart.getXAxis();
377 xAxis.setLabelRotationAngle(0); 388 xAxis.setLabelRotationAngle(0);
378 xAxis.setPosition(XAxis.XAxisPosition.TOP); 389 xAxis.setPosition(XAxis.XAxisPosition.TOP);
379 xAxis.setDrawGridLines(true); 390 xAxis.setDrawGridLines(true);
380 xAxis.setLabelCount(10); 391 xAxis.setLabelCount(10);
381 xAxis.setTextColor(Color.WHITE); 392 xAxis.setTextColor(Color.WHITE);
382 xAxis.setValueFormatter(xValueFormatter); 393 xAxis.setValueFormatter(xValueFormatter);
383 394
384 395
385 YAxis leftAxis = mChart.getAxisLeft(); 396 YAxis leftAxis = mChart.getAxisLeft();
386 leftAxis.setDrawLabels(false); 397 leftAxis.setDrawLabels(false);
387 leftAxis.setDrawGridLines(false); 398 leftAxis.setDrawGridLines(false);
388 leftAxis.setAxisMinimum(0f); 399 leftAxis.setAxisMinimum(0f);
389 leftAxis.setAxisMaximum(10000f); 400 leftAxis.setAxisMaximum(10000f);
390 leftAxis.setDrawZeroLine(false); 401 leftAxis.setDrawZeroLine(false);
391 402
392 leftAxis.setEnabled(false); 403 leftAxis.setEnabled(false);
393 mChart.setDrawValueAboveBar(false); 404 mChart.setDrawValueAboveBar(false);
394 mChart.getAxisRight().setEnabled(false); 405 mChart.getAxisRight().setEnabled(false);
395 406
396 // set auto scale min max 407 // set auto scale min max
397 mChart.setAutoScaleMinMaxEnabled(true); 408 mChart.setAutoScaleMinMaxEnabled(true);
398 mChart.notifyDataSetChanged(); 409 mChart.notifyDataSetChanged();
399 410
400 // Set enimate y 411 // Set enimate y
401 mChart.animateY(2000); 412 mChart.animateY(2000);
402 413
403 setData(); 414 setData();
404 415
405 mChart.getLegend().setEnabled(false); 416 mChart.getLegend().setEnabled(false);
406 } 417 }
407 418
408 419
409 private void setData() { 420 private void setData() {
410 421
411 ArrayList<String> xVals = new ArrayList<>(); 422 ArrayList<String> xVals = new ArrayList<>();
412 for (int i = 0; i < mStep.length; i++) { 423 for (int i = 0; i < mStep.length; i++) {
413 xVals.add(mParties[i % mStep.length]); 424 xVals.add(mParties[i % mStep.length]);
414 } 425 }
415 426
416 ArrayList<BarEntry> yVals1 = new ArrayList<>(); 427 ArrayList<BarEntry> yVals1 = new ArrayList<>();
417 for (int i = 0; i < mStep.length; i++) { 428 for (int i = 0; i < mStep.length; i++) {
418 float val = (float) (mStep[i]*1); 429 float val = (float) (mStep[i]*1);
419 yVals1.add(new BarEntry(i, val)); 430 yVals1.add(new BarEntry(i, val));
420 } 431 }
421 432
422 BarDataSet set1; 433 BarDataSet set1;
423 434
424 if (mChart.getData() != null && mChart.getData().getDataSetCount() > 0) { 435 if (mChart.getData() != null && mChart.getData().getDataSetCount() > 0) {
425 set1 = (BarDataSet)mChart.getData().getDataSetByIndex(0); 436 set1 = (BarDataSet)mChart.getData().getDataSetByIndex(0);
426 set1.setValues(yVals1); 437 set1.setValues(yVals1);
427 mChart.getData().notifyDataChanged(); 438 mChart.getData().notifyDataChanged();
428 mChart.notifyDataSetChanged(); 439 mChart.notifyDataSetChanged();
429 } else { 440 } else {
430 ArrayList<Integer> colors = new ArrayList<>(); 441 ArrayList<Integer> colors = new ArrayList<>();
431 442
432 443
433 int[] MATERIAL_COLORS = {rgb("#40CDEF")}; 444 int[] MATERIAL_COLORS = {rgb("#40CDEF")};
434 445
435 for (int c : MATERIAL_COLORS) 446 for (int c : MATERIAL_COLORS)
436 colors.add(c); 447 colors.add(c);
437 448
438 set1 = new BarDataSet(yVals1, null); 449 set1 = new BarDataSet(yVals1, null);
439 450
440 set1.setColors(colors); 451 set1.setColors(colors);
441 452
442 ArrayList<IBarDataSet> dataSets = new ArrayList<>(); 453 ArrayList<IBarDataSet> dataSets = new ArrayList<>();
443 dataSets.add(set1); 454 dataSets.add(set1);
444 455
445 BarData data = new BarData(dataSets); 456 BarData data = new BarData(dataSets);
446 data.setValueTextSize(10f); 457 data.setValueTextSize(10f);
447 458
448 mChart.setData(data); 459 mChart.setData(data);
449 } 460 }
450 } 461 }
451 462
452 463
453 464
454 private void handleEvent(){ 465 private void handleEvent(){
455 tvDate.setOnClickListener(new View.OnClickListener() { 466 tvDate.setOnClickListener(new View.OnClickListener() {
456 @Override 467 @Override
457 public void onClick(View view) { 468 public void onClick(View view) {
458 handleAnaDatePicker(); 469 handleAnaDatePicker();
459 } 470 }
460 }); 471 });
461 472
462 ivBack.setOnClickListener(new View.OnClickListener() { 473 ivBack.setOnClickListener(new View.OnClickListener() {
463 @Override 474 @Override
464 public void onClick(View view) { 475 public void onClick(View view) {
465 mCalendar = Calendar.getInstance(); 476 mCalendar = Calendar.getInstance();
466 mCalendar.setTime(mAnaDate); 477 mCalendar.setTime(mAnaDate);
467 mCalendar.add(Calendar.DAY_OF_MONTH, -1); 478 mCalendar.add(Calendar.DAY_OF_MONTH, -1);
468 Date date = mCalendar.getTime(); 479 Date date = mCalendar.getTime();
469 tvDate.setText(Utils.dateToStringFormatDayMonthYearJp(date)); 480 tvDate.setText(Utils.dateToStringFormatDayMonthYearJp(date));
470 mAnaDate = date; 481 mAnaDate = date;
471 } 482 }
472 }); 483 });
473 484
474 ivNext.setOnClickListener(new View.OnClickListener() { 485 ivNext.setOnClickListener(new View.OnClickListener() {
475 @Override 486 @Override
476 public void onClick(View view) { 487 public void onClick(View view) {
477 mCalendar = Calendar.getInstance(); 488 mCalendar = Calendar.getInstance();
478 mCalendar.setTime(mAnaDate); 489 mCalendar.setTime(mAnaDate);
479 mCalendar.add(Calendar.DAY_OF_MONTH, +1); 490 mCalendar.add(Calendar.DAY_OF_MONTH, +1);
480 Date date = mCalendar.getTime(); 491 Date date = mCalendar.getTime();
481 tvDate.setText(Utils.dateToStringFormatDayMonthYearJp(date)); 492 tvDate.setText(Utils.dateToStringFormatDayMonthYearJp(date));
482 mAnaDate = date; 493 mAnaDate = date;
483 } 494 }
484 }); 495 });
485 496
486 llBike.setOnClickListener(new View.OnClickListener() { 497 llBike.setOnClickListener(new View.OnClickListener() {
487 @Override 498 @Override
488 public void onClick(View view) { 499 public void onClick(View view) {
489 stepType = Const.STEP_TYPE.BIKE; 500 stepType = Const.STEP_TYPE.BIKE;
490 updateUiStepType(false, false, true); 501 updateUiStepType(true, false, false);
491 getTopPage(mAnaDate, stepType); 502 getTopPage(mAnaDate, stepType);
492 } 503 }
493 }); 504 });
494 505
495 llRunning.setOnClickListener(new View.OnClickListener() { 506 llRunning.setOnClickListener(new View.OnClickListener() {
496 @Override 507 @Override
497 public void onClick(View view) { 508 public void onClick(View view) {
498 stepType = Const.STEP_TYPE.RUNNING; 509 stepType = Const.STEP_TYPE.RUNNING;
499 updateUiStepType(false, false, true); 510 updateUiStepType(false, false, true);
500 getTopPage(mAnaDate, stepType); 511 getTopPage(mAnaDate, stepType);
501 } 512 }
502 }); 513 });
503 514
504 llWalking.setOnClickListener(new View.OnClickListener() { 515 llWalking.setOnClickListener(new View.OnClickListener() {
505 @Override 516 @Override
506 public void onClick(View view) { 517 public void onClick(View view) {
507 stepType = Const.STEP_TYPE.WALKING; 518 stepType = Const.STEP_TYPE.WALKING;
508 updateUiStepType(false, false, true); 519 updateUiStepType(false, true, false);
509 getTopPage(mAnaDate, stepType); 520 getTopPage(mAnaDate, stepType);
510 } 521 }
511 }); 522 });
512 523
513 524
514 } 525 }
515 526
516 527
517 /** 528 /**
518 * Show date picker dialog 529 * Show date picker dialog
519 */ 530 */
520 private void handleAnaDatePicker() { 531 private void handleAnaDatePicker() {
521 532
522 new DatePickerDialog(getActivity(), new DatePickerDialog.OnDateSetListener() { 533 new DatePickerDialog(getActivity(), new DatePickerDialog.OnDateSetListener() {
523 @Override 534 @Override
524 public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) { 535 public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) {
525 536
526 mCalendar = Calendar.getInstance(); 537 mCalendar = Calendar.getInstance();
527 mCalendar.set(year, monthOfYear, dayOfMonth); 538 mCalendar.set(year, monthOfYear, dayOfMonth);
528 mAnaYear = year; 539 mAnaYear = year;
529 mAnaMonth = monthOfYear; 540 mAnaMonth = monthOfYear;
530 mAnaDay = dayOfMonth; 541 mAnaDay = dayOfMonth;
531 Date date = mCalendar.getTime(); 542 Date date = mCalendar.getTime();
532 tvDate.setText(Utils.dateToStringFormatDayMonthYearJp(date)); 543 tvDate.setText(Utils.dateToStringFormatDayMonthYearJp(date));
533 mAnaDate = date; 544 mAnaDate = date;
534 getTopPage(mAnaDate, stepType); 545 getTopPage(mAnaDate, stepType);
535 } 546 }
536 }, mAnaYear, mAnaMonth, mAnaDay).show(); 547 }, mAnaYear, mAnaMonth, mAnaDay).show();
537 548
538 } 549 }
539 550
540 551
541 private void updateUI(){ 552 private void updateUI(){
542 stepTotal = stepTotal + stepCount; 553 Debug.normal("Step total================ "+ stepTotal);
543 stepRemain = stepRemain - stepCount; 554 int stepRemain = stepGoal - stepTotal;
544 double percentDone = stepTotal *100.0 / (stepTotal + stepRemain); 555 double percentDone = stepTotal *100.0 / stepGoal;
545 stepsView.setText(String.valueOf(stepTotal)); 556 stepsView.setText(String.valueOf(stepTotal));
546 tvStepRemain.setText(String.valueOf(stepRemain)); 557 tvStepRemain.setText(String.valueOf(stepRemain));
547 tvStepRateDone.setText(getResources().getString(R.string.percent_unit, Utils.convert2String2Decimal(percentDone))); 558 tvStepRateDone.setText(getResources().getString(R.string.percent_unit, Utils.convert2String2Decimal(percentDone)));
548 tvSmallRemain.setText(String.valueOf(stepRemain)); 559 tvSmallRemain.setText(String.valueOf(stepRemain));
549 } 560 }
550 561
551 @Override 562 @Override
552 public void onAttach(Context context) { 563 public void onAttach(Context context) {
553 super.onAttach(context); 564 super.onAttach(context);
554 565
555 } 566 }
556 567
557 @Override 568 @Override
558 public void onSaveData() { 569 public void onSaveData() {
559 570
560 } 571 }
561 572
562 @Override 573 @Override
563 public void onInvalidate(boolean isInit) { 574 public void onInvalidate(boolean isInit) {
564 initData(); 575 initData();
565 } 576 }
566 577
567 @Override 578 @Override
568 public void onViewStateRestored(@Nullable Bundle savedInstanceState) { 579 public void onViewStateRestored(@Nullable Bundle savedInstanceState) {
569 super.onViewStateRestored(savedInstanceState); 580 super.onViewStateRestored(savedInstanceState);
570 581
571 initData(); 582 initData();
572 } 583 }
573 584
574 585
575 @Override 586 @Override
576 public void onResume() { 587 public void onResume() {
577 super.onResume(); 588 super.onResume();
578 activityRunning = true; 589 activityRunning = true;
579 Sensor countSensor = sensorManager.getDefaultSensor(Sensor.TYPE_STEP_COUNTER); 590 Sensor countSensor = sensorManager.getDefaultSensor(Sensor.TYPE_STEP_COUNTER);
580 if (countSensor != null) { 591 if (countSensor != null) {
581 sensorManager.registerListener(this, countSensor, SensorManager.SENSOR_DELAY_UI); 592 sensorManager.registerListener(this, countSensor, SensorManager.SENSOR_DELAY_UI);
582 } else { 593 } else {
583 Toast.makeText(mContext, getResources().getString(R.string.sensor_available), Toast.LENGTH_SHORT).show(); 594 Toast.makeText(mContext, getResources().getString(R.string.sensor_available), Toast.LENGTH_SHORT).show();
584 } 595 }
585 } 596 }
586 597
587 @Override 598 @Override
588 public void onSensorChanged(SensorEvent event) { 599 public void onSensorChanged(SensorEvent event) {
589 Debug.normal("Sensor count step active"); 600 Debug.normal("Sensor count step active");
590 if (activityRunning){ 601 if (activityRunning){
591 stepCount = (int) event.values[0]; 602 stepCount = (int) event.values[0];
603 Debug.normal("Step change: "+ stepCount);
604 stepTotal++;
592 // update UI 605 // update UI
593 updateUI(); 606 updateUI();
594 } 607 }
595 } 608 }
596 609
597 @Override 610 @Override
598 public void onAccuracyChanged(Sensor sensor, int accuracy) { 611 public void onAccuracyChanged(Sensor sensor, int accuracy) {
599 612
600 } 613 }
601 614
602 @Override 615 @Override
603 public void onPause() { 616 public void onPause() {
604 super.onPause(); 617 super.onPause();
605 activityRunning = false; 618 activityRunning = false;
606 Debug.normal("Start create log"); 619 Debug.normal("Start create log");
607 mToDate = new Date(); 620 mToDate = new Date();
621 if (sensorManager != null) {
622 sensorManager.unregisterListener(this);
623 }
608 // create log step 624 // create log step
609 creatLogStep(); 625 creatLogStep();
610 } 626 }
611 627
612 @Override 628 @Override
613 public void onDestroy() { 629 public void onDestroy() {
614 super.onDestroy(); 630 super.onDestroy();
615 } 631 }
616 632
617 private void creatLogStep(){ 633 private void creatLogStep(){
618 634
619 LLAPIManager.createLog(stepType, stepCount, mFromDate, mToDate, new LLAPIManagerListener() { 635 LLAPIManager.createLog(stepType, stepCount, mFromDate, mToDate, new LLAPIManagerListener() {
620 @Override 636 @Override
621 public void onError(Error error) { 637 public void onError(Error error) {
622 Debug.error("Get data history error"); 638 Debug.error("Get data history error");
623 } 639 }
624 640
625 @Override 641 @Override
626 public void onSuccess(String json) { 642 public void onSuccess(String json) {
627 Debug.error("Get data history success"); 643 Debug.error("Get data history success");
628 } 644 }
629 645
630 @Override 646 @Override
631 public void onSuccess(JSONObject object) { 647 public void onSuccess(JSONObject object) {
632 Debug.error("Get data history success"); 648 Debug.error("Get data history success");
633 } 649 }
634 }); 650 });
635 } 651 }
app/src/main/res/layout/fragment_top_today.xml
1 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 1 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
2 xmlns:appNs="http://schemas.android.com/apk/res-auto" 2 xmlns:appNs="http://schemas.android.com/apk/res-auto"
3 android:layout_width="match_parent" 3 android:layout_width="match_parent"
4 android:layout_height="match_parent" 4 android:layout_height="match_parent"
5 android:background="@color/background_main"> 5 android:background="@color/background_main">
6 6
7 <ScrollView 7 <ScrollView
8 android:layout_width="match_parent" 8 android:layout_width="match_parent"
9 android:layout_height="match_parent" 9 android:layout_height="match_parent"
10 android:layout_alignParentTop="true" 10 android:layout_alignParentTop="true"
11 android:layout_alignParentStart="true" 11 android:layout_alignParentStart="true"
12 android:layout_above="@+id/ll_stepType"> 12 android:layout_above="@+id/ll_stepType">
13 13
14 <LinearLayout 14 <LinearLayout
15 android:layout_width="match_parent" 15 android:layout_width="match_parent"
16 android:layout_height="wrap_content" 16 android:layout_height="wrap_content"
17 android:orientation="vertical" 17 android:orientation="vertical"
18 android:padding="10dp"> 18 android:padding="10dp">
19 19
20 20
21 <LinearLayout 21 <LinearLayout
22 android:layout_width="match_parent" 22 android:layout_width="match_parent"
23 android:layout_height="wrap_content" 23 android:layout_height="wrap_content"
24 android:orientation="horizontal" 24 android:orientation="horizontal"
25 android:paddingTop="10dp"> 25 android:paddingTop="10dp">
26 26
27 <ImageView 27 <ImageView
28 android:id="@+id/iv_back" 28 android:id="@+id/iv_back"
29 android:layout_width="@dimen/next_date_height" 29 android:layout_width="@dimen/next_date_height"
30 android:layout_height="@dimen/next_date_height" 30 android:layout_height="@dimen/next_date_height"
31 android:src="@drawable/back_ic" /> 31 android:src="@drawable/back_ic" />
32 32
33 <TextView 33 <TextView
34 android:id="@+id/tv_date" 34 android:id="@+id/tv_date"
35 android:layout_width="0dp" 35 android:layout_width="0dp"
36 android:layout_height="match_parent" 36 android:layout_height="match_parent"
37 android:layout_weight="1.0" 37 android:layout_weight="1.0"
38 android:gravity="center" 38 android:gravity="center"
39 android:text="2017ๅนด1ๆœˆ1ๆ—ฅ" 39 android:text="2017ๅนด1ๆœˆ1ๆ—ฅ"
40 android:textColor="@color/white" 40 android:textColor="@color/white"
41 android:textSize="23sp" /> 41 android:textSize="23sp" />
42 42
43 <ImageView 43 <ImageView
44 android:id="@+id/iv_next" 44 android:id="@+id/iv_next"
45 android:layout_width="@dimen/next_date_height" 45 android:layout_width="@dimen/next_date_height"
46 android:layout_height="@dimen/next_date_height" 46 android:layout_height="@dimen/next_date_height"
47 android:src="@drawable/next_ic" /> 47 android:src="@drawable/next_ic" />
48 48
49 </LinearLayout> 49 </LinearLayout>
50 50
51 <LinearLayout 51 <LinearLayout
52 android:layout_width="match_parent" 52 android:layout_width="match_parent"
53 android:layout_height="wrap_content" 53 android:layout_height="wrap_content"
54 android:orientation="horizontal" 54 android:orientation="horizontal"
55 android:paddingTop="10dp" 55 android:paddingTop="10dp"
56 android:weightSum="100"> 56 android:weightSum="100">
57 57
58 <LinearLayout 58 <LinearLayout
59 android:layout_width="0dp" 59 android:layout_width="0dp"
60 android:layout_height="wrap_content" 60 android:layout_height="wrap_content"
61 android:layout_weight="15" 61 android:layout_weight="15"
62 android:orientation="vertical"> 62 android:orientation="vertical">
63 63
64 <ImageView 64 <ImageView
65 android:layout_width="match_parent" 65 android:layout_width="match_parent"
66 android:layout_height="wrap_content" 66 android:layout_height="wrap_content"
67 android:src="@drawable/goout_ic" 67 android:src="@drawable/goout_ic"
68 android:adjustViewBounds="true"/> 68 android:adjustViewBounds="true"/>
69 69
70 <ImageView 70 <ImageView
71 android:layout_width="match_parent" 71 android:layout_width="match_parent"
72 android:layout_height="wrap_content" 72 android:layout_height="wrap_content"
73 android:src="@drawable/ic_face" 73 android:src="@drawable/ic_face"
74 android:adjustViewBounds="true" 74 android:adjustViewBounds="true"
75 android:paddingTop="6dp"/> 75 android:paddingTop="6dp"/>
76 76
77 <ImageView 77 <ImageView
78 android:layout_width="match_parent" 78 android:layout_width="match_parent"
79 android:layout_height="wrap_content" 79 android:layout_height="wrap_content"
80 android:src="@drawable/ic_line" 80 android:src="@drawable/ic_line"
81 android:adjustViewBounds="true" 81 android:adjustViewBounds="true"
82 android:paddingTop="10dp"/> 82 android:paddingTop="10dp"/>
83 83
84 </LinearLayout> 84 </LinearLayout>
85 85
86 <RelativeLayout 86 <RelativeLayout
87 android:layout_width="0dp" 87 android:layout_width="0dp"
88 android:layout_height="wrap_content" 88 android:layout_height="wrap_content"
89 android:layout_weight="60" 89 android:layout_weight="60"
90 android:paddingLeft="10dp"> 90 android:paddingLeft="10dp">
91 91
92 <org.eazegraph.lib.charts.PieChart 92 <org.eazegraph.lib.charts.PieChart
93 xmlns:eaze="http://schemas.android.com/apk/res-auto" 93 xmlns:eaze="http://schemas.android.com/apk/res-auto"
94 android:id="@+id/graph" 94 android:id="@+id/graph"
95 android:layout_width="match_parent" 95 android:layout_width="match_parent"
96 android:layout_height="200dp" 96 android:layout_height="200dp"
97 android:layout_marginTop="10dp" 97 android:layout_marginTop="10dp"
98 eaze:egLegendHeight="0dp" 98 eaze:egLegendHeight="0dp"
99 eaze:egInnerPadding="93" 99 eaze:egInnerPadding="93"
100 eaze:egInnerPaddingColor="@color/background_main" 100 eaze:egInnerPaddingColor="@color/background_main"
101 eaze:egHighlightStrength="1"/> 101 eaze:egHighlightStrength="1"/>
102 102
103 <LinearLayout 103 <LinearLayout
104 android:layout_width="match_parent" 104 android:layout_width="match_parent"
105 android:layout_height="200dp" 105 android:layout_height="200dp"
106 android:layout_marginTop="10dp" 106 android:layout_marginTop="10dp"
107 android:orientation="vertical" 107 android:orientation="vertical"
108 android:gravity="center_horizontal"> 108 android:gravity="center_horizontal">
109 109
110 <ImageView 110 <ImageView
111 android:layout_width="@dimen/walking_img_height" 111 android:layout_width="@dimen/walking_img_height"
112 android:layout_height="@dimen/walking_img_height" 112 android:layout_height="@dimen/walking_img_height"
113 android:layout_marginTop="25dp" 113 android:layout_marginTop="25dp"
114 android:gravity="center" 114 android:gravity="center"
115 android:src="@drawable/walking_ic"/> 115 android:src="@drawable/walking_ic"/>
116 116
117 <TextView 117 <TextView
118 android:id="@+id/steps" 118 android:id="@+id/steps"
119 android:layout_width="match_parent" 119 android:layout_width="match_parent"
120 android:layout_height="wrap_content" 120 android:layout_height="wrap_content"
121 android:gravity="center" 121 android:gravity="center"
122 android:textSize="45sp" 122 android:textSize="45sp"
123 android:text="10.000" 123 android:text="10.000"
124 android:textColor="@color/white"/> 124 android:textColor="@color/white"/>
125 125
126 <TextView 126 <TextView
127 android:id="@+id/tv_smallStepGoal" 127 android:id="@+id/tv_smallStepGoal"
128 android:layout_width="wrap_content" 128 android:layout_width="wrap_content"
129 android:layout_height="wrap_content" 129 android:layout_height="wrap_content"
130 android:text="@string/pie_text_content1" 130 android:text="@string/pie_text_content1"
131 android:textSize="14sp" 131 android:textSize="14sp"
132 android:padding="4dp" 132 android:padding="4dp"
133 android:textColor="@color/white"/> 133 android:textColor="@color/white"/>
134 134
135 <TextView 135 <TextView
136 android:layout_width="wrap_content" 136 android:layout_width="wrap_content"
137 android:layout_height="wrap_content" 137 android:layout_height="wrap_content"
138 android:text="@string/pie_text_content2" 138 android:text="@string/pie_text_content2"
139 android:textSize="14sp" 139 android:textSize="14sp"
140 android:textColor="@color/white"/> 140 android:textColor="@color/white"/>
141 141
142 <TextView 142 <TextView
143 android:id="@+id/tv_smallRemain" 143 android:id="@+id/tv_smallRemain"
144 android:layout_width="wrap_content" 144 android:layout_width="wrap_content"
145 android:layout_height="wrap_content" 145 android:layout_height="wrap_content"
146 android:layout_below="@+id/steps" 146 android:layout_below="@+id/steps"
147 android:layout_centerHorizontal="true" 147 android:layout_centerHorizontal="true"
148 android:text="@string/pie_text_content3" 148 android:text="@string/pie_text_content3"
149 android:textSize="14sp" 149 android:textSize="14sp"
150 android:textColor="@color/white"/> 150 android:textColor="@color/white"/>
151 151
152 </LinearLayout> 152 </LinearLayout>
153 153
154 </RelativeLayout> 154 </RelativeLayout>
155 155
156 <LinearLayout 156 <LinearLayout
157 android:layout_width="0dp" 157 android:layout_width="0dp"
158 android:layout_height="wrap_content" 158 android:layout_height="wrap_content"
159 android:layout_weight="25" 159 android:layout_weight="25"
160 android:gravity="center" 160 android:gravity="center"
161 android:orientation="vertical"> 161 android:orientation="vertical">
162 162
163 <TextView 163 <TextView
164 android:layout_width="wrap_content" 164 android:layout_width="wrap_content"
165 android:layout_height="wrap_content" 165 android:layout_height="wrap_content"
166 android:text="@string/goal_jp" 166 android:text="@string/goal_jp"
167 android:textColor="@color/white" 167 android:textColor="@color/white"
168 android:textSize="16sp" /> 168 android:textSize="16sp" />
169 169
170 <TextView 170 <TextView
171 android:id="@+id/tv_stepGoal" 171 android:id="@+id/tv_stepGoal"
172 android:layout_width="wrap_content" 172 android:layout_width="wrap_content"
173 android:layout_height="wrap_content" 173 android:layout_height="wrap_content"
174 android:paddingLeft="10dp" 174 android:paddingLeft="10dp"
175 android:text="10000ๆญฉ" 175 android:text="10000ๆญฉ"
176 android:textColor="@color/white" 176 android:textColor="@color/white"
177 android:textSize="16sp" /> 177 android:textSize="16sp" />
178 178
179 <TextView 179 <TextView
180 android:layout_width="wrap_content" 180 android:layout_width="wrap_content"
181 android:layout_height="wrap_content" 181 android:layout_height="wrap_content"
182 android:paddingTop="10dp" 182 android:paddingTop="10dp"
183 android:text="@string/remaining_number_step" 183 android:text="@string/remaining_number_step"
184 android:textColor="@color/white" 184 android:textColor="@color/white"
185 android:textSize="16sp" /> 185 android:textSize="16sp" />
186 186
187 <TextView 187 <TextView
188 android:id="@+id/tv_stepRemain" 188 android:id="@+id/tv_stepRemain"
189 android:layout_width="wrap_content" 189 android:layout_width="wrap_content"
190 android:layout_height="wrap_content" 190 android:layout_height="wrap_content"
191 android:paddingLeft="10dp" 191 android:paddingLeft="10dp"
192 android:text="3000ๆญฉ" 192 android:text="3000ๆญฉ"
193 android:textColor="@color/white" 193 android:textColor="@color/white"
194 android:textSize="16sp" /> 194 android:textSize="16sp" />
195 195
196 <TextView 196 <TextView
197 android:layout_width="wrap_content" 197 android:layout_width="wrap_content"
198 android:layout_height="wrap_content" 198 android:layout_height="wrap_content"
199 android:paddingTop="10dp" 199 android:paddingTop="10dp"
200 android:text="@string/achiverment_rate" 200 android:text="@string/achiverment_rate"
201 android:textColor="@color/white" 201 android:textColor="@color/white"
202 android:textSize="16sp" /> 202 android:textSize="16sp" />
203 203
204 <TextView 204 <TextView
205 android:id="@+id/tv_stepRateDone" 205 android:id="@+id/tv_stepRateDone"
206 android:layout_width="wrap_content" 206 android:layout_width="wrap_content"
207 android:layout_height="wrap_content" 207 android:layout_height="wrap_content"
208 android:paddingLeft="10dp" 208 android:paddingLeft="10dp"
209 android:text="78%" 209 android:text="78%"
210 android:textColor="@color/white" 210 android:textColor="@color/white"
211 android:textSize="16sp" /> 211 android:textSize="16sp" />
212 212
213 </LinearLayout> 213 </LinearLayout>
214 214
215 </LinearLayout> 215 </LinearLayout>
216 216
217 <LinearLayout 217 <LinearLayout
218 android:layout_width="match_parent" 218 android:layout_width="match_parent"
219 android:layout_height="wrap_content" 219 android:layout_height="wrap_content"
220 android:weightSum="100" 220 android:weightSum="100"
221 android:paddingTop="20dp" 221 android:paddingTop="20dp"
222 android:orientation="horizontal"> 222 android:orientation="horizontal">
223 223
224 <LinearLayout 224 <LinearLayout
225 android:layout_width="0dp" 225 android:layout_width="0dp"
226 android:layout_height="wrap_content" 226 android:layout_height="wrap_content"
227 android:layout_weight="20" 227 android:layout_weight="10"
228 android:gravity="center" 228 android:gravity="center"
229 android:orientation="vertical"> 229 android:orientation="vertical">
230 230
231 </LinearLayout> 231 </LinearLayout>
232 232
233 <LinearLayout 233 <LinearLayout
234 android:layout_width="0dp" 234 android:layout_width="0dp"
235 android:layout_height="wrap_content" 235 android:layout_height="wrap_content"
236 android:layout_weight="20" 236 android:layout_weight="20"
237 android:gravity="center" 237 android:gravity="center"
238 android:orientation="vertical"> 238 android:orientation="vertical">
239 239
240 <ImageView 240 <ImageView
241 android:layout_width="wrap_content" 241 android:layout_width="wrap_content"
242 android:layout_height="wrap_content" 242 android:layout_height="wrap_content"
243 android:src="@drawable/category" 243 android:src="@drawable/category"
244 android:adjustViewBounds="true"/> 244 android:adjustViewBounds="true"/>
245 245
246 </LinearLayout> 246 </LinearLayout>
247 247
248 <LinearLayout 248 <LinearLayout
249 android:layout_width="0dp" 249 android:layout_width="0dp"
250 android:layout_height="wrap_content" 250 android:layout_height="wrap_content"
251 android:layout_weight="20" 251 android:layout_weight="30"
252 android:gravity="center" 252 android:gravity="center"
253 android:orientation="vertical"> 253 android:orientation="vertical">
254 254
255 <TextView 255 <TextView
256 android:id="@+id/tv_distance" 256 android:id="@+id/tv_distance"
257 android:layout_width="wrap_content" 257 android:layout_width="wrap_content"
258 android:layout_height="wrap_content" 258 android:layout_height="wrap_content"
259 android:text="4.9" 259 android:text="4.9"
260 android:textColor="@color/white" 260 android:textColor="@color/white"
261 android:textSize="30sp" /> 261 android:textSize="22sp" />
262 262
263 </LinearLayout> 263 </LinearLayout>
264 264
265 <LinearLayout 265 <LinearLayout
266 android:layout_width="0dp" 266 android:layout_width="0dp"
267 android:layout_height="wrap_content" 267 android:layout_height="wrap_content"
268 android:layout_weight="20" 268 android:layout_weight="30"
269 android:gravity="center" 269 android:gravity="center"
270 android:orientation="vertical"> 270 android:orientation="vertical">
271 271
272 <TextView 272 <TextView
273 android:id="@+id/tv_time" 273 android:id="@+id/tv_time"
274 android:layout_width="wrap_content" 274 android:layout_width="wrap_content"
275 android:layout_height="wrap_content" 275 android:layout_height="wrap_content"
276 android:text="1:09" 276 android:text="1:09"
277 android:textColor="@color/white" 277 android:textColor="@color/white"
278 android:textSize="30sp" /> 278 android:textSize="22sp" />
279 279
280 </LinearLayout> 280 </LinearLayout>
281 281
282 <LinearLayout 282 <LinearLayout
283 android:layout_width="0dp" 283 android:layout_width="0dp"
284 android:layout_height="wrap_content" 284 android:layout_height="wrap_content"
285 android:layout_weight="20" 285 android:layout_weight="10"
286 android:gravity="center" 286 android:gravity="center"
287 android:orientation="vertical"> 287 android:orientation="vertical">
288 288
289 <ImageView 289 <ImageView
290 android:layout_width="@dimen/next_date_height" 290 android:layout_width="@dimen/next_date_height"
291 android:layout_height="wrap_content" 291 android:layout_height="wrap_content"
292 android:src="@drawable/pause" 292 android:src="@drawable/pause"
293 android:background="@color/white" 293 android:background="@color/white"
294 android:adjustViewBounds="true" 294 android:adjustViewBounds="true"
295 android:visibility="gone"/> 295 android:visibility="gone"/>
296 296
297 </LinearLayout> 297 </LinearLayout>
298 </LinearLayout> 298 </LinearLayout>
299 299
300 <LinearLayout 300 <LinearLayout
301 android:layout_width="match_parent" 301 android:layout_width="match_parent"
302 android:layout_height="wrap_content" 302 android:layout_height="wrap_content"
303 android:weightSum="100" 303 android:weightSum="100"
304 android:orientation="horizontal"> 304 android:orientation="horizontal">
305 305
306 <LinearLayout 306 <LinearLayout
307 android:layout_width="0dp" 307 android:layout_width="0dp"
308 android:layout_height="wrap_content" 308 android:layout_height="wrap_content"
309 android:layout_weight="20" 309 android:layout_weight="20"
310 android:gravity="center" 310 android:gravity="center"
311 android:orientation="vertical"> 311 android:orientation="vertical">
312 312
313 </LinearLayout> 313 </LinearLayout>
314 314
315 <LinearLayout 315 <LinearLayout
316 android:layout_width="0dp" 316 android:layout_width="0dp"
317 android:layout_height="wrap_content" 317 android:layout_height="wrap_content"
318 android:layout_weight="20" 318 android:layout_weight="20"
319 android:gravity="center" 319 android:gravity="center"
320 android:orientation="vertical"> 320 android:orientation="vertical">
321 321
322 <TextView 322 <TextView
323 android:layout_width="wrap_content" 323 android:layout_width="wrap_content"
324 android:layout_height="wrap_content" 324 android:layout_height="wrap_content"
325 android:text="@string/carori" 325 android:text="@string/carori"
326 android:textColor="@color/white" 326 android:textColor="@color/white"
327 android:textSize="16sp" /> 327 android:textSize="16sp" />
328 328
329 </LinearLayout> 329 </LinearLayout>
330 330
331 <LinearLayout 331 <LinearLayout
332 android:layout_width="0dp" 332 android:layout_width="0dp"
333 android:layout_height="wrap_content" 333 android:layout_height="wrap_content"
334 android:layout_weight="20" 334 android:layout_weight="20"
335 android:gravity="center" 335 android:gravity="center"
336 android:orientation="vertical"> 336 android:orientation="vertical">
337 337
338 <TextView 338 <TextView
339 android:layout_width="wrap_content" 339 android:layout_width="wrap_content"
340 android:layout_height="wrap_content" 340 android:layout_height="wrap_content"
341 android:text="@string/km" 341 android:text="@string/km"
342 android:textColor="@color/white" 342 android:textColor="@color/white"
343 android:textSize="16sp" /> 343 android:textSize="16sp" />
344 344
345 </LinearLayout> 345 </LinearLayout>
346 346
347 <LinearLayout 347 <LinearLayout
348 android:layout_width="0dp" 348 android:layout_width="0dp"
349 android:layout_height="wrap_content" 349 android:layout_height="wrap_content"
350 android:layout_weight="20" 350 android:layout_weight="20"
351 android:gravity="center" 351 android:gravity="center"
352 android:orientation="vertical"> 352 android:orientation="vertical">
353 353
354 <TextView 354 <TextView
355 android:layout_width="wrap_content" 355 android:layout_width="wrap_content"
356 android:layout_height="wrap_content" 356 android:layout_height="wrap_content"
357 android:text="@string/time" 357 android:text="@string/time"
358 android:textColor="@color/white" 358 android:textColor="@color/white"
359 android:textSize="16sp" /> 359 android:textSize="16sp" />
360 360
361 </LinearLayout> 361 </LinearLayout>
362 </LinearLayout> 362 </LinearLayout>
363 363
364 364
365 <LinearLayout 365 <LinearLayout
366 android:layout_width="match_parent" 366 android:layout_width="match_parent"
367 android:layout_height="120dp" 367 android:layout_height="120dp"
368 android:orientation="vertical" 368 android:orientation="vertical"
369 android:layout_marginTop="10dp"> 369 android:layout_marginTop="10dp">
370 370
371 <!--<org.eazegraph.lib.charts.BarChart--> 371 <!--<org.eazegraph.lib.charts.BarChart-->
372 <!--xmlns:eaze="http://schemas.android.com/apk/res-auto"--> 372 <!--xmlns:eaze="http://schemas.android.com/apk/res-auto"-->
373 <!--android:id="@+id/bargraph"--> 373 <!--android:id="@+id/bargraph"-->
374 <!--android:layout_width="match_parent"--> 374 <!--android:layout_width="match_parent"-->
375 <!--android:layout_height="120dp"--> 375 <!--android:layout_height="120dp"-->
376 <!--android:layout_below="@+id/averageandtotaltext"--> 376 <!--android:layout_below="@+id/averageandtotaltext"-->
377 <!--eaze:egLegendHeight="0dp"--> 377 <!--eaze:egLegendHeight="0dp"-->
378 <!--eaze:egShowValues="false" />--> 378 <!--eaze:egShowValues="false" />-->
379 <com.github.mikephil.charting.charts.BarChart 379 <com.github.mikephil.charting.charts.BarChart
380 android:id="@+id/chart" 380 android:id="@+id/chart"
381 android:layout_width="match_parent" 381 android:layout_width="match_parent"
382 android:layout_height="match_parent" /> 382 android:layout_height="match_parent" />
383 383
384 384
385 </LinearLayout> 385 </LinearLayout>
386 386
387 387
388 </LinearLayout> 388 </LinearLayout>
389 </ScrollView> 389 </ScrollView>
390 390
391 <include layout="@layout/type_step" /> 391 <include layout="@layout/type_step" />
392 </RelativeLayout> 392 </RelativeLayout>
393 393
app/src/main/res/mipmap-hdpi/ic_launcher.png

3.34 KB | W: | H:

2.89 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
app/src/main/res/mipmap-mdpi/ic_launcher.png

2.15 KB | W: | H:

2.03 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
app/src/main/res/mipmap-xhdpi/ic_launcher.png

4.73 KB | W: | H:

3.62 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
app/src/main/res/mipmap-xxhdpi/ic_launcher.png

7.54 KB | W: | H:

5.18 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
app/src/main/res/mipmap-xxxhdpi/ic_launcher.png

10.2 KB | W: | H:

21.9 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin