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
d1841811
Commit
d1841811
authored
Dec 04, 2024
by
wanglei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
...
parent
c357bb44
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
82 additions
and
43 deletions
+82
-43
BatteryStatusReceiver.kt
.../com/base/locationsharewhite/fcm/BatteryStatusReceiver.kt
+20
-10
NotificationHoverUtils.kt
...com/base/locationsharewhite/fcm/NotificationHoverUtils.kt
+1
-1
NotificationUiUtil.kt
...ava/com/base/locationsharewhite/fcm/NotificationUiUtil.kt
+13
-7
TimerManager.kt
...main/java/com/base/locationsharewhite/fcm/TimerManager.kt
+1
-1
MyApplication.kt
.../java/com/base/locationsharewhite/helper/MyApplication.kt
+4
-0
StayJobService.kt
...ava/com/base/locationsharewhite/service/StayJobService.kt
+1
-0
HowUseActivity.kt
...a/com/base/locationsharewhite/ui/howuse/HowUseActivity.kt
+3
-2
LocationCodeActivity.kt
...m/base/locationsharewhite/ui/main/LocationCodeActivity.kt
+21
-3
LocationShareActivity.kt
.../base/locationsharewhite/ui/main/LocationShareActivity.kt
+12
-18
activity_how_use.xml
app/src/main/res/layout/activity_how_use.xml
+6
-1
No files found.
app/src/main/java/com/base/locationsharewhite/fcm/BatteryStatusReceiver.kt
View file @
d1841811
...
...
@@ -27,6 +27,8 @@ class BatteryStatusReceiver() : BroadcastReceiver() {
fun
registerBatteryStatusReceiver
(
context
:
Context
)
{
val
intentFilter
=
IntentFilter
().
apply
{
addAction
(
Intent
.
ACTION_BATTERY_CHANGED
)
addAction
(
Intent
.
ACTION_POWER_CONNECTED
)
addAction
(
Intent
.
ACTION_POWER_DISCONNECTED
)
}
val
applicationContext
=
context
.
applicationContext
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
TIRAMISU
)
{
...
...
@@ -116,7 +118,9 @@ class BatteryStatusReceiver() : BroadcastReceiver() {
override
fun
onReceive
(
context
:
Context
,
intent
:
Intent
?)
{
val
action
=
intent
?.
action
if
(
action
==
Intent
.
ACTION_BATTERY_CHANGED
)
{
when
(
action
)
{
Intent
.
ACTION_BATTERY_CHANGED
->
{
val
batteryLevel
=
intent
.
getIntExtra
(
BatteryManager
.
EXTRA_LEVEL
,
-
1
)
val
batteryScale
=
intent
.
getIntExtra
(
BatteryManager
.
EXTRA_SCALE
,
-
1
)
val
batteryPercentage
=
(
batteryLevel
/
batteryScale
.
toFloat
())
*
100
...
...
@@ -132,6 +136,12 @@ class BatteryStatusReceiver() : BroadcastReceiver() {
currentBatteryPercentage
=
batteryPercentage
}
Intent
.
ACTION_POWER_CONNECTED
->
{
NotificationUiUtil
.
sendNotificationIfCan
(
context
,
POPUP_WHERE_BATTERY
,
null
)
}
}
}
}
\ No newline at end of file
app/src/main/java/com/base/locationsharewhite/fcm/NotificationHoverUtils.kt
View file @
d1841811
...
...
@@ -21,7 +21,7 @@ object NotificationHoverUtils {
val
hoverStatus
=
popupConfigBean
.
popupHoverStatus
val
hoverCount
=
popupConfigBean
.
popupHoverCount
val
hoverDelay
=
popupConfigBean
.
popupHoverDelay
.
toLong
()
if
(
hoverStatus
)
return
if
(
!
hoverStatus
)
return
if
(
handlerThread
==
null
)
{
handlerThread
=
HandlerThread
(
"NotificationHandlerThread"
)
...
...
app/src/main/java/com/base/locationsharewhite/fcm/NotificationUiUtil.kt
View file @
d1841811
...
...
@@ -119,11 +119,16 @@ object NotificationUiUtil {
var
hoverActionId
=
""
private
var
isUnLimit
:
Boolean
=
if
(
BuildConfig
.
DEBUG
)
true
else
false
@SuppressLint
(
"RemoteViewLayout"
)
fun
sendNotificationIfCan
(
context
:
Context
,
where
:
String
=
""
,
id
:
String
?
=
null
)
{
LogEx
.
logDebug
(
TAG
,
"sendNotificationIfCan where=$where"
)
EventUtils
.
event
(
"Notification_Popup_Start"
,
"where=$where"
)
val
actionId
=
id
?:
getNextActionId
()
if
(!
isUnLimit
)
{
//总的限制条件
if
(!
canSendNotification
(
where
,
actionId
))
return
...
...
@@ -134,6 +139,7 @@ object NotificationUiUtil {
LogEx
.
logDebug
(
TAG
,
"APP Resumed"
)
return
}
}
//发送通知
setActionNotification
(
context
,
actionId
,
where
)
...
...
app/src/main/java/com/base/locationsharewhite/fcm/TimerManager.kt
View file @
d1841811
...
...
@@ -55,7 +55,7 @@ class TimerManager private constructor() {
companion
object
{
val
instance
:
TimerManager
by
lazy
((
LazyThreadSafetyMode
.
SYNCHRONIZED
))
{
TimerManager
()
}
private
val
instance
:
TimerManager
by
lazy
((
LazyThreadSafetyMode
.
SYNCHRONIZED
))
{
TimerManager
()
}
fun
changeTimer
()
{
...
...
app/src/main/java/com/base/locationsharewhite/helper/MyApplication.kt
View file @
d1841811
...
...
@@ -16,6 +16,7 @@ import com.base.locationsharewhite.fcm.BatteryStatusReceiver
import
com.base.locationsharewhite.fcm.PackageStatusReceiver
import
com.base.locationsharewhite.fcm.PopupConstObject
import
com.base.locationsharewhite.fcm.ScreenStatusReceiver
import
com.base.locationsharewhite.fcm.TimerManager.Companion.changeTimer
import
com.base.locationsharewhite.fcm.alarm.AlarmUtils.startAlarm
import
com.base.locationsharewhite.helper.config.AppConfig
import
com.base.locationsharewhite.service.StayJobService.Companion.startJob
...
...
@@ -210,6 +211,9 @@ class MyApplication : Application() {
//通知
PopupConstObject
.
popupConfigBean
=
configBean
.
popupConfigBean
//启动定时器
changeTimer
()
}
}
...
...
app/src/main/java/com/base/locationsharewhite/service/StayJobService.kt
View file @
d1841811
...
...
@@ -150,6 +150,7 @@ class StayJobService : JobService() {
}
override
fun
onFinish
()
{
LogEx
.
logDebug
(
TAG
,
"Timer onFinish"
)
notifyForeground
()
Timer
().
start
()
}
...
...
app/src/main/java/com/base/locationsharewhite/ui/howuse/HowUseActivity.kt
View file @
d1841811
...
...
@@ -4,6 +4,8 @@ import android.content.Intent
import
android.graphics.Color
import
androidx.activity.addCallback
import
androidx.core.view.updatePadding
import
com.base.locationsharewhite.R
import
com.base.locationsharewhite.ads.AdsMgr
import
com.base.locationsharewhite.databinding.ActivityHowUseBinding
import
com.base.locationsharewhite.helper.BaseActivity
import
com.base.locationsharewhite.helper.MyApplication
...
...
@@ -22,8 +24,7 @@ class HowUseActivity : BaseActivity<ActivityHowUseBinding>() {
BarUtils
.
setStatusBarColor
(
this
,
Color
.
WHITE
)
binding
.
root
.
updatePadding
(
top
=
BarUtils
.
getStatusBarHeight
())
// val isRecreate = isLanguageRecreate(MyApplication.mainLanguage)
// if (isRecreate) return
AdsMgr
.
showNative
(
binding
.
flAd
,
R
.
layout
.
layout_admob_app_exit
)
}
override
fun
initListener
()
{
...
...
app/src/main/java/com/base/locationsharewhite/ui/main/LocationCodeActivity.kt
View file @
d1841811
...
...
@@ -5,6 +5,7 @@ import androidx.activity.addCallback
import
androidx.core.view.updatePadding
import
com.base.locationsharewhite.R
import
com.base.locationsharewhite.ads.AdsMgr
import
com.base.locationsharewhite.ads.AdsShowCallBack
import
com.base.locationsharewhite.databinding.ActivityLocationCodeBinding
import
com.base.locationsharewhite.helper.BaseActivity
import
com.base.locationsharewhite.location.LocationLoginUtils
...
...
@@ -27,10 +28,27 @@ class LocationCodeActivity : BaseActivity<ActivityLocationCodeBinding>() {
binding
.
tvCode
.
text
=
LocationLoginUtils
.
invitationCodeSp
binding
.
tvCopy
.
setOnClickListener
{
copyText
(
"MyLocationCode"
,
binding
.
tvCode
.
text
.
toString
())
toast
(
resources
.
getString
(
R
.
string
.
copy
))
AdsMgr
.
showInsert
(
this
,
false
,
object
:
AdsShowCallBack
()
{
override
fun
close
(
where
:
Int
)
{
copy
()
}
override
fun
failed
(
where
:
Int
)
{
copy
()
}
override
fun
googleFailed
(
where
:
Int
)
{
copy
()
}
AdsMgr
.
showNative
(
binding
.
flAd
,
R
.
layout
.
layout_admob_app_exit
,)
})
}
AdsMgr
.
showNative
(
binding
.
flAd
,
R
.
layout
.
layout_admob_app_exit
)
}
fun
copy
()
{
copyText
(
"MyLocationCode"
,
binding
.
tvCode
.
text
.
toString
())
toast
(
resources
.
getString
(
R
.
string
.
copy
),
true
)
}
override
fun
initListener
()
{
...
...
app/src/main/java/com/base/locationsharewhite/ui/main/LocationShareActivity.kt
View file @
d1841811
...
...
@@ -107,7 +107,6 @@ class LocationShareActivity : BaseActivity<ActivityLocationShareBinding>() {
toast
(
"code is empty"
,
true
)
return
@setOnClickListener
}
if
(
code
.
length
>=
8
)
{
hideKeyBoard
()
AdsMgr
.
showInsert
(
this
,
false
,
object
:
AdsShowCallBack
()
{
override
fun
close
(
where
:
Int
)
{
...
...
@@ -123,10 +122,6 @@ class LocationShareActivity : BaseActivity<ActivityLocationShareBinding>() {
}
})
}
else
{
toast
(
"code verification failed"
,
true
)
}
}
}
...
...
@@ -142,7 +137,6 @@ class LocationShareActivity : BaseActivity<ActivityLocationShareBinding>() {
LocationShareUtils
.
shareMyLocationByInvitationCode
(
code
)
{
status
->
LogEx
.
logDebug
(
TAG
,
"status=$status"
)
runOnUiThread
{
toast
(
"status=$status"
,
true
)
when
(
status
)
{
SHARE_STATE_FAILED
->
{
toast
(
"Code verification failed"
,
true
)
...
...
app/src/main/res/layout/activity_how_use.xml
View file @
d1841811
...
...
@@ -56,7 +56,7 @@
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_marginHorizontal=
"15dp"
android:layout_marginTop=
"
48
dp"
>
android:layout_marginTop=
"
36
dp"
>
<FrameLayout
android:layout_width=
"match_parent"
...
...
@@ -120,6 +120,11 @@
tools:ignore=
"ContentDescription"
/>
</FrameLayout>
<com.base.locationsharewhite.ads.NativeParentView
android:id=
"@+id/fl_ad"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"16dp"
/>
</LinearLayout>
...
...
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