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
a64890fc
Commit
a64890fc
authored
Oct 31, 2024
by
wanglei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
...
parent
98d04232
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
72 additions
and
16 deletions
+72
-16
AdsMgr.kt
app/src/main/java/com/base/locationsharewhite/ads/AdsMgr.kt
+1
-2
ViewingBean.kt
...main/java/com/base/locationsharewhite/bean/ViewingBean.kt
+3
-1
LocationMapActivity.kt
.../locationsharewhite/ui/locationmap/LocationMapActivity.kt
+27
-5
ViewingAdapter.kt
.../base/locationsharewhite/ui/locationmap/ViewingAdapter.kt
+1
-1
LocationShareActivity.kt
.../base/locationsharewhite/ui/main/LocationShareActivity.kt
+1
-2
RenameActivity.kt
...java/com/base/locationsharewhite/ui/set/RenameActivity.kt
+36
-5
DialogView.kt
...n/java/com/base/locationsharewhite/ui/views/DialogView.kt
+2
-0
SpStringUtils.kt
...n/java/com/base/locationsharewhite/utils/SpStringUtils.kt
+1
-0
No files found.
app/src/main/java/com/base/locationsharewhite/ads/AdsMgr.kt
View file @
a64890fc
...
@@ -95,10 +95,9 @@ object AdsMgr {
...
@@ -95,10 +95,9 @@ object AdsMgr {
* 展示原生广告
* 展示原生广告
*
*
* @param parent 需要展示广告的父布局容器
* @param parent 需要展示广告的父布局容器
* @param layout 原生广告布局 ,这里传入的layout要和
com.example.mydemo.strategy.ads.admob.
NativeView里的id一致
* @param layout 原生广告布局 ,这里传入的layout要和NativeView里的id一致
*/
*/
fun
showNative
(
parent
:
ViewGroup
,
layout
:
Int
)
{
fun
showNative
(
parent
:
ViewGroup
,
layout
:
Int
)
{
if
(!
isInit
||
adsConfigBean
?.
isInBlackList
!=
false
)
return
adNativeMgr
.
show
(
parent
,
layout
)
adNativeMgr
.
show
(
parent
,
layout
)
}
}
...
...
app/src/main/java/com/base/locationsharewhite/bean/ViewingBean.kt
View file @
a64890fc
...
@@ -8,7 +8,9 @@ data class ViewingBean(
...
@@ -8,7 +8,9 @@ data class ViewingBean(
val
nickname
:
String
,
val
nickname
:
String
,
val
status
:
Int
=
-
1
,
//1可见,0不可见
val
status
:
Int
=
-
1
,
//1可见,0不可见
var
locatDate
:
LocationData
?
=
null
,
var
locatDate
:
LocationData
?
=
null
,
)
)
{
var
localNickName
:
String
?
=
null
}
data class
LocationData
(
data class
LocationData
(
val
longitude
:
Double
,
val
longitude
:
Double
,
...
...
app/src/main/java/com/base/locationsharewhite/ui/locationmap/LocationMapActivity.kt
View file @
a64890fc
...
@@ -2,6 +2,7 @@ package com.base.locationsharewhite.ui.locationmap
...
@@ -2,6 +2,7 @@ package com.base.locationsharewhite.ui.locationmap
import
android.animation.ValueAnimator
import
android.animation.ValueAnimator
import
android.annotation.SuppressLint
import
android.annotation.SuppressLint
import
android.content.Intent
import
android.graphics.Color
import
android.graphics.Color
import
android.view.LayoutInflater
import
android.view.LayoutInflater
import
android.view.View
import
android.view.View
...
@@ -11,6 +12,7 @@ import androidx.lifecycle.lifecycleScope
...
@@ -11,6 +12,7 @@ import androidx.lifecycle.lifecycleScope
import
com.base.locationsharewhite.BuildConfig
import
com.base.locationsharewhite.BuildConfig
import
com.base.locationsharewhite.R
import
com.base.locationsharewhite.R
import
com.base.locationsharewhite.bean.ConstObject
import
com.base.locationsharewhite.bean.ConstObject
import
com.base.locationsharewhite.bean.ViewerBean
import
com.base.locationsharewhite.bean.ViewingBean
import
com.base.locationsharewhite.bean.ViewingBean
import
com.base.locationsharewhite.databinding.ActivityLocationMapBinding
import
com.base.locationsharewhite.databinding.ActivityLocationMapBinding
import
com.base.locationsharewhite.helper.BaseActivity
import
com.base.locationsharewhite.helper.BaseActivity
...
@@ -19,11 +21,16 @@ import com.base.locationsharewhite.location.LocationPositionUtils
...
@@ -19,11 +21,16 @@ import com.base.locationsharewhite.location.LocationPositionUtils
import
com.base.locationsharewhite.location.LocationShareListUtils
import
com.base.locationsharewhite.location.LocationShareListUtils
import
com.base.locationsharewhite.map.MapUtils.addLocationMarker
import
com.base.locationsharewhite.map.MapUtils.addLocationMarker
import
com.base.locationsharewhite.map.MapUtils.getLatLngByLocationManager
import
com.base.locationsharewhite.map.MapUtils.getLatLngByLocationManager
import
com.base.locationsharewhite.ui.set.RenameActivity
import
com.base.locationsharewhite.ui.set.RenameActivity.Companion.RENAME_VIEWING_NICK_NAME
import
com.base.locationsharewhite.ui.views.DialogView.showMapTypeDialog
import
com.base.locationsharewhite.ui.views.DialogView.showMapTypeDialog
import
com.base.locationsharewhite.ui.views.DialogView.showViewerMoreDialog
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.PermissionUtils.checkLocationPermission
import
com.base.locationsharewhite.utils.PermissionUtils.checkLocationPermission
import
com.base.locationsharewhite.utils.SpStringUtils
import
com.base.locationsharewhite.utils.SpStringUtils.VIEWING_NICKNAME_KEY
import
com.base.locationsharewhite.utils.SpStringUtils._DEVICE_NICKNAME_
import
com.base.locationsharewhite.utils.ToastUtils.toast
import
com.base.locationsharewhite.utils.ToastUtils.toast
import
com.google.android.gms.maps.CameraUpdateFactory
import
com.google.android.gms.maps.CameraUpdateFactory
import
com.google.android.gms.maps.GoogleMap
import
com.google.android.gms.maps.GoogleMap
...
@@ -89,11 +96,14 @@ class LocationMapActivity : BaseActivity<ActivityLocationMapBinding>(), OnMapRea
...
@@ -89,11 +96,14 @@ class LocationMapActivity : BaseActivity<ActivityLocationMapBinding>(), OnMapRea
moreClick
=
{
anchorView
,
viewingBean
:
ViewingBean
->
moreClick
=
{
anchorView
,
viewingBean
:
ViewingBean
->
showViewerMoreDialog
(
anchorView
,
showViewerMoreDialog
(
anchorView
,
renameAction
=
{
renameAction
=
{
startActivity
(
Intent
(
this
,
RenameActivity
::
class
.
java
).
apply
{
putExtra
(
"doWhat"
,
RENAME_VIEWING_NICK_NAME
)
putExtra
(
"device"
,
viewingBean
.
device
)
putExtra
(
"nickName"
,
viewingBean
.
nickname
)
})
},
},
deleteAction
=
{
deleteAction
=
{
LocationShareListUtils
.
deleteShare
(
viewingBean
.
device
)
{
result
->
LocationShareListUtils
.
deleteShare
(
viewingBean
.
device
)
{
result
->
runOnUiThread
{
runOnUiThread
{
if
(
result
)
{
if
(
result
)
{
toast
(
"delete success"
)
toast
(
"delete success"
)
...
@@ -160,9 +170,11 @@ class LocationMapActivity : BaseActivity<ActivityLocationMapBinding>(), OnMapRea
...
@@ -160,9 +170,11 @@ class LocationMapActivity : BaseActivity<ActivityLocationMapBinding>(), OnMapRea
private
fun
initViewingData
()
{
private
fun
initViewingData
()
{
LocationShareListUtils
.
getShareList
(
LocationShareListUtils
.
getShareList
(
viewingListCallBack
=
{
viewingListCallBack
=
{
viewing
->
val
nickList
=
SpStringUtils
.
getSpStringList
(
VIEWING_NICKNAME_KEY
)
viewing
.
map
{
changeLocalNickName
(
it
,
nickList
)
}
runOnUiThread
{
runOnUiThread
{
if
(
it
.
isEmpty
())
{
if
(
viewing
.
isEmpty
())
{
showFriendGuideOrNoFriend
()
showFriendGuideOrNoFriend
()
adapter
.
submitList
(
listOf
())
adapter
.
submitList
(
listOf
())
cancelGetLocationJob
()
cancelGetLocationJob
()
...
@@ -170,7 +182,7 @@ class LocationMapActivity : BaseActivity<ActivityLocationMapBinding>(), OnMapRea
...
@@ -170,7 +182,7 @@ class LocationMapActivity : BaseActivity<ActivityLocationMapBinding>(), OnMapRea
binding
.
llFriendsGuide
.
visibility
=
View
.
GONE
binding
.
llFriendsGuide
.
visibility
=
View
.
GONE
binding
.
llNoFriend
.
visibility
=
View
.
GONE
binding
.
llNoFriend
.
visibility
=
View
.
GONE
binding
.
rvViewing
.
visibility
=
View
.
VISIBLE
binding
.
rvViewing
.
visibility
=
View
.
VISIBLE
adapter
.
submitList
(
it
)
adapter
.
submitList
(
viewing
)
}
}
}
}
}
}
...
@@ -404,4 +416,14 @@ class LocationMapActivity : BaseActivity<ActivityLocationMapBinding>(), OnMapRea
...
@@ -404,4 +416,14 @@ class LocationMapActivity : BaseActivity<ActivityLocationMapBinding>(), OnMapRea
}
}
}
}
private
fun
changeLocalNickName
(
viewingBean
:
ViewingBean
,
nickList
:
List
<
String
>)
{
val
deviceNicknameSp
=
nickList
.
find
{
it
.
contains
(
viewingBean
.
device
)
}
deviceNicknameSp
?.
let
{
sp
->
runCatching
{
val
localNickName
=
sp
.
split
(
_DEVICE_NICKNAME_
)[
1
]
viewingBean
.
localNickName
=
localNickName
}
}
}
}
}
\ No newline at end of file
app/src/main/java/com/base/locationsharewhite/ui/locationmap/ViewingAdapter.kt
View file @
a64890fc
...
@@ -21,7 +21,7 @@ class ViewingAdapter(
...
@@ -21,7 +21,7 @@ class ViewingAdapter(
item
?:
return
item
?:
return
val
binding
=
ItemViewingBinding
.
bind
(
holder
.
itemView
)
val
binding
=
ItemViewingBinding
.
bind
(
holder
.
itemView
)
binding
.
tvNameLetters
.
text
=
item
.
nickname
.
substring
(
0
,
1
)
binding
.
tvNameLetters
.
text
=
item
.
nickname
.
substring
(
0
,
1
)
binding
.
tvNameCode
.
text
=
item
.
nickname
binding
.
tvNameCode
.
text
=
item
.
localNickName
?:
item
.
nickname
when
(
item
.
locatDate
?.
power
)
{
when
(
item
.
locatDate
?.
power
)
{
in
0
..
20
->
{
in
0
..
20
->
{
binding
.
ivPower
.
setImageResource
(
R
.
mipmap
.
dianchi5
)
binding
.
ivPower
.
setImageResource
(
R
.
mipmap
.
dianchi5
)
...
...
app/src/main/java/com/base/locationsharewhite/ui/main/LocationShareActivity.kt
View file @
a64890fc
...
@@ -46,7 +46,6 @@ class LocationShareActivity : BaseActivity<ActivityLocationShareBinding>() {
...
@@ -46,7 +46,6 @@ class LocationShareActivity : BaseActivity<ActivityLocationShareBinding>() {
BarUtils
.
setStatusBarColor
(
this
,
Color
.
WHITE
)
BarUtils
.
setStatusBarColor
(
this
,
Color
.
WHITE
)
binding
.
root
.
updatePadding
(
top
=
BarUtils
.
getStatusBarHeight
())
binding
.
root
.
updatePadding
(
top
=
BarUtils
.
getStatusBarHeight
())
binding
.
editCode
.
setOnFocusChangeListener
{
v
,
hasFocus
->
binding
.
editCode
.
setOnFocusChangeListener
{
v
,
hasFocus
->
if
(
hasFocus
)
{
if
(
hasFocus
)
{
binding
.
editCode
.
hint
=
""
binding
.
editCode
.
hint
=
""
...
@@ -77,7 +76,7 @@ class LocationShareActivity : BaseActivity<ActivityLocationShareBinding>() {
...
@@ -77,7 +76,7 @@ class LocationShareActivity : BaseActivity<ActivityLocationShareBinding>() {
}
}
},
renameAction
=
{
},
renameAction
=
{
startActivity
(
Intent
(
this
,
RenameActivity
::
class
.
java
).
apply
{
startActivity
(
Intent
(
this
,
RenameActivity
::
class
.
java
).
apply
{
putExtra
(
"doWhat"
,
RenameActivity
.
RENAME_
FRIEND
_NICK_NAME
)
putExtra
(
"doWhat"
,
RenameActivity
.
RENAME_
VIEWER
_NICK_NAME
)
putExtra
(
"device"
,
viewerBean
.
device
)
putExtra
(
"device"
,
viewerBean
.
device
)
putExtra
(
"nickName"
,
viewerBean
.
localNickName
?:
viewerBean
.
nickName
)
putExtra
(
"nickName"
,
viewerBean
.
localNickName
?:
viewerBean
.
nickName
)
})
})
...
...
app/src/main/java/com/base/locationsharewhite/ui/set/RenameActivity.kt
View file @
a64890fc
...
@@ -12,6 +12,7 @@ import com.base.locationsharewhite.location.LocationNameUtils
...
@@ -12,6 +12,7 @@ import com.base.locationsharewhite.location.LocationNameUtils
import
com.base.locationsharewhite.utils.BarUtils
import
com.base.locationsharewhite.utils.BarUtils
import
com.base.locationsharewhite.utils.SpStringUtils
import
com.base.locationsharewhite.utils.SpStringUtils
import
com.base.locationsharewhite.utils.SpStringUtils.VIEWER_NICKNAME_KEY
import
com.base.locationsharewhite.utils.SpStringUtils.VIEWER_NICKNAME_KEY
import
com.base.locationsharewhite.utils.SpStringUtils.VIEWING_NICKNAME_KEY
import
com.base.locationsharewhite.utils.SpStringUtils._DEVICE_NICKNAME_
import
com.base.locationsharewhite.utils.SpStringUtils._DEVICE_NICKNAME_
import
com.base.locationsharewhite.utils.ToastUtils.toast
import
com.base.locationsharewhite.utils.ToastUtils.toast
...
@@ -29,7 +30,8 @@ class RenameActivity : BaseActivity<ActivityRenameBinding>() {
...
@@ -29,7 +30,8 @@ class RenameActivity : BaseActivity<ActivityRenameBinding>() {
companion
object
{
companion
object
{
const
val
RENAME_USER_NAME
=
"rename_user_name"
const
val
RENAME_USER_NAME
=
"rename_user_name"
const
val
RENAME_FRIEND_NICK_NAME
=
"rename_friend_nick_name"
const
val
RENAME_VIEWER_NICK_NAME
=
"rename_viewer_nick_name"
const
val
RENAME_VIEWING_NICK_NAME
=
"rename_viewing_nick_name"
}
}
override
fun
onNewIntent
(
intent
:
Intent
?)
{
override
fun
onNewIntent
(
intent
:
Intent
?)
{
...
@@ -50,11 +52,18 @@ class RenameActivity : BaseActivity<ActivityRenameBinding>() {
...
@@ -50,11 +52,18 @@ class RenameActivity : BaseActivity<ActivityRenameBinding>() {
if
(
doWhat
==
RENAME_USER_NAME
)
{
if
(
doWhat
==
RENAME_USER_NAME
)
{
binding
.
editName
.
setText
(
LocationLoginUtils
.
myNickNameSp
)
binding
.
editName
.
setText
(
LocationLoginUtils
.
myNickNameSp
)
}
else
{
}
if
(
doWhat
==
RENAME_VIEWER_NICK_NAME
)
{
binding
.
editName
.
setText
(
nickName
)
binding
.
tvEnterTip
.
text
=
getString
(
R
.
string
.
enter_friend_nickname
)
}
if
(
doWhat
==
RENAME_VIEWING_NICK_NAME
)
{
binding
.
editName
.
setText
(
nickName
)
binding
.
editName
.
setText
(
nickName
)
binding
.
tvEnterTip
.
text
=
getString
(
R
.
string
.
enter_friend_nickname
)
binding
.
tvEnterTip
.
text
=
getString
(
R
.
string
.
enter_friend_nickname
)
}
}
// if (BuildConfig.DEBUG) {
// if (BuildConfig.DEBUG) {
// binding.tvDevice.visibility = View.VISIBLE
// binding.tvDevice.visibility = View.VISIBLE
// binding.tvDevice.text = AppPreferences.getInstance().getString("uuid", "")
// binding.tvDevice.text = AppPreferences.getInstance().getString("uuid", "")
...
@@ -73,15 +82,19 @@ class RenameActivity : BaseActivity<ActivityRenameBinding>() {
...
@@ -73,15 +82,19 @@ class RenameActivity : BaseActivity<ActivityRenameBinding>() {
renameUser
()
renameUser
()
}
}
RENAME_FRIEND_NICK_NAME
->
{
RENAME_VIEWER_NICK_NAME
->
{
renameFriendNickName
()
renameViewerNickName
()
}
RENAME_VIEWING_NICK_NAME
->
{
renameViewingNickName
()
}
}
}
}
}
}
}
}
private
fun
rename
Friend
NickName
()
{
private
fun
rename
Viewer
NickName
()
{
val
newName
=
binding
.
editName
.
text
.
toString
()
val
newName
=
binding
.
editName
.
text
.
toString
()
if
(
newName
.
isEmpty
())
{
if
(
newName
.
isEmpty
())
{
toast
(
getString
(
R
.
string
.
name_is_empty
))
toast
(
getString
(
R
.
string
.
name_is_empty
))
...
@@ -99,6 +112,24 @@ class RenameActivity : BaseActivity<ActivityRenameBinding>() {
...
@@ -99,6 +112,24 @@ class RenameActivity : BaseActivity<ActivityRenameBinding>() {
finish
()
finish
()
}
}
private
fun
renameViewingNickName
()
{
val
newName
=
binding
.
editName
.
text
.
toString
()
if
(
newName
.
isEmpty
())
{
toast
(
getString
(
R
.
string
.
name_is_empty
))
return
}
val
nickList
=
SpStringUtils
.
getSpStringList
(
VIEWING_NICKNAME_KEY
)
val
olderSp
=
nickList
.
find
{
it
.
contains
(
device
)
}
olderSp
?.
let
{
SpStringUtils
.
deleteSpString
(
VIEWING_NICKNAME_KEY
,
it
)
}
val
sp
=
device
+
_DEVICE_NICKNAME_
+
newName
SpStringUtils
.
addSpString
(
VIEWING_NICKNAME_KEY
,
sp
)
toast
(
"Rename success"
)
finish
()
}
private
fun
renameUser
()
{
private
fun
renameUser
()
{
val
newName
=
binding
.
editName
.
text
.
toString
()
val
newName
=
binding
.
editName
.
text
.
toString
()
if
(
newName
.
isEmpty
())
{
if
(
newName
.
isEmpty
())
{
...
...
app/src/main/java/com/base/locationsharewhite/ui/views/DialogView.kt
View file @
a64890fc
...
@@ -11,6 +11,7 @@ import android.widget.FrameLayout
...
@@ -11,6 +11,7 @@ import android.widget.FrameLayout
import
android.widget.LinearLayout
import
android.widget.LinearLayout
import
androidx.core.content.ContextCompat
import
androidx.core.content.ContextCompat
import
com.base.locationsharewhite.R
import
com.base.locationsharewhite.R
import
com.base.locationsharewhite.ads.AdsMgr
import
com.base.locationsharewhite.databinding.DialogAppExitBinding
import
com.base.locationsharewhite.databinding.DialogAppExitBinding
import
com.base.locationsharewhite.databinding.DialogMapTypeBinding
import
com.base.locationsharewhite.databinding.DialogMapTypeBinding
import
com.base.locationsharewhite.databinding.DialogViewerMoreBinding
import
com.base.locationsharewhite.databinding.DialogViewerMoreBinding
...
@@ -80,6 +81,7 @@ object DialogView {
...
@@ -80,6 +81,7 @@ object DialogView {
binding
.
ivClose
.
setOnClickListener
{
binding
.
ivClose
.
setOnClickListener
{
dialog
.
dismiss
()
dialog
.
dismiss
()
}
}
AdsMgr
.
showNative
(
binding
.
flAd
,
R
.
layout
.
layout_admob_app_exit
)
}
}
...
...
app/src/main/java/com/base/locationsharewhite/utils/SpStringUtils.kt
View file @
a64890fc
...
@@ -5,6 +5,7 @@ object SpStringUtils {
...
@@ -5,6 +5,7 @@ object SpStringUtils {
private
val
TAG
=
"SpStringUtils"
private
val
TAG
=
"SpStringUtils"
const
val
VIEWER_NICKNAME_KEY
=
"viewer_nickname_key"
const
val
VIEWER_NICKNAME_KEY
=
"viewer_nickname_key"
const
val
VIEWING_NICKNAME_KEY
=
"viewing_nickname_key"
const
val
_DEVICE_NICKNAME_
=
"_device_nickname_"
const
val
_DEVICE_NICKNAME_
=
"_device_nickname_"
fun
getSpStringList
(
key
:
String
):
List
<
String
>
{
fun
getSpStringList
(
key
:
String
):
List
<
String
>
{
...
...
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