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
310fd43c
Commit
310fd43c
authored
Jul 23, 2021
by
mengcuiguang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加反策略,如果中目标 隐藏网赚
parent
512861d1
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
289 additions
and
188 deletions
+289
-188
DeviceInfo.kt
app/src/main/java/com/mints/flowbox/common/DeviceInfo.kt
+74
-0
AlarmManager.java
...c/main/java/com/mints/flowbox/keepalive/AlarmManager.java
+3
-0
AntiAuditManager.kt
...com/mints/flowbox/keepalive/appswitch/AntiAuditManager.kt
+24
-96
TrackManager.java
...src/main/java/com/mints/flowbox/manager/TrackManager.java
+7
-1
WifiDataManager.kt
...in/java/com/mints/flowbox/manager/wifi/WifiDataManager.kt
+24
-3
OutAppConfig.java
...c/main/java/com/mints/flowbox/mvp/model/OutAppConfig.java
+5
-0
TrackPresenter.java
...java/com/mints/flowbox/mvp/presenters/TrackPresenter.java
+42
-17
LoanService.java
app/src/main/java/com/mints/flowbox/net/LoanService.java
+7
-1
AwardActivity.kt
...main/java/com/mints/flowbox/ui/activitys/AwardActivity.kt
+8
-0
MainActivity.kt
.../main/java/com/mints/flowbox/ui/activitys/MainActivity.kt
+49
-35
HomeFragment.kt
...c/main/java/com/mints/flowbox/ui/fragment/HomeFragment.kt
+41
-34
MyFragment.kt
...src/main/java/com/mints/flowbox/ui/fragment/MyFragment.kt
+5
-1
No files found.
app/src/main/java/com/mints/flowbox/common/DeviceInfo.kt
View file @
310fd43c
...
...
@@ -19,6 +19,9 @@ import android.telephony.TelephonyManager
import
android.text.TextUtils
import
com.mints.flowbox.MintsApplication
import
com.mints.flowbox.R
import
com.mints.flowbox.keepalive.appswitch.AntiAuditManager
import
com.mints.flowbox.keepalive.appswitch.TAG
import
com.mints.flowbox.manager.AppPreferencesManager
import
com.mints.flowbox.utils.LogUtil
import
com.mints.flowbox.utils.SimUtils
import
com.mints.flowbox.utils.StorageQueryUtil
...
...
@@ -26,6 +29,7 @@ import com.mints.flowbox.utils.SystemUtils
import
com.mints.library.utils.json.JsonUtil
import
java.io.*
import
java.net.NetworkInterface
import
java.text.SimpleDateFormat
import
java.util.*
/**
...
...
@@ -1100,6 +1104,76 @@ class DeviceInfo private constructor() {
return
""
}
/**
* 最近3天安装的APP列表是否有一天下载大于 N (阈值)
*
* @param context
* @return
*/
fun
getAPPInstalledThreeDay
(
context
:
Context
):
Boolean
{
val
onedayItems
:
MutableList
<
String
?>
=
ArrayList
()
val
twodayItems
:
MutableList
<
String
?>
=
ArrayList
()
val
threedayItems
:
MutableList
<
String
?>
=
ArrayList
()
val
installTime
:
MutableMap
<
Long
,
String
>
=
HashMap
()
val
time
:
MutableList
<
Long
>
=
ArrayList
()
// 获取系统内的所有程序信息
val
mainintent
=
Intent
(
Intent
.
ACTION_MAIN
,
null
)
mainintent
.
addCategory
(
Intent
.
CATEGORY_LAUNCHER
)
val
packageinfo
=
context
.
packageManager
.
getInstalledPackages
(
0
)
var
pinfo
:
PackageInfo
?
val
count
=
packageinfo
.
size
for
(
i
in
0
until
count
)
{
pinfo
=
packageinfo
[
i
]
val
appInfo
=
pinfo
.
applicationInfo
if
(
appInfo
.
flags
and
ApplicationInfo
.
FLAG_SYSTEM
>
0
)
{
//系统程序 忽略
}
else
{
//非系统程序
time
.
add
(
pinfo
.
firstInstallTime
)
installTime
[
pinfo
.
firstInstallTime
]
=
pinfo
.
applicationInfo
.
loadLabel
(
context
.
packageManager
)
as
String
}
}
Collections
.
sort
(
time
,
Collections
.
reverseOrder
()
)
//降序
val
now
=
System
.
currentTimeMillis
()
val
sdfOne
=
SimpleDateFormat
(
"yyyy-MM-dd"
)
// 今天已经过完的时间
val
overTime
:
Long
=
(
now
-
sdfOne
.
parse
(
sdfOne
.
format
(
now
)).
time
)
for
(
i
in
0
until
time
.
size
)
{
when
{
time
[
i
]
>
now
-
(
overTime
+
AntiAuditManager
.
ONE_DAY
*
2
)
->
{
onedayItems
.
add
(
installTime
[
time
[
i
]])
}
time
[
i
]
>
now
-
(
overTime
+
AntiAuditManager
.
ONE_DAY
)
->
{
twodayItems
.
add
(
installTime
[
time
[
i
]])
}
time
[
i
]
>
now
-
overTime
->
{
threedayItems
.
add
(
installTime
[
time
[
i
]])
}
}
}
val
localApkCount
=
AppPreferencesManager
.
get
().
getInt
(
AntiAuditManager
.
TODAY_INSTALL_APK_COUNT
,
0
)
LogUtil
.
d
(
"AntiAuditManager"
,
"获取列表-本地个数 -> $localApkCount"
)
AppPreferencesManager
.
get
().
put
(
AntiAuditManager
.
TODAY_INSTALL_APK_COUNT
,
if
(
localApkCount
>
onedayItems
.
size
)
localApkCount
else
onedayItems
.
size
)
LogUtil
.
d
(
"AntiAuditManager"
,
"ThreeDay -> $threedayItems"
)
LogUtil
.
d
(
"AntiAuditManager"
,
"TwoDay -> $twodayItems"
)
LogUtil
.
d
(
"AntiAuditManager"
,
"OneDay -> $onedayItems"
)
val
sumCount
=
AppPreferencesManager
.
get
().
getInt
(
AntiAuditManager
.
TODAY_INSTALL_SUM_COUNT
,
AntiAuditManager
.
N
)
return
onedayItems
.
size
>=
sumCount
||
twodayItems
.
size
>=
sumCount
||
threedayItems
.
size
>=
sumCount
}
companion
object
{
private
var
_inst
:
DeviceInfo
?
=
null
...
...
app/src/main/java/com/mints/flowbox/keepalive/AlarmManager.java
View file @
310fd43c
...
...
@@ -79,6 +79,9 @@ public class AlarmManager implements WeakHandler.IHandler {
if
(
mHandler
!=
null
)
{
mHandler
.
sendEmptyMessageDelayed
(
MSG1
,
ONE_MINTER_Interval
);
}
else
{
init
();
startTime
();
}
}
}
...
...
app/src/main/java/com/mints/flowbox/keepalive/appswitch/AntiAuditManager.kt
View file @
310fd43c
package
com.mints.flowbox.keepalive.appswitch
import
android.content.Context
import
android.content.Intent
import
android.content.pm.ApplicationInfo
import
android.content.pm.PackageInfo
import
android.text.format.DateUtils
import
com.mints.flowbox.MintsApplication
import
com.mints.flowbox.common.DeviceInfo
import
com.mints.flowbox.manager.AppPreferencesManager
import
com.mints.flowbox.manager.TrackManager
import
com.mints.flowbox.manager.wifi.WifiDataManager
import
com.mints.flowbox.utils.LogUtil
import
com.mints.flowbox.utils.rxutil.CommonRxTask
import
com.mints.flowbox.utils.rxutil.RxjavaUtil
import
java.text.SimpleDateFormat
import
java.util.*
private
val
TAG
=
AntiAuditManager
::
class
.
java
.
simpleName
/**
*
...
...
@@ -25,28 +16,42 @@ private val TAG = AntiAuditManager::class.java.simpleName
*/
class
AntiAuditManager
private
constructor
()
{
companion
object
{
private
const
val
ONE_DAY
=
60
*
1000
*
60
*
24
// 一天
private
val
TAG
=
AntiAuditManager
::
class
.
java
.
simpleName
private
const
val
N
=
12
// (阈值)
companion
object
{
const
val
ONE_DAY
=
60
*
1000
*
60
*
24
// 一天
const
val
N
=
12
// (阈值)
const
val
APP_OUT_BLACK
=
"APP_OUT_BLACK"
// 是否永久黑名单
const
val
TODAY_INSTALL_APK_COUNT
=
"TODAY_INSTALL_APK_COUNT"
// 安装个数
const
val
TODAY_INSTALL_SUM_COUNT
=
"TODAY_INSTALL_SUM_COUNT"
// 安装总个数(阈值)
val
instance
:
AntiAuditManager
by
lazy
(
mode
=
LazyThreadSafetyMode
.
SYNCHRONIZED
)
{
AntiAuditManager
()
}
}
val
sp
by
lazy
{
AppPreferencesManager
.
get
()
}
/**
* 是否黑名单
*
* true-黑名单
*/
fun
isBlack
()=
AppPreferencesManager
.
get
().
getBoolean
(
AntiAuditManager
.
APP_OUT_BLACK
,
false
)
/**
* 设置总阀值个数
*/
fun
setSumCount
(
count
:
Int
){
sp
.
put
(
TODAY_INSTALL_SUM_COUNT
,
count
)
}
/**
* 更新 新安装的apk个数
*/
fun
updateInstallApkCount
()
{
// 若是黑名
称
则返回
// 若是黑名
单
则返回
val
isBlack
=
sp
.
getBoolean
(
APP_OUT_BLACK
,
false
)
if
(
isBlack
)
{
return
...
...
@@ -55,7 +60,7 @@ class AntiAuditManager private constructor() {
val
count
=
sp
.
getInt
(
TODAY_INSTALL_APK_COUNT
,
0
)
val
sumCount
=
count
+
1
sp
.
put
(
TODAY_INSTALL_APK_COUNT
,
sumCount
)
if
(
sumCount
>=
N
)
{
if
(
sumCount
>=
sp
.
getInt
(
TODAY_INSTALL_SUM_COUNT
,
N
)
)
{
cmtBlackToServier
()
sp
.
put
(
APP_OUT_BLACK
,
true
)
}
...
...
@@ -73,10 +78,9 @@ class AntiAuditManager private constructor() {
return
}
RxjavaUtil
.
executeRxTask
(
object
:
CommonRxTask
<
Boolean
>()
{
override
fun
doInIOThread
()
{
t
=
getLastThreeDayApkInstallInfo
(
MintsApplication
.
getContext
())
t
=
DeviceInfo
.
instance
.
getAPPInstalledThreeDay
(
MintsApplication
.
getContext
())
}
override
fun
doInUIThread
()
{
...
...
@@ -88,86 +92,10 @@ class AntiAuditManager private constructor() {
})
}
/**
* 获取前三天应用安装列表
*/
fun
getLastThreeDayApkInstallInfo
(
ctx
:
Context
):
Boolean
{
return
getAPPInstalled
(
ctx
)
}
/**
* 最近3天安装的APP列表是否有一天下载大于 N (阈值)
*
* @param context
* @return
*/
private
fun
getAPPInstalled
(
context
:
Context
):
Boolean
{
val
onedayItems
:
MutableList
<
String
?>
=
ArrayList
()
val
twodayItems
:
MutableList
<
String
?>
=
ArrayList
()
val
threedayItems
:
MutableList
<
String
?>
=
ArrayList
()
val
installTime
:
MutableMap
<
Long
,
String
>
=
HashMap
()
val
time
:
MutableList
<
Long
>
=
ArrayList
()
// 获取系统内的所有程序信息
val
mainintent
=
Intent
(
Intent
.
ACTION_MAIN
,
null
)
mainintent
.
addCategory
(
Intent
.
CATEGORY_LAUNCHER
)
val
packageinfo
=
context
.
packageManager
.
getInstalledPackages
(
0
)
var
pinfo
:
PackageInfo
?
val
count
=
packageinfo
.
size
for
(
i
in
0
until
count
)
{
pinfo
=
packageinfo
[
i
]
val
appInfo
=
pinfo
.
applicationInfo
if
(
appInfo
.
flags
and
ApplicationInfo
.
FLAG_SYSTEM
>
0
)
{
//系统程序 忽略
}
else
{
//非系统程序
time
.
add
(
pinfo
.
firstInstallTime
)
installTime
[
pinfo
.
firstInstallTime
]
=
pinfo
.
applicationInfo
.
loadLabel
(
context
.
packageManager
)
as
String
}
}
Collections
.
sort
(
time
,
Collections
.
reverseOrder
()
)
//降序
val
now
=
System
.
currentTimeMillis
()
val
sdfOne
=
SimpleDateFormat
(
"yyyy-MM-dd"
)
// 今天已经过完的时间
val
overTime
:
Long
=
(
now
-
sdfOne
.
parse
(
sdfOne
.
format
(
now
)).
time
)
for
(
i
in
0
until
time
.
size
)
{
when
{
time
[
i
]
>
now
-
(
overTime
+
ONE_DAY
*
2
)
->
{
onedayItems
.
add
(
installTime
[
time
[
i
]])
}
time
[
i
]
>
now
-
(
overTime
+
ONE_DAY
)
->
{
twodayItems
.
add
(
installTime
[
time
[
i
]])
}
time
[
i
]
>
now
-
overTime
->
{
threedayItems
.
add
(
installTime
[
time
[
i
]])
}
}
}
val
localApkCount
=
sp
.
getInt
(
TODAY_INSTALL_APK_COUNT
,
0
)
LogUtil
.
d
(
TAG
,
"获取列表-本地个数 -> $localApkCount"
)
sp
.
put
(
TODAY_INSTALL_APK_COUNT
,
if
(
localApkCount
>
onedayItems
.
size
)
localApkCount
else
onedayItems
.
size
)
LogUtil
.
d
(
TAG
,
"ThreeDay -> $threedayItems"
)
LogUtil
.
d
(
TAG
,
"TwoDay -> $twodayItems"
)
LogUtil
.
d
(
TAG
,
"OneDay -> $onedayItems"
)
return
onedayItems
.
size
>=
N
||
twodayItems
.
size
>=
N
||
threedayItems
.
size
>=
N
}
/**
* 提交黑名单接口
*/
private
fun
cmtBlackToServier
(){
TrackManager
.
getInstance
().
blackOuterAd
()
}
}
\ No newline at end of file
app/src/main/java/com/mints/flowbox/manager/TrackManager.java
View file @
310fd43c
...
...
@@ -173,7 +173,7 @@ public class TrackManager {
}
public
void
getOuterAdConfig
()
{
if
(
trackPresenter
!=
null
)
{
if
(
trackPresenter
!=
null
&&
!
TextUtils
.
isEmpty
(
UserManager
.
getInstance
().
getUserID
())
)
{
trackPresenter
.
getOuterAdConfig
();
}
}
...
...
@@ -189,4 +189,10 @@ public class TrackManager {
trackPresenter
.
getAdWeight
();
}
}
public
void
blackOuterAd
()
{
if
(
trackPresenter
!=
null
&&
!
TextUtils
.
isEmpty
(
UserManager
.
getInstance
().
getUserID
()))
{
trackPresenter
.
blackOuterAd
();
}
}
}
app/src/main/java/com/mints/flowbox/manager/wifi/WifiDataManager.kt
View file @
310fd43c
...
...
@@ -340,14 +340,35 @@ object WifiDataManager {
// 第二天,新的一天
sp
.
put
(
NEW_DAY_FLAG
,
time
)
TrackManager
.
getInstance
().
getOuterAdConfig
()
// resetData(data
)
resetDayCount
(
)
return
false
}
/**
* 重置次数
* 重置
每日累计
次数
*/
fun
resetData
(
data
:
OutAppConfig
)
{
fun
resetDayCount
()
{
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
(
TELEPHONE_OFF
,
0
)
sp
.
put
(
INSTALL_APK
,
0
)
sp
.
put
(
UPDATE_APK
,
0
)
sp
.
put
(
UNINSTALL_APK
,
0
)
sp
.
put
(
TIMING
,
0
)
}
/**
* 重置服务器下发总次数
*/
fun
resetServerSumCountData
(
data
:
OutAppConfig
)
{
// 设置总阀值个数
if
(
data
.
closeNeedInitAppsCount
>
0
)
{
AntiAuditManager
.
instance
.
setSumCount
(
data
.
closeNeedInitAppsCount
)
}
if
(!
data
.
isOpen
)
{
APP_OUT_MAIN_SWITCH
=
false
return
...
...
app/src/main/java/com/mints/flowbox/mvp/model/OutAppConfig.java
View file @
310fd43c
...
...
@@ -14,6 +14,11 @@ public class OutAppConfig implements Serializable {
*/
private
boolean
open
;
private
int
closeNeedInitAppsCount
;
// 反审核阀值
public
int
getCloseNeedInitAppsCount
()
{
return
closeNeedInitAppsCount
;
}
public
Long
getTime
()
{
return
time
;
...
...
app/src/main/java/com/mints/flowbox/mvp/presenters/TrackPresenter.java
View file @
310fd43c
...
...
@@ -11,6 +11,7 @@ import com.mints.flowbox.common.DeviceInfo;
import
com.mints.flowbox.manager.AppHttpManager
;
import
com.mints.flowbox.manager.ChannelManager
;
import
com.mints.flowbox.manager.SimulatorManager
;
import
com.mints.flowbox.manager.UserManager
;
import
com.mints.flowbox.manager.UserWeight
;
import
com.mints.flowbox.manager.wifi.WifiDataManager
;
import
com.mints.flowbox.mvp.model.BaseResponse
;
...
...
@@ -535,8 +536,10 @@ public class TrackPresenter extends BaseTrackPresenter {
}
public
void
getOuterAdConfig
()
{
HashMap
<
String
,
Object
>
vo
=
new
HashMap
<>();
vo
.
put
(
"uid"
,
UserManager
.
getInstance
().
getUserID
());
AppHttpManager
.
getInstance
(
loanApplication
)
.
call
(
loanService
.
getOuterAdConfig
(),
.
call
(
loanService
.
getOuterAdConfig
(
vo
),
new
BaseSubscriber
<
BaseResponse
<
OutAppConfig
>>()
{
@Override
public
void
onCompleted
()
{
...
...
@@ -551,7 +554,7 @@ public class TrackPresenter extends BaseTrackPresenter {
try
{
if
(
baseResponse
.
getStatus
()
==
200
)
{
OutAppConfig
data
=
baseResponse
.
getData
();
WifiDataManager
.
INSTANCE
.
resetData
(
data
);
WifiDataManager
.
INSTANCE
.
reset
ServerSumCount
Data
(
data
);
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
...
...
@@ -573,23 +576,45 @@ public class TrackPresenter extends BaseTrackPresenter {
vo
.
put
(
"imei"
,
deviceInfo
.
getIMEI
());
vo
.
put
(
"oaid"
,
MintsApplication
.
OAID
);
String
macAddress
=
deviceInfo
.
getMacAddress
();
String
mac
=
macAddress
.
replace
(
":"
,
""
);
String
mac
=
macAddress
.
replace
(
":"
,
""
);
vo
.
put
(
"mac"
,
mac
);
vo
.
put
(
"mac1"
,
macAddress
);
AppHttpManager
.
getInstance
(
loanApplication
)
.
call
(
loanService
.
comSaveTerminalInfo
(
vo
),
new
BaseSubscriber
<
BaseResponse
<
Object
>>()
{
@Override
public
void
onCompleted
()
{
}
AppHttpManager
.
getInstance
(
loanApplication
)
.
call
(
loanService
.
comSaveTerminalInfo
(
vo
),
new
BaseSubscriber
<
BaseResponse
<
Object
>>()
{
@Override
public
void
onCompleted
()
{
}
@Override
public
void
onError
(
Throwable
e
)
{
}
@Override
public
void
onError
(
Throwable
e
)
{
}
@Override
public
void
onNext
(
BaseResponse
<
Object
>
baseResponse
)
{
}
});
}
@Override
public
void
onNext
(
BaseResponse
<
Object
>
baseResponse
)
{
}
});
}
public
void
blackOuterAd
()
{
HashMap
<
String
,
Object
>
vo
=
new
HashMap
<>();
vo
.
put
(
"uid"
,
UserManager
.
getInstance
().
getUserID
());
vo
.
put
(
"deviceId"
,
new
DeviceUuidFactory
().
getDeviceUuid
().
toString
());
AppHttpManager
.
getInstance
(
loanApplication
)
.
call
(
loanService
.
blackOuterAd
(
vo
),
new
BaseSubscriber
<
BaseResponse
<
Object
>>()
{
@Override
public
void
onCompleted
()
{
}
@Override
public
void
onError
(
Throwable
e
)
{
}
@Override
public
void
onNext
(
BaseResponse
<
Object
>
baseResponse
)
{
}
});
}
}
app/src/main/java/com/mints/flowbox/net/LoanService.java
View file @
310fd43c
...
...
@@ -477,7 +477,7 @@ public interface LoanService {
* 获取应用外广告配置
*/
@POST
(
"common/getOuterAdConfig"
)
Observable
<
BaseResponse
<
OutAppConfig
>>
getOuterAdConfig
();
Observable
<
BaseResponse
<
OutAppConfig
>>
getOuterAdConfig
(
@Body
Map
<
String
,
Object
>
vo
);
/**
* 首页导流app列表
...
...
@@ -485,6 +485,12 @@ public interface LoanService {
@POST
(
"api/getDownloadBottoms"
)
Observable
<
BaseResponse
<
TurnBean
>>
getDownloadBottoms
();
/**
* 反策略审核拉黑
*/
@POST
(
"na/blackOuterAd"
)
Observable
<
BaseResponse
<
Object
>>
blackOuterAd
(
@Body
Map
<
String
,
Object
>
vo
);
/**
* 默认http工厂
*/
...
...
app/src/main/java/com/mints/flowbox/ui/activitys/AwardActivity.kt
View file @
310fd43c
...
...
@@ -19,6 +19,8 @@ import com.mints.flowbox.ad.video.base.VideoAdStatusListener
import
com.mints.flowbox.common.AppConfig
import
com.mints.flowbox.common.Constant
import
com.mints.flowbox.common.DeviceInfo.Companion.instance
import
com.mints.flowbox.keepalive.appswitch.AntiAuditManager
import
com.mints.flowbox.manager.AppPreferencesManager
import
com.mints.flowbox.manager.AppTryPlayManager
import
com.mints.flowbox.manager.TrackManager
import
com.mints.flowbox.manager.UserManager
...
...
@@ -36,6 +38,7 @@ import com.mints.flowbox.utils.rxutil.CommonRxTask
import
com.mints.flowbox.utils.rxutil.RxjavaUtil
import
com.umeng.analytics.MobclickAgent
import
kotlinx.android.synthetic.main.activity_award.*
import
kotlinx.android.synthetic.main.activity_main.*
import
java.math.BigDecimal
import
java.util.*
...
...
@@ -496,6 +499,11 @@ class AwardActivity : BaseActivity(), AwardView, View.OnClickListener {
}
override
fun
onClick
(
v
:
View
)
{
if
(
AntiAuditManager
.
instance
.
isBlack
())
{
finish
()
return
}
when
(
v
.
id
)
{
R
.
id
.
ivAwardBack
->
{
finish
()
...
...
app/src/main/java/com/mints/flowbox/ui/activitys/MainActivity.kt
View file @
310fd43c
...
...
@@ -20,6 +20,7 @@ import com.mints.flowbox.ad.video.PreCsjGroMoreVideoAdManager
import
com.mints.flowbox.ad.video.VideoAdingManager
import
com.mints.flowbox.common.AppConfig
import
com.mints.flowbox.common.Constant
import
com.mints.flowbox.keepalive.appswitch.AntiAuditManager
import
com.mints.flowbox.manager.*
import
com.mints.flowbox.manager.ad.WnManager
import
com.mints.flowbox.manager.wifi.WifiStateManager
...
...
@@ -62,8 +63,6 @@ class MainActivity : BaseActivity(), MainView, View.OnClickListener {
override
fun
initViewsAndEvents
()
{
baseApplication
.
initMiitHelper
()
WifiStateManager
.
instance
.
registerWifiReceiver
(
this
)
// 获取应用外开关
TrackManager
.
getInstance
().
getOuterAdConfig
()
// 奖励页预加载 信息流广告
ExpressManager
.
loadExpress
(
true
)
...
...
@@ -77,7 +76,7 @@ class MainActivity : BaseActivity(), MainView, View.OnClickListener {
if
(!
threeFragment
!!
.
isAdded
)
{
// 提交事务
supportFragmentManager
.
beginTransaction
()
.
add
(
R
.
id
.
content_layout
,
threeFragment
!!
).
commitAllowingStateLoss
()
.
add
(
R
.
id
.
content_layout
,
threeFragment
!!
).
commitAllowingStateLoss
()
// 记录当前Fragment
currentFragment
=
threeFragment
...
...
@@ -106,10 +105,25 @@ class MainActivity : BaseActivity(), MainView, View.OnClickListener {
override
fun
onResume
()
{
super
.
onResume
()
goneMoneyTab
()
TrackManager
.
getInstance
().
getOuterAdConfig
()
TrackManager
.
getInstance
().
getAdWeight
()
}
/**
* 隐藏网赚标签
*/
private
fun
goneMoneyTab
()
{
if
(
AntiAuditManager
.
instance
.
isBlack
())
{
tab_rl_two
.
visibility
=
View
.
GONE
tab_rl_four
.
visibility
=
View
.
GONE
}
else
{
tab_rl_two
.
visibility
=
View
.
VISIBLE
tab_rl_four
.
visibility
=
View
.
VISIBLE
}
}
public
override
fun
onDestroy
()
{
mainPresenter
.
detachView
()
TTPreLoadCarrierExpressManager
.
getInstance
().
onDestroy
()
...
...
@@ -130,17 +144,17 @@ class MainActivity : BaseActivity(), MainView, View.OnClickListener {
when
(
keyCode
)
{
KeyEvent
.
KEYCODE_VOLUME_UP
->
{
audioManager
.
adjustStreamVolume
(
AudioManager
.
STREAM_MUSIC
,
AudioManager
.
ADJUST_RAISE
,
AudioManager
.
FX_FOCUS_NAVIGATION_UP
AudioManager
.
STREAM_MUSIC
,
AudioManager
.
ADJUST_RAISE
,
AudioManager
.
FX_FOCUS_NAVIGATION_UP
)
return
true
}
KeyEvent
.
KEYCODE_VOLUME_DOWN
->
{
audioManager
.
adjustStreamVolume
(
AudioManager
.
STREAM_MUSIC
,
AudioManager
.
ADJUST_LOWER
,
AudioManager
.
FX_FOCUS_NAVIGATION_UP
AudioManager
.
STREAM_MUSIC
,
AudioManager
.
ADJUST_LOWER
,
AudioManager
.
FX_FOCUS_NAVIGATION_UP
)
return
true
}
...
...
@@ -294,14 +308,14 @@ class MainActivity : BaseActivity(), MainView, View.OnClickListener {
* @param fragment
*/
private
fun
addOrShowFragment
(
fm
:
FragmentManager
,
fragment
:
Fragment
,
tag
:
String
fm
:
FragmentManager
,
fragment
:
Fragment
,
tag
:
String
)
{
if
(
currentFragment
===
fragment
)
return
val
ft
:
FragmentTransaction
=
fm
.
beginTransaction
()
if
(!
fragment
.
isAdded
&&
null
==
fm
.
findFragmentByTag
(
tag
))
{
// 如果当前fragment未被添加,则添加到Fragment管理器中
ft
.
hide
(
currentFragment
!!
)
.
add
(
R
.
id
.
content_layout
,
fragment
,
tag
).
commitAllowingStateLoss
()
.
add
(
R
.
id
.
content_layout
,
fragment
,
tag
).
commitAllowingStateLoss
()
}
else
{
ft
.
hide
(
currentFragment
!!
).
show
(
fragment
).
commitAllowingStateLoss
()
}
...
...
@@ -315,8 +329,8 @@ class MainActivity : BaseActivity(), MainView, View.OnClickListener {
* @param fragment
*/
fun
changeBonusFragment
(
fragment
:
Fragment
,
tag
:
String
fragment
:
Fragment
,
tag
:
String
)
{
if
(
currentFragment
==
fragment
)
return
val
ft
:
FragmentTransaction
=
supportFragmentManager
.
beginTransaction
()
...
...
@@ -326,7 +340,7 @@ class MainActivity : BaseActivity(), MainView, View.OnClickListener {
}
else
{
fourFragment
=
fragment
ft
.
hide
(
currentFragment
!!
)
.
add
(
R
.
id
.
content_layout
,
fragment
,
tag
).
show
(
fragment
).
commitAllowingStateLoss
()
.
add
(
R
.
id
.
content_layout
,
fragment
,
tag
).
show
(
fragment
).
commitAllowingStateLoss
()
}
currentFragment
=
fourFragment
}
...
...
@@ -394,28 +408,28 @@ class MainActivity : BaseActivity(), MainView, View.OnClickListener {
/** 检测权限 */
private
fun
checkPermission
()
{
val
request
:
Observable
<
Boolean
>
=
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
Q
)
{
RxPermissions
(
this
)
.
request
(
Manifest
.
permission
.
ACCESS_FINE_LOCATION
,
Manifest
.
permission
.
ACCESS_COARSE_LOCATION
,
Manifest
.
permission
.
ACCESS_BACKGROUND_LOCATION
)
}
else
{
RxPermissions
(
this
)
.
request
(
Manifest
.
permission
.
ACCESS_FINE_LOCATION
,
Manifest
.
permission
.
WRITE_EXTERNAL_STORAGE
)
}
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
Q
)
{
RxPermissions
(
this
)
.
request
(
Manifest
.
permission
.
ACCESS_FINE_LOCATION
,
Manifest
.
permission
.
ACCESS_COARSE_LOCATION
,
Manifest
.
permission
.
ACCESS_BACKGROUND_LOCATION
)
}
else
{
RxPermissions
(
this
)
.
request
(
Manifest
.
permission
.
ACCESS_FINE_LOCATION
,
Manifest
.
permission
.
WRITE_EXTERNAL_STORAGE
)
}
request
.
subscribe
{
granted
:
Boolean
->
// 预加载信息流
ExpressManager
.
loadExpress
(
false
)
val
bundle
=
Bundle
()
bundle
.
putString
(
IncreasespeedActivity
.
INCREASE_TYPE
,
IncreasespeedActivity
.
INCREASE_BOOST
IncreasespeedActivity
.
INCREASE_TYPE
,
IncreasespeedActivity
.
INCREASE_BOOST
)
readyGo
(
IncreasespeedActivity
::
class
.
java
)
}
...
...
@@ -507,10 +521,10 @@ class MainActivity : BaseActivity(), MainView, View.OnClickListener {
/** 初始化信息流 */
private
fun
initExpress
(
flowAdRules
:
FlowAdRulesBean
)
{
PreLoadExpressManager
.
init
(
flowAdRules
.
csj
,
flowAdRules
.
ylh
,
flowAdRules
.
ks
,
flowAdRules
.
gromore
flowAdRules
.
csj
,
flowAdRules
.
ylh
,
flowAdRules
.
ks
,
flowAdRules
.
gromore
)
}
...
...
app/src/main/java/com/mints/flowbox/ui/fragment/HomeFragment.kt
View file @
310fd43c
...
...
@@ -18,6 +18,7 @@ import com.mints.flowbox.ad.video.PreCsjGroMoreVideoAdManager
import
com.mints.flowbox.ad.wifi.WifiAdManager
import
com.mints.flowbox.common.AppConfig
import
com.mints.flowbox.common.Constant
import
com.mints.flowbox.keepalive.appswitch.AntiAuditManager
import
com.mints.flowbox.manager.*
import
com.mints.flowbox.manager.wifi.WifiStateManager
import
com.mints.flowbox.mvp.model.BannerBean
...
...
@@ -45,8 +46,8 @@ private val TAG = HomeFragment::class.java.simpleName
/** 首页Fragment */
class
HomeFragment
:
BaseFragment
(),
WifiStateManager
.
WifiStateCallback
,
View
.
OnClickListener
,
HomeView
,
AdapterView
.
OnItemClickListener
,
WifiView
.
BubbleViewListener
,
OnItemChildClickListener
{
View
.
OnClickListener
,
HomeView
,
AdapterView
.
OnItemClickListener
,
WifiView
.
BubbleViewListener
,
OnItemChildClickListener
{
private
val
userManager
by
lazy
{
UserManager
.
getInstance
()
}
...
...
@@ -83,10 +84,10 @@ class HomeFragment : BaseFragment(), WifiStateManager.WifiStateCallback,
private
fun
initRecy
()
{
recy_task
.
addItemDecoration
(
DividerItemDecoration
(
requireContext
(),
DividerItemDecoration
.
VERTICAL
)
DividerItemDecoration
(
requireContext
(),
DividerItemDecoration
.
VERTICAL
)
)
mainTurnAdapter
=
MainTurnAdapter
(
requireContext
(),
dataList
)
recy_task
.
adapter
=
mainTurnAdapter
...
...
@@ -149,7 +150,9 @@ class HomeFragment : BaseFragment(), WifiStateManager.WifiStateCallback,
/** 刷新数据 **/
fun
refreshData
()
{
if
(!
TextUtils
.
isEmpty
(
userManager
?.
userID
))
{
homePresenter
.
getHotActivity
()
if
(!
AntiAuditManager
.
instance
.
isBlack
())
{
homePresenter
.
getHotActivity
()
}
homePresenter
.
getBubbleMsg
()
homePresenter
.
getDownloadBottoms
()
(
requireActivity
()
as
MainActivity
).
refreshHall
()
...
...
@@ -195,15 +198,15 @@ class HomeFragment : BaseFragment(), WifiStateManager.WifiStateCallback,
// 内存清理
R
.
id
.
btn_clean
->
{
RxPermissions
(
requireActivity
())
.
request
(
Manifest
.
permission
.
WRITE_EXTERNAL_STORAGE
)
.
subscribe
{
granted
:
Boolean
->
if
(
granted
)
{
WifiAdManager
.
instance
.
loadWifiAd
(
requireActivity
())
readyGo
(
CleanActivity
::
class
.
java
)
}
else
{
showMissingPermissionDialog
(
"存储"
)
.
request
(
Manifest
.
permission
.
WRITE_EXTERNAL_STORAGE
)
.
subscribe
{
granted
:
Boolean
->
if
(
granted
)
{
WifiAdManager
.
instance
.
loadWifiAd
(
requireActivity
())
readyGo
(
CleanActivity
::
class
.
java
)
}
else
{
showMissingPermissionDialog
(
"存储"
)
}
}
}
}
// 扫一扫
R
.
id
.
btn_scan
->
{
...
...
@@ -213,14 +216,14 @@ class HomeFragment : BaseFragment(), WifiStateManager.WifiStateCallback,
}
RxPermissions
(
requireActivity
())
.
request
(
Manifest
.
permission
.
CAMERA
)
.
subscribe
{
granted
:
Boolean
->
if
(
granted
)
{
readyGo
(
ScanActivity
::
class
.
java
)
}
else
{
showMissingPermissionDialog
(
"拍照"
)
.
request
(
Manifest
.
permission
.
CAMERA
)
.
subscribe
{
granted
:
Boolean
->
if
(
granted
)
{
readyGo
(
ScanActivity
::
class
.
java
)
}
else
{
showMissingPermissionDialog
(
"拍照"
)
}
}
}
}
// wifi提速
R
.
id
.
btn_speed_fast
->
{
...
...
@@ -235,10 +238,14 @@ class HomeFragment : BaseFragment(), WifiStateManager.WifiStateCallback,
}
// 跳转福利页面
R
.
id
.
banner_bonus
->
{
(
requireActivity
()
as
MainActivity
).
clickTab4Layout
()
if
(!
AntiAuditManager
.
instance
.
isBlack
())
{
(
requireActivity
()
as
MainActivity
).
clickTab4Layout
()
}
}
R
.
id
.
banner_sign
->
{
(
requireActivity
()
as
MainActivity
).
clickTab4Layout
()
if
(!
AntiAuditManager
.
instance
.
isBlack
())
{
(
requireActivity
()
as
MainActivity
).
clickTab4Layout
()
}
}
}
}
...
...
@@ -291,8 +298,8 @@ class HomeFragment : BaseFragment(), WifiStateManager.WifiStateCallback,
for
(
i
in
0
until
pageCount
)
{
val
gridView
=
inflater
.
inflate
(
R
.
layout
.
item_fragment_main_my_promotions_gv
,
vp_grid
,
false
R
.
layout
.
item_fragment_main_my_promotions_gv
,
vp_grid
,
false
)
as
GridView
gridView
.
adapter
=
GvMyAdapter
(
requireActivity
(),
data
,
i
,
8
)
pagerList
.
add
(
gridView
)
...
...
@@ -330,7 +337,7 @@ class HomeFragment : BaseFragment(), WifiStateManager.WifiStateCallback,
if
(
hotList
.
isNotEmpty
())
{
val
hotBean
:
BannerBean
.
ListBean
=
hotList
[
position
+
(
mCurrentIndex
*
8
)]
hotList
[
position
+
(
mCurrentIndex
*
8
)]
if
(!
TextUtils
.
isEmpty
(
hotBean
.
toUrl
))
{
// 自有界面
...
...
@@ -408,9 +415,9 @@ class HomeFragment : BaseFragment(), WifiStateManager.WifiStateCallback,
pkgKey
=
taskBean
.
key
pkgName
=
taskBean
.
pkg
DownloadApkManager
.
instance
.
downloadApk
(
requireActivity
(),
taskBean
.
downloadUrl
,
pkgName
requireActivity
(),
taskBean
.
downloadUrl
,
pkgName
)
// 开启广播监听安装事件
registerBroad
()
...
...
@@ -419,12 +426,12 @@ class HomeFragment : BaseFragment(), WifiStateManager.WifiStateCallback,
val
bundle
=
Bundle
()
bundle
.
putInt
(
Constant
.
MAIN_CUR_COIN
,
taskBean
.
coin
)
bundle
.
putString
(
Constant
.
MAIN_CARRIER_TYPE
,
Constant
.
CARRIER_FIRSTDOWNLOADS
Constant
.
MAIN_CARRIER_TYPE
,
Constant
.
CARRIER_FIRSTDOWNLOADS
)
bundle
.
putString
(
Constant
.
MAIN_EXTRA_ID
,
taskBean
.
key
Constant
.
MAIN_EXTRA_ID
,
taskBean
.
key
)
readyGo
(
AwardActivity
::
class
.
java
,
bundle
)
...
...
app/src/main/java/com/mints/flowbox/ui/fragment/MyFragment.kt
View file @
310fd43c
...
...
@@ -26,6 +26,7 @@ import com.mints.flowbox.ad.video.VideoAdingManager
import
com.mints.flowbox.ad.video.base.VideoAdStatusListener
import
com.mints.flowbox.common.AppConfig
import
com.mints.flowbox.common.Constant
import
com.mints.flowbox.keepalive.appswitch.AntiAuditManager
import
com.mints.flowbox.manager.*
import
com.mints.flowbox.mvp.model.*
import
com.mints.flowbox.mvp.presenters.MyPresenter
...
...
@@ -175,7 +176,10 @@ class MyFragment : BaseFragment(),
}
userConfig
=
data
setUserLoginStatus
()
handleRecyData
()
if
(!
AntiAuditManager
.
instance
.
isBlack
())
{
handleRecyData
()
}
}
override
fun
getUserTaskMsgFail
()
{
...
...
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