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
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.AESHelper
import
com.base.locationsharewhite.helper.ConfigHelper
import
com.base.locationsharewhite.helper.ConfigHelper
import
com.base.locationsharewhite.helper.ReportUtils.doPost
import
com.base.locationsharewhite.helper.ReportUtils.doPost
...
@@ -45,21 +43,12 @@ object LocationLoginUtils {
...
@@ -45,21 +43,12 @@ object LocationLoginUtils {
fun
login
(
name
:
String
?
=
null
)
{
fun
login
(
name
:
String
?
=
null
)
{
Thread
{
Thread
{
val
pkg
=
ConfigHelper
.
packageName
val
data
=
JSONObject
()
val
data
=
JSONObject
()
name
?.
let
{
data
.
put
(
"nickName"
,
it
)
}
name
?.
let
{
data
.
put
(
"nickName"
,
it
)
}
val
bp
=
JSONObject
()
val
bp
=
BpUtils
.
getBp
()
// .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
,
"uuid=${AppPreferences.getInstance().getString("
uuid
", "")}"
)
LogEx
.
logDebug
(
TAG
,
"uuid=${AppPreferences.getInstance().getString("
uuid
", "")}"
)
val
body
=
JSONObject
()
val
body
=
JSONObject
()
.
put
(
"data"
,
data
)
.
put
(
"data"
,
data
)
...
...
app/src/main/java/com/base/locationsharewhite/location/LocationNameUtils.kt
View file @
ba3f81d7
package
com.base.locationsharewhite.location
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.AESHelper
import
com.base.locationsharewhite.helper.ConfigHelper
import
com.base.locationsharewhite.helper.ConfigHelper
import
com.base.locationsharewhite.helper.ReportUtils
import
com.base.locationsharewhite.helper.ReportUtils
import
com.base.locationsharewhite.utils.AppPreferences
import
com.base.locationsharewhite.utils.LogEx
import
com.base.locationsharewhite.utils.LogEx
import
org.json.JSONObject
import
org.json.JSONObject
...
@@ -27,16 +24,7 @@ object LocationNameUtils {
...
@@ -27,16 +24,7 @@ object LocationNameUtils {
val
data
=
JSONObject
()
val
data
=
JSONObject
()
data
.
put
(
"nickName"
,
nickname
)
data
.
put
(
"nickName"
,
nickname
)
val
bp
=
JSONObject
()
val
bp
=
BpUtils
.
getBp
()
// .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
body
=
JSONObject
()
val
body
=
JSONObject
()
.
put
(
"data"
,
data
)
.
put
(
"data"
,
data
)
.
put
(
"bp"
,
bp
)
.
put
(
"bp"
,
bp
)
...
...
app/src/main/java/com/base/locationsharewhite/location/LocationPositionUtils.kt
View file @
ba3f81d7
...
@@ -42,17 +42,9 @@ object LocationPositionUtils {
...
@@ -42,17 +42,9 @@ object LocationPositionUtils {
data
.
put
(
"longitude"
,
latLng
.
longitude
)
data
.
put
(
"longitude"
,
latLng
.
longitude
)
data
.
put
(
"power"
,
power
)
data
.
put
(
"power"
,
power
)
data
.
put
(
"timezone"
,
System
.
currentTimeMillis
())
data
.
put
(
"timezone"
,
System
.
currentTimeMillis
())
LogEx
.
logDebug
(
TAG
,
"latitude=${latLng.latitude} longitude=${latLng.longitude} power=$power"
)
LogEx
.
logDebug
(
TAG
,
"uploadMyLocation uuid=${AppPreferences.getInstance().getString("
uuid
", "")}"
)
val
bp
=
JSONObject
()
LogEx
.
logDebug
(
TAG
,
"uploadMyLocation latitude=${latLng.latitude} longitude=${latLng.longitude} power=$power"
)
// .put("${pkg}_1", "")
val
bp
=
BpUtils
.
getBp
()
.
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
body
=
JSONObject
()
val
body
=
JSONObject
()
.
put
(
"data"
,
data
)
.
put
(
"data"
,
data
)
.
put
(
"bp"
,
bp
)
.
put
(
"bp"
,
bp
)
...
@@ -89,22 +81,12 @@ object LocationPositionUtils {
...
@@ -89,22 +81,12 @@ object LocationPositionUtils {
callBack
:
((
locationData
:
LocationData
?)
->
Unit
)?
=
null
callBack
:
((
locationData
:
LocationData
?)
->
Unit
)?
=
null
)
{
)
{
Thread
{
Thread
{
val
pkg
=
ConfigHelper
.
packageName
val
data
=
JSONObject
()
val
data
=
JSONObject
()
data
.
put
(
"device"
,
device
)
data
.
put
(
"device"
,
device
)
LogEx
.
logDebug
(
TAG
,
"getLocation device=$device"
)
LogEx
.
logDebug
(
TAG
,
"getLocation device=$device"
)
val
bp
=
JSONObject
()
val
bp
=
BpUtils
.
getBp
()
// .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
,
"uuid=${AppPreferences.getInstance().getString("
uuid
", "")}"
)
LogEx
.
logDebug
(
TAG
,
"uuid=${AppPreferences.getInstance().getString("
uuid
", "")}"
)
val
body
=
JSONObject
()
val
body
=
JSONObject
()
.
put
(
"data"
,
data
)
.
put
(
"data"
,
data
)
...
...
app/src/main/java/com/base/locationsharewhite/location/LocationShareListUtils.kt
View file @
ba3f81d7
package
com.base.locationsharewhite.location
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.ViewerBean
import
com.base.locationsharewhite.bean.ViewingBean
import
com.base.locationsharewhite.bean.ViewingBean
import
com.base.locationsharewhite.helper.AESHelper
import
com.base.locationsharewhite.helper.AESHelper
...
@@ -39,19 +37,10 @@ object LocationShareListUtils {
...
@@ -39,19 +37,10 @@ object LocationShareListUtils {
viewingListCallBack
:
((
viewingList
:
List
<
ViewingBean
>)
->
Unit
)?
=
null
viewingListCallBack
:
((
viewingList
:
List
<
ViewingBean
>)
->
Unit
)?
=
null
)
{
)
{
Thread
{
Thread
{
val
pkg
=
ConfigHelper
.
packageName
val
data
=
JSONObject
()
val
data
=
JSONObject
()
val
bp
=
JSONObject
()
val
bp
=
BpUtils
.
getBp
()
// .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
body
=
JSONObject
()
val
body
=
JSONObject
()
.
put
(
"data"
,
data
)
.
put
(
"data"
,
data
)
.
put
(
"bp"
,
bp
)
.
put
(
"bp"
,
bp
)
...
@@ -95,4 +84,45 @@ object LocationShareListUtils {
...
@@ -95,4 +84,45 @@ object LocationShareListUtils {
LogEx
.
logDebug
(
TAG
,
"viewingList size=${viewingList.size}"
)
LogEx
.
logDebug
(
TAG
,
"viewingList size=${viewingList.size}"
)
viewingListCallBack
?.
invoke
(
viewingList
)
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
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.AESHelper
import
com.base.locationsharewhite.helper.ConfigHelper
import
com.base.locationsharewhite.helper.ConfigHelper
import
com.base.locationsharewhite.helper.ReportUtils
import
com.base.locationsharewhite.helper.ReportUtils
...
@@ -39,21 +37,11 @@ object LocationShareUtils {
...
@@ -39,21 +37,11 @@ object LocationShareUtils {
callBack
:
(
state
:
Int
)
->
Unit
callBack
:
(
state
:
Int
)
->
Unit
)
{
)
{
Thread
{
Thread
{
val
pkg
=
ConfigHelper
.
packageName
val
data
=
JSONObject
()
val
data
=
JSONObject
()
data
.
put
(
"invitationCode"
,
invitationCode
)
data
.
put
(
"invitationCode"
,
invitationCode
)
LogEx
.
logDebug
(
TAG
,
"invitationCode=${invitationCode}"
)
LogEx
.
logDebug
(
TAG
,
"invitationCode=${invitationCode}"
)
val
bp
=
JSONObject
()
val
bp
=
BpUtils
.
getBp
()
// .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
,
"uuid=${AppPreferences.getInstance().getString("
uuid
", "")}"
)
LogEx
.
logDebug
(
TAG
,
"uuid=${AppPreferences.getInstance().getString("
uuid
", "")}"
)
val
body
=
JSONObject
()
val
body
=
JSONObject
()
.
put
(
"data"
,
data
)
.
put
(
"data"
,
data
)
...
...
app/src/main/java/com/base/locationsharewhite/location/LocationStatusUtils.kt
View file @
ba3f81d7
...
@@ -39,16 +39,7 @@ object LocationStatusUtils {
...
@@ -39,16 +39,7 @@ object LocationStatusUtils {
data
.
put
(
"device"
,
device
)
data
.
put
(
"device"
,
device
)
data
.
put
(
"status"
,
status
)
data
.
put
(
"status"
,
status
)
val
bp
=
JSONObject
()
val
bp
=
BpUtils
.
getBp
()
// .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
body
=
JSONObject
()
val
body
=
JSONObject
()
.
put
(
"data"
,
data
)
.
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
...
@@ -54,7 +54,6 @@ class LocationMapActivity : BaseActivity<ActivityLocationMapBinding>(), OnMapRea
private
var
friendMarker
:
Marker
?
=
null
private
var
friendMarker
:
Marker
?
=
null
private
var
currentViewingBean
:
ViewingBean
?
=
null
private
var
currentViewingBean
:
ViewingBean
?
=
null
override
fun
initView
()
{
override
fun
initView
()
{
BarUtils
.
setStatusBarLightMode
(
this
,
true
)
BarUtils
.
setStatusBarLightMode
(
this
,
true
)
BarUtils
.
setStatusBarColor
(
this
,
Color
.
TRANSPARENT
)
BarUtils
.
setStatusBarColor
(
this
,
Color
.
TRANSPARENT
)
...
@@ -79,15 +78,13 @@ class LocationMapActivity : BaseActivity<ActivityLocationMapBinding>(), OnMapRea
...
@@ -79,15 +78,13 @@ class LocationMapActivity : BaseActivity<ActivityLocationMapBinding>(), OnMapRea
adapter
=
ViewingAdapter
(
adapter
=
ViewingAdapter
(
itemClick
=
{
viewingBean
->
itemClick
=
{
viewingBean
->
if
(
currentViewingBean
!=
viewingBean
)
{
if
(
currentViewingBean
?.
device
!=
viewingBean
.
device
)
{
removeOldViewingMarker
()
removeOldViewingMarker
()
currentViewingBean
=
viewingBean
currentViewingBean
=
viewingBean
}
changeMarkerZIndex
(
false
)
setViewingBeanMarker
(
true
)
startGetLocationJob
()
startGetLocationJob
()
}
changeViewingBeanPosition
(
true
,
true
,
true
)
},
},
moreClick
=
{
anchorView
,
item
->
moreClick
=
{
anchorView
,
item
->
showViewerMoreDialog
(
anchorView
)
showViewerMoreDialog
(
anchorView
)
...
@@ -113,9 +110,7 @@ class LocationMapActivity : BaseActivity<ActivityLocationMapBinding>(), OnMapRea
...
@@ -113,9 +110,7 @@ class LocationMapActivity : BaseActivity<ActivityLocationMapBinding>(), OnMapRea
while
(
isActive
)
{
while
(
isActive
)
{
currentViewingBean
?.
let
{
viewingBean
->
currentViewingBean
?.
let
{
viewingBean
->
LocationPositionUtils
.
getLocation
(
viewingBean
.
device
)
{
locatDate
->
LocationPositionUtils
.
getLocation
(
viewingBean
.
device
)
{
locatDate
->
LogEx
.
logDebug
(
TAG
,
"getLocation ${viewingBean.device} locatDate=$locatDate"
)
currentViewingBean
?.
locatDate
=
locatDate
currentViewingBean
?.
locatDate
=
locatDate
lifecycleScope
.
launch
(
Dispatchers
.
Main
)
{
lifecycleScope
.
launch
(
Dispatchers
.
Main
)
{
if
(
BuildConfig
.
DEBUG
)
{
if
(
BuildConfig
.
DEBUG
)
{
toast
(
"getLocation ${locatDate?.latitude} ${locatDate?.longitude}"
)
toast
(
"getLocation ${locatDate?.latitude} ${locatDate?.longitude}"
)
...
@@ -124,7 +119,7 @@ class LocationMapActivity : BaseActivity<ActivityLocationMapBinding>(), OnMapRea
...
@@ -124,7 +119,7 @@ class LocationMapActivity : BaseActivity<ActivityLocationMapBinding>(), OnMapRea
viewing
?.
locatDate
=
locatDate
viewing
?.
locatDate
=
locatDate
adapter
.
notifyDataSetChanged
()
adapter
.
notifyDataSetChanged
()
setViewingBeanMarker
(
false
)
changeViewingBeanPosition
(
false
,
false
,
false
)
}
}
}
}
}
}
...
@@ -166,7 +161,6 @@ class LocationMapActivity : BaseActivity<ActivityLocationMapBinding>(), OnMapRea
...
@@ -166,7 +161,6 @@ class LocationMapActivity : BaseActivity<ActivityLocationMapBinding>(), OnMapRea
)
)
}
}
override
fun
initListener
()
{
override
fun
initListener
()
{
super
.
initListener
()
super
.
initListener
()
if
(
isLanguageRecreate
(
MyApplication
.
locationMapLanguage
))
{
if
(
isLanguageRecreate
(
MyApplication
.
locationMapLanguage
))
{
...
@@ -178,9 +172,11 @@ class LocationMapActivity : BaseActivity<ActivityLocationMapBinding>(), OnMapRea
...
@@ -178,9 +172,11 @@ class LocationMapActivity : BaseActivity<ActivityLocationMapBinding>(), OnMapRea
binding
.
ivFanhui
.
setOnClickListener
{
binding
.
ivFanhui
.
setOnClickListener
{
onBackPressedDispatcher
.
onBackPressed
()
onBackPressedDispatcher
.
onBackPressed
()
}
}
binding
.
ivChangeMapType
.
setOnClickListener
{
binding
.
ivChangeMapType
.
setOnClickListener
{
map
?.
let
{
showMapTypeDialog
(
it
)
}
map
?.
let
{
showMapTypeDialog
(
it
)
}
}
}
binding
.
tvGotIt
.
setOnClickListener
{
binding
.
tvGotIt
.
setOnClickListener
{
binding
.
llFriendsGuide
.
visibility
=
View
.
GONE
binding
.
llFriendsGuide
.
visibility
=
View
.
GONE
if
(
adapter
.
items
.
isEmpty
())
{
if
(
adapter
.
items
.
isEmpty
())
{
...
@@ -195,7 +191,7 @@ class LocationMapActivity : BaseActivity<ActivityLocationMapBinding>(), OnMapRea
...
@@ -195,7 +191,7 @@ class LocationMapActivity : BaseActivity<ActivityLocationMapBinding>(), OnMapRea
}
}
}
}
binding
.
ivLocation
.
setOnClickListener
{
binding
.
ivLocation
.
setOnClickListener
{
resetMyLocation
(
locationPresenter
.
getMyLocation
()
,
true
,
true
)
changeMyLocation
(
locationPresenter
.
getMyLocation
(),
true
,
true
,
true
)
}
}
binding
.
ivRefresh
.
setOnClickListener
{
binding
.
ivRefresh
.
setOnClickListener
{
startRefreshAnimation
()
startRefreshAnimation
()
...
@@ -209,7 +205,6 @@ class LocationMapActivity : BaseActivity<ActivityLocationMapBinding>(), OnMapRea
...
@@ -209,7 +205,6 @@ class LocationMapActivity : BaseActivity<ActivityLocationMapBinding>(), OnMapRea
}
}
private
var
valueAnimator
:
ValueAnimator
?
=
null
private
var
valueAnimator
:
ValueAnimator
?
=
null
private
fun
startRefreshAnimation
()
{
private
fun
startRefreshAnimation
()
{
if
(
valueAnimator
==
null
)
{
if
(
valueAnimator
==
null
)
{
...
@@ -234,41 +229,59 @@ class LocationMapActivity : BaseActivity<ActivityLocationMapBinding>(), OnMapRea
...
@@ -234,41 +229,59 @@ class LocationMapActivity : BaseActivity<ActivityLocationMapBinding>(), OnMapRea
}
}
override
fun
onMapReady
(
googleMap
:
GoogleMap
)
{
override
fun
onMapReady
(
googleMap
:
GoogleMap
)
{
LogEx
.
logDebug
(
TAG
,
"onMapReady"
)
map
=
googleMap
map
=
googleMap
LogEx
.
logDebug
(
TAG
,
"onMapReady"
)
LogEx
.
logDebug
(
TAG
,
"onMapReady"
)
val
flag
=
resetMyLocation
(
locationPresenter
.
getMyLocation
()
,
true
,
true
)
val
flag
=
changeMyLocation
(
locationPresenter
.
getMyLocation
(),
true
,
true
,
true
)
if
(!
flag
)
{
if
(!
flag
)
{
locationPresenter
.
getGoogleServiceLocation
()
locationPresenter
.
getGoogleServiceLocation
()
locationPresenter
.
oneShotLocationCallBack
=
{
locationPresenter
.
oneShotLocationCallBack
=
{
resetMyLocation
(
locationPresenter
.
getMyLocation
()
,
true
,
true
)
changeMyLocation
(
locationPresenter
.
getMyLocation
(),
true
,
true
,
true
)
}
}
}
}
locationPresenter
.
refreshLocationCallBack
=
{
locationPresenter
.
refreshLocationCallBack
=
{
toast
(
"updata ${it?.latitude} ${it?.longitude}"
)
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
)
{
if
(
changeZIndex
)
{
changeMarkerZIndex
(
true
)
changeMarkerZIndex
(
true
)
}
}
initMyLocationMarker
()
latLng
?.
let
{
latLng
?.
let
{
myMarker
?.
position
=
it
myMarker
?.
position
=
it
if
(
followCamera
)
{
if
(
resetZoom
)
{
if
(
resetZoom
)
{
map
?.
moveCamera
(
CameraUpdateFactory
.
newLatLngZoom
(
it
,
15f
))
map
?.
moveCamera
(
CameraUpdateFactory
.
newLatLngZoom
(
it
,
15f
))
myMarker
?.
showInfoWindow
()
}
else
{
}
else
{
map
?.
moveCamera
(
CameraUpdateFactory
.
newLatLng
(
it
))
map
?.
moveCamera
(
CameraUpdateFactory
.
newLatLng
(
it
))
}
}
}
return
true
return
true
}
}
return
false
return
false
}
}
/**
* 初始化自己Marker
*/
private
fun
initMyLocationMarker
()
{
private
fun
initMyLocationMarker
()
{
if
(
myMarker
==
null
)
{
if
(
myMarker
==
null
)
{
var
myLatLng
:
LatLng
?
=
getLatLngByLocationManager
()
var
myLatLng
:
LatLng
?
=
getLatLngByLocationManager
()
...
@@ -283,37 +296,63 @@ class LocationMapActivity : BaseActivity<ActivityLocationMapBinding>(), OnMapRea
...
@@ -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
->
currentViewingBean
?.
let
{
viewingBean
->
viewingBean
.
locatDate
?.
let
{
locatDate
->
viewingBean
.
locatDate
?.
let
{
locatDate
->
val
latLng
=
LatLng
(
locatDate
.
latitude
,
locatDate
.
longitude
)
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
)
{
if
(
friendMarker
==
null
)
{
val
friendAvatar
=
LayoutInflater
.
from
(
this
).
inflate
(
R
.
layout
.
avatar_friend
,
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
,
nickname
)
friendMarker
=
map
?.
addLocationMarker
(
friendAvatar
,
latLng
,
viewingBean
.
nickname
)
changeMarkerZIndex
(
false
)
}
}
setViewingBeanLocation
(
latLng
,
resetZoom
)
}
}
}
}
/**
* 移除旧的他人Marker
*/
private
fun
removeOldViewingMarker
()
{
private
fun
removeOldViewingMarker
()
{
friendMarker
?.
remove
()
friendMarker
?.
remove
()
friendMarker
=
null
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
)
{
if
(
resetZoom
)
{
map
?.
moveCamera
(
CameraUpdateFactory
.
newLatLngZoom
(
latLng
,
15f
))
map
?.
moveCamera
(
CameraUpdateFactory
.
newLatLngZoom
(
latLng
,
15f
))
friendMarker
?.
showInfoWindow
()
}
else
{
}
else
{
map
?.
moveCamera
(
CameraUpdateFactory
.
newLatLng
(
latLng
))
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
)
{
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
...
@@ -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_SHARED
import
com.base.locationsharewhite.location.LocationShareUtils.SHARE_STATE_SUCCESS
import
com.base.locationsharewhite.location.LocationShareUtils.SHARE_STATE_SUCCESS
import
com.base.locationsharewhite.location.LocationStatusUtils
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.BarUtils
import
com.base.locationsharewhite.utils.LogEx
import
com.base.locationsharewhite.utils.LogEx
import
com.base.locationsharewhite.utils.ToastUtils.toast
import
com.base.locationsharewhite.utils.ToastUtils.toast
...
@@ -58,6 +59,15 @@ class LocationShareActivity : BaseActivity<ActivityLocationShareBinding>() {
...
@@ -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
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
...
@@ -4,8 +4,6 @@ import android.content.Context
import
android.view.View
import
android.view.View
import
android.view.ViewGroup
import
android.view.ViewGroup
import
android.widget.CompoundButton
import
android.widget.CompoundButton
import
android.widget.RadioGroup
import
android.widget.RadioGroup.OnCheckedChangeListener
import
androidx.recyclerview.widget.RecyclerView.ViewHolder
import
androidx.recyclerview.widget.RecyclerView.ViewHolder
import
com.base.locationsharewhite.R
import
com.base.locationsharewhite.R
import
com.base.locationsharewhite.bean.ViewerBean
import
com.base.locationsharewhite.bean.ViewerBean
...
@@ -17,6 +15,8 @@ class ViewerAdapter(
...
@@ -17,6 +15,8 @@ class ViewerAdapter(
private
val
switchAction
:
(
viewerBean
:
ViewerBean
,
isChecked
:
Boolean
)
->
Unit
private
val
switchAction
:
(
viewerBean
:
ViewerBean
,
isChecked
:
Boolean
)
->
Unit
)
:
BaseQuickAdapter
<
ViewerBean
,
ViewerAdapter
.
ViewerViewHolder
>()
{
)
:
BaseQuickAdapter
<
ViewerBean
,
ViewerAdapter
.
ViewerViewHolder
>()
{
var
moreAction
:
((
anchorView
:
View
,
viewerBean
:
ViewerBean
)
->
Unit
)?
=
null
inner
class
ViewerViewHolder
(
view
:
View
)
:
ViewHolder
(
view
)
inner
class
ViewerViewHolder
(
view
:
View
)
:
ViewHolder
(
view
)
override
fun
onBindViewHolder
(
holder
:
ViewerViewHolder
,
position
:
Int
,
item
:
ViewerBean
?)
{
override
fun
onBindViewHolder
(
holder
:
ViewerViewHolder
,
position
:
Int
,
item
:
ViewerBean
?)
{
...
@@ -32,6 +32,9 @@ class ViewerAdapter(
...
@@ -32,6 +32,9 @@ class ViewerAdapter(
}
}
switchAction
.
invoke
(
item
,
isChecked
)
switchAction
.
invoke
(
item
,
isChecked
)
}
}
binding
.
ivMore
.
setOnClickListener
{
moreAction
?.
invoke
(
it
,
item
)
}
}
}
override
fun
onCreateViewHolder
(
context
:
Context
,
parent
:
ViewGroup
,
viewType
:
Int
):
ViewerViewHolder
{
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 {
...
@@ -34,6 +34,7 @@ object DialogView {
params
?.
y
=
20
params
?.
y
=
20
dialog
.
window
?.
attributes
=
params
dialog
.
window
?.
attributes
=
params
dialog
.
window
?.
setBackgroundDrawableResource
(
android
.
R
.
color
.
transparent
)
dialog
.
window
?.
setBackgroundDrawableResource
(
android
.
R
.
color
.
transparent
)
LogEx
.
logDebug
(
"showMapTypeDialog"
,
"mapType=${googleMap.mapType}"
)
if
(
googleMap
.
mapType
==
GoogleMap
.
MAP_TYPE_SATELLITE
)
{
if
(
googleMap
.
mapType
==
GoogleMap
.
MAP_TYPE_SATELLITE
)
{
binding
.
ivStatellite
.
background
=
ContextCompat
.
getDrawable
(
this
,
R
.
drawable
.
bg_stroke_03b988_15
)
binding
.
ivStatellite
.
background
=
ContextCompat
.
getDrawable
(
this
,
R
.
drawable
.
bg_stroke_03b988_15
)
binding
.
tvStatellite
.
setTextColor
(
Color
.
parseColor
(
"#03B988"
))
binding
.
tvStatellite
.
setTextColor
(
Color
.
parseColor
(
"#03B988"
))
...
@@ -84,6 +85,8 @@ object DialogView {
...
@@ -84,6 +85,8 @@ object DialogView {
fun
Context
.
showViewerMoreDialog
(
fun
Context
.
showViewerMoreDialog
(
anchorView
:
View
,
anchorView
:
View
,
renameAction
:
(()
->
Unit
)?
=
null
,
deleteAction
:
(()
->
Unit
)?
=
null
,
)
{
)
{
val
binding
=
DialogViewerMoreBinding
.
inflate
(
LayoutInflater
.
from
(
this
))
val
binding
=
DialogViewerMoreBinding
.
inflate
(
LayoutInflater
.
from
(
this
))
val
dialog
=
AlertDialog
.
Builder
(
this
).
create
()
val
dialog
=
AlertDialog
.
Builder
(
this
).
create
()
...
@@ -117,6 +120,14 @@ object DialogView {
...
@@ -117,6 +120,14 @@ object DialogView {
params
?.
x
=
x
params
?.
x
=
x
params
?.
y
=
y
params
?.
y
=
y
dialog
.
window
?.
attributes
=
params
dialog
.
window
?.
attributes
=
params
binding
.
tvRename
.
setOnClickListener
{
}
binding
.
tvDelete
.
setOnClickListener
{
dialog
.
dismiss
()
deleteAction
?.
invoke
()
}
}
}
fun
Context
.
viewIsOutScreen
(
view
:
View
,
height
:
Int
):
Boolean
{
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 @@
...
@@ -2,7 +2,7 @@
<shape
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<shape
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<stroke
<stroke
android:width=
"
2
dp"
android:width=
"
5
dp"
android:color=
"#03B988"
/>
android:color=
"#03B988"
/>
<corners
android:radius=
"15dp"
/>
<corners
android:radius=
"15dp"
/>
</shape>
</shape>
\ No newline at end of file
app/src/main/res/layout/dialog_map_type.xml
View file @
ba3f81d7
...
@@ -21,7 +21,7 @@
...
@@ -21,7 +21,7 @@
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center_horizontal"
android:layout_gravity=
"center_horizontal"
android:layout_marginTop=
"26dp"
android:layout_marginTop=
"26dp"
android:padding=
"
1
dp"
android:padding=
"
2
dp"
android:src=
"@mipmap/staellitemap"
android:src=
"@mipmap/staellitemap"
tools:ignore=
"ContentDescription"
/>
tools:ignore=
"ContentDescription"
/>
...
@@ -50,7 +50,7 @@
...
@@ -50,7 +50,7 @@
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center_horizontal"
android:layout_gravity=
"center_horizontal"
android:layout_marginTop=
"26dp"
android:layout_marginTop=
"26dp"
android:padding=
"
1
dp"
android:padding=
"
2
dp"
android:src=
"@mipmap/streetmap"
android:src=
"@mipmap/streetmap"
tools:ignore=
"ContentDescription"
/>
tools:ignore=
"ContentDescription"
/>
...
...
app/src/main/res/layout/dialog_viewer_more.xml
View file @
ba3f81d7
...
@@ -6,6 +6,7 @@
...
@@ -6,6 +6,7 @@
android:orientation=
"vertical"
>
android:orientation=
"vertical"
>
<TextView
<TextView
android:id=
"@+id/tv_rename"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"45dp"
android:layout_height=
"45dp"
android:gravity=
"center"
android:gravity=
"center"
...
@@ -19,6 +20,7 @@
...
@@ -19,6 +20,7 @@
android:background=
"#545454"
/>
android:background=
"#545454"
/>
<TextView
<TextView
android:id=
"@+id/tv_delete"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"45dp"
android:layout_height=
"45dp"
android:gravity=
"center"
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