Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Sign in / Register
Toggle navigation
L
location share white
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
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wanglei
location share white
Commits
ba3f81d7
Commit
ba3f81d7
authored
Oct 30, 2024
by
wanglei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
...
parent
dc3983ed
Show whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
189 additions
and
127 deletions
+189
-127
BpUtils.kt
...main/java/com/base/locationsharewhite/location/BpUtils.kt
+29
-0
LocationLoginUtils.kt
...om/base/locationsharewhite/location/LocationLoginUtils.kt
+2
-13
LocationNameUtils.kt
...com/base/locationsharewhite/location/LocationNameUtils.kt
+1
-13
LocationPositionUtils.kt
...base/locationsharewhite/location/LocationPositionUtils.kt
+4
-22
LocationShareListUtils.kt
...ase/locationsharewhite/location/LocationShareListUtils.kt
+43
-13
LocationShareUtils.kt
...om/base/locationsharewhite/location/LocationShareUtils.kt
+1
-13
LocationStatusUtils.kt
...m/base/locationsharewhite/location/LocationStatusUtils.kt
+1
-10
LocationMapActivity.kt
.../locationsharewhite/ui/locationmap/LocationMapActivity.kt
+76
-37
LocationShareActivity.kt
.../base/locationsharewhite/ui/main/LocationShareActivity.kt
+10
-0
ViewerAdapter.kt
...java/com/base/locationsharewhite/ui/main/ViewerAdapter.kt
+5
-2
DialogView.kt
...n/java/com/base/locationsharewhite/ui/views/DialogView.kt
+12
-1
bg_stroke_03b988_15.xml
app/src/main/res/drawable/bg_stroke_03b988_15.xml
+1
-1
dialog_map_type.xml
app/src/main/res/layout/dialog_map_type.xml
+2
-2
dialog_viewer_more.xml
app/src/main/res/layout/dialog_viewer_more.xml
+2
-0
No files found.
app/src/main/java/com/base/locationsharewhite/location/BpUtils.kt
0 → 100644
View file @
ba3f81d7
package
com.base.locationsharewhite.location
import
android.os.Build
import
com.base.locationsharewhite.BuildConfig
import
com.base.locationsharewhite.helper.ConfigHelper
import
com.base.locationsharewhite.utils.AppPreferences
import
org.json.JSONObject
object
BpUtils
{
fun
getBp
():
JSONObject
{
val
pkg
=
ConfigHelper
.
packageName
val
bp
=
JSONObject
()
// .put("${pkg}_1", "")
.
put
(
"${pkg}_5"
,
Build
.
VERSION
.
SDK_INT
)
.
put
(
"${pkg}_8"
,
BuildConfig
.
VERSION_NAME
)
.
put
(
"${pkg}_9"
,
AppPreferences
.
getInstance
().
getString
(
"uuid"
,
""
))
.
put
(
"${pkg}_10"
,
AppPreferences
.
getInstance
().
getString
(
"uuid"
,
""
))
//gid
.
put
(
"${pkg}_13"
,
"android"
)
.
put
(
"${pkg}_14"
,
BuildConfig
.
VERSION_CODE
)
.
put
(
"${pkg}_15"
,
"google"
)
.
put
(
"${pkg}_24"
,
BuildConfig
.
BUILD_TYPE
)
return
bp
}
}
\ No newline at end of file
app/src/main/java/com/base/locationsharewhite/location/LocationLoginUtils.kt
View file @
ba3f81d7
package
com.base.locationsharewhite.location
import
android.os.Build
import
com.base.locationsharewhite.BuildConfig
import
com.base.locationsharewhite.helper.AESHelper
import
com.base.locationsharewhite.helper.ConfigHelper
import
com.base.locationsharewhite.helper.ReportUtils.doPost
...
...
@@ -45,21 +43,12 @@ object LocationLoginUtils {
fun
login
(
name
:
String
?
=
null
)
{
Thread
{
val
pkg
=
ConfigHelper
.
packageName
val
data
=
JSONObject
()
name
?.
let
{
data
.
put
(
"nickName"
,
it
)
}
val
bp
=
JSONObject
()
// .put("${pkg}_1", "")
.
put
(
"${pkg}_5"
,
Build
.
VERSION
.
SDK_INT
)
.
put
(
"${pkg}_8"
,
BuildConfig
.
VERSION_NAME
)
.
put
(
"${pkg}_9"
,
AppPreferences
.
getInstance
().
getString
(
"uuid"
,
""
))
.
put
(
"${pkg}_10"
,
AppPreferences
.
getInstance
().
getString
(
"uuid"
,
""
))
//gid
.
put
(
"${pkg}_13"
,
"android"
)
.
put
(
"${pkg}_14"
,
BuildConfig
.
VERSION_CODE
)
.
put
(
"${pkg}_15"
,
"google"
)
.
put
(
"${pkg}_24"
,
BuildConfig
.
BUILD_TYPE
)
val
bp
=
BpUtils
.
getBp
()
LogEx
.
logDebug
(
TAG
,
"uuid=${AppPreferences.getInstance().getString("
uuid
", "")}"
)
val
body
=
JSONObject
()
.
put
(
"data"
,
data
)
...
...
app/src/main/java/com/base/locationsharewhite/location/LocationNameUtils.kt
View file @
ba3f81d7
package
com.base.locationsharewhite.location
import
android.os.Build
import
com.base.locationsharewhite.BuildConfig
import
com.base.locationsharewhite.helper.AESHelper
import
com.base.locationsharewhite.helper.ConfigHelper
import
com.base.locationsharewhite.helper.ReportUtils
import
com.base.locationsharewhite.utils.AppPreferences
import
com.base.locationsharewhite.utils.LogEx
import
org.json.JSONObject
...
...
@@ -27,16 +24,7 @@ object LocationNameUtils {
val
data
=
JSONObject
()
data
.
put
(
"nickName"
,
nickname
)
val
bp
=
JSONObject
()
// .put("${pkg}_1", "")
.
put
(
"${pkg}_5"
,
Build
.
VERSION
.
SDK_INT
)
.
put
(
"${pkg}_8"
,
BuildConfig
.
VERSION_NAME
)
.
put
(
"${pkg}_9"
,
AppPreferences
.
getInstance
().
getString
(
"uuid"
,
""
))
.
put
(
"${pkg}_10"
,
AppPreferences
.
getInstance
().
getString
(
"uuid"
,
""
))
//gid
.
put
(
"${pkg}_13"
,
"android"
)
.
put
(
"${pkg}_14"
,
BuildConfig
.
VERSION_CODE
)
.
put
(
"${pkg}_15"
,
"google"
)
.
put
(
"${pkg}_24"
,
BuildConfig
.
BUILD_TYPE
)
val
bp
=
BpUtils
.
getBp
()
val
body
=
JSONObject
()
.
put
(
"data"
,
data
)
.
put
(
"bp"
,
bp
)
...
...
app/src/main/java/com/base/locationsharewhite/location/LocationPositionUtils.kt
View file @
ba3f81d7
...
...
@@ -42,17 +42,9 @@ object LocationPositionUtils {
data
.
put
(
"longitude"
,
latLng
.
longitude
)
data
.
put
(
"power"
,
power
)
data
.
put
(
"timezone"
,
System
.
currentTimeMillis
())
LogEx
.
logDebug
(
TAG
,
"latitude=${latLng.latitude} longitude=${latLng.longitude} power=$power"
)
val
bp
=
JSONObject
()
// .put("${pkg}_1", "")
.
put
(
"${pkg}_5"
,
Build
.
VERSION
.
SDK_INT
)
.
put
(
"${pkg}_8"
,
BuildConfig
.
VERSION_NAME
)
.
put
(
"${pkg}_9"
,
AppPreferences
.
getInstance
().
getString
(
"uuid"
,
""
))
.
put
(
"${pkg}_10"
,
AppPreferences
.
getInstance
().
getString
(
"uuid"
,
""
))
//gid
.
put
(
"${pkg}_13"
,
"android"
)
.
put
(
"${pkg}_14"
,
BuildConfig
.
VERSION_CODE
)
.
put
(
"${pkg}_15"
,
"google"
)
.
put
(
"${pkg}_24"
,
BuildConfig
.
BUILD_TYPE
)
LogEx
.
logDebug
(
TAG
,
"uploadMyLocation uuid=${AppPreferences.getInstance().getString("
uuid
", "")}"
)
LogEx
.
logDebug
(
TAG
,
"uploadMyLocation latitude=${latLng.latitude} longitude=${latLng.longitude} power=$power"
)
val
bp
=
BpUtils
.
getBp
()
val
body
=
JSONObject
()
.
put
(
"data"
,
data
)
.
put
(
"bp"
,
bp
)
...
...
@@ -89,22 +81,12 @@ object LocationPositionUtils {
callBack
:
((
locationData
:
LocationData
?)
->
Unit
)?
=
null
)
{
Thread
{
val
pkg
=
ConfigHelper
.
packageName
val
data
=
JSONObject
()
data
.
put
(
"device"
,
device
)
LogEx
.
logDebug
(
TAG
,
"getLocation device=$device"
)
val
bp
=
JSONObject
()
// .put("${pkg}_1", "")
.
put
(
"${pkg}_5"
,
Build
.
VERSION
.
SDK_INT
)
.
put
(
"${pkg}_8"
,
BuildConfig
.
VERSION_NAME
)
.
put
(
"${pkg}_9"
,
AppPreferences
.
getInstance
().
getString
(
"uuid"
,
""
))
.
put
(
"${pkg}_10"
,
AppPreferences
.
getInstance
().
getString
(
"uuid"
,
""
))
//gid
.
put
(
"${pkg}_13"
,
"android"
)
.
put
(
"${pkg}_14"
,
BuildConfig
.
VERSION_CODE
)
.
put
(
"${pkg}_15"
,
"google"
)
.
put
(
"${pkg}_24"
,
BuildConfig
.
BUILD_TYPE
)
val
bp
=
BpUtils
.
getBp
()
LogEx
.
logDebug
(
TAG
,
"uuid=${AppPreferences.getInstance().getString("
uuid
", "")}"
)
val
body
=
JSONObject
()
.
put
(
"data"
,
data
)
...
...
app/src/main/java/com/base/locationsharewhite/location/LocationShareListUtils.kt
View file @
ba3f81d7
package
com.base.locationsharewhite.location
import
android.os.Build
import
com.base.locationsharewhite.BuildConfig
import
com.base.locationsharewhite.bean.ViewerBean
import
com.base.locationsharewhite.bean.ViewingBean
import
com.base.locationsharewhite.helper.AESHelper
...
...
@@ -39,19 +37,10 @@ object LocationShareListUtils {
viewingListCallBack
:
((
viewingList
:
List
<
ViewingBean
>)
->
Unit
)?
=
null
)
{
Thread
{
val
pkg
=
ConfigHelper
.
packageName
val
data
=
JSONObject
()
val
bp
=
JSONObject
()
// .put("${pkg}_1", "")
.
put
(
"${pkg}_5"
,
Build
.
VERSION
.
SDK_INT
)
.
put
(
"${pkg}_8"
,
BuildConfig
.
VERSION_NAME
)
.
put
(
"${pkg}_9"
,
AppPreferences
.
getInstance
().
getString
(
"uuid"
,
""
))
.
put
(
"${pkg}_10"
,
AppPreferences
.
getInstance
().
getString
(
"uuid"
,
""
))
//gid
.
put
(
"${pkg}_13"
,
"android"
)
.
put
(
"${pkg}_14"
,
BuildConfig
.
VERSION_CODE
)
.
put
(
"${pkg}_15"
,
"google"
)
.
put
(
"${pkg}_24"
,
BuildConfig
.
BUILD_TYPE
)
val
bp
=
BpUtils
.
getBp
()
val
body
=
JSONObject
()
.
put
(
"data"
,
data
)
.
put
(
"bp"
,
bp
)
...
...
@@ -95,4 +84,45 @@ object LocationShareListUtils {
LogEx
.
logDebug
(
TAG
,
"viewingList size=${viewingList.size}"
)
viewingListCallBack
?.
invoke
(
viewingList
)
}
/**
* 分享关系列表
*/
private
val
deleteUrl
by
lazy
{
val
pkg
=
ConfigHelper
.
packageName
val
url
=
StringBuilder
(
"${ConfigHelper.apiUrl}/dingwei/${pkg.filter { it.isLowerCase() }.substring(4, 9)}p"
)
url
.
append
(
"?pkg=$pkg"
)
url
.
toString
()
}
fun
deleteViewer
(
device
:
String
,
callBacK
:
(
result
:
Boolean
)
->
Unit
)
{
Thread
{
val
data
=
JSONObject
()
data
.
put
(
"device"
,
device
)
val
bp
=
BpUtils
.
getBp
()
val
body
=
JSONObject
()
.
put
(
"data"
,
data
)
.
put
(
"bp"
,
bp
)
.
toString
()
val
paramJson
=
AESHelper
.
encrypt
(
body
)
runCatching
{
val
result
=
ReportUtils
.
doPost
(
deleteUrl
,
HashMap
(),
paramJson
)
LogEx
.
logDebug
(
TAG
,
"result=$result"
)
val
responseData
=
LocationLoginUtils
.
extractData
(
result
)
LogEx
.
logDebug
(
TAG
,
"responseData=$responseData"
)
if
(
responseData
!=
null
)
{
val
decryptedData
=
AESHelper
.
decrypt
(
responseData
)
LogEx
.
logDebug
(
TAG
,
"decryptedData=$decryptedData"
)
callBacK
.
invoke
(
decryptedData
.
toBoolean
())
}
}
}.
start
()
}
}
\ No newline at end of file
app/src/main/java/com/base/locationsharewhite/location/LocationShareUtils.kt
View file @
ba3f81d7
package
com.base.locationsharewhite.location
import
android.os.Build
import
com.base.locationsharewhite.BuildConfig
import
com.base.locationsharewhite.helper.AESHelper
import
com.base.locationsharewhite.helper.ConfigHelper
import
com.base.locationsharewhite.helper.ReportUtils
...
...
@@ -39,21 +37,11 @@ object LocationShareUtils {
callBack
:
(
state
:
Int
)
->
Unit
)
{
Thread
{
val
pkg
=
ConfigHelper
.
packageName
val
data
=
JSONObject
()
data
.
put
(
"invitationCode"
,
invitationCode
)
LogEx
.
logDebug
(
TAG
,
"invitationCode=${invitationCode}"
)
val
bp
=
JSONObject
()
// .put("${pkg}_1", "")
.
put
(
"${pkg}_5"
,
Build
.
VERSION
.
SDK_INT
)
.
put
(
"${pkg}_8"
,
BuildConfig
.
VERSION_NAME
)
.
put
(
"${pkg}_9"
,
AppPreferences
.
getInstance
().
getString
(
"uuid"
,
""
))
.
put
(
"${pkg}_10"
,
AppPreferences
.
getInstance
().
getString
(
"uuid"
,
""
))
//gid
.
put
(
"${pkg}_13"
,
"android"
)
.
put
(
"${pkg}_14"
,
BuildConfig
.
VERSION_CODE
)
.
put
(
"${pkg}_15"
,
"google"
)
.
put
(
"${pkg}_24"
,
BuildConfig
.
BUILD_TYPE
)
val
bp
=
BpUtils
.
getBp
()
LogEx
.
logDebug
(
TAG
,
"uuid=${AppPreferences.getInstance().getString("
uuid
", "")}"
)
val
body
=
JSONObject
()
.
put
(
"data"
,
data
)
...
...
app/src/main/java/com/base/locationsharewhite/location/LocationStatusUtils.kt
View file @
ba3f81d7
...
...
@@ -39,16 +39,7 @@ object LocationStatusUtils {
data
.
put
(
"device"
,
device
)
data
.
put
(
"status"
,
status
)
val
bp
=
JSONObject
()
// .put("${pkg}_1", "")
.
put
(
"${pkg}_5"
,
Build
.
VERSION
.
SDK_INT
)
.
put
(
"${pkg}_8"
,
BuildConfig
.
VERSION_NAME
)
.
put
(
"${pkg}_9"
,
AppPreferences
.
getInstance
().
getString
(
"uuid"
,
""
))
.
put
(
"${pkg}_10"
,
AppPreferences
.
getInstance
().
getString
(
"uuid"
,
""
))
//gid
.
put
(
"${pkg}_13"
,
"android"
)
.
put
(
"${pkg}_14"
,
BuildConfig
.
VERSION_CODE
)
.
put
(
"${pkg}_15"
,
"google"
)
.
put
(
"${pkg}_24"
,
BuildConfig
.
BUILD_TYPE
)
val
bp
=
BpUtils
.
getBp
()
val
body
=
JSONObject
()
.
put
(
"data"
,
data
)
...
...
app/src/main/java/com/base/locationsharewhite/ui/locationmap/LocationMapActivity.kt
View file @
ba3f81d7
...
...
@@ -54,7 +54,6 @@ class LocationMapActivity : BaseActivity<ActivityLocationMapBinding>(), OnMapRea
private
var
friendMarker
:
Marker
?
=
null
private
var
currentViewingBean
:
ViewingBean
?
=
null
override
fun
initView
()
{
BarUtils
.
setStatusBarLightMode
(
this
,
true
)
BarUtils
.
setStatusBarColor
(
this
,
Color
.
TRANSPARENT
)
...
...
@@ -79,15 +78,13 @@ class LocationMapActivity : BaseActivity<ActivityLocationMapBinding>(), OnMapRea
adapter
=
ViewingAdapter
(
itemClick
=
{
viewingBean
->
if
(
currentViewingBean
!=
viewingBean
)
{
if
(
currentViewingBean
?.
device
!=
viewingBean
.
device
)
{
removeOldViewingMarker
()
currentViewingBean
=
viewingBean
}
changeMarkerZIndex
(
false
)
setViewingBeanMarker
(
true
)
startGetLocationJob
()
}
changeViewingBeanPosition
(
true
,
true
,
true
)
},
moreClick
=
{
anchorView
,
item
->
showViewerMoreDialog
(
anchorView
)
...
...
@@ -113,9 +110,7 @@ class LocationMapActivity : BaseActivity<ActivityLocationMapBinding>(), OnMapRea
while
(
isActive
)
{
currentViewingBean
?.
let
{
viewingBean
->
LocationPositionUtils
.
getLocation
(
viewingBean
.
device
)
{
locatDate
->
LogEx
.
logDebug
(
TAG
,
"getLocation ${viewingBean.device} locatDate=$locatDate"
)
currentViewingBean
?.
locatDate
=
locatDate
lifecycleScope
.
launch
(
Dispatchers
.
Main
)
{
if
(
BuildConfig
.
DEBUG
)
{
toast
(
"getLocation ${locatDate?.latitude} ${locatDate?.longitude}"
)
...
...
@@ -124,7 +119,7 @@ class LocationMapActivity : BaseActivity<ActivityLocationMapBinding>(), OnMapRea
viewing
?.
locatDate
=
locatDate
adapter
.
notifyDataSetChanged
()
setViewingBeanMarker
(
false
)
changeViewingBeanPosition
(
false
,
false
,
false
)
}
}
}
...
...
@@ -166,7 +161,6 @@ class LocationMapActivity : BaseActivity<ActivityLocationMapBinding>(), OnMapRea
)
}
override
fun
initListener
()
{
super
.
initListener
()
if
(
isLanguageRecreate
(
MyApplication
.
locationMapLanguage
))
{
...
...
@@ -178,9 +172,11 @@ class LocationMapActivity : BaseActivity<ActivityLocationMapBinding>(), OnMapRea
binding
.
ivFanhui
.
setOnClickListener
{
onBackPressedDispatcher
.
onBackPressed
()
}
binding
.
ivChangeMapType
.
setOnClickListener
{
map
?.
let
{
showMapTypeDialog
(
it
)
}
}
binding
.
tvGotIt
.
setOnClickListener
{
binding
.
llFriendsGuide
.
visibility
=
View
.
GONE
if
(
adapter
.
items
.
isEmpty
())
{
...
...
@@ -195,7 +191,7 @@ class LocationMapActivity : BaseActivity<ActivityLocationMapBinding>(), OnMapRea
}
}
binding
.
ivLocation
.
setOnClickListener
{
resetMyLocation
(
locationPresenter
.
getMyLocation
()
,
true
,
true
)
changeMyLocation
(
locationPresenter
.
getMyLocation
(),
true
,
true
,
true
)
}
binding
.
ivRefresh
.
setOnClickListener
{
startRefreshAnimation
()
...
...
@@ -209,7 +205,6 @@ class LocationMapActivity : BaseActivity<ActivityLocationMapBinding>(), OnMapRea
}
private
var
valueAnimator
:
ValueAnimator
?
=
null
private
fun
startRefreshAnimation
()
{
if
(
valueAnimator
==
null
)
{
...
...
@@ -234,41 +229,59 @@ class LocationMapActivity : BaseActivity<ActivityLocationMapBinding>(), OnMapRea
}
override
fun
onMapReady
(
googleMap
:
GoogleMap
)
{
LogEx
.
logDebug
(
TAG
,
"onMapReady"
)
map
=
googleMap
LogEx
.
logDebug
(
TAG
,
"onMapReady"
)
val
flag
=
resetMyLocation
(
locationPresenter
.
getMyLocation
()
,
true
,
true
)
val
flag
=
changeMyLocation
(
locationPresenter
.
getMyLocation
(),
true
,
true
,
true
)
if
(!
flag
)
{
locationPresenter
.
getGoogleServiceLocation
()
locationPresenter
.
oneShotLocationCallBack
=
{
resetMyLocation
(
locationPresenter
.
getMyLocation
()
,
true
,
true
)
changeMyLocation
(
locationPresenter
.
getMyLocation
(),
true
,
true
,
true
)
}
}
locationPresenter
.
refreshLocationCallBack
=
{
toast
(
"updata ${it?.latitude} ${it?.longitude}"
)
resetMyLocation
(
it
,
false
,
false
)
LogEx
.
logDebug
(
TAG
,
"myLocation ${it}"
)
changeMyLocation
(
it
,
false
,
false
,
false
)
}
}
private
fun
resetMyLocation
(
latLng
:
LatLng
?,
resetZoom
:
Boolean
,
changeZIndex
:
Boolean
):
Boolean
{
/**
* 设置自己位置
*/
private
fun
changeMyLocation
(
latLng
:
LatLng
?,
followCamera
:
Boolean
,
resetZoom
:
Boolean
,
changeZIndex
:
Boolean
):
Boolean
{
initMyLocationMarker
()
if
(
changeZIndex
)
{
changeMarkerZIndex
(
true
)
}
initMyLocationMarker
()
latLng
?.
let
{
myMarker
?.
position
=
it
if
(
followCamera
)
{
if
(
resetZoom
)
{
map
?.
moveCamera
(
CameraUpdateFactory
.
newLatLngZoom
(
it
,
15f
))
myMarker
?.
showInfoWindow
()
}
else
{
map
?.
moveCamera
(
CameraUpdateFactory
.
newLatLng
(
it
))
}
}
return
true
}
return
false
}
/**
* 初始化自己Marker
*/
private
fun
initMyLocationMarker
()
{
if
(
myMarker
==
null
)
{
var
myLatLng
:
LatLng
?
=
getLatLngByLocationManager
()
...
...
@@ -283,37 +296,63 @@ class LocationMapActivity : BaseActivity<ActivityLocationMapBinding>(), OnMapRea
}
}
private
fun
setViewingBeanMarker
(
resetZoom
:
Boolean
)
{
/**
* 改变他人位置
*/
private
fun
changeViewingBeanPosition
(
changeCamera
:
Boolean
,
resetZoom
:
Boolean
,
changeZIndex
:
Boolean
)
{
currentViewingBean
?.
let
{
viewingBean
->
viewingBean
.
locatDate
?.
let
{
locatDate
->
val
latLng
=
LatLng
(
locatDate
.
latitude
,
locatDate
.
longitude
)
initViewingMarker
(
latLng
,
viewingBean
.
nickname
)
setViewingBeanMarker
(
latLng
,
changeCamera
,
resetZoom
,
changeZIndex
)
}
}
}
/**
* 初始化他人Marker
*/
private
fun
initViewingMarker
(
latLng
:
LatLng
,
nickname
:
String
)
{
if
(
friendMarker
==
null
)
{
val
friendAvatar
=
LayoutInflater
.
from
(
this
).
inflate
(
R
.
layout
.
avatar_friend
,
null
)
LogEx
.
logDebug
(
TAG
,
"initViewingBeanMarker locatDate ${locatDate.latitude} ${locatDate.longitude}"
)
friendMarker
=
map
?.
addLocationMarker
(
friendAvatar
,
latLng
,
viewingBean
.
nickname
)
changeMarkerZIndex
(
false
)
friendMarker
=
map
?.
addLocationMarker
(
friendAvatar
,
latLng
,
nickname
)
}
setViewingBeanLocation
(
latLng
,
resetZoom
)
}
}
}
/**
* 移除旧的他人Marker
*/
private
fun
removeOldViewingMarker
()
{
friendMarker
?.
remove
()
friendMarker
=
null
}
private
fun
setViewingBeanLocation
(
latLng
:
LatLng
,
resetZoom
:
Boolean
=
false
)
{
/**
* 移动他人Marker
*/
private
fun
setViewingBeanMarker
(
latLng
:
LatLng
,
changeCamera
:
Boolean
,
resetZoom
:
Boolean
,
changeZIndex
:
Boolean
)
{
if
(
changeCamera
)
{
if
(
resetZoom
)
{
map
?.
moveCamera
(
CameraUpdateFactory
.
newLatLngZoom
(
latLng
,
15f
))
friendMarker
?.
showInfoWindow
()
}
else
{
map
?.
moveCamera
(
CameraUpdateFactory
.
newLatLng
(
latLng
))
}
myMarker
?.
position
=
latLng
}
friendMarker
?.
position
=
latLng
LogEx
.
logDebug
(
TAG
,
"Viewing ${latLng}"
)
if
(
changeZIndex
)
{
changeMarkerZIndex
(
false
)
}
}
private
fun
changeMarkerZIndex
(
isShowMe
:
Boolean
)
{
...
...
app/src/main/java/com/base/locationsharewhite/ui/main/LocationShareActivity.kt
View file @
ba3f81d7
...
...
@@ -14,6 +14,7 @@ import com.base.locationsharewhite.location.LocationShareUtils.SHARE_STATE_MYSEL
import
com.base.locationsharewhite.location.LocationShareUtils.SHARE_STATE_SHARED
import
com.base.locationsharewhite.location.LocationShareUtils.SHARE_STATE_SUCCESS
import
com.base.locationsharewhite.location.LocationStatusUtils
import
com.base.locationsharewhite.ui.views.DialogView.showViewerMoreDialog
import
com.base.locationsharewhite.utils.BarUtils
import
com.base.locationsharewhite.utils.LogEx
import
com.base.locationsharewhite.utils.ToastUtils.toast
...
...
@@ -58,6 +59,15 @@ class LocationShareActivity : BaseActivity<ActivityLocationShareBinding>() {
}
}
})
adapter
.
moreAction
=
{
anchorView
,
viewerBean
->
showViewerMoreDialog
(
anchorView
,
deleteAction
=
{
LocationShareListUtils
.
deleteViewer
(
viewerBean
.
device
)
{
runOnUiThread
{
toast
(
it
.
toString
())
}
}
})
}
binding
.
rv
.
adapter
=
adapter
...
...
app/src/main/java/com/base/locationsharewhite/ui/main/ViewerAdapter.kt
View file @
ba3f81d7
...
...
@@ -4,8 +4,6 @@ import android.content.Context
import
android.view.View
import
android.view.ViewGroup
import
android.widget.CompoundButton
import
android.widget.RadioGroup
import
android.widget.RadioGroup.OnCheckedChangeListener
import
androidx.recyclerview.widget.RecyclerView.ViewHolder
import
com.base.locationsharewhite.R
import
com.base.locationsharewhite.bean.ViewerBean
...
...
@@ -17,6 +15,8 @@ class ViewerAdapter(
private
val
switchAction
:
(
viewerBean
:
ViewerBean
,
isChecked
:
Boolean
)
->
Unit
)
:
BaseQuickAdapter
<
ViewerBean
,
ViewerAdapter
.
ViewerViewHolder
>()
{
var
moreAction
:
((
anchorView
:
View
,
viewerBean
:
ViewerBean
)
->
Unit
)?
=
null
inner
class
ViewerViewHolder
(
view
:
View
)
:
ViewHolder
(
view
)
override
fun
onBindViewHolder
(
holder
:
ViewerViewHolder
,
position
:
Int
,
item
:
ViewerBean
?)
{
...
...
@@ -32,6 +32,9 @@ class ViewerAdapter(
}
switchAction
.
invoke
(
item
,
isChecked
)
}
binding
.
ivMore
.
setOnClickListener
{
moreAction
?.
invoke
(
it
,
item
)
}
}
override
fun
onCreateViewHolder
(
context
:
Context
,
parent
:
ViewGroup
,
viewType
:
Int
):
ViewerViewHolder
{
...
...
app/src/main/java/com/base/locationsharewhite/ui/views/DialogView.kt
View file @
ba3f81d7
...
...
@@ -34,6 +34,7 @@ object DialogView {
params
?.
y
=
20
dialog
.
window
?.
attributes
=
params
dialog
.
window
?.
setBackgroundDrawableResource
(
android
.
R
.
color
.
transparent
)
LogEx
.
logDebug
(
"showMapTypeDialog"
,
"mapType=${googleMap.mapType}"
)
if
(
googleMap
.
mapType
==
GoogleMap
.
MAP_TYPE_SATELLITE
)
{
binding
.
ivStatellite
.
background
=
ContextCompat
.
getDrawable
(
this
,
R
.
drawable
.
bg_stroke_03b988_15
)
binding
.
tvStatellite
.
setTextColor
(
Color
.
parseColor
(
"#03B988"
))
...
...
@@ -84,6 +85,8 @@ object DialogView {
fun
Context
.
showViewerMoreDialog
(
anchorView
:
View
,
renameAction
:
(()
->
Unit
)?
=
null
,
deleteAction
:
(()
->
Unit
)?
=
null
,
)
{
val
binding
=
DialogViewerMoreBinding
.
inflate
(
LayoutInflater
.
from
(
this
))
val
dialog
=
AlertDialog
.
Builder
(
this
).
create
()
...
...
@@ -117,6 +120,14 @@ object DialogView {
params
?.
x
=
x
params
?.
y
=
y
dialog
.
window
?.
attributes
=
params
binding
.
tvRename
.
setOnClickListener
{
}
binding
.
tvDelete
.
setOnClickListener
{
dialog
.
dismiss
()
deleteAction
?.
invoke
()
}
}
fun
Context
.
viewIsOutScreen
(
view
:
View
,
height
:
Int
):
Boolean
{
...
...
app/src/main/res/drawable/bg_stroke_03b988_15.xml
View file @
ba3f81d7
...
...
@@ -2,7 +2,7 @@
<shape
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<stroke
android:width=
"
2
dp"
android:width=
"
5
dp"
android:color=
"#03B988"
/>
<corners
android:radius=
"15dp"
/>
</shape>
\ No newline at end of file
app/src/main/res/layout/dialog_map_type.xml
View file @
ba3f81d7
...
...
@@ -21,7 +21,7 @@
android:layout_height=
"wrap_content"
android:layout_gravity=
"center_horizontal"
android:layout_marginTop=
"26dp"
android:padding=
"
1
dp"
android:padding=
"
2
dp"
android:src=
"@mipmap/staellitemap"
tools:ignore=
"ContentDescription"
/>
...
...
@@ -50,7 +50,7 @@
android:layout_height=
"wrap_content"
android:layout_gravity=
"center_horizontal"
android:layout_marginTop=
"26dp"
android:padding=
"
1
dp"
android:padding=
"
2
dp"
android:src=
"@mipmap/streetmap"
tools:ignore=
"ContentDescription"
/>
...
...
app/src/main/res/layout/dialog_viewer_more.xml
View file @
ba3f81d7
...
...
@@ -6,6 +6,7 @@
android:orientation=
"vertical"
>
<TextView
android:id=
"@+id/tv_rename"
android:layout_width=
"match_parent"
android:layout_height=
"45dp"
android:gravity=
"center"
...
...
@@ -19,6 +20,7 @@
android:background=
"#545454"
/>
<TextView
android:id=
"@+id/tv_delete"
android:layout_width=
"match_parent"
android:layout_height=
"45dp"
android:gravity=
"center"
...
...
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