() {
165 |
166 | @Override
167 | public void onSuccess(final String s) {
168 | if (callbackListener != null) {
169 | callbackListener.onSuccess(finalString, s);
170 | }
171 | }
172 |
173 | @Override
174 | public void onError(final Throwable throwable, final boolean b) {
175 | if (callbackListener != null) {
176 | callbackListener.onError(throwable);
177 | }
178 |
179 | }
180 |
181 | @Override
182 | public void onCancelled(final CancelledException e) {
183 | if (callbackListener != null) {
184 | callbackListener.onCancelled();
185 | }
186 | }
187 |
188 | @Override
189 | public void onFinished() {
190 | if (callbackListener != null) {
191 | callbackListener.onFinished();
192 | }
193 | }
194 |
195 | });
196 | }
197 |
198 |
199 | /**
200 | * 加载图片
201 | *
202 | * @param uri
203 | * @param imageView
204 | */
205 | public static void image(Context mContext, String uri, ImageView imageView) {
206 | try {
207 | Glide.with(mContext).load(uri).dontAnimate().into(imageView);
208 | } catch (Exception mE) {
209 |
210 | }
211 | }
212 |
213 | /**
214 | * 加载图片
215 | *
216 | * @param mContext
217 | * @param uri
218 | * @param err
219 | * @param imageView
220 | */
221 |
222 | public static void image(Context mContext, String uri, @DrawableRes int err, ImageView imageView) {
223 | try {
224 | Glide.with(mContext).load(uri).error(err).into(imageView);
225 | } catch (Exception mE) {
226 |
227 | }
228 |
229 | }
230 |
231 | /**
232 | * 加载图片
233 | *
234 | * @param mContext
235 | * @param uri
236 | * @param err
237 | * @param imageView
238 | */
239 |
240 | public static void image(Context mContext, String uri, @DrawableRes int placeholder, @DrawableRes int err, ImageView imageView) {
241 | try {
242 | Glide.with(mContext).load(uri).error(err).placeholder(placeholder).into(imageView);
243 | } catch (Exception mE) {
244 |
245 | }
246 |
247 | }
248 |
249 | /**
250 | * 加载图片
251 | *
252 | * @param uri
253 | * @param imageView
254 | */
255 | public static void image(Context mContext, File uri, ImageView imageView) {
256 | try {
257 | Glide.with(mContext).load(uri).into(imageView);
258 | } catch (Exception mE) {
259 |
260 | }
261 |
262 | }
263 |
264 | /**
265 | * 加载图片
266 | *
267 | * @param uri
268 | * @param imageView
269 | */
270 | public static void image(Context mContext, Uri uri, ImageView imageView) {
271 | try {
272 | Glide.with(mContext).load(uri).into(imageView);
273 | } catch (Exception mE) {
274 |
275 | }
276 |
277 | }
278 |
279 | /**
280 | * 加载图片
281 | *
282 | * @param uri
283 | * @param imageView
284 | */
285 | public static void image(Context mContext, byte[] uri, ImageView imageView) {
286 | try {
287 | Glide.with(mContext).load(uri).into(imageView);
288 | } catch (Exception mE) {
289 |
290 | }
291 |
292 | }
293 |
294 | /**
295 | * 加载图片
296 | *
297 | * @param uri
298 | * @param imageView
299 | */
300 | public static void image(Context mContext, int uri, ImageView imageView) {
301 | try {
302 | Glide.with(mContext).load(uri).into(imageView);
303 | } catch (Exception mE) {
304 |
305 | }
306 |
307 | }
308 |
309 | /**
310 | * Wait Dialog
311 | */
312 | private static AlertDialog mWaitDialog;
313 |
314 | public static void waitDialogToShow(Context mContext) {
315 | waitDialogToShow(mContext, null, null, true);
316 | }
317 |
318 | /**
319 | * 显示dialog
320 | *
321 | * @param mContext
322 | * @param title 标题 可空
323 | * @param content 内容 可空
324 | * @param canable 可否取消
325 | */
326 | public static void waitDialogToShow(Context mContext, @Nullable String title, @Nullable String content, boolean canable) {
327 | AlertDialog.Builder mBuilder = new AlertDialog.Builder(mContext, R.style.WaitDialog);
328 | if (title != null) {
329 | mBuilder.setTitle(title);
330 | }
331 | mBuilder.setCancelable(canable);
332 | View mView = View.inflate(mContext, R.layout.waitingdialog, null);
333 | TextView mTextView = (TextView) mView.findViewById(R.id.content);
334 | // SpinKitView mSpinKitView= (SpinKitView) mView.findViewById (R.id.skv);
335 | if (content != null) {
336 | mTextView.setText(content);
337 | }
338 | mBuilder.setView(mView);
339 | mWaitDialog = mBuilder.show();
340 | }
341 |
342 | /**
343 | * 关闭dialog
344 | */
345 | public static void waitDialogToClose() {
346 | if (mWaitDialog == null) {
347 | return;
348 | }
349 | mWaitDialog.dismiss();
350 | }
351 | public interface onDialogListener{
352 | public void onPositive();
353 | public void onNegative();
354 | }
355 | public static void ShowDialog_Normal(Context mContext, String mContent, final onDialogListener mListener) {
356 | final AlertDialog.Builder dialog = new AlertDialog.Builder(mContext);
357 | dialog.setMessage(mContent).setPositiveButton("确定", new DialogInterface.OnClickListener() {
358 | @Override
359 | public void onClick(DialogInterface dialog, int which) {
360 | mListener.onPositive();
361 | }
362 | }).setNegativeButton("取消", new DialogInterface.OnClickListener() {
363 | @Override
364 | public void onClick(DialogInterface dialog, int which) {
365 | mListener.onNegative();
366 | }
367 | }) .show();
368 | }
369 | public static String getLocalFileTemp(String ext) {
370 | if (Environment.MEDIA_MOUNTED.equals(Environment.getExternalStorageState()) || !Environment.isExternalStorageRemovable()) {
371 | // return app.sApp.getExternalCacheDir() + qktool.time_getTimeYMDHm(System.currentTimeMillis())+ "." + ext;
372 | File mFile=new File("/sdcard/demo/");
373 | mFile.mkdirs();
374 | return "/sdcard/demo/" + qktool.time_getTimeYMDHm(System.currentTimeMillis())+ "." + ext;
375 | }
376 |
377 | return app.sApp.getCacheDir() + qktool.time_getTimeYMDHm(System.currentTimeMillis())+"." + ext;
378 | }
379 | }
380 |
--------------------------------------------------------------------------------
/TraceDemo/app/src/main/java/com/itgowo/sport/trace/tracedemo/Other/Request.java:
--------------------------------------------------------------------------------
1 | package com.itgowo.sport.trace.tracedemo.Other;
2 |
3 | public class Request {
4 |
5 | }
6 |
--------------------------------------------------------------------------------
/TraceDemo/app/src/main/java/com/itgowo/sport/trace/tracedemo/Other/Response.java:
--------------------------------------------------------------------------------
1 | package com.itgowo.sport.trace.tracedemo.Other;
2 |
3 | import com.alibaba.fastjson.JSON;
4 |
5 | /**
6 | * Created by hnvfh on 2017/5/15.
7 | */
8 | public class Response {
9 | private int code=200;
10 | private String msg="成功";
11 | private Object data;
12 |
13 | public int getCode() {
14 | return code;
15 | }
16 |
17 | public Response setCode(int mCode) {
18 | code = mCode;
19 | return this;
20 | }
21 |
22 | public String getMsg() {
23 | return msg;
24 | }
25 |
26 | public Response setMsg(String mMsg) {
27 | msg = mMsg;
28 | return this;
29 | }
30 |
31 | public Object getData() {
32 | return data;
33 | }
34 |
35 | public Response setData(Object mData) {
36 | this.data = mData;
37 | return this;
38 | }
39 | public String toJson(){
40 | return JSON.toJSONString(this);
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/TraceDemo/app/src/main/java/com/itgowo/sport/trace/tracedemo/Other/TitleBarView.java:
--------------------------------------------------------------------------------
1 | package com.itgowo.sport.trace.tracedemo.Other;
2 |
3 | import android.content.Context;
4 | import android.graphics.drawable.Drawable;
5 | import android.support.annotation.Nullable;
6 | import android.util.AttributeSet;
7 | import android.view.View;
8 | import android.widget.LinearLayout;
9 | import android.widget.RelativeLayout;
10 | import android.widget.TextView;
11 |
12 | import com.itgowo.sport.trace.tracedemo.R;
13 |
14 |
15 | /**
16 | * Created by lujianchao on 2016/11/16.
17 | *
18 | * @author lujianchao
19 | *
20 | * titlebar,不解释
21 | */
22 |
23 | public class TitleBarView extends LinearLayout {
24 | public static final String Tag = "TitleBarView";
25 | private RelativeLayout layout;
26 | private TextView titlebarLeftbt;
27 | private TextView titlebarTitle;
28 | private TextView titlebarRightbt;
29 | private TextView titlebar_rightotherbt;
30 | private OnClickListener mOnClickListener;
31 | private onTitleBarListener mOnTitleBarListener;
32 |
33 |
34 | public TitleBarView(final Context context, final AttributeSet attrs) {
35 | super (context, attrs);
36 | inflate (context, R.layout.titlebar_viewlayout, this);
37 | this.setTag (Tag);
38 | initView ();
39 | initListener ();
40 | }
41 |
42 |
43 | /**
44 | * 获取Titlebar左边textview
45 | *
46 | * @return TextView
47 | */
48 | public TextView getTitlebarLeftbt () {
49 | return titlebarLeftbt;
50 | }
51 |
52 | /**
53 | * 获取Titlebar左边textview
54 | *
55 | * @return TextView
56 | */
57 | public TextView getTitlebarTitle () {
58 | return titlebarTitle;
59 | }
60 |
61 |
62 | /**
63 | * 设置Title
64 | *
65 | * @param mTitle
66 | */
67 | public void setTitle (String mTitle) {
68 | titlebarTitle.setText (mTitle);
69 | }
70 |
71 | public void setMsgRight (String mMsgRight) {
72 | titlebarRightbt.getLayoutParams ().width = LayoutParams.WRAP_CONTENT;
73 | titlebarRightbt.setText (mMsgRight);
74 | }
75 |
76 | public void setMsgLeft (String mMsgLeft) {
77 | titlebarLeftbt.getLayoutParams ().width = LayoutParams.WRAP_CONTENT;
78 | titlebarLeftbt.setText (mMsgLeft);
79 | }
80 |
81 | /**
82 | * 获取Titlebar左边textview
83 | *
84 | * @return TextView
85 | */
86 | public TextView getTitlebarRightbt () {
87 | return titlebarRightbt;
88 | }
89 |
90 | /**
91 | * 获取Titlebar左边textview
92 | *
93 | * @return TextView
94 | */
95 | public TextView getTitlebarRightOtherbt () {
96 | return titlebar_rightotherbt;
97 | }
98 |
99 | private void initListener () {
100 | mOnClickListener = new OnClickListener () {
101 | @Override
102 | public void onClick (final View mView) {
103 | if (mOnTitleBarListener != null) {
104 | switch (mView.getId ()) {
105 | case R.id.titlebar_leftbt:
106 | mOnTitleBarListener.onTitleBarLeftOnClick (mView);
107 | break;
108 | case R.id.titlebar_rightbt:
109 | mOnTitleBarListener.onTitleBarRightOnClick (mView);
110 | break;
111 | case R.id.titlebar_title:
112 | mOnTitleBarListener.onTitleBarTitleOnClick (mView);
113 | break;
114 | }
115 | }
116 | }
117 | };
118 | titlebarTitle.setOnClickListener (mOnClickListener);
119 | titlebarRightbt.setOnClickListener (mOnClickListener);
120 | titlebarLeftbt.setOnClickListener (mOnClickListener);
121 | }
122 |
123 | private void initView () {
124 | layout = (RelativeLayout) findViewById (R.id.layout);
125 | titlebarLeftbt = (TextView) findViewById (R.id.titlebar_leftbt);
126 | titlebarTitle = (TextView) findViewById (R.id.titlebar_title);
127 | titlebarRightbt = (TextView) findViewById (R.id.titlebar_rightbt);
128 | titlebar_rightotherbt = (TextView) findViewById (R.id.titlebar_rightotherbt);
129 | }
130 |
131 | public RelativeLayout getLayoutView () {
132 | return layout;
133 | }
134 |
135 | /**
136 | * 设置TitleBar监听
137 | */
138 | public void setonTitlebarListener (onTitleBarListener mTitlebarListener) {
139 | mOnTitleBarListener = mTitlebarListener;
140 | }
141 |
142 | public enum TitleBarChildView {
143 | LEFT, RIGHT, CENTER, RIGHTOTHER;
144 | }
145 |
146 | /**
147 | * 设置TitleBar中三个textview的图片用drawableleif形式
148 | *
149 | * @param res 资源ID
150 | * @param index 指定被操作的textview
151 | */
152 | public void setDrawableLeft (int res, TitleBarChildView index) {
153 | Drawable mDrawable = getResources ().getDrawable (res);
154 | mDrawable.setBounds (0, 0, mDrawable.getMinimumWidth (), mDrawable.getMinimumHeight ());
155 | if (index == TitleBarChildView.LEFT) {
156 | titlebarLeftbt.setCompoundDrawables (mDrawable, null, null, null);
157 | } else if (index == TitleBarChildView.RIGHT) {
158 | titlebarRightbt.setCompoundDrawables (mDrawable, null, null, null);
159 | } else if (index == TitleBarChildView.RIGHTOTHER) {
160 | titlebar_rightotherbt.setCompoundDrawables (mDrawable, null, null, null);
161 | } else {
162 | titlebarTitle.setCompoundDrawables (mDrawable, null, null, null);
163 | }
164 | }
165 |
166 | /**
167 | * 设置TitleBar中三个textview的图片用drawableright形式
168 | *
169 | * @param res 资源ID
170 | * @param index 指定被操作的textview
171 | */
172 | public void setDrawableRight (@Nullable int res, TitleBarChildView index) {
173 | Drawable mDrawable = getResources ().getDrawable (res);
174 | mDrawable.setBounds (0, 0, mDrawable.getMinimumWidth (), mDrawable.getMinimumHeight ());
175 | if (index == TitleBarChildView.LEFT) {
176 | titlebarLeftbt.setCompoundDrawables (null, null, mDrawable, null);
177 | } else if (index == TitleBarChildView.RIGHT) {
178 | titlebarRightbt.setCompoundDrawables (null, null, mDrawable, null);
179 | } else if (index == TitleBarChildView.RIGHTOTHER) {
180 | titlebar_rightotherbt.setCompoundDrawables (null, null, mDrawable, null);
181 | } else {
182 | titlebarTitle.setCompoundDrawables (null, null, mDrawable, null);
183 | }
184 | }
185 |
186 | public interface onTitleBarListener {
187 | public void onTitleBarLeftOnClick(View mView);
188 |
189 | public void onTitleBarRightOnClick(View mView);
190 |
191 | public void onTitleBarTitleOnClick(View mView);
192 | }
193 |
194 | }
195 |
--------------------------------------------------------------------------------
/TraceDemo/app/src/main/java/com/itgowo/sport/trace/tracedemo/Other/XListView/XListViewFooter.java:
--------------------------------------------------------------------------------
1 | /**
2 | * @file XFooterView.java
3 | * @create Mar 31, 2012 9:33:43 PM
4 | * @author Maxwin
5 | * @description XListView's footer
6 | */
7 | package com.itgowo.sport.trace.tracedemo.Other.XListView;
8 |
9 |
10 | import android.content.Context;
11 | import android.util.AttributeSet;
12 | import android.view.LayoutInflater;
13 | import android.view.View;
14 | import android.widget.LinearLayout;
15 | import android.widget.TextView;
16 |
17 | import com.itgowo.sport.trace.tracedemo.R;
18 |
19 |
20 | public class XListViewFooter extends LinearLayout {
21 | public final static int STATE_NORMAL = 0;
22 | public final static int STATE_READY = 1;
23 | public final static int STATE_LOADING = 2;
24 |
25 | private Context mContext;
26 |
27 | private View mContentView;
28 | private View mProgressBar;
29 | private TextView mHintView;
30 |
31 | public XListViewFooter(Context context) {
32 | super(context);
33 | initView(context);
34 | }
35 |
36 | public XListViewFooter(Context context, AttributeSet attrs) {
37 | super(context, attrs);
38 | initView(context);
39 | }
40 |
41 |
42 | public void setState(int state) {
43 | mHintView.setVisibility(View.INVISIBLE);
44 | mProgressBar.setVisibility(View.INVISIBLE);
45 | mHintView.setVisibility(View.INVISIBLE);
46 | if (state == STATE_READY) {
47 | mHintView.setVisibility(View.VISIBLE);
48 | mHintView.setText(R.string.xlistview_footer_hint_ready);
49 | } else if (state == STATE_LOADING) {
50 | mProgressBar.setVisibility(View.VISIBLE);
51 | } else {
52 | mHintView.setVisibility(View.VISIBLE);
53 | mHintView.setText(R.string.xlistview_footer_hint_normal);
54 | }
55 | }
56 |
57 | public void setBottomMargin(int height) {
58 | if (height < 0) return ;
59 | LayoutParams lp = (LayoutParams)mContentView.getLayoutParams();
60 | lp.bottomMargin = height;
61 | mContentView.setLayoutParams(lp);
62 | }
63 |
64 | public int getBottomMargin() {
65 | LayoutParams lp = (LayoutParams)mContentView.getLayoutParams();
66 | return lp.bottomMargin;
67 | }
68 |
69 |
70 | /**
71 | * normal status
72 | */
73 | public void normal() {
74 | mHintView.setVisibility(View.VISIBLE);
75 | mProgressBar.setVisibility(View.GONE);
76 | }
77 |
78 |
79 | /**
80 | * loading status
81 | */
82 | public void loading() {
83 | mHintView.setVisibility(View.GONE);
84 | mProgressBar.setVisibility(View.VISIBLE);
85 | }
86 |
87 | /**
88 | * hide footer when disable pull load more
89 | */
90 | public void hide() {
91 | LayoutParams lp = (LayoutParams)mContentView.getLayoutParams();
92 | lp.height = 0;
93 | mContentView.setLayoutParams(lp);
94 | }
95 |
96 | /**
97 | * show footer
98 | */
99 | public void show() {
100 | LayoutParams lp = (LayoutParams)mContentView.getLayoutParams();
101 | lp.height = LayoutParams.WRAP_CONTENT;
102 | mContentView.setLayoutParams(lp);
103 | }
104 |
105 | private void initView(Context context) {
106 | mContext = context;
107 | LinearLayout moreView = (LinearLayout)LayoutInflater.from(mContext).inflate(R.layout.xlistview_footer, null);
108 | addView(moreView);
109 | moreView.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));
110 |
111 | mContentView = moreView.findViewById(R.id.xlistview_footer_content);
112 | mProgressBar = moreView.findViewById(R.id.xlistview_footer_progressbar);
113 | mHintView = (TextView)moreView.findViewById(R.id.xlistview_footer_hint_textview);
114 | }
115 |
116 |
117 | }
118 |
--------------------------------------------------------------------------------
/TraceDemo/app/src/main/java/com/itgowo/sport/trace/tracedemo/Other/XListView/XListViewHeader.java:
--------------------------------------------------------------------------------
1 | /**
2 | * @file XListViewHeader.java
3 | * @create Apr 18, 2012 5:22:27 PM
4 | * @author Maxwin
5 | * @description XListView's header
6 | */
7 | package com.itgowo.sport.trace.tracedemo.Other.XListView;
8 |
9 | import android.content.Context;
10 | import android.util.AttributeSet;
11 | import android.view.Gravity;
12 | import android.view.LayoutInflater;
13 | import android.view.View;
14 | import android.view.animation.Animation;
15 | import android.view.animation.RotateAnimation;
16 | import android.widget.ImageView;
17 | import android.widget.LinearLayout;
18 | import android.widget.ProgressBar;
19 | import android.widget.TextView;
20 |
21 | import com.itgowo.sport.trace.tracedemo.R;
22 |
23 |
24 | public class XListViewHeader extends LinearLayout {
25 | private LinearLayout mContainer;
26 | private ImageView mArrowImageView;
27 | private ProgressBar mProgressBar;
28 | private TextView mHintTextView;
29 | private int mState = STATE_NORMAL;
30 |
31 | private Animation mRotateUpAnim;
32 | private Animation mRotateDownAnim;
33 |
34 | private final int ROTATE_ANIM_DURATION = 180;
35 |
36 | public final static int STATE_NORMAL = 0;
37 | public final static int STATE_READY = 1;
38 | public final static int STATE_REFRESHING = 2;
39 |
40 | public XListViewHeader(Context context) {
41 | super(context);
42 | initView(context);
43 | }
44 |
45 | /**
46 | * @param context
47 | * @param attrs
48 | */
49 | public XListViewHeader(Context context, AttributeSet attrs) {
50 | super(context, attrs);
51 | initView(context);
52 | }
53 |
54 | private void initView(Context context) {
55 | // 初始情况,设置下拉刷新view高度为0
56 | LayoutParams lp = new LayoutParams(LayoutParams.FILL_PARENT, 0);
57 | mContainer = (LinearLayout) LayoutInflater.from(context).inflate(R.layout.xlistview_header, null);
58 | addView(mContainer, lp);
59 | setGravity(Gravity.BOTTOM);
60 |
61 | mArrowImageView = (ImageView) findViewById(R.id.xlistview_header_arrow);
62 | mHintTextView = (TextView) findViewById(R.id.xlistview_header_hint_textview);
63 | mProgressBar = (ProgressBar) findViewById(R.id.xlistview_header_progressbar);
64 |
65 | mRotateUpAnim = new RotateAnimation(0.0f, -180.0f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
66 | mRotateUpAnim.setDuration(ROTATE_ANIM_DURATION);
67 | mRotateUpAnim.setFillAfter(true);
68 | mRotateDownAnim = new RotateAnimation(-180.0f, 0.0f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
69 | mRotateDownAnim.setDuration(ROTATE_ANIM_DURATION);
70 | mRotateDownAnim.setFillAfter(true);
71 | }
72 |
73 | public void setState(int state) {
74 | if (state == mState) return;
75 |
76 | if (state == STATE_REFRESHING) { // 显示进度
77 | mArrowImageView.clearAnimation();
78 | mArrowImageView.setVisibility(View.INVISIBLE);
79 | mProgressBar.setVisibility(View.VISIBLE);
80 | } else { // 显示箭头图片
81 | mArrowImageView.setVisibility(View.VISIBLE);
82 | mProgressBar.setVisibility(View.INVISIBLE);
83 | }
84 |
85 | switch (state) {
86 | case STATE_NORMAL:
87 | if (mState == STATE_READY) {
88 | mArrowImageView.startAnimation(mRotateDownAnim);
89 | }
90 | if (mState == STATE_REFRESHING) {
91 | mArrowImageView.clearAnimation();
92 | }
93 | mHintTextView.setText(R.string.xlistview_header_hint_normal);
94 | break;
95 | case STATE_READY:
96 | if (mState != STATE_READY) {
97 | mArrowImageView.clearAnimation();
98 | mArrowImageView.startAnimation(mRotateUpAnim);
99 | mHintTextView.setText(R.string.xlistview_header_hint_ready);
100 | }
101 | break;
102 | case STATE_REFRESHING:
103 | mHintTextView.setText(R.string.xlistview_header_hint_loading);
104 | break;
105 | default:
106 | }
107 |
108 | mState = state;
109 | }
110 |
111 | public void setVisiableHeight(int height) {
112 | if (height < 0) {
113 | height = 0;
114 | }
115 | LayoutParams lp = (LayoutParams) mContainer.getLayoutParams();
116 | lp.height = height;
117 | mContainer.setLayoutParams(lp);
118 | }
119 |
120 | public int getVisiableHeight() {
121 | return mContainer.getLayoutParams().height;
122 | }
123 |
124 | }
125 |
--------------------------------------------------------------------------------
/TraceDemo/app/src/main/java/com/itgowo/sport/trace/tracedemo/Other/app.java:
--------------------------------------------------------------------------------
1 | package com.itgowo.sport.trace.tracedemo.Other;
2 |
3 | import android.app.Application;
4 | import android.os.Build;
5 |
6 | import com.baidu.mapapi.SDKInitializer;
7 |
8 | import org.xutils.x;
9 |
10 | /**
11 | * Created by hnvfh on 2017/5/15.
12 | */
13 |
14 | public class app extends Application {
15 | public static Application sApp;
16 | public static String sNickName= "晴空的一滴雨 itgowo.com";
17 | @Override
18 | public void onCreate() {
19 | super.onCreate();
20 | sApp=this;
21 | x.Ext.init(this);
22 | SDKInitializer.initialize(this);
23 | qktool.initTool(sApp);
24 | }
25 |
26 | }
27 |
--------------------------------------------------------------------------------
/TraceDemo/app/src/main/java/com/itgowo/sport/trace/tracedemo/Other/circleprogress/CircleProgress.java:
--------------------------------------------------------------------------------
1 | package com.itgowo.sport.trace.tracedemo.Other.circleprogress;
2 |
3 | import android.content.Context;
4 | import android.content.res.Resources;
5 | import android.content.res.TypedArray;
6 | import android.graphics.Canvas;
7 | import android.graphics.Color;
8 | import android.graphics.Paint;
9 | import android.graphics.RectF;
10 | import android.os.Bundle;
11 | import android.os.Parcelable;
12 | import android.text.TextPaint;
13 | import android.text.TextUtils;
14 | import android.util.AttributeSet;
15 | import android.view.View;
16 |
17 | import com.itgowo.sport.trace.tracedemo.R;
18 |
19 |
20 | /**
21 | * Created by bruce on 11/4/14.
22 | */
23 | public class CircleProgress extends View {
24 | private Paint textPaint;
25 | private RectF rectF = new RectF();
26 |
27 | private float textSize;
28 | private int textColor;
29 | private int progress = 0;
30 | private int max;
31 | private int finishedColor;
32 | private int unfinishedColor;
33 | private String prefixText = "";
34 | private String suffixText = "%";
35 |
36 | private final int default_finished_color = Color.rgb(66, 145, 241);
37 | private final int default_unfinished_color = Color.rgb(204, 204, 204);
38 | private final int default_text_color = Color.WHITE;
39 | private final int default_max = 100;
40 | private final float default_text_size;
41 | private final int min_size;
42 |
43 | private static final String INSTANCE_STATE = "saved_instance";
44 | private static final String INSTANCE_TEXT_COLOR = "text_color";
45 | private static final String INSTANCE_TEXT_SIZE = "text_size";
46 | private static final String INSTANCE_FINISHED_STROKE_COLOR = "finished_stroke_color";
47 | private static final String INSTANCE_UNFINISHED_STROKE_COLOR = "unfinished_stroke_color";
48 | private static final String INSTANCE_MAX = "max";
49 | private static final String INSTANCE_PROGRESS = "progress";
50 | private static final String INSTANCE_SUFFIX = "suffix";
51 | private static final String INSTANCE_PREFIX = "prefix";
52 |
53 | private Paint paint = new Paint();
54 |
55 | public CircleProgress(Context context) {
56 | this(context, null);
57 | }
58 |
59 | public CircleProgress(Context context, AttributeSet attrs) {
60 | this(context, attrs, 0);
61 | }
62 |
63 | public CircleProgress(Context context, AttributeSet attrs, int defStyleAttr) {
64 | super(context, attrs, defStyleAttr);
65 |
66 | default_text_size = sp2px(getResources(), 18);
67 | min_size = (int) dp2px(getResources(), 100);
68 |
69 | final TypedArray attributes = context.getTheme().obtainStyledAttributes(attrs, R.styleable.CircleProgress, defStyleAttr, 0);
70 | initByAttributes(attributes);
71 | attributes.recycle();
72 |
73 | initPainters();
74 | }
75 |
76 | protected void initByAttributes(TypedArray attributes) {
77 | finishedColor = attributes.getColor(R.styleable.CircleProgress_circle_finished_color, default_finished_color);
78 | unfinishedColor = attributes.getColor(R.styleable.CircleProgress_circle_unfinished_color, default_unfinished_color);
79 | textColor = attributes.getColor(R.styleable.CircleProgress_circle_text_color, default_text_color);
80 | textSize = attributes.getDimension(R.styleable.CircleProgress_circle_text_size, default_text_size);
81 |
82 | setMax(attributes.getInt(R.styleable.CircleProgress_circle_max, default_max));
83 | setProgress(attributes.getInt(R.styleable.CircleProgress_circle_progress, 0));
84 |
85 | if (attributes.getString(R.styleable.CircleProgress_circle_prefix_text) != null) {
86 | setPrefixText(attributes.getString(R.styleable.CircleProgress_circle_prefix_text));
87 | }
88 | if (attributes.getString(R.styleable.CircleProgress_circle_suffix_text) != null) {
89 | setSuffixText(attributes.getString(R.styleable.CircleProgress_circle_suffix_text));
90 | }
91 | }
92 |
93 | protected void initPainters() {
94 | textPaint = new TextPaint();
95 | textPaint.setColor(textColor);
96 | textPaint.setTextSize(textSize);
97 | textPaint.setAntiAlias(true);
98 |
99 | paint.setAntiAlias(true);
100 | }
101 |
102 | @Override
103 | public void invalidate() {
104 | initPainters();
105 | super.invalidate();
106 | }
107 |
108 | public int getProgress() {
109 | return progress;
110 | }
111 |
112 | public void setProgress(int progress) {
113 | this.progress = progress;
114 | if (this.progress > getMax()) {
115 | this.progress %= getMax();
116 | }
117 | invalidate();
118 | }
119 |
120 | public int getMax() {
121 | return max;
122 | }
123 |
124 | public void setMax(int max) {
125 | if (max > 0) {
126 | this.max = max;
127 | invalidate();
128 | }
129 | }
130 |
131 | public float getTextSize() {
132 | return textSize;
133 | }
134 |
135 | public void setTextSize(float textSize) {
136 | this.textSize = textSize;
137 | this.invalidate();
138 | }
139 |
140 | public int getTextColor() {
141 | return textColor;
142 | }
143 |
144 | public void setTextColor(int textColor) {
145 | this.textColor = textColor;
146 | this.invalidate();
147 | }
148 |
149 | public int getFinishedColor() {
150 | return finishedColor;
151 | }
152 |
153 | public void setFinishedColor(int finishedColor) {
154 | this.finishedColor = finishedColor;
155 | this.invalidate();
156 | }
157 |
158 | public int getUnfinishedColor() {
159 | return unfinishedColor;
160 | }
161 |
162 | public void setUnfinishedColor(int unfinishedColor) {
163 | this.unfinishedColor = unfinishedColor;
164 | this.invalidate();
165 | }
166 |
167 | public String getPrefixText() {
168 | return prefixText;
169 | }
170 |
171 | public void setPrefixText(String prefixText) {
172 | this.prefixText = prefixText;
173 | this.invalidate();
174 | }
175 |
176 | public String getSuffixText() {
177 | return suffixText;
178 | }
179 |
180 | public void setSuffixText(String suffixText) {
181 | this.suffixText = suffixText;
182 | this.invalidate();
183 | }
184 |
185 | public String getDrawText() {
186 | return getPrefixText() + getProgress() + getSuffixText();
187 | }
188 |
189 | @Override
190 | protected int getSuggestedMinimumHeight() {
191 | return min_size;
192 | }
193 |
194 | @Override
195 | protected int getSuggestedMinimumWidth() {
196 | return min_size;
197 | }
198 |
199 | public float getProgressPercentage() {
200 | return getProgress() / (float) getMax();
201 | }
202 |
203 | @Override
204 | protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
205 | rectF.set(0, 0, MeasureSpec.getSize(widthMeasureSpec), MeasureSpec.getSize(heightMeasureSpec));
206 | setMeasuredDimension(widthMeasureSpec, heightMeasureSpec);
207 | }
208 |
209 | @Override protected void onDraw(Canvas canvas) {
210 | float yHeight = getProgress() / (float) getMax() * getHeight();
211 | float radius = getWidth() / 2f;
212 | float angle = (float) (Math.acos((radius - yHeight) / radius) * 180 / Math.PI);
213 | float startAngle = 90 + angle;
214 | float sweepAngle = 360 - angle * 2;
215 | paint.setColor(getUnfinishedColor());
216 | canvas.drawArc(rectF, startAngle, sweepAngle, false, paint);
217 |
218 | canvas.save();
219 | canvas.rotate(180, getWidth() / 2, getHeight() / 2);
220 | paint.setColor(getFinishedColor());
221 | canvas.drawArc(rectF, 270 - angle, angle * 2, false, paint);
222 | canvas.restore();
223 |
224 | // Also works.
225 | // paint.setColor(getFinishedColor());
226 | // canvas.drawArc(rectF, 90 - angle, angle * 2, false, paint);
227 |
228 | String text = getDrawText();
229 | if (!TextUtils.isEmpty(text)) {
230 | float textHeight = textPaint.descent() + textPaint.ascent();
231 | canvas.drawText(text, (getWidth() - textPaint.measureText(text)) / 2.0f, (getWidth() - textHeight) / 2.0f, textPaint);
232 | }
233 | }
234 |
235 | @Override
236 | protected Parcelable onSaveInstanceState() {
237 | final Bundle bundle = new Bundle();
238 | bundle.putParcelable(INSTANCE_STATE, super.onSaveInstanceState());
239 | bundle.putInt(INSTANCE_TEXT_COLOR, getTextColor());
240 | bundle.putFloat(INSTANCE_TEXT_SIZE, getTextSize());
241 | bundle.putInt(INSTANCE_FINISHED_STROKE_COLOR, getFinishedColor());
242 | bundle.putInt(INSTANCE_UNFINISHED_STROKE_COLOR, getUnfinishedColor());
243 | bundle.putInt(INSTANCE_MAX, getMax());
244 | bundle.putInt(INSTANCE_PROGRESS, getProgress());
245 | bundle.putString(INSTANCE_SUFFIX, getSuffixText());
246 | bundle.putString(INSTANCE_PREFIX, getPrefixText());
247 | return bundle;
248 | }
249 |
250 | @Override
251 | protected void onRestoreInstanceState(Parcelable state) {
252 | if(state instanceof Bundle) {
253 | final Bundle bundle = (Bundle) state;
254 | textColor = bundle.getInt(INSTANCE_TEXT_COLOR);
255 | textSize = bundle.getFloat(INSTANCE_TEXT_SIZE);
256 | finishedColor = bundle.getInt(INSTANCE_FINISHED_STROKE_COLOR);
257 | unfinishedColor = bundle.getInt(INSTANCE_UNFINISHED_STROKE_COLOR);
258 | initPainters();
259 | setMax(bundle.getInt(INSTANCE_MAX));
260 | setProgress(bundle.getInt(INSTANCE_PROGRESS));
261 | prefixText = bundle.getString(INSTANCE_PREFIX);
262 | suffixText = bundle.getString(INSTANCE_SUFFIX);
263 | super.onRestoreInstanceState(bundle.getParcelable(INSTANCE_STATE));
264 | return;
265 | }
266 | super.onRestoreInstanceState(state);
267 | }
268 | public float dp2px(Resources resources, float dp) {
269 | final float scale = resources.getDisplayMetrics().density;
270 | return dp * scale + 0.5f;
271 | }
272 |
273 | public float sp2px(Resources resources, float sp){
274 | final float scale = resources.getDisplayMetrics().scaledDensity;
275 | return sp * scale;
276 | }
277 | }
278 |
--------------------------------------------------------------------------------
/TraceDemo/app/src/main/java/com/itgowo/sport/trace/tracedemo/Other/onNetCallbackIListener.java:
--------------------------------------------------------------------------------
1 | package com.itgowo.sport.trace.tracedemo.Other;
2 |
3 | import java.io.File;
4 |
5 | /**
6 | * Created by lujianchao on 2016/10/27.
7 | */
8 |
9 | public interface onNetCallbackIListener {
10 | /**
11 | * 返回网络请求数据
12 | *
13 | * @param requestStr 请求发出数据
14 | * @param result 请求结果
15 | */
16 | public void onSuccess(String requestStr, String result);
17 |
18 | public void onSuccess(String result);
19 |
20 | public void onError(Throwable throwable);
21 |
22 | public void onFinished();
23 |
24 | public void onCancelled();
25 | public void onSuccess(File mFile);
26 | }
27 |
--------------------------------------------------------------------------------
/TraceDemo/app/src/main/java/com/itgowo/sport/trace/tracedemo/Other/onNetCallbackListener.java:
--------------------------------------------------------------------------------
1 | package com.itgowo.sport.trace.tracedemo.Other;
2 |
3 | import java.io.File;
4 |
5 | /**
6 | * Created by lujianchao on 2016/11/2.
7 | */
8 |
9 | public abstract class onNetCallbackListener implements onNetCallbackIListener {
10 | @Override
11 | public void onCancelled () {
12 | }
13 |
14 | @Override
15 | public void onError (final Throwable throwable) {
16 | throwable.printStackTrace ();
17 | }
18 |
19 | @Override
20 | public void onFinished () {
21 |
22 | }
23 |
24 | @Override
25 | public void onSuccess (final String result) {
26 |
27 | }
28 |
29 | @Override
30 | public void onSuccess (final File mFile) {
31 |
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/TraceDemo/app/src/main/java/com/itgowo/sport/trace/tracedemo/Trace/Entity/EntityRecord.java:
--------------------------------------------------------------------------------
1 | package com.itgowo.sport.trace.tracedemo.Trace.Entity;
2 |
3 |
4 | public class EntityRecord {
5 | private int id;
6 | private double mileage; // 里程
7 | private long finishTime; // 用时
8 | private double avgSpeed; // 平均速度
9 | private double altitude; // 爬升
10 | private long startTime; // 开始时间
11 | private long endTime; // 结束时间
12 | private int pace; // 配速
13 | private int itemType; // 类型 1 跑步 2 骑行
14 | private String records; // 记录
15 |
16 | public int getId() {
17 | return id;
18 | }
19 |
20 | public EntityRecord setId(int mId) {
21 | id = mId;
22 | return this;
23 | }
24 |
25 | public double getMileage() {
26 | return mileage;
27 | }
28 |
29 | public EntityRecord setMileage(double mMileage) {
30 | mileage = mMileage;
31 | return this;
32 | }
33 |
34 | public long getFinishTime() {
35 | return finishTime;
36 | }
37 |
38 | public EntityRecord setFinishTime(long mFinishTime) {
39 | finishTime = mFinishTime;
40 | return this;
41 | }
42 |
43 | public double getAvgSpeed() {
44 | return avgSpeed;
45 | }
46 |
47 | public EntityRecord setAvgSpeed(double mAvgSpeed) {
48 | avgSpeed = mAvgSpeed;
49 | return this;
50 | }
51 |
52 | public double getAltitude() {
53 | return altitude;
54 | }
55 |
56 | public EntityRecord setAltitude(double mAltitude) {
57 | altitude = mAltitude;
58 | return this;
59 | }
60 |
61 | public long getStartTime() {
62 | return startTime;
63 | }
64 |
65 | public EntityRecord setStartTime(long mStartTime) {
66 | startTime = mStartTime;
67 | return this;
68 | }
69 |
70 | public long getEndTime() {
71 | return endTime;
72 | }
73 |
74 | public EntityRecord setEndTime(long mEndTime) {
75 | endTime = mEndTime;
76 | return this;
77 | }
78 |
79 | public int getPace() {
80 | return pace;
81 | }
82 |
83 | public EntityRecord setPace(int mPace) {
84 | pace = mPace;
85 | return this;
86 | }
87 |
88 | public int getItemType() {
89 | return itemType;
90 | }
91 |
92 | public EntityRecord setItemType(int mItemType) {
93 | itemType = mItemType;
94 | return this;
95 | }
96 |
97 | public String getRecords() {
98 | return records;
99 | }
100 |
101 | public EntityRecord setRecords(String mRecords) {
102 | records = mRecords;
103 | return this;
104 | }
105 | }
106 |
--------------------------------------------------------------------------------
/TraceDemo/app/src/main/java/com/itgowo/sport/trace/tracedemo/Trace/Entity/Entity_GetRunRecord.java:
--------------------------------------------------------------------------------
1 | package com.itgowo.sport.trace.tracedemo.Trace.Entity;
2 |
3 |
4 | import com.itgowo.sport.trace.tracedemo.Other.Response;
5 |
6 | import java.util.List;
7 |
8 | /**
9 | * Created by lujianchao on 2017/2/10.
10 | *
11 | * @author lujianchao
12 | */
13 |
14 | public class Entity_GetRunRecord extends Response {
15 | private EntityRecord data;
16 |
17 | public EntityRecord getData() {
18 | return data;
19 | }
20 |
21 | public void setData(EntityRecord data) {
22 | this.data = data;
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/TraceDemo/app/src/main/java/com/itgowo/sport/trace/tracedemo/Trace/Entity/Entity_GetRunRecordList.java:
--------------------------------------------------------------------------------
1 | package com.itgowo.sport.trace.tracedemo.Trace.Entity;
2 |
3 | import com.itgowo.sport.trace.tracedemo.Other.Response;
4 |
5 | import java.util.List;
6 |
7 |
8 | /**
9 | * Created by lujianchao on 2017/2/8.
10 | *
11 | * @author lujianchao
12 | */
13 |
14 | public class Entity_GetRunRecordList extends Response {
15 |
16 | private List data;
17 |
18 | public List getData() {
19 | return data;
20 | }
21 |
22 | public void setData(List data) {
23 | this.data = data;
24 | }
25 |
26 | }
27 |
--------------------------------------------------------------------------------
/TraceDemo/app/src/main/java/com/itgowo/sport/trace/tracedemo/Trace/Entity/Entity_TotalInfo.java:
--------------------------------------------------------------------------------
1 | package com.itgowo.sport.trace.tracedemo.Trace.Entity;
2 |
3 | import com.itgowo.sport.trace.tracedemo.Other.Response;
4 |
5 | /**
6 | * Created by hnvfh on 2017/5/16.
7 | */
8 | public class Entity_TotalInfo extends Response {
9 | private TotalInfo mData;
10 |
11 | @Override
12 | public TotalInfo getData() {
13 | return mData;
14 | }
15 |
16 | public Entity_TotalInfo setData(TotalInfo mData) {
17 | this.mData = mData;
18 | return this;
19 | }
20 |
21 | public static class TotalInfo {
22 | private double totalmileage; // 里程
23 | private long totalTime; // 用时
24 | private int type; // 类型
25 |
26 | public int getType() {
27 | return type;
28 | }
29 |
30 | public TotalInfo setType(int mType) {
31 | type = mType;
32 | return this;
33 | }
34 | public double getTotalmileage() {
35 | return totalmileage;
36 | }
37 |
38 | public TotalInfo setTotalmileage(double mTotalmileage) {
39 | totalmileage = mTotalmileage;
40 | return this;
41 | }
42 |
43 | public long getTotalTime() {
44 | return totalTime;
45 | }
46 |
47 | public TotalInfo setTotalTime(long mTotalTime) {
48 | totalTime = mTotalTime;
49 | return this;
50 | }
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/TraceDemo/app/src/main/java/com/itgowo/sport/trace/tracedemo/Trace/Entity/Entity_UploadResponse.java:
--------------------------------------------------------------------------------
1 | package com.itgowo.sport.trace.tracedemo.Trace.Entity;
2 |
3 | import com.itgowo.sport.trace.tracedemo.Other.Response;
4 |
5 | /**
6 | * Created by hnvfh on 2017/5/16.
7 | */
8 |
9 | public class Entity_UploadResponse extends Response {
10 | private EntityRecord mData;
11 |
12 | @Override
13 | public EntityRecord getData() {
14 | return mData;
15 | }
16 |
17 | public Entity_UploadResponse setData(EntityRecord mData) {
18 | this.mData = mData;
19 | return this;
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/TraceDemo/app/src/main/java/com/itgowo/sport/trace/tracedemo/Trace/Entity/LocationInfo.java:
--------------------------------------------------------------------------------
1 | package com.itgowo.sport.trace.tracedemo.Trace.Entity;
2 |
3 | /**
4 | * Created by lujianchao on 2017/1/8.
5 | *
6 | * @author lujianchao
7 | */
8 |
9 | public class LocationInfo {
10 |
11 | private double latitude;
12 | private double longitude;
13 | private int status;//1 正常轨迹 2.暂停状态轨迹
14 |
15 | public double getLatitude () {
16 | return latitude;
17 | }
18 |
19 | public LocationInfo setLatitude (final double mLatitude) {
20 | latitude = mLatitude;
21 | return this;
22 | }
23 |
24 | public double getLongitude () {
25 | return longitude;
26 | }
27 |
28 | public LocationInfo setLongitude (final double mLongitude) {
29 | longitude = mLongitude;
30 | return this;
31 | }
32 |
33 | public int getStatus () {
34 | return status;
35 | }
36 |
37 | public LocationInfo setStatus (final int mStatus) {
38 | status = mStatus;
39 | return this;
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/TraceDemo/app/src/main/java/com/itgowo/sport/trace/tracedemo/Trace/Entity/RequestTrace.java:
--------------------------------------------------------------------------------
1 | package com.itgowo.sport.trace.tracedemo.Trace.Entity;
2 |
3 | /**
4 | * Created by hnvfh on 2017/5/15.
5 | */
6 | public class RequestTrace {
7 | public static final int RequestNo = 0, RequestDetails = 1, RequestList = 2, RequestUpload = 3, RequestInfo = 4,RequestDel=5;
8 | private int requestType = 0; //0;不请求数据 1:根据id获取详情(id) 2:获取轨迹列表(pageindex,pagesize) 3:上传轨迹 4:获取统计信息 关联运动类型,用id传
9 | private int id;
10 | private int pageindex = 1;
11 | private int pagesize = 20;
12 | private Object entity;
13 |
14 | public int getRequestType() {
15 | return requestType;
16 | }
17 |
18 | public RequestTrace setRequestType(int mRequestType) {
19 | requestType = mRequestType;
20 | return this;
21 | }
22 |
23 | public int getId() {
24 | return id;
25 | }
26 |
27 | public RequestTrace setId(int mId) {
28 | id = mId;
29 | return this;
30 | }
31 |
32 | public int getPageindex() {
33 | return pageindex;
34 | }
35 |
36 | public RequestTrace setPageindex(int mPageindex) {
37 | pageindex = mPageindex;
38 | return this;
39 | }
40 |
41 | public int getPagesize() {
42 | return pagesize;
43 | }
44 |
45 | public RequestTrace setPagesize(int mPagesize) {
46 | pagesize = mPagesize;
47 | return this;
48 | }
49 |
50 | public Object getEntity() {
51 | return entity;
52 | }
53 |
54 | public RequestTrace setEntity(Object mEntity) {
55 | entity = mEntity;
56 | return this;
57 | }
58 | }
59 |
--------------------------------------------------------------------------------
/TraceDemo/app/src/main/java/com/itgowo/sport/trace/tracedemo/Trace/TraceManager.java:
--------------------------------------------------------------------------------
1 | package com.itgowo.sport.trace.tracedemo.Trace;
2 |
3 |
4 | import com.itgowo.sport.trace.tracedemo.Other.QKManager;
5 | import com.itgowo.sport.trace.tracedemo.Other.onNetCallbackListener;
6 | import com.itgowo.sport.trace.tracedemo.Trace.Entity.RequestTrace;
7 |
8 | /**
9 | * Created by lujianchao on 2017/1/4.
10 | *
11 | * @author lujianchao
12 | */
13 |
14 | public class TraceManager {
15 | public static String ROOT_URL = "http://itgowo.com:8081/TraceServer/Trace"; // 用户轨迹操作
16 | // public static String ROOT_URL = "http://1.1.1.156:8080/Trace"; // 用户轨迹操作
17 | /**
18 | * 获取轨迹详情
19 | *
20 | * @param runRecordId
21 | * @param mListener
22 | */
23 | public static void GetRunRecord (int runRecordId, onNetCallbackListener mListener) {
24 | RequestTrace mRequestALL = new RequestTrace ().setId (runRecordId).setRequestType(RequestTrace.RequestDetails) ;
25 | QKManager.http_post (ROOT_URL, "", mRequestALL, mListener);
26 |
27 | }
28 |
29 |
30 |
31 | /**
32 | * 获取运动轨迹记录列表
33 | *
34 | * @param itemType 运动类型 1:跑步 2:骑行
35 | * @param mListener
36 | */
37 | public static void GetRunRecordList (int itemType, int index,int size, onNetCallbackListener mListener) {
38 | RequestTrace request = new RequestTrace ().setId (itemType).setPageindex (index).setPagesize(size).setRequestType(RequestTrace.RequestList);
39 | QKManager.http_post (ROOT_URL, "", request, mListener);
40 | }
41 | /**
42 | * 删除运动轨迹记录
43 | *
44 | * @param mListener
45 | */
46 | public static void delRecord(int id, onNetCallbackListener mListener) {
47 | RequestTrace request = new RequestTrace ().setId (id).setRequestType(RequestTrace.RequestDel);
48 | QKManager.http_post (ROOT_URL, "", request, mListener);
49 | }
50 | /**
51 | * 获取运动总信息,首页信息
52 | *
53 | * @param itemType
54 | * @param mListener
55 | */
56 | public static void GetRunRecordIndexPage (int itemType, onNetCallbackListener mListener) {
57 | RequestTrace request = new RequestTrace().setRequestType (RequestTrace.RequestInfo).setId(itemType);
58 | QKManager.http_post (ROOT_URL, "", request, mListener);
59 | }
60 | }
61 |
--------------------------------------------------------------------------------
/TraceDemo/app/src/main/java/com/itgowo/sport/trace/tracedemo/Trace/TraceRecordActivity.java:
--------------------------------------------------------------------------------
1 | package com.itgowo.sport.trace.tracedemo.Trace;
2 |
3 | import android.content.Context;
4 | import android.content.Intent;
5 | import android.os.Bundle;
6 | import android.view.View;
7 | import android.view.ViewGroup;
8 | import android.widget.AdapterView;
9 | import android.widget.BaseAdapter;
10 | import android.widget.ImageView;
11 | import android.widget.TextView;
12 |
13 | import com.alibaba.fastjson.JSON;
14 | import com.itgowo.sport.trace.tracedemo.Other.BaseActivity;
15 | import com.itgowo.sport.trace.tracedemo.Other.QKManager;
16 | import com.itgowo.sport.trace.tracedemo.Other.Response;
17 | import com.itgowo.sport.trace.tracedemo.Other.TitleBarView;
18 | import com.itgowo.sport.trace.tracedemo.Other.XListView.XListView;
19 | import com.itgowo.sport.trace.tracedemo.Other.app;
20 | import com.itgowo.sport.trace.tracedemo.Other.onNetCallbackListener;
21 | import com.itgowo.sport.trace.tracedemo.Other.qktool;
22 | import com.itgowo.sport.trace.tracedemo.R;
23 | import com.itgowo.sport.trace.tracedemo.Trace.Entity.EntityRecord;
24 | import com.itgowo.sport.trace.tracedemo.Trace.Entity.Entity_GetRunRecordList;
25 |
26 | import java.text.DecimalFormat;
27 | import java.util.Date;
28 | import java.util.TimeZone;
29 |
30 |
31 | public class TraceRecordActivity extends BaseActivity {
32 | /**
33 | * 从开始运动界面跳过来不允许再跳回,右上角图标消失隐藏
34 | */
35 | public static final String IsCanJump = "IsCanJump";
36 | public static final String SportItemType = "sportItemType";
37 | /**
38 | * 1:跑步 2:骑行
39 | */
40 | private int mSportType = 1;
41 | private XListView mXListView;
42 | private Entity_GetRunRecordList mRecordList;
43 | private RecordAdapter mRecordAdapter;
44 | private int pageindex = 0, pagesize = 10;
45 |
46 | @Override
47 | protected void onCreate(Bundle savedInstanceState) {
48 | super.onCreate(savedInstanceState);
49 | setContentView(R.layout.activity_trace_record);
50 | mSportType = getIntent().getIntExtra(SportItemType, 1);
51 | mXListView = (XListView) findViewById(R.id.listView);
52 | mRecordAdapter = new RecordAdapter();
53 | mXListView.setXListViewListener(new XListView.IXListViewListener() {
54 | @Override
55 | public void onRefresh() {
56 | loadData(true);
57 | }
58 |
59 | @Override
60 | public void onLoadMore() {
61 | loadData(false);
62 |
63 | }
64 | });
65 | mXListView.setAdapter(mRecordAdapter);
66 |
67 | loadData(true);
68 | }
69 |
70 | public static void StartActivity(Context mContext, boolean mIsCanJump, int mSportType) {
71 | Intent intent = new Intent(mContext, TraceRecordActivity.class);
72 | intent.putExtra(SportItemType, mSportType);
73 | intent.putExtra(IsCanJump, mIsCanJump);
74 | mContext.startActivity(intent);
75 | }
76 |
77 | private void loadData(final boolean isRefresh) {
78 | mXListView.setPullLoadEnable(false);
79 | mXListView.setPullRefreshEnable(false);
80 | if (isRefresh) {
81 | pageindex = 0;
82 | }
83 | TraceManager.GetRunRecordList(mSportType, isRefresh ? 0 : pageindex, pagesize, new onNetCallbackListener() {
84 | @Override
85 | public void onError(final Throwable throwable) {
86 | super.onError(throwable);
87 | mXListView.stopLoadMore();
88 | mXListView.stopRefresh();
89 | mXListView.ReFreshNodateStatus(null, true);
90 | mXListView.setPullRefreshEnable(true);
91 | }
92 |
93 | @Override
94 | public void onSuccess(final String requestStr, final String result) {
95 | Entity_GetRunRecordList mRecordList1 = JSON.parseObject(result, Entity_GetRunRecordList.class);
96 | mXListView.stopLoadMore();
97 | mXListView.stopRefresh();
98 | if (mRecordList1.getCode() == 200) {
99 | if (mRecordList1.getData() != null && mRecordList1.getData().size() > 0) {
100 | if (isRefresh) {
101 | mRecordList = mRecordList1;
102 | pageindex += pagesize;
103 | } else {
104 | pageindex += pagesize;
105 | mRecordList.getData().addAll(mRecordList1.getData());
106 | }
107 | String lastdata = "";
108 | int index = 0;
109 | while (index < mRecordList.getData().size()) {
110 | if (mRecordList.getData().get(index).getId() == 0) {
111 | lastdata = qktool.time_getTimeYMD(mRecordList.getData().get(index).getEndTime());
112 | } else {
113 | if (!lastdata .equalsIgnoreCase(qktool.time_getTimeYMD(mRecordList.getData().get(index).getEndTime()))) {
114 | lastdata = qktool.time_getTimeYMD(mRecordList.getData().get(index).getEndTime());
115 | mRecordList.getData().add(index, new EntityRecord().setEndTime(mRecordList.getData().get(index).getEndTime()));
116 | index++;
117 | }
118 | }
119 | index++;
120 | }
121 | mXListView.setPullLoadEnable(true);
122 | mXListView.setPullRefreshEnable(true);
123 | mRecordAdapter.notifyDataSetChanged();
124 | } else {
125 | mXListView.setPullLoadEnable(false);
126 | mXListView.setPullRefreshEnable(true);
127 | }
128 | } else {
129 | qktool.ToastShout(mRecordList1.getMsg());
130 | }
131 | mXListView.ReFreshNodateStatus(null, true);
132 | }
133 | });
134 | }
135 |
136 | @Override
137 | protected void initTitleBarData(final TitleBarView mTitleBarView) {
138 | mTitleBarView.setTitle("运动记录(" + (getIntent().getIntExtra(SportItemType, 1) == 1 ? "跑步)" : "骑行)"));
139 | mTitleBarView.setDrawableLeft(R.drawable.fanhui, TitleBarView.TitleBarChildView.LEFT);
140 | if (getIntent().getBooleanExtra(IsCanJump, true)) {
141 | mTitleBarView.setDrawableLeft(R.drawable.paobuico, TitleBarView.TitleBarChildView.RIGHT);
142 | } else {
143 | mTitleBarView.getTitlebarRightbt().setEnabled(false);
144 | }
145 | mTitleBarView.setonTitlebarListener(new TitleBarView.onTitleBarListener() {
146 | @Override
147 | public void onTitleBarLeftOnClick(final View mView) {
148 | finish();
149 | }
150 |
151 | @Override
152 | public void onTitleBarRightOnClick(final View mView) {
153 | TraceMainActivity.StartActivity(mContext);
154 | }
155 |
156 | @Override
157 | public void onTitleBarTitleOnClick(final View mView) {
158 |
159 | }
160 | });
161 | }
162 |
163 | public class RecordAdapter extends BaseAdapter {
164 |
165 | @Override
166 | public int getCount() {
167 | return mRecordList == null || mRecordList.getData() == null ? 0 : mRecordList.getData().size();
168 | }
169 |
170 | @Override
171 | public Object getItem(final int position) {
172 | return null;
173 | }
174 |
175 | @Override
176 | public int getViewTypeCount() {
177 | return 3;
178 | }
179 |
180 | @Override
181 | public int getItemViewType(final int position) {
182 | return mRecordList.getData().get(position).getId() == 0 ? 2 : 1;
183 | }
184 |
185 | @Override
186 | public long getItemId(final int position) {
187 | return 0;
188 | }
189 |
190 | @Override
191 | public View getView(final int position, View convertView, final ViewGroup parent) {
192 | if (getItemViewType(position) == 2) {
193 | TextView mTextView = (TextView) View.inflate(mContext, R.layout.listview_itemtypetitle, null);
194 | mTextView.setText(qktool.time_getTimeYMD(mRecordList.getData().get(position).getEndTime()));
195 | return mTextView;
196 | } else {
197 | if (convertView == null) {
198 | convertView = View.inflate(mContext, R.layout.tracerecordlistitem, null);
199 | convertView.setTag(new ViewHolder(convertView));
200 | convertView.setOnClickListener(new View.OnClickListener() {
201 | @Override
202 | public void onClick(final View v) {
203 | TraceEndActivity.StartActivity(mContext, mRecordList.getData().get(position).getId(), app.sNickName, true);
204 | }
205 | });
206 | convertView.setOnLongClickListener(new View.OnLongClickListener() {
207 | @Override
208 | public boolean onLongClick(final View v) {
209 | QKManager.ShowDialog_Normal(mContext, "是否删除本次记录?", new QKManager.onDialogListener() {
210 | @Override
211 | public void onPositive() {
212 | TraceManager.delRecord(mRecordList.getData().get(position).getId(), new onNetCallbackListener() {
213 | @Override
214 | public void onSuccess(String requestStr, String result) {
215 | Response mResponse=JSON.parseObject(result,Response.class);
216 | if (mResponse.getCode()==200){
217 | qktool.ToastShout("记录删除成功");
218 | mRecordList.getData().remove(position);
219 | mRecordAdapter.notifyDataSetChanged();
220 | }else {
221 | qktool.ToastShout(mResponse.getMsg());
222 | }
223 | }
224 | });
225 | }
226 |
227 | @Override
228 | public void onNegative() {
229 | qktool.ToastShout("没做处理,onNegative");
230 | }
231 | });
232 | return false;
233 | }
234 | });
235 | }
236 | ViewHolder mViewHolder = (ViewHolder) convertView.getTag();
237 | EntityRecord mBean = mRecordList.getData().get(position);
238 | if (mBean.getItemType() == 1) {
239 | mViewHolder.type.setImageResource(R.drawable.tracetype_run);
240 | } else {
241 | mViewHolder.type.setImageResource(R.drawable.tracetype_bike);
242 | }
243 | DecimalFormat formatVal = new DecimalFormat("##.##");
244 | mViewHolder.length.setText(formatVal.format(mBean.getMileage() / 1000) + " KM");
245 | mViewHolder.time.setText(qktool.time_getTimeHms(new Date(mBean.getFinishTime() * 1000 - TimeZone.getDefault().getRawOffset()).getTime()));
246 | int peisu = mBean.getPace();
247 | mViewHolder.peisu.setText((peisu / 60 < 10 ? "0" : "") + peisu / 60 + ":" + (peisu % 60 < 10 ? "0" : "") + peisu % 60);
248 |
249 | }
250 | return convertView;
251 | }
252 |
253 | public class ViewHolder {
254 | private ImageView type;
255 | private TextView length, time, peisu;
256 |
257 | public ViewHolder(View mView) {
258 | type = (ImageView) mView.findViewById(R.id.type);
259 | length = (TextView) mView.findViewById(R.id.length);
260 | time = (TextView) mView.findViewById(R.id.time);
261 | peisu = (TextView) mView.findViewById(R.id.peisu);
262 | }
263 | }
264 | }
265 | }
266 |
--------------------------------------------------------------------------------
/TraceDemo/app/src/main/java/com/itgowo/sport/trace/tracedemo/Trace/WalkShareTop.java:
--------------------------------------------------------------------------------
1 | package com.itgowo.sport.trace.tracedemo.Trace;
2 |
3 | import android.content.Context;
4 | import android.util.AttributeSet;
5 | import android.view.View;
6 | import android.widget.ImageView;
7 | import android.widget.RelativeLayout;
8 | import android.widget.TextView;
9 |
10 | import com.itgowo.sport.trace.tracedemo.R;
11 |
12 |
13 | /**
14 | * Created by lujianchao on 2016/12/26.
15 | *
16 | * @author lujianchao
17 | */
18 |
19 | public class WalkShareTop extends RelativeLayout {
20 | public TextView sharelength, sharename;
21 | public ImageView sharehead;
22 |
23 | public WalkShareTop(final Context context, final AttributeSet attrs) {
24 | super (context, attrs);
25 | View.inflate (context, R.layout.walksharetopview, this);
26 | initView ();
27 | }
28 |
29 | private void initView () {
30 | sharelength = (TextView) findViewById (R.id.sharelength);
31 | sharename = (TextView) findViewById (R.id.sharename);
32 | sharehead = (ImageView) findViewById (R.id.sharehead);
33 | }
34 |
35 | public WalkShareTop(final Context context) {
36 | super (context);
37 | View.inflate (context, R.layout.walksharetopview, this);
38 | initView ();
39 | }
40 |
41 | }
42 |
--------------------------------------------------------------------------------
/TraceDemo/app/src/main/res/drawable-xhdpi/gps_signal_0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/itgowo/TraceDemo/63c6e4a6e021d442c32c9306aa1e7ba88456af18/TraceDemo/app/src/main/res/drawable-xhdpi/gps_signal_0.png
--------------------------------------------------------------------------------
/TraceDemo/app/src/main/res/drawable-xhdpi/gps_signal_1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/itgowo/TraceDemo/63c6e4a6e021d442c32c9306aa1e7ba88456af18/TraceDemo/app/src/main/res/drawable-xhdpi/gps_signal_1.png
--------------------------------------------------------------------------------
/TraceDemo/app/src/main/res/drawable-xhdpi/gps_signal_2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/itgowo/TraceDemo/63c6e4a6e021d442c32c9306aa1e7ba88456af18/TraceDemo/app/src/main/res/drawable-xhdpi/gps_signal_2.png
--------------------------------------------------------------------------------
/TraceDemo/app/src/main/res/drawable-xhdpi/gps_signal_3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/itgowo/TraceDemo/63c6e4a6e021d442c32c9306aa1e7ba88456af18/TraceDemo/app/src/main/res/drawable-xhdpi/gps_signal_3.png
--------------------------------------------------------------------------------
/TraceDemo/app/src/main/res/drawable-xhdpi/icon2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/itgowo/TraceDemo/63c6e4a6e021d442c32c9306aa1e7ba88456af18/TraceDemo/app/src/main/res/drawable-xhdpi/icon2.png
--------------------------------------------------------------------------------
/TraceDemo/app/src/main/res/drawable-xhdpi/list.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/itgowo/TraceDemo/63c6e4a6e021d442c32c9306aa1e7ba88456af18/TraceDemo/app/src/main/res/drawable-xhdpi/list.png
--------------------------------------------------------------------------------
/TraceDemo/app/src/main/res/drawable-xhdpi/lock1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/itgowo/TraceDemo/63c6e4a6e021d442c32c9306aa1e7ba88456af18/TraceDemo/app/src/main/res/drawable-xhdpi/lock1.png
--------------------------------------------------------------------------------
/TraceDemo/app/src/main/res/drawable-xhdpi/logo1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/itgowo/TraceDemo/63c6e4a6e021d442c32c9306aa1e7ba88456af18/TraceDemo/app/src/main/res/drawable-xhdpi/logo1.png
--------------------------------------------------------------------------------
/TraceDemo/app/src/main/res/drawable-xhdpi/map_icon_end.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/itgowo/TraceDemo/63c6e4a6e021d442c32c9306aa1e7ba88456af18/TraceDemo/app/src/main/res/drawable-xhdpi/map_icon_end.png
--------------------------------------------------------------------------------
/TraceDemo/app/src/main/res/drawable-xhdpi/paobuico.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/itgowo/TraceDemo/63c6e4a6e021d442c32c9306aa1e7ba88456af18/TraceDemo/app/src/main/res/drawable-xhdpi/paobuico.png
--------------------------------------------------------------------------------
/TraceDemo/app/src/main/res/drawable-xhdpi/ranking.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/itgowo/TraceDemo/63c6e4a6e021d442c32c9306aa1e7ba88456af18/TraceDemo/app/src/main/res/drawable-xhdpi/ranking.png
--------------------------------------------------------------------------------
/TraceDemo/app/src/main/res/drawable-xhdpi/tance_icon_end.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/itgowo/TraceDemo/63c6e4a6e021d442c32c9306aa1e7ba88456af18/TraceDemo/app/src/main/res/drawable-xhdpi/tance_icon_end.png
--------------------------------------------------------------------------------
/TraceDemo/app/src/main/res/drawable-xhdpi/tance_icon_start.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/itgowo/TraceDemo/63c6e4a6e021d442c32c9306aa1e7ba88456af18/TraceDemo/app/src/main/res/drawable-xhdpi/tance_icon_start.png
--------------------------------------------------------------------------------
/TraceDemo/app/src/main/res/drawable-xhdpi/trace_history.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/itgowo/TraceDemo/63c6e4a6e021d442c32c9306aa1e7ba88456af18/TraceDemo/app/src/main/res/drawable-xhdpi/trace_history.png
--------------------------------------------------------------------------------
/TraceDemo/app/src/main/res/drawable-xhdpi/trace_time.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/itgowo/TraceDemo/63c6e4a6e021d442c32c9306aa1e7ba88456af18/TraceDemo/app/src/main/res/drawable-xhdpi/trace_time.png
--------------------------------------------------------------------------------
/TraceDemo/app/src/main/res/drawable-xhdpi/tracetype_bike.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/itgowo/TraceDemo/63c6e4a6e021d442c32c9306aa1e7ba88456af18/TraceDemo/app/src/main/res/drawable-xhdpi/tracetype_bike.png
--------------------------------------------------------------------------------
/TraceDemo/app/src/main/res/drawable-xhdpi/tracetype_run.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/itgowo/TraceDemo/63c6e4a6e021d442c32c9306aa1e7ba88456af18/TraceDemo/app/src/main/res/drawable-xhdpi/tracetype_run.png
--------------------------------------------------------------------------------
/TraceDemo/app/src/main/res/drawable-xhdpi/trance_bike.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/itgowo/TraceDemo/63c6e4a6e021d442c32c9306aa1e7ba88456af18/TraceDemo/app/src/main/res/drawable-xhdpi/trance_bike.png
--------------------------------------------------------------------------------
/TraceDemo/app/src/main/res/drawable-xhdpi/trance_bike2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/itgowo/TraceDemo/63c6e4a6e021d442c32c9306aa1e7ba88456af18/TraceDemo/app/src/main/res/drawable-xhdpi/trance_bike2.png
--------------------------------------------------------------------------------
/TraceDemo/app/src/main/res/drawable-xhdpi/trance_run.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/itgowo/TraceDemo/63c6e4a6e021d442c32c9306aa1e7ba88456af18/TraceDemo/app/src/main/res/drawable-xhdpi/trance_run.png
--------------------------------------------------------------------------------
/TraceDemo/app/src/main/res/drawable-xhdpi/trance_run2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/itgowo/TraceDemo/63c6e4a6e021d442c32c9306aa1e7ba88456af18/TraceDemo/app/src/main/res/drawable-xhdpi/trance_run2.png
--------------------------------------------------------------------------------
/TraceDemo/app/src/main/res/drawable-xhdpi/xlistview_arrow.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/itgowo/TraceDemo/63c6e4a6e021d442c32c9306aa1e7ba88456af18/TraceDemo/app/src/main/res/drawable-xhdpi/xlistview_arrow.png
--------------------------------------------------------------------------------
/TraceDemo/app/src/main/res/drawable-xxhdpi/fanhui.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/itgowo/TraceDemo/63c6e4a6e021d442c32c9306aa1e7ba88456af18/TraceDemo/app/src/main/res/drawable-xxhdpi/fanhui.png
--------------------------------------------------------------------------------
/TraceDemo/app/src/main/res/drawable/backgrounp_gray1.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/TraceDemo/app/src/main/res/drawable/backgrounp_orange.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/TraceDemo/app/src/main/res/drawable/circle_deepblue.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 |
8 |
11 |
12 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/TraceDemo/app/src/main/res/drawable/circle_gray.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 |
8 |
11 |
12 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/TraceDemo/app/src/main/res/drawable/circle_orange.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 |
8 |
11 |
12 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/TraceDemo/app/src/main/res/drawable/circlerect_gray.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/TraceDemo/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
11 |
12 |
19 |
20 |
27 |
28 |
35 |
36 |
41 |
42 |
46 |
47 |
--------------------------------------------------------------------------------
/TraceDemo/app/src/main/res/layout/activity_trace_end.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
14 |
15 |
19 |
20 |
21 |
26 |
27 |
31 |
32 |
40 |
41 |
52 |
53 |
65 |
66 |
67 |
68 |
69 |
74 |
75 |
80 |
81 |
87 |
88 |
95 |
96 |
102 |
103 |
104 |
110 |
111 |
118 |
119 |
125 |
126 |
127 |
128 |
129 |
134 |
135 |
140 |
141 |
147 |
148 |
155 |
156 |
162 |
163 |
164 |
165 |
171 |
172 |
179 |
180 |
186 |
187 |
188 |
194 |
195 |
202 |
203 |
209 |
210 |
211 |
212 |
213 |
214 |
215 |
--------------------------------------------------------------------------------
/TraceDemo/app/src/main/res/layout/activity_trace_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
15 |
16 |
21 |
22 |
31 |
32 |
45 |
46 |
57 |
58 |
59 |
68 |
69 |
77 |
78 |
83 |
84 |
90 |
91 |
92 |
101 |
102 |
111 |
112 |
123 |
124 |
133 |
134 |
135 |
136 |
143 |
144 |
145 |
146 |
147 |
154 |
155 |
171 |
172 |
173 |
174 |
181 |
182 |
192 |
193 |
197 |
198 |
--------------------------------------------------------------------------------
/TraceDemo/app/src/main/res/layout/activity_trace_record.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
14 |
15 |
23 |
24 |
--------------------------------------------------------------------------------
/TraceDemo/app/src/main/res/layout/listview_itemtypetitle.xml:
--------------------------------------------------------------------------------
1 |
2 |
13 |
14 |
--------------------------------------------------------------------------------
/TraceDemo/app/src/main/res/layout/nodataview.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/TraceDemo/app/src/main/res/layout/sliding_layout.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
13 |
14 |
20 |
21 |
--------------------------------------------------------------------------------
/TraceDemo/app/src/main/res/layout/titlebar_viewlayout.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
10 |
23 |
24 |
25 |
35 |
36 |
50 |
51 |
52 |
65 |
66 |
--------------------------------------------------------------------------------
/TraceDemo/app/src/main/res/layout/trace_includelayout.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
14 |
15 |
22 |
23 |
31 |
32 |
39 |
40 |
41 |
48 |
49 |
56 |
57 |
64 |
65 |
66 |
67 |
72 |
73 |
79 |
80 |
84 |
85 |
93 |
94 |
102 |
103 |
110 |
111 |
120 |
121 |
128 |
129 |
130 |
131 |
139 |
140 |
148 |
149 |
156 |
157 |
166 |
167 |
174 |
175 |
176 |
177 |
182 |
183 |
199 |
200 |
201 |
202 |
216 |
217 |
218 |
228 |
229 |
230 |
231 |
--------------------------------------------------------------------------------
/TraceDemo/app/src/main/res/layout/tracerecordlistitem.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
19 |
20 |
21 |
30 |
31 |
40 |
41 |
42 |
52 |
53 |
54 |
65 |
66 |
--------------------------------------------------------------------------------
/TraceDemo/app/src/main/res/layout/waitingdialog.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
17 |
18 |
26 |
27 |
--------------------------------------------------------------------------------
/TraceDemo/app/src/main/res/layout/walksharetopview.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
15 |
16 |
28 |
29 |
41 |
42 |
49 |
50 |
55 |
56 |
67 |
68 |
--------------------------------------------------------------------------------
/TraceDemo/app/src/main/res/layout/xlistview_footer.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
11 |
12 |
18 |
19 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/TraceDemo/app/src/main/res/layout/xlistview_header.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
11 |
12 |
19 |
20 |
26 |
27 |
31 |
32 |
38 |
39 |
45 |
46 |
47 |
48 |
56 |
57 |
65 |
66 |
67 |
--------------------------------------------------------------------------------
/TraceDemo/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/itgowo/TraceDemo/63c6e4a6e021d442c32c9306aa1e7ba88456af18/TraceDemo/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/TraceDemo/app/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/itgowo/TraceDemo/63c6e4a6e021d442c32c9306aa1e7ba88456af18/TraceDemo/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/TraceDemo/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/itgowo/TraceDemo/63c6e4a6e021d442c32c9306aa1e7ba88456af18/TraceDemo/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/TraceDemo/app/src/main/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/itgowo/TraceDemo/63c6e4a6e021d442c32c9306aa1e7ba88456af18/TraceDemo/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/TraceDemo/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/itgowo/TraceDemo/63c6e4a6e021d442c32c9306aa1e7ba88456af18/TraceDemo/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/TraceDemo/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/itgowo/TraceDemo/63c6e4a6e021d442c32c9306aa1e7ba88456af18/TraceDemo/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/TraceDemo/app/src/main/res/mipmap-xxhdpi/fenxiang.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/itgowo/TraceDemo/63c6e4a6e021d442c32c9306aa1e7ba88456af18/TraceDemo/app/src/main/res/mipmap-xxhdpi/fenxiang.png
--------------------------------------------------------------------------------
/TraceDemo/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/itgowo/TraceDemo/63c6e4a6e021d442c32c9306aa1e7ba88456af18/TraceDemo/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/TraceDemo/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/itgowo/TraceDemo/63c6e4a6e021d442c32c9306aa1e7ba88456af18/TraceDemo/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/TraceDemo/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/itgowo/TraceDemo/63c6e4a6e021d442c32c9306aa1e7ba88456af18/TraceDemo/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/TraceDemo/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/itgowo/TraceDemo/63c6e4a6e021d442c32c9306aa1e7ba88456af18/TraceDemo/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/TraceDemo/app/src/main/res/values/attrs_CircleProgress.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
--------------------------------------------------------------------------------
/TraceDemo/app/src/main/res/values/attrs_DragButton.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
--------------------------------------------------------------------------------
/TraceDemo/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | #FFFFFF
5 | #e2e2e2
6 | #f2f2f2
7 | #999999
8 | #fe671e
9 | #32cb21
10 | #FFFFFF
11 | #f2f2f2
12 | #7c7c7c
13 | #e5e5e5
14 | #000000
15 | #40000000
16 | #80000000
17 | #04aaaa
18 |
19 | #20fe671e
20 | #40fe671e
21 | #242424
22 | #36353a
23 | #85bbb8
24 | #82888e
25 | #ea4e3d
26 | #4e5359
27 |
28 | #242424
29 | #c0c0c0
30 | #666666
31 | #e5e5e5
32 | #777777
33 | #777777
34 | #999999
35 | #ffffff
36 | #fe671e
37 |
38 |
39 | @color/v180_color5
40 | @color/v180_color1
41 | @color/v180_color16
42 | @color/v180_color3
43 |
44 |
--------------------------------------------------------------------------------
/TraceDemo/app/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 16dp
5 | 16dp
6 |
7 |
8 | 30sp
9 | 17sp
10 | 17sp
11 | 17sp
12 | 16sp
13 | 15sp
14 | 14sp
15 | 14sp
16 | 13sp
17 | 12sp
18 | 12sp
19 | 11sp
20 | 10sp
21 | 9sp
22 | 11sp
23 | 7sp
24 | 20sp
25 | 45dp
26 | 45dp
27 | 45dp
28 | 50dp
29 |
30 |
--------------------------------------------------------------------------------
/TraceDemo/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | TraceDemo
3 |
4 |
--------------------------------------------------------------------------------
/TraceDemo/app/src/main/res/values/strings_XListView.xml:
--------------------------------------------------------------------------------
1 |
2 | 下拉刷新
3 | 松开刷新数据
4 | 正在加载...
5 | 上次更新时间:
6 | 查看更多
7 | 松开载入更多
8 |
9 |
--------------------------------------------------------------------------------
/TraceDemo/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
18 |
27 |
28 |
--------------------------------------------------------------------------------
/TraceDemo/app/src/test/java/com/itgowo/sport/trace/tracedemo/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.itgowo.sport.trace.tracedemo;
2 |
3 |
4 |
5 | /**
6 | * Example local unit test, which will execute on the development machine (host).
7 | *
8 | * @see Testing documentation
9 | */
10 | public class ExampleUnitTest {
11 |
12 | public void addition_isCorrect() throws Exception {
13 |
14 | }
15 | }
--------------------------------------------------------------------------------
/TraceDemo/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 | repositories {
5 | jcenter()
6 | }
7 | dependencies {
8 | classpath 'com.android.tools.build:gradle:2.3.2'
9 |
10 | // NOTE: Do not place your application dependencies here; they belong
11 | // in the individual module build.gradle files
12 | }
13 | }
14 |
15 | allprojects {
16 | repositories {
17 | jcenter()
18 | }
19 | }
20 |
21 | task clean(type: Delete) {
22 | delete rootProject.buildDir
23 | }
24 |
--------------------------------------------------------------------------------
/TraceDemo/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 |
3 | # IDE (e.g. Android Studio) users:
4 | # Gradle settings configured through the IDE *will override*
5 | # any settings specified in this file.
6 |
7 | # For more details on how to configure your build environment visit
8 | # http://www.gradle.org/docs/current/userguide/build_environment.html
9 |
10 | # Specifies the JVM arguments used for the daemon process.
11 | # The setting is particularly useful for tweaking memory settings.
12 | org.gradle.jvmargs=-Xmx1536m
13 |
14 | # When configured, Gradle will run in incubating parallel mode.
15 | # This option should only be used with decoupled projects. More details, visit
16 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
17 | # org.gradle.parallel=true
18 |
--------------------------------------------------------------------------------
/TraceDemo/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/itgowo/TraceDemo/63c6e4a6e021d442c32c9306aa1e7ba88456af18/TraceDemo/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/TraceDemo/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Mon May 15 10:18:01 CST 2017
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip
7 |
--------------------------------------------------------------------------------
/TraceDemo/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
10 | DEFAULT_JVM_OPTS=""
11 |
12 | APP_NAME="Gradle"
13 | APP_BASE_NAME=`basename "$0"`
14 |
15 | # Use the maximum available, or set MAX_FD != -1 to use that value.
16 | MAX_FD="maximum"
17 |
18 | warn ( ) {
19 | echo "$*"
20 | }
21 |
22 | die ( ) {
23 | echo
24 | echo "$*"
25 | echo
26 | exit 1
27 | }
28 |
29 | # OS specific support (must be 'true' or 'false').
30 | cygwin=false
31 | msys=false
32 | darwin=false
33 | case "`uname`" in
34 | CYGWIN* )
35 | cygwin=true
36 | ;;
37 | Darwin* )
38 | darwin=true
39 | ;;
40 | MINGW* )
41 | msys=true
42 | ;;
43 | esac
44 |
45 | # Attempt to set APP_HOME
46 | # Resolve links: $0 may be a link
47 | PRG="$0"
48 | # Need this for relative symlinks.
49 | while [ -h "$PRG" ] ; do
50 | ls=`ls -ld "$PRG"`
51 | link=`expr "$ls" : '.*-> \(.*\)$'`
52 | if expr "$link" : '/.*' > /dev/null; then
53 | PRG="$link"
54 | else
55 | PRG=`dirname "$PRG"`"/$link"
56 | fi
57 | done
58 | SAVED="`pwd`"
59 | cd "`dirname \"$PRG\"`/" >/dev/null
60 | APP_HOME="`pwd -P`"
61 | cd "$SAVED" >/dev/null
62 |
63 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
64 |
65 | # Determine the Java command to use to start the JVM.
66 | if [ -n "$JAVA_HOME" ] ; then
67 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
68 | # IBM's JDK on AIX uses strange locations for the executables
69 | JAVACMD="$JAVA_HOME/jre/sh/java"
70 | else
71 | JAVACMD="$JAVA_HOME/bin/java"
72 | fi
73 | if [ ! -x "$JAVACMD" ] ; then
74 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
75 |
76 | Please set the JAVA_HOME variable in your environment to match the
77 | location of your Java installation."
78 | fi
79 | else
80 | JAVACMD="java"
81 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
82 |
83 | Please set the JAVA_HOME variable in your environment to match the
84 | location of your Java installation."
85 | fi
86 |
87 | # Increase the maximum file descriptors if we can.
88 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
89 | MAX_FD_LIMIT=`ulimit -H -n`
90 | if [ $? -eq 0 ] ; then
91 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
92 | MAX_FD="$MAX_FD_LIMIT"
93 | fi
94 | ulimit -n $MAX_FD
95 | if [ $? -ne 0 ] ; then
96 | warn "Could not set maximum file descriptor limit: $MAX_FD"
97 | fi
98 | else
99 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
100 | fi
101 | fi
102 |
103 | # For Darwin, add options to specify how the application appears in the dock
104 | if $darwin; then
105 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
106 | fi
107 |
108 | # For Cygwin, switch paths to Windows format before running java
109 | if $cygwin ; then
110 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
111 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
112 | JAVACMD=`cygpath --unix "$JAVACMD"`
113 |
114 | # We build the pattern for arguments to be converted via cygpath
115 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
116 | SEP=""
117 | for dir in $ROOTDIRSRAW ; do
118 | ROOTDIRS="$ROOTDIRS$SEP$dir"
119 | SEP="|"
120 | done
121 | OURCYGPATTERN="(^($ROOTDIRS))"
122 | # Add a user-defined pattern to the cygpath arguments
123 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
124 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
125 | fi
126 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
127 | i=0
128 | for arg in "$@" ; do
129 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
130 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
131 |
132 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
133 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
134 | else
135 | eval `echo args$i`="\"$arg\""
136 | fi
137 | i=$((i+1))
138 | done
139 | case $i in
140 | (0) set -- ;;
141 | (1) set -- "$args0" ;;
142 | (2) set -- "$args0" "$args1" ;;
143 | (3) set -- "$args0" "$args1" "$args2" ;;
144 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
145 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
146 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
147 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
148 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
149 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
150 | esac
151 | fi
152 |
153 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
154 | function splitJvmOpts() {
155 | JVM_OPTS=("$@")
156 | }
157 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
158 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
159 |
160 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
161 |
--------------------------------------------------------------------------------
/TraceDemo/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
12 | set DEFAULT_JVM_OPTS=
13 |
14 | set DIRNAME=%~dp0
15 | if "%DIRNAME%" == "" set DIRNAME=.
16 | set APP_BASE_NAME=%~n0
17 | set APP_HOME=%DIRNAME%
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windowz variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 | if "%@eval[2+2]" == "4" goto 4NT_args
53 |
54 | :win9xME_args
55 | @rem Slurp the command line arguments.
56 | set CMD_LINE_ARGS=
57 | set _SKIP=2
58 |
59 | :win9xME_args_slurp
60 | if "x%~1" == "x" goto execute
61 |
62 | set CMD_LINE_ARGS=%*
63 | goto execute
64 |
65 | :4NT_args
66 | @rem Get arguments from the 4NT Shell from JP Software
67 | set CMD_LINE_ARGS=%$
68 |
69 | :execute
70 | @rem Setup the command line
71 |
72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
73 |
74 | @rem Execute Gradle
75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
76 |
77 | :end
78 | @rem End local scope for the variables with windows NT shell
79 | if "%ERRORLEVEL%"=="0" goto mainEnd
80 |
81 | :fail
82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83 | rem the _cmd.exe /c_ return code!
84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
85 | exit /b 1
86 |
87 | :mainEnd
88 | if "%OS%"=="Windows_NT" endlocal
89 |
90 | :omega
91 |
--------------------------------------------------------------------------------
/TraceDemo/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
--------------------------------------------------------------------------------
/TraceServer.7z:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/itgowo/TraceDemo/63c6e4a6e021d442c32c9306aa1e7ba88456af18/TraceServer.7z
--------------------------------------------------------------------------------
/TraceServer.war:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/itgowo/TraceDemo/63c6e4a6e021d442c32c9306aa1e7ba88456af18/TraceServer.war
--------------------------------------------------------------------------------
/TraceServer/.idea/artifacts/TraceServer.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | $PROJECT_DIR$/out/artifacts/TraceServer
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/TraceServer/.idea/encodings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/TraceServer/.idea/kotlinc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/TraceServer/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/TraceServer/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/TraceServer/Libs/fastjson-1.2.32.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/itgowo/TraceDemo/63c6e4a6e021d442c32c9306aa1e7ba88456af18/TraceServer/Libs/fastjson-1.2.32.jar
--------------------------------------------------------------------------------
/TraceServer/Libs/sqlite-jdbc-3.16.1.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/itgowo/TraceDemo/63c6e4a6e021d442c32c9306aa1e7ba88456af18/TraceServer/Libs/sqlite-jdbc-3.16.1.jar
--------------------------------------------------------------------------------
/TraceServer/src/DBManager.java:
--------------------------------------------------------------------------------
1 | import java.sql.Connection;
2 | import java.sql.DriverManager;
3 | import java.sql.PreparedStatement;
4 | import java.sql.ResultSet;
5 | import java.sql.SQLException;
6 | import java.sql.Statement;
7 | import java.util.ArrayList;
8 | import java.util.List;
9 |
10 | /**
11 | * Created by hnvfh on 2017/5/15.
12 | */
13 | public class DBManager {
14 | private static boolean isFirstRun = true;
15 | private static String Url = "jdbc:sqlite:record.db";
16 | private static String CreatTableSql = "CREATE TABLE record (\n" +
17 | "\"id\" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,\n" +
18 | "\"mileage\" REAL,\n" +
19 | "\"finishTime\" INTEGER,\n" +
20 | "\"avgSpeed\" REAL,\n" +
21 | "\"altitude\" REAL,\n" +
22 | "\"startTime\" INTEGER,\n" +
23 | "\"endTime\" INTEGER,\n" +
24 | "\"pace\" INTEGER,\n" +
25 | "\"itemType\" INTEGER,\n" +
26 | "\"records\" TEXT\n" +
27 | ")";
28 |
29 | public synchronized static void init() {
30 | Connection connection = null;
31 | // load the sqlite-JDBC driver using the current class loader
32 | try {
33 | Class.forName("org.sqlite.JDBC");
34 | // create a database connection
35 | connection = DriverManager.getConnection("jdbc:sqlite:record.db");
36 | if (isFirstRun) {
37 | Statement statement = connection.createStatement();
38 | statement.setQueryTimeout(30); // set timeout to 30 sec.
39 | ResultSet mSet = statement.executeQuery("SELECT count(*) FROM sqlite_master WHERE type='table' AND name='record'");
40 | int count = 0;
41 | while (mSet.next()) {
42 | count = mSet.getInt(1);
43 | }
44 | if (count == 0) {
45 | statement.executeUpdate(CreatTableSql);
46 | }
47 | statement.close();
48 | connection.close();
49 | isFirstRun = false;
50 | }
51 | } catch (Exception e) {
52 | // if the error message is "out of memory",
53 | // it probably means no database file is found
54 | e.printStackTrace();
55 | } finally {
56 | try {
57 | if (connection != null)
58 | connection.close();
59 | } catch (SQLException e) {
60 | // connection close failed.
61 | e.printStackTrace();
62 | }
63 | }
64 | }
65 |
66 | static {
67 | init();
68 | }
69 |
70 | /**
71 | * 添加一条数据
72 | *
73 | * @param mEntity_record
74 | * @return
75 | */
76 | public synchronized static int addTraceRecord(Entity_Record mEntity_record) {
77 | Connection connection = null;
78 | try {
79 | Class.forName("org.sqlite.JDBC");
80 | connection = DriverManager.getConnection(Url);
81 | int result;
82 | String sql = "insert into record (mileage,finishTime,avgSpeed,altitude,startTime,endTime,pace,itemType,records) values(?,?,?,?,?,?,?,?,?)";
83 | PreparedStatement pstmt;
84 | pstmt = connection.prepareStatement(sql);
85 | pstmt.setDouble(1, mEntity_record.getMileage());
86 | pstmt.setLong(2, mEntity_record.getFinishTime());
87 | pstmt.setDouble(3, mEntity_record.getAvgSpeed());
88 | pstmt.setDouble(4, mEntity_record.getAltitude());
89 | pstmt.setLong(5, mEntity_record.getStartTime());
90 | pstmt.setLong(6, mEntity_record.getEndTime());
91 | pstmt.setInt(7, mEntity_record.getPace());
92 | pstmt.setInt(8, mEntity_record.getItemType());
93 | pstmt.setString(9, mEntity_record.getRecords());
94 | result = pstmt.executeUpdate();
95 | pstmt.close();
96 | Statement statement = connection.createStatement();
97 | statement.setQueryTimeout(30); // set timeout to 30 sec.
98 | ResultSet rs = statement.executeQuery("select * from record order by id desc limit 0,1");
99 | if (rs.next()) {
100 | result = rs.getInt(1);
101 | }
102 | statement.close();
103 | connection.close();
104 | return result;
105 | } catch (Exception mE) {
106 | mE.printStackTrace();
107 | if (connection != null) {
108 | try {
109 | connection.close();
110 | } catch (SQLException mE1) {
111 | mE1.printStackTrace();
112 | }
113 | }
114 | }
115 | return -1;
116 | }
117 |
118 | /**
119 | * 根据ID查轨迹记录
120 | *
121 | * @param id
122 | * @return
123 | */
124 | public synchronized static Entity_Record getTraceRecord(int id) {
125 | Connection connection = null;
126 | Entity_Record mEntity_record = null;
127 | try {
128 | Class.forName("org.sqlite.JDBC");
129 | connection = DriverManager.getConnection(Url);
130 | Statement statement = connection.createStatement();
131 | statement.setQueryTimeout(30); // set timeout to 30 sec.
132 | ResultSet rs = statement.executeQuery("select * from record WHERE id=" + id);
133 | while (rs.next()) {
134 | mEntity_record = new Entity_Record();
135 | mEntity_record.setId(rs.getInt("id"));
136 | mEntity_record.setMileage(rs.getDouble("mileage"));
137 | mEntity_record.setFinishTime(rs.getLong("finishTime"));
138 | mEntity_record.setAvgSpeed(rs.getDouble("avgSpeed"));
139 | mEntity_record.setAltitude(rs.getDouble("altitude"));
140 | mEntity_record.setStartTime(rs.getLong("startTime"));
141 | mEntity_record.setEndTime(rs.getLong("endTime"));
142 | mEntity_record.setPace(rs.getInt("pace"));
143 | mEntity_record.setItemType(rs.getInt("itemType"));
144 | mEntity_record.setRecords(rs.getString("records"));
145 | }
146 | statement.close();
147 | connection.close();
148 | return mEntity_record;
149 | } catch (Exception mE) {
150 | mE.printStackTrace();
151 | if (connection != null) {
152 | try {
153 | connection.close();
154 | } catch (SQLException mE1) {
155 | mE1.printStackTrace();
156 | }
157 | }
158 | }
159 | return mEntity_record;
160 | }
161 |
162 | /**
163 | * 获取某一项运动类型的总数据
164 | *
165 | * @param type 1:跑步 2:骑行
166 | * @return
167 | */
168 | public synchronized static Entity_TotalInfo getTraceTotalInfo(int type) {
169 |
170 | Entity_TotalInfo mEntity_totalInfo = new Entity_TotalInfo();
171 | Connection connection = null;
172 | try {
173 | Class.forName("org.sqlite.JDBC");
174 | connection = DriverManager.getConnection(Url);
175 | Statement statement = connection.createStatement();
176 | ResultSet rs = statement.executeQuery("select sum(mileage),sum(finishTime) from record WHERE itemType=" + type);
177 |
178 | while (rs.next()) {
179 | mEntity_totalInfo.setTotalmileage(rs.getDouble(1));
180 | mEntity_totalInfo.setTotalTime(rs.getLong(2));
181 | mEntity_totalInfo.setType(type);
182 | }
183 | statement.close();
184 | connection.close();
185 | return mEntity_totalInfo;
186 | } catch (Exception mE) {
187 | mE.printStackTrace();
188 | if (connection != null) {
189 | try {
190 | connection.close();
191 | } catch (SQLException mE1) {
192 | mE1.printStackTrace();
193 | }
194 | }
195 | }
196 | return mEntity_totalInfo;
197 | }
198 |
199 | /**
200 | * 轨迹记录列表
201 | *
202 | * @param pageindex
203 | * @param pagesize
204 | * @return
205 | */
206 | public synchronized static List getTraceRecordList(int type, int pageindex, int pagesize) {
207 | List mRecords = new ArrayList<>();
208 | Connection connection = null;
209 | try {
210 | Class.forName("org.sqlite.JDBC");
211 | connection = DriverManager.getConnection(Url);
212 | PreparedStatement statement = connection.prepareStatement("SELECT record.id,record.mileage,record.finishTime,record.avgSpeed,record.altitude,record.startTime,record.endTime,record.pace,record.itemType FROM record WHERE itemType=? ORDER BY endTime DESC LIMIT ?,?");
213 | statement.setInt(1, type);
214 | statement.setInt(2, pageindex);
215 | statement.setInt(3, pagesize);
216 | ResultSet rs = statement.executeQuery();
217 | while (rs.next()) {
218 | Entity_Record mEntity_record = new Entity_Record();
219 | mEntity_record.setId(rs.getInt("id"));
220 | mEntity_record.setMileage(rs.getDouble("mileage"));
221 | mEntity_record.setFinishTime(rs.getLong("finishTime"));
222 | mEntity_record.setAvgSpeed(rs.getDouble("avgSpeed"));
223 | mEntity_record.setAltitude(rs.getDouble("altitude"));
224 | mEntity_record.setStartTime(rs.getLong("startTime"));
225 | mEntity_record.setEndTime(rs.getLong("endTime"));
226 | mEntity_record.setPace(rs.getInt("pace"));
227 | mEntity_record.setItemType(rs.getInt("itemType"));
228 | // mEntity_record.setRecords(rs.getString("records"));
229 | mRecords.add(mEntity_record);
230 | }
231 | statement.close();
232 | connection.close();
233 | return mRecords;
234 | } catch (Exception mE) {
235 | mE.printStackTrace();
236 | if (connection != null) {
237 | try {
238 | connection.close();
239 | } catch (SQLException mE1) {
240 | mE1.printStackTrace();
241 | }
242 | }
243 | }
244 | return mRecords;
245 | }
246 |
247 | /**
248 | * 删除轨迹记录
249 | *
250 | * @param id
251 | * @return
252 | */
253 | public synchronized static int deleteTraceRecord(int id) {
254 | Connection connection = null;
255 | try {
256 | Class.forName("org.sqlite.JDBC");
257 | connection = DriverManager.getConnection(Url);
258 | Statement statement = connection.createStatement();
259 | int mI = statement.executeUpdate("DELETE from record where id=" + id);
260 | return mI;
261 | } catch (Exception mE) {
262 | mE.printStackTrace();
263 | }
264 | return -1;
265 | }
266 | }
267 |
--------------------------------------------------------------------------------
/TraceServer/src/Entity_Record.java:
--------------------------------------------------------------------------------
1 | public class Entity_Record {
2 | private int id;
3 | private double mileage; // 里程
4 | private long finishTime; // 用时
5 | private double avgSpeed; // 平均速度
6 | private double altitude; // 爬升
7 | private long startTime; // 开始时间
8 | private long endTime; // 结束时间
9 | private int pace; // 配速
10 | private int itemType; // 类型 1 跑步 2 骑行
11 | private String records; // 记录
12 |
13 | public int getId() {
14 | return id;
15 | }
16 |
17 | public Entity_Record setId(int mId) {
18 | id = mId;
19 | return this;
20 | }
21 |
22 | public double getMileage() {
23 | return mileage;
24 | }
25 |
26 | public Entity_Record setMileage(double mMileage) {
27 | mileage = mMileage;
28 | return this;
29 | }
30 |
31 | public long getFinishTime() {
32 | return finishTime;
33 | }
34 |
35 | public Entity_Record setFinishTime(long mFinishTime) {
36 | finishTime = mFinishTime;
37 | return this;
38 | }
39 |
40 | public double getAvgSpeed() {
41 | return avgSpeed;
42 | }
43 |
44 | public Entity_Record setAvgSpeed(double mAvgSpeed) {
45 | avgSpeed = mAvgSpeed;
46 | return this;
47 | }
48 |
49 | public double getAltitude() {
50 | return altitude;
51 | }
52 |
53 | public Entity_Record setAltitude(double mAltitude) {
54 | altitude = mAltitude;
55 | return this;
56 | }
57 |
58 | public long getStartTime() {
59 | return startTime;
60 | }
61 |
62 | public Entity_Record setStartTime(long mStartTime) {
63 | startTime = mStartTime;
64 | return this;
65 | }
66 |
67 | public long getEndTime() {
68 | return endTime;
69 | }
70 |
71 | public Entity_Record setEndTime(long mEndTime) {
72 | endTime = mEndTime;
73 | return this;
74 | }
75 |
76 | public int getPace() {
77 | return pace;
78 | }
79 |
80 | public Entity_Record setPace(int mPace) {
81 | pace = mPace;
82 | return this;
83 | }
84 |
85 | public int getItemType() {
86 | return itemType;
87 | }
88 |
89 | public Entity_Record setItemType(int mItemType) {
90 | itemType = mItemType;
91 | return this;
92 | }
93 |
94 | public String getRecords() {
95 | return records;
96 | }
97 |
98 | public Entity_Record setRecords(String mRecords) {
99 | records = mRecords;
100 | return this;
101 | }
102 | }
103 |
--------------------------------------------------------------------------------
/TraceServer/src/Entity_RequestTrace.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Created by hnvfh on 2017/5/15.
3 | */
4 | public class Entity_RequestTrace {
5 | public static final int RequestNo = 0, RequestDetails = 1, RequestList = 2, RequestUpload = 3, RequestInfo = 4,RequestDel=5;
6 | private int requestType = 0; //0;不请求数据 1:根据id获取详情(id) 2:获取轨迹列表(pageindex,pagesize) 3:上传轨迹 4:获取统计信息 关联运动类型,用id传
7 | private int id;
8 | private int pageindex = 1;
9 | private int pagesize = 20;
10 | private Entity_Record entity;
11 |
12 | public int getRequestType() {
13 | return requestType;
14 | }
15 |
16 | public Entity_RequestTrace setRequestType(int mRequestType) {
17 | requestType = mRequestType;
18 | return this;
19 | }
20 |
21 | public int getId() {
22 | return id;
23 | }
24 |
25 | public Entity_RequestTrace setId(int mId) {
26 | id = mId;
27 | return this;
28 | }
29 |
30 | public int getPageindex() {
31 | return pageindex;
32 | }
33 |
34 | public Entity_RequestTrace setPageindex(int mPageindex) {
35 | pageindex = mPageindex;
36 | return this;
37 | }
38 |
39 | public int getPagesize() {
40 | return pagesize;
41 | }
42 |
43 | public Entity_RequestTrace setPagesize(int mPagesize) {
44 | pagesize = mPagesize;
45 | return this;
46 | }
47 |
48 | public Entity_Record getEntity() {
49 | return entity;
50 | }
51 |
52 | public Entity_RequestTrace setEntity(Entity_Record mEntity) {
53 | entity = mEntity;
54 | return this;
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/TraceServer/src/Entity_TotalInfo.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Created by hnvfh on 2017/5/16.
3 | */
4 | public class Entity_TotalInfo {
5 | private double totalmileage; // 里程
6 | private long totalTime; // 用时
7 | private int type; // 类型
8 |
9 | public int getType() {
10 | return type;
11 | }
12 |
13 | public Entity_TotalInfo setType(int mType) {
14 | type = mType;
15 | return this;
16 | }
17 |
18 | public double getTotalmileage() {
19 | return totalmileage;
20 | }
21 |
22 | public Entity_TotalInfo setTotalmileage(double mTotalmileage) {
23 | totalmileage = mTotalmileage;
24 | return this;
25 | }
26 |
27 | public long getTotalTime() {
28 | return totalTime;
29 | }
30 |
31 | public Entity_TotalInfo setTotalTime(long mTotalTime) {
32 | totalTime = mTotalTime;
33 | return this;
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/TraceServer/src/ErrorEnum.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Created by hnvfh on 2016/12/5.
3 | */
4 | public class ErrorEnum {
5 | public static final int 请求方式错误toGet = 100;
6 | public static final String Code_100 = "请求方式错误,请用Get方式请求";
7 | public static final int 请求方式错误toPost = 101;
8 | public static final String Code_101 = "请求方式错误,请用Post方式请求";
9 |
10 | public static final int 请求成功 = 200;
11 | public static final String Code_200 = "请求成功";
12 |
13 | public static final int Json解析异常 = 201;
14 | public static final String Code_201 = "Json解析异常";
15 |
16 | public static final int 数据库异常 = 202;
17 | public static final String Code_202 = "数据库异常";
18 |
19 | public static final int 数据库查询异常 = 203;
20 | public static final String Code_203 = "数据库查询异常";
21 |
22 | public static final int 数据库写入异常 = 204;
23 | public static final String Code_204 = "数据库写入异常";
24 |
25 |
26 | public static final int 参数未找到 = 205;
27 | public static final String Code_205 = "参数未找到";
28 |
29 | public static final int 请求失败 = 206;
30 | public static final String Code_206 = "请求失败";
31 |
32 | public static final int 参数错误 = 207;
33 | public static final String Code_207 = "参数错误";
34 |
35 | public static final int 参数log未找到 = 208;
36 | public static final String Code_208 = "参数log未找到";
37 |
38 | public static final int GZIP数据未找到 = 209;
39 | public static final String Code_209 = "GZIP数据未找到";
40 |
41 | public static final int 上传失败 = 301;
42 | public static final String Code_301 = "没有上传数据或者未识别信息";
43 |
44 | public static final int 上传失败_中断 = 302;
45 | public static final String Code_302 = "上传过程中网络异常,请重试";
46 |
47 | public static final int 文件未找到 = 303;
48 | public static final String Code_303 = "文件未找到";
49 |
50 | public static final int 文件读取失败 = 304;
51 | public static final String Code_304 = "文件读取失败";
52 | }
53 |
--------------------------------------------------------------------------------
/TraceServer/src/Response.java:
--------------------------------------------------------------------------------
1 | import com.alibaba.fastjson.JSON;
2 |
3 | /**
4 | * Created by hnvfh on 2017/5/15.
5 | */
6 | public class Response {
7 | private int code=200;
8 | private String msg="成功";
9 | private Object mData;
10 |
11 | public int getCode() {
12 | return code;
13 | }
14 |
15 | public Response setCode(int mCode) {
16 | code = mCode;
17 | return this;
18 | }
19 |
20 | public String getMsg() {
21 | return msg;
22 | }
23 |
24 | public Response setMsg(String mMsg) {
25 | msg = mMsg;
26 | return this;
27 | }
28 |
29 | public Object getData() {
30 | return mData;
31 | }
32 |
33 | public Response setData(Object mData) {
34 | this.mData = mData;
35 | return this;
36 | }
37 | public String toJson(){
38 | return JSON.toJSONString(this);
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/TraceServer/src/Trace.java:
--------------------------------------------------------------------------------
1 | import com.alibaba.fastjson.JSON;
2 |
3 | import java.io.BufferedReader;
4 | import java.io.IOException;
5 | import java.io.InputStream;
6 | import java.nio.charset.Charset;
7 | import java.sql.Connection;
8 | import java.sql.DriverManager;
9 | import java.sql.SQLException;
10 | import java.sql.SQLInput;
11 | import java.util.List;
12 |
13 | import javax.servlet.ServletException;
14 | import javax.servlet.ServletInputStream;
15 | import javax.servlet.annotation.WebServlet;
16 | import javax.servlet.http.HttpServlet;
17 | import javax.servlet.http.HttpServletRequest;
18 | import javax.servlet.http.HttpServletResponse;
19 |
20 | /**
21 | * Created by hnvfh on 2017/5/15.
22 | */
23 | @WebServlet(name = "Trace")
24 | public class Trace extends HttpServlet {
25 | protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
26 | request.setCharacterEncoding("UTF-8");
27 | response.setCharacterEncoding("UTF-8");
28 |
29 | BufferedReader mReader = request.getReader();
30 | StringBuilder out = new StringBuilder();
31 | String data;
32 | while ((data = mReader.readLine()) != null) {
33 | out.append(data + "\r\n");
34 | }
35 | data = out.toString().trim();
36 | Entity_RequestTrace mRequestTrace = null;
37 | try {
38 | mRequestTrace = JSON.parseObject(data, Entity_RequestTrace.class);
39 | } catch (Exception mE) {
40 | mE.printStackTrace();
41 | response.getWriter().write(new Response().setCode(ErrorEnum.Json解析异常).setMsg(ErrorEnum.Code_201).setData(mE.getMessage()).toJson());
42 | }
43 | try {
44 | switch (mRequestTrace.getRequestType()) {
45 | case Entity_RequestTrace.RequestDetails:
46 | Entity_Record mRecord = DBManager.getTraceRecord(mRequestTrace.getId());
47 | response.getWriter().write(new Response().setData(mRecord).toJson());
48 | break;
49 | case Entity_RequestTrace.RequestList:
50 | List mRecords = DBManager.getTraceRecordList(mRequestTrace.getId(),mRequestTrace.getPageindex(), mRequestTrace.getPagesize());
51 | response.getWriter().write(new Response().setData(mRecords).toJson());
52 | break;
53 | case Entity_RequestTrace.RequestUpload:
54 | int mI = DBManager.addTraceRecord(mRequestTrace.getEntity());
55 | if (mI > 0) {
56 | response.getWriter().write(new Response().setData(new Entity_Record().setId(mI)).toJson());
57 | } else {
58 | response.getWriter().write(new Response().setCode(ErrorEnum.数据库写入异常).setMsg(ErrorEnum.Code_204).toJson());
59 | }
60 | break;
61 | case Entity_RequestTrace.RequestInfo:
62 | Entity_TotalInfo mInfo = DBManager.getTraceTotalInfo(mRequestTrace.getId());
63 | response.getWriter().write(new Response().setData(mInfo).toJson());
64 | break;
65 | case Entity_RequestTrace.RequestDel:
66 | int mI1=DBManager.deleteTraceRecord(mRequestTrace.getId());
67 | if (mI1>0){
68 | response.getWriter().write(new Response().toJson());
69 | }else {
70 | response.getWriter().write(new Response().setCode(ErrorEnum.数据库写入异常).setMsg(ErrorEnum.Code_204).toJson());
71 | }
72 | break;
73 | default:
74 | response.getWriter().write(new Response().setCode(ErrorEnum.参数错误).setMsg(ErrorEnum.Code_207).toJson());
75 | break;
76 | }
77 | } catch (Exception mE) {
78 | mE.printStackTrace();
79 | response.getWriter().write(new Response().setCode(ErrorEnum.数据库异常).setMsg(ErrorEnum.Code_202).setData(mE.getMessage()).toJson());
80 | }
81 | }
82 |
83 | protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
84 | request.setCharacterEncoding("UTF-8");
85 | response.setCharacterEncoding("UTF-8");
86 |
87 | response.getWriter().write(new Response().setCode(ErrorEnum.请求方式错误toPost).setMsg(ErrorEnum.Code_101).toJson());
88 | }
89 | }
90 |
--------------------------------------------------------------------------------
/TraceServer/web/0.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/itgowo/TraceDemo/63c6e4a6e021d442c32c9306aa1e7ba88456af18/TraceServer/web/0.jpg
--------------------------------------------------------------------------------
/TraceServer/web/1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/itgowo/TraceDemo/63c6e4a6e021d442c32c9306aa1e7ba88456af18/TraceServer/web/1.jpg
--------------------------------------------------------------------------------
/TraceServer/web/2.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/itgowo/TraceDemo/63c6e4a6e021d442c32c9306aa1e7ba88456af18/TraceServer/web/2.jpg
--------------------------------------------------------------------------------
/TraceServer/web/3.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/itgowo/TraceDemo/63c6e4a6e021d442c32c9306aa1e7ba88456af18/TraceServer/web/3.jpg
--------------------------------------------------------------------------------
/TraceServer/web/4.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/itgowo/TraceDemo/63c6e4a6e021d442c32c9306aa1e7ba88456af18/TraceServer/web/4.jpg
--------------------------------------------------------------------------------
/TraceServer/web/5.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/itgowo/TraceDemo/63c6e4a6e021d442c32c9306aa1e7ba88456af18/TraceServer/web/5.jpg
--------------------------------------------------------------------------------
/TraceServer/web/WEB-INF/META-INF/MANIFEST.MF:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 |
3 |
--------------------------------------------------------------------------------
/TraceServer/web/WEB-INF/web.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
8 | Trace
9 | Trace
10 |
11 |
12 | Trace
13 | /Trace
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/TraceServer/web/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | 晴空的一滴雨
6 |
7 |
8 |
9 | 运动类轨迹记录Demo(Android和Tomcat源码)
10 | 个人主页:http://lujianchao.com
11 | 个人主页:http://itgowo.com
12 | 声明:文件下载使用的是我自己写的文件服务器,所有文件都是一个id表示,支持断点续传,同名(同路径)文件会被替换,从C盘移动到d盘再次上传会被认为是两个文件,同一个路径视为同一个文件进行更新,空间有限,只能这样了
13 | App和Server源码
14 |
15 | 简单介绍
16 |
17 | 1:Android demo最开始页面
18 | 地图使用的是百度地图,单独申请的key,放到了源码中
19 |
20 |
21 |
22 | 默认进来就会获取总运动里程和总时间,切换运动类型可以更新数据
23 | 右上角一个是排行,因为demo没有用户区分处理,所以无效,另一个是记录,根据首页选择运动类型显示相应类型数据记录 |
24 |  |
25 |
26 |
27 | 因为在楼间定位不准确,只能这么看了
28 | 配速是单位路程所使用的时间,这里是千米每秒,显示格式为分秒,如果超过1小时会显示小时 |
29 |  |
30 |
31 |
32 | 按住锁屏按钮有动画并计时,计时到了全屏加一层遮罩
33 | 滑动解锁 |
34 |  |
35 |
36 |
37 | 运动中可以点击下方距离时间区域,自动收回和展开,有动画 |
38 |  |
39 |
40 |
41 | 根据日期分割
42 | 列表支持刷新和加载更多,增加自定义方法,空数据有单独显示,默认加了上次刷新时间提示 |
43 |  |
44 |
45 |
46 | 上面右侧是分享记录的路程
47 | 左上是用户名和备注信息
48 | 用画笔画的bitmap |
49 |  |
50 |
51 |
52 |
53 | 1:Tomcat 源码
54 | 使用了fastjson和sqlite-jdbc,不用担心数据库有密码泄露了(ˇˍˇ) 想~
55 | Servlet是用IntelliJ IDEA开发的,只有一个Servlet做了上传记录获取记录和列表等多个功能,个人感觉一个接口就够用了
56 | 非专业开发,勿喷,有用中文做参数的
57 | QQ:1264957104
58 | 个人主页:http://lujianchao.com
59 | 个人主页:http://itgowo.com
60 |
61 |
62 |
--------------------------------------------------------------------------------
/debug.keystore:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/itgowo/TraceDemo/63c6e4a6e021d442c32c9306aa1e7ba88456af18/debug.keystore
--------------------------------------------------------------------------------
/keystore说明.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/itgowo/TraceDemo/63c6e4a6e021d442c32c9306aa1e7ba88456af18/keystore说明.txt
--------------------------------------------------------------------------------