├── Vpedometer
├── .gitignore
├── .idea
│ ├── compiler.xml
│ ├── copyright
│ │ └── profiles_settings.xml
│ ├── encodings.xml
│ ├── gradle.xml
│ ├── inspectionProfiles
│ │ ├── Project_Default.xml
│ │ └── profiles_settings.xml
│ ├── misc.xml
│ ├── modules.xml
│ ├── runConfigurations.xml
│ └── statistic.xml
├── LibMarsdaemon
│ ├── .gitignore
│ ├── build.gradle
│ ├── jni
│ │ ├── Android.mk
│ │ ├── Application.mk
│ │ ├── com_marswin89_marsdaemon_nativ_NativeDaemonAPI20.h
│ │ ├── com_marswin89_marsdaemon_nativ_NativeDaemonAPI21.h
│ │ ├── common.c
│ │ ├── constant.h
│ │ ├── daemon.c
│ │ ├── daemon_api20.c
│ │ ├── daemon_api21.c
│ │ └── log.h
│ ├── libs
│ │ ├── armeabi-v7a
│ │ │ ├── libdaemon_api20.so
│ │ │ └── libdaemon_api21.so
│ │ ├── armeabi
│ │ │ ├── libdaemon_api20.so
│ │ │ └── libdaemon_api21.so
│ │ └── x86
│ │ │ ├── libdaemon_api20.so
│ │ │ └── libdaemon_api21.so
│ ├── proguard-rules.pro
│ └── src
│ │ ├── main
│ │ ├── AndroidManifest.xml
│ │ ├── assets
│ │ │ ├── armeabi-v7a
│ │ │ │ └── daemon
│ │ │ ├── armeabi
│ │ │ │ └── daemon
│ │ │ └── x86
│ │ │ │ └── daemon
│ │ ├── java
│ │ │ └── com
│ │ │ │ └── marswin89
│ │ │ │ └── marsdaemon
│ │ │ │ ├── DaemonApplication.java
│ │ │ │ ├── DaemonClient.java
│ │ │ │ ├── DaemonConfigurations.java
│ │ │ │ ├── IDaemonClient.java
│ │ │ │ ├── IDaemonStrategy.java
│ │ │ │ ├── NativeDaemonBase.java
│ │ │ │ ├── PackageUtils.java
│ │ │ │ ├── nativ
│ │ │ │ ├── NativeDaemonAPI20.java
│ │ │ │ └── NativeDaemonAPI21.java
│ │ │ │ └── strategy
│ │ │ │ ├── DaemonStrategy21.java
│ │ │ │ ├── DaemonStrategy22.java
│ │ │ │ ├── DaemonStrategy23.java
│ │ │ │ ├── DaemonStrategyUnder21.java
│ │ │ │ └── DaemonStrategyXiaomi.java
│ │ └── res
│ │ │ └── values
│ │ │ └── strings.xml
│ │ └── test
│ │ └── java
│ │ └── com
│ │ └── marswin89
│ │ └── marsdaemon
│ │ └── ExampleUnitTest.java
├── app
│ ├── .gitignore
│ ├── app-release.apk
│ ├── build.gradle
│ ├── libs
│ │ ├── cocos2d-android.jar
│ │ ├── hellocharts-library-1.5.8.jar
│ │ ├── lite-orm-1.7.0.jar
│ │ └── nineoldandroids-2.4.0.jar
│ ├── proguard-rules.pro
│ └── src
│ │ ├── androidTest
│ │ └── java
│ │ │ └── com
│ │ │ └── vincent
│ │ │ └── vpedometer
│ │ │ └── ExampleInstrumentedTest.java
│ │ ├── main
│ │ ├── AndroidManifest.xml
│ │ ├── assets
│ │ │ ├── fight
│ │ │ │ ├── FinalWave.png
│ │ │ │ ├── FlagMeterLevelProgress.png
│ │ │ │ ├── StartPlant.png
│ │ │ │ ├── StartReady.png
│ │ │ │ ├── StartSet.png
│ │ │ │ ├── Thumbs.db
│ │ │ │ ├── ZombiesWon.jpg
│ │ │ │ ├── bk1.jpg
│ │ │ │ ├── bullet.png
│ │ │ │ ├── chose
│ │ │ │ │ ├── choose_default01.png
│ │ │ │ │ ├── choose_default02.png
│ │ │ │ │ ├── choose_default03.png
│ │ │ │ │ ├── choose_default04.png
│ │ │ │ │ ├── choose_default05.png
│ │ │ │ │ ├── choose_default06.png
│ │ │ │ │ ├── choose_default07.png
│ │ │ │ │ ├── choose_default08.png
│ │ │ │ │ ├── choose_default09.png
│ │ │ │ │ ├── chose_01.png
│ │ │ │ │ ├── fight_choose.png
│ │ │ │ │ ├── fight_chose.png
│ │ │ │ │ └── fight_start.png
│ │ │ │ ├── flagmeter.png
│ │ │ │ ├── map_day.tmx
│ │ │ │ ├── progress.png
│ │ │ │ ├── ready_01.png
│ │ │ │ ├── ready_02.png
│ │ │ │ ├── ready_03.png
│ │ │ │ ├── startready_01.png
│ │ │ │ ├── startready_02.png
│ │ │ │ ├── startready_03.png
│ │ │ │ └── zombhead.png
│ │ │ ├── fps_images.png
│ │ │ ├── map
│ │ │ │ ├── 132807580832.jpg
│ │ │ │ ├── fullmap.tmx
│ │ │ │ └── map.tmx
│ │ │ └── zombies
│ │ │ │ ├── attack
│ │ │ │ ├── z_1_attack_01.png
│ │ │ │ ├── z_1_attack_02.png
│ │ │ │ ├── z_1_attack_03.png
│ │ │ │ ├── z_1_attack_04.png
│ │ │ │ ├── z_1_attack_05.png
│ │ │ │ ├── z_1_attack_06.png
│ │ │ │ ├── z_1_attack_07.png
│ │ │ │ ├── z_1_attack_08.png
│ │ │ │ ├── z_1_attack_09.png
│ │ │ │ └── z_1_attack_10.png
│ │ │ │ ├── attack_losthead
│ │ │ │ ├── z_1_attack_losthead_01.png
│ │ │ │ ├── z_1_attack_losthead_02.png
│ │ │ │ ├── z_1_attack_losthead_03.png
│ │ │ │ ├── z_1_attack_losthead_04.png
│ │ │ │ ├── z_1_attack_losthead_05.png
│ │ │ │ ├── z_1_attack_losthead_06.png
│ │ │ │ ├── z_1_attack_losthead_07.png
│ │ │ │ └── z_1_attack_losthead_08.png
│ │ │ │ ├── die
│ │ │ │ ├── z_1_die_01.png
│ │ │ │ ├── z_1_die_02.png
│ │ │ │ ├── z_1_die_03.png
│ │ │ │ ├── z_1_die_04.png
│ │ │ │ ├── z_1_die_05.png
│ │ │ │ └── z_1_die_06.png
│ │ │ │ ├── head
│ │ │ │ ├── z_1_head_01.png
│ │ │ │ ├── z_1_head_02.png
│ │ │ │ ├── z_1_head_03.png
│ │ │ │ ├── z_1_head_04.png
│ │ │ │ ├── z_1_head_05.png
│ │ │ │ └── z_1_head_06.png
│ │ │ │ ├── shake
│ │ │ │ ├── z_1_01.png
│ │ │ │ └── z_1_02.png
│ │ │ │ ├── walk
│ │ │ │ ├── z_1_01.png
│ │ │ │ ├── z_1_02.png
│ │ │ │ ├── z_1_03.png
│ │ │ │ ├── z_1_04.png
│ │ │ │ ├── z_1_05.png
│ │ │ │ ├── z_1_06.png
│ │ │ │ └── z_1_07.png
│ │ │ │ └── work_losthead
│ │ │ │ ├── z_1_losthead_01.png
│ │ │ │ ├── z_1_losthead_02.png
│ │ │ │ ├── z_1_losthead_03.png
│ │ │ │ ├── z_1_losthead_04.png
│ │ │ │ ├── z_1_losthead_05.png
│ │ │ │ ├── z_1_losthead_06.png
│ │ │ │ ├── z_1_losthead_07.png
│ │ │ │ ├── z_1_losthead_08.png
│ │ │ │ └── z_1_losthead_09.png
│ │ ├── java
│ │ │ └── com
│ │ │ │ └── vincent
│ │ │ │ └── vpedometer
│ │ │ │ ├── base
│ │ │ │ ├── BaseActivity.java
│ │ │ │ └── StepMode.java
│ │ │ │ ├── config
│ │ │ │ └── MyConstants.java
│ │ │ │ ├── dao
│ │ │ │ ├── MyDBOpenHelper.java
│ │ │ │ └── ShutDownDao.java
│ │ │ │ ├── pojo
│ │ │ │ ├── BaseElement.java
│ │ │ │ ├── ChartData.java
│ │ │ │ ├── Fighter.java
│ │ │ │ ├── GameCharecter.java
│ │ │ │ ├── RemoteSkill.java
│ │ │ │ ├── ShowFighter.java
│ │ │ │ ├── ShowSkill.java
│ │ │ │ ├── ShutDown.java
│ │ │ │ ├── Skill.java
│ │ │ │ ├── StepData.java
│ │ │ │ ├── TheFighter.java
│ │ │ │ └── User.java
│ │ │ │ ├── receiver
│ │ │ │ └── BootCompleteReceiver.java
│ │ │ │ ├── services
│ │ │ │ ├── StepInAcceleration.java
│ │ │ │ ├── StepInPedometer.java
│ │ │ │ └── StepService.java
│ │ │ │ ├── test
│ │ │ │ └── data
│ │ │ │ │ └── Constant.java
│ │ │ │ ├── ui
│ │ │ │ ├── activity
│ │ │ │ │ ├── ChartActivity.java
│ │ │ │ │ ├── GameActivity.java
│ │ │ │ │ ├── LoginActivity.java
│ │ │ │ │ ├── MainActivity.java
│ │ │ │ │ ├── MapActivity.java
│ │ │ │ │ ├── RegisterAcitivity.java
│ │ │ │ │ └── SplashActivity.java
│ │ │ │ ├── enginne
│ │ │ │ │ └── GameEnginee.java
│ │ │ │ ├── fragment
│ │ │ │ │ ├── BaseFrament.java
│ │ │ │ │ ├── GameListFrament.java
│ │ │ │ │ ├── HomeFragment.java
│ │ │ │ │ ├── IconFragment.java
│ │ │ │ │ ├── InformationFragment.java
│ │ │ │ │ ├── PasswordFragment.java
│ │ │ │ │ └── SettingFragment.java
│ │ │ │ ├── layer
│ │ │ │ │ ├── BaseLayer.java
│ │ │ │ │ └── MapLayer.java
│ │ │ │ └── view
│ │ │ │ │ ├── BeforeOrAfterCalendarView.java
│ │ │ │ │ ├── MyLinearLayout.java
│ │ │ │ │ ├── MyListView.java
│ │ │ │ │ ├── RecordsCalenderItemView.java
│ │ │ │ │ └── SlideMenu.java
│ │ │ │ └── utils
│ │ │ │ ├── ColorUtil.java
│ │ │ │ ├── DbUtils.java
│ │ │ │ ├── GameUtils.java
│ │ │ │ ├── PermissionUtils.java
│ │ │ │ ├── SensorCheckUtils.java
│ │ │ │ ├── ServerUtils.java
│ │ │ │ ├── SpTools.java
│ │ │ │ ├── StreamUtils.java
│ │ │ │ └── TimeUtils.java
│ │ └── res
│ │ │ ├── drawable
│ │ │ ├── bg.png
│ │ │ ├── head.png
│ │ │ ├── ic_blue_round_bg.png
│ │ │ ├── ic_small_blue_rectangular.png
│ │ │ ├── stronger.jpeg
│ │ │ └── v.JPG
│ │ │ ├── layout
│ │ │ ├── activity_login.xml
│ │ │ ├── activity_main.xml
│ │ │ ├── activity_register.xml
│ │ │ ├── activity_splash.xml
│ │ │ ├── before_or_after_calendar_layout.xml
│ │ │ ├── layout_chat.xml
│ │ │ ├── layout_gamelist.xml
│ │ │ ├── layout_home.xml
│ │ │ ├── layout_information.xml
│ │ │ ├── layout_main.xml
│ │ │ ├── layout_map.xml
│ │ │ ├── layout_menu.xml
│ │ │ ├── layout_more.xml
│ │ │ ├── layout_password.xml
│ │ │ ├── layout_photo.xml
│ │ │ └── records_calender_item_view.xml
│ │ │ ├── menu
│ │ │ └── activity_main.xml
│ │ │ ├── mipmap-hdpi
│ │ │ ├── ic_blue_round_bg.png
│ │ │ ├── ic_launcher.png
│ │ │ └── ic_small_blue_rectangular.png
│ │ │ ├── mipmap-mdpi
│ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-xhdpi
│ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-xxhdpi
│ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-xxxhdpi
│ │ │ └── ic_launcher.png
│ │ │ ├── raw
│ │ │ ├── day.mp3
│ │ │ └── start.mp3
│ │ │ ├── values-w820dp
│ │ │ └── dimens.xml
│ │ │ └── values
│ │ │ ├── colors.xml
│ │ │ ├── dimens.xml
│ │ │ ├── strings.xml
│ │ │ └── styles.xml
│ │ └── test
│ │ └── java
│ │ └── com
│ │ └── vincent
│ │ └── vpedometer
│ │ └── ExampleUnitTest.java
├── build.gradle
├── gradle.properties
├── gradle
│ └── wrapper
│ │ ├── gradle-wrapper.jar
│ │ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
└── settings.gradle
└── pedometerserver
├── .classpath
├── .mymetadata
├── .project
├── .settings
├── .jsdtscope
├── org.eclipse.jdt.core.prefs
├── org.eclipse.wst.common.component
├── org.eclipse.wst.common.project.facet.core.xml
├── org.eclipse.wst.jsdt.ui.superType.container
└── org.eclipse.wst.jsdt.ui.superType.name
├── WebRoot
├── META-INF
│ └── MANIFEST.MF
├── WEB-INF
│ ├── classes
│ │ ├── c3p0-config.xml
│ │ └── vincent
│ │ │ └── chan
│ │ │ ├── dao
│ │ │ ├── RoleDao.class
│ │ │ └── UserDao.class
│ │ │ ├── pojo
│ │ │ ├── Role.class
│ │ │ └── User.class
│ │ │ ├── services
│ │ │ ├── RoleService.class
│ │ │ └── UserService.class
│ │ │ ├── servlet
│ │ │ ├── RoleServlet.class
│ │ │ └── UserServlet.class
│ │ │ └── utils
│ │ │ └── Tool.class
│ ├── lib
│ │ ├── activation.jar
│ │ ├── c3p0-0.9.2-pre1.jar
│ │ ├── c3p0-oracle-thin-extras-0.9.2-pre1.jar
│ │ ├── commons-beanutils-1.8.3.jar
│ │ ├── commons-collections-3.2.1.jar
│ │ ├── commons-dbutils-1.4.jar
│ │ ├── commons-fileupload-1.3.1.jar
│ │ ├── commons-io-2.4.jar
│ │ ├── commons-lang-2.5.jar
│ │ ├── commons-logging-1.2.jar
│ │ ├── ezmorph-1.0.6.jar
│ │ ├── gson-2.3.1.jar
│ │ ├── itcast-tools-1.4.2.jar
│ │ ├── json-lib-2.4-jdk15.jar
│ │ ├── mchange-commons-0.2.jar
│ │ └── mysql-connector-java-5.1.13-bin.jar
│ └── web.xml
└── index.jsp
└── src
├── c3p0-config.xml
└── vincent
└── chan
├── dao
├── RoleDao.java
└── UserDao.java
├── pojo
├── Role.java
└── User.java
├── services
├── RoleService.java
└── UserService.java
├── servlet
├── RoleServlet.java
└── UserServlet.java
└── utils
└── Tool.java
/Vpedometer/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea/workspace.xml
5 | /.idea/libraries
6 | .DS_Store
7 | /build
8 | /captures
9 | .externalNativeBuild
10 |
--------------------------------------------------------------------------------
/Vpedometer/.idea/compiler.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/Vpedometer/.idea/copyright/profiles_settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/Vpedometer/.idea/encodings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Vpedometer/.idea/gradle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
18 |
19 |
--------------------------------------------------------------------------------
/Vpedometer/.idea/inspectionProfiles/Project_Default.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/Vpedometer/.idea/inspectionProfiles/profiles_settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/Vpedometer/.idea/misc.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 |
--------------------------------------------------------------------------------
/Vpedometer/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/Vpedometer/.idea/runConfigurations.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/Vpedometer/.idea/statistic.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/Vpedometer/LibMarsdaemon/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/Vpedometer/LibMarsdaemon/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.library'
2 |
3 | android {
4 | compileSdkVersion 23
5 | buildToolsVersion "23.0.2"
6 |
7 | defaultConfig {
8 | minSdkVersion 10
9 | targetSdkVersion 23
10 | versionCode 1
11 | versionName "1.0"
12 | }
13 | buildTypes {
14 | release {
15 | minifyEnabled false
16 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
17 | }
18 | }
19 | sourceSets {
20 | main {
21 | jniLibs.srcDirs =['libs']
22 | }
23 | }
24 | }
25 |
26 | dependencies {
27 | compile fileTree(dir: 'libs', include: ['*.jar'])
28 | testCompile 'junit:junit:4.12'
29 | compile 'com.android.support:appcompat-v7:23.1.1'
30 | }
31 |
--------------------------------------------------------------------------------
/Vpedometer/LibMarsdaemon/jni/Android.mk:
--------------------------------------------------------------------------------
1 | LOCAL_PATH := $(call my-dir)
2 | include $(CLEAR_VARS)
3 | LOCAL_MODULE := daemon_api20
4 | LOCAL_SRC_FILES := daemon_api20.c \
5 | common.c
6 | LOCAL_C_INCLUDES := $(LOCAL_PATH)/include
7 | LOCAL_LDLIBS := -L$(SYSROOT)/usr/lib -llog -lm -lz
8 | include $(BUILD_SHARED_LIBRARY)
9 |
10 | include $(CLEAR_VARS)
11 | LOCAL_MODULE := daemon_api21
12 | LOCAL_SRC_FILES := daemon_api21.c \
13 | common.c
14 | LOCAL_C_INCLUDES := $(LOCAL_PATH)/include
15 | LOCAL_LDLIBS := -L$(SYSROOT)/usr/lib -llog -lm -lz
16 | include $(BUILD_SHARED_LIBRARY)
17 |
18 | include $(CLEAR_VARS)
19 | LOCAL_MODULE := daemon
20 | LOCAL_SRC_FILES := daemon.c
21 | LOCAL_CFLAGS += -pie -fPIE
22 | LOCAL_LDFLAGS += -pie -fPIE
23 | LOCAL_C_INCLUDES := $(LOCAL_PATH)/include
24 | LOCAL_LDLIBS += -L$(SYSROOT)/usr/lib -llog -lm -lz
25 | include $(BUILD_EXECUTABLE)
26 |
27 |
--------------------------------------------------------------------------------
/Vpedometer/LibMarsdaemon/jni/Application.mk:
--------------------------------------------------------------------------------
1 | APP_ABI := armeabi armeabi-v7a x86
2 | APP_PLATFORM := android-15
--------------------------------------------------------------------------------
/Vpedometer/LibMarsdaemon/jni/com_marswin89_marsdaemon_nativ_NativeDaemonAPI20.h:
--------------------------------------------------------------------------------
1 | /* DO NOT EDIT THIS FILE - it is machine generated */
2 | #include
3 | /* Header for class com_marswin89_marsdaemon_nativ_NativeDaemonAPI20 */
4 |
5 | #ifndef _Included_com_marswin89_marsdaemon_nativ_NativeDaemonAPI20
6 | #define _Included_com_marswin89_marsdaemon_nativ_NativeDaemonAPI20
7 | #ifdef __cplusplus
8 | extern "C" {
9 | #endif
10 | /*
11 | * Class: com_marswin89_marsdaemon_nativ_NativeDaemonAPI20
12 | * Method: doDaemon
13 | * Signature: (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
14 | */
15 | JNIEXPORT void JNICALL Java_com_marswin89_marsdaemon_nativ_NativeDaemonAPI20_doDaemon
16 | (JNIEnv *, jobject, jstring, jstring, jstring);
17 |
18 | #ifdef __cplusplus
19 | }
20 | #endif
21 | #endif
22 |
--------------------------------------------------------------------------------
/Vpedometer/LibMarsdaemon/jni/com_marswin89_marsdaemon_nativ_NativeDaemonAPI21.h:
--------------------------------------------------------------------------------
1 | /* DO NOT EDIT THIS FILE - it is machine generated */
2 | #include
3 | /* Header for class com_marswin89_marsdaemon_nativ_NativeDaemonAPI21 */
4 |
5 | #ifndef _Included_com_marswin89_marsdaemon_nativ_NativeDaemonAPI21
6 | #define _Included_com_marswin89_marsdaemon_nativ_NativeDaemonAPI21
7 | #ifdef __cplusplus
8 | extern "C" {
9 | #endif
10 | /*
11 | * Class: com_marswin89_marsdaemon_nativ_NativeDaemonAPI21
12 | * Method: doDaemon
13 | * Signature: (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
14 | */
15 | JNIEXPORT void JNICALL Java_com_marswin89_marsdaemon_nativ_NativeDaemonAPI21_doDaemon
16 | (JNIEnv *, jobject, jstring, jstring, jstring, jstring);
17 |
18 | #ifdef __cplusplus
19 | }
20 | #endif
21 | #endif
22 |
--------------------------------------------------------------------------------
/Vpedometer/LibMarsdaemon/jni/common.c:
--------------------------------------------------------------------------------
1 | /*
2 | * File : daemon_api21.c
3 | * Author : Mars Kwok
4 | * Date : Jul. 21, 2015
5 | * Description : common method here
6 | *
7 | * Copyright (C) Mars Kwok
8 | *
9 | */
10 | #include
11 | #include
12 | #include
13 | #include
14 | #include
15 |
16 | #include "log.h"
17 |
18 | /**
19 | * get the android version code
20 | */
21 | int get_version(){
22 | char value[8] = "";
23 | __system_property_get("ro.build.version.sdk", value);
24 | return atoi(value);
25 | }
26 |
27 | /**
28 | * stitch three string to one
29 | */
30 | char *str_stitching(const char *str1, const char *str2, const char *str3){
31 | char *result;
32 | result = (char*) malloc(strlen(str1) + strlen(str2) + strlen(str3) + 1);
33 | if (!result){
34 | return NULL;
35 | }
36 | strcpy(result, str1);
37 | strcat(result, str2);
38 | strcat(result, str3);
39 | return result;
40 | }
41 |
42 | /**
43 | * get android context
44 | */
45 | jobject get_context(JNIEnv* env, jobject jobj){
46 | jclass thiz_cls = (*env)->GetObjectClass(env, jobj);
47 | jfieldID context_field = (*env)->GetFieldID(env, thiz_cls, "mContext", "Landroid/content/Context;");
48 | return (*env)->GetObjectField(env, jobj, context_field);
49 | }
50 |
51 |
52 | char* get_package_name(JNIEnv* env, jobject jobj){
53 | jobject context_obj = get_context(env, jobj);
54 | jclass context_cls = (*env)->GetObjectClass(env, context_obj);
55 | jmethodID getpackagename_method = (*env)->GetMethodID(jobj, context_cls, "getPackageName", "()Ljava/lang/String;");
56 | jstring package_name = (jstring)(*env)->CallObjectMethod(env, context_obj, getpackagename_method);
57 | return (char*)(*env)->GetStringUTFChars(env, package_name, 0);
58 | }
59 |
60 |
61 | /**
62 | * call java callback
63 | */
64 | void java_callback(JNIEnv* env, jobject jobj, char* method_name){
65 | jclass cls = (*env)->GetObjectClass(env, jobj);
66 | jmethodID cb_method = (*env)->GetMethodID(env, cls, method_name, "()V");
67 | (*env)->CallVoidMethod(env, jobj, cb_method);
68 | }
69 |
70 | /**
71 | * start a android service
72 | */
73 | void start_service(char* package_name, char* service_name){
74 | pid_t pid = fork();
75 | if(pid < 0){
76 | //error, do nothing...
77 | }else if(pid == 0){
78 | if(package_name == NULL || service_name == NULL){
79 | exit(EXIT_SUCCESS);
80 | }
81 | int version = get_version();
82 | char* pkg_svc_name = str_stitching(package_name, "/", service_name);
83 | if (version >= 17 || version == 0) {
84 | execlp("am", "am", "startservice", "--user", "0", "-n", pkg_svc_name, (char *) NULL);
85 | } else {
86 | execlp("am", "am", "startservice", "-n", pkg_svc_name, (char *) NULL);
87 | }
88 | exit(EXIT_SUCCESS);
89 | }else{
90 | waitpid(pid, NULL, 0);
91 | }
92 | }
93 |
--------------------------------------------------------------------------------
/Vpedometer/LibMarsdaemon/jni/constant.h:
--------------------------------------------------------------------------------
1 | #define NATIVE_DAEMON_NAME "mars_d"
2 | #define BUFFER_SIZE 2048
3 | #define DAEMON_CALLBACK_NAME "onDaemonDead"
4 | #define PARAM_PIPE_1_READ "-p1r"
5 | #define PARAM_PIPE_1_WRITE "-p1w"
6 | #define PARAM_PIPE_2_READ "-p2r"
7 | #define PARAM_PIPE_2_WRITE "-p2w"
8 | #define PARAM_PKG_NAME "-p"
9 | #define PARAM_SVC_NAME "-s"
10 |
11 |
12 |
--------------------------------------------------------------------------------
/Vpedometer/LibMarsdaemon/jni/daemon.c:
--------------------------------------------------------------------------------
1 | /*
2 | * File : daemon_api21.c
3 | * Author : Mars Kwok
4 | * Date : Jul. 21, 2015
5 | * Description : This is native process to watch parent process.
6 | *
7 | * Copyright (C) Mars Kwok
8 | *
9 | */
10 | #include
11 | #include
12 |
13 | #include "log.h"
14 | #include "constant.h"
15 |
16 |
17 | /**
18 | * get the android version code
19 | */
20 | int get_version(){
21 | char value[8] = "";
22 | __system_property_get("ro.build.version.sdk", value);
23 | return atoi(value);
24 | }
25 |
26 | char *str_stitching(const char *str1, const char *str2, const char *str3){
27 | char *result;
28 | result = (char*) malloc(strlen(str1) + strlen(str2) + strlen(str3) + 1);
29 | if (!result){
30 | return NULL;
31 | }
32 | strcpy(result, str1);
33 | strcat(result, str2);
34 | strcat(result, str3);
35 | return result;
36 | }
37 |
38 | /**
39 | * start a android service
40 | */
41 | void start_service(char* package_name, char* service_name){
42 | pid_t pid = fork();
43 | if(pid < 0){
44 | //error, do nothing...
45 | }else if(pid == 0){
46 | if(package_name == NULL || service_name == NULL){
47 | exit(EXIT_SUCCESS);
48 | }
49 | int version = get_version();
50 | char* pkg_svc_name = str_stitching(package_name, "/", service_name);
51 | if (version >= 17 || version == 0) {
52 | execlp("am", "am", "startservice", "--user", "0", "-n", pkg_svc_name, (char *) NULL);
53 | } else {
54 | execlp("am", "am", "startservice", "-n", pkg_svc_name, (char *) NULL);
55 | }
56 | exit(EXIT_SUCCESS);
57 | }else{
58 | waitpid(pid, NULL, 0);
59 | }
60 | }
61 |
62 |
63 |
64 | int main(int argc, char *argv[]){
65 | pid_t pid = fork();
66 | if(pid == 0){
67 | setsid();
68 | int pipe_fd1[2];
69 | int pipe_fd2[2];
70 | char* pkg_name;
71 | char* svc_name;
72 | if(argc < 13){
73 | LOGE("daemon parameters error");
74 | return ;
75 | }
76 | int i;
77 | for (i = 0; i < argc; i ++){
78 | if(argv[i] == NULL){
79 | continue;
80 | }
81 | if (!strcmp(PARAM_PKG_NAME, argv[i])){
82 | pkg_name = argv[i + 1];
83 | }else if (!strcmp(PARAM_SVC_NAME, argv[i])) {
84 | svc_name = argv[i + 1];
85 | }else if (!strcmp(PARAM_PIPE_1_READ, argv[i])){
86 | char* p1r = argv[i + 1];
87 | pipe_fd1[0] = atoi(p1r);
88 | }else if (!strcmp(PARAM_PIPE_1_WRITE, argv[i])) {
89 | char* p1w = argv[i + 1];
90 | pipe_fd1[1] = atoi(p1w);
91 | }else if (!strcmp(PARAM_PIPE_2_READ, argv[i])) {
92 | char* p2r = argv[i + 1];
93 | pipe_fd2[0] = atoi(p2r);
94 | }else if (!strcmp(PARAM_PIPE_2_WRITE, argv[i])) {
95 | char* p2w = argv[i + 1];
96 | pipe_fd2[1] = atoi(p2w);
97 | }
98 | }
99 |
100 | close(pipe_fd1[0]);
101 | close(pipe_fd2[1]);
102 |
103 | char r_buf[100];
104 | int r_num;
105 | memset(r_buf,0, sizeof(r_buf));
106 |
107 | r_num=read(pipe_fd2[0], r_buf, 100);
108 | LOGE("Watch >>>>PARENT<<<< Dead !!");
109 | int count = 0;
110 | while(count < 50){
111 | start_service(pkg_name, svc_name);
112 | usleep(100000);
113 | count++;
114 | }
115 | }else{
116 | exit(EXIT_SUCCESS);
117 | }
118 | }
119 |
--------------------------------------------------------------------------------
/Vpedometer/LibMarsdaemon/jni/daemon_api20.c:
--------------------------------------------------------------------------------
1 | /*
2 | * File : daemon_api21.c
3 | * Author : Mars Kwok
4 | * Date : Jul. 21, 2015
5 | * Description : This is used to watch process dead under api 20
6 | *
7 | * Copyright (C) Mars Kwok
8 | *
9 | */
10 | #include
11 | #include
12 | #include
13 |
14 | #include "log.h"
15 | #include "constant.h"
16 | #include "com_marswin89_marsdaemon_nativ_NativeDaemonAPI20.h"
17 |
18 |
19 |
20 | /**
21 | * get the process pid by process name
22 | */
23 | int find_pid_by_name(char *pid_name, int *pid_list){
24 | DIR *dir;
25 | struct dirent *next;
26 | int i = 0;
27 | pid_list[0] = 0;
28 | dir = opendir("/proc");
29 | if (!dir){
30 | return 0;
31 | }
32 | while ((next = readdir(dir)) != NULL){
33 | FILE *status;
34 | char proc_file_name[BUFFER_SIZE];
35 | char buffer[BUFFER_SIZE];
36 | char process_name[BUFFER_SIZE];
37 |
38 | if (strcmp(next->d_name, "..") == 0){
39 | continue;
40 | }
41 | if (!isdigit(*next->d_name)){
42 | continue;
43 | }
44 | sprintf(proc_file_name, "/proc/%s/cmdline", next->d_name);
45 | if (!(status = fopen(proc_file_name, "r"))){
46 | continue;
47 | }
48 | if (fgets(buffer, BUFFER_SIZE - 1, status) == NULL){
49 | fclose(status);
50 | continue;
51 | }
52 | fclose(status);
53 | sscanf(buffer, "%[^-]", process_name);
54 | if (strcmp(process_name, pid_name) == 0){
55 | pid_list[i ++] = atoi(next->d_name);
56 | }
57 | }
58 | if (pid_list){
59 | pid_list[i] = 0;
60 | }
61 | closedir(dir);
62 | return i;
63 | }
64 |
65 | /**
66 | * kill all process by name
67 | */
68 | void kill_zombie_process(char* zombie_name){
69 | int pid_list[200];
70 | int total_num = find_pid_by_name(zombie_name, pid_list);
71 | LOGD("zombie process name is %s, and number is %d, killing...", zombie_name, total_num);
72 | int i;
73 | for (i = 0; i < total_num; i ++) {
74 | int retval = 0;
75 | int daemon_pid = pid_list[i];
76 | if (daemon_pid > 1 && daemon_pid != getpid() && daemon_pid != getppid()){
77 | retval = kill(daemon_pid, SIGTERM);
78 | if (!retval){
79 | LOGD("kill zombie successfully, zombie`s pid = %d", daemon_pid);
80 | }else{
81 | LOGE("kill zombie failed, zombie`s pid = %d", daemon_pid);
82 | }
83 | }
84 | }
85 | }
86 |
87 | JNIEXPORT void JNICALL Java_com_marswin89_marsdaemon_nativ_NativeDaemonAPI20_doDaemon(JNIEnv *env, jobject jobj, jstring pkgName, jstring svcName, jstring daemonPath){
88 | if(pkgName == NULL || svcName == NULL || daemonPath == NULL){
89 | LOGE("native doDaemon parameters cannot be NULL !");
90 | return ;
91 | }
92 |
93 | char *pkg_name = (char*)(*env)->GetStringUTFChars(env, pkgName, 0);
94 | char *svc_name = (char*)(*env)->GetStringUTFChars(env, svcName, 0);
95 | char *daemon_path = (char*)(*env)->GetStringUTFChars(env, daemonPath, 0);
96 |
97 | kill_zombie_process(NATIVE_DAEMON_NAME);
98 |
99 | int pipe_fd1[2];//order to watch child
100 | int pipe_fd2[2];//order to watch parent
101 |
102 | pid_t pid;
103 | char r_buf[100];
104 | int r_num;
105 | memset(r_buf, 0, sizeof(r_buf));
106 | if(pipe(pipe_fd1)<0){
107 | LOGE("pipe1 create error");
108 | return ;
109 | }
110 | if(pipe(pipe_fd2)<0){
111 | LOGE("pipe2 create error");
112 | return ;
113 | }
114 |
115 | char str_p1r[10];
116 | char str_p1w[10];
117 | char str_p2r[10];
118 | char str_p2w[10];
119 |
120 | sprintf(str_p1r,"%d",pipe_fd1[0]);
121 | sprintf(str_p1w,"%d",pipe_fd1[1]);
122 | sprintf(str_p2r,"%d",pipe_fd2[0]);
123 | sprintf(str_p2w,"%d",pipe_fd2[1]);
124 |
125 |
126 | if((pid=fork())==0){
127 | execlp(daemon_path,
128 | NATIVE_DAEMON_NAME,
129 | PARAM_PKG_NAME, pkg_name,
130 | PARAM_SVC_NAME, svc_name,
131 | PARAM_PIPE_1_READ, str_p1r,
132 | PARAM_PIPE_1_WRITE, str_p1w,
133 | PARAM_PIPE_2_READ, str_p2r,
134 | PARAM_PIPE_2_WRITE, str_p2w,
135 | (char *) NULL);
136 | }else if(pid>0){
137 | close(pipe_fd1[1]);
138 | close(pipe_fd2[0]);
139 | //wait for child
140 | r_num=read(pipe_fd1[0], r_buf, 100);
141 | LOGE("Watch >>>>CHILD<<<< Dead !!!");
142 | java_callback(env, jobj, DAEMON_CALLBACK_NAME);
143 | }
144 | }
145 |
146 |
--------------------------------------------------------------------------------
/Vpedometer/LibMarsdaemon/jni/log.h:
--------------------------------------------------------------------------------
1 | /*
2 | * File : daemon_below20.c
3 | * Author : Guoyang3
4 | * Date : Aug. 14, 2015
5 | * Description : for easy log.
6 | */
7 |
8 | #include
9 | #include
10 |
11 | #define TAG "Daemon"
12 |
13 | #define LOGI(...) __android_log_print(ANDROID_LOG_INFO, TAG, __VA_ARGS__)
14 | #define LOGD(...) __android_log_print(ANDROID_LOG_DEBUG, TAG, __VA_ARGS__)
15 | #define LOGW(...) __android_log_print(ANDROID_LOG_WARN, TAG, __VA_ARGS__)
16 | #define LOGE(...) __android_log_print(ANDROID_LOG_ERROR, TAG, __VA_ARGS__)
--------------------------------------------------------------------------------
/Vpedometer/LibMarsdaemon/libs/armeabi-v7a/libdaemon_api20.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hkvincent/vpeodometer/0a31acd9724a141979c7c35d099f5e401c7e77b6/Vpedometer/LibMarsdaemon/libs/armeabi-v7a/libdaemon_api20.so
--------------------------------------------------------------------------------
/Vpedometer/LibMarsdaemon/libs/armeabi-v7a/libdaemon_api21.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hkvincent/vpeodometer/0a31acd9724a141979c7c35d099f5e401c7e77b6/Vpedometer/LibMarsdaemon/libs/armeabi-v7a/libdaemon_api21.so
--------------------------------------------------------------------------------
/Vpedometer/LibMarsdaemon/libs/armeabi/libdaemon_api20.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hkvincent/vpeodometer/0a31acd9724a141979c7c35d099f5e401c7e77b6/Vpedometer/LibMarsdaemon/libs/armeabi/libdaemon_api20.so
--------------------------------------------------------------------------------
/Vpedometer/LibMarsdaemon/libs/armeabi/libdaemon_api21.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hkvincent/vpeodometer/0a31acd9724a141979c7c35d099f5e401c7e77b6/Vpedometer/LibMarsdaemon/libs/armeabi/libdaemon_api21.so
--------------------------------------------------------------------------------
/Vpedometer/LibMarsdaemon/libs/x86/libdaemon_api20.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hkvincent/vpeodometer/0a31acd9724a141979c7c35d099f5e401c7e77b6/Vpedometer/LibMarsdaemon/libs/x86/libdaemon_api20.so
--------------------------------------------------------------------------------
/Vpedometer/LibMarsdaemon/libs/x86/libdaemon_api21.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hkvincent/vpeodometer/0a31acd9724a141979c7c35d099f5e401c7e77b6/Vpedometer/LibMarsdaemon/libs/x86/libdaemon_api21.so
--------------------------------------------------------------------------------
/Vpedometer/LibMarsdaemon/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in /Users/guoyang/Developer/android-sdk-macosx/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
19 | -keep class com.marswin89.marsdaemon.NativeDaemonBase{*;}
20 | -keep class com.marswin89.marsdaemon.nativ.NativeDaemonAPI20{*;}
21 | -keep class com.marswin89.marsdaemon.nativ.NativeDaemonAPI21{*;}
22 | -keep class com.marswin89.marsdaemon.DaemonApplication{*;}
23 | -keep class com.marswin89.marsdaemon.DaemonClient{*;}
24 | -keepattributes Exceptions,InnerClasses,...
25 | -keep class com.marswin89.marsdaemon.DaemonConfigurations{*;}
26 | -keep class com.marswin89.marsdaemon.DaemonConfigurations$*{*;}
--------------------------------------------------------------------------------
/Vpedometer/LibMarsdaemon/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/Vpedometer/LibMarsdaemon/src/main/assets/armeabi-v7a/daemon:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hkvincent/vpeodometer/0a31acd9724a141979c7c35d099f5e401c7e77b6/Vpedometer/LibMarsdaemon/src/main/assets/armeabi-v7a/daemon
--------------------------------------------------------------------------------
/Vpedometer/LibMarsdaemon/src/main/assets/armeabi/daemon:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hkvincent/vpeodometer/0a31acd9724a141979c7c35d099f5e401c7e77b6/Vpedometer/LibMarsdaemon/src/main/assets/armeabi/daemon
--------------------------------------------------------------------------------
/Vpedometer/LibMarsdaemon/src/main/assets/x86/daemon:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hkvincent/vpeodometer/0a31acd9724a141979c7c35d099f5e401c7e77b6/Vpedometer/LibMarsdaemon/src/main/assets/x86/daemon
--------------------------------------------------------------------------------
/Vpedometer/LibMarsdaemon/src/main/java/com/marswin89/marsdaemon/DaemonApplication.java:
--------------------------------------------------------------------------------
1 | package com.marswin89.marsdaemon;
2 |
3 | import android.app.Application;
4 | import android.content.Context;
5 |
6 | /**
7 | * make your Application extends it
8 | * @author Mars
9 | *
10 | */
11 | public abstract class DaemonApplication extends Application{
12 | /**
13 | * Daemon SDK needs the Daemon Configurations contains two process informations
14 | * see {@link DaemonConfigurations} and {@link DaemonConfigurations.DaemonConfiguration}
15 | *
16 | * @return DaemonConfigurations
17 | */
18 | protected abstract DaemonConfigurations getDaemonConfigurations();
19 |
20 |
21 |
22 | private IDaemonClient mDaemonClient;
23 | public DaemonApplication(){
24 | mDaemonClient = new DaemonClient(getDaemonConfigurations());
25 | }
26 |
27 |
28 | /**
29 | * order to prevent performing super.attachBaseContext() by child class
30 | * if do it, it will cause the IllegalStateException if a base context has already been set.
31 | */
32 | private boolean mHasAttachBaseContext = false;
33 |
34 | @Override
35 | public final void attachBaseContext(Context base) {
36 | if(mHasAttachBaseContext){
37 | return ;
38 | }
39 | mHasAttachBaseContext = true;
40 | super.attachBaseContext(base);
41 | mDaemonClient.onAttachBaseContext(base);
42 | attachBaseContextByDaemon(base);
43 | }
44 |
45 | /**
46 | * instead of {{@link #attachBaseContext(Context)}, you can override this.
47 | * @param base
48 | */
49 | public void attachBaseContextByDaemon(Context base){
50 |
51 | }
52 |
53 |
54 | }
55 |
--------------------------------------------------------------------------------
/Vpedometer/LibMarsdaemon/src/main/java/com/marswin89/marsdaemon/DaemonClient.java:
--------------------------------------------------------------------------------
1 | package com.marswin89.marsdaemon;
2 |
3 | import java.io.BufferedReader;
4 | import java.io.File;
5 | import java.io.FileReader;
6 | import java.io.IOException;
7 |
8 | import android.content.Context;
9 | import android.content.SharedPreferences;
10 | import android.content.SharedPreferences.Editor;
11 |
12 | /**
13 | *
14 | * @author Mars
15 | *
16 | */
17 | public class DaemonClient implements IDaemonClient{
18 | private DaemonConfigurations mConfigurations;
19 | public DaemonClient(DaemonConfigurations configurations) {
20 | this.mConfigurations = configurations;
21 | }
22 | @Override
23 | public void onAttachBaseContext(Context base) {
24 | initDaemon(base);
25 | }
26 |
27 |
28 | private final String DAEMON_PERMITTING_SP_FILENAME = "d_permit";
29 | private final String DAEMON_PERMITTING_SP_KEY = "permitted";
30 |
31 |
32 | private BufferedReader mBufferedReader;//release later to save time
33 |
34 |
35 | /**
36 | * do some thing about daemon
37 | * @param base
38 | */
39 | private void initDaemon(Context base) {
40 | if(!isDaemonPermitting(base) || mConfigurations == null){
41 | return ;
42 | }
43 | String processName = getProcessName();
44 | String packageName = base.getPackageName();
45 |
46 | if(processName.startsWith(mConfigurations.PERSISTENT_CONFIG.PROCESS_NAME)){
47 | IDaemonStrategy.Fetcher.fetchStrategy().onPersistentCreate(base, mConfigurations);
48 | }else if(processName.startsWith(mConfigurations.DAEMON_ASSISTANT_CONFIG.PROCESS_NAME)){
49 | IDaemonStrategy.Fetcher.fetchStrategy().onDaemonAssistantCreate(base, mConfigurations);
50 | }else if(processName.startsWith(packageName)){
51 | IDaemonStrategy.Fetcher.fetchStrategy().onInitialization(base);
52 | }
53 |
54 | releaseIO();
55 | }
56 |
57 |
58 | /* spend too much time !! 60+ms
59 | private String getProcessName(){
60 | ActivityManager am = (ActivityManager) this.getSystemService(Context.ACTIVITY_SERVICE);
61 | int pid = android.os.Process.myPid();
62 | List infos = am.getRunningAppProcesses();
63 | for (int i = 0; i < infos.size(); i++) {
64 | RunningAppProcessInfo info = infos.get(i);
65 | if(pid == info.pid){
66 | return info.processName;
67 | }
68 | }
69 | return null;
70 | }
71 | */
72 |
73 | private String getProcessName() {
74 | try {
75 | File file = new File("/proc/" + android.os.Process.myPid() + "/" + "cmdline");
76 | mBufferedReader = new BufferedReader(new FileReader(file));
77 | return mBufferedReader.readLine();
78 | } catch (Exception e) {
79 | e.printStackTrace();
80 | return null;
81 | }
82 | }
83 |
84 | /**
85 | * release reader IO
86 | */
87 | private void releaseIO(){
88 | if(mBufferedReader != null){
89 | try {
90 | mBufferedReader.close();
91 | } catch (IOException e) {
92 | e.printStackTrace();
93 | }
94 | mBufferedReader = null;
95 | }
96 | }
97 |
98 | private boolean isDaemonPermitting(Context context){
99 | SharedPreferences sp = context.getSharedPreferences(DAEMON_PERMITTING_SP_FILENAME, Context.MODE_PRIVATE);
100 | return sp.getBoolean(DAEMON_PERMITTING_SP_KEY, true);
101 | }
102 |
103 | protected boolean setDaemonPermiiting(Context context, boolean isPermitting) {
104 | SharedPreferences sp = context.getSharedPreferences(DAEMON_PERMITTING_SP_FILENAME, Context.MODE_PRIVATE);
105 | Editor editor = sp.edit();
106 | editor.putBoolean(DAEMON_PERMITTING_SP_KEY, isPermitting);
107 | return editor.commit();
108 | }
109 |
110 | }
111 |
--------------------------------------------------------------------------------
/Vpedometer/LibMarsdaemon/src/main/java/com/marswin89/marsdaemon/DaemonConfigurations.java:
--------------------------------------------------------------------------------
1 | package com.marswin89.marsdaemon;
2 |
3 | import android.content.Context;
4 |
5 | /**
6 | * the configurations of Daemon SDK, contains two process configuration.
7 | * @author Mars
8 | *
9 | */
10 | public class DaemonConfigurations {
11 |
12 | public final DaemonConfiguration PERSISTENT_CONFIG;
13 | public final DaemonConfiguration DAEMON_ASSISTANT_CONFIG;
14 | public final DaemonListener LISTENER;
15 |
16 | public DaemonConfigurations(DaemonConfiguration persistentConfig, DaemonConfiguration daemonAssistantConfig){
17 | this.PERSISTENT_CONFIG = persistentConfig;
18 | this.DAEMON_ASSISTANT_CONFIG = daemonAssistantConfig;
19 | this.LISTENER = null;
20 | }
21 |
22 | public DaemonConfigurations(DaemonConfiguration persistentConfig, DaemonConfiguration daemonAssistantConfig, DaemonListener listener){
23 | this.PERSISTENT_CONFIG = persistentConfig;
24 | this.DAEMON_ASSISTANT_CONFIG = daemonAssistantConfig;
25 | this.LISTENER = listener;
26 | }
27 |
28 |
29 |
30 | /**
31 | * the configuration of a daemon process, contains process name, service name and receiver name if Android 6.0
32 | * @author guoyang
33 | *
34 | */
35 | public static class DaemonConfiguration{
36 |
37 | public final String PROCESS_NAME;
38 | public final String SERVICE_NAME;
39 | public final String RECEIVER_NAME;
40 |
41 | public DaemonConfiguration(String processName, String serviceName, String receiverName){
42 | this.PROCESS_NAME = processName;
43 | this.SERVICE_NAME = serviceName;
44 | this.RECEIVER_NAME = receiverName;
45 | }
46 | }
47 |
48 | /**
49 | * listener of daemon for external
50 | *
51 | * @author Mars
52 | *
53 | */
54 | public interface DaemonListener {
55 | void onPersistentStart(Context context);
56 | void onDaemonAssistantStart(Context context);
57 | void onWatchDaemonDaed();
58 | }
59 | }
60 |
--------------------------------------------------------------------------------
/Vpedometer/LibMarsdaemon/src/main/java/com/marswin89/marsdaemon/IDaemonClient.java:
--------------------------------------------------------------------------------
1 | package com.marswin89.marsdaemon;
2 |
3 | import android.content.Context;
4 |
5 | /**
6 | *
7 | * @author Mars
8 | *
9 | */
10 | public interface IDaemonClient {
11 | /**
12 | * override this method by {@link android.app.Application}
13 | * ****************************************************************
14 | * DO super.attchBaseContext() first !
15 | * ****************************************************************
16 | *
17 | * @param base
18 | */
19 | void onAttachBaseContext(Context base);
20 | }
21 |
--------------------------------------------------------------------------------
/Vpedometer/LibMarsdaemon/src/main/java/com/marswin89/marsdaemon/IDaemonStrategy.java:
--------------------------------------------------------------------------------
1 | package com.marswin89.marsdaemon;
2 |
3 | import com.marswin89.marsdaemon.strategy.DaemonStrategy21;
4 | import com.marswin89.marsdaemon.strategy.DaemonStrategy22;
5 | import com.marswin89.marsdaemon.strategy.DaemonStrategy23;
6 | import com.marswin89.marsdaemon.strategy.DaemonStrategyUnder21;
7 | import com.marswin89.marsdaemon.strategy.DaemonStrategyXiaomi;
8 |
9 | import android.content.Context;
10 | import android.os.Build;
11 |
12 | /**
13 | * define strategy method
14 | *
15 | * @author Mars
16 | *
17 | */
18 | public interface IDaemonStrategy {
19 | /**
20 | * Initialization some files or other when 1st time
21 | *
22 | * @param context
23 | * @return
24 | */
25 | boolean onInitialization(Context context);
26 |
27 | /**
28 | * when Persistent process create
29 | *
30 | * @param context
31 | * @param configs
32 | */
33 | void onPersistentCreate(Context context, DaemonConfigurations configs);
34 |
35 | /**
36 | * when DaemonAssistant process create
37 | * @param context
38 | * @param configs
39 | */
40 | void onDaemonAssistantCreate(Context context, DaemonConfigurations configs);
41 |
42 | /**
43 | * when watches the process dead which it watched
44 | */
45 | void onDaemonDead();
46 |
47 |
48 |
49 | /**
50 | * all about strategy on different device here
51 | *
52 | * @author Mars
53 | *
54 | */
55 | public static class Fetcher {
56 |
57 | private static IDaemonStrategy mDaemonStrategy;
58 |
59 | /**
60 | * fetch the strategy for this device
61 | *
62 | * @return the daemon strategy for this device
63 | */
64 | static IDaemonStrategy fetchStrategy() {
65 | if (mDaemonStrategy != null) {
66 | return mDaemonStrategy;
67 | }
68 | int sdk = Build.VERSION.SDK_INT;
69 | switch (sdk) {
70 | case 23:
71 | mDaemonStrategy = new DaemonStrategy23();
72 | break;
73 |
74 | case 22:
75 | mDaemonStrategy = new DaemonStrategy22();
76 | break;
77 |
78 | case 21:
79 | if("MX4 Pro".equalsIgnoreCase(Build.MODEL)){
80 | mDaemonStrategy = new DaemonStrategyUnder21();
81 | }else{
82 | mDaemonStrategy = new DaemonStrategy21();
83 | }
84 | break;
85 |
86 | default:
87 | if(Build.MODEL != null && Build.MODEL.toLowerCase().startsWith("mi")){
88 | mDaemonStrategy = new DaemonStrategyXiaomi();
89 | }else if(Build.MODEL != null && Build.MODEL.toLowerCase().startsWith("a31")){
90 | mDaemonStrategy = new DaemonStrategy21();
91 | }else{
92 | mDaemonStrategy = new DaemonStrategyUnder21();
93 | }
94 | break;
95 | }
96 | return mDaemonStrategy;
97 | }
98 | }
99 | }
100 |
--------------------------------------------------------------------------------
/Vpedometer/LibMarsdaemon/src/main/java/com/marswin89/marsdaemon/NativeDaemonBase.java:
--------------------------------------------------------------------------------
1 | package com.marswin89.marsdaemon;
2 |
3 | import android.content.Context;
4 |
5 | /**
6 | * native base class
7 | *
8 | * @author Mars
9 | *
10 | */
11 | public class NativeDaemonBase {
12 | /**
13 | * used for native
14 | */
15 | protected Context mContext;
16 |
17 | public NativeDaemonBase(Context context){
18 | this.mContext = context;
19 | }
20 |
21 | /**
22 | * native call back
23 | */
24 | protected void onDaemonDead(){
25 | IDaemonStrategy.Fetcher.fetchStrategy().onDaemonDead();
26 | }
27 |
28 | }
29 |
--------------------------------------------------------------------------------
/Vpedometer/LibMarsdaemon/src/main/java/com/marswin89/marsdaemon/PackageUtils.java:
--------------------------------------------------------------------------------
1 | package com.marswin89.marsdaemon;
2 |
3 | import android.content.ComponentName;
4 | import android.content.Context;
5 | import android.content.pm.PackageManager;
6 |
7 | /**
8 | * Utils to prevent component from third-party app forbidding
9 | *
10 | * @author Mars
11 | *
12 | */
13 | public class PackageUtils {
14 | /**
15 | * set the component in our package default
16 | * @param context
17 | * @param componentClassName
18 | */
19 | public static void setComponentDefault(Context context, String componentClassName){
20 | PackageManager pm = context.getPackageManager();
21 | ComponentName componentName = new ComponentName(context.getPackageName(), componentClassName);
22 | pm.setComponentEnabledSetting(componentName, PackageManager.COMPONENT_ENABLED_STATE_DEFAULT, PackageManager.DONT_KILL_APP);
23 | }
24 |
25 | /**
26 | * get the component in our package default
27 | * @param context
28 | * @param componentClassName
29 | */
30 | public static boolean isComponentDefault(Context context, String componentClassName){
31 | PackageManager pm = context.getPackageManager();
32 | ComponentName componentName = new ComponentName(context.getPackageName(), componentClassName);
33 | return pm.getComponentEnabledSetting(componentName) == PackageManager.COMPONENT_ENABLED_STATE_DEFAULT;
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/Vpedometer/LibMarsdaemon/src/main/java/com/marswin89/marsdaemon/nativ/NativeDaemonAPI20.java:
--------------------------------------------------------------------------------
1 | package com.marswin89.marsdaemon.nativ;
2 |
3 | import com.marswin89.marsdaemon.NativeDaemonBase;
4 |
5 | import android.content.Context;
6 |
7 | /**
8 | * native code to watch each other when api under 20 (contains 20)
9 | * @author Mars
10 | *
11 | */
12 | public class NativeDaemonAPI20 extends NativeDaemonBase {
13 |
14 | public NativeDaemonAPI20(Context context) {
15 | super(context);
16 | }
17 |
18 | static{
19 | try {
20 | System.loadLibrary("daemon_api20");
21 | } catch (Exception e) {
22 | e.printStackTrace();
23 | }
24 | }
25 |
26 | public native void doDaemon(String pkgName, String svcName, String daemonPath);
27 |
28 | }
29 |
--------------------------------------------------------------------------------
/Vpedometer/LibMarsdaemon/src/main/java/com/marswin89/marsdaemon/nativ/NativeDaemonAPI21.java:
--------------------------------------------------------------------------------
1 | package com.marswin89.marsdaemon.nativ;
2 |
3 | import com.marswin89.marsdaemon.NativeDaemonBase;
4 |
5 | import android.content.Context;
6 |
7 | /**
8 | * native code to watch each other when api over 21 (contains 21)
9 | * @author Mars
10 | *
11 | */
12 | public class NativeDaemonAPI21 extends NativeDaemonBase{
13 |
14 | public NativeDaemonAPI21(Context context) {
15 | super(context);
16 | }
17 |
18 | static{
19 | try {
20 | System.loadLibrary("daemon_api21");
21 | } catch (Exception e) {
22 | e.printStackTrace();
23 | }
24 | }
25 |
26 | public native void doDaemon(String indicatorSelfPath, String indicatorDaemonPath, String observerSelfPath, String observerDaemonPath);
27 | }
28 |
--------------------------------------------------------------------------------
/Vpedometer/LibMarsdaemon/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | Marsdaemon
3 |
4 |
--------------------------------------------------------------------------------
/Vpedometer/LibMarsdaemon/src/test/java/com/marswin89/marsdaemon/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.marswin89.marsdaemon;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.*;
6 |
7 | /**
8 | * To work on unit tests, switch the Test Artifact in the Build Variants view.
9 | */
10 | public class ExampleUnitTest {
11 | @Test
12 | public void addition_isCorrect() throws Exception {
13 | assertEquals(4, 2 + 2);
14 | }
15 | }
--------------------------------------------------------------------------------
/Vpedometer/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/Vpedometer/app/app-release.apk:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hkvincent/vpeodometer/0a31acd9724a141979c7c35d099f5e401c7e77b6/Vpedometer/app/app-release.apk
--------------------------------------------------------------------------------
/Vpedometer/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | useLibrary 'org.apache.http.legacy'
5 | signingConfigs {
6 | config {
7 | keyAlias 'vincent'
8 | keyPassword '*****'
9 | storeFile file('F:/programming/vincent.jks')
10 | storePassword '*****'
11 | }
12 |
13 | }
14 | compileSdkVersion 25
15 | buildToolsVersion "25.0.0"
16 | defaultConfig {
17 | applicationId "com.vincent.vpedometer"
18 | minSdkVersion 21
19 | targetSdkVersion 25
20 | versionCode 4
21 | versionName "1.3"
22 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
23 | }
24 | buildTypes {
25 | release {
26 | minifyEnabled true
27 | zipAlignEnabled true
28 | shrinkResources true
29 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
30 | signingConfig signingConfigs.config
31 | }
32 | }
33 | }
34 |
35 |
36 |
37 | dependencies {
38 | compile fileTree(include: ['*.jar'], dir: 'libs')
39 | androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
40 | exclude group: 'com.android.support', module: 'support-annotations'
41 | })
42 | compile 'com.android.support:appcompat-v7:25.0.0'
43 | compile 'in.srain.cube:ultra-ptr:1.0.11'
44 | compile 'com.squareup.okhttp3:mockwebserver:3.10.0'
45 | compile 'com.google.code.gson:gson:2.8.2'
46 | compile 'com.google.android.gms:play-services-maps:11.4.0'
47 | compile 'com.google.android.gms:play-services-location:11.4.0'
48 | testCompile 'junit:junit:4.12'
49 |
50 | }
51 |
--------------------------------------------------------------------------------
/Vpedometer/app/libs/cocos2d-android.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hkvincent/vpeodometer/0a31acd9724a141979c7c35d099f5e401c7e77b6/Vpedometer/app/libs/cocos2d-android.jar
--------------------------------------------------------------------------------
/Vpedometer/app/libs/hellocharts-library-1.5.8.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hkvincent/vpeodometer/0a31acd9724a141979c7c35d099f5e401c7e77b6/Vpedometer/app/libs/hellocharts-library-1.5.8.jar
--------------------------------------------------------------------------------
/Vpedometer/app/libs/lite-orm-1.7.0.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hkvincent/vpeodometer/0a31acd9724a141979c7c35d099f5e401c7e77b6/Vpedometer/app/libs/lite-orm-1.7.0.jar
--------------------------------------------------------------------------------
/Vpedometer/app/libs/nineoldandroids-2.4.0.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hkvincent/vpeodometer/0a31acd9724a141979c7c35d099f5e401c7e77b6/Vpedometer/app/libs/nineoldandroids-2.4.0.jar
--------------------------------------------------------------------------------
/Vpedometer/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in C:\Users\Administrator.ZGC-20130905TJJ\AppData\Local\Android\Sdk/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 | -keep class com.badlogic.gdx.** { *; }
19 | -keep class org.cocos2d.gdi.**{*;}
20 | -keep class lecho.lib.hellocharts.**{*;}
21 | -keep class com.litesuits.orm.**{*;}
22 | -keep class com.nineoldandroids.**{*;}
23 | -ignorewarnings
24 |
25 | #-libraryjars libs/cocos2d-android.jar
26 | #-libraryjars libs/hellocharts-library-1.5.8.jar
27 | #-libraryjars libs/lite-orm-1.7.0.jar
28 | #-libraryjars libs/nineoldandroids-2.4.0.jar
--------------------------------------------------------------------------------
/Vpedometer/app/src/androidTest/java/com/vincent/vpedometer/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package com.vincent.vpedometer;
2 |
3 | import android.content.Context;
4 | import android.support.test.InstrumentationRegistry;
5 | import android.support.test.runner.AndroidJUnit4;
6 |
7 | import org.junit.Test;
8 | import org.junit.runner.RunWith;
9 |
10 | import static org.junit.Assert.*;
11 |
12 | /**
13 | * Instrumentation test, which will execute on an Android device.
14 | *
15 | * @see Testing documentation
16 | */
17 | @RunWith(AndroidJUnit4.class)
18 | public class ExampleInstrumentedTest {
19 | @Test
20 | public void useAppContext() throws Exception {
21 | // Context of the app under test.
22 | Context appContext = InstrumentationRegistry.getTargetContext();
23 |
24 | assertEquals("com.vincent.vpedometer", appContext.getPackageName());
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/Vpedometer/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
27 |
28 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
45 |
46 |
47 |
50 |
51 |
55 |
56 |
57 |
58 |
59 |
60 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
--------------------------------------------------------------------------------
/Vpedometer/app/src/main/assets/fight/FinalWave.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hkvincent/vpeodometer/0a31acd9724a141979c7c35d099f5e401c7e77b6/Vpedometer/app/src/main/assets/fight/FinalWave.png
--------------------------------------------------------------------------------
/Vpedometer/app/src/main/assets/fight/FlagMeterLevelProgress.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hkvincent/vpeodometer/0a31acd9724a141979c7c35d099f5e401c7e77b6/Vpedometer/app/src/main/assets/fight/FlagMeterLevelProgress.png
--------------------------------------------------------------------------------
/Vpedometer/app/src/main/assets/fight/StartPlant.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hkvincent/vpeodometer/0a31acd9724a141979c7c35d099f5e401c7e77b6/Vpedometer/app/src/main/assets/fight/StartPlant.png
--------------------------------------------------------------------------------
/Vpedometer/app/src/main/assets/fight/StartReady.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hkvincent/vpeodometer/0a31acd9724a141979c7c35d099f5e401c7e77b6/Vpedometer/app/src/main/assets/fight/StartReady.png
--------------------------------------------------------------------------------
/Vpedometer/app/src/main/assets/fight/StartSet.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hkvincent/vpeodometer/0a31acd9724a141979c7c35d099f5e401c7e77b6/Vpedometer/app/src/main/assets/fight/StartSet.png
--------------------------------------------------------------------------------
/Vpedometer/app/src/main/assets/fight/Thumbs.db:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hkvincent/vpeodometer/0a31acd9724a141979c7c35d099f5e401c7e77b6/Vpedometer/app/src/main/assets/fight/Thumbs.db
--------------------------------------------------------------------------------
/Vpedometer/app/src/main/assets/fight/ZombiesWon.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hkvincent/vpeodometer/0a31acd9724a141979c7c35d099f5e401c7e77b6/Vpedometer/app/src/main/assets/fight/ZombiesWon.jpg
--------------------------------------------------------------------------------
/Vpedometer/app/src/main/assets/fight/bk1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hkvincent/vpeodometer/0a31acd9724a141979c7c35d099f5e401c7e77b6/Vpedometer/app/src/main/assets/fight/bk1.jpg
--------------------------------------------------------------------------------
/Vpedometer/app/src/main/assets/fight/bullet.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hkvincent/vpeodometer/0a31acd9724a141979c7c35d099f5e401c7e77b6/Vpedometer/app/src/main/assets/fight/bullet.png
--------------------------------------------------------------------------------
/Vpedometer/app/src/main/assets/fight/chose/choose_default01.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hkvincent/vpeodometer/0a31acd9724a141979c7c35d099f5e401c7e77b6/Vpedometer/app/src/main/assets/fight/chose/choose_default01.png
--------------------------------------------------------------------------------
/Vpedometer/app/src/main/assets/fight/chose/choose_default02.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hkvincent/vpeodometer/0a31acd9724a141979c7c35d099f5e401c7e77b6/Vpedometer/app/src/main/assets/fight/chose/choose_default02.png
--------------------------------------------------------------------------------
/Vpedometer/app/src/main/assets/fight/chose/choose_default03.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hkvincent/vpeodometer/0a31acd9724a141979c7c35d099f5e401c7e77b6/Vpedometer/app/src/main/assets/fight/chose/choose_default03.png
--------------------------------------------------------------------------------
/Vpedometer/app/src/main/assets/fight/chose/choose_default04.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hkvincent/vpeodometer/0a31acd9724a141979c7c35d099f5e401c7e77b6/Vpedometer/app/src/main/assets/fight/chose/choose_default04.png
--------------------------------------------------------------------------------
/Vpedometer/app/src/main/assets/fight/chose/choose_default05.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hkvincent/vpeodometer/0a31acd9724a141979c7c35d099f5e401c7e77b6/Vpedometer/app/src/main/assets/fight/chose/choose_default05.png
--------------------------------------------------------------------------------
/Vpedometer/app/src/main/assets/fight/chose/choose_default06.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hkvincent/vpeodometer/0a31acd9724a141979c7c35d099f5e401c7e77b6/Vpedometer/app/src/main/assets/fight/chose/choose_default06.png
--------------------------------------------------------------------------------
/Vpedometer/app/src/main/assets/fight/chose/choose_default07.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hkvincent/vpeodometer/0a31acd9724a141979c7c35d099f5e401c7e77b6/Vpedometer/app/src/main/assets/fight/chose/choose_default07.png
--------------------------------------------------------------------------------
/Vpedometer/app/src/main/assets/fight/chose/choose_default08.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hkvincent/vpeodometer/0a31acd9724a141979c7c35d099f5e401c7e77b6/Vpedometer/app/src/main/assets/fight/chose/choose_default08.png
--------------------------------------------------------------------------------
/Vpedometer/app/src/main/assets/fight/chose/choose_default09.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hkvincent/vpeodometer/0a31acd9724a141979c7c35d099f5e401c7e77b6/Vpedometer/app/src/main/assets/fight/chose/choose_default09.png
--------------------------------------------------------------------------------
/Vpedometer/app/src/main/assets/fight/chose/chose_01.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hkvincent/vpeodometer/0a31acd9724a141979c7c35d099f5e401c7e77b6/Vpedometer/app/src/main/assets/fight/chose/chose_01.png
--------------------------------------------------------------------------------
/Vpedometer/app/src/main/assets/fight/chose/fight_choose.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hkvincent/vpeodometer/0a31acd9724a141979c7c35d099f5e401c7e77b6/Vpedometer/app/src/main/assets/fight/chose/fight_choose.png
--------------------------------------------------------------------------------
/Vpedometer/app/src/main/assets/fight/chose/fight_chose.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hkvincent/vpeodometer/0a31acd9724a141979c7c35d099f5e401c7e77b6/Vpedometer/app/src/main/assets/fight/chose/fight_chose.png
--------------------------------------------------------------------------------
/Vpedometer/app/src/main/assets/fight/chose/fight_start.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hkvincent/vpeodometer/0a31acd9724a141979c7c35d099f5e401c7e77b6/Vpedometer/app/src/main/assets/fight/chose/fight_start.png
--------------------------------------------------------------------------------
/Vpedometer/app/src/main/assets/fight/flagmeter.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hkvincent/vpeodometer/0a31acd9724a141979c7c35d099f5e401c7e77b6/Vpedometer/app/src/main/assets/fight/flagmeter.png
--------------------------------------------------------------------------------
/Vpedometer/app/src/main/assets/fight/map_day.tmx:
--------------------------------------------------------------------------------
1 |
2 |
95 |
--------------------------------------------------------------------------------
/Vpedometer/app/src/main/assets/fight/progress.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hkvincent/vpeodometer/0a31acd9724a141979c7c35d099f5e401c7e77b6/Vpedometer/app/src/main/assets/fight/progress.png
--------------------------------------------------------------------------------
/Vpedometer/app/src/main/assets/fight/ready_01.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hkvincent/vpeodometer/0a31acd9724a141979c7c35d099f5e401c7e77b6/Vpedometer/app/src/main/assets/fight/ready_01.png
--------------------------------------------------------------------------------
/Vpedometer/app/src/main/assets/fight/ready_02.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hkvincent/vpeodometer/0a31acd9724a141979c7c35d099f5e401c7e77b6/Vpedometer/app/src/main/assets/fight/ready_02.png
--------------------------------------------------------------------------------
/Vpedometer/app/src/main/assets/fight/ready_03.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hkvincent/vpeodometer/0a31acd9724a141979c7c35d099f5e401c7e77b6/Vpedometer/app/src/main/assets/fight/ready_03.png
--------------------------------------------------------------------------------
/Vpedometer/app/src/main/assets/fight/startready_01.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hkvincent/vpeodometer/0a31acd9724a141979c7c35d099f5e401c7e77b6/Vpedometer/app/src/main/assets/fight/startready_01.png
--------------------------------------------------------------------------------
/Vpedometer/app/src/main/assets/fight/startready_02.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hkvincent/vpeodometer/0a31acd9724a141979c7c35d099f5e401c7e77b6/Vpedometer/app/src/main/assets/fight/startready_02.png
--------------------------------------------------------------------------------
/Vpedometer/app/src/main/assets/fight/startready_03.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hkvincent/vpeodometer/0a31acd9724a141979c7c35d099f5e401c7e77b6/Vpedometer/app/src/main/assets/fight/startready_03.png
--------------------------------------------------------------------------------
/Vpedometer/app/src/main/assets/fight/zombhead.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hkvincent/vpeodometer/0a31acd9724a141979c7c35d099f5e401c7e77b6/Vpedometer/app/src/main/assets/fight/zombhead.png
--------------------------------------------------------------------------------
/Vpedometer/app/src/main/assets/fps_images.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hkvincent/vpeodometer/0a31acd9724a141979c7c35d099f5e401c7e77b6/Vpedometer/app/src/main/assets/fps_images.png
--------------------------------------------------------------------------------
/Vpedometer/app/src/main/assets/map/132807580832.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hkvincent/vpeodometer/0a31acd9724a141979c7c35d099f5e401c7e77b6/Vpedometer/app/src/main/assets/map/132807580832.jpg
--------------------------------------------------------------------------------
/Vpedometer/app/src/main/assets/map/fullmap.tmx:
--------------------------------------------------------------------------------
1 |
2 |
16 |
--------------------------------------------------------------------------------
/Vpedometer/app/src/main/assets/map/map.tmx:
--------------------------------------------------------------------------------
1 |
2 |
16 |
--------------------------------------------------------------------------------
/Vpedometer/app/src/main/assets/zombies/attack/z_1_attack_01.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hkvincent/vpeodometer/0a31acd9724a141979c7c35d099f5e401c7e77b6/Vpedometer/app/src/main/assets/zombies/attack/z_1_attack_01.png
--------------------------------------------------------------------------------
/Vpedometer/app/src/main/assets/zombies/attack/z_1_attack_02.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hkvincent/vpeodometer/0a31acd9724a141979c7c35d099f5e401c7e77b6/Vpedometer/app/src/main/assets/zombies/attack/z_1_attack_02.png
--------------------------------------------------------------------------------
/Vpedometer/app/src/main/assets/zombies/attack/z_1_attack_03.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hkvincent/vpeodometer/0a31acd9724a141979c7c35d099f5e401c7e77b6/Vpedometer/app/src/main/assets/zombies/attack/z_1_attack_03.png
--------------------------------------------------------------------------------
/Vpedometer/app/src/main/assets/zombies/attack/z_1_attack_04.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hkvincent/vpeodometer/0a31acd9724a141979c7c35d099f5e401c7e77b6/Vpedometer/app/src/main/assets/zombies/attack/z_1_attack_04.png
--------------------------------------------------------------------------------
/Vpedometer/app/src/main/assets/zombies/attack/z_1_attack_05.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hkvincent/vpeodometer/0a31acd9724a141979c7c35d099f5e401c7e77b6/Vpedometer/app/src/main/assets/zombies/attack/z_1_attack_05.png
--------------------------------------------------------------------------------
/Vpedometer/app/src/main/assets/zombies/attack/z_1_attack_06.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hkvincent/vpeodometer/0a31acd9724a141979c7c35d099f5e401c7e77b6/Vpedometer/app/src/main/assets/zombies/attack/z_1_attack_06.png
--------------------------------------------------------------------------------
/Vpedometer/app/src/main/assets/zombies/attack/z_1_attack_07.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hkvincent/vpeodometer/0a31acd9724a141979c7c35d099f5e401c7e77b6/Vpedometer/app/src/main/assets/zombies/attack/z_1_attack_07.png
--------------------------------------------------------------------------------
/Vpedometer/app/src/main/assets/zombies/attack/z_1_attack_08.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hkvincent/vpeodometer/0a31acd9724a141979c7c35d099f5e401c7e77b6/Vpedometer/app/src/main/assets/zombies/attack/z_1_attack_08.png
--------------------------------------------------------------------------------
/Vpedometer/app/src/main/assets/zombies/attack/z_1_attack_09.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hkvincent/vpeodometer/0a31acd9724a141979c7c35d099f5e401c7e77b6/Vpedometer/app/src/main/assets/zombies/attack/z_1_attack_09.png
--------------------------------------------------------------------------------
/Vpedometer/app/src/main/assets/zombies/attack/z_1_attack_10.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hkvincent/vpeodometer/0a31acd9724a141979c7c35d099f5e401c7e77b6/Vpedometer/app/src/main/assets/zombies/attack/z_1_attack_10.png
--------------------------------------------------------------------------------
/Vpedometer/app/src/main/assets/zombies/attack_losthead/z_1_attack_losthead_01.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hkvincent/vpeodometer/0a31acd9724a141979c7c35d099f5e401c7e77b6/Vpedometer/app/src/main/assets/zombies/attack_losthead/z_1_attack_losthead_01.png
--------------------------------------------------------------------------------
/Vpedometer/app/src/main/assets/zombies/attack_losthead/z_1_attack_losthead_02.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hkvincent/vpeodometer/0a31acd9724a141979c7c35d099f5e401c7e77b6/Vpedometer/app/src/main/assets/zombies/attack_losthead/z_1_attack_losthead_02.png
--------------------------------------------------------------------------------
/Vpedometer/app/src/main/assets/zombies/attack_losthead/z_1_attack_losthead_03.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hkvincent/vpeodometer/0a31acd9724a141979c7c35d099f5e401c7e77b6/Vpedometer/app/src/main/assets/zombies/attack_losthead/z_1_attack_losthead_03.png
--------------------------------------------------------------------------------
/Vpedometer/app/src/main/assets/zombies/attack_losthead/z_1_attack_losthead_04.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hkvincent/vpeodometer/0a31acd9724a141979c7c35d099f5e401c7e77b6/Vpedometer/app/src/main/assets/zombies/attack_losthead/z_1_attack_losthead_04.png
--------------------------------------------------------------------------------
/Vpedometer/app/src/main/assets/zombies/attack_losthead/z_1_attack_losthead_05.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hkvincent/vpeodometer/0a31acd9724a141979c7c35d099f5e401c7e77b6/Vpedometer/app/src/main/assets/zombies/attack_losthead/z_1_attack_losthead_05.png
--------------------------------------------------------------------------------
/Vpedometer/app/src/main/assets/zombies/attack_losthead/z_1_attack_losthead_06.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hkvincent/vpeodometer/0a31acd9724a141979c7c35d099f5e401c7e77b6/Vpedometer/app/src/main/assets/zombies/attack_losthead/z_1_attack_losthead_06.png
--------------------------------------------------------------------------------
/Vpedometer/app/src/main/assets/zombies/attack_losthead/z_1_attack_losthead_07.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hkvincent/vpeodometer/0a31acd9724a141979c7c35d099f5e401c7e77b6/Vpedometer/app/src/main/assets/zombies/attack_losthead/z_1_attack_losthead_07.png
--------------------------------------------------------------------------------
/Vpedometer/app/src/main/assets/zombies/attack_losthead/z_1_attack_losthead_08.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hkvincent/vpeodometer/0a31acd9724a141979c7c35d099f5e401c7e77b6/Vpedometer/app/src/main/assets/zombies/attack_losthead/z_1_attack_losthead_08.png
--------------------------------------------------------------------------------
/Vpedometer/app/src/main/assets/zombies/die/z_1_die_01.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hkvincent/vpeodometer/0a31acd9724a141979c7c35d099f5e401c7e77b6/Vpedometer/app/src/main/assets/zombies/die/z_1_die_01.png
--------------------------------------------------------------------------------
/Vpedometer/app/src/main/assets/zombies/die/z_1_die_02.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hkvincent/vpeodometer/0a31acd9724a141979c7c35d099f5e401c7e77b6/Vpedometer/app/src/main/assets/zombies/die/z_1_die_02.png
--------------------------------------------------------------------------------
/Vpedometer/app/src/main/assets/zombies/die/z_1_die_03.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hkvincent/vpeodometer/0a31acd9724a141979c7c35d099f5e401c7e77b6/Vpedometer/app/src/main/assets/zombies/die/z_1_die_03.png
--------------------------------------------------------------------------------
/Vpedometer/app/src/main/assets/zombies/die/z_1_die_04.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hkvincent/vpeodometer/0a31acd9724a141979c7c35d099f5e401c7e77b6/Vpedometer/app/src/main/assets/zombies/die/z_1_die_04.png
--------------------------------------------------------------------------------
/Vpedometer/app/src/main/assets/zombies/die/z_1_die_05.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hkvincent/vpeodometer/0a31acd9724a141979c7c35d099f5e401c7e77b6/Vpedometer/app/src/main/assets/zombies/die/z_1_die_05.png
--------------------------------------------------------------------------------
/Vpedometer/app/src/main/assets/zombies/die/z_1_die_06.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hkvincent/vpeodometer/0a31acd9724a141979c7c35d099f5e401c7e77b6/Vpedometer/app/src/main/assets/zombies/die/z_1_die_06.png
--------------------------------------------------------------------------------
/Vpedometer/app/src/main/assets/zombies/head/z_1_head_01.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hkvincent/vpeodometer/0a31acd9724a141979c7c35d099f5e401c7e77b6/Vpedometer/app/src/main/assets/zombies/head/z_1_head_01.png
--------------------------------------------------------------------------------
/Vpedometer/app/src/main/assets/zombies/head/z_1_head_02.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hkvincent/vpeodometer/0a31acd9724a141979c7c35d099f5e401c7e77b6/Vpedometer/app/src/main/assets/zombies/head/z_1_head_02.png
--------------------------------------------------------------------------------
/Vpedometer/app/src/main/assets/zombies/head/z_1_head_03.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hkvincent/vpeodometer/0a31acd9724a141979c7c35d099f5e401c7e77b6/Vpedometer/app/src/main/assets/zombies/head/z_1_head_03.png
--------------------------------------------------------------------------------
/Vpedometer/app/src/main/assets/zombies/head/z_1_head_04.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hkvincent/vpeodometer/0a31acd9724a141979c7c35d099f5e401c7e77b6/Vpedometer/app/src/main/assets/zombies/head/z_1_head_04.png
--------------------------------------------------------------------------------
/Vpedometer/app/src/main/assets/zombies/head/z_1_head_05.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hkvincent/vpeodometer/0a31acd9724a141979c7c35d099f5e401c7e77b6/Vpedometer/app/src/main/assets/zombies/head/z_1_head_05.png
--------------------------------------------------------------------------------
/Vpedometer/app/src/main/assets/zombies/head/z_1_head_06.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hkvincent/vpeodometer/0a31acd9724a141979c7c35d099f5e401c7e77b6/Vpedometer/app/src/main/assets/zombies/head/z_1_head_06.png
--------------------------------------------------------------------------------
/Vpedometer/app/src/main/assets/zombies/shake/z_1_01.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hkvincent/vpeodometer/0a31acd9724a141979c7c35d099f5e401c7e77b6/Vpedometer/app/src/main/assets/zombies/shake/z_1_01.png
--------------------------------------------------------------------------------
/Vpedometer/app/src/main/assets/zombies/shake/z_1_02.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hkvincent/vpeodometer/0a31acd9724a141979c7c35d099f5e401c7e77b6/Vpedometer/app/src/main/assets/zombies/shake/z_1_02.png
--------------------------------------------------------------------------------
/Vpedometer/app/src/main/assets/zombies/walk/z_1_01.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hkvincent/vpeodometer/0a31acd9724a141979c7c35d099f5e401c7e77b6/Vpedometer/app/src/main/assets/zombies/walk/z_1_01.png
--------------------------------------------------------------------------------
/Vpedometer/app/src/main/assets/zombies/walk/z_1_02.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hkvincent/vpeodometer/0a31acd9724a141979c7c35d099f5e401c7e77b6/Vpedometer/app/src/main/assets/zombies/walk/z_1_02.png
--------------------------------------------------------------------------------
/Vpedometer/app/src/main/assets/zombies/walk/z_1_03.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hkvincent/vpeodometer/0a31acd9724a141979c7c35d099f5e401c7e77b6/Vpedometer/app/src/main/assets/zombies/walk/z_1_03.png
--------------------------------------------------------------------------------
/Vpedometer/app/src/main/assets/zombies/walk/z_1_04.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hkvincent/vpeodometer/0a31acd9724a141979c7c35d099f5e401c7e77b6/Vpedometer/app/src/main/assets/zombies/walk/z_1_04.png
--------------------------------------------------------------------------------
/Vpedometer/app/src/main/assets/zombies/walk/z_1_05.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hkvincent/vpeodometer/0a31acd9724a141979c7c35d099f5e401c7e77b6/Vpedometer/app/src/main/assets/zombies/walk/z_1_05.png
--------------------------------------------------------------------------------
/Vpedometer/app/src/main/assets/zombies/walk/z_1_06.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hkvincent/vpeodometer/0a31acd9724a141979c7c35d099f5e401c7e77b6/Vpedometer/app/src/main/assets/zombies/walk/z_1_06.png
--------------------------------------------------------------------------------
/Vpedometer/app/src/main/assets/zombies/walk/z_1_07.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hkvincent/vpeodometer/0a31acd9724a141979c7c35d099f5e401c7e77b6/Vpedometer/app/src/main/assets/zombies/walk/z_1_07.png
--------------------------------------------------------------------------------
/Vpedometer/app/src/main/assets/zombies/work_losthead/z_1_losthead_01.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hkvincent/vpeodometer/0a31acd9724a141979c7c35d099f5e401c7e77b6/Vpedometer/app/src/main/assets/zombies/work_losthead/z_1_losthead_01.png
--------------------------------------------------------------------------------
/Vpedometer/app/src/main/assets/zombies/work_losthead/z_1_losthead_02.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hkvincent/vpeodometer/0a31acd9724a141979c7c35d099f5e401c7e77b6/Vpedometer/app/src/main/assets/zombies/work_losthead/z_1_losthead_02.png
--------------------------------------------------------------------------------
/Vpedometer/app/src/main/assets/zombies/work_losthead/z_1_losthead_03.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hkvincent/vpeodometer/0a31acd9724a141979c7c35d099f5e401c7e77b6/Vpedometer/app/src/main/assets/zombies/work_losthead/z_1_losthead_03.png
--------------------------------------------------------------------------------
/Vpedometer/app/src/main/assets/zombies/work_losthead/z_1_losthead_04.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hkvincent/vpeodometer/0a31acd9724a141979c7c35d099f5e401c7e77b6/Vpedometer/app/src/main/assets/zombies/work_losthead/z_1_losthead_04.png
--------------------------------------------------------------------------------
/Vpedometer/app/src/main/assets/zombies/work_losthead/z_1_losthead_05.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hkvincent/vpeodometer/0a31acd9724a141979c7c35d099f5e401c7e77b6/Vpedometer/app/src/main/assets/zombies/work_losthead/z_1_losthead_05.png
--------------------------------------------------------------------------------
/Vpedometer/app/src/main/assets/zombies/work_losthead/z_1_losthead_06.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hkvincent/vpeodometer/0a31acd9724a141979c7c35d099f5e401c7e77b6/Vpedometer/app/src/main/assets/zombies/work_losthead/z_1_losthead_06.png
--------------------------------------------------------------------------------
/Vpedometer/app/src/main/assets/zombies/work_losthead/z_1_losthead_07.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hkvincent/vpeodometer/0a31acd9724a141979c7c35d099f5e401c7e77b6/Vpedometer/app/src/main/assets/zombies/work_losthead/z_1_losthead_07.png
--------------------------------------------------------------------------------
/Vpedometer/app/src/main/assets/zombies/work_losthead/z_1_losthead_08.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hkvincent/vpeodometer/0a31acd9724a141979c7c35d099f5e401c7e77b6/Vpedometer/app/src/main/assets/zombies/work_losthead/z_1_losthead_08.png
--------------------------------------------------------------------------------
/Vpedometer/app/src/main/assets/zombies/work_losthead/z_1_losthead_09.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hkvincent/vpeodometer/0a31acd9724a141979c7c35d099f5e401c7e77b6/Vpedometer/app/src/main/assets/zombies/work_losthead/z_1_losthead_09.png
--------------------------------------------------------------------------------
/Vpedometer/app/src/main/java/com/vincent/vpedometer/base/StepMode.java:
--------------------------------------------------------------------------------
1 | package com.vincent.vpedometer.base;
2 |
3 | import android.content.Context;
4 | import android.hardware.SensorEventListener;
5 | import android.hardware.SensorManager;
6 |
7 | /**
8 | * Created by Administrator on 2018/2/8.
9 | * two mode ,first mode is using acceleration to calculate step
10 | * the second mode is using google step count sensor
11 | */
12 |
13 | public abstract class StepMode implements SensorEventListener {
14 |
15 | public interface StepCallBack {
16 | void Step(int stepNum);
17 | }
18 |
19 | private Context context; // the object has necessary information we need
20 | public StepCallBack stepCallBack;
21 | public SensorManager sensorManager;
22 | public static int CURRENT_STEP = 0;
23 | public boolean isAvailable = false;
24 |
25 | public StepMode(Context context, StepCallBack stepCallBack) {
26 | this.context = context;
27 | this.stepCallBack = stepCallBack;
28 | }
29 |
30 | public boolean getStep() {
31 | prepareSensorManager();
32 | registerSensor();
33 | return isAvailable;
34 | }
35 |
36 | protected abstract void registerSensor();
37 |
38 | private void prepareSensorManager() {
39 | if (sensorManager != null) {
40 | sensorManager.unregisterListener(this);
41 | sensorManager = null;
42 | }
43 | sensorManager = (SensorManager) context
44 | .getSystemService(Context.SENSOR_SERVICE);
45 | // getLock(this);
46 | // int VERSION_CODES = android.os.Build.VERSION.SDK_INT;
47 | // if (VERSION_CODES >= 19) {
48 | // addCountStepListener();
49 | // } else {
50 | // addBasePedoListener();
51 | // }
52 |
53 | }
54 |
55 | }
56 |
--------------------------------------------------------------------------------
/Vpedometer/app/src/main/java/com/vincent/vpedometer/config/MyConstants.java:
--------------------------------------------------------------------------------
1 | package com.vincent.vpedometer.config;
2 |
3 | /**
4 | * Created by Administrator on 2018/1/23.
5 | */
6 |
7 | public interface MyConstants {
8 |
9 | public String CONFIGFILE = "cachevalue";
10 | String ISSETUP = "issetup";
11 | public static final int MSG_FROM_CLIENT = 0;
12 | public static final int MSG_FROM_SERVER = 1;
13 | public static final int REQUEST_SERVER = 2;
14 | public static final int CHANGE_PASSWORD = 4;
15 | public static final int TEST_DATABASE = 3;
16 | public static final String IP = "http://47.74.150.98:8080";
17 | //public static final String IP = "http://192.168.0.102:8080";
18 |
19 |
20 | public static final String[] sCheeseStrings = {
21 | "gamelist", "home", "setting", "logout"
22 | };
23 |
24 |
25 |
26 | }
27 |
--------------------------------------------------------------------------------
/Vpedometer/app/src/main/java/com/vincent/vpedometer/dao/MyDBOpenHelper.java:
--------------------------------------------------------------------------------
1 | package com.vincent.vpedometer.dao;
2 |
3 | import android.content.Context;
4 | import android.database.sqlite.SQLiteDatabase;
5 | import android.database.sqlite.SQLiteOpenHelper;
6 |
7 |
8 | /**
9 | * Created by Administrator on 2018/2/11 19:15
10 | */
11 | public class MyDBOpenHelper extends SQLiteOpenHelper {
12 |
13 |
14 | public MyDBOpenHelper(Context context, String dbname, int version) {
15 | super(context, dbname, null, 1);
16 | }
17 |
18 | @Override
19 | public void onCreate(SQLiteDatabase db) {
20 | db.execSQL("create table shutdown (id integer primary key autoincrement, date char(30), steps int);");
21 | }
22 |
23 | @Override
24 | public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
25 |
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/Vpedometer/app/src/main/java/com/vincent/vpedometer/dao/ShutDownDao.java:
--------------------------------------------------------------------------------
1 | package com.vincent.vpedometer.dao;
2 |
3 | import android.content.Context;
4 | import android.database.Cursor;
5 | import android.database.sqlite.SQLiteDatabase;
6 |
7 | import com.vincent.vpedometer.pojo.ShutDown;
8 |
9 | import java.util.ArrayList;
10 | import java.util.List;
11 |
12 | /**
13 | * Created by Administrator on 2018/2/11 19:21
14 | * when user shut down their phone ,the shutDOWNDAO tools will be invoked to record the steps
15 | */
16 | public class ShutDownDao {
17 | private final MyDBOpenHelper helper;
18 | private final String DBNAME = "shutdown";
19 |
20 | public ShutDownDao(Context context) {
21 | MyDBOpenHelper myDBOpenHelper = new MyDBOpenHelper(context, DBNAME, 1);
22 | this.helper = myDBOpenHelper;
23 | }
24 |
25 | public void add(String date, int totalStep) {
26 | SQLiteDatabase db = helper.getWritableDatabase();
27 | db.execSQL("insert into " + DBNAME + " (date, steps) values (?, ?);", new Object[]{date, totalStep});
28 | db.close();
29 | }
30 |
31 | public void delete(String date) {
32 | SQLiteDatabase db = helper.getWritableDatabase();
33 | db.execSQL("delete from " + DBNAME + " where date=? ", new Object[]{date});
34 | db.close();
35 | }
36 |
37 | public void update(int id, String date, int step) {
38 | SQLiteDatabase db = helper.getWritableDatabase();
39 | db.execSQL("update " + DBNAME + " set date=? , steps = ? where id = ? ", new Object[]{date, step, id});
40 | db.close();
41 | }
42 |
43 | public List query() {
44 | SQLiteDatabase db = helper.getReadableDatabase();
45 | Cursor cursor = db.rawQuery("select * from " + DBNAME, null);
46 | List Lists = new ArrayList();
47 | while (cursor.moveToNext()) {
48 | ShutDown shutDown = new ShutDown();
49 | shutDown.setId(cursor.getInt(0));
50 | shutDown.setShutDownDate(cursor.getString(1));
51 | shutDown.setTotalSteps(cursor.getInt(2));
52 | Lists.add(shutDown);
53 | }
54 | cursor.close();
55 | db.close();
56 | return Lists;
57 |
58 | }
59 |
60 | }
61 |
62 |
--------------------------------------------------------------------------------
/Vpedometer/app/src/main/java/com/vincent/vpedometer/pojo/BaseElement.java:
--------------------------------------------------------------------------------
1 | package com.vincent.vpedometer.pojo;
2 |
3 | import org.cocos2d.nodes.CCSprite;
4 |
5 | /**
6 | * Created by Administrator on 2018/1/28.
7 | */
8 |
9 | public abstract class BaseElement extends CCSprite {
10 |
11 | public interface DieListener {
12 | void die();
13 | }
14 |
15 | private DieListener dieListener; // dying listener
16 |
17 | public void setDieListener(DieListener dieListener) {
18 | this.dieListener = dieListener;
19 | }
20 |
21 | public BaseElement(String filepath) {
22 | super(filepath);
23 | }
24 |
25 | /**
26 | * the base action of sprite
27 | */
28 | public abstract void baseAction();
29 |
30 | public void destroy() {
31 | if (dieListener != null) {
32 | dieListener.die();
33 | }
34 | removeSelf();
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/Vpedometer/app/src/main/java/com/vincent/vpedometer/pojo/ChartData.java:
--------------------------------------------------------------------------------
1 | package com.vincent.vpedometer.pojo;
2 |
3 | import java.io.Serializable;
4 | import java.util.ArrayList;
5 |
6 | /**
7 | * Created by Administrator on 2018/2/13 19:03
8 | */
9 | public class ChartData implements Serializable {
10 |
11 | private ArrayList timeData = new ArrayList<>();
12 | private ArrayList stepData = new ArrayList<>();
13 |
14 | public ArrayList getTimeData() {
15 | return timeData;
16 | }
17 |
18 | public void setTimeData(ArrayList timeData) {
19 | this.timeData = timeData;
20 | }
21 |
22 | public ArrayList getStepData() {
23 | return stepData;
24 | }
25 |
26 | public void setStepData(ArrayList stepData) {
27 | this.stepData = stepData;
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/Vpedometer/app/src/main/java/com/vincent/vpedometer/pojo/Fighter.java:
--------------------------------------------------------------------------------
1 | package com.vincent.vpedometer.pojo;
2 |
3 | import org.cocos2d.types.CGPoint;
4 |
5 | /**
6 | * Created by Administrator on 2018/1/28.
7 | * all fighter super class
8 | */
9 |
10 | public abstract class Fighter extends BaseElement {
11 |
12 | protected int life = 200;// HP
13 | protected int attack = 30;// attack
14 | protected int speed = 50;// MOVE SPEED
15 | int MagicPoint = 30;
16 | int defened = 20;
17 |
18 | protected CGPoint startPoint;
19 | protected CGPoint endPoint;
20 |
21 | @Override
22 | public abstract void baseAction();
23 |
24 | public Fighter(String filepath) {
25 | super(filepath);
26 | setAnchorPoint(0.5f, 0);
27 | }
28 |
29 | public Fighter(String filepath, int life, int attack, int speed, int magicPoint, int defened) {
30 | super(filepath);
31 | setAnchorPoint(0.5f, 0);
32 | this.life = life;
33 | this.attack = attack;
34 | this.speed = speed;
35 | this.MagicPoint = magicPoint;
36 | }
37 |
38 | protected boolean isAttacking;
39 |
40 | public boolean isAttacking() {
41 | return isAttacking;
42 | }
43 |
44 | public void setAttacking(boolean isAttacking) {
45 | this.isAttacking = isAttacking;
46 | }
47 |
48 |
49 | public abstract void move();
50 |
51 |
52 | public abstract void attack(BaseElement element);
53 |
54 |
55 | public abstract void attacked(int attack);
56 |
57 | public abstract void winJump();
58 | }
59 |
--------------------------------------------------------------------------------
/Vpedometer/app/src/main/java/com/vincent/vpedometer/pojo/GameCharecter.java:
--------------------------------------------------------------------------------
1 | package com.vincent.vpedometer.pojo;
2 |
3 | /**
4 | * Created by Administrator on 2018/2/28 21:09
5 | */
6 | public class GameCharecter {
7 | String rid;
8 | String name;
9 | int level;
10 |
11 | int attack;
12 | int defend;
13 | int health_point;
14 |
15 | int magic_point;
16 |
17 | int skill;
18 | String userUid;
19 |
20 |
21 | public String getRid() {
22 | return rid;
23 | }
24 |
25 | public void setRid(String rid) {
26 | this.rid = rid;
27 | }
28 |
29 | public String getName() {
30 | return name;
31 | }
32 |
33 | public void setName(String name) {
34 | this.name = name;
35 | }
36 |
37 | public int getLevel() {
38 | return level;
39 | }
40 |
41 | public void setLevel(int level) {
42 | this.level = level;
43 | }
44 |
45 | public int getAttack() {
46 | return attack;
47 | }
48 |
49 | public void setAttack(int attack) {
50 | this.attack = attack;
51 | }
52 |
53 | public int getDefend() {
54 | return defend;
55 | }
56 |
57 | public void setDefend(int defend) {
58 | this.defend = defend;
59 | }
60 |
61 | public int getHealthPoint() {
62 | return health_point;
63 | }
64 |
65 | public void setHealthPoint(int healthPoint) {
66 | this.health_point = healthPoint;
67 | }
68 |
69 | public int getMagicPoint() {
70 | return magic_point;
71 | }
72 |
73 | public void setMagicPoint(int magicPoint) {
74 | this.magic_point = magicPoint;
75 | }
76 |
77 | public int getSkill() {
78 | return skill;
79 | }
80 |
81 | public void setSkill(int skill) {
82 | this.skill = skill;
83 | }
84 |
85 | public String getUserUid() {
86 | return userUid;
87 | }
88 |
89 | public void setUserUid(String userId) {
90 | this.userUid = userId;
91 | }
92 |
93 |
94 | public int getHealth_point() {
95 | return health_point;
96 | }
97 |
98 | public void setHealth_point(int healthPoint) {
99 | this.health_point = healthPoint;
100 | }
101 |
102 | public int getMagic_point() {
103 | return magic_point;
104 | }
105 |
106 | public void setMagic_point(int magicPoint) {
107 | this.magic_point = magicPoint;
108 | }
109 |
110 | }
111 |
112 |
113 |
114 |
115 |
--------------------------------------------------------------------------------
/Vpedometer/app/src/main/java/com/vincent/vpedometer/pojo/RemoteSkill.java:
--------------------------------------------------------------------------------
1 | package com.vincent.vpedometer.pojo;
2 |
3 | import org.cocos2d.actions.instant.CCCallFunc;
4 | import org.cocos2d.actions.interval.CCMoveTo;
5 | import org.cocos2d.actions.interval.CCSequence;
6 | import org.cocos2d.nodes.CCDirector;
7 |
8 | /**
9 | * Created by Administrator on 2018/1/29.
10 | * the remote skill
11 | */
12 |
13 | public class RemoteSkill extends Skill {
14 |
15 |
16 | public RemoteSkill() {
17 | super("fight/bullet.png");
18 | setScale(2);
19 | this.isRemoteSkill = true;
20 | }
21 |
22 | public RemoteSkill(String filepath) {
23 | super(filepath);
24 | }
25 |
26 | /**
27 | * move the image from where to where
28 | */
29 | @Override
30 | public void move() {
31 | System.out.println("remote skill release");
32 | //how fast the skill move
33 | float t = (CCDirector.sharedDirector().winSize().width - getPosition().x)
34 | / speed;
35 | System.out.println("time :" + t);
36 | System.out.println("end point:" + CCDirector.sharedDirector().winSize().width + "----" + getPosition().y);
37 | //the skill move to right end of the screen
38 | CCMoveTo move = CCMoveTo.action(t, ccp(CCDirector.sharedDirector().winSize().width,
39 | getPosition().y));
40 | //call the destroy method to destory skill
41 | CCSequence sequence = CCSequence.actions(move, CCCallFunc.action(this, "destroy"));
42 | runAction(sequence);
43 |
44 | }
45 |
46 | @Override
47 | public void baseAction() {
48 |
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/Vpedometer/app/src/main/java/com/vincent/vpedometer/pojo/ShowFighter.java:
--------------------------------------------------------------------------------
1 | package com.vincent.vpedometer.pojo;
2 |
3 | import com.vincent.vpedometer.utils.GameUtils;
4 |
5 | import org.cocos2d.actions.base.CCAction;
6 | import org.cocos2d.nodes.CCSprite;
7 |
8 | /**
9 | * Created by Administrator on 2018/1/25.
10 | * show pre fighting status of fighter
11 | */
12 |
13 | public class ShowFighter extends CCSprite {
14 |
15 | public ShowFighter(boolean filpx) {
16 | super("zombies/shake/z_1_01.png");
17 | setScale(1);
18 | setAnchorPoint(0.5f, 0);
19 | if (filpx) {
20 | setFlipX(true);
21 | }
22 | shake();
23 |
24 | }
25 |
26 | private void shake() {
27 | CCAction animate = GameUtils.animate(
28 | "zombies/shake/z_1_%02d.png", 2, true);
29 | runAction(animate);
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/Vpedometer/app/src/main/java/com/vincent/vpedometer/pojo/ShowSkill.java:
--------------------------------------------------------------------------------
1 | package com.vincent.vpedometer.pojo;
2 |
3 | import org.cocos2d.nodes.CCSprite;
4 |
5 | /**
6 | * Created by Administrator on 2018/1/28.
7 | * show skill logo
8 | */
9 |
10 | public class ShowSkill {
11 |
12 | String format = "fight/chose/choose_default%02d.png";
13 | private CCSprite bgSkill;
14 | private CCSprite showSkill;
15 |
16 | private int id;//标示植物
17 |
18 | public ShowSkill(int i) {
19 | this.id = i;
20 | bgSkill = CCSprite.sprite(String.format(format, i));
21 | bgSkill.setAnchorPoint(0, 0);
22 | float x = (i - 1) % 4 * 54 + 16;
23 | float y = 175 - (i - 1) / 4 * 59;
24 | bgSkill.setPosition(x, y);
25 | bgSkill.setOpacity(100);
26 |
27 | showSkill = CCSprite.sprite(String.format(format, i));
28 | showSkill.setAnchorPoint(0, 0);
29 | showSkill.setPosition(bgSkill.getPosition());
30 | }
31 |
32 | public CCSprite getBgSkill() {
33 | return bgSkill;
34 | }
35 |
36 | public CCSprite getShowSkill() {
37 | return showSkill;
38 | }
39 |
40 | public int getId() {
41 | return id;
42 | }
43 |
44 | }
45 |
--------------------------------------------------------------------------------
/Vpedometer/app/src/main/java/com/vincent/vpedometer/pojo/ShutDown.java:
--------------------------------------------------------------------------------
1 | package com.vincent.vpedometer.pojo;
2 |
3 | import com.litesuits.orm.db.annotation.Column;
4 | import com.litesuits.orm.db.annotation.PrimaryKey;
5 | import com.litesuits.orm.db.annotation.Table;
6 | import com.litesuits.orm.db.enums.AssignType;
7 |
8 | /**
9 | * Created by Administrator on 2018/2/11 18:28
10 | */
11 | @Table("shutdown")
12 | public class ShutDown {
13 | @PrimaryKey(AssignType.AUTO_INCREMENT)
14 | int id;
15 | @Column("shut_down_date")
16 | String shutDownDate;
17 | @Column("total_steps")
18 | int totalSteps;
19 |
20 | public int getTotalSteps() {
21 | return totalSteps;
22 | }
23 |
24 | public void setTotalSteps(int totalSteps) {
25 | this.totalSteps = totalSteps;
26 | }
27 |
28 | public int getId() {
29 | return id;
30 | }
31 |
32 | public void setId(int id) {
33 | this.id = id;
34 | }
35 |
36 | public String getShutDownDate() {
37 | return shutDownDate;
38 | }
39 |
40 | public void setShutDownDate(String shutDownDate) {
41 | this.shutDownDate = shutDownDate;
42 | }
43 |
44 | @Override
45 | public String toString() {
46 | return "ShutDown{" +
47 | "id=" + id +
48 | ", shutDownDate='" + shutDownDate + '\'' +
49 | ", totalSteps=" + totalSteps +
50 | '}';
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/Vpedometer/app/src/main/java/com/vincent/vpedometer/pojo/Skill.java:
--------------------------------------------------------------------------------
1 | package com.vincent.vpedometer.pojo;
2 |
3 | /**
4 | * Created by Administrator on 2018/1/29.
5 | * All skill super class
6 | */
7 |
8 | public abstract class Skill extends BaseElement {
9 | protected int attack = 80;
10 | protected int speed = 120;
11 | public boolean isRemoteSkill;
12 |
13 |
14 | public Skill(String filepath) {
15 | super(filepath);
16 | }
17 |
18 | public abstract void move();
19 |
20 | public int getAttack() {
21 | return attack;
22 | }
23 |
24 | public void setAttack(int attack) {
25 | this.attack = attack;
26 | }
27 |
28 | }
29 |
--------------------------------------------------------------------------------
/Vpedometer/app/src/main/java/com/vincent/vpedometer/pojo/StepData.java:
--------------------------------------------------------------------------------
1 | package com.vincent.vpedometer.pojo;
2 |
3 | import com.litesuits.orm.db.annotation.Column;
4 | import com.litesuits.orm.db.annotation.PrimaryKey;
5 | import com.litesuits.orm.db.annotation.Table;
6 | import com.litesuits.orm.db.enums.AssignType;
7 |
8 | /**
9 | * Created by Administrator on 2018/2/8.
10 | * ORM model
11 | */
12 |
13 | @Table("step")
14 | public class StepData {
15 | // primary key and set it auto increment
16 | @PrimaryKey(AssignType.AUTO_INCREMENT)
17 | private int id;
18 |
19 | @Column("today")
20 | private String today;
21 | @Column("step")
22 | private int step;
23 |
24 | public int getId() {
25 | return id;
26 | }
27 |
28 | public void setId(int id) {
29 | this.id = id;
30 | }
31 |
32 | public String getToday() {
33 | return today;
34 | }
35 |
36 | public void setToday(String today) {
37 | this.today = today;
38 | }
39 |
40 | public int getStep() {
41 | return step;
42 | }
43 |
44 | public void setStep(int step) {
45 | this.step = step;
46 | }
47 |
48 | @Override
49 | public String toString() {
50 | return "StepData{" +
51 | "id=" + id +
52 | ", today='" + today + '\'' +
53 | ", step=" + step +
54 | '}';
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/Vpedometer/app/src/main/java/com/vincent/vpedometer/pojo/User.java:
--------------------------------------------------------------------------------
1 | package com.vincent.vpedometer.pojo;
2 |
3 | /**
4 | * Created by Administrator on 2018/2/28 21:03
5 | */
6 | public class User {
7 |
8 | String uid;
9 | String name;
10 | String password;
11 | String email;
12 | String totalstep;
13 | long registerTime;
14 |
15 | public String getTotalstep() {
16 | return totalstep;
17 | }
18 |
19 | public void setTotalstep(String totalstep) {
20 | this.totalstep = totalstep;
21 | }
22 |
23 | public int getGender() {
24 | return gender;
25 | }
26 |
27 | public GameCharecter getRole() {
28 | return role;
29 | }
30 |
31 | public void setRole(GameCharecter role) {
32 | this.role = role;
33 | }
34 |
35 | long loginTime;
36 | int loginCount;
37 | int gender;
38 | String code;
39 | GameCharecter role;
40 |
41 | public User(String userName, String password) {
42 | this.name = userName;
43 | this.password = password;
44 | }
45 |
46 | public User() {
47 |
48 | }
49 |
50 | public String getUid() {
51 | return uid;
52 | }
53 |
54 | public void setUid(String uid) {
55 | this.uid = uid;
56 | }
57 |
58 | public String getName() {
59 | return name;
60 | }
61 |
62 | public void setName(String name) {
63 | this.name = name;
64 | }
65 |
66 | public String getPassword() {
67 | return password;
68 | }
69 |
70 | public void setPassword(String password) {
71 | this.password = password;
72 | }
73 |
74 | public String getEmail() {
75 | return email;
76 | }
77 |
78 | public void setEmail(String email) {
79 | this.email = email;
80 | }
81 |
82 | public long getRegisterTime() {
83 | return registerTime;
84 | }
85 |
86 | public void setRegisterTime(long registerTime) {
87 | this.registerTime = registerTime;
88 | }
89 |
90 | public long getLoginTime() {
91 | return loginTime;
92 | }
93 |
94 | public void setLoginTime(long loginTime) {
95 | this.loginTime = loginTime;
96 | }
97 |
98 | public int getLoginCount() {
99 | return loginCount;
100 | }
101 |
102 | public void setLoginCount(int loginCount) {
103 | this.loginCount = loginCount;
104 | }
105 |
106 | public int isGender() {
107 | return gender;
108 | }
109 |
110 | public void setGender(int gender) {
111 | this.gender = gender;
112 | }
113 |
114 | public String getCode() {
115 | return code;
116 | }
117 |
118 | public void setCode(String code) {
119 | this.code = code;
120 | }
121 |
122 | public GameCharecter getGameCharecter() {
123 | return role;
124 | }
125 |
126 | public void setGameCharecter(GameCharecter gameCharecter) {
127 | this.role = gameCharecter;
128 | }
129 |
130 | @Override
131 | public String toString() {
132 | return "User{" +
133 | "uid='" + uid + '\'' +
134 | ", name='" + name + '\'' +
135 | ", password='" + password + '\'' +
136 | ", email='" + email + '\'' +
137 | ", registerTime=" + registerTime +
138 | ", loginTime=" + loginTime +
139 | ", loginCount=" + loginCount +
140 | ", gender=" + gender +
141 | ", code='" + code + '\'' +
142 | ", gameCharecter=" + role +
143 | '}';
144 | }
145 | }
146 |
--------------------------------------------------------------------------------
/Vpedometer/app/src/main/java/com/vincent/vpedometer/receiver/BootCompleteReceiver.java:
--------------------------------------------------------------------------------
1 | package com.vincent.vpedometer.receiver;
2 |
3 | import android.content.BroadcastReceiver;
4 | import android.content.Context;
5 | import android.content.Intent;
6 | import android.util.Log;
7 |
8 | import com.vincent.vpedometer.services.StepService;
9 |
10 | /**
11 | * when phone reboot, this class will do the open service job
12 | */
13 | public class BootCompleteReceiver extends BroadcastReceiver {
14 | public BootCompleteReceiver() {
15 | }
16 |
17 | @Override
18 | public void onReceive(Context context, Intent intent) {
19 | Intent i = new Intent(context, StepService.class);
20 | context.startService(i);
21 | Log.i("reciver", "reboot");
22 | // throw new UnsupportedOperationException("Not yet implemented");
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/Vpedometer/app/src/main/java/com/vincent/vpedometer/services/StepInPedometer.java:
--------------------------------------------------------------------------------
1 | package com.vincent.vpedometer.services;
2 |
3 | import android.content.Context;
4 | import android.hardware.Sensor;
5 | import android.hardware.SensorEvent;
6 | import android.hardware.SensorManager;
7 | import android.util.Log;
8 |
9 | import com.vincent.vpedometer.base.StepMode;
10 |
11 | /**
12 | * Created by Administrator on 2018/2/8.
13 | */
14 |
15 | public class StepInPedometer extends StepMode {
16 | private final String TAG = "StepInPedometer";
17 | private int lastStep = -1;
18 | private int liveStep = 0;
19 | private int increment = 0;
20 | //0-TYPE_STEP_DETECTOR 1-TYPE_STEP_COUNTER
21 | private int sensorMode = 0;
22 | private boolean hasRecord;
23 | private int hasStepCount;
24 | private int previousStepCount;
25 |
26 | public StepInPedometer(Context context, StepCallBack stepCallBack) {
27 | super(context, stepCallBack);
28 |
29 | }
30 |
31 | @Override
32 | protected void registerSensor() {
33 | addCountStepListener();
34 | }
35 |
36 | /**
37 | * this method will call when sensor has reaction
38 | *
39 | * @param event
40 | */
41 | @Override
42 | public void onSensorChanged(SensorEvent event) {
43 | liveStep = (int) event.values[0];
44 | if (sensorMode == 0) {
45 | StepMode.CURRENT_STEP += liveStep;
46 | } else if (sensorMode == 1) {
47 | int tempStep = (int) event.values[0];
48 | if (!hasRecord) {
49 | hasRecord = true;
50 | hasStepCount = tempStep;
51 | } else {
52 | int thisStepCount = tempStep - hasStepCount;
53 | CURRENT_STEP += (thisStepCount - previousStepCount);
54 | previousStepCount = thisStepCount;
55 | }
56 | }
57 | stepCallBack.Step(StepMode.CURRENT_STEP);
58 |
59 | }
60 |
61 | @Override
62 | public void onAccuracyChanged(Sensor sensor, int accuracy) {
63 |
64 | }
65 |
66 | private void addCountStepListener() {
67 | //get two sensor which one can be used.
68 | Sensor detectorSensor = sensorManager.getDefaultSensor(Sensor.TYPE_STEP_DETECTOR);
69 | Sensor countSensor = sensorManager.getDefaultSensor(Sensor.TYPE_STEP_COUNTER);
70 | //first sensor will return the step counting is not cumulative
71 | if (detectorSensor != null) {
72 | sensorManager.registerListener(this, detectorSensor, SensorManager.SENSOR_DELAY_UI);
73 | isAvailable = true;
74 | sensorMode = 0;
75 | //second one will return the step counting is cumulative
76 | } else if (countSensor != null) {
77 | sensorManager.registerListener(this, countSensor, SensorManager.SENSOR_DELAY_UI);
78 | isAvailable = true;
79 | sensorMode = 1;
80 | //google step sensor can not be used
81 | } else {
82 | isAvailable = false;
83 | Log.v(TAG, "Count sensor not available!");
84 | }
85 | }
86 | }
87 |
--------------------------------------------------------------------------------
/Vpedometer/app/src/main/java/com/vincent/vpedometer/test/data/Constant.java:
--------------------------------------------------------------------------------
1 | package com.vincent.vpedometer.test.data;
2 |
3 | public interface Constant {
4 | public static final String[] sCheeseStrings = {
5 | "Abbaye de Belloc", "Abbaye du Mont des Cats", "Abertam", "Abondance", "Ackawi",
6 | "Acorn", "Adelost", "Affidelice au Chablis", "Afuega'l Pitu", "Airag", "Airedale",
7 | "Aisy Cendre", "Allgauer Emmentaler", "Alverca", "Ambert", "American Cheese",
8 | "Ami du Chambertin", "Anejo Enchilado", "Anneau du Vic-Bilh", "Anthoriro", "Appenzell",
9 | "Aragon", "Ardi Gasna", "Ardrahan", "Armenian String", "Aromes au Gene de Marc",
10 | "Cougar Gold", "Coulommiers", "Coverdale", "Crayeux de Roncq", "Cream Cheese",
11 | "Cream Havarti", "Crema Agria", "Crema Mexicana", "Creme Fraiche", "Crescenza",
12 | "Croghan", "Crottin de Chavignol", "Crottin du Chavignol", "Crowdie", "Crowley",
13 | "Zamorano", "Zanetti Grana Padano", "Zanetti Parmigiano Reggiano"
14 | };
15 |
16 | public static final String[] NAMES = new String[]{"宋江", "卢俊义", "吴用",
17 | "公孙胜", "关胜", "林冲", "秦明", "呼延灼", "花荣", "柴进", "李应", "朱仝", "鲁智深",
18 | "武松", "董平", "张清", "杨志", "徐宁", "索超", "戴宗", "刘唐", "李逵", "史进", "穆弘",
19 | "雷横", "李俊", "阮小二", "张横", "阮小五", " 张顺", "阮小七", "杨雄", "石秀", "解珍",
20 | " 解宝", "燕青", "朱武", "黄信", "孙立", "宣赞", "郝思文", "韩滔", "彭玘", "单廷珪",
21 | "魏定国", "萧让", "裴宣", "欧鹏", "邓飞", " 燕顺", "杨林", "凌振", "蒋敬", "吕方",
22 | "郭 盛", "安道全", "皇甫端", "王英", "扈三娘", "鲍旭", "樊瑞", "孔明", "孔亮", "项充",
23 | "李衮", "金大坚", "马麟", "童威", "童猛", "孟康", "侯健", "陈达", "杨春", "郑天寿",
24 | "陶宗旺", "宋清", "乐和", "龚旺", "丁得孙", "穆春", "曹正", "宋万", "杜迁", "薛永", "施恩",
25 | };
26 | }
27 |
--------------------------------------------------------------------------------
/Vpedometer/app/src/main/java/com/vincent/vpedometer/ui/activity/GameActivity.java:
--------------------------------------------------------------------------------
1 | package com.vincent.vpedometer.ui.activity;
2 |
3 | import android.content.Intent;
4 | import android.os.Bundle;
5 | import android.support.v7.app.AppCompatActivity;
6 | import android.view.Window;
7 |
8 | import com.vincent.vpedometer.ui.enginne.GameEnginee;
9 | import com.vincent.vpedometer.ui.layer.MapLayer;
10 |
11 | import org.cocos2d.layers.CCScene;
12 | import org.cocos2d.nodes.CCDirector;
13 | import org.cocos2d.opengl.CCGLSurfaceView;
14 | import org.cocos2d.sound.SoundEngine;
15 |
16 | /**
17 | * Created by Administrator on 2018/1/25.
18 | */
19 |
20 | public class GameActivity extends AppCompatActivity {
21 |
22 | private CCDirector director;
23 |
24 | @Override
25 | protected void onCreate(Bundle savedInstanceState) {
26 | super.onCreate(savedInstanceState);
27 | this.requestWindowFeature(Window.FEATURE_NO_TITLE);
28 | if (getSupportActionBar() != null) {
29 | getSupportActionBar().hide();
30 | }
31 |
32 | CCGLSurfaceView view = new CCGLSurfaceView(this);
33 |
34 | setContentView(view);
35 |
36 | director = CCDirector.sharedDirector();
37 | director.attachInView(view);
38 |
39 | director.setDisplayFPS(true);
40 | //director.setAnimationInterval(1 / 60f);/
41 |
42 | director.setDeviceOrientation(CCDirector.kCCDeviceOrientationLandscapeLeft);
43 | director.setScreenSize(920, 480);
44 |
45 |
46 | CCScene scene = CCScene.node();
47 | MapLayer gameLayer = new MapLayer(this);
48 |
49 | scene.addChild(gameLayer);
50 |
51 |
52 | director.runWithScene(scene);
53 | }
54 |
55 | @Override
56 | protected void onResume() {
57 | super.onResume();
58 | director.resume();
59 | SoundEngine.sharedEngine().resumeSound();
60 | }
61 |
62 | @Override
63 | protected void onPause() {
64 | super.onPause();
65 | director.pause();
66 | SoundEngine.sharedEngine().pauseSound();
67 | }
68 |
69 | @Override
70 | protected void onDestroy() {
71 | GameEnginee.getInstance().gameOver();
72 | super.onDestroy();
73 | director.end();
74 | }
75 |
76 | public void gameOver() {
77 |
78 | this.finish();
79 | }
80 |
81 | public void gameOver(boolean win) {
82 | Intent userData = new Intent();
83 | if (win) {
84 |
85 | userData.putExtra("win", true);
86 |
87 | } else {
88 | userData.putExtra("win", false);
89 |
90 | }
91 | setResult(1, userData);
92 | this.finish();
93 | }
94 | }
95 |
--------------------------------------------------------------------------------
/Vpedometer/app/src/main/java/com/vincent/vpedometer/ui/fragment/BaseFrament.java:
--------------------------------------------------------------------------------
1 | package com.vincent.vpedometer.ui.fragment;
2 |
3 | import android.content.Context;
4 | import android.view.View;
5 |
6 | import com.vincent.vpedometer.ui.activity.MainActivity;
7 | import com.vincent.vpedometer.ui.view.MyLinearLayout;
8 | import com.vincent.vpedometer.ui.view.SlideMenu;
9 |
10 | /**
11 | * Created by Administrator on 2018/2/11 21:44
12 | */
13 | public abstract class BaseFrament {
14 | Context mContext;
15 | SlideMenu mSlideMenu;
16 | public MyLinearLayout mMyView;
17 | public MainActivity mMainActivity;
18 | public View rootView;
19 |
20 |
21 | public abstract void init();
22 |
23 | public abstract BaseFrament getMe();
24 |
25 | }
26 |
--------------------------------------------------------------------------------
/Vpedometer/app/src/main/java/com/vincent/vpedometer/ui/fragment/IconFragment.java:
--------------------------------------------------------------------------------
1 | package com.vincent.vpedometer.ui.fragment;
2 |
3 | import android.content.Context;
4 | import android.view.View;
5 | import android.widget.Button;
6 | import android.widget.ImageView;
7 | import android.widget.TextView;
8 |
9 | import com.vincent.vpedometer.R;
10 | import com.vincent.vpedometer.ui.activity.MainActivity;
11 | import com.vincent.vpedometer.ui.view.MyLinearLayout;
12 | import com.vincent.vpedometer.ui.view.SlideMenu;
13 |
14 | import static com.vincent.vpedometer.R.id.imageView;
15 |
16 | /**
17 | * Created by Administrator on 2018/2/11 22:50
18 | */
19 | public class IconFragment extends BaseFrament {
20 |
21 | MainActivity main;
22 | public ImageView mImageView;
23 | public TextView mTextView;
24 |
25 | public IconFragment(Context context, SlideMenu slideMenu, MainActivity main) {
26 | this.mContext = context;
27 | this.mSlideMenu = slideMenu;
28 | this.main = main;
29 | }
30 |
31 |
32 |
33 | @Override
34 | public void init() {
35 | ininView();
36 |
37 | }
38 |
39 | private void ininView() {
40 | View mainView = View.inflate(mContext, R.layout.layout_photo, this.mSlideMenu);
41 | mMyView = (MyLinearLayout) mainView.findViewById(R.id.photo_layout);
42 | Button btnPhone = (Button) mainView.findViewById(R.id.btnPhone);
43 | mImageView = (ImageView) mainView.findViewById(imageView);
44 | mTextView = (TextView) mainView.findViewById(R.id.img_path);
45 | btnPhone.setOnClickListener(new View.OnClickListener() {
46 | @Override
47 | public void onClick(View v) {
48 | main.setImage();
49 | }
50 | });
51 | this.mSlideMenu.setMainView(mMyView);
52 | }
53 |
54 | public IconFragment getMe() {
55 | return this;
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/Vpedometer/app/src/main/java/com/vincent/vpedometer/ui/fragment/InformationFragment.java:
--------------------------------------------------------------------------------
1 | package com.vincent.vpedometer.ui.fragment;
2 |
3 | import android.content.Context;
4 | import android.view.View;
5 | import android.widget.TextView;
6 |
7 | import com.vincent.vpedometer.R;
8 | import com.vincent.vpedometer.pojo.User;
9 | import com.vincent.vpedometer.ui.activity.MainActivity;
10 | import com.vincent.vpedometer.ui.view.SlideMenu;
11 | import com.vincent.vpedometer.utils.ServerUtils;
12 |
13 | /**
14 | * Created by Administrator on 2018/3/14 14:53
15 | */
16 | public class InformationFragment extends BaseFrament {
17 | private TextView name ;
18 | private TextView totalsteps;
19 | private TextView email;
20 | private TextView level;
21 | private TextView attack;
22 | private TextView defend;
23 | private TextView HP;
24 | private TextView MP;
25 |
26 | public InformationFragment(Context context, SlideMenu slideMenu) {
27 | this.mContext = context;
28 | this.mSlideMenu = slideMenu;
29 | this.mMainActivity = (MainActivity) context;
30 | }
31 |
32 |
33 | @Override
34 | public void init() {
35 | initView();
36 | initData();
37 | }
38 |
39 | private void initData() {
40 | new Thread(new Runnable() {
41 | @Override
42 | public void run() {
43 | final User myRple = ServerUtils.getMyRple(mMainActivity);
44 | mMainActivity.runOnUiThread(new Runnable() {
45 | @Override
46 | public void run() {
47 | if (myRple != null) {
48 | updateText(myRple);
49 | }
50 | }
51 | });
52 |
53 | }
54 | }).start();
55 | }
56 |
57 | private void initView() {
58 | rootView = View.inflate(mMainActivity, R.layout.layout_information, null);
59 | name = (TextView) rootView.findViewById(R.id.name);
60 | totalsteps = (TextView) rootView.findViewById(R.id.totalsteps);
61 | email = (TextView) rootView.findViewById(R.id.email);
62 | level = (TextView) rootView.findViewById(R.id.level);
63 | attack = (TextView) rootView.findViewById(R.id.attack);
64 | defend = (TextView) rootView.findViewById(R.id.defend);
65 | HP = (TextView) rootView.findViewById(R.id.HP);
66 | MP = (TextView) rootView.findViewById(R.id.MP);
67 | }
68 |
69 | private void updateText(User user) {
70 | name.setText(user.getName());
71 | totalsteps.setText(user.getTotalstep());
72 | email.setText(user.getEmail());
73 | level.setText(user.getGameCharecter().getLevel() + "");
74 | attack.setText(user.getGameCharecter().getAttack() + "");
75 | defend.setText(user.getGameCharecter().getDefend() + "");
76 | HP.setText(user.getGameCharecter().getHealthPoint() + "");
77 | MP.setText(user.getGameCharecter().getMagicPoint() + "");
78 |
79 | }
80 |
81 |
82 | @Override
83 | public BaseFrament getMe() {
84 | return this;
85 | }
86 | }
87 |
--------------------------------------------------------------------------------
/Vpedometer/app/src/main/java/com/vincent/vpedometer/ui/fragment/PasswordFragment.java:
--------------------------------------------------------------------------------
1 | package com.vincent.vpedometer.ui.fragment;
2 |
3 | import android.content.Context;
4 | import android.os.Bundle;
5 | import android.os.Message;
6 | import android.text.TextUtils;
7 | import android.view.View;
8 | import android.widget.Button;
9 | import android.widget.EditText;
10 | import android.widget.Toast;
11 |
12 | import com.vincent.vpedometer.R;
13 | import com.vincent.vpedometer.config.MyConstants;
14 | import com.vincent.vpedometer.pojo.User;
15 | import com.vincent.vpedometer.ui.activity.MainActivity;
16 | import com.vincent.vpedometer.ui.view.SlideMenu;
17 | import com.vincent.vpedometer.utils.ServerUtils;
18 |
19 | /**
20 | * Created by Administrator on 2018/3/13 22:04
21 | */
22 | public class PasswordFragment extends BaseFrament {
23 | @Override
24 | public void init() {
25 | initView();
26 | initData();
27 |
28 | }
29 |
30 | public PasswordFragment(Context context, SlideMenu slideMenu) {
31 | this.mContext = context;
32 | this.mSlideMenu = slideMenu;
33 | this.mMainActivity = (MainActivity) context;
34 |
35 | }
36 |
37 | private void initData() {
38 |
39 |
40 | }
41 |
42 | private void initView() {
43 | rootView = View.inflate(mMainActivity, R.layout.layout_password, null);
44 | final EditText oldPassword = (EditText) rootView.findViewById(R.id.et_oldpassword);
45 | final EditText newPassword = (EditText) rootView.findViewById(R.id.et_newpassword);
46 | final EditText comfirmPassword = (EditText) rootView.findViewById(R.id.et_comfirmpassword);
47 | final EditText userName = (EditText) rootView.findViewById(R.id.et_changeUsername);
48 | Button comfirmButton = (Button) rootView.findViewById(R.id.btn_comfirm);
49 |
50 | comfirmButton.setOnClickListener(new View.OnClickListener() {
51 | @Override
52 | public void onClick(View v) {
53 | if (TextUtils.isEmpty(oldPassword.getText()) || TextUtils.isEmpty(comfirmPassword.getText()) || TextUtils.isEmpty(newPassword.getText())) {
54 | Toast.makeText(mMainActivity, "can not be empty", Toast.LENGTH_SHORT).show();
55 | return;
56 | }
57 | if (!comfirmPassword.getText().toString().equals(newPassword.getText().toString())) {
58 | Toast.makeText(mMainActivity, "two password need be same", Toast.LENGTH_SHORT).show();
59 | return;
60 | }
61 | final User user = new User();
62 | user.setName(userName.getText().toString().trim());
63 | user.setPassword(oldPassword.getText().toString().trim());
64 |
65 | new Thread(new Runnable() {
66 | @Override
67 | public void run() {
68 | String password = ServerUtils.ChangePassword(mMainActivity, user, newPassword.getText().toString().trim());
69 | Message msg = Message.obtain(null, MyConstants.CHANGE_PASSWORD);
70 | Bundle bundle = new Bundle();
71 | bundle.putString("password", password);
72 | msg.setData(bundle);
73 | mMainActivity.delayHandler.sendMessage(msg);
74 | }
75 | }).start();
76 | }
77 | });
78 | }
79 |
80 |
81 | @Override
82 | public BaseFrament getMe() {
83 | return this;
84 | }
85 |
86 |
87 | }
88 |
--------------------------------------------------------------------------------
/Vpedometer/app/src/main/java/com/vincent/vpedometer/ui/fragment/SettingFragment.java:
--------------------------------------------------------------------------------
1 | package com.vincent.vpedometer.ui.fragment;
2 |
3 | /**
4 | * Created by Administrator on 2018/2/11 22:50
5 | */
6 | public class SettingFragment extends BaseFrament {
7 | @Override
8 | public void init() {
9 |
10 | }
11 |
12 | @Override
13 | public BaseFrament getMe() {
14 | return null;
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/Vpedometer/app/src/main/java/com/vincent/vpedometer/ui/layer/BaseLayer.java:
--------------------------------------------------------------------------------
1 | package com.vincent.vpedometer.ui.layer;
2 |
3 | import org.cocos2d.layers.CCLayer;
4 | import org.cocos2d.nodes.CCDirector;
5 | import org.cocos2d.types.CGSize;
6 |
7 | /**
8 | * Created by Administrator on 2018/1/25.
9 | */
10 |
11 | public class BaseLayer extends CCLayer {
12 | public CGSize winSize = CCDirector.sharedDirector().winSize();
13 |
14 | public BaseLayer() {
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/Vpedometer/app/src/main/java/com/vincent/vpedometer/ui/view/BeforeOrAfterCalendarView.java:
--------------------------------------------------------------------------------
1 | package com.vincent.vpedometer.ui.view;
2 |
3 | import android.content.Context;
4 | import android.view.LayoutInflater;
5 | import android.view.View;
6 | import android.widget.LinearLayout;
7 | import android.widget.RelativeLayout;
8 |
9 | import com.vincent.vpedometer.R;
10 | import com.vincent.vpedometer.utils.TimeUtils;
11 |
12 | import java.util.ArrayList;
13 | import java.util.List;
14 |
15 | /**
16 | * Created by Administrator on 2018/2/11 19:22
17 | * the past six date of today calender
18 | */
19 |
20 | public class BeforeOrAfterCalendarView extends RelativeLayout {
21 |
22 | private List dayList = new ArrayList<>();
23 | private List dateList = new ArrayList<>();
24 |
25 | protected List itemViewList = new ArrayList<>();
26 | protected Context mContext;
27 | protected LinearLayout calenderViewLl;
28 | protected int curPosition;
29 |
30 | public BeforeOrAfterCalendarView(Context context) {
31 | super(context);
32 | this.mContext = context;
33 |
34 | init();
35 | }
36 |
37 | private void init() {
38 | //inflate this xml file to a view and this view's parent is this.
39 | View view = LayoutInflater.from(mContext).inflate(R.layout.before_or_after_calendar_layout, this);
40 |
41 | calenderViewLl = (LinearLayout) view.findViewById(R.id.boa_calender_view_ll);
42 |
43 | setBeforeDateViews();
44 |
45 | initItemViews();
46 | }
47 |
48 | /**
49 | * set the before day of today
50 | */
51 | private void setBeforeDateViews() {
52 | //get full date e.g :2017年02月21日
53 | dateList.addAll(TimeUtils.getBeforeDateListByNow());
54 | //get partial date e.g : 21
55 | dayList.addAll(TimeUtils.dateListToDayList(dateList));
56 | }
57 |
58 | private void initItemViews() {
59 | for (int i = 0; i < dateList.size(); i++) {
60 | int day = dayList.get(i);
61 | String curItemDate = dateList.get(i);
62 | final RecordsCalenderItemView itemView;
63 | if (day == TimeUtils.getCurrentDay()) {
64 | itemView = new RecordsCalenderItemView(mContext, "今天", String.valueOf(day), i, curItemDate);
65 | } else {
66 | itemView = new RecordsCalenderItemView(mContext, TimeUtils.getCurWeekDay(curItemDate), String.valueOf(day), i, curItemDate);
67 | }
68 |
69 | itemViewList.add(itemView);
70 | calenderViewLl.addView(itemView);
71 |
72 | itemView.setOnCalenderItemClick(new RecordsCalenderItemView.OnCalenderItemClick() {
73 | @Override
74 | public void onCalenderItemClick() {
75 | curPosition = itemView.getPosition();
76 | switchPositionView(curPosition);
77 |
78 | //callback onclick event to refresh user selecting date
79 | if (calenderClickListener != null) {
80 | calenderClickListener.onClickToRefresh(curPosition, dateList.get(curPosition));
81 | }
82 | }
83 | });
84 | }
85 |
86 | switchPositionView(6);
87 |
88 | }
89 |
90 | private void switchPositionView(int position) {
91 | for (int i = 0; i < itemViewList.size(); i++) {
92 | if (position == i) {
93 | itemViewList.get(i).setChecked(true);
94 | } else {
95 | itemViewList.get(i).setChecked(false);
96 | }
97 | }
98 | }
99 |
100 | private BoaCalenderClickListener calenderClickListener;
101 |
102 | public interface BoaCalenderClickListener {
103 | void onClickToRefresh(int position, String curDate);
104 | }
105 |
106 | public void setOnBoaCalenderClickListener(BoaCalenderClickListener calenderClickListener) {
107 | this.calenderClickListener = calenderClickListener;
108 | }
109 | }
110 |
--------------------------------------------------------------------------------
/Vpedometer/app/src/main/java/com/vincent/vpedometer/ui/view/MyLinearLayout.java:
--------------------------------------------------------------------------------
1 | package com.vincent.vpedometer.ui.view;
2 |
3 |
4 | import android.content.Context;
5 | import android.util.AttributeSet;
6 | import android.util.Log;
7 | import android.view.MotionEvent;
8 | import android.widget.LinearLayout;
9 |
10 | import com.vincent.vpedometer.ui.view.SlideMenu.DragState;
11 |
12 | /**
13 | * Created by Administrator on 2018/1/30.
14 | */
15 |
16 | public class MyLinearLayout extends LinearLayout {
17 |
18 | public MyLinearLayout(Context context, AttributeSet attrs, int defStyle) {
19 | super(context, attrs, defStyle);
20 | }
21 |
22 | public MyLinearLayout(Context context, AttributeSet attrs) {
23 | super(context, attrs);
24 | }
25 |
26 | public MyLinearLayout(Context context) {
27 | super(context);
28 | }
29 |
30 | private static SlideMenu slideMenu;
31 |
32 | public void setSlideMenu(SlideMenu slideMenu) {
33 | this.slideMenu = slideMenu;
34 | }
35 |
36 | @Override
37 | public boolean onInterceptTouchEvent(MotionEvent ev) {
38 | int childCount = getChildCount();
39 | Log.i("MyLinearLayout", childCount + "");
40 | if (slideMenu != null && slideMenu.getCurrentState() == DragState.Open) {
41 | //intercept the slide event
42 | return true;
43 | }
44 | return super.onInterceptTouchEvent(ev);
45 | //return false;
46 | }
47 |
48 | @Override
49 | public boolean onTouchEvent(MotionEvent event) {
50 | if (slideMenu != null && slideMenu.getCurrentState() == DragState.Open) {
51 | if (event.getAction() == MotionEvent.ACTION_UP) {
52 | //close sile menu when the motion event is action up
53 | slideMenu.close();
54 | }
55 |
56 | //intercept the slide event
57 | return true;
58 |
59 | } else if (slideMenu != null && slideMenu.getCurrentState() == DragState.Close) {
60 | //intercept the event in order not returning to slide menu.
61 | return true;
62 | }
63 | return super.onTouchEvent(event);
64 | }
65 | }
66 |
--------------------------------------------------------------------------------
/Vpedometer/app/src/main/java/com/vincent/vpedometer/utils/ColorUtil.java:
--------------------------------------------------------------------------------
1 | package com.vincent.vpedometer.utils;
2 |
3 | public class ColorUtil {
4 | public static Object evaluateColor(float fraction, Object startValue,
5 | Object endValue) {
6 | int startInt = (Integer) startValue;
7 | int startA = (startInt >> 24) & 0xff;
8 | int startR = (startInt >> 16) & 0xff;
9 | int startG = (startInt >> 8) & 0xff;
10 | int startB = startInt & 0xff;
11 |
12 | int endInt = (Integer) endValue;
13 | int endA = (endInt >> 24) & 0xff;
14 | int endR = (endInt >> 16) & 0xff;
15 | int endG = (endInt >> 8) & 0xff;
16 | int endB = endInt & 0xff;
17 |
18 | return (int) ((startA + (int) (fraction * (endA - startA))) << 24)
19 | | (int) ((startR + (int) (fraction * (endR - startR))) << 16)
20 | | (int) ((startG + (int) (fraction * (endG - startG))) << 8)
21 | | (int) ((startB + (int) (fraction * (endB - startB))));
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/Vpedometer/app/src/main/java/com/vincent/vpedometer/utils/DbUtils.java:
--------------------------------------------------------------------------------
1 | package com.vincent.vpedometer.utils;
2 |
3 | import android.content.Context;
4 |
5 | import com.litesuits.orm.LiteOrm;
6 | import com.litesuits.orm.db.assit.QueryBuilder;
7 | import com.litesuits.orm.db.model.ConflictAlgorithm;
8 |
9 | import java.util.List;
10 |
11 | /**
12 | * Created by Administrator on 2018/2/8.
13 | */
14 |
15 | public class DbUtils {
16 | public static String DB_NAME;
17 | public static LiteOrm liteOrm;
18 |
19 | public static void createDb(Context _activity, String DB_NAME) {
20 | DB_NAME = DB_NAME + ".db";
21 | if (liteOrm == null) {
22 | liteOrm = LiteOrm.newCascadeInstance(_activity, DB_NAME);
23 | liteOrm.setDebugged(true);
24 | }
25 | }
26 |
27 | public static LiteOrm getLiteOrm() {
28 | return liteOrm;
29 | }
30 |
31 | /**
32 | * insert teh record
33 | *
34 | * @param t
35 | */
36 | public static void insert(T t) {
37 | liteOrm.save(t);
38 | }
39 |
40 | /**
41 | * insert the data as a list
42 | *
43 | * @param list
44 | */
45 | public static void insertAll(List list) {
46 | liteOrm.save(list);
47 | }
48 |
49 | /**
50 | * get all
51 | *
52 | * @param cla
53 | * @return
54 | */
55 | public static List getQueryAll(Class cla) {
56 | return liteOrm.query(cla);
57 | }
58 |
59 | /**
60 | * query by conditional
61 | *
62 | * @param cla
63 | * @param field
64 | * @param value
65 | * @return
66 | */
67 | public static List getQueryByWhere(Class cla, String field, String[] value) {
68 | return liteOrm.query(new QueryBuilder(cla).where(field + "=?", value));
69 | }
70 |
71 | /**
72 | * paging
73 | *
74 | * @param cla
75 | * @param field
76 | * @param value
77 | * @param start
78 | * @param length
79 | * @return
80 | */
81 | public static List getQueryByWhereLength(Class cla, String field, String[] value, int start, int length) {
82 | return liteOrm.query(new QueryBuilder(cla).where(field + "=?", value).limit(start, length));
83 | }
84 |
85 | /**
86 | * delete the record by where condition
87 | * @param cla
88 | * @param field
89 | * @param value
90 | */
91 | // public static void deleteWhere(Class cla,String field,String [] value){
92 | // liteOrm.delete(cla, WhereBuilder.create().where(field + "=?", value));
93 | // }
94 |
95 | /**
96 | * delete all
97 | *
98 | * @param cla
99 | */
100 | public static void deleteAll(Class cla) {
101 | liteOrm.deleteAll(cla);
102 | }
103 |
104 | /**
105 | * update the data when data is exits
106 | *
107 | * @param t
108 | */
109 | public static void update(T t) {
110 | liteOrm.update(t, ConflictAlgorithm.Replace);
111 | }
112 |
113 |
114 | public static void updateALL(List list) {
115 | liteOrm.update(list);
116 | }
117 |
118 | public static void closeDb() {
119 | liteOrm.close();
120 | }
121 |
122 |
123 | }
124 |
--------------------------------------------------------------------------------
/Vpedometer/app/src/main/java/com/vincent/vpedometer/utils/GameUtils.java:
--------------------------------------------------------------------------------
1 | package com.vincent.vpedometer.utils;
2 |
3 | import org.cocos2d.actions.base.CCAction;
4 | import org.cocos2d.actions.base.CCRepeatForever;
5 | import org.cocos2d.actions.interval.CCAnimate;
6 | import org.cocos2d.layers.CCLayer;
7 | import org.cocos2d.layers.CCScene;
8 | import org.cocos2d.layers.CCTMXObjectGroup;
9 | import org.cocos2d.layers.CCTMXTiledMap;
10 | import org.cocos2d.nodes.CCAnimation;
11 | import org.cocos2d.nodes.CCDirector;
12 | import org.cocos2d.nodes.CCNode;
13 | import org.cocos2d.nodes.CCSprite;
14 | import org.cocos2d.nodes.CCSpriteFrame;
15 | import org.cocos2d.transitions.CCFadeTransition;
16 | import org.cocos2d.types.CGPoint;
17 |
18 | import java.util.ArrayList;
19 | import java.util.HashMap;
20 |
21 | /**
22 | * game engine tools
23 | *
24 | * @author vincent
25 | */
26 | public class GameUtils {
27 |
28 | /**
29 | * animation tool
30 | *
31 | * @param format image path format
32 | * @param num how many image need to be loaded
33 | * @param repeat repeat the animation
34 | * @return
35 | */
36 | public static CCAction animate(String format, int num, boolean repeat) {
37 | return animate(format, num, repeat, 0.2f);
38 | }
39 |
40 |
41 | /**
42 | * set the animation
43 | *
44 | * @param format the image where in
45 | * @param num how many image need to be loaded
46 | * @param repeat repeat or not
47 | * @param t fps
48 | * @return
49 | */
50 | public static CCAction animate(String format, int num, boolean repeat, float t) {
51 | ArrayList frames = new ArrayList();
52 | for (int i = 1; i <= num; i++) {
53 | frames.add(CCSprite.sprite(String.format(format, i))
54 | .displayedFrame());
55 | }
56 |
57 | CCAnimation anim = CCAnimation.animation("loading", t, frames);// the t is how many time to display one image
58 |
59 | if (!repeat) {
60 | CCAnimate animate = CCAnimate.action(anim, false);// paramter 2 say animation repeat or not
61 | return animate;
62 | } else {
63 | CCAnimate animate = CCAnimate.action(anim);
64 | CCRepeatForever r = CCRepeatForever.action(animate);
65 | return r;
66 | }
67 | }
68 |
69 | /**
70 | * change the game layer
71 | */
72 | public static void changeLayer(CCLayer layer) {
73 | CCScene scene = CCScene.node();
74 | scene.addChild(layer);
75 |
76 | // CCJumpZoomTransition transition = CCJumpZoomTransition.transition(2,
77 | // scene);// change
78 |
79 | CCFadeTransition transition = CCFadeTransition.transition(1, scene);// how to change
80 | CCDirector.sharedDirector().replaceScene(transition);// change sence
81 | }
82 |
83 | /**
84 | * get the specific map point
85 | */
86 | public static ArrayList loadPoint(CCTMXTiledMap map,
87 | String groupName) {
88 | ArrayList points = new ArrayList();
89 |
90 | CCTMXObjectGroup objectGroupNamed = map.objectGroupNamed(groupName);
91 | ArrayList> objects = objectGroupNamed.objects;
92 | for (HashMap hashMap : objects) {
93 | Integer x = Integer.parseInt(hashMap.get("x"));
94 | Integer y = Integer.parseInt(hashMap.get("y"));
95 | points.add(CCNode.ccp(x, y));
96 | }
97 |
98 | return points;
99 | }
100 | }
101 |
--------------------------------------------------------------------------------
/Vpedometer/app/src/main/java/com/vincent/vpedometer/utils/SensorCheckUtils.java:
--------------------------------------------------------------------------------
1 | package com.vincent.vpedometer.utils;
2 |
3 | import android.annotation.TargetApi;
4 | import android.content.Context;
5 | import android.content.pm.PackageManager;
6 | import android.hardware.Sensor;
7 | import android.hardware.SensorManager;
8 | import android.os.Build;
9 |
10 | /**
11 | * Created by Administrator on 2018/2/12 1:16
12 | */
13 | public class SensorCheckUtils {
14 | private Context context;
15 | //the sensor provide by google
16 | private boolean hasSensor;
17 |
18 | public SensorCheckUtils(Context context) {
19 | this.context = context;
20 | hasSensor = isSupportStepCountSensor();
21 | }
22 |
23 | @TargetApi(Build.VERSION_CODES.KITKAT)
24 | public boolean isSupportStepCountSensor() {
25 | return context.getPackageManager()
26 | .hasSystemFeature(PackageManager.FEATURE_SENSOR_STEP_COUNTER);
27 | }
28 |
29 | /**
30 | * determine the phone support google sensor or not
31 | *
32 | * @param context
33 | * @return
34 | */
35 | @TargetApi(Build.VERSION_CODES.KITKAT)
36 | public static boolean isSupportStepCountSensor(Context context) {
37 | // get the sensor
38 | SensorManager sensorManager = (SensorManager) context
39 | .getSystemService(context.SENSOR_SERVICE);
40 | Sensor countSensor = sensorManager.getDefaultSensor(Sensor.TYPE_STEP_COUNTER);
41 | Sensor detectorSensor = sensorManager.getDefaultSensor(Sensor.TYPE_STEP_DETECTOR);
42 | return countSensor != null || detectorSensor != null;
43 | }
44 |
45 |
46 | }
47 |
--------------------------------------------------------------------------------
/Vpedometer/app/src/main/java/com/vincent/vpedometer/utils/SpTools.java:
--------------------------------------------------------------------------------
1 | package com.vincent.vpedometer.utils;
2 |
3 | import android.content.Context;
4 | import android.content.SharedPreferences;
5 |
6 | import com.vincent.vpedometer.config.MyConstants;
7 |
8 | /**
9 | * Created by Administrator on 2018/1/23.
10 | */
11 |
12 | public class SpTools {
13 |
14 | /**
15 | * @param key
16 | * @param value
17 | */
18 | public static void setBoolean(Context context, String key, boolean value) {
19 | SharedPreferences sp = context.getSharedPreferences(MyConstants.CONFIGFILE, Context.MODE_PRIVATE);
20 | sp.edit().putBoolean(key, value).commit();
21 |
22 | }
23 |
24 | public static boolean getBoolean(Context context, String key, boolean defValue) {
25 | SharedPreferences sp = context.getSharedPreferences(MyConstants.CONFIGFILE, Context.MODE_PRIVATE);
26 | return sp.getBoolean(key, defValue);
27 | }
28 |
29 | public static boolean getBoolean(Context context, String key, boolean defValue, String fileName) {
30 | SharedPreferences sp = context.getSharedPreferences(fileName, Context.MODE_PRIVATE);
31 | return sp.getBoolean(key, defValue);
32 | }
33 |
34 |
35 | public static void setString(Context context, String key, String value) {
36 | SharedPreferences sp = context.getSharedPreferences(MyConstants.CONFIGFILE, Context.MODE_PRIVATE);
37 | sp.edit().putString(key, value).commit();
38 |
39 |
40 | }
41 |
42 | public static String getString(Context context, String key, String defValue, String fileName) {
43 | SharedPreferences sp = context.getSharedPreferences(fileName, Context.MODE_PRIVATE);
44 | return sp.getString(key, defValue);
45 | }
46 |
47 | }
48 |
--------------------------------------------------------------------------------
/Vpedometer/app/src/main/java/com/vincent/vpedometer/utils/StreamUtils.java:
--------------------------------------------------------------------------------
1 | package com.vincent.vpedometer.utils;
2 |
3 | import android.graphics.Bitmap;
4 | import android.graphics.BitmapFactory;
5 |
6 | import java.io.ByteArrayOutputStream;
7 | import java.io.InputStream;
8 |
9 | public class StreamUtils {
10 |
11 |
12 | public static String readStream(InputStream is){
13 | try {
14 | ByteArrayOutputStream baos = new ByteArrayOutputStream();
15 | byte[] buffer = new byte[1024];
16 | int len = 0;
17 | while(( len = is.read(buffer))!=-1){
18 | baos.write(buffer, 0, len);
19 | }
20 | is.close();
21 | String result = baos.toString();
22 |
23 | if(result.contains("gb2312")){
24 | return baos.toString("gb2312");
25 | }else{
26 | return result;
27 | }
28 |
29 | } catch (Exception e) {
30 | e.printStackTrace();
31 | return null;
32 | }
33 | }
34 |
35 | public static Bitmap readBitmap(InputStream is){
36 | return BitmapFactory.decodeStream(is);
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/Vpedometer/app/src/main/res/drawable/bg.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hkvincent/vpeodometer/0a31acd9724a141979c7c35d099f5e401c7e77b6/Vpedometer/app/src/main/res/drawable/bg.png
--------------------------------------------------------------------------------
/Vpedometer/app/src/main/res/drawable/head.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hkvincent/vpeodometer/0a31acd9724a141979c7c35d099f5e401c7e77b6/Vpedometer/app/src/main/res/drawable/head.png
--------------------------------------------------------------------------------
/Vpedometer/app/src/main/res/drawable/ic_blue_round_bg.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hkvincent/vpeodometer/0a31acd9724a141979c7c35d099f5e401c7e77b6/Vpedometer/app/src/main/res/drawable/ic_blue_round_bg.png
--------------------------------------------------------------------------------
/Vpedometer/app/src/main/res/drawable/ic_small_blue_rectangular.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hkvincent/vpeodometer/0a31acd9724a141979c7c35d099f5e401c7e77b6/Vpedometer/app/src/main/res/drawable/ic_small_blue_rectangular.png
--------------------------------------------------------------------------------
/Vpedometer/app/src/main/res/drawable/stronger.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hkvincent/vpeodometer/0a31acd9724a141979c7c35d099f5e401c7e77b6/Vpedometer/app/src/main/res/drawable/stronger.jpeg
--------------------------------------------------------------------------------
/Vpedometer/app/src/main/res/drawable/v.JPG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hkvincent/vpeodometer/0a31acd9724a141979c7c35d099f5e401c7e77b6/Vpedometer/app/src/main/res/drawable/v.JPG
--------------------------------------------------------------------------------
/Vpedometer/app/src/main/res/layout/activity_login.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
14 |
15 |
22 |
23 |
30 |
31 |
37 |
38 |
43 |
44 |
49 |
50 |
51 |
52 |
53 |
59 |
60 |
66 |
67 |
72 |
73 |
--------------------------------------------------------------------------------
/Vpedometer/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/Vpedometer/app/src/main/res/layout/activity_register.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
14 |
15 |
22 |
23 |
30 |
31 |
38 |
39 |
46 |
47 |
53 |
54 |
60 |
61 |
62 |
68 |
69 |
--------------------------------------------------------------------------------
/Vpedometer/app/src/main/res/layout/activity_splash.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
13 |
14 |
--------------------------------------------------------------------------------
/Vpedometer/app/src/main/res/layout/before_or_after_calendar_layout.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/Vpedometer/app/src/main/res/layout/layout_chat.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/Vpedometer/app/src/main/res/layout/layout_gamelist.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
8 |
15 |
16 |
--------------------------------------------------------------------------------
/Vpedometer/app/src/main/res/layout/layout_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
13 |
14 |
21 |
22 |
23 |
28 |
29 |
--------------------------------------------------------------------------------
/Vpedometer/app/src/main/res/layout/layout_map.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
11 |
12 |
16 |
17 |
22 |
23 |
24 |
25 |
32 |
33 |
34 |
--------------------------------------------------------------------------------
/Vpedometer/app/src/main/res/layout/layout_menu.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
16 |
17 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/Vpedometer/app/src/main/res/layout/layout_more.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
10 |
14 |
15 |
--------------------------------------------------------------------------------
/Vpedometer/app/src/main/res/layout/layout_password.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
15 |
16 |
23 |
24 |
31 |
32 |
33 |
40 |
41 |
48 |
49 |
54 |
55 |
--------------------------------------------------------------------------------
/Vpedometer/app/src/main/res/layout/layout_photo.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
18 |
19 |
24 |
25 |
32 |
33 |
--------------------------------------------------------------------------------
/Vpedometer/app/src/main/res/layout/records_calender_item_view.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
11 |
12 |
20 |
21 |
28 |
29 |
35 |
36 |
42 |
43 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
--------------------------------------------------------------------------------
/Vpedometer/app/src/main/res/menu/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/Vpedometer/app/src/main/res/mipmap-hdpi/ic_blue_round_bg.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hkvincent/vpeodometer/0a31acd9724a141979c7c35d099f5e401c7e77b6/Vpedometer/app/src/main/res/mipmap-hdpi/ic_blue_round_bg.png
--------------------------------------------------------------------------------
/Vpedometer/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hkvincent/vpeodometer/0a31acd9724a141979c7c35d099f5e401c7e77b6/Vpedometer/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/Vpedometer/app/src/main/res/mipmap-hdpi/ic_small_blue_rectangular.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hkvincent/vpeodometer/0a31acd9724a141979c7c35d099f5e401c7e77b6/Vpedometer/app/src/main/res/mipmap-hdpi/ic_small_blue_rectangular.png
--------------------------------------------------------------------------------
/Vpedometer/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hkvincent/vpeodometer/0a31acd9724a141979c7c35d099f5e401c7e77b6/Vpedometer/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/Vpedometer/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hkvincent/vpeodometer/0a31acd9724a141979c7c35d099f5e401c7e77b6/Vpedometer/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/Vpedometer/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hkvincent/vpeodometer/0a31acd9724a141979c7c35d099f5e401c7e77b6/Vpedometer/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/Vpedometer/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hkvincent/vpeodometer/0a31acd9724a141979c7c35d099f5e401c7e77b6/Vpedometer/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/Vpedometer/app/src/main/res/raw/day.mp3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hkvincent/vpeodometer/0a31acd9724a141979c7c35d099f5e401c7e77b6/Vpedometer/app/src/main/res/raw/day.mp3
--------------------------------------------------------------------------------
/Vpedometer/app/src/main/res/raw/start.mp3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hkvincent/vpeodometer/0a31acd9724a141979c7c35d099f5e401c7e77b6/Vpedometer/app/src/main/res/raw/start.mp3
--------------------------------------------------------------------------------
/Vpedometer/app/src/main/res/values-w820dp/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 64dp
6 |
7 |
--------------------------------------------------------------------------------
/Vpedometer/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #3F51B5
4 | #303F9F
5 | #FF4081
6 | #FFFFFF
7 | #000000
8 | #44CDC5
9 | #333333
10 | #666666
11 |
12 |
--------------------------------------------------------------------------------
/Vpedometer/app/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 16dp
4 | 16dp
5 |
6 |
--------------------------------------------------------------------------------
/Vpedometer/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | Vpedometer
3 |
4 |
--------------------------------------------------------------------------------
/Vpedometer/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/Vpedometer/app/src/test/java/com/vincent/vpedometer/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.vincent.vpedometer;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.*;
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * @see Testing documentation
11 | */
12 | public class ExampleUnitTest {
13 | @Test
14 | public void addition_isCorrect() throws Exception {
15 | assertEquals(4, 2 + 2);
16 | }
17 | }
--------------------------------------------------------------------------------
/Vpedometer/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 | mavenCentral()
6 | jcenter()
7 |
8 | }
9 | dependencies {
10 | classpath 'com.android.tools.build:gradle:2.2.2'
11 |
12 | // NOTE: Do not place your application dependencies here; they belong
13 | // in the individual module build.gradle files
14 | }
15 | }
16 |
17 | allprojects {
18 | repositories {
19 | mavenCentral()
20 | jcenter()
21 | maven {
22 | url 'https://maven.google.com'
23 | }
24 | maven {
25 | url 'https://oss.sonatype.org/content/repositories/snapshots'
26 | }
27 |
28 |
29 | }
30 | }
31 |
32 | task clean(type: Delete) {
33 | delete rootProject.buildDir
34 | }
35 |
--------------------------------------------------------------------------------
/Vpedometer/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 |
--------------------------------------------------------------------------------
/Vpedometer/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hkvincent/vpeodometer/0a31acd9724a141979c7c35d099f5e401c7e77b6/Vpedometer/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/Vpedometer/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Mon Dec 28 10:00:20 PST 2015
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-2.14.1-all.zip
7 |
--------------------------------------------------------------------------------
/Vpedometer/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 |
--------------------------------------------------------------------------------
/Vpedometer/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
--------------------------------------------------------------------------------
/pedometerserver/.classpath:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/pedometerserver/.mymetadata:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/pedometerserver/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | pedometerserver
4 |
5 |
6 |
7 |
8 |
9 | org.eclipse.wst.common.project.facet.core.builder
10 |
11 |
12 |
13 |
14 | org.eclipse.wst.jsdt.core.javascriptValidator
15 |
16 |
17 |
18 |
19 | com.genuitec.eclipse.j2eedt.core.WebClasspathBuilder
20 |
21 |
22 |
23 |
24 | org.eclipse.jdt.core.javabuilder
25 |
26 |
27 |
28 |
29 | com.genuitec.eclipse.j2eedt.core.J2EEProjectValidator
30 |
31 |
32 |
33 |
34 | com.genuitec.eclipse.j2eedt.core.DeploymentDescriptorValidator
35 |
36 |
37 |
38 |
39 | org.eclipse.wst.validation.validationbuilder
40 |
41 |
42 |
43 |
44 | com.genuitec.eclipse.ast.deploy.core.DeploymentBuilder
45 |
46 |
47 |
48 |
49 |
50 | com.genuitec.eclipse.ast.deploy.core.deploymentnature
51 | org.eclipse.jem.workbench.JavaEMFNature
52 | com.genuitec.eclipse.j2eedt.core.webnature
53 | org.eclipse.jdt.core.javanature
54 | org.eclipse.wst.jsdt.core.jsNature
55 | org.eclipse.wst.common.project.facet.core.nature
56 | org.eclipse.wst.common.modulecore.ModuleCoreNature
57 |
58 |
59 |
--------------------------------------------------------------------------------
/pedometerserver/.settings/.jsdtscope:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/pedometerserver/.settings/org.eclipse.jdt.core.prefs:
--------------------------------------------------------------------------------
1 | eclipse.preferences.version=1
2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
4 | org.eclipse.jdt.core.compiler.compliance=1.6
5 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
6 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
7 | org.eclipse.jdt.core.compiler.source=1.6
8 |
--------------------------------------------------------------------------------
/pedometerserver/.settings/org.eclipse.wst.common.component:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/pedometerserver/.settings/org.eclipse.wst.common.project.facet.core.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/pedometerserver/.settings/org.eclipse.wst.jsdt.ui.superType.container:
--------------------------------------------------------------------------------
1 | org.eclipse.wst.jsdt.launching.baseBrowserLibrary
--------------------------------------------------------------------------------
/pedometerserver/.settings/org.eclipse.wst.jsdt.ui.superType.name:
--------------------------------------------------------------------------------
1 | Window
--------------------------------------------------------------------------------
/pedometerserver/WebRoot/META-INF/MANIFEST.MF:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 | Class-Path:
3 |
4 |
--------------------------------------------------------------------------------
/pedometerserver/WebRoot/WEB-INF/classes/c3p0-config.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | jdbc:mysql://47.74.150.98:3306/pedometer?useUnicode=true&characterEncoding=UTF8
7 |
8 | com.mysql.jdbc.Driver
9 | root
10 | vincent
11 |
12 | 3
13 | 10
14 | 2
15 | 10
16 |
17 | 18000
18 |
19 |
20 |
21 |
22 | jdbc:mysql://localhost:3306/mydb1
23 | com.mysql.jdbc.Driver
24 | root
25 | 123
26 | 3
27 | 10
28 | 2
29 | 10
30 |
31 |
32 |
--------------------------------------------------------------------------------
/pedometerserver/WebRoot/WEB-INF/classes/vincent/chan/dao/RoleDao.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hkvincent/vpeodometer/0a31acd9724a141979c7c35d099f5e401c7e77b6/pedometerserver/WebRoot/WEB-INF/classes/vincent/chan/dao/RoleDao.class
--------------------------------------------------------------------------------
/pedometerserver/WebRoot/WEB-INF/classes/vincent/chan/dao/UserDao.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hkvincent/vpeodometer/0a31acd9724a141979c7c35d099f5e401c7e77b6/pedometerserver/WebRoot/WEB-INF/classes/vincent/chan/dao/UserDao.class
--------------------------------------------------------------------------------
/pedometerserver/WebRoot/WEB-INF/classes/vincent/chan/pojo/Role.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hkvincent/vpeodometer/0a31acd9724a141979c7c35d099f5e401c7e77b6/pedometerserver/WebRoot/WEB-INF/classes/vincent/chan/pojo/Role.class
--------------------------------------------------------------------------------
/pedometerserver/WebRoot/WEB-INF/classes/vincent/chan/pojo/User.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hkvincent/vpeodometer/0a31acd9724a141979c7c35d099f5e401c7e77b6/pedometerserver/WebRoot/WEB-INF/classes/vincent/chan/pojo/User.class
--------------------------------------------------------------------------------
/pedometerserver/WebRoot/WEB-INF/classes/vincent/chan/services/RoleService.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hkvincent/vpeodometer/0a31acd9724a141979c7c35d099f5e401c7e77b6/pedometerserver/WebRoot/WEB-INF/classes/vincent/chan/services/RoleService.class
--------------------------------------------------------------------------------
/pedometerserver/WebRoot/WEB-INF/classes/vincent/chan/services/UserService.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hkvincent/vpeodometer/0a31acd9724a141979c7c35d099f5e401c7e77b6/pedometerserver/WebRoot/WEB-INF/classes/vincent/chan/services/UserService.class
--------------------------------------------------------------------------------
/pedometerserver/WebRoot/WEB-INF/classes/vincent/chan/servlet/RoleServlet.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hkvincent/vpeodometer/0a31acd9724a141979c7c35d099f5e401c7e77b6/pedometerserver/WebRoot/WEB-INF/classes/vincent/chan/servlet/RoleServlet.class
--------------------------------------------------------------------------------
/pedometerserver/WebRoot/WEB-INF/classes/vincent/chan/servlet/UserServlet.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hkvincent/vpeodometer/0a31acd9724a141979c7c35d099f5e401c7e77b6/pedometerserver/WebRoot/WEB-INF/classes/vincent/chan/servlet/UserServlet.class
--------------------------------------------------------------------------------
/pedometerserver/WebRoot/WEB-INF/classes/vincent/chan/utils/Tool.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hkvincent/vpeodometer/0a31acd9724a141979c7c35d099f5e401c7e77b6/pedometerserver/WebRoot/WEB-INF/classes/vincent/chan/utils/Tool.class
--------------------------------------------------------------------------------
/pedometerserver/WebRoot/WEB-INF/lib/activation.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hkvincent/vpeodometer/0a31acd9724a141979c7c35d099f5e401c7e77b6/pedometerserver/WebRoot/WEB-INF/lib/activation.jar
--------------------------------------------------------------------------------
/pedometerserver/WebRoot/WEB-INF/lib/c3p0-0.9.2-pre1.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hkvincent/vpeodometer/0a31acd9724a141979c7c35d099f5e401c7e77b6/pedometerserver/WebRoot/WEB-INF/lib/c3p0-0.9.2-pre1.jar
--------------------------------------------------------------------------------
/pedometerserver/WebRoot/WEB-INF/lib/c3p0-oracle-thin-extras-0.9.2-pre1.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hkvincent/vpeodometer/0a31acd9724a141979c7c35d099f5e401c7e77b6/pedometerserver/WebRoot/WEB-INF/lib/c3p0-oracle-thin-extras-0.9.2-pre1.jar
--------------------------------------------------------------------------------
/pedometerserver/WebRoot/WEB-INF/lib/commons-beanutils-1.8.3.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hkvincent/vpeodometer/0a31acd9724a141979c7c35d099f5e401c7e77b6/pedometerserver/WebRoot/WEB-INF/lib/commons-beanutils-1.8.3.jar
--------------------------------------------------------------------------------
/pedometerserver/WebRoot/WEB-INF/lib/commons-collections-3.2.1.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hkvincent/vpeodometer/0a31acd9724a141979c7c35d099f5e401c7e77b6/pedometerserver/WebRoot/WEB-INF/lib/commons-collections-3.2.1.jar
--------------------------------------------------------------------------------
/pedometerserver/WebRoot/WEB-INF/lib/commons-dbutils-1.4.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hkvincent/vpeodometer/0a31acd9724a141979c7c35d099f5e401c7e77b6/pedometerserver/WebRoot/WEB-INF/lib/commons-dbutils-1.4.jar
--------------------------------------------------------------------------------
/pedometerserver/WebRoot/WEB-INF/lib/commons-fileupload-1.3.1.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hkvincent/vpeodometer/0a31acd9724a141979c7c35d099f5e401c7e77b6/pedometerserver/WebRoot/WEB-INF/lib/commons-fileupload-1.3.1.jar
--------------------------------------------------------------------------------
/pedometerserver/WebRoot/WEB-INF/lib/commons-io-2.4.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hkvincent/vpeodometer/0a31acd9724a141979c7c35d099f5e401c7e77b6/pedometerserver/WebRoot/WEB-INF/lib/commons-io-2.4.jar
--------------------------------------------------------------------------------
/pedometerserver/WebRoot/WEB-INF/lib/commons-lang-2.5.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hkvincent/vpeodometer/0a31acd9724a141979c7c35d099f5e401c7e77b6/pedometerserver/WebRoot/WEB-INF/lib/commons-lang-2.5.jar
--------------------------------------------------------------------------------
/pedometerserver/WebRoot/WEB-INF/lib/commons-logging-1.2.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hkvincent/vpeodometer/0a31acd9724a141979c7c35d099f5e401c7e77b6/pedometerserver/WebRoot/WEB-INF/lib/commons-logging-1.2.jar
--------------------------------------------------------------------------------
/pedometerserver/WebRoot/WEB-INF/lib/ezmorph-1.0.6.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hkvincent/vpeodometer/0a31acd9724a141979c7c35d099f5e401c7e77b6/pedometerserver/WebRoot/WEB-INF/lib/ezmorph-1.0.6.jar
--------------------------------------------------------------------------------
/pedometerserver/WebRoot/WEB-INF/lib/gson-2.3.1.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hkvincent/vpeodometer/0a31acd9724a141979c7c35d099f5e401c7e77b6/pedometerserver/WebRoot/WEB-INF/lib/gson-2.3.1.jar
--------------------------------------------------------------------------------
/pedometerserver/WebRoot/WEB-INF/lib/itcast-tools-1.4.2.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hkvincent/vpeodometer/0a31acd9724a141979c7c35d099f5e401c7e77b6/pedometerserver/WebRoot/WEB-INF/lib/itcast-tools-1.4.2.jar
--------------------------------------------------------------------------------
/pedometerserver/WebRoot/WEB-INF/lib/json-lib-2.4-jdk15.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hkvincent/vpeodometer/0a31acd9724a141979c7c35d099f5e401c7e77b6/pedometerserver/WebRoot/WEB-INF/lib/json-lib-2.4-jdk15.jar
--------------------------------------------------------------------------------
/pedometerserver/WebRoot/WEB-INF/lib/mchange-commons-0.2.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hkvincent/vpeodometer/0a31acd9724a141979c7c35d099f5e401c7e77b6/pedometerserver/WebRoot/WEB-INF/lib/mchange-commons-0.2.jar
--------------------------------------------------------------------------------
/pedometerserver/WebRoot/WEB-INF/lib/mysql-connector-java-5.1.13-bin.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hkvincent/vpeodometer/0a31acd9724a141979c7c35d099f5e401c7e77b6/pedometerserver/WebRoot/WEB-INF/lib/mysql-connector-java-5.1.13-bin.jar
--------------------------------------------------------------------------------
/pedometerserver/WebRoot/WEB-INF/web.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
8 | index.jsp
9 |
10 |
11 |
12 | UserServlet
13 | vincent.chan.servlet.UserServlet
14 |
15 |
16 | UserServlet
17 | /UserServlet
18 |
19 |
20 | RoleServlet
21 | vincent.chan.servlet.RoleServlet
22 |
23 |
24 | RoleServlet
25 | /RoleServlet
26 |
27 |
28 |
--------------------------------------------------------------------------------
/pedometerserver/WebRoot/index.jsp:
--------------------------------------------------------------------------------
1 | <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
2 | <%
3 | String path = request.getContextPath();
4 | String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
5 | %>
6 |
7 |
8 |
9 |
10 |
11 |
12 | My JSP 'index.jsp' starting page
13 |
14 |
15 |
16 |
17 |
18 |
21 |
22 |
23 |
24 | This is my JSP page.
25 |
26 |
27 |
--------------------------------------------------------------------------------
/pedometerserver/src/c3p0-config.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | jdbc:mysql://47.74.150.98:3306/pedometer?useUnicode=true&characterEncoding=UTF8
7 |
8 | com.mysql.jdbc.Driver
9 | xxxx
10 | xxxx
11 |
12 | 3
13 | 10
14 | 2
15 | 10
16 |
17 | 18000
18 |
19 |
20 |
21 |
22 | jdbc:mysql://localhost:3306/mydb1
23 | com.mysql.jdbc.Driver
24 | root
25 | 123
26 | 3
27 | 10
28 | 2
29 | 10
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/pedometerserver/src/vincent/chan/dao/RoleDao.java:
--------------------------------------------------------------------------------
1 | package vincent.chan.dao;
2 |
3 | import java.sql.SQLException;
4 | import java.util.ArrayList;
5 | import java.util.List;
6 | import java.util.Map;
7 |
8 | import org.apache.commons.dbutils.QueryRunner;
9 | import org.apache.commons.dbutils.handlers.BeanHandler;
10 | import org.apache.commons.dbutils.handlers.BeanListHandler;
11 | import org.apache.commons.dbutils.handlers.MapHandler;
12 | import org.apache.commons.dbutils.handlers.MapListHandler;
13 |
14 | import vincent.chan.pojo.Role;
15 | import vincent.chan.pojo.User;
16 |
17 | import cn.itcast.jdbc.TxQueryRunner;
18 |
19 | public class RoleDao {
20 | private QueryRunner qr = new TxQueryRunner();
21 |
22 | public boolean createRole(Role role) throws SQLException {
23 | int reuslt = 0;
24 | String sql = "insert into role(rid,name,level,attack,defend,health_point,magic_point,skill,user_uid) values(?,?,?,?,?,?,?,?,?) ";
25 | Object[] paras = { role.getRid(), role.getName(), role.getLevel(),
26 | role.getAttack(), role.getDefend(), role.getHealthPoint(),
27 | role.getMagicPoint(), role.getSkill(), role.getUserUid() };
28 | reuslt = qr.update(sql, paras);
29 |
30 | return reuslt >= 0 ? true : false;
31 |
32 | }
33 |
34 | public List