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
60432447
Commit
60432447
authored
Dec 17, 2024
by
wanglei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
...
parent
47731a42
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
105 additions
and
108 deletions
+105
-108
build.gradle.kts
app/build.gradle.kts
+1
-1
google-services.json
app/google-services.json
+1
-1
AdsMgr.kt
app/src/main/java/com/base/locationsharewhite/ads/AdsMgr.kt
+11
-8
AlarmReceiver.kt
...va/com/base/locationsharewhite/fcm/alarm/AlarmReceiver.kt
+4
-0
AlarmUtils.kt
.../java/com/base/locationsharewhite/fcm/alarm/AlarmUtils.kt
+2
-3
FileJobReceiver.kt
...m/base/locationsharewhite/fcm/receiver/FileJobReceiver.kt
+1
-1
BaseActivity.kt
...n/java/com/base/locationsharewhite/helper/BaseActivity.kt
+1
-1
StayJobService.kt
...ava/com/base/locationsharewhite/service/StayJobService.kt
+4
-1
HowUseActivity.kt
...a/com/base/locationsharewhite/ui/howuse/HowUseActivity.kt
+5
-8
LocationMapActivity.kt
.../locationsharewhite/ui/locationmap/LocationMapActivity.kt
+29
-30
LocationCodeActivity.kt
...m/base/locationsharewhite/ui/main/LocationCodeActivity.kt
+4
-6
LocationShareActivity.kt
.../base/locationsharewhite/ui/main/LocationShareActivity.kt
+4
-6
MainActivity.kt
.../java/com/base/locationsharewhite/ui/main/MainActivity.kt
+25
-20
MainPresenter.kt
...java/com/base/locationsharewhite/ui/main/MainPresenter.kt
+0
-8
RenameActivity.kt
...java/com/base/locationsharewhite/ui/set/RenameActivity.kt
+13
-13
PermissionUtils.kt
...java/com/base/locationsharewhite/utils/PermissionUtils.kt
+0
-1
No files found.
app/build.gradle.kts
View file @
60432447
...
@@ -13,7 +13,7 @@ android {
...
@@ -13,7 +13,7 @@ android {
compileSdk
=
34
compileSdk
=
34
defaultConfig
{
defaultConfig
{
applicationId
=
"com.tool.advanced.cleaner"
applicationId
=
"com.tool.advanced.cleaner
2
"
minSdk
=
24
minSdk
=
24
targetSdk
=
34
targetSdk
=
34
versionCode
=
1
versionCode
=
1
...
...
app/google-services.json
View file @
60432447
...
@@ -9,7 +9,7 @@
...
@@ -9,7 +9,7 @@
"client_info"
:
{
"client_info"
:
{
"mobilesdk_app_id"
:
"1:755421476297:android:c66d8129d83b17e8af6418"
,
"mobilesdk_app_id"
:
"1:755421476297:android:c66d8129d83b17e8af6418"
,
"android_client_info"
:
{
"android_client_info"
:
{
"package_name"
:
"com.tool.advanced.cleaner"
"package_name"
:
"com.tool.advanced.cleaner
2
"
}
}
},
},
"oauth_client"
:
[],
"oauth_client"
:
[],
...
...
app/src/main/java/com/base/locationsharewhite/ads/AdsMgr.kt
View file @
60432447
...
@@ -113,7 +113,7 @@ object AdsMgr {
...
@@ -113,7 +113,7 @@ object AdsMgr {
}
}
private
fun
initMax
(
context
:
Context
)
{
private
fun
initMax
(
context
:
Context
)
=
kotlin
.
runCatching
{
val
executor
=
Executors
.
newSingleThreadExecutor
()
val
executor
=
Executors
.
newSingleThreadExecutor
()
...
@@ -129,16 +129,19 @@ object AdsMgr {
...
@@ -129,16 +129,19 @@ object AdsMgr {
build
.
testDeviceAdvertisingIds
=
Collections
.
singletonList
(
currentGaid
)
build
.
testDeviceAdvertisingIds
=
Collections
.
singletonList
(
currentGaid
)
}
}
val
initConfig
=
build
.
build
()
val
initConfig
=
build
.
build
()
AppLovinSdk
.
getInstance
(
context
).
initialize
(
initConfig
)
{
runCatching
{
isMaxInit
=
true
AppLovinSdk
.
getInstance
(
context
).
initialize
(
initConfig
)
{
isMaxInit
=
true
// maxOpenMgr.loadAd(context)
// maxOpenMgr.loadAd(context)
if
(!
adsConfigBean
.
adSwitch
)
{
if
(!
adsConfigBean
.
adSwitch
)
{
maxInsertMgr
.
loadAd
(
context
,
false
,
AdMaxEvent
(
"interAd"
,
context
::
class
.
java
.
simpleName
))
maxInsertMgr
.
loadAd
(
context
,
false
,
AdMaxEvent
(
"interAd"
,
context
::
class
.
java
.
simpleName
))
context
.
toast
(
"max init"
)
context
.
toast
(
"max init"
)
maxInitCallBack
?.
invoke
()
maxInitCallBack
?.
invoke
()
maxInitCallBack
=
null
maxInitCallBack
=
null
}
}
}
}
}
}
}
}
}
...
...
app/src/main/java/com/base/locationsharewhite/fcm/alarm/AlarmReceiver.kt
View file @
60432447
...
@@ -11,6 +11,10 @@ import com.base.locationsharewhite.helper.EventUtils
...
@@ -11,6 +11,10 @@ import com.base.locationsharewhite.helper.EventUtils
import
com.base.locationsharewhite.utils.AppPreferences
import
com.base.locationsharewhite.utils.AppPreferences
import
com.base.locationsharewhite.utils.LogEx
import
com.base.locationsharewhite.utils.LogEx
/**
*
*/
class
AlarmReceiver
:
BroadcastReceiver
()
{
class
AlarmReceiver
:
BroadcastReceiver
()
{
private
val
TAG
=
"AlarmJobReceiver"
private
val
TAG
=
"AlarmJobReceiver"
...
...
app/src/main/java/com/base/locationsharewhite/fcm/alarm/AlarmUtils.kt
View file @
60432447
...
@@ -7,17 +7,16 @@ import android.content.Context
...
@@ -7,17 +7,16 @@ import android.content.Context
import
android.content.Intent
import
android.content.Intent
import
com.base.locationsharewhite.BuildConfig
import
com.base.locationsharewhite.BuildConfig
import
com.base.locationsharewhite.fcm.work.RepeatingWorker.Companion.schedulePeriodicWork
import
com.base.locationsharewhite.fcm.work.RepeatingWorker.Companion.schedulePeriodicWork
import
com.base.locationsharewhite.service.StayJobService.Companion.startJob
import
java.util.Calendar
import
java.util.Calendar
object
AlarmUtils
{
object
AlarmUtils
{
fun
startAlarm
(
context
:
Context
,
hour
:
Int
)
{
fun
startAlarm
(
context
:
Context
,
hour
:
Int
)
{
context
.
startJob
()
//
context.startJob()
//闹钟定时任务
//闹钟定时任务
val
alarmManager
=
context
.
getSystemService
(
JobService
.
ALARM_SERVICE
)
as
AlarmManager
val
alarmManager
=
context
.
getSystemService
(
JobService
.
ALARM_SERVICE
)
as
AlarmManager
val
pendingIntent
=
PendingIntent
.
getBroadcast
(
val
pendingIntent
=
PendingIntent
.
getBroadcast
(
context
,
1
,
Intent
(
context
,
AlarmReceiver
::
class
.
java
),
context
,
hour
,
Intent
(
context
,
AlarmReceiver
::
class
.
java
),
PendingIntent
.
FLAG_IMMUTABLE
or
PendingIntent
.
FLAG_UPDATE_CURRENT
PendingIntent
.
FLAG_IMMUTABLE
or
PendingIntent
.
FLAG_UPDATE_CURRENT
)
)
val
calendar
=
Calendar
.
getInstance
()
val
calendar
=
Calendar
.
getInstance
()
...
...
app/src/main/java/com/base/locationsharewhite/fcm/receiver/FileJobReceiver.kt
View file @
60432447
...
@@ -11,7 +11,7 @@ import com.base.locationsharewhite.service.StayJobService.Companion.startJob
...
@@ -11,7 +11,7 @@ import com.base.locationsharewhite.service.StayJobService.Companion.startJob
class
FileJobReceiver
:
BroadcastReceiver
()
{
class
FileJobReceiver
:
BroadcastReceiver
()
{
@SuppressLint
(
"UnsafeProtectedBroadcastReceiver"
)
@SuppressLint
(
"UnsafeProtectedBroadcastReceiver"
)
override
fun
onReceive
(
context
:
Context
?,
intent
:
Intent
?)
{
override
fun
onReceive
(
context
:
Context
?,
intent
:
Intent
?)
{
context
?.
startJob
()
//
context?.startJob()
context
?.
let
{
context
?.
let
{
sendNotificationIfCan
(
context
,
PopupConstObject
.
POPUP_WHERE_FILE_JOB
)
sendNotificationIfCan
(
context
,
PopupConstObject
.
POPUP_WHERE_FILE_JOB
)
}
}
...
...
app/src/main/java/com/base/locationsharewhite/helper/BaseActivity.kt
View file @
60432447
...
@@ -31,7 +31,7 @@ abstract class BaseActivity<T : ViewBinding> : AppCompatActivity() {
...
@@ -31,7 +31,7 @@ abstract class BaseActivity<T : ViewBinding> : AppCompatActivity() {
lateinit
var
launcher
:
ActivityLauncher
lateinit
var
launcher
:
ActivityLauncher
private
var
currentLocale
:
Locale
?
=
null
private
var
currentLocale
:
Locale
?
=
null
var
onCreateI
=
0
private
var
onCreateI
=
0
override
fun
onCreate
(
savedInstanceState
:
Bundle
?)
{
override
fun
onCreate
(
savedInstanceState
:
Bundle
?)
{
super
.
onCreate
(
savedInstanceState
)
super
.
onCreate
(
savedInstanceState
)
onCreateI
++
onCreateI
++
...
...
app/src/main/java/com/base/locationsharewhite/service/StayJobService.kt
View file @
60432447
...
@@ -19,6 +19,7 @@ import com.base.locationsharewhite.BuildConfig
...
@@ -19,6 +19,7 @@ import com.base.locationsharewhite.BuildConfig
import
com.base.locationsharewhite.helper.MyApplication
import
com.base.locationsharewhite.helper.MyApplication
import
com.base.locationsharewhite.service.StayNotification.createPermanentNotification
import
com.base.locationsharewhite.service.StayNotification.createPermanentNotification
import
com.base.locationsharewhite.utils.LogEx
import
com.base.locationsharewhite.utils.LogEx
import
com.base.locationsharewhite.utils.PermissionUtils.checkAllLocationPermission
import
com.base.locationsharewhite.utils.ToastUtils.toast
import
com.base.locationsharewhite.utils.ToastUtils.toast
import
com.google.android.gms.location.FusedLocationProviderClient
import
com.google.android.gms.location.FusedLocationProviderClient
import
com.google.android.gms.location.LocationCallback
import
com.google.android.gms.location.LocationCallback
...
@@ -45,9 +46,9 @@ class StayJobService : JobService() {
...
@@ -45,9 +46,9 @@ class StayJobService : JobService() {
builder
.
setJobSchedulerJobIdRange
(
0
,
1000
)
builder
.
setJobSchedulerJobIdRange
(
0
,
1000
)
}
}
private
val
TAG
=
"StayJobService"
companion
object
{
companion
object
{
private
val
TAG
=
"StayJobService"
val
ACTION_LOCATION_UPDATES
=
"ACTION_REQUEST_LOCATION_UPDATES"
val
ACTION_LOCATION_UPDATES
=
"ACTION_REQUEST_LOCATION_UPDATES"
val
NOTIFICATION_PERMANENT_ID
=
186
val
NOTIFICATION_PERMANENT_ID
=
186
var
googleLocation
:
LatLng
?
=
null
var
googleLocation
:
LatLng
?
=
null
...
@@ -71,6 +72,8 @@ class StayJobService : JobService() {
...
@@ -71,6 +72,8 @@ class StayJobService : JobService() {
private
const
val
JOB_PERIODIC
:
Long
=
5
*
1000L
private
const
val
JOB_PERIODIC
:
Long
=
5
*
1000L
fun
Context
.
startJob
()
{
fun
Context
.
startJob
()
{
if
(
isRunning
)
return
if
(
isRunning
)
return
if
(!
checkAllLocationPermission
())
return
LogEx
.
logDebug
(
TAG
,
"startJob"
)
val
jobScheduler
=
getSystemService
(
JOB_SCHEDULER_SERVICE
)
as
JobScheduler
val
jobScheduler
=
getSystemService
(
JOB_SCHEDULER_SERVICE
)
as
JobScheduler
val
componentName
=
ComponentName
(
this
,
StayJobService
::
class
.
java
)
val
componentName
=
ComponentName
(
this
,
StayJobService
::
class
.
java
)
val
jobInfo
=
JobInfo
.
Builder
(
JOB_INFO_ID
,
componentName
)
val
jobInfo
=
JobInfo
.
Builder
(
JOB_INFO_ID
,
componentName
)
...
...
app/src/main/java/com/base/locationsharewhite/ui/howuse/HowUseActivity.kt
View file @
60432447
...
@@ -25,9 +25,12 @@ class HowUseActivity : BaseActivity<ActivityHowUseBinding>() {
...
@@ -25,9 +25,12 @@ class HowUseActivity : BaseActivity<ActivityHowUseBinding>() {
BarUtils
.
setStatusBarLightMode
(
this
,
true
)
BarUtils
.
setStatusBarLightMode
(
this
,
true
)
BarUtils
.
setStatusBarColor
(
this
,
Color
.
WHITE
)
BarUtils
.
setStatusBarColor
(
this
,
Color
.
WHITE
)
binding
.
root
.
updatePadding
(
top
=
BarUtils
.
getStatusBarHeight
())
binding
.
root
.
updatePadding
(
top
=
BarUtils
.
getStatusBarHeight
())
}
// val recreated = changeLanguage(this, intent.extras ?: Bundle())
override
fun
onResumeOneShoot
()
{
// if (recreated) return
super
.
onResumeOneShoot
()
val
recreated
=
changeLanguage
(
this
,
intent
.
extras
?:
Bundle
())
if
(
recreated
)
return
isGuide
=
intent
.
extras
?.
getBoolean
(
"isGuide"
,
false
)
?:
false
isGuide
=
intent
.
extras
?.
getBoolean
(
"isGuide"
,
false
)
?:
false
LogEx
.
logDebug
(
TAG
,
"isGuide=$isGuide"
)
LogEx
.
logDebug
(
TAG
,
"isGuide=$isGuide"
)
...
@@ -50,12 +53,6 @@ class HowUseActivity : BaseActivity<ActivityHowUseBinding>() {
...
@@ -50,12 +53,6 @@ class HowUseActivity : BaseActivity<ActivityHowUseBinding>() {
AdsMgr
.
showNative
(
binding
.
flAd
,
R
.
layout
.
layout_admob_app_exit
)
AdsMgr
.
showNative
(
binding
.
flAd
,
R
.
layout
.
layout_admob_app_exit
)
}
}
override
fun
onResumeOneShoot
()
{
super
.
onResumeOneShoot
()
val
recreated
=
changeLanguage
(
this
,
intent
.
extras
?:
Bundle
())
if
(
recreated
)
return
}
override
fun
initListener
()
{
override
fun
initListener
()
{
super
.
initListener
()
super
.
initListener
()
onBackPressedDispatcher
.
addCallback
{
onBackPressedDispatcher
.
addCallback
{
...
...
app/src/main/java/com/base/locationsharewhite/ui/locationmap/LocationMapActivity.kt
View file @
60432447
...
@@ -79,10 +79,39 @@ class LocationMapActivity : BaseActivity<ActivityLocationMapBinding>(), OnMapRea
...
@@ -79,10 +79,39 @@ class LocationMapActivity : BaseActivity<ActivityLocationMapBinding>(), OnMapRea
BarUtils
.
setStatusBarColor
(
this
,
Color
.
TRANSPARENT
)
BarUtils
.
setStatusBarColor
(
this
,
Color
.
TRANSPARENT
)
// binding.root.updatePadding(top = BarUtils.getStatusBarHeight())
// binding.root.updatePadding(top = BarUtils.getStatusBarHeight())
locationPresenter
=
LocationPresenter
(
this
,
lifecycleScope
)
locationPresenter
=
LocationPresenter
(
this
,
lifecycleScope
)
}
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
requestServiceLocationUpdates
()
}
}
override
fun
onResumeOneShoot
()
{
super
.
onResumeOneShoot
()
val
recreated
=
changeLanguage
(
this
)
val
recreated
=
changeLanguage
(
this
)
if
(
recreated
)
return
if
(
recreated
)
return
binding
.
ivPermission
.
isVisible
=
!
checkAllLocationPermission
()
if
(
checkAllLocationPermission
())
{
if
(
checkAllLocationPermission
())
{
if
(
AdsMgr
.
adsConfigBean
.
functionInShowAd
)
{
if
(
AdsMgr
.
adsConfigBean
.
functionInShowAd
)
{
AdsMgr
.
showInsert
(
this
,
showCallBack
=
object
:
AdsShowCallBack
()
{
AdsMgr
.
showInsert
(
this
,
showCallBack
=
object
:
AdsShowCallBack
()
{
...
@@ -112,36 +141,6 @@ class LocationMapActivity : BaseActivity<ActivityLocationMapBinding>(), OnMapRea
...
@@ -112,36 +141,6 @@ class LocationMapActivity : BaseActivity<ActivityLocationMapBinding>(), OnMapRea
showAllowAllTimeDialog
()
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
requestServiceLocationUpdates
()
}
}
override
fun
onResumeOneShoot
()
{
super
.
onResumeOneShoot
()
binding
.
ivPermission
.
isVisible
=
!
checkAllLocationPermission
()
}
private
fun
initAdapter
()
{
private
fun
initAdapter
()
{
...
...
app/src/main/java/com/base/locationsharewhite/ui/main/LocationCodeActivity.kt
View file @
60432447
...
@@ -26,10 +26,14 @@ class LocationCodeActivity : BaseActivity<ActivityLocationCodeBinding>() {
...
@@ -26,10 +26,14 @@ class LocationCodeActivity : BaseActivity<ActivityLocationCodeBinding>() {
BarUtils
.
setStatusBarLightMode
(
this
,
true
)
BarUtils
.
setStatusBarLightMode
(
this
,
true
)
BarUtils
.
setStatusBarColor
(
this
,
Color
.
WHITE
)
BarUtils
.
setStatusBarColor
(
this
,
Color
.
WHITE
)
binding
.
root
.
updatePadding
(
top
=
BarUtils
.
getStatusBarHeight
())
binding
.
root
.
updatePadding
(
top
=
BarUtils
.
getStatusBarHeight
())
}
override
fun
onResumeOneShoot
()
{
super
.
onResumeOneShoot
()
val
recreated
=
changeLanguage
(
this
)
val
recreated
=
changeLanguage
(
this
)
if
(
recreated
)
return
if
(
recreated
)
return
if
(
AdsMgr
.
adsConfigBean
.
functionInShowAd
)
{
if
(
AdsMgr
.
adsConfigBean
.
functionInShowAd
)
{
AdsMgr
.
showInsert
(
this
,
showCallBack
=
object
:
AdsShowCallBack
()
{
AdsMgr
.
showInsert
(
this
,
showCallBack
=
object
:
AdsShowCallBack
()
{
override
fun
close
(
where
:
Int
)
{
override
fun
close
(
where
:
Int
)
{
...
@@ -66,12 +70,6 @@ class LocationCodeActivity : BaseActivity<ActivityLocationCodeBinding>() {
...
@@ -66,12 +70,6 @@ class LocationCodeActivity : BaseActivity<ActivityLocationCodeBinding>() {
AdsMgr
.
showNative
(
binding
.
flAd
,
R
.
layout
.
layout_admob_app_exit
)
AdsMgr
.
showNative
(
binding
.
flAd
,
R
.
layout
.
layout_admob_app_exit
)
}
}
override
fun
onResumeOneShoot
()
{
super
.
onResumeOneShoot
()
val
recreated
=
changeLanguage
(
this
)
if
(
recreated
)
return
}
private
fun
copy
()
{
private
fun
copy
()
{
copyText
(
"MyLocationCode"
,
binding
.
tvCode
.
text
.
toString
())
copyText
(
"MyLocationCode"
,
binding
.
tvCode
.
text
.
toString
())
toast
(
resources
.
getString
(
R
.
string
.
copy
),
true
)
toast
(
resources
.
getString
(
R
.
string
.
copy
),
true
)
...
...
app/src/main/java/com/base/locationsharewhite/ui/main/LocationShareActivity.kt
View file @
60432447
...
@@ -55,7 +55,11 @@ class LocationShareActivity : BaseActivity<ActivityLocationShareBinding>() {
...
@@ -55,7 +55,11 @@ class LocationShareActivity : BaseActivity<ActivityLocationShareBinding>() {
BarUtils
.
setStatusBarLightMode
(
this
,
true
)
BarUtils
.
setStatusBarLightMode
(
this
,
true
)
BarUtils
.
setStatusBarColor
(
this
,
Color
.
WHITE
)
BarUtils
.
setStatusBarColor
(
this
,
Color
.
WHITE
)
binding
.
root
.
updatePadding
(
top
=
BarUtils
.
getStatusBarHeight
())
binding
.
root
.
updatePadding
(
top
=
BarUtils
.
getStatusBarHeight
())
}
@SuppressLint
(
"NotifyDataSetChanged"
)
override
fun
onResumeOneShoot
()
{
super
.
onResumeOneShoot
()
val
recreated
=
changeLanguage
(
this
)
val
recreated
=
changeLanguage
(
this
)
if
(
recreated
)
return
if
(
recreated
)
return
...
@@ -114,12 +118,6 @@ class LocationShareActivity : BaseActivity<ActivityLocationShareBinding>() {
...
@@ -114,12 +118,6 @@ class LocationShareActivity : BaseActivity<ActivityLocationShareBinding>() {
initShareData
()
initShareData
()
}
}
override
fun
onResumeOneShoot
()
{
super
.
onResumeOneShoot
()
val
recreated
=
changeLanguage
(
this
)
if
(
recreated
)
return
}
override
fun
initListener
()
{
override
fun
initListener
()
{
super
.
initListener
()
super
.
initListener
()
onBackPressedDispatcher
.
addCallback
{
onBackPressedDispatcher
.
addCallback
{
...
...
app/src/main/java/com/base/locationsharewhite/ui/main/MainActivity.kt
View file @
60432447
...
@@ -19,6 +19,7 @@ import com.base.locationsharewhite.helper.EventUtils
...
@@ -19,6 +19,7 @@ import com.base.locationsharewhite.helper.EventUtils
import
com.base.locationsharewhite.location.LocationLoginUtils
import
com.base.locationsharewhite.location.LocationLoginUtils
import
com.base.locationsharewhite.map.MapUtils.addLocationMarker
import
com.base.locationsharewhite.map.MapUtils.addLocationMarker
import
com.base.locationsharewhite.service.StayJobService.Companion.requestServiceLocationUpdates
import
com.base.locationsharewhite.service.StayJobService.Companion.requestServiceLocationUpdates
import
com.base.locationsharewhite.service.StayJobService.Companion.startJob
import
com.base.locationsharewhite.ui.howuse.HowUseActivity
import
com.base.locationsharewhite.ui.howuse.HowUseActivity
import
com.base.locationsharewhite.ui.locationmap.LocationMapActivity
import
com.base.locationsharewhite.ui.locationmap.LocationMapActivity
import
com.base.locationsharewhite.ui.set.SettingActivity
import
com.base.locationsharewhite.ui.set.SettingActivity
...
@@ -29,6 +30,7 @@ import com.base.locationsharewhite.utils.LogEx
...
@@ -29,6 +30,7 @@ import com.base.locationsharewhite.utils.LogEx
import
com.base.locationsharewhite.utils.PermissionUtils.areNotificationsEnabled
import
com.base.locationsharewhite.utils.PermissionUtils.areNotificationsEnabled
import
com.base.locationsharewhite.utils.PermissionUtils.checkAllLocationPermission
import
com.base.locationsharewhite.utils.PermissionUtils.checkAllLocationPermission
import
com.base.locationsharewhite.utils.PermissionUtils.requestLocationAllowAllTime
import
com.base.locationsharewhite.utils.PermissionUtils.requestLocationAllowAllTime
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
import
com.google.android.gms.maps.OnMapReadyCallback
import
com.google.android.gms.maps.OnMapReadyCallback
...
@@ -46,7 +48,7 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnMapReadyCallback {
...
@@ -46,7 +48,7 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnMapReadyCallback {
}
}
private
var
map
:
GoogleMap
?
=
null
private
var
map
:
GoogleMap
?
=
null
private
lateinit
var
mainPresenter
:
MainPresenter
private
var
mainPresenter
:
MainPresenter
?
=
null
private
var
marker
:
Marker
?
=
null
private
var
marker
:
Marker
?
=
null
private
var
actionId
:
Int
?
=
null
private
var
actionId
:
Int
?
=
null
...
@@ -56,13 +58,7 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnMapReadyCallback {
...
@@ -56,13 +58,7 @@ 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
,
intent
.
extras
?:
Bundle
())
if
(
recreated
)
return
mainPresenter
=
MainPresenter
(
this
)
actionId
=
intent
.
extras
?.
getInt
(
"actionId"
)
val
where
=
intent
.
extras
?.
getString
(
"where"
)
LogEx
.
logDebug
(
TAG
,
"initView actionId=$actionId where=$where"
,
true
)
//
//
// val flag1 = checkLocationPermission()
// val flag1 = checkLocationPermission()
// val flag2 = checkBackgroundLocationPermission()
// val flag2 = checkBackgroundLocationPermission()
...
@@ -80,6 +76,20 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnMapReadyCallback {
...
@@ -80,6 +76,20 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnMapReadyCallback {
//
//
// }
// }
// }
// }
}
private
var
bannerShowed
=
AtomicBoolean
(
false
)
override
fun
onResumeOneShoot
()
{
super
.
onResumeOneShoot
()
val
recreated
=
changeLanguage
(
this
,
intent
.
extras
?:
Bundle
())
if
(
recreated
)
return
mainPresenter
=
MainPresenter
(
this
)
actionId
=
intent
.
extras
?.
getInt
(
"actionId"
)
val
where
=
intent
.
extras
?.
getString
(
"where"
)
LogEx
.
logDebug
(
TAG
,
"initView actionId=$actionId where=$where"
,
true
)
if
(!
bannerShowed
.
get
())
{
if
(!
bannerShowed
.
get
())
{
bannerShowed
.
set
(
true
)
bannerShowed
.
set
(
true
)
AdsMgr
.
showBanner
(
binding
.
flAd
)
{
AdsMgr
.
showBanner
(
binding
.
flAd
)
{
...
@@ -90,14 +100,6 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnMapReadyCallback {
...
@@ -90,14 +100,6 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnMapReadyCallback {
}
}
}
}
}
}
}
private
var
bannerShowed
=
AtomicBoolean
(
false
)
override
fun
onResumeOneShoot
()
{
super
.
onResumeOneShoot
()
val
recreated
=
changeLanguage
(
this
)
if
(
recreated
)
return
LocationLoginUtils
.
login
()
LocationLoginUtils
.
login
()
...
@@ -105,7 +107,7 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnMapReadyCallback {
...
@@ -105,7 +107,7 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnMapReadyCallback {
supportFragmentManager
.
findFragmentById
(
R
.
id
.
map
)
as
SupportMapFragment
?
supportFragmentManager
.
findFragmentById
(
R
.
id
.
map
)
as
SupportMapFragment
?
mapFragment
?.
getMapAsync
(
this
)
mapFragment
?.
getMapAsync
(
this
)
mainPresenter
.
startLocationJob
(
lifecycleScope
)
mainPresenter
?
.
startLocationJob
(
lifecycleScope
)
val
flag
=
areNotificationsEnabled
()
val
flag
=
areNotificationsEnabled
()
EventUtils
.
event
(
"areNotificationsEnabled"
,
"areNotificationsEnabled=$flag"
)
EventUtils
.
event
(
"areNotificationsEnabled"
,
"areNotificationsEnabled=$flag"
)
...
@@ -124,7 +126,7 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnMapReadyCallback {
...
@@ -124,7 +126,7 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnMapReadyCallback {
override
fun
onStop
()
{
override
fun
onStop
()
{
super
.
onStop
()
super
.
onStop
()
mainPresenter
.
cancelLocationJob
()
mainPresenter
?
.
cancelLocationJob
()
}
}
...
@@ -137,7 +139,10 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnMapReadyCallback {
...
@@ -137,7 +139,10 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnMapReadyCallback {
requestLocationAllowAllTime
(
launcher
,
jumpOutAction
=
{
requestLocationAllowAllTime
(
launcher
,
jumpOutAction
=
{
LogEx
.
logDebug
(
TAG
,
"jumpOutAction"
)
LogEx
.
logDebug
(
TAG
,
"jumpOutAction"
)
},
permissionAllowCallBack
=
{
},
permissionAllowCallBack
=
{
if
(
BuildConfig
.
DEBUG
)
{
toast
(
"startJob"
)
}
this
.
startJob
()
})
})
},
},
dismissAction
=
{
dismissAction
=
{
...
@@ -215,8 +220,8 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnMapReadyCallback {
...
@@ -215,8 +220,8 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnMapReadyCallback {
map
=
googleMap
map
=
googleMap
LogEx
.
logDebug
(
TAG
,
"onMapReady"
)
LogEx
.
logDebug
(
TAG
,
"onMapReady"
)
mainPresenter
.
startLocationJob
(
lifecycleScope
)
mainPresenter
?
.
startLocationJob
(
lifecycleScope
)
mainPresenter
.
uiLocationCallback
=
{
mainPresenter
?
.
uiLocationCallback
=
{
LogEx
.
logDebug
(
TAG
,
"uiLocationCallback $it"
)
LogEx
.
logDebug
(
TAG
,
"uiLocationCallback $it"
)
changeLocation
(
it
,
true
,
reSetZoom
)
changeLocation
(
it
,
true
,
reSetZoom
)
reSetZoom
=
false
reSetZoom
=
false
...
...
app/src/main/java/com/base/locationsharewhite/ui/main/MainPresenter.kt
View file @
60432447
package
com.base.locationsharewhite.ui.main
package
com.base.locationsharewhite.ui.main
import
android.annotation.SuppressLint
import
android.app.Activity
import
android.app.Activity
import
android.location.Location
import
android.os.Looper
import
androidx.lifecycle.LifecycleCoroutineScope
import
androidx.lifecycle.LifecycleCoroutineScope
import
com.base.locationsharewhite.map.MapUtils.getLatLngByLocationManager
import
com.base.locationsharewhite.map.MapUtils.getLatLngByLocationManager
import
com.base.locationsharewhite.service.StayJobService
import
com.base.locationsharewhite.service.StayJobService
import
com.base.locationsharewhite.utils.LogEx
import
com.base.locationsharewhite.utils.LogEx
import
com.google.android.gms.location.FusedLocationProviderClient
import
com.google.android.gms.location.LocationCallback
import
com.google.android.gms.location.LocationRequest
import
com.google.android.gms.location.LocationResult
import
com.google.android.gms.location.LocationServices
import
com.google.android.gms.maps.model.LatLng
import
com.google.android.gms.maps.model.LatLng
import
kotlinx.coroutines.Dispatchers
import
kotlinx.coroutines.Dispatchers
import
kotlinx.coroutines.Job
import
kotlinx.coroutines.Job
...
...
app/src/main/java/com/base/locationsharewhite/ui/set/RenameActivity.kt
View file @
60432447
...
@@ -2,6 +2,7 @@ package com.base.locationsharewhite.ui.set
...
@@ -2,6 +2,7 @@ package com.base.locationsharewhite.ui.set
import
android.content.Intent
import
android.content.Intent
import
android.graphics.Color
import
android.graphics.Color
import
android.os.Bundle
import
androidx.activity.addCallback
import
androidx.activity.addCallback
import
androidx.core.view.updatePadding
import
androidx.core.view.updatePadding
import
com.base.locationsharewhite.R
import
com.base.locationsharewhite.R
...
@@ -46,9 +47,18 @@ class RenameActivity : BaseActivity<ActivityRenameBinding>() {
...
@@ -46,9 +47,18 @@ class RenameActivity : BaseActivity<ActivityRenameBinding>() {
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
)
}
override
fun
onResumeOneShoot
()
{
super
.
onResumeOneShoot
()
val
recreated
=
changeLanguage
(
this
,
intent
.
extras
?:
Bundle
())
if
(
recreated
)
return
if
(
recreated
)
return
doWhat
=
intent
.
extras
?.
getString
(
"doWhat"
,
RENAME_USER_NAME
)
?:
RENAME_USER_NAME
device
=
intent
?.
extras
?.
getString
(
"device"
,
""
)
?:
""
nickName
=
intent
?.
extras
?.
getString
(
"nickName"
,
""
)
?:
""
if
(
AdsMgr
.
adsConfigBean
.
functionInShowAd
)
{
if
(
AdsMgr
.
adsConfigBean
.
functionInShowAd
)
{
AdsMgr
.
showInsert
(
this
,
showCallBack
=
object
:
AdsShowCallBack
()
{
AdsMgr
.
showInsert
(
this
,
showCallBack
=
object
:
AdsShowCallBack
()
{
override
fun
close
(
where
:
Int
)
{
override
fun
close
(
where
:
Int
)
{
...
@@ -62,10 +72,6 @@ class RenameActivity : BaseActivity<ActivityRenameBinding>() {
...
@@ -62,10 +72,6 @@ class RenameActivity : BaseActivity<ActivityRenameBinding>() {
})
})
}
}
doWhat
=
intent
.
extras
?.
getString
(
"doWhat"
,
RENAME_USER_NAME
)
?:
RENAME_USER_NAME
device
=
intent
?.
extras
?.
getString
(
"device"
,
""
)
?:
""
nickName
=
intent
?.
extras
?.
getString
(
"nickName"
,
""
)
?:
""
if
(
doWhat
==
RENAME_USER_NAME
)
{
if
(
doWhat
==
RENAME_USER_NAME
)
{
binding
.
editName
.
setText
(
LocationLoginUtils
.
myNickNameSp
)
binding
.
editName
.
setText
(
LocationLoginUtils
.
myNickNameSp
)
}
}
...
@@ -83,17 +89,11 @@ class RenameActivity : BaseActivity<ActivityRenameBinding>() {
...
@@ -83,17 +89,11 @@ class RenameActivity : BaseActivity<ActivityRenameBinding>() {
AdsMgr
.
showNative
(
binding
.
flAd
,
R
.
layout
.
layout_admob_app_exit
)
AdsMgr
.
showNative
(
binding
.
flAd
,
R
.
layout
.
layout_admob_app_exit
)
}
}
override
fun
onResumeOneShoot
()
{
super
.
onResumeOneShoot
()
val
recreated
=
changeLanguage
(
this
)
if
(
recreated
)
return
}
override
fun
initListener
()
{
override
fun
initListener
()
{
super
.
initListener
()
super
.
initListener
()
onBackPressedDispatcher
.
addCallback
{
onBackPressedDispatcher
.
addCallback
{
if
(
AdsMgr
.
adsConfigBean
.
functionBackShowAd
)
{
if
(
AdsMgr
.
adsConfigBean
.
functionBackShowAd
)
{
AdsMgr
.
showInsert
(
this
@RenameActivity
,
false
,
object
:
AdsShowCallBack
()
{
AdsMgr
.
showInsert
(
this
@RenameActivity
,
false
,
object
:
AdsShowCallBack
()
{
override
fun
close
(
where
:
Int
)
{
override
fun
close
(
where
:
Int
)
{
finishToMain
()
finishToMain
()
}
}
...
@@ -106,7 +106,7 @@ class RenameActivity : BaseActivity<ActivityRenameBinding>() {
...
@@ -106,7 +106,7 @@ class RenameActivity : BaseActivity<ActivityRenameBinding>() {
finishToMain
()
finishToMain
()
}
}
})
})
}
else
{
}
else
{
finishToMain
()
finishToMain
()
}
}
}
}
...
...
app/src/main/java/com/base/locationsharewhite/utils/PermissionUtils.kt
View file @
60432447
...
@@ -115,7 +115,6 @@ object PermissionUtils {
...
@@ -115,7 +115,6 @@ object PermissionUtils {
)
{
)
{
val
TAG
=
"requestLocationAllowAllTime"
val
TAG
=
"requestLocationAllowAllTime"
launcher
.
launch
(
launcher
.
launch
(
arrayOf
(
arrayOf
(
Manifest
.
permission
.
ACCESS_FINE_LOCATION
,
Manifest
.
permission
.
ACCESS_FINE_LOCATION
,
...
...
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