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
213fec50
Commit
213fec50
authored
Dec 11, 2024
by
wanglei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
...
parent
9294c03d
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
153 additions
and
66 deletions
+153
-66
HowUseShareActivity.kt
.../base/locationsharewhite/ui/howuse/HowUseShareActivity.kt
+16
-1
HowViewOtherActivity.kt
...base/locationsharewhite/ui/howuse/HowViewOtherActivity.kt
+16
-1
LocationMapActivity.kt
.../locationsharewhite/ui/locationmap/LocationMapActivity.kt
+55
-13
MainActivity.kt
.../java/com/base/locationsharewhite/ui/main/MainActivity.kt
+29
-40
LanguageActivity.kt
...va/com/base/locationsharewhite/ui/set/LanguageActivity.kt
+2
-1
SplashActivity.kt
...a/com/base/locationsharewhite/ui/splash/SplashActivity.kt
+8
-0
PermissionUtils.kt
...java/com/base/locationsharewhite/utils/PermissionUtils.kt
+23
-6
activity_language.xml
app/src/main/res/layout/activity_language.xml
+3
-4
activity_location_map.xml
app/src/main/res/layout/activity_location_map.xml
+1
-0
No files found.
app/src/main/java/com/base/locationsharewhite/ui/howuse/HowUseShareActivity.kt
View file @
213fec50
...
...
@@ -101,7 +101,22 @@ class HowUseShareActivity : BaseActivity<ActivityHowUseShareBinding>() {
if
(
uiType
==
1
)
{
step2ui
()
}
else
{
onBackPressedDispatcher
.
onBackPressed
()
AdsMgr
.
showInsert
(
activity
,
showCallBack
=
object
:
AdsShowCallBack
()
{
override
fun
close
(
where
:
Int
)
{
LogEx
.
logDebug
(
TAG
,
"where=$where"
)
finishToMainTop
()
}
override
fun
failed
(
where
:
Int
)
{
LogEx
.
logDebug
(
TAG
,
"where=$where"
)
finishToMainTop
()
}
override
fun
googleFailed
(
where
:
Int
)
{
LogEx
.
logDebug
(
TAG
,
"where=$where"
)
finishToMainTop
()
}
})
}
}
}
...
...
app/src/main/java/com/base/locationsharewhite/ui/howuse/HowViewOtherActivity.kt
View file @
213fec50
...
...
@@ -104,7 +104,22 @@ class HowViewOtherActivity : BaseActivity<ActivityHowViewOtherBinding>() {
if
(
uiType
==
1
)
{
step2ui
()
}
else
{
onBackPressedDispatcher
.
onBackPressed
()
AdsMgr
.
showInsert
(
activity
,
showCallBack
=
object
:
AdsShowCallBack
()
{
override
fun
close
(
where
:
Int
)
{
LogEx
.
logDebug
(
TAG
,
"where=$where"
)
finishToMainTop
()
}
override
fun
failed
(
where
:
Int
)
{
LogEx
.
logDebug
(
TAG
,
"where=$where"
)
finishToMainTop
()
}
override
fun
googleFailed
(
where
:
Int
)
{
LogEx
.
logDebug
(
TAG
,
"where=$where"
)
finishToMainTop
()
}
})
}
}
}
...
...
app/src/main/java/com/base/locationsharewhite/ui/locationmap/LocationMapActivity.kt
View file @
213fec50
package
com.base.locationsharewhite.ui.locationmap
import
android.Manifest
import
android.animation.ValueAnimator
import
android.annotation.SuppressLint
import
android.app.Dialog
import
android.content.Intent
import
android.graphics.Color
import
android.os.Build
import
android.view.LayoutInflater
import
android.view.View
import
android.view.animation.LinearInterpolator
import
androidx.activity.addCallback
import
androidx.core.view.isVisible
import
androidx.lifecycle.lifecycleScope
import
com.base.locationsharewhite.BuildConfig
import
com.base.locationsharewhite.R
...
...
@@ -16,6 +20,7 @@ import com.base.locationsharewhite.ads.AdsShowCallBack
import
com.base.locationsharewhite.bean.ConstObject
import
com.base.locationsharewhite.bean.ViewingBean
import
com.base.locationsharewhite.databinding.ActivityLocationMapBinding
import
com.base.locationsharewhite.fcm.NotificationUiUtil.sendAllAllowedNotification
import
com.base.locationsharewhite.helper.BaseActivity
import
com.base.locationsharewhite.location.LocationPositionUtils
import
com.base.locationsharewhite.location.LocationShareListUtils
...
...
@@ -28,8 +33,10 @@ 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.showViewerMoreDialog
import
com.base.locationsharewhite.ui.views.LocationPermissionDialog.showLocationAllowAllTimeDialog
import
com.base.locationsharewhite.utils.BarUtils
import
com.base.locationsharewhite.utils.LogEx
import
com.base.locationsharewhite.utils.PermissionUtils.checkAllLocationPermission
import
com.base.locationsharewhite.utils.PermissionUtils.checkBackgroundLocationPermission
import
com.base.locationsharewhite.utils.PermissionUtils.checkLocationPermission
import
com.base.locationsharewhite.utils.PermissionUtils.requestLocationAllowAllTime
...
...
@@ -64,6 +71,8 @@ class LocationMapActivity : BaseActivity<ActivityLocationMapBinding>(), OnMapRea
private
var
myMarker
:
Marker
?
=
null
private
var
friendMarker
:
Marker
?
=
null
private
var
currentViewingBean
:
ViewingBean
?
=
null
private
var
allowAllTimeDialog
:
Dialog
?
=
null
override
fun
initView
()
{
BarUtils
.
setStatusBarLightMode
(
this
,
true
)
...
...
@@ -74,20 +83,22 @@ class LocationMapActivity : BaseActivity<ActivityLocationMapBinding>(), OnMapRea
val
recreated
=
changeLanguage
(
this
)
if
(
recreated
)
return
if
(
AdsMgr
.
adsConfigBean
.
functionInShowAd
)
{
AdsMgr
.
showInsert
(
this
,
showCallBack
=
object
:
AdsShowCallBack
()
{
override
fun
close
(
where
:
Int
)
{
LogEx
.
logDebug
(
TAG
,
"where=$where"
)
}
if
(
checkAllLocationPermission
())
{
if
(
AdsMgr
.
adsConfigBean
.
functionInShowAd
)
{
AdsMgr
.
showInsert
(
this
,
showCallBack
=
object
:
AdsShowCallBack
()
{
override
fun
close
(
where
:
Int
)
{
LogEx
.
logDebug
(
TAG
,
"where=$where"
)
}
override
fun
failed
(
where
:
Int
)
{
LogEx
.
logDebug
(
TAG
,
"where=$where"
)
}
override
fun
failed
(
where
:
Int
)
{
LogEx
.
logDebug
(
TAG
,
"where=$where"
)
}
override
fun
googleFailed
(
where
:
Int
)
{
LogEx
.
logDebug
(
TAG
,
"where=$where"
)
}
})
override
fun
googleFailed
(
where
:
Int
)
{
LogEx
.
logDebug
(
TAG
,
"where=$where"
)
}
})
}
}
val
mapFragment
=
...
...
@@ -97,10 +108,41 @@ class LocationMapActivity : BaseActivity<ActivityLocationMapBinding>(), OnMapRea
showFriendGuideOrNoFriend
()
initAdapter
()
initViewingData
()
showAllowAllTimeDialog
()
}
private
fun
showAllowAllTimeDialog
()
{
if
(!
checkAllLocationPermission
())
{
// toast("显示权限始终允许弹窗")
if
(
allowAllTimeDialog
==
null
)
{
allowAllTimeDialog
=
showLocationAllowAllTimeDialog
(
setAction
=
{
sendAllAllowedNotification
(
this
)
requestLocationAllowAllTime
(
launcher
,
jumpOutAction
=
{
LogEx
.
logDebug
(
TAG
,
"jumpOutAction"
)
},
permissionAllowCallBack
=
{})
},
dismissAction
=
{
allowAllTimeDialog
=
null
})
}
}
else
{
// toast("不显示权限始终允许弹窗")
allowAllTimeDialog
?.
dismiss
()
allowAllTimeDialog
=
null
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
TIRAMISU
)
{
launcher
.
launch
(
arrayOf
(
Manifest
.
permission
.
POST_NOTIFICATIONS
))
{}
}
requestServiceLocationUpdates
()
}
}
override
fun
onResumeOneShoot
()
{
super
.
onResumeOneShoot
()
binding
.
ivPermission
.
isVisible
=
!
checkAllLocationPermission
()
}
...
...
@@ -286,7 +328,7 @@ class LocationMapActivity : BaseActivity<ActivityLocationMapBinding>(), OnMapRea
}
binding
.
bottomSheet
.
setOnClickListener
{
}
binding
.
ivPermission
.
setOnClickListener
{
requestLocationAllowAllTime
(
launcher
,
jumpOutAction
=
{},
permissionAllowAction
=
{}
)
showAllowAllTimeDialog
(
)
}
}
...
...
app/src/main/java/com/base/locationsharewhite/ui/main/MainActivity.kt
View file @
213fec50
...
...
@@ -13,7 +13,6 @@ import com.base.locationsharewhite.BuildConfig
import
com.base.locationsharewhite.R
import
com.base.locationsharewhite.ads.AdsMgr
import
com.base.locationsharewhite.ads.AdsShowCallBack
import
com.base.locationsharewhite.bean.config.ConfigBean
import
com.base.locationsharewhite.databinding.ActivityMainBinding
import
com.base.locationsharewhite.fcm.NotificationUiUtil.sendAllAllowedNotification
import
com.base.locationsharewhite.helper.BaseActivity
...
...
@@ -27,6 +26,8 @@ import com.base.locationsharewhite.ui.views.DialogView.showAppExitDialog
import
com.base.locationsharewhite.ui.views.LocationPermissionDialog.showLocationAllowAllTimeDialog
import
com.base.locationsharewhite.utils.BarUtils
import
com.base.locationsharewhite.utils.LogEx
import
com.base.locationsharewhite.utils.PermissionUtils.areNotificationsEnabled
import
com.base.locationsharewhite.utils.PermissionUtils.checkAllLocationPermission
import
com.base.locationsharewhite.utils.PermissionUtils.checkBackgroundLocationPermission
import
com.base.locationsharewhite.utils.PermissionUtils.checkBackgroundLocationPermissionDeniedByUser
import
com.base.locationsharewhite.utils.PermissionUtils.checkLocationPermission
...
...
@@ -38,7 +39,6 @@ import com.google.android.gms.maps.OnMapReadyCallback
import
com.google.android.gms.maps.SupportMapFragment
import
com.google.android.gms.maps.model.LatLng
import
com.google.android.gms.maps.model.Marker
import
com.google.gson.Gson
import
java.util.concurrent.atomic.AtomicBoolean
class
MainActivity
:
BaseActivity
<
ActivityMainBinding
>(),
OnMapReadyCallback
{
...
...
@@ -60,6 +60,9 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnMapReadyCallback {
BarUtils
.
setStatusBarColor
(
this
,
Color
.
TRANSPARENT
)
binding
.
root
.
updatePadding
(
top
=
BarUtils
.
getStatusBarHeight
())
val
recreated
=
changeLanguage
(
this
)
if
(
recreated
)
return
mainPresenter
=
MainPresenter
(
this
)
actionId
=
intent
.
extras
?.
getInt
(
"actionId"
)
LogEx
.
logDebug
(
TAG
,
"initView actionId=$actionId"
,
true
)
...
...
@@ -86,6 +89,13 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnMapReadyCallback {
mapFragment
?.
getMapAsync
(
this
)
LocationLoginUtils
.
login
()
if
(!
checkAllLocationPermission
())
{
showAllowAllTimeDialog
()
}
else
{
val
flag
=
areNotificationsEnabled
()
requestServiceLocationUpdates
()
}
}
private
var
bannerShowed
=
AtomicBoolean
(
false
)
...
...
@@ -94,22 +104,16 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnMapReadyCallback {
val
recreated
=
changeLanguage
(
this
)
if
(
recreated
)
return
if
(
checkAllLocationPermission
())
{
showNotificationDialog
()
if
(!
bannerShowed
.
get
())
{
bannerShowed
.
set
(
true
)
AdsMgr
.
showBanner
(
binding
.
flAd
)
}
}
mainPresenter
.
startLocationJob
(
lifecycleScope
)
showAllowAllTimeDialog
()
}
private
fun
showNotificationDialog
()
{
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
TIRAMISU
)
{
launcher
.
launch
(
arrayOf
(
Manifest
.
permission
.
POST_NOTIFICATIONS
))
{
override
fun
onResume
()
{
super
.
onResume
()
if
(
checkAllLocationPermission
()
||
allowAllTimeDialog
==
null
)
{
if
(!
bannerShowed
.
get
())
{
bannerShowed
.
set
(
true
)
AdsMgr
.
showBanner
(
binding
.
flAd
)
}
}
}
...
...
@@ -119,35 +123,20 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnMapReadyCallback {
mainPresenter
.
cancelLocationJob
()
}
private
fun
checkAllLocationPermission
():
Boolean
{
return
checkLocationPermission
()
&&
checkBackgroundLocationPermission
()
}
private
fun
showAllowAllTimeDialog
()
{
if
(!
checkAllLocationPermission
())
{
// toast("显示权限始终允许弹窗")
if
(
allowAllTimeDialog
==
null
)
{
allowAllTimeDialog
=
showLocationAllowAllTimeDialog
(
setAction
=
{
sendAllAllowedNotification
(
this
)
requestLocationAllowAllTime
(
launcher
,
jumpOutAction
=
{
LogEx
.
logDebug
(
TAG
,
"jumpOutAction"
)
},
permissionAllowAction
=
{})
},
dismissAction
=
{
allowAllTimeDialog
=
null
})
}
}
else
{
// toast("不显示权限始终允许弹窗")
allowAllTimeDialog
?.
dismiss
()
allowAllTimeDialog
=
null
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
TIRAMISU
)
{
launcher
.
launch
(
arrayOf
(
Manifest
.
permission
.
POST_NOTIFICATIONS
))
{}
}
requestServiceLocationUpdates
()
if
(
allowAllTimeDialog
==
null
)
{
allowAllTimeDialog
=
showLocationAllowAllTimeDialog
(
setAction
=
{
sendAllAllowedNotification
(
this
)
requestLocationAllowAllTime
(
launcher
,
jumpOutAction
=
{
LogEx
.
logDebug
(
TAG
,
"jumpOutAction"
)
},
permissionAllowCallBack
=
{})
},
dismissAction
=
{
allowAllTimeDialog
=
null
})
}
}
...
...
app/src/main/java/com/base/locationsharewhite/ui/set/LanguageActivity.kt
View file @
213fec50
...
...
@@ -3,6 +3,7 @@ package com.base.locationsharewhite.ui.set
import
android.content.Intent
import
android.graphics.Color
import
androidx.core.view.updatePadding
import
com.base.locationsharewhite.R
import
com.base.locationsharewhite.ads.AdsMgr
import
com.base.locationsharewhite.bean.ConstObject.appLanguageCountrySp
import
com.base.locationsharewhite.bean.ConstObject.appLanguageSp
...
...
@@ -28,7 +29,7 @@ class LanguageActivity : BaseActivity<ActivityLanguageBinding>() {
binding
.
root
.
updatePadding
(
top
=
BarUtils
.
getStatusBarHeight
())
isGuide
=
intent
.
extras
?.
getBoolean
(
"isGuide"
)
?:
false
AdsMgr
.
show
Banner
(
binding
.
flBanner
)
AdsMgr
.
show
Native
(
binding
.
flAd
,
R
.
layout
.
layout_admob_app_exit
)
adapter
=
LanguageAdapter
(
click
=
{
item
->
})
...
...
app/src/main/java/com/base/locationsharewhite/ui/splash/SplashActivity.kt
View file @
213fec50
package
com.base.locationsharewhite.ui.splash
import
android.Manifest
import
android.annotation.SuppressLint
import
android.content.Intent
import
android.graphics.Color
import
android.os.Build
import
androidx.lifecycle.lifecycleScope
import
com.base.locationsharewhite.R
import
com.base.locationsharewhite.ads.AdsMgr
...
...
@@ -59,6 +61,12 @@ class SplashActivity : BaseActivity<ActivitySplashBinding>(), SplashView {
agreePrivacy
()
}
initSolarEngine
(
true
)
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
TIRAMISU
)
{
launcher
.
launch
(
arrayOf
(
Manifest
.
permission
.
POST_NOTIFICATIONS
))
{
LogEx
.
logDebug
(
TAG
,
"POST_NOTIFICATIONS"
)
}
}
}
override
fun
showAd
()
{
...
...
app/src/main/java/com/base/locationsharewhite/utils/PermissionUtils.kt
View file @
213fec50
...
...
@@ -2,6 +2,7 @@ package com.base.locationsharewhite.utils
import
android.Manifest
import
android.app.Activity
import
android.app.NotificationManager
import
android.content.Context
import
android.content.Intent
import
android.content.pm.PackageManager
...
...
@@ -14,6 +15,14 @@ import com.base.locationsharewhite.utils.IntentUtils.intentAppDetailsSettings
object
PermissionUtils
{
fun
Context
.
areNotificationsEnabled
():
Boolean
{
val
notificationManager
=
this
.
getSystemService
(
Context
.
NOTIFICATION_SERVICE
)
as
NotificationManager
val
flag
=
notificationManager
.
areNotificationsEnabled
()
return
flag
}
fun
Context
.
checkStorePermission
():
Boolean
{
return
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
R
)
{
Environment
.
isExternalStorageManager
()
...
...
@@ -32,6 +41,10 @@ object PermissionUtils {
}
}
fun
Context
.
checkAllLocationPermission
():
Boolean
{
return
checkLocationPermission
()
&&
checkBackgroundLocationPermission
()
}
fun
Context
.
checkLocationPermission
():
Boolean
{
val
fineLocationPermission
=
ActivityCompat
.
checkSelfPermission
(
this
,
Manifest
.
permission
.
ACCESS_FINE_LOCATION
)
...
...
@@ -56,9 +69,13 @@ object PermissionUtils {
fun
Context
.
checkBackgroundLocationPermission
():
Boolean
{
return
ActivityCompat
.
checkSelfPermission
(
this
,
Manifest
.
permission
.
ACCESS_BACKGROUND_LOCATION
)
==
PackageManager
.
PERMISSION_GRANTED
return
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
Q
)
{
ActivityCompat
.
checkSelfPermission
(
this
,
Manifest
.
permission
.
ACCESS_BACKGROUND_LOCATION
)
==
PackageManager
.
PERMISSION_GRANTED
}
else
{
true
}
}
fun
Activity
.
checkBackgroundLocationPermissionDeniedByUser
():
Boolean
{
...
...
@@ -94,7 +111,7 @@ object PermissionUtils {
fun
Activity
.
requestLocationAllowAllTime
(
launcher
:
ActivityLauncher
,
jumpOutAction
:
(()
->
Unit
)?
=
null
,
//跳转到设置
permissionAllow
Action
:
(()
->
Unit
)?
=
null
//权限同意
permissionAllow
CallBack
:
(()
->
Unit
)?
=
null
//权限同意
)
{
val
TAG
=
"requestLocationAllowAllTime"
...
...
@@ -115,7 +132,7 @@ object PermissionUtils {
LogEx
.
logDebug
(
TAG
,
"后台位置权限回调 backLocationResult=$backLocationResult"
)
if
(
backLocationResult
)
{
// toast("权限请求完毕")
permissionAllow
Action
?.
invoke
()
permissionAllow
CallBack
?.
invoke
()
}
else
{
val
userBackLocationDeny
=
this
.
checkBackgroundLocationPermissionDeniedByUser
()
LogEx
.
logDebug
(
TAG
,
"userBackLocationDeny userBackLocationDeny=$userBackLocationDeny 跳转设置"
)
...
...
@@ -126,7 +143,7 @@ object PermissionUtils {
}
}
}
else
{
permissionAllow
Action
?.
invoke
()
permissionAllow
CallBack
?.
invoke
()
// toast("权限请求完毕")
}
}
else
{
...
...
app/src/main/res/layout/activity_language.xml
View file @
213fec50
...
...
@@ -64,18 +64,17 @@
android:paddingTop=
"16dp"
android:paddingBottom=
"40dp"
app:layoutManager=
"androidx.recyclerview.widget.GridLayoutManager"
app:layout_constraintBottom_toTopOf=
"@id/fl_
banner
"
app:layout_constraintBottom_toTopOf=
"@id/fl_
ad
"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@+id/tv"
app:spanCount=
"2"
tools:listitem=
"@layout/item_language"
/>
<
FrameLayout
android:id=
"@+id/fl_
banner
"
<
com.base.locationsharewhite.ads.NativeParentView
android:id=
"@+id/fl_
ad
"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:minHeight=
"60dp"
app:layout_constraintBottom_toBottomOf=
"parent"
/>
...
...
app/src/main/res/layout/activity_location_map.xml
View file @
213fec50
...
...
@@ -66,6 +66,7 @@
</androidx.constraintlayout.widget.ConstraintLayout>
<FrameLayout
android:id=
"@+id/bottom_sheet"
android:layout_width=
"match_parent"
...
...
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