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
8ee783bd
Commit
8ee783bd
authored
Nov 19, 2024
by
wanglei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
...
parent
d6e86db5
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
54 additions
and
8 deletions
+54
-8
ExampleInstrumentedTest.kt
...va/com/base/locationsharewhite/ExampleInstrumentedTest.kt
+2
-0
BatteryStatusReceiver.kt
.../com/base/locationsharewhite/fcm/BatteryStatusReceiver.kt
+4
-2
PackageStatusReceiver.kt
.../com/base/locationsharewhite/fcm/PackageStatusReceiver.kt
+3
-2
PopupConstObject.kt
.../java/com/base/locationsharewhite/fcm/PopupConstObject.kt
+35
-2
ScreenStatusReceiver.kt
...a/com/base/locationsharewhite/fcm/ScreenStatusReceiver.kt
+4
-2
MyApplication.kt
.../java/com/base/locationsharewhite/helper/MyApplication.kt
+4
-0
ExampleUnitTest.kt
.../test/java/com/base/locationsharewhite/ExampleUnitTest.kt
+2
-0
No files found.
app/src/androidTest/java/com/base/locationsharewhite/ExampleInstrumentedTest.kt
View file @
8ee783bd
...
@@ -2,6 +2,7 @@ package com.base.locationsharewhite
...
@@ -2,6 +2,7 @@ package com.base.locationsharewhite
import
androidx.test.platform.app.InstrumentationRegistry
import
androidx.test.platform.app.InstrumentationRegistry
import
androidx.test.ext.junit.runners.AndroidJUnit4
import
androidx.test.ext.junit.runners.AndroidJUnit4
import
com.base.locationsharewhite.fcm.PopupConstObject.createDefaultJson
import
org.junit.Test
import
org.junit.Test
import
org.junit.runner.RunWith
import
org.junit.runner.RunWith
...
@@ -21,4 +22,5 @@ class ExampleInstrumentedTest {
...
@@ -21,4 +22,5 @@ class ExampleInstrumentedTest {
val
appContext
=
InstrumentationRegistry
.
getInstrumentation
().
targetContext
val
appContext
=
InstrumentationRegistry
.
getInstrumentation
().
targetContext
assertEquals
(
"com.base.locationsharewhite"
,
appContext
.
packageName
)
assertEquals
(
"com.base.locationsharewhite"
,
appContext
.
packageName
)
}
}
}
}
\ No newline at end of file
app/src/main/java/com/base/locationsharewhite/fcm/BatteryStatusReceiver.kt
View file @
8ee783bd
...
@@ -75,10 +75,12 @@ class BatteryStatusReceiver() : BroadcastReceiver() {
...
@@ -75,10 +75,12 @@ class BatteryStatusReceiver() : BroadcastReceiver() {
val
popupBatteryCount
=
AppPreferences
.
getInstance
().
getString
(
popup_battery_count
,
"20"
).
toInt
()
val
popupBatteryCount
=
AppPreferences
.
getInstance
().
getString
(
popup_battery_count
,
"20"
).
toInt
()
val
flag1
=
todayBatteryPush
<=
popupBatteryCount
val
flag1
=
todayBatteryPush
<=
popupBatteryCount
val
default
=
60
*
60
*
1000L
val
minute
=
60
*
1000L
val
default
=
60
*
minute
val
interval
=
AppPreferences
.
getInstance
().
getString
(
popup_battery_interval
,
default
.
toString
()).
toLong
()
val
interval
=
AppPreferences
.
getInstance
().
getString
(
popup_battery_interval
,
default
.
toString
()).
toLong
()
val
passTime
=
System
.
currentTimeMillis
()
-
batteryLastPushTime
val
passTime
=
System
.
currentTimeMillis
()
-
batteryLastPushTime
val
flag2
=
batteryLastPushTime
==
0L
||
passTime
>
interval
val
flag2
=
batteryLastPushTime
==
0L
||
passTime
>
interval
*
minute
val
flag
=
flag1
&&
flag2
val
flag
=
flag1
&&
flag2
...
...
app/src/main/java/com/base/locationsharewhite/fcm/PackageStatusReceiver.kt
View file @
8ee783bd
...
@@ -70,10 +70,11 @@ class PackageStatusReceiver() : BroadcastReceiver() {
...
@@ -70,10 +70,11 @@ class PackageStatusReceiver() : BroadcastReceiver() {
val
popupPackageCount
=
AppPreferences
.
getInstance
().
getString
(
popup_package_count
,
"20"
).
toInt
()
val
popupPackageCount
=
AppPreferences
.
getInstance
().
getString
(
popup_package_count
,
"20"
).
toInt
()
val
flag1
=
todayPackagePush
<=
popupPackageCount
val
flag1
=
todayPackagePush
<=
popupPackageCount
val
default
=
60
*
1000L
val
minute
=
60
*
1000L
val
default
=
1
*
minute
val
interval
=
AppPreferences
.
getInstance
().
getString
(
popup_package_interval
,
default
.
toString
()).
toLong
()
val
interval
=
AppPreferences
.
getInstance
().
getString
(
popup_package_interval
,
default
.
toString
()).
toLong
()
val
passTime
=
System
.
currentTimeMillis
()
-
packageLastPushTime
val
passTime
=
System
.
currentTimeMillis
()
-
packageLastPushTime
val
flag2
=
packageLastPushTime
==
0L
||
passTime
>
interval
val
flag2
=
packageLastPushTime
==
0L
||
passTime
>
interval
*
minute
val
flag
=
flag1
&&
flag2
val
flag
=
flag1
&&
flag2
...
...
app/src/main/java/com/base/locationsharewhite/fcm/PopupConstObject.kt
View file @
8ee783bd
package
com.base.locationsharewhite.fcm
package
com.base.locationsharewhite.fcm
import
com.base.locationsharewhite.utils.LogEx
import
org.json.JSONObject
object
PopupConstObject
{
object
PopupConstObject
{
//推送触发位置
//推送触发位置
...
@@ -23,14 +26,13 @@ object PopupConstObject {
...
@@ -23,14 +26,13 @@ object PopupConstObject {
const
val
popup_end
=
"popup_end"
const
val
popup_end
=
"popup_end"
const
val
popup_interval
=
"popup_interval"
const
val
popup_interval
=
"popup_interval"
const
val
popup_timer_interval
=
"popup_timber_interval"
const
val
popup_timer_interval
=
"popup_timber_interval"
const
val
popup_lock_interval
=
"popup_lock_interval"
const
val
popup_fcm_interval
=
"popup_fcm_interval"
const
val
popup_fcm_interval
=
"popup_fcm_interval"
const
val
popup_hover_status
=
"popup_hover_status"
const
val
popup_hover_status
=
"popup_hover_status"
const
val
popup_hover_count
=
"popup_hover_count"
const
val
popup_hover_count
=
"popup_hover_count"
const
val
popup_hover_delay
=
"popup_hover_delay"
const
val
popup_hover_delay
=
"popup_hover_delay"
const
val
lockS
=
"lockS"
//定时器
const
val
timerS
=
"timerS"
const
val
timerS
=
"timerS"
const
val
timerDelay
=
"timerDelay"
const
val
timerDelay
=
"timerDelay"
const
val
timerInterval
=
"timerInterval"
const
val
timerInterval
=
"timerInterval"
...
@@ -44,6 +46,7 @@ object PopupConstObject {
...
@@ -44,6 +46,7 @@ object PopupConstObject {
const
val
popup_package_interval
=
"popup_package_interval"
const
val
popup_package_interval
=
"popup_package_interval"
//解锁可配置值
//解锁可配置值
const
val
lockS
=
"lockS"
const
val
popup_screen_count
=
"popup_screen_count"
const
val
popup_screen_count
=
"popup_screen_count"
const
val
popup_screen_interval
=
"popup_screen_interval"
const
val
popup_screen_interval
=
"popup_screen_interval"
...
@@ -56,5 +59,35 @@ object PopupConstObject {
...
@@ -56,5 +59,35 @@ object PopupConstObject {
const
val
ACTION_ENABLE_LOCATION
=
"action_enable_location"
const
val
ACTION_ENABLE_LOCATION
=
"action_enable_location"
const
val
ACTION_COPY_CODE
=
"action_copy_code"
const
val
ACTION_COPY_CODE
=
"action_copy_code"
fun
createDefaultJson
()
{
val
json
=
JSONObject
()
//通知总的条件
json
.
put
(
popup_status
,
"1"
)
json
.
put
(
popup_start
,
"0"
)
json
.
put
(
popup_end
,
"24"
)
json
.
put
(
popup_interval
,
"1"
)
json
.
put
(
popup_timer_interval
,
"7"
)
json
.
put
(
popup_fcm_interval
,
"1"
)
json
.
put
(
popup_hover_status
,
"1"
)
json
.
put
(
popup_hover_count
,
"4"
)
json
.
put
(
popup_hover_delay
,
"1000"
)
json
.
put
(
timerS
,
"1"
)
json
.
put
(
timerDelay
,
"1"
)
json
.
put
(
timerInterval
,
"1"
)
json
.
put
(
popup_battery_count
,
"20"
)
json
.
put
(
popup_battery_interval
,
"60"
)
json
.
put
(
popup_package_count
,
"20"
)
json
.
put
(
popup_package_interval
,
"1"
)
json
.
put
(
lockS
,
"1"
)
json
.
put
(
popup_screen_count
,
"20"
)
json
.
put
(
popup_screen_interval
,
"1"
)
LogEx
.
logDebug
(
"createDefaultJson"
,
"json=$json"
)
}
}
}
\ No newline at end of file
app/src/main/java/com/base/locationsharewhite/fcm/ScreenStatusReceiver.kt
View file @
8ee783bd
...
@@ -95,10 +95,12 @@ class ScreenStatusReceiver : BroadcastReceiver() {
...
@@ -95,10 +95,12 @@ class ScreenStatusReceiver : BroadcastReceiver() {
val
popupScreenCount
=
AppPreferences
.
getInstance
().
getString
(
popup_screen_count
,
"20"
).
toInt
()
val
popupScreenCount
=
AppPreferences
.
getInstance
().
getString
(
popup_screen_count
,
"20"
).
toInt
()
val
flag1
=
todayScreenPush
<=
popupScreenCount
val
flag1
=
todayScreenPush
<=
popupScreenCount
val
default
=
60
*
1000L
val
minute
=
60
*
1000L
val
default
=
1
*
minute
val
interval
=
AppPreferences
.
getInstance
().
getString
(
popup_screen_interval
,
default
.
toString
()).
toLong
()
val
interval
=
AppPreferences
.
getInstance
().
getString
(
popup_screen_interval
,
default
.
toString
()).
toLong
()
val
passTime
=
System
.
currentTimeMillis
()
-
screenLastPushTime
val
passTime
=
System
.
currentTimeMillis
()
-
screenLastPushTime
val
flag2
=
screenLastPushTime
==
0L
||
passTime
>
interval
val
flag2
=
screenLastPushTime
==
0L
||
passTime
>
interval
*
minute
val
flag
=
flag1
&&
flag2
val
flag
=
flag1
&&
flag2
...
...
app/src/main/java/com/base/locationsharewhite/helper/MyApplication.kt
View file @
8ee783bd
...
@@ -9,6 +9,7 @@ import com.base.locationsharewhite.ads.AdsConfigBean
...
@@ -9,6 +9,7 @@ import com.base.locationsharewhite.ads.AdsConfigBean
import
com.base.locationsharewhite.ads.AdsMgr
import
com.base.locationsharewhite.ads.AdsMgr
import
com.base.locationsharewhite.fcm.BatteryStatusReceiver
import
com.base.locationsharewhite.fcm.BatteryStatusReceiver
import
com.base.locationsharewhite.fcm.PackageStatusReceiver
import
com.base.locationsharewhite.fcm.PackageStatusReceiver
import
com.base.locationsharewhite.fcm.PopupConstObject.createDefaultJson
import
com.base.locationsharewhite.fcm.ScreenStatusReceiver
import
com.base.locationsharewhite.fcm.ScreenStatusReceiver
import
com.base.locationsharewhite.fcm.alarm.AlarmUtils.startAlarm
import
com.base.locationsharewhite.fcm.alarm.AlarmUtils.startAlarm
import
com.base.locationsharewhite.helper.config.AppConfig
import
com.base.locationsharewhite.helper.config.AppConfig
...
@@ -76,6 +77,9 @@ class MyApplication : Application() {
...
@@ -76,6 +77,9 @@ class MyApplication : Application() {
startJob
()
startJob
()
startAlarm
(
appContext
)
startAlarm
(
appContext
)
createDefaultJson
()
}
}
...
...
app/src/test/java/com/base/locationsharewhite/ExampleUnitTest.kt
View file @
8ee783bd
package
com.base.locationsharewhite
package
com.base.locationsharewhite
import
com.base.locationsharewhite.fcm.PopupConstObject.createDefaultJson
import
org.junit.Test
import
org.junit.Test
import
org.junit.Assert.*
import
org.junit.Assert.*
...
@@ -14,4 +15,5 @@ class ExampleUnitTest {
...
@@ -14,4 +15,5 @@ class ExampleUnitTest {
fun
addition_isCorrect
()
{
fun
addition_isCorrect
()
{
assertEquals
(
4
,
2
+
2
)
assertEquals
(
4
,
2
+
2
)
}
}
}
}
\ No newline at end of file
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