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