├── .gitattributes ├── .gitignore ├── .idea ├── .name ├── compiler.xml ├── copyright │ └── profiles_settings.xml ├── encodings.xml ├── gradle.xml ├── misc.xml ├── modules.xml ├── runConfigurations.xml └── vcs.xml ├── README.md ├── app ├── .gitignore ├── build.gradle ├── libs │ ├── AMap_3DMap_V3.3.1_20160419.jar │ └── AMap_Location_V2.4.1_20160414.jar ├── proguard-rules.pro ├── screenshot │ └── draw.jpg └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── yhy │ │ └── drawtracedemo │ │ └── ApplicationTest.java │ ├── main │ ├── AndroidManifest.xml │ ├── java │ │ └── com │ │ │ └── yhy │ │ │ └── drawtracedemo │ │ │ ├── MainActivity.java │ │ │ ├── activity │ │ │ ├── BaseActivity.java │ │ │ └── DrawTraceActivity.java │ │ │ ├── customview │ │ │ └── CircleImageView.java │ │ │ └── util │ │ │ ├── LogUtil.java │ │ │ └── WalkUtil.java │ ├── jniLibs │ │ ├── arm64-v8a │ │ │ ├── libgdinamapv4sdk752.so │ │ │ ├── libgdinamapv4sdk752ex.so │ │ │ └── libweibosdkcore.so │ │ ├── armeabi-v7a │ │ │ ├── libgdinamapv4sdk752.so │ │ │ ├── libgdinamapv4sdk752ex.so │ │ │ └── libweibosdkcore.so │ │ └── armeabi │ │ │ ├── libgdinamapv4sdk752.so │ │ │ ├── libgdinamapv4sdk752ex.so │ │ │ └── libweibosdkcore.so │ └── res │ │ ├── drawable │ │ └── man_bot.xml │ │ ├── layout │ │ ├── activity_draw_trace.xml │ │ └── activity_main.xml │ │ ├── mipmap-hdpi │ │ └── ic_launcher.png │ │ ├── mipmap-mdpi │ │ └── ic_launcher.png │ │ ├── mipmap-xhdpi │ │ ├── ic_launcher.png │ │ └── location.png │ │ ├── mipmap-xxhdpi │ │ └── ic_launcher.png │ │ ├── mipmap-xxxhdpi │ │ └── ic_launcher.png │ │ ├── values-w820dp │ │ └── dimens.xml │ │ └── values │ │ ├── attr.xml │ │ ├── colors.xml │ │ ├── dimens.xml │ │ ├── strings.xml │ │ └── styles.xml │ └── test │ └── java │ └── com │ └── yhy │ └── drawtracedemo │ └── ExampleUnitTest.java ├── build.gradle ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── screenshot └── draw.jpg └── settings.gradle /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | 4 | # Custom for Visual Studio 5 | *.cs diff=csharp 6 | 7 | # Standard to msysgit 8 | *.doc diff=astextplain 9 | *.DOC diff=astextplain 10 | *.docx diff=astextplain 11 | *.DOCX diff=astextplain 12 | *.dot diff=astextplain 13 | *.DOT diff=astextplain 14 | *.pdf diff=astextplain 15 | *.PDF diff=astextplain 16 | *.rtf diff=astextplain 17 | *.RTF diff=astextplain 18 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/workspace.xml 5 | /.idea/libraries 6 | .DS_Store 7 | /build 8 | /captures 9 | -------------------------------------------------------------------------------- /.idea/.name: -------------------------------------------------------------------------------- 1 | DrawTraceDemo -------------------------------------------------------------------------------- /.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 | -------------------------------------------------------------------------------- /.idea/copyright/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /.idea/encodings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 22 | 23 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 19 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 46 | 47 | 48 | 49 | 50 | 1.8 51 | 52 | 57 | 58 | 59 | 60 | 61 | 62 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /.idea/runConfigurations.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # DrawTraceDemo 2 | 高德地图轨迹回放带定位纠偏加彩虹渐变线 3 | 4 | 5 | 由于高德自身持续定位存在偏移状况,故摒弃了高德自身的定位点,改用自定义marker点作为定位点 6 | 7 | 加注轨迹纠偏函数,根据时间判定此次移动是否合乎标准 8 | 9 | if(currLength<((minusTime+1)/1000)*5){ 10 | // if(currLength<((minusTime+1)/1000)*5||mOver){ 11 | errorCnt = 0; 12 | lastLa = currLa; 13 | lastTime = currTime; 14 | 15 | mBestLat = mLocatinLat; 16 | mBestLon = mLocationLon; 17 | 18 | mCurrentLatLng = new LatLng(mBestLat, mBestLon); 19 | LogUtil.d("yhy 发给轩哥了>>>>>>>>>" + currLength); 20 | mLocationList.add(mCurrentLatLng); 21 | mMarkMyLocation.setPosition(mCurrentLatLng); 22 | DrawRideTraceTotal(); 23 | // lastTime = currTime; 24 | // everyTime = currTime; 25 | }else if(minusTime>=20000){ 26 | 27 | 28 | if(mOver){ 29 | 30 | if(!overLa.equals(currLa)){ 31 | // if(mOverCnt!=mLocationCnt){ 32 | errorCnt = 0; 33 | lastLa = currLa; 34 | lastTime = currTime; 35 | LogUtil.d("确定大于距离,发给服务端>>>>>>>>>" + currLength); 36 | // Toast.makeText(MainActivity.this,"确定大于距离,发给服务端>>>>>>>>>" + currLength,Toast.LENGTH_SHORT).show(); 37 | 38 | 39 | mBestLat = mLocatinLat; 40 | mBestLon = mLocationLon; 41 | 42 | mCurrentLatLng = new LatLng(mBestLat, mBestLon); 43 | mLocationList.add(mCurrentLatLng); 44 | mMarkMyLocation.setPosition(mCurrentLatLng); 45 | DrawRideTraceTotal(); 46 | // lastTime = currTime; 47 | // everyTime = currTime; 48 | mOver = false; 49 | }else { 50 | errorCnt = 0; 51 | // lastLa = currLa; 52 | lastTime = currTime; 53 | mOver = false; 54 | } 55 | }else { 56 | if(currLength>((minusTime+1)/1000)*5){ 57 | mOver = true; 58 | overLa = currLa; 59 | LogUtil.d("yhy 第一次大于距离"+currLength); 60 | // mOverCnt = mLocationCnt; 61 | } 62 | } 63 | } 64 | 65 | 如若连续定位时间超过20秒,则判定为移动,或者连续两次较大偏移,则判断为确定移动 66 | 67 | 68 | 画线采取彩红线条,用户体验更加美观,如果选用高德自身渐变接口,效果并不是很理想,所以自行写渐变函数实现 69 | 70 | 渐变线效果。 71 | 72 | 73 | 程序实现定位实时记录,实时画线,捋通程序,你会发现悦跑圈,咕咚运动,不过如此。 74 | 75 | 我的上架项目遛狗圈地址:http://android.myapp.com/myapp/detail.htm?apkName=com.lbt.staffy.walkthedog 76 | 77 | 78 | 欢迎互相探讨学习。 79 | 80 | ![image](https://github.com/qweyhy/DrawTraceDemo/blob/master/screenshot/draw.jpg) 81 | 82 | 83 | 84 | -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 23 5 | buildToolsVersion "23.0.3" 6 | 7 | defaultConfig { 8 | applicationId "com.yhy.drawtracedemo" 9 | minSdkVersion 15 10 | targetSdkVersion 23 11 | versionCode 1 12 | versionName "1.0" 13 | } 14 | buildTypes { 15 | release { 16 | minifyEnabled false 17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 18 | } 19 | } 20 | } 21 | 22 | dependencies { 23 | compile fileTree(include: ['*.jar'], dir: 'libs') 24 | testCompile 'junit:junit:4.12' 25 | compile 'com.android.support:appcompat-v7:23.2.1' 26 | compile files('libs/AMap_3DMap_V3.3.1_20160419.jar') 27 | } 28 | -------------------------------------------------------------------------------- /app/libs/AMap_3DMap_V3.3.1_20160419.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YangHaoyi/DrawTraceDemo/9bcc508b3540f8b6439bc50b04677ed7b1002726/app/libs/AMap_3DMap_V3.3.1_20160419.jar -------------------------------------------------------------------------------- /app/libs/AMap_Location_V2.4.1_20160414.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YangHaoyi/DrawTraceDemo/9bcc508b3540f8b6439bc50b04677ed7b1002726/app/libs/AMap_Location_V2.4.1_20160414.jar -------------------------------------------------------------------------------- /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 D:\YhyAndroid\Tools\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 | -------------------------------------------------------------------------------- /app/screenshot/draw.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YangHaoyi/DrawTraceDemo/9bcc508b3540f8b6439bc50b04677ed7b1002726/app/screenshot/draw.jpg -------------------------------------------------------------------------------- /app/src/androidTest/java/com/yhy/drawtracedemo/ApplicationTest.java: -------------------------------------------------------------------------------- 1 | package com.yhy.drawtracedemo; 2 | 3 | import android.app.Application; 4 | import android.test.ApplicationTestCase; 5 | 6 | /** 7 | * Testing Fundamentals 8 | */ 9 | public class ApplicationTest extends ApplicationTestCase { 10 | public ApplicationTest() { 11 | super(Application.class); 12 | } 13 | } -------------------------------------------------------------------------------- /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 | 29 | 30 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /app/src/main/java/com/yhy/drawtracedemo/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.yhy.drawtracedemo; 2 | 3 | import android.support.v7.app.AppCompatActivity; 4 | import android.os.Bundle; 5 | 6 | public class MainActivity extends AppCompatActivity { 7 | 8 | @Override 9 | protected void onCreate(Bundle savedInstanceState) { 10 | super.onCreate(savedInstanceState); 11 | setContentView(R.layout.activity_main); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /app/src/main/java/com/yhy/drawtracedemo/activity/BaseActivity.java: -------------------------------------------------------------------------------- 1 | package com.yhy.drawtracedemo.activity; 2 | 3 | import android.support.v4.app.FragmentActivity; 4 | import android.view.View; 5 | 6 | /** 7 | * Created by Administrator on 2016/5/4. 8 | */ 9 | public class BaseActivity extends FragmentActivity { 10 | 11 | @Override 12 | public void setContentView(View view) { 13 | super.setContentView(view); 14 | initView(); 15 | initConfig(); 16 | initData(); 17 | initEvent(); 18 | } 19 | @Override 20 | public void setContentView(int layoutResID) { 21 | super.setContentView(layoutResID); 22 | initView(); 23 | initConfig(); 24 | initData(); 25 | initEvent(); 26 | } 27 | 28 | protected void initView(){ 29 | 30 | } 31 | 32 | //初始化适配相关 33 | protected void initConfig(){ 34 | 35 | } 36 | protected void initData(){ 37 | 38 | } 39 | 40 | protected void initEvent(){ 41 | 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /app/src/main/java/com/yhy/drawtracedemo/activity/DrawTraceActivity.java: -------------------------------------------------------------------------------- 1 | package com.yhy.drawtracedemo.activity; 2 | 3 | import android.app.Activity; 4 | import android.graphics.Bitmap; 5 | import android.graphics.Color; 6 | import android.os.Bundle; 7 | import android.support.annotation.Nullable; 8 | import android.support.v4.app.DialogFragment; 9 | import android.support.v4.app.FragmentActivity; 10 | import android.widget.FrameLayout; 11 | import android.widget.ImageView; 12 | 13 | import com.amap.api.location.AMapLocation; 14 | import com.amap.api.location.AMapLocationClient; 15 | import com.amap.api.location.AMapLocationClientOption; 16 | import com.amap.api.location.AMapLocationListener; 17 | import com.amap.api.maps.AMap; 18 | import com.amap.api.maps.AMapUtils; 19 | import com.amap.api.maps.CameraUpdateFactory; 20 | import com.amap.api.maps.LocationSource; 21 | import com.amap.api.maps.MapView; 22 | import com.amap.api.maps.UiSettings; 23 | import com.amap.api.maps.model.BitmapDescriptor; 24 | import com.amap.api.maps.model.BitmapDescriptorFactory; 25 | import com.amap.api.maps.model.LatLng; 26 | import com.amap.api.maps.model.Marker; 27 | import com.amap.api.maps.model.MarkerOptions; 28 | import com.amap.api.maps.model.MyLocationStyle; 29 | import com.amap.api.maps.model.Polyline; 30 | import com.amap.api.maps.model.PolylineOptions; 31 | import com.yhy.drawtracedemo.R; 32 | import com.yhy.drawtracedemo.util.LogUtil; 33 | import com.yhy.drawtracedemo.util.WalkUtil; 34 | 35 | import java.util.ArrayList; 36 | 37 | /** 38 | * Created by yhy on 2016/5/4. 39 | */ 40 | public class DrawTraceActivity extends BaseActivity implements LocationSource, AMapLocationListener { 41 | 42 | 43 | private static final int LOCATION_TIME_INTERVAL = 4000; 44 | 45 | Bundle mSavedInstanceState; 46 | private AMap aMap; 47 | private MapView mapView; 48 | private UiSettings mUiSettings; 49 | private OnLocationChangedListener mLocationLinstener; 50 | private AMapLocationClient locationClient = null; 51 | private AMapLocationClientOption locationOption = null; 52 | 53 | 54 | private ArrayList mLocationList = new ArrayList(); 55 | 56 | private boolean mIsFirstLocation = true; 57 | private Marker mMarkMyLocation; 58 | private double mLocatinLat; 59 | private double mLocationLon; 60 | private double mBestLat; 61 | private double mBestLon; 62 | private double currLength; 63 | private long lastTime=0; 64 | private long currTime=0; 65 | private int errorCnt = 0; 66 | private long minusTime; 67 | //当前经纬度 68 | private LatLng mCurrentLatLng; 69 | //上次经纬度 70 | private LatLng mLastLatLng; 71 | private LatLng currLa; 72 | private LatLng lastLa = new LatLng(0,0); 73 | private LatLng overLa = new LatLng(0,0); 74 | 75 | 76 | @Override 77 | protected void onCreate(Bundle savedInstanceState) { 78 | super.onCreate(savedInstanceState); 79 | setContentView(R.layout.activity_draw_trace); 80 | // mapView = (MapView) findViewById(R.id.map); 81 | // mapView.onCreate(savedInstanceState);// 此方法必须重写 82 | mSavedInstanceState = savedInstanceState; 83 | 84 | } 85 | 86 | 87 | 88 | @Override 89 | protected void initView() { 90 | super.initView(); 91 | mapView = (MapView) findViewById(R.id.map); 92 | mapView.onCreate(mSavedInstanceState);// 此方法必须重写 93 | if (aMap == null) { 94 | aMap = mapView.getMap(); 95 | aMap.setOnMapLoadedListener(new AMap.OnMapLoadedListener() { 96 | @Override 97 | public void onMapLoaded() { 98 | aMap.setMapType(AMap.MAP_TYPE_NAVI); 99 | setMyLocationStyleIcon(); 100 | // aMap.moveCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(laQuick, loQuick), 17)); 101 | } 102 | }); 103 | 104 | } 105 | mUiSettings = aMap.getUiSettings(); 106 | mUiSettings.setLogoPosition(2);//设置高德地图logo位置 107 | mUiSettings.setZoomControlsEnabled(false); 108 | mUiSettings.setTiltGesturesEnabled(false); 109 | aMap.setLocationSource(this);// 设置定位监听 110 | aMap.setMyLocationEnabled(true); 111 | initLocation(); 112 | 113 | } 114 | 115 | 116 | private void setMyLocationStyleIcon() { 117 | // 自定义系统定位小蓝点 118 | 119 | MyLocationStyle myLocationStyle = new MyLocationStyle(); 120 | ImageView iv = new ImageView(this); 121 | FrameLayout.LayoutParams fmIv = new FrameLayout.LayoutParams(1, 1); 122 | iv.setImageResource(R.mipmap.location); 123 | iv.setLayoutParams(fmIv); 124 | BitmapDescriptor markerIcon = BitmapDescriptorFactory.fromView(iv); 125 | myLocationStyle.myLocationIcon(markerIcon);// 设置小蓝点的图标 126 | myLocationStyle.strokeColor(Color.argb(0, 0, 0, 0));// 设置圆形的边框颜色 127 | myLocationStyle.radiusFillColor(Color.argb(0, 0, 0, 0));// 设置圆形的填充颜色 128 | myLocationStyle.strokeWidth(0f);// 设置圆形的边框粗细 129 | // myLocationStyle. 130 | myLocationStyle.anchor(0.5f, 0.9f); 131 | aMap.setMyLocationStyle(myLocationStyle); 132 | 133 | // aMap.setMyLocationEnabled(true); 134 | //// // 设置定位的类型为 跟随模式 135 | // aMap.setMyLocationType(AMap.MAP_TYPE_NORMAL); 136 | 137 | } 138 | 139 | 140 | private void initLocation() { 141 | 142 | locationClient = new AMapLocationClient(getApplicationContext()); 143 | locationOption = new AMapLocationClientOption(); 144 | 145 | // 设置定位模式为高精度模式 146 | locationOption.setLocationMode(AMapLocationClientOption.AMapLocationMode.Hight_Accuracy); 147 | //设置是否返回地址信息(默认返回地址信息) 148 | locationOption.setNeedAddress(true); 149 | // 设置定位监听 150 | locationClient.setLocationListener(this); 151 | //每两秒定位一次 152 | locationOption.setInterval(LOCATION_TIME_INTERVAL); 153 | locationOption.setOnceLocation(false); 154 | // 设置定位参数 155 | locationClient.setLocationOption(locationOption); 156 | // 启动定位 157 | locationClient.startLocation(); 158 | 159 | } 160 | 161 | @Override 162 | public void activate(OnLocationChangedListener onLocationChangedListener) { 163 | mLocationLinstener = onLocationChangedListener; 164 | } 165 | 166 | @Override 167 | public void deactivate() { 168 | mLocationLinstener = null; 169 | } 170 | 171 | @Override 172 | public void onLocationChanged(AMapLocation aMapLocation) { 173 | if (aMapLocation != null) { 174 | if (aMapLocation != null 175 | && aMapLocation.getErrorCode() == 0) { 176 | 177 | if (mLocationLinstener != null) { 178 | mLocationLinstener.onLocationChanged(aMapLocation);// 显示系统小蓝点 179 | } 180 | mLocatinLat = aMapLocation.getLatitude(); 181 | mLocationLon = aMapLocation.getLongitude(); 182 | 183 | if (mIsFirstLocation) { 184 | mIsFirstLocation = false; 185 | // aMap.moveCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(mLocatinLat, mLocationLon), 17)); 186 | setMyStopLoca(new LatLng(mLocatinLat, mLocationLon)); 187 | //// setMyLocationStyleIcon(); 188 | //// aMap.moveCamera(CameraUpdateFactory.changeLatLng(new LatLng(latitude, longitude))); 189 | // setMyStopLoca(new LatLng(latitude, longitude)); 190 | // 191 | mLocationList.add(new LatLng(mLocatinLat, mLocationLon)); 192 | // mTrueLat = latitude; 193 | // mTrueLon = longitude; 194 | // 195 | // mSendLat = latitude; 196 | // mSendLon = longitude; 197 | // 198 | // 199 | // mCenterLat = latitude; 200 | // mCenterLon = longitude; 201 | } else { 202 | // 203 | if (mLastLatLng == null) { 204 | mLastLatLng = new LatLng(mLocatinLat, mLocationLon); 205 | }else { 206 | findBest(); 207 | } 208 | } 209 | 210 | } 211 | } else { 212 | //显示错误信息ErrCode是错误码,errInfo是错误信息,详见错误码表。 213 | // LogUtil.d("location Error, ErrCode:" 214 | // + aMapLocation.getErrorCode() + ", errInfo:" 215 | // + aMapLocation.getErrorInfo()); 216 | } 217 | } 218 | 219 | 220 | private void setMyStopLoca(final LatLng latlng) { 221 | aMap.moveCamera(CameraUpdateFactory.newLatLngZoom(latlng, 17f)); 222 | 223 | if(mMarkMyLocation!=null){ 224 | mMarkMyLocation.destroy(); 225 | mMarkMyLocation = null; 226 | } 227 | 228 | 229 | if (mMarkMyLocation == null) { 230 | final MarkerOptions markerOptions = new MarkerOptions(); 231 | //markerOptions.snippet(dogId); 232 | // 设置Marker点击之后显示的标题 233 | markerOptions.setFlat(false); 234 | markerOptions.anchor(0.5f, 0.7f); 235 | markerOptions.zIndex(25); 236 | markerOptions.zIndex(90); 237 | ImageView iv = new ImageView(this); 238 | FrameLayout.LayoutParams fmIv = new FrameLayout.LayoutParams(100, 100); 239 | iv.setImageResource(R.mipmap.location); 240 | iv.setLayoutParams(fmIv); 241 | BitmapDescriptor markerIcon = BitmapDescriptorFactory.fromView(iv); 242 | markerOptions.icon(markerIcon); 243 | markerOptions.position(latlng); 244 | mMarkMyLocation = aMap.addMarker(markerOptions); 245 | 246 | }else { 247 | mMarkMyLocation.setPosition(latlng); 248 | } 249 | } 250 | 251 | 252 | private Polyline TotalLine; 253 | private void DrawRideTraceTotal(){ 254 | if(TotalLine!=null){ 255 | TotalLine.remove(); 256 | TotalLine = null; 257 | } 258 | PolylineOptions polylineOptions=new PolylineOptions(); 259 | polylineOptions.addAll(mLocationList); 260 | polylineOptions.visible(true).width(30).zIndex(200); 261 | // 加入对应的颜色,使用colorValues 即表示使用多颜色,使用color表示使用单色线 262 | polylineOptions.colorValues(WalkUtil.getColorList(mLocationList.size()/144+1,this)); 263 | //加上这个属性,表示使用渐变线 264 | // polylineOptions.useGradient(true); 265 | TotalLine = aMap.addPolyline(polylineOptions); 266 | } 267 | private boolean mOver = false; 268 | private void findBest(){ 269 | 270 | currLa = new LatLng(mLocatinLat,mLocationLon); 271 | 272 | currTime = System.currentTimeMillis(); 273 | LogUtil.d("test walk la is"+currLa+""); 274 | LogUtil.d("test walk last is"+lastLa+""); 275 | String move; 276 | // if(mIsMove){ 277 | // move = "move中"; 278 | // }else { 279 | // move = "臭不要脸的静止中"; 280 | // } 281 | 282 | // LogUtil.d("yhy 位置来啦,给不给轩哥发?位置是"+ currLa.toString()+"但是"+move); 283 | // MyToast.showMsg(MainActivity.this, "位置来啦,给不给轩哥发?位置是" + currLa.toString()); 284 | currLength = AMapUtils.calculateLineDistance( 285 | lastLa, currLa); 286 | //TODO 传感器检测 287 | // if(mIsMove){ 288 | if(!lastLa.equals(currLa)){ 289 | // LogUtil.d("yhy 发给轩哥了"); 290 | // 291 | minusTime = currTime-lastTime; 292 | // if(minusTime>=20000&&!firstOverTime){ 293 | // firstOverTime = true; 294 | // overTimeLat = currLa; 295 | //// if(overLength>((minusTime+1)/1000)*5){ 296 | //// mOver = true; 297 | //// } 298 | // }else if(minusTime>=20000){ 299 | // overLength = AMapUtils.calculateLineDistance( 300 | // overTimeLat, currLa); 301 | // if(overLength<=20){ 302 | // mOver = true; 303 | // }else { 304 | // lastTime = currTime; 305 | // } 306 | // firstOverTime = false; 307 | // } 308 | 309 | LogUtil.d("yhy time testzzz"+minusTime); 310 | // if(currLength<(errorCnt+1)*5||errorCnt>=20){ 311 | if(currLength<((minusTime+1)/1000)*5){ 312 | // if(currLength<((minusTime+1)/1000)*5||mOver){ 313 | errorCnt = 0; 314 | lastLa = currLa; 315 | lastTime = currTime; 316 | 317 | mBestLat = mLocatinLat; 318 | mBestLon = mLocationLon; 319 | 320 | mCurrentLatLng = new LatLng(mBestLat, mBestLon); 321 | LogUtil.d("yhy 发给轩哥了>>>>>>>>>" + currLength); 322 | mLocationList.add(mCurrentLatLng); 323 | mMarkMyLocation.setPosition(mCurrentLatLng); 324 | DrawRideTraceTotal(); 325 | // lastTime = currTime; 326 | // everyTime = currTime; 327 | }else if(minusTime>=20000){ 328 | 329 | 330 | if(mOver){ 331 | 332 | if(!overLa.equals(currLa)){ 333 | // if(mOverCnt!=mLocationCnt){ 334 | errorCnt = 0; 335 | lastLa = currLa; 336 | lastTime = currTime; 337 | LogUtil.d("yhy 确定大于距离,发给轩哥>>>>>>>>>" + currLength); 338 | // Toast.makeText(MainActivity.this,"确定大于距离,发给轩哥>>>>>>>>>" + currLength,Toast.LENGTH_SHORT).show(); 339 | 340 | 341 | mBestLat = mLocatinLat; 342 | mBestLon = mLocationLon; 343 | 344 | mCurrentLatLng = new LatLng(mBestLat, mBestLon); 345 | mLocationList.add(mCurrentLatLng); 346 | mMarkMyLocation.setPosition(mCurrentLatLng); 347 | DrawRideTraceTotal(); 348 | // lastTime = currTime; 349 | // everyTime = currTime; 350 | mOver = false; 351 | }else { 352 | errorCnt = 0; 353 | // lastLa = currLa; 354 | lastTime = currTime; 355 | mOver = false; 356 | } 357 | }else { 358 | if(currLength>((minusTime+1)/1000)*5){ 359 | mOver = true; 360 | overLa = currLa; 361 | LogUtil.d("yhy 第一次大于距离"+currLength); 362 | // mOverCnt = mLocationCnt; 363 | } 364 | } 365 | 366 | 367 | 368 | } else { 369 | errorCnt++; 370 | LogUtil.d("yhy +++++++++++++++++++++++++++++++++++++++++++++距离太大,是漂移,不发"+currLength+"定位是"+mLocatinLat+"^^^"+mLocationLon); 371 | // Toast.makeText(MainActivity.this,"++++距离太大,是漂移,不发"+currLength,Toast.LENGTH_SHORT).show(); 372 | // everyTime = currTime; 373 | // lastLa = currLa; 374 | // lastTime = currTime; 375 | // currLa = lastLa; 376 | } 377 | 378 | // LogUtil.d("test walk last change is"+lastLa+""); 379 | 380 | 381 | }else { 382 | LogUtil.d("yhy -------------------------------------------------距离太小,没有移动,不发"); 383 | // Toast.makeText(MainActivity.this,"------距离太小,没有移动,不发",Toast.LENGTH_SHORT).show(); 384 | lastTime = currTime; 385 | } 386 | // } 387 | 388 | 389 | 390 | 391 | } 392 | 393 | 394 | 395 | 396 | /** 397 | * 方法必须重写 398 | */ 399 | @Override 400 | protected void onResume() { 401 | super.onResume(); 402 | mapView.onResume(); 403 | } 404 | 405 | /** 406 | * 方法必须重写 407 | */ 408 | @Override 409 | protected void onPause() { 410 | super.onPause(); 411 | mapView.onPause(); 412 | deactivate(); 413 | } 414 | 415 | /** 416 | * 方法必须重写 417 | */ 418 | @Override 419 | protected void onSaveInstanceState(Bundle outState) { 420 | super.onSaveInstanceState(outState); 421 | mapView.onSaveInstanceState(outState); 422 | } 423 | 424 | /** 425 | * 方法必须重写 426 | */ 427 | @Override 428 | protected void onDestroy() { 429 | super.onDestroy(); 430 | mapView.onDestroy(); 431 | if(null !=locationClient ){ 432 | locationClient.onDestroy(); 433 | } 434 | } 435 | 436 | 437 | } 438 | -------------------------------------------------------------------------------- /app/src/main/java/com/yhy/drawtracedemo/customview/CircleImageView.java: -------------------------------------------------------------------------------- 1 | package com.yhy.drawtracedemo.customview; 2 | 3 | import android.content.Context; 4 | import android.content.res.TypedArray; 5 | import android.graphics.Bitmap; 6 | import android.graphics.BitmapShader; 7 | import android.graphics.Canvas; 8 | import android.graphics.Color; 9 | import android.graphics.Matrix; 10 | import android.graphics.Paint; 11 | import android.graphics.RectF; 12 | import android.graphics.Shader; 13 | import android.graphics.drawable.BitmapDrawable; 14 | import android.graphics.drawable.ColorDrawable; 15 | import android.graphics.drawable.Drawable; 16 | import android.net.Uri; 17 | import android.util.AttributeSet; 18 | import android.util.TypedValue; 19 | import android.widget.ImageView; 20 | 21 | import com.yhy.drawtracedemo.R; 22 | 23 | 24 | public class CircleImageView extends ImageView { 25 | 26 | private static final ScaleType SCALE_TYPE = ScaleType.CENTER_CROP; 27 | 28 | private static final Bitmap.Config BITMAP_CONFIG = Bitmap.Config.ARGB_8888; 29 | private static final int COLORDRAWABLE_DIMENSION = 2; 30 | 31 | private static final int DEFAULT_BORDER_WIDTH = 0; 32 | private static final int DEFAULT_BORDER_COLOR = Color.BLACK; 33 | 34 | private final RectF mDrawableRect = new RectF(); 35 | private final RectF mBorderRect = new RectF(); 36 | 37 | private final Matrix mShaderMatrix = new Matrix(); 38 | private final Paint mBitmapPaint = new Paint(); 39 | private final Paint mBorderPaint = new Paint(); 40 | 41 | private int mBorderColor = DEFAULT_BORDER_COLOR; 42 | private int mBorderWidth = DEFAULT_BORDER_WIDTH; 43 | 44 | private Bitmap mBitmap; 45 | private BitmapShader mBitmapShader; 46 | private int mBitmapWidth; 47 | private int mBitmapHeight; 48 | 49 | private float mDrawableRadius; 50 | private float mBorderRadius; 51 | 52 | private boolean mReady; 53 | private boolean mSetupPending; 54 | 55 | //add by staffy start 56 | private Context mContext; 57 | private static final int DEFAULT_INNER_PADDING = 0; //图片的内间距 5 58 | //add by staffy end 59 | 60 | private int mInnerPadding; 61 | 62 | 63 | 64 | public CircleImageView(Context context) { 65 | super(context); 66 | mContext = context; 67 | init(); 68 | } 69 | 70 | public CircleImageView(Context context, AttributeSet attrs) { 71 | this(context, attrs, 0); 72 | } 73 | 74 | public CircleImageView(Context context, AttributeSet attrs, int defStyle) { 75 | super(context, attrs, defStyle); 76 | 77 | TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.CircleImageView, defStyle, 0); 78 | 79 | mBorderWidth = a.getDimensionPixelSize(R.styleable.CircleImageView_border_width, DEFAULT_BORDER_WIDTH); 80 | mBorderColor = a.getColor(R.styleable.CircleImageView_border_color, DEFAULT_BORDER_COLOR); 81 | mInnerPadding = a.getDimensionPixelSize(R.styleable.CircleImageView_inner_padding, DEFAULT_INNER_PADDING); 82 | 83 | a.recycle(); 84 | mContext = context; 85 | init(); 86 | } 87 | 88 | private void init() { 89 | super.setScaleType(SCALE_TYPE); 90 | mReady = true; 91 | 92 | if (mSetupPending) { 93 | setup(); 94 | mSetupPending = false; 95 | } 96 | } 97 | 98 | @Override 99 | public ScaleType getScaleType() { 100 | return SCALE_TYPE; 101 | } 102 | 103 | @Override 104 | public void setScaleType(ScaleType scaleType) { 105 | if (scaleType != SCALE_TYPE) { 106 | throw new IllegalArgumentException(String.format("ScaleType %s not supported.", scaleType)); 107 | } 108 | } 109 | 110 | @Override 111 | public void setAdjustViewBounds(boolean adjustViewBounds) { 112 | if (adjustViewBounds) { 113 | throw new IllegalArgumentException("adjustViewBounds not supported."); 114 | } 115 | } 116 | 117 | @Override 118 | protected void onDraw(Canvas canvas) { 119 | if (getDrawable() == null) { 120 | return; 121 | } 122 | 123 | canvas.drawCircle(getWidth() / 2, getHeight() / 2, mDrawableRadius, mBitmapPaint); 124 | if (mBorderWidth != 0) { 125 | canvas.drawCircle(getWidth() / 2, getHeight() / 2, mBorderRadius, mBorderPaint); 126 | } 127 | } 128 | 129 | @Override 130 | protected void onSizeChanged(int w, int h, int oldw, int oldh) { 131 | super.onSizeChanged(w, h, oldw, oldh); 132 | setup(); 133 | } 134 | 135 | public int getBorderColor() { 136 | return mBorderColor; 137 | } 138 | 139 | public void setBorderColor(int borderColor) { 140 | if (borderColor == mBorderColor) { 141 | return; 142 | } 143 | 144 | mBorderColor = borderColor; 145 | mBorderPaint.setColor(mBorderColor); 146 | invalidate(); 147 | } 148 | 149 | public int getBorderWidth() { 150 | return mBorderWidth; 151 | } 152 | 153 | public void setBorderWidth(int borderWidth) { 154 | if (borderWidth == mBorderWidth) { 155 | return; 156 | } 157 | 158 | mBorderWidth = borderWidth; 159 | setup(); 160 | } 161 | 162 | @Override 163 | public void setImageBitmap(Bitmap bm) { 164 | super.setImageBitmap(bm); 165 | mBitmap = bm; 166 | setup(); 167 | } 168 | 169 | @Override 170 | public void setImageDrawable(Drawable drawable) { 171 | super.setImageDrawable(drawable); 172 | mBitmap = getBitmapFromDrawable(drawable); 173 | setup(); 174 | } 175 | 176 | @Override 177 | public void setImageResource(int resId) { 178 | super.setImageResource(resId); 179 | mBitmap = getBitmapFromDrawable(getDrawable()); 180 | setup(); 181 | } 182 | 183 | @Override 184 | public void setImageURI(Uri uri) { 185 | super.setImageURI(uri); 186 | mBitmap = getBitmapFromDrawable(getDrawable()); 187 | setup(); 188 | } 189 | 190 | private Bitmap getBitmapFromDrawable(Drawable drawable) { 191 | if (drawable == null) { 192 | return null; 193 | } 194 | 195 | if (drawable instanceof BitmapDrawable) { 196 | return ((BitmapDrawable) drawable).getBitmap(); 197 | } 198 | 199 | try { 200 | Bitmap bitmap; 201 | 202 | if (drawable instanceof ColorDrawable) { 203 | bitmap = Bitmap.createBitmap(COLORDRAWABLE_DIMENSION, COLORDRAWABLE_DIMENSION, BITMAP_CONFIG); 204 | } else { 205 | bitmap = Bitmap.createBitmap(drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight(), BITMAP_CONFIG); 206 | } 207 | 208 | Canvas canvas = new Canvas(bitmap); 209 | drawable.setBounds(0, 0, canvas.getWidth(), canvas.getHeight()); 210 | drawable.draw(canvas); 211 | return bitmap; 212 | } catch (OutOfMemoryError e) { 213 | return null; 214 | } 215 | } 216 | 217 | private void setup() { 218 | if (!mReady) { 219 | mSetupPending = true; 220 | return; 221 | } 222 | 223 | if (mBitmap == null) { 224 | return; 225 | } 226 | 227 | mBitmapShader = new BitmapShader(mBitmap, Shader.TileMode.CLAMP, Shader.TileMode.CLAMP); 228 | 229 | mBitmapPaint.setAntiAlias(true); 230 | mBitmapPaint.setShader(mBitmapShader); 231 | 232 | mBorderPaint.setStyle(Paint.Style.STROKE); 233 | mBorderPaint.setAntiAlias(true); 234 | mBorderPaint.setColor(mBorderColor); 235 | mBorderPaint.setStrokeWidth(mBorderWidth); 236 | 237 | mBitmapHeight = mBitmap.getHeight(); 238 | mBitmapWidth = mBitmap.getWidth(); 239 | 240 | mBorderRect.set(0, 0, getWidth(), getHeight()); 241 | mBorderRadius = Math.min((mBorderRect.height() - mBorderWidth) / 2, (mBorderRect.width() - mBorderWidth) / 2); 242 | 243 | mDrawableRect.set(mBorderWidth, mBorderWidth, mBorderRect.width() - mBorderWidth, mBorderRect.height() - mBorderWidth); 244 | mDrawableRadius = Math.min(mDrawableRect.height() / 2, mDrawableRect.width() / 2); 245 | //add by staffy begin 246 | mDrawableRadius -= TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, mInnerPadding, mContext.getResources().getDisplayMetrics()); 247 | //add by staffy end 248 | updateShaderMatrix(); 249 | invalidate(); 250 | } 251 | 252 | private void updateShaderMatrix() { 253 | float scale; 254 | float dx = 0; 255 | float dy = 0; 256 | 257 | mShaderMatrix.set(null); 258 | 259 | if (mBitmapWidth * mDrawableRect.height() > mDrawableRect.width() * mBitmapHeight) { 260 | scale = mDrawableRect.height() / (float) mBitmapHeight; 261 | dx = (mDrawableRect.width() - mBitmapWidth * scale) * 0.5f; 262 | } else { 263 | scale = mDrawableRect.width() / (float) mBitmapWidth; 264 | dy = (mDrawableRect.height() - mBitmapHeight * scale) * 0.5f; 265 | } 266 | 267 | mShaderMatrix.setScale(scale, scale); 268 | mShaderMatrix.postTranslate((int) (dx + 0.5f) + mBorderWidth, (int) (dy + 0.5f) + mBorderWidth); 269 | 270 | mBitmapShader.setLocalMatrix(mShaderMatrix); 271 | } 272 | 273 | } -------------------------------------------------------------------------------- /app/src/main/java/com/yhy/drawtracedemo/util/LogUtil.java: -------------------------------------------------------------------------------- 1 | package com.yhy.drawtracedemo.util; 2 | 3 | import android.util.Log; 4 | 5 | 6 | 7 | public class LogUtil { 8 | 9 | public static void d(String msg){ 10 | if(msg==null){ 11 | return; 12 | } 13 | Log.d("yhy", msg); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /app/src/main/java/com/yhy/drawtracedemo/util/WalkUtil.java: -------------------------------------------------------------------------------- 1 | package com.yhy.drawtracedemo.util; 2 | 3 | import android.content.Context; 4 | 5 | import com.amap.api.maps.model.LatLng; 6 | import com.yhy.drawtracedemo.R; 7 | 8 | 9 | import java.math.RoundingMode; 10 | import java.text.NumberFormat; 11 | import java.util.ArrayList; 12 | import java.util.HashMap; 13 | import java.util.List; 14 | import java.util.Map; 15 | 16 | /** 17 | * Created by Administrator on 2016/3/2. 18 | */ 19 | public class WalkUtil { 20 | 21 | /** 22 | * 算斜率 23 | */ 24 | public static double getSlope(LatLng fromPoint, LatLng toPoint) { 25 | if (toPoint.longitude == fromPoint.longitude) { 26 | return Double.MAX_VALUE; 27 | } 28 | if(toPoint.latitude == fromPoint.latitude){ 29 | return Double.MAX_VALUE; 30 | } 31 | double slope = ((toPoint.latitude - fromPoint.latitude) / (toPoint.longitude - fromPoint.longitude)); 32 | return slope; 33 | } 34 | 35 | /** 36 | * 根据点和斜率算取截距 37 | */ 38 | public static double getInterception(double slope, LatLng point) { 39 | 40 | double interception = point.latitude - slope * point.longitude; 41 | return interception; 42 | } 43 | 44 | /** 45 | * 计算x方向每次移动的距离 46 | */ 47 | public static double getXMoveDistance(double slope,double dis) { 48 | if (slope == Double.MAX_VALUE) { 49 | return dis; 50 | } 51 | return Math.abs((dis * slope) / Math.sqrt(1 + slope * slope)); 52 | } 53 | 54 | 55 | public static List getDifferent(List list1, List list2) 56 | { 57 | Map map = new HashMap(list1.size()); 58 | List diff = new ArrayList(); 59 | List maxList = list1; 60 | List minList = list2; 61 | 62 | for (String string : maxList) 63 | { 64 | map.put(string, 1); 65 | } 66 | 67 | for (String string : minList) 68 | { 69 | Integer cc = map.get(string); 70 | if(cc!=null) 71 | { 72 | map.put(string, ++cc); 73 | continue; 74 | } 75 | } 76 | 77 | for(Map.Entry entry:map.entrySet()) 78 | { 79 | if(entry.getValue()==1) 80 | { 81 | diff.add(entry.getKey()); 82 | } 83 | } 84 | return diff; 85 | } 86 | 87 | 88 | /** 89 | * 使用NumberFormat,保留小数点后两位 90 | */ 91 | public static String formatDouble(double value) { 92 | NumberFormat nf = NumberFormat.getNumberInstance(); 93 | nf.setMaximumFractionDigits(2); 94 | /* 95 | * setMinimumFractionDigits设置成2 96 | * 97 | * 如果不这么做,那么当value的值是100.00的时候返回100 98 | * 99 | * 而不是100.00 100 | */ 101 | nf.setMinimumFractionDigits(2); 102 | nf.setRoundingMode(RoundingMode.HALF_UP); 103 | /* 104 | * 如果想输出的格式用逗号隔开,可以设置成true 105 | */ 106 | nf.setGroupingUsed(false); 107 | return nf.format(value); 108 | } 109 | public static int strToInt(String s){ 110 | int i= Integer.valueOf(s).intValue(); 111 | return i; 112 | } 113 | /** 114 | * 根据两点算取图标转的角度 115 | */ 116 | public static double getAngle(LatLng fromPoint, LatLng toPoint) { 117 | double slope = getSlope(fromPoint, toPoint); 118 | if (slope == Double.MAX_VALUE) { 119 | if (toPoint.latitude > fromPoint.latitude) { 120 | return 0; 121 | } else { 122 | return 180; 123 | } 124 | } 125 | float deltAngle = 0; 126 | if ((toPoint.latitude - fromPoint.latitude) * slope < 0) { 127 | deltAngle = 180; 128 | } 129 | double radio = Math.atan(slope); 130 | double angle = 180 * (radio / Math.PI) + deltAngle - 90; 131 | return angle; 132 | } 133 | 134 | 135 | 136 | 137 | 138 | 139 | public static List getLineColor(Context mContext){ 140 | 141 | List mPolylinesColor = new ArrayList<>(); 142 | 143 | 144 | mPolylinesColor.add(R.color.track_line_1); 145 | mPolylinesColor.add(R.color.track_line_2); 146 | mPolylinesColor.add(R.color.track_line_3); 147 | mPolylinesColor.add(R.color.track_line_4); 148 | mPolylinesColor.add(R.color.track_line_5); 149 | mPolylinesColor.add(R.color.track_line_6); 150 | mPolylinesColor.add(R.color.track_line_7); 151 | mPolylinesColor.add(R.color.track_line_8); 152 | mPolylinesColor.add(R.color.track_line_9); 153 | mPolylinesColor.add(R.color.track_line_10); 154 | 155 | mPolylinesColor.add(R.color.track_line_11); 156 | mPolylinesColor.add(R.color.track_line_12); 157 | mPolylinesColor.add(R.color.track_line_13); 158 | mPolylinesColor.add(R.color.track_line_14); 159 | mPolylinesColor.add(R.color.track_line_15); 160 | mPolylinesColor.add(R.color.track_line_16); 161 | mPolylinesColor.add(R.color.track_line_17); 162 | mPolylinesColor.add(R.color.track_line_18); 163 | mPolylinesColor.add(R.color.track_line_19); 164 | mPolylinesColor.add(R.color.track_line_20); 165 | 166 | mPolylinesColor.add(R.color.track_line_21); 167 | mPolylinesColor.add(R.color.track_line_22); 168 | mPolylinesColor.add(R.color.track_line_23); 169 | mPolylinesColor.add(R.color.track_line_24); 170 | mPolylinesColor.add(R.color.track_line_25); 171 | mPolylinesColor.add(R.color.track_line_26); 172 | mPolylinesColor.add(R.color.track_line_27); 173 | mPolylinesColor.add(R.color.track_line_28); 174 | mPolylinesColor.add(R.color.track_line_29); 175 | mPolylinesColor.add(R.color.track_line_30); 176 | 177 | mPolylinesColor.add(R.color.track_line_31); 178 | mPolylinesColor.add(R.color.track_line_32); 179 | mPolylinesColor.add(R.color.track_line_33); 180 | mPolylinesColor.add(R.color.track_line_34); 181 | mPolylinesColor.add(R.color.track_line_35); 182 | mPolylinesColor.add(R.color.track_line_36); 183 | mPolylinesColor.add(R.color.track_line_37); 184 | mPolylinesColor.add(R.color.track_line_38); 185 | mPolylinesColor.add(R.color.track_line_39); 186 | mPolylinesColor.add(R.color.track_line_40); 187 | 188 | mPolylinesColor.add(R.color.track_line_41); 189 | mPolylinesColor.add(R.color.track_line_42); 190 | mPolylinesColor.add(R.color.track_line_43); 191 | mPolylinesColor.add(R.color.track_line_44); 192 | mPolylinesColor.add(R.color.track_line_45); 193 | mPolylinesColor.add(R.color.track_line_46); 194 | mPolylinesColor.add(R.color.track_line_47); 195 | mPolylinesColor.add(R.color.track_line_48); 196 | mPolylinesColor.add(R.color.track_line_49); 197 | mPolylinesColor.add(R.color.track_line_50); 198 | 199 | mPolylinesColor.add(R.color.track_line_51); 200 | mPolylinesColor.add(R.color.track_line_52); 201 | mPolylinesColor.add(R.color.track_line_53); 202 | mPolylinesColor.add(R.color.track_line_54); 203 | mPolylinesColor.add(R.color.track_line_55); 204 | mPolylinesColor.add(R.color.track_line_56); 205 | mPolylinesColor.add(R.color.track_line_57); 206 | mPolylinesColor.add(R.color.track_line_58); 207 | mPolylinesColor.add(R.color.track_line_59); 208 | mPolylinesColor.add(R.color.track_line_60); 209 | 210 | mPolylinesColor.add(R.color.track_line_61); 211 | mPolylinesColor.add(R.color.track_line_62); 212 | mPolylinesColor.add(R.color.track_line_63); 213 | mPolylinesColor.add(R.color.track_line_64); 214 | mPolylinesColor.add(R.color.track_line_65); 215 | mPolylinesColor.add(R.color.track_line_66); 216 | mPolylinesColor.add(R.color.track_line_67); 217 | mPolylinesColor.add(R.color.track_line_68); 218 | mPolylinesColor.add(R.color.track_line_69); 219 | mPolylinesColor.add(R.color.track_line_70); 220 | 221 | mPolylinesColor.add(R.color.track_line_71); 222 | mPolylinesColor.add(R.color.track_line_72); 223 | mPolylinesColor.add(R.color.track_line_73); 224 | 225 | return mPolylinesColor; 226 | } 227 | 228 | 229 | 230 | 231 | public static List getColorList(int cnt, Context mContext){ 232 | List colorList = new ArrayList(); 233 | 234 | 235 | for(int i=0;i clazz = Class.forName("com.android.internal.R$dimen"); 556 | Object object = clazz.newInstance(); 557 | int height = Integer.parseInt(clazz.getField("status_bar_height").get(object).toString()); 558 | statusHeight = context.getResources().getDimensionPixelSize(height); 559 | } 560 | catch (Exception e){ 561 | e.printStackTrace(); 562 | } 563 | return statusHeight; 564 | } 565 | 566 | 567 | 568 | 569 | 570 | 571 | 572 | 573 | 574 | 575 | 576 | } 577 | -------------------------------------------------------------------------------- /app/src/main/jniLibs/arm64-v8a/libgdinamapv4sdk752.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YangHaoyi/DrawTraceDemo/9bcc508b3540f8b6439bc50b04677ed7b1002726/app/src/main/jniLibs/arm64-v8a/libgdinamapv4sdk752.so -------------------------------------------------------------------------------- /app/src/main/jniLibs/arm64-v8a/libgdinamapv4sdk752ex.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YangHaoyi/DrawTraceDemo/9bcc508b3540f8b6439bc50b04677ed7b1002726/app/src/main/jniLibs/arm64-v8a/libgdinamapv4sdk752ex.so -------------------------------------------------------------------------------- /app/src/main/jniLibs/arm64-v8a/libweibosdkcore.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YangHaoyi/DrawTraceDemo/9bcc508b3540f8b6439bc50b04677ed7b1002726/app/src/main/jniLibs/arm64-v8a/libweibosdkcore.so -------------------------------------------------------------------------------- /app/src/main/jniLibs/armeabi-v7a/libgdinamapv4sdk752.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YangHaoyi/DrawTraceDemo/9bcc508b3540f8b6439bc50b04677ed7b1002726/app/src/main/jniLibs/armeabi-v7a/libgdinamapv4sdk752.so -------------------------------------------------------------------------------- /app/src/main/jniLibs/armeabi-v7a/libgdinamapv4sdk752ex.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YangHaoyi/DrawTraceDemo/9bcc508b3540f8b6439bc50b04677ed7b1002726/app/src/main/jniLibs/armeabi-v7a/libgdinamapv4sdk752ex.so -------------------------------------------------------------------------------- /app/src/main/jniLibs/armeabi-v7a/libweibosdkcore.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YangHaoyi/DrawTraceDemo/9bcc508b3540f8b6439bc50b04677ed7b1002726/app/src/main/jniLibs/armeabi-v7a/libweibosdkcore.so -------------------------------------------------------------------------------- /app/src/main/jniLibs/armeabi/libgdinamapv4sdk752.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YangHaoyi/DrawTraceDemo/9bcc508b3540f8b6439bc50b04677ed7b1002726/app/src/main/jniLibs/armeabi/libgdinamapv4sdk752.so -------------------------------------------------------------------------------- /app/src/main/jniLibs/armeabi/libgdinamapv4sdk752ex.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YangHaoyi/DrawTraceDemo/9bcc508b3540f8b6439bc50b04677ed7b1002726/app/src/main/jniLibs/armeabi/libgdinamapv4sdk752ex.so -------------------------------------------------------------------------------- /app/src/main/jniLibs/armeabi/libweibosdkcore.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YangHaoyi/DrawTraceDemo/9bcc508b3540f8b6439bc50b04677ed7b1002726/app/src/main/jniLibs/armeabi/libweibosdkcore.so -------------------------------------------------------------------------------- /app/src/main/res/drawable/man_bot.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_draw_trace.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 11 | 12 | 16 | 17 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YangHaoyi/DrawTraceDemo/9bcc508b3540f8b6439bc50b04677ed7b1002726/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YangHaoyi/DrawTraceDemo/9bcc508b3540f8b6439bc50b04677ed7b1002726/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YangHaoyi/DrawTraceDemo/9bcc508b3540f8b6439bc50b04677ed7b1002726/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/location.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YangHaoyi/DrawTraceDemo/9bcc508b3540f8b6439bc50b04677ed7b1002726/app/src/main/res/mipmap-xhdpi/location.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YangHaoyi/DrawTraceDemo/9bcc508b3540f8b6439bc50b04677ed7b1002726/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YangHaoyi/DrawTraceDemo/9bcc508b3540f8b6439bc50b04677ed7b1002726/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/values-w820dp/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 64dp 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/values/attr.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #3F51B5 4 | #303F9F 5 | #FF4081 6 | 7 | 8 | 9 | #80FF00 10 | #86FF00 11 | #8CFF00 12 | #92FF00 13 | #98FF00 14 | #9EFF00 15 | #A4FF00 16 | #AAFF00 17 | #B0FF00 18 | #B6FF00 19 | #BCFF00 20 | #C2FF00 21 | #C8FF00 22 | #CEFF00 23 | #D4FF00 24 | #DAFF00 25 | #E0FF00 26 | #E6FF00 27 | #ECFF00 28 | #F2FF00 29 | #F8FF00 30 | #FEFF00 31 | #FFFF00 32 | #FFFF00 33 | #FFFF00 34 | #FFFF00 35 | #FFFF00 36 | #FFFF00 37 | #FFFF00 38 | #FFFF00 39 | #FFFF00 40 | #FFFF00 41 | #FFFF00 42 | #FFFF00 43 | #FFFF00 44 | #FFFF00 45 | #FFFF00 46 | #FFF900 47 | #FFF300 48 | #FFED00 49 | #FFE700 50 | #FFE100 51 | #FFDB00 52 | #FFD500 53 | #FFCF00 54 | #FFC900 55 | #FFC300 56 | #FFBD00 57 | #FFB700 58 | #FFB100 59 | #FFAB00 60 | #FFA500 61 | #FF9F00 62 | #FF9900 63 | #FF9300 64 | #FF8D00 65 | #FF8700 66 | #FF8100 67 | #FF7B00 68 | #FF7500 69 | #FF6F00 70 | #FF6900 71 | #FF6300 72 | #FF5D00 73 | #FF5700 74 | #FF5100 75 | #FF4B00 76 | #FF4500 77 | #FF4000 78 | #FF4000 79 | #FF4000 80 | #FF4000 81 | #FF4000 82 | 83 | 84 | 85 | 86 | 87 | 88 | -------------------------------------------------------------------------------- /app/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16dp 4 | 16dp 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | DrawTraceDemo 3 | 4 | -------------------------------------------------------------------------------- /app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /app/src/test/java/com/yhy/drawtracedemo/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package com.yhy.drawtracedemo; 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 | } -------------------------------------------------------------------------------- /build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | 3 | buildscript { 4 | repositories { 5 | jcenter() 6 | } 7 | dependencies { 8 | classpath 'com.android.tools.build:gradle:2.0.0' 9 | 10 | // NOTE: Do not place your application dependencies here; they belong 11 | // in the individual module build.gradle files 12 | } 13 | } 14 | 15 | allprojects { 16 | repositories { 17 | jcenter() 18 | } 19 | } 20 | 21 | task clean(type: Delete) { 22 | delete rootProject.buildDir 23 | } 24 | -------------------------------------------------------------------------------- /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 | # Default value: -Xmx10248m -XX:MaxPermSize=256m 13 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 14 | 15 | # When configured, Gradle will run in incubating parallel mode. 16 | # This option should only be used with decoupled projects. More details, visit 17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 18 | # org.gradle.parallel=true -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YangHaoyi/DrawTraceDemo/9bcc508b3540f8b6439bc50b04677ed7b1002726/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /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.10-all.zip 7 | -------------------------------------------------------------------------------- /gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ############################################################################## 4 | ## 5 | ## Gradle start up script for UN*X 6 | ## 7 | ############################################################################## 8 | 9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 10 | DEFAULT_JVM_OPTS="" 11 | 12 | APP_NAME="Gradle" 13 | APP_BASE_NAME=`basename "$0"` 14 | 15 | # Use the maximum available, or set MAX_FD != -1 to use that value. 16 | MAX_FD="maximum" 17 | 18 | warn ( ) { 19 | echo "$*" 20 | } 21 | 22 | die ( ) { 23 | echo 24 | echo "$*" 25 | echo 26 | exit 1 27 | } 28 | 29 | # OS specific support (must be 'true' or 'false'). 30 | cygwin=false 31 | msys=false 32 | darwin=false 33 | case "`uname`" in 34 | CYGWIN* ) 35 | cygwin=true 36 | ;; 37 | Darwin* ) 38 | darwin=true 39 | ;; 40 | MINGW* ) 41 | msys=true 42 | ;; 43 | esac 44 | 45 | # Attempt to set APP_HOME 46 | # Resolve links: $0 may be a link 47 | PRG="$0" 48 | # Need this for relative symlinks. 49 | while [ -h "$PRG" ] ; do 50 | ls=`ls -ld "$PRG"` 51 | link=`expr "$ls" : '.*-> \(.*\)$'` 52 | if expr "$link" : '/.*' > /dev/null; then 53 | PRG="$link" 54 | else 55 | PRG=`dirname "$PRG"`"/$link" 56 | fi 57 | done 58 | SAVED="`pwd`" 59 | cd "`dirname \"$PRG\"`/" >/dev/null 60 | APP_HOME="`pwd -P`" 61 | cd "$SAVED" >/dev/null 62 | 63 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 64 | 65 | # Determine the Java command to use to start the JVM. 66 | if [ -n "$JAVA_HOME" ] ; then 67 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 68 | # IBM's JDK on AIX uses strange locations for the executables 69 | JAVACMD="$JAVA_HOME/jre/sh/java" 70 | else 71 | JAVACMD="$JAVA_HOME/bin/java" 72 | fi 73 | if [ ! -x "$JAVACMD" ] ; then 74 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 75 | 76 | Please set the JAVA_HOME variable in your environment to match the 77 | location of your Java installation." 78 | fi 79 | else 80 | JAVACMD="java" 81 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 82 | 83 | Please set the JAVA_HOME variable in your environment to match the 84 | location of your Java installation." 85 | fi 86 | 87 | # Increase the maximum file descriptors if we can. 88 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then 89 | MAX_FD_LIMIT=`ulimit -H -n` 90 | if [ $? -eq 0 ] ; then 91 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 92 | MAX_FD="$MAX_FD_LIMIT" 93 | fi 94 | ulimit -n $MAX_FD 95 | if [ $? -ne 0 ] ; then 96 | warn "Could not set maximum file descriptor limit: $MAX_FD" 97 | fi 98 | else 99 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 100 | fi 101 | fi 102 | 103 | # For Darwin, add options to specify how the application appears in the dock 104 | if $darwin; then 105 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 106 | fi 107 | 108 | # For Cygwin, switch paths to Windows format before running java 109 | if $cygwin ; then 110 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 111 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 112 | JAVACMD=`cygpath --unix "$JAVACMD"` 113 | 114 | # We build the pattern for arguments to be converted via cygpath 115 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 116 | SEP="" 117 | for dir in $ROOTDIRSRAW ; do 118 | ROOTDIRS="$ROOTDIRS$SEP$dir" 119 | SEP="|" 120 | done 121 | OURCYGPATTERN="(^($ROOTDIRS))" 122 | # Add a user-defined pattern to the cygpath arguments 123 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 124 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 125 | fi 126 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 127 | i=0 128 | for arg in "$@" ; do 129 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 130 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 131 | 132 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 133 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 134 | else 135 | eval `echo args$i`="\"$arg\"" 136 | fi 137 | i=$((i+1)) 138 | done 139 | case $i in 140 | (0) set -- ;; 141 | (1) set -- "$args0" ;; 142 | (2) set -- "$args0" "$args1" ;; 143 | (3) set -- "$args0" "$args1" "$args2" ;; 144 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 145 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 146 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 147 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 148 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 149 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 150 | esac 151 | fi 152 | 153 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules 154 | function splitJvmOpts() { 155 | JVM_OPTS=("$@") 156 | } 157 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS 158 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" 159 | 160 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" 161 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /screenshot/draw.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YangHaoyi/DrawTraceDemo/9bcc508b3540f8b6439bc50b04677ed7b1002726/screenshot/draw.jpg -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | --------------------------------------------------------------------------------