Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
R
RatelVirtualLocation
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
open-source
RatelVirtualLocation
Commits
3a135fdd
Commit
3a135fdd
authored
Aug 27, 2020
by
Administrator
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bugfix
parent
727b97c4
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
3 deletions
+17
-3
.gitignore
.gitignore
+2
-0
MainActivity.java
...top/littlerich/virtuallocation/activity/MainActivity.java
+15
-3
No files found.
.gitignore
View file @
3a135fdd
...
...
@@ -7,3 +7,5 @@ build/
/captures
.externalNativeBuild
.cxx
*.apk
ratelConfig.properties
\ No newline at end of file
app/src/main/java/top/littlerich/virtuallocation/activity/MainActivity.java
View file @
3a135fdd
...
...
@@ -71,7 +71,7 @@ public class MainActivity extends BaseActivity implements View.OnClickListener {
private
MapView
mMapView
;
private
static
BaiduMap
mBaiduMap
;
// 初始化全局 bitmap 信息,不用时及时 recycle
private
BitmapDescriptor
bd
=
BitmapDescriptorFactory
.
fromResource
(
R
.
mipmap
.
icon_gcoding
);
private
BitmapDescriptor
bd
=
null
;
//=
BitmapDescriptorFactory.fromResource(R.mipmap.icon_gcoding);
private
static
Marker
mMarker
;
private
static
LatLng
curLatlng
;
private
static
GeoCoder
mSearch
;
...
...
@@ -97,6 +97,11 @@ public class MainActivity extends BaseActivity implements View.OnClickListener {
Manifest
.
permission
.
WRITE_EXTERNAL_STORAGE
,
Manifest
.
permission
.
ACCESS_FINE_LOCATION
},
99
);
if
(
PermissionUtil
.
checkPermission
(
this
,
Manifest
.
permission
.
ACCESS_FINE_LOCATION
)
==
PackageManager
.
PERMISSION_GRANTED
)
{
bd
=
BitmapDescriptorFactory
.
fromResource
(
R
.
mipmap
.
icon_gcoding
);
}
super
.
onCreate
(
savedInstanceState
);
}
...
...
@@ -107,6 +112,8 @@ public class MainActivity extends BaseActivity implements View.OnClickListener {
// 在使用 SDK 各组间之前初始化 context 信息,传入 ApplicationContext
SDKInitializer
.
initialize
(
getApplicationContext
());
SDKInitializer
.
setCoordType
(
CoordType
.
GCJ02
);
bd
=
BitmapDescriptorFactory
.
fromResource
(
R
.
mipmap
.
icon_gcoding
);
initOverlay
();
}
else
{
Toast
.
makeText
(
this
,
"没有权限,无法工作"
,
Toast
.
LENGTH_SHORT
).
show
();
}
...
...
@@ -244,7 +251,10 @@ public class MainActivity extends BaseActivity implements View.OnClickListener {
mBaiduMap
.
setMyLocationConfigeration
(
new
MyLocationConfiguration
(
mCurrentMode
,
true
,
mCurrentMarker
));
mLocClient
.
setLocOption
(
option
);
initOverlay
();
if
(
PermissionUtil
.
checkPermission
(
this
,
Manifest
.
permission
.
ACCESS_FINE_LOCATION
)
==
PackageManager
.
PERMISSION_GRANTED
)
{
initOverlay
();
}
}
...
...
@@ -352,7 +362,9 @@ public class MainActivity extends BaseActivity implements View.OnClickListener {
mBaiduMap
.
setMyLocationEnabled
(
false
);
mMapView
.
onDestroy
();
mMapView
=
null
;
bd
.
recycle
();
if
(
bd
!=
null
)
{
bd
.
recycle
();
}
mSearch
.
destroy
();
super
.
onDestroy
();
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment