Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
android_flowbox
Project
Project
Details
Activity
Releases
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
android
android_flowbox
Commits
75dcdd43
Commit
75dcdd43
authored
Jul 08, 2021
by
mengcuiguang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加wifi本地管理类,负责监听次数和分钟
parent
d6365451
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
227 additions
and
4 deletions
+227
-4
WifiAdManager.kt
app/src/main/java/com/mints/flowbox/ad/wifi/WifiAdManager.kt
+2
-1
WifiDataManager.kt
...in/java/com/mints/flowbox/manager/wifi/WifiDataManager.kt
+190
-0
WifiActiveBean.kt
...c/main/java/com/mints/flowbox/mvp/model/WifiActiveBean.kt
+8
-0
TrackPresenter.java
...java/com/mints/flowbox/mvp/presenters/TrackPresenter.java
+16
-2
LoanService.java
app/src/main/java/com/mints/flowbox/net/LoanService.java
+2
-1
TimeRender.java
app/src/main/java/com/mints/flowbox/utils/TimeRender.java
+9
-0
rockert.gif
app/src/main/res/drawable/rockert.gif
+0
-0
No files found.
app/src/main/java/com/mints/flowbox/ad/wifi/WifiAdManager.kt
View file @
75dcdd43
...
...
@@ -51,7 +51,8 @@ class WifiAdManager {
tempAdType
=
Constant
.
GROMORE_FULL_AD
}
return
tempAdType
// return tempAdType
return
Constant
.
GROMORE_INSERTSCREEN_AD
}
/**
...
...
app/src/main/java/com/mints/flowbox/manager/wifi/WifiDataManager.kt
0 → 100644
View file @
75dcdd43
package
com.mints.flowbox.manager.wifi
import
android.text.format.DateUtils
import
com.mints.flowbox.manager.AppPreferencesManager
import
com.mints.flowbox.utils.TimeRender
/**
* wifi本地数据管理
*
* 孟崔广
*/
object
WifiDataManager
{
// 新的一天
private
val
NEW_DAY_FLAG
=
"NEW_DAY_FLAG"
// wifi连接 10次
private
val
WIFI_ON
=
"WIFI_ON"
// wifi断开 10次
private
val
WIFI_OFF
=
"WIFI_OFF"
// 充电 10次
private
val
BATTERY_ON
=
"BATTERY_ON"
// 拔电 10次
private
val
BATTERY_OFF
=
"BATTERY_OFF"
// 安装 引导
private
val
INSTALL_ON
=
"INSTALL_ON"
// 卸载 引导
private
val
UNINSTALL_OFF
=
"UNINSTALL_OFF"
// 定时 15分钟 在定时器触发
private
val
TIMER_15MIN
=
"TIMER_15MIN"
// 点击home键 30分钟
private
val
HOME_30MIN
=
"HOME_30MIN"
// 最近任务列表 30分钟
private
val
APPLIST_30MIN
=
"APPLIST_30MIN"
// 挂断电话 无广告
private
val
TELEPHONE_OFF
=
"TELEPHONE_OFF"
// 锁屏 100次
private
val
LOCK_ON
=
"LOCK_ON"
// 锁屏 单位:次数
var
LOCK_TIMES
=
100
// wifi、拔电 单位:次数
var
WIFI_TIMES
=
10
// 点击home键、最近任务列表 单位:分钟
var
HOME_TIMES
=
30
val
sp
by
lazy
{
AppPreferencesManager
.
get
()
}
/**
* 是否显示wifi连接广告
*/
fun
getWifiOn
():
Boolean
{
val
wifiOn
=
sp
.
getInt
(
WIFI_ON
,
0
)
if
(
wifiOn
<
WIFI_TIMES
)
{
// 设置wifi次数+1
sp
.
put
(
WIFI_ON
,
wifiOn
+
1
)
return
true
}
return
false
}
/**
* 是否显示wifi断开广告
*/
fun
getWifiOff
():
Boolean
{
val
wifiOff
=
sp
.
getInt
(
WIFI_OFF
,
0
)
if
(
wifiOff
<
WIFI_TIMES
)
{
// 设置wifi次数+1
sp
.
put
(
WIFI_OFF
,
wifiOff
+
1
)
return
true
}
return
false
}
/**
* 是否显示充电连接广告
*/
fun
getBatteryOn
():
Boolean
{
val
batteryOn
=
sp
.
getInt
(
BATTERY_ON
,
0
)
if
(
batteryOn
<
WIFI_TIMES
)
{
// 设置充电次数+1
sp
.
put
(
BATTERY_ON
,
batteryOn
+
1
)
return
true
}
return
false
}
/**
* 是否显示断电连接广告
*/
fun
getBatteryOff
():
Boolean
{
val
batteryOff
=
sp
.
getInt
(
BATTERY_OFF
,
0
)
if
(
batteryOff
<
WIFI_TIMES
)
{
// 设置断电次数+1
sp
.
put
(
BATTERY_OFF
,
batteryOff
+
1
)
return
true
}
return
false
}
/**
* 是否锁屏
*/
fun
getLockOn
():
Boolean
{
val
lockOn
=
sp
.
getInt
(
LOCK_ON
,
0
)
if
(
lockOn
<
LOCK_TIMES
)
{
sp
.
put
(
LOCK_ON
,
lockOn
+
1
)
return
true
}
return
false
}
/**
* 是否点击home键 满足30分钟后
*/
fun
getHomeKey
():
Boolean
{
// 保存的时间戳
val
preTime
=
sp
.
getLong
(
HOME_30MIN
,
System
.
currentTimeMillis
())
val
currentTime
=
System
.
currentTimeMillis
()
// 当前时间-保存的时间戳=间隔时间
val
min
=
TimeRender
.
getMinForTimestamp
(
preTime
,
currentTime
)
if
(
min
<
HOME_TIMES
)
{
return
false
}
sp
.
put
(
HOME_30MIN
,
currentTime
)
return
true
}
/**
* 是否操作最近任务列表 满足30分钟后
*/
fun
getApplistKey
():
Boolean
{
// 保存的时间戳
val
preTime
=
sp
.
getLong
(
APPLIST_30MIN
,
System
.
currentTimeMillis
())
val
currentTime
=
System
.
currentTimeMillis
()
// 当前时间-保存的时间戳=间隔时间
val
min
=
TimeRender
.
getMinForTimestamp
(
preTime
,
currentTime
)
if
(
min
<
HOME_TIMES
)
{
return
false
}
sp
.
put
(
APPLIST_30MIN
,
currentTime
)
return
true
}
/**
* 是否当天
*/
fun
getNewDay
(
time
:
Long
):
Boolean
{
// 上一次服务器的时间,首次为系统时间
val
preTime
=
sp
.
getLong
(
NEW_DAY_FLAG
,
System
.
currentTimeMillis
())
// 判断时间是否是新的一天
if
(
DateUtils
.
isToday
(
preTime
))
{
// 是新的一天
return
true
}
// 第二天,新的一天
sp
.
put
(
NEW_DAY_FLAG
,
time
)
resetData
()
return
false
}
/**
* 重置次数
*/
private
fun
resetData
()
{
sp
.
put
(
WIFI_ON
,
0
)
sp
.
put
(
WIFI_OFF
,
0
)
sp
.
put
(
BATTERY_ON
,
0
)
sp
.
put
(
BATTERY_OFF
,
0
)
sp
.
put
(
LOCK_ON
,
0
)
sp
.
put
(
HOME_30MIN
,
System
.
currentTimeMillis
())
sp
.
put
(
APPLIST_30MIN
,
System
.
currentTimeMillis
())
}
}
\ No newline at end of file
app/src/main/java/com/mints/flowbox/mvp/model/WifiActiveBean.kt
0 → 100644
View file @
75dcdd43
package
com.mints.flowbox.mvp.model
import
java.io.Serializable
data class
WifiActiveBean
(
val
ouTofApplicationAdCount
:
Int
=
10
,
val
time
:
Long
=
0
,
val
ouTofApplicationAdMins
:
Int
=
10
)
:
Serializable
\ No newline at end of file
app/src/main/java/com/mints/flowbox/mvp/presenters/TrackPresenter.java
View file @
75dcdd43
...
...
@@ -2,6 +2,7 @@ package com.mints.flowbox.mvp.presenters;
import
android.app.Activity
;
import
android.text.TextUtils
;
import
android.text.format.DateUtils
;
import
com.google.gson.JsonObject
;
import
com.mints.flowbox.MintsApplication
;
...
...
@@ -12,9 +13,11 @@ import com.mints.flowbox.manager.AppHttpManager;
import
com.mints.flowbox.manager.ChannelManager
;
import
com.mints.flowbox.manager.SimulatorManager
;
import
com.mints.flowbox.manager.UserWeight
;
import
com.mints.flowbox.manager.wifi.WifiDataManager
;
import
com.mints.flowbox.mvp.model.BaseResponse
;
import
com.mints.flowbox.mvp.model.CommonParamBean
;
import
com.mints.flowbox.mvp.model.ServerAdBean
;
import
com.mints.flowbox.mvp.model.WifiActiveBean
;
import
com.mints.library.net.neterror.BaseSubscriber
;
import
com.mints.library.net.neterror.Throwable
;
import
com.mints.flowbox.mvp.model.UserTaskMsgBean
;
...
...
@@ -71,7 +74,7 @@ public class TrackPresenter extends BaseTrackPresenter {
public
void
setMinsActive
(
HashMap
<
String
,
Object
>
vo
)
{
AppHttpManager
.
getInstance
(
loanApplication
)
.
call
(
loanService
.
setMinsActive
(
vo
),
new
BaseSubscriber
<
BaseResponse
<
Object
>>()
{
new
BaseSubscriber
<
BaseResponse
<
WifiActiveBean
>>()
{
@Override
public
void
onCompleted
()
{
}
...
...
@@ -81,7 +84,18 @@ public class TrackPresenter extends BaseTrackPresenter {
}
@Override
public
void
onNext
(
BaseResponse
<
Object
>
baseResponse
)
{
public
void
onNext
(
BaseResponse
<
WifiActiveBean
>
baseResponse
)
{
try
{
if
(
baseResponse
.
getStatus
()
==
200
)
{
WifiActiveBean
data
=
baseResponse
.
getData
();
if
(
data
!=
null
)
{
// 本地标记未赋值时
WifiDataManager
.
INSTANCE
.
getNewDay
(
data
.
getTime
());
}
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
});
}
...
...
app/src/main/java/com/mints/flowbox/net/LoanService.java
View file @
75dcdd43
...
...
@@ -29,6 +29,7 @@ import com.mints.flowbox.mvp.model.UserTaskMsgBean;
import
com.mints.flowbox.mvp.model.Version
;
import
com.mints.flowbox.mvp.model.WalkBean
;
import
com.mints.flowbox.mvp.model.WaterBean
;
import
com.mints.flowbox.mvp.model.WifiActiveBean
;
import
com.mints.flowbox.mvp.model.XmlyUnlockBean
;
import
com.mints.flowbox.utils.AESUtils
;
import
com.orhanobut.logger.Logger
;
...
...
@@ -469,7 +470,7 @@ public interface LoanService {
* 提现排名
*/
@POST
(
"na/setMinsActive"
)
Observable
<
BaseResponse
<
JsonObject
>>
setMinsActive
(
@Body
Map
<
String
,
Object
>
vo
);
Observable
<
BaseResponse
<
WifiActiveBean
>>
setMinsActive
(
@Body
Map
<
String
,
Object
>
vo
);
/**
* 默认http工厂
...
...
app/src/main/java/com/mints/flowbox/utils/TimeRender.java
View file @
75dcdd43
...
...
@@ -276,4 +276,13 @@ public class TimeRender {
HMStime
=
wenshutr
+
":"
+
sedStr
;
return
HMStime
;
}
/**
* 根据时间戳 计算分钟间隔
*
* @return
*/
public
static
long
getMinForTimestamp
(
long
lastTime
,
long
curTime
){
return
(
curTime
-
lastTime
)
/
(
1000
*
60
);
}
}
app/src/main/res/drawable/rockert.gif
View replaced file @
d6365451
View file @
75dcdd43
15.9 KB
|
W:
|
H:
14.7 KB
|
W:
|
H:
2-up
Swipe
Onion skin
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