Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
android_goodmoney
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_goodmoney
Commits
192d16bd
Commit
192d16bd
authored
Jan 06, 2021
by
jyx
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
高额任务试玩奖励
parent
4a19cc29
Changes
30
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
30 changed files
with
607 additions
and
151 deletions
+607
-151
AndroidManifest.xml
GoodMoney/app/src/main/AndroidManifest.xml
+15
-5
InitAppService.kt
...y/app/src/main/java/com/mints/goodmoney/InitAppService.kt
+0
-11
CsjVedioAdManager.java
.../java/com/mints/goodmoney/ad/vedio/CsjVedioAdManager.java
+28
-1
MhVedioAdManager.kt
...ain/java/com/mints/goodmoney/ad/vedio/MhVedioAdManager.kt
+1
-1
VedioAdingManager.java
.../java/com/mints/goodmoney/ad/vedio/VedioAdingManager.java
+60
-12
WnVedioAdManager.kt
...ain/java/com/mints/goodmoney/ad/vedio/WnVedioAdManager.kt
+12
-13
YlhVedioAdManager.java
.../java/com/mints/goodmoney/ad/vedio/YlhVedioAdManager.java
+1
-0
AppConfig.java
...p/src/main/java/com/mints/goodmoney/common/AppConfig.java
+5
-0
Constant.kt
.../app/src/main/java/com/mints/goodmoney/common/Constant.kt
+4
-1
AppTryPlayManager.kt
...ain/java/com/mints/goodmoney/manager/AppTryPlayManager.kt
+35
-0
EventMessage.java
...main/java/com/mints/goodmoney/mvp/model/EventMessage.java
+5
-0
BookPresenter.kt
.../java/com/mints/goodmoney/mvp/presenters/BookPresenter.kt
+2
-2
DrawcashPresenter.java
...com/mints/goodmoney/mvp/presenters/DrawcashPresenter.java
+37
-3
KuYinYuePagePresenter.kt
...m/mints/goodmoney/mvp/presenters/KuYinYuePagePresenter.kt
+0
-5
MyPresenter.kt
...in/java/com/mints/goodmoney/mvp/presenters/MyPresenter.kt
+29
-7
DrawcashView.java
...main/java/com/mints/goodmoney/mvp/views/DrawcashView.java
+2
-0
LoanService.java
...pp/src/main/java/com/mints/goodmoney/net/LoanService.java
+8
-1
AppInstallService.java
...n/java/com/mints/goodmoney/service/AppInstallService.java
+15
-10
AboutusActivity.kt
.../java/com/mints/goodmoney/ui/activitys/AboutusActivity.kt
+4
-4
AccountMergeActivity.kt
.../com/mints/goodmoney/ui/activitys/AccountMergeActivity.kt
+4
-1
AwardActivity.kt
...in/java/com/mints/goodmoney/ui/activitys/AwardActivity.kt
+11
-4
BindMobileActivity.kt
...va/com/mints/goodmoney/ui/activitys/BindMobileActivity.kt
+1
-2
DrawcashActivity.kt
...java/com/mints/goodmoney/ui/activitys/DrawcashActivity.kt
+42
-27
MainActivity.kt
...ain/java/com/mints/goodmoney/ui/activitys/MainActivity.kt
+0
-5
SettingsActivity.kt
...java/com/mints/goodmoney/ui/activitys/SettingsActivity.kt
+3
-3
MainMyAdapter.kt
...main/java/com/mints/goodmoney/ui/adapter/MainMyAdapter.kt
+3
-0
MainFragment.kt
...main/java/com/mints/goodmoney/ui/fragment/MainFragment.kt
+0
-1
MyFragment.kt
...c/main/java/com/mints/goodmoney/ui/fragment/MyFragment.kt
+166
-31
AppUtil.kt
...ey/app/src/main/java/com/mints/goodmoney/utils/AppUtil.kt
+113
-0
activity_kyl_vedio.xml
GoodMoney/app/src/main/res/layout/activity_kyl_vedio.xml
+1
-1
No files found.
GoodMoney/app/src/main/AndroidManifest.xml
View file @
192d16bd
...
...
@@ -12,7 +12,9 @@
<uses-permission
android:name=
"android.permission.REQUEST_INSTALL_PACKAGES"
/>
<uses-permission
android:name=
"android.permission.GET_TASKS"
/>
<uses-permission
android:name=
"android.permission.WAKE_LOCK"
/>
<uses-permission
android:name=
"android.permission.WRITE_SETTINGS"
/>
<uses-permission
android:name=
"android.permission.WRITE_SETTINGS"
tools:ignore=
"ProtectedPermissions"
/>
<uses-permission
android:name=
"android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS"
/>
<uses-permission
android:name=
"android.permission.PACKAGE_USAGE_STATS"
...
...
@@ -28,12 +30,17 @@
<uses-permission
android:name=
"com.mints.goodmoney.permission.JPUSH_MESSAGE"
/>
<uses-permission
android:name=
"android.permission.RECEIVE_USER_PRESENT"
/>
<uses-permission
android:name=
"android.permission.VIBRATE"
/>
<uses-permission
android:name=
"android.permission.MOUNT_UNMOUNT_FILESYSTEMS"
/>
<uses-permission
android:name=
"android.permission.MOUNT_UNMOUNT_FILESYSTEMS"
tools:ignore=
"ProtectedPermissions"
/>
<uses-permission
android:name=
"android.permission.SYSTEM_ALERT_WINDOW"
/>
<uses-permission
android:name=
"android.permission.ACCESS_LOCATION_EXTRA_COMMANDS"
/>
<uses-permission
android:name=
"android.permission.CHANGE_NETWORK_STATE"
/>
<uses-permission
android:name=
"android.permission.ACCESS_BACKGROUND_LOCATION"
/>
<uses-permission
android:name=
"android.permission.SET_WALLPAPER"
/>
<uses-permission
android:name=
"android.permission.SET_WALLPAPER"
/>
<uses-permission
android:name=
"android.permission.PACKAGE_USAGE_STATS"
tools:ignore=
"ProtectedPermissions"
/>
<application
android:name=
".MintsApplication"
...
...
@@ -233,6 +240,11 @@
android:exported=
"true"
android:process=
":player"
/>
<!-- 监听apk安装 -->
<service
android:name=
".service.AppInstallService"
android:exported=
"false"
/>
<!-- JPUSH 用户自定义的广播接收器 -->
<receiver
android:name=
"com.mints.goodmoney.service.JpushReceiver"
...
...
@@ -363,8 +375,6 @@
android:resource=
"@xml/wn_file_paths"
/>
</provider>
<service
android:name=
".service.MyService"
></service>
</application>
</manifest>
\ No newline at end of file
GoodMoney/app/src/main/java/com/mints/goodmoney/InitAppService.kt
View file @
192d16bd
...
...
@@ -7,18 +7,7 @@ import android.content.Intent
import
cn.jpush.android.api.BasicPushNotificationBuilder
import
cn.jpush.android.api.JPushInterface
import
com.mints.goodmoney.manager.BxmManager.initBxm
import
com.mints.library.utils.CommonUtils
import
com.mob.MobSDK
import
com.orhanobut.logger.AndroidLogAdapter
import
com.orhanobut.logger.FormatStrategy
import
com.orhanobut.logger.Logger
import
com.orhanobut.logger.PrettyFormatStrategy
import
com.tendcloud.tenddata.TCAgent
import
com.umeng.analytics.MobclickAgent
import
com.umeng.commonsdk.UMConfigure
import
com.ximalaya.ting.android.opensdk.constants.ConstantsOpenSdk
import
com.ximalaya.ting.android.opensdk.datatrasfer.CommonRequest
/**
* 子线程初始化SDK
...
...
GoodMoney/app/src/main/java/com/mints/goodmoney/ad/vedio/CsjVedioAdManager.java
View file @
192d16bd
...
...
@@ -5,6 +5,7 @@ import android.app.Activity;
import
com.bytedance.sdk.openadsdk.AdSlot
;
import
com.bytedance.sdk.openadsdk.TTAdConstant
;
import
com.bytedance.sdk.openadsdk.TTAdNative
;
import
com.bytedance.sdk.openadsdk.TTAppDownloadListener
;
import
com.bytedance.sdk.openadsdk.TTRewardVideoAd
;
import
com.mints.goodmoney.BuildConfig
;
import
com.mints.goodmoney.common.Constant
;
...
...
@@ -127,7 +128,6 @@ public class CsjVedioAdManager extends BaseVedioAd {
.
build
();
if
(
ttAdNative
!=
null
)
{
ttAdNative
.
loadRewardVideoAd
(
adSlot
,
new
TTAdNative
.
RewardVideoAdListener
()
{
@Override
public
void
onError
(
int
code
,
String
message
)
{
...
...
@@ -213,6 +213,33 @@ public class CsjVedioAdManager extends BaseVedioAd {
public
void
onSkippedVideo
()
{
}
});
// 下载任务监听
mttRewardVideoAd
.
setDownloadListener
(
new
TTAppDownloadListener
()
{
@Override
public
void
onIdle
()
{
}
@Override
public
void
onDownloadActive
(
long
l
,
long
l1
,
String
s
,
String
s1
)
{
}
@Override
public
void
onDownloadPaused
(
long
l
,
long
l1
,
String
s
,
String
s1
)
{
}
@Override
public
void
onDownloadFailed
(
long
l
,
long
l1
,
String
s
,
String
s1
)
{
}
@Override
public
void
onDownloadFinished
(
long
l
,
String
s
,
String
s1
)
{
}
@Override
public
void
onInstalled
(
String
s
,
String
appName
)
{
}
});
}
}
});
...
...
GoodMoney/app/src/main/java/com/mints/goodmoney/ad/vedio/MhVedioAdManager.kt
View file @
192d16bd
...
...
@@ -50,7 +50,7 @@ class MhVedioAdManager private constructor(activity: Activity) :
this
.
activity
=
activity
isClickScreen
=
true
va
r
postId
:
String
=
when
(
carrierType
)
{
va
l
postId
:
String
=
when
(
carrierType
)
{
Constant
.
CARRIER_VERSUS_VIDEO
->
MhManager
.
POS_ID
Constant
.
CARRIER_HOMEWATER
->
MhManager
.
POS_ID
Constant
.
CARRIER_CHALLENGE_TURN
,
Constant
.
CARRIER_DRAWCASH
->
MhManager
.
POS_ID
...
...
GoodMoney/app/src/main/java/com/mints/goodmoney/ad/vedio/VedioAdingManager.java
View file @
192d16bd
...
...
@@ -35,6 +35,10 @@ public class VedioAdingManager {
private
int
flVedioWeight
;
private
ArrayList
<
WeightBean
>
weightList
;
// 是否是高额视频任务
private
boolean
isHighWeight
=
false
;
private
boolean
isTTVideoAd
=
false
;
private
Activity
activity
;
private
boolean
isVedioAdDownload
=
false
;
// 是否点击广告下载 true-点击
...
...
@@ -74,15 +78,6 @@ public class VedioAdingManager {
this
.
flVedioWeight
=
flVedioWeight
;
}
/**
* 初始化广告权重
*/
public
void
initAdWeight
(
int
csjVedioWeight
,
int
ylhWeight
,
int
wnWeight
)
{
this
.
csjVedioWeight
=
csjVedioWeight
;
this
.
ylhWeight
=
ylhWeight
;
this
.
wnWeight
=
wnWeight
;
}
/**
* 根据类型加载对应视频(第一次加载)
*
...
...
@@ -100,6 +95,8 @@ public class VedioAdingManager {
// 权重自有逻辑
loadAdVedio
(
getVedioAdType
(),
bean
);
}
isHighWeight
=
false
;
}
/**
...
...
@@ -160,12 +157,65 @@ public class VedioAdingManager {
*/
private
String
getVedioAdType
()
{
// 根据权重获取广告类型
String
adType
=
getRandomWeight
();
String
adType
;
if
(
isHighWeight
)
{
adType
=
getHighWeight
();
}
else
{
adType
=
getRandomWeight
();
}
LogUtil
.
d
(
TAG
,
"权重结果返回的广告类型:"
+
adType
);
return
adType
;
}
public
void
setIsHighWeight
(
boolean
isHighWeight
)
{
this
.
isHighWeight
=
isHighWeight
;
}
/**
* 高额任务广告类型
*
* @return
*/
private
String
getHighWeight
()
{
int
weight
=
0
;
if
(
AppConfig
.
csjVedioAdCount
>
0
)
{
weight
=
weight
+
csjVedioWeight
;
LogUtil
.
d
(
TAG
,
"权重值:csjVedioWeight:"
+
csjVedioWeight
);
}
if
(
AppConfig
.
ylhAdCount
>
0
)
{
weight
=
weight
+
ylhWeight
;
LogUtil
.
d
(
TAG
,
"权重值:ylhWeight:"
+
ylhWeight
);
}
if
(
AppConfig
.
wnVedioAdCount
>
0
)
{
weight
=
weight
+
wnWeight
;
LogUtil
.
d
(
TAG
,
"权重值:wnWeight:"
+
wnWeight
);
}
// 权重随机
if
(
weight
>
0
)
{
isTTVideoAd
=
!
isTTVideoAd
;
if
(
isTTVideoAd
)
{
if
(
AppConfig
.
csjVedioAdCount
>
0
)
{
return
Constant
.
CSJ_VEDIO_AD
;
}
else
if
(
AppConfig
.
ylhAdCount
>
0
)
{
return
Constant
.
YLH_VEDIO_AD
;
}
else
{
return
Constant
.
SDHZ_VEDIO_AD
;
}
}
else
{
if
(
AppConfig
.
ylhAdCount
>
0
)
{
return
Constant
.
YLH_VEDIO_AD
;
}
else
if
(
AppConfig
.
csjVedioAdCount
>
0
)
{
return
Constant
.
CSJ_VEDIO_AD
;
}
else
{
return
Constant
.
SDHZ_VEDIO_AD
;
}
}
}
return
""
;
}
/**
* 根据权重获取广告类型
*
...
...
@@ -205,8 +255,6 @@ public class VedioAdingManager {
int
randomWeight
=
r
.
nextInt
(
weight
)
+
1
;
LogUtil
.
d
(
TAG
,
"2、权重随机值:"
+
randomWeight
);
// ToastUtil.showLong(activity, "权重随机值:" + randomWeight);
for
(
WeightBean
weightBean
:
weightList
)
{
randomWeight
-=
weightBean
.
getWeight
();
if
(
randomWeight
<=
0
)
{
...
...
GoodMoney/app/src/main/java/com/mints/goodmoney/ad/vedio/WnVedioAdManager.kt
View file @
192d16bd
...
...
@@ -2,6 +2,8 @@ package com.mints.goodmoney.ad.vedio
import
android.app.Activity
import
com.mints.goodmoney.common.Constant
import
com.mints.goodmoney.common.DeviceInfo.Companion.instance
import
com.mints.goodmoney.manager.AppTryPlayManager
import
com.mints.goodmoney.manager.TrackManager
import
com.mints.goodmoney.manager.WnManager
import
com.mints.goodmoney.mvp.presenters.WnVedioAdPresenter
...
...
@@ -9,14 +11,14 @@ import com.mints.goodmoney.mvp.views.VedioAdManagerView
import
com.mints.goodmoney.utils.LogUtil
import
com.wannuosili.sdk.*
private
val
TAG
=
WnVedioAdManager
::
class
.
java
.
simpleName
/**
* 闪电盒子视频
*/
class
WnVedioAdManager
private
constructor
(
activity
:
Activity
)
:
BaseVedioAd
(
activity
),
VedioAdManagerView
{
private
val
TAG
=
WnVedioAdManager
::
class
.
java
.
simpleName
private
var
wnVedioAdPresenter
:
WnVedioAdPresenter
?
=
null
private
var
wnVedioAdListener
:
WnVedioAdListener
?
=
null
private
var
mRewardVideoAd
:
WNRewardVideoAd
?
=
null
...
...
@@ -50,13 +52,12 @@ class WnVedioAdManager private constructor(activity: Activity) :
this
.
activity
=
activity
isClickScreen
=
true
var
postId
:
String
=
""
when
(
carrierType
)
{
Constant
.
CARRIER_VERSUS_VIDEO
->
postId
=
WnManager
.
WN_AD_VEDIO_MAIN_POSTID
Constant
.
CARRIER_HOMEWATER
->
postId
=
WnManager
.
WN_AD_VEDIO_DRINK_POSTID
Constant
.
CARRIER_CHALLENGE_TURN
,
Constant
.
CARRIER_DRAWCASH
->
postId
=
WnManager
.
WN_AD_VEDIO_TURNABLE_POSTID
Constant
.
CARRIER_CHALLENGE_CARD
->
postId
=
WnManager
.
WN_AD_VEDIO_ERASE_POSTID
else
->
postId
=
WnManager
.
WN_AD_VEDIO_MOREDIALOG_POSTID
val
postId
:
String
=
when
(
carrierType
)
{
Constant
.
CARRIER_VERSUS_VIDEO
->
WnManager
.
WN_AD_VEDIO_MAIN_POSTID
Constant
.
CARRIER_HOMEWATER
->
WnManager
.
WN_AD_VEDIO_DRINK_POSTID
Constant
.
CARRIER_CHALLENGE_TURN
,
Constant
.
CARRIER_DRAWCASH
->
WnManager
.
WN_AD_VEDIO_TURNABLE_POSTID
Constant
.
CARRIER_CHALLENGE_CARD
->
WnManager
.
WN_AD_VEDIO_ERASE_POSTID
else
->
WnManager
.
WN_AD_VEDIO_MOREDIALOG_POSTID
}
val
slot
=
WNAdSlot
.
Builder
()
.
setSlotId
(
postId
)
...
...
@@ -116,11 +117,9 @@ class WnVedioAdManager private constructor(activity: Activity) :
showToast
(
"开始下载"
)
}
override
fun
onDownloadFinished
(
totalBytes
:
Long
,
fileName
:
String
,
appName
:
String
)
{
}
override
fun
onDownloadFinished
(
totalBytes
:
Long
,
fileName
:
String
,
appName
:
String
)
{}
override
fun
onDownloadFailed
(
fileName
:
String
,
appName
:
String
)
{
}
override
fun
onDownloadFailed
(
fileName
:
String
,
appName
:
String
)
{}
}
}
mRewardVideoAd
=
ad
...
...
GoodMoney/app/src/main/java/com/mints/goodmoney/ad/vedio/YlhVedioAdManager.java
View file @
192d16bd
...
...
@@ -121,6 +121,7 @@ public class YlhVedioAdManager extends BaseVedioAd implements VedioAdManagerView
rewardVideoAD
=
null
;
}
rewardVideoAD
=
new
RewardVideoAD
(
activity
,
YlhAdManager
.
YLH_AD_APPID
,
ylhPostId
,
new
RewardVideoADListener
()
{
@Override
public
void
onADLoad
()
{
//广告加载成功,可在此回调后进行广告展示,此时广告过期时间确定,可通过RewardVideoAD.getExpireTimestamp()获取
...
...
GoodMoney/app/src/main/java/com/mints/goodmoney/common/AppConfig.java
View file @
192d16bd
...
...
@@ -71,4 +71,9 @@ public class AppConfig {
*/
public
static
int
flVedioAdCount
=
5
;
/**
* 高额试玩任务标识
*/
public
static
boolean
isHighTask
=
false
;
}
GoodMoney/app/src/main/java/com/mints/goodmoney/common/Constant.kt
View file @
192d16bd
...
...
@@ -127,7 +127,7 @@ object Constant {
const
val
CARRIER_BLESSINGBAG_DOUBLE
=
"BLESSINGBAG_DOUBLE"
//首页福袋翻倍
const
val
CARRIER_XMLY_CHALLENGE
=
"XMLY_CHALLENGE"
//喜马拉雅听书
const
val
CARRIER_KUYINYUE_VEDIO
=
"KUYINYUE_VEDIO"
//酷音乐视频
const
val
CARRIER_HIGH_ACTIVITY
=
"HIGH_ACTIVITY"
//高额任务
const
val
CHALLENGE_SHAREFRIEND
=
"CHALLENGE_SHAREFRIEND"
//邀请好友
...
...
@@ -216,4 +216,7 @@ object Constant {
// 分页 条数
const
val
PAGE_SIZE
=
15
// 是否是高额任务
const
val
IS_HIGH_TASK
=
"is_high_task"
}
GoodMoney/app/src/main/java/com/mints/goodmoney/manager/AppTryPlayManager.kt
0 → 100644
View file @
192d16bd
package
com.mints.goodmoney.manager
import
com.mints.goodmoney.MintsApplication
import
com.mints.goodmoney.common.Constant
import
com.mints.goodmoney.mvp.model.EventMessage
import
com.mints.goodmoney.utils.RxBus
import
com.mints.goodmoney.utils.AppUtil
/**
* APP试玩管理类
*/
object
AppTryPlayManager
{
// 第一次打开时间
private
var
openTime
=
0L
private
var
currentPkg
=
""
fun
toTryPlay
(
pkg
:
String
)
{
if
(
currentPkg
!=
pkg
)
{
openTime
=
AppUtil
.
getAppUseTime
(
MintsApplication
.
getContext
(),
pkg
)
AppUtil
.
openThirdApp
(
MintsApplication
.
getContext
(),
pkg
)
val
eventMessage
=
EventMessage
(
Constant
.
IS_HIGH_TASK
,
pkg
)
RxBus
.
getDefault
().
postSticky
(
eventMessage
)
currentPkg
=
pkg
}
}
fun
getTryPlayIsOK
(
pkg
:
String
):
Boolean
{
val
currentUseTime
=
AppUtil
.
getAppUseTime
(
MintsApplication
.
getContext
(),
pkg
)
openTime
=
0L
currentPkg
=
""
return
currentUseTime
-
openTime
>=
20
}
}
\ No newline at end of file
GoodMoney/app/src/main/java/com/mints/goodmoney/mvp/model/EventMessage.java
View file @
192d16bd
...
...
@@ -9,6 +9,11 @@ public class EventMessage<T> {
this
.
message
=
message
;
}
public
EventMessage
(
String
message
,
T
content
)
{
this
.
message
=
message
;
this
.
content
=
content
;
}
public
String
getMessage
()
{
return
message
;
}
...
...
GoodMoney/app/src/main/java/com/mints/goodmoney/mvp/presenters/BookPresenter.kt
View file @
192d16bd
...
...
@@ -56,8 +56,8 @@ class BookPresenter : BasePresenter<BookView>() {
when
(
code
)
{
200
->
{
if
(
data
!=
null
)
{
val
msg
=
data
.
getAsJsonObject
(
"msg"
)
view
.
readInfo
(
msg
[
"needSecods"
].
asInt
,
msg
[
"coin"
].
asInt
,
msg
[
"completeSeconds"
].
asInt
)
val
msg
=
data
.
getAsJsonObject
(
"msg"
)
view
.
readInfo
(
msg
[
"needSecods"
].
asInt
,
msg
[
"coin"
].
asInt
,
msg
[
"completeSeconds"
].
asInt
)
}
}
else
->
view
.
showToast
(
baseResponse
.
getMessage
())
...
...
GoodMoney/app/src/main/java/com/mints/goodmoney/mvp/presenters/DrawcashPresenter.java
View file @
192d16bd
package
com
.
mints
.
goodmoney
.
mvp
.
presenters
;
import
android.text.TextUtils
;
import
android.view.animation.AccelerateDecelerateInterpolator
;
import
com.daimajia.androidanimations.library.Techniques
;
import
com.daimajia.androidanimations.library.YoYo
;
import
com.google.gson.JsonObject
;
import
com.mints.goodmoney.MintsApplication
;
import
com.mints.goodmoney.common.Constant
;
...
...
@@ -277,6 +274,43 @@ public class DrawcashPresenter extends BasePresenter<DrawcashView> {
});
}
/**
* 获取京东跳转链接
*/
public
void
getCommonJdUrl
()
{
view
.
showLoading
(
"加载中..."
);
AppHttpManager
.
getInstance
(
loanApplication
)
.
call
(
loanService
.
getCommonJdUrl
(),
new
BaseSubscriber
<
BaseResponse
<
JsonObject
>>()
{
@Override
public
void
onCompleted
()
{
if
(
isLinkView
())
return
;
view
.
hideLoading
();
}
@Override
public
void
onError
(
Throwable
e
)
{
if
(
isLinkView
())
return
;
view
.
hideLoading
();
view
.
showToast
(
e
.
getMessage
());
}
@Override
public
void
onNext
(
BaseResponse
<
JsonObject
>
baseResponse
)
{
if
(
isLinkView
())
return
;
int
code
=
baseResponse
.
getStatus
();
view
.
showToast
(
baseResponse
.
getMessage
());
switch
(
code
)
{
case
200
:
//成功
view
.
getCommonJdUrlSuc
(
baseResponse
.
getData
().
get
(
"JDUrl"
).
getAsString
());
break
;
}
}
});
}
/**
* 风控信息
*/
...
...
GoodMoney/app/src/main/java/com/mints/goodmoney/mvp/presenters/KuYinYuePagePresenter.kt
View file @
192d16bd
package
com.mints.goodmoney.mvp.presenters
import
com.google.gson.JsonObject
import
com.mints.goodmoney.common.Constant
import
com.mints.goodmoney.manager.AppHttpManager
import
com.mints.goodmoney.mvp.model.BaseResponse
import
com.mints.goodmoney.mvp.model.KylVedioBean
import
com.mints.goodmoney.mvp.views.BookView
import
com.mints.goodmoney.mvp.views.KuYinYuePageView
import
com.mints.goodmoney.utils.LogUtil
import
com.mints.library.net.neterror.BaseSubscriber
import
com.mints.library.net.neterror.Throwable
import
com.mints.library.utils.json.JsonUtil
import
java.util.*
class
KuYinYuePagePresenter
:
BasePresenter
<
KuYinYuePageView
>()
{
...
...
GoodMoney/app/src/main/java/com/mints/goodmoney/mvp/presenters/MyPresenter.kt
View file @
192d16bd
...
...
@@ -14,7 +14,7 @@ import com.mints.library.net.neterror.BaseSubscriber
import
com.mints.library.net.neterror.Throwable
import
java.util.*
class
MyPresenter
:
BasePresenter
<
MyView
>()
{
open
class
MyPresenter
:
BasePresenter
<
MyView
>()
{
/**
* 获取签到内容
...
...
@@ -36,10 +36,8 @@ class MyPresenter : BasePresenter<MyView>() {
override
fun
onNext
(
baseResponse
:
BaseResponse
<
SignCardBean
>)
{
if
(
isLinkView
)
return
val
code
=
baseResponse
.
status
val
message
=
baseResponse
.
message
when
(
code
)
{
when
(
baseResponse
.
status
)
{
200
->
view
.
getSignInHomePageMsgSuc
(
baseResponse
.
data
)
}
}
...
...
@@ -67,8 +65,7 @@ class MyPresenter : BasePresenter<MyView>() {
override
fun
onNext
(
baseResponse
:
BaseResponse
<
Any
>)
{
if
(
isLinkView
)
return
val
code
=
baseResponse
.
status
when
(
code
)
{
when
(
baseResponse
.
status
)
{
200
->
view
.
signInHomePageSuc
()
}
}
...
...
@@ -246,10 +243,35 @@ class MyPresenter : BasePresenter<MyView>() {
})
}
/**
* 设置高额任务状态
*
*/
fun
setHighTaskType
(
value
:
String
)
{
val
vo
=
HashMap
<
String
,
Any
>()
vo
[
"carrierType"
]
=
Constant
.
CARRIER_HIGH_ACTIVITY
vo
[
"value"
]
=
value
AppHttpManager
.
getInstance
(
loanApplication
)
.
call
(
loanService
.
setStatusInOneDayByCarrierType
(
vo
),
object
:
BaseSubscriber
<
BaseResponse
<
Any
>>()
{
override
fun
onCompleted
()
{
if
(
isLinkView
)
return
}
override
fun
onError
(
e
:
Throwable
)
{
if
(
isLinkView
)
return
}
override
fun
onNext
(
baseResponse
:
BaseResponse
<
Any
>)
{
if
(
isLinkView
)
return
when
(
baseResponse
.
status
)
{
}
}
})
}
fun
getHallBaseMsg
()
{
AppHttpManager
.
getInstance
(
loanApplication
)
.
call
(
loanService
.
getHallBaseMsg
()
,
.
call
(
loanService
.
hallBaseMsg
,
object
:
BaseSubscriber
<
BaseResponse
<
UserTaskMsgBean
>>()
{
override
fun
onCompleted
()
{
if
(
isLinkView
)
return
...
...
GoodMoney/app/src/main/java/com/mints/goodmoney/mvp/views/DrawcashView.java
View file @
192d16bd
...
...
@@ -19,4 +19,6 @@ public interface DrawcashView extends BaseView {
void
checkJDNewUsersSuc
(
boolean
isJdNewUser
,
String
JDUrl
);
void
checkJDNewUsersFail
();
void
getCommonJdUrlSuc
(
String
jdUrl
);
}
GoodMoney/app/src/main/java/com/mints/goodmoney/net/LoanService.java
View file @
192d16bd
...
...
@@ -10,7 +10,6 @@ import com.mints.goodmoney.mvp.model.BaseResponse;
import
com.mints.goodmoney.mvp.model.DrawcashBean
;
import
com.mints.goodmoney.mvp.model.DrawcashRecordBean
;
import
com.mints.goodmoney.mvp.model.FriendHallMsgBean
;
import
com.mints.goodmoney.mvp.model.FriendsTaskBean
;
import
com.mints.goodmoney.mvp.model.GoldRecordBean
;
import
com.mints.goodmoney.mvp.model.KylTabBean
;
import
com.mints.goodmoney.mvp.model.KylVedioBean
;
...
...
@@ -503,6 +502,14 @@ public interface LoanService {
@POST
(
"api/getXfPageMsg"
)
Observable
<
BaseResponse
<
KylVedioBean
>>
getXfPageMsg
(
@Body
Map
<
String
,
Object
>
vo
);
/**
* 获取京东跳转链接
*
* @return
*/
@POST
(
"api/getCommonJdUrl"
)
Observable
<
BaseResponse
<
JsonObject
>>
getCommonJdUrl
();
/**
* 默认http工厂
*/
...
...
GoodMoney/app/src/main/java/com/mints/goodmoney/service/
My
Service.java
→
GoodMoney/app/src/main/java/com/mints/goodmoney/service/
AppInstall
Service.java
View file @
192d16bd
...
...
@@ -5,27 +5,33 @@ import android.content.BroadcastReceiver;
import
android.content.Context
;
import
android.content.Intent
;
import
android.content.IntentFilter
;
import
android.os.Build
;
import
android.os.IBinder
;
import
android.util.Log
;
import
android.widget.Toast
;
import
com.mints.goodmoney.utils.ToastUtil
;
public
class
MyService
extends
Service
{
public
class
AppInstallService
extends
Service
{
BroadcastReceiver
broadcastReceiver
=
new
BroadcastReceiver
()
{
public
void
onReceive
(
Context
param1Context
,
Intent
param1Intent
)
{
if
(
param1Intent
==
null
)
return
;
ToastUtil
.
show
(
param1Context
.
getApplicationContext
(),
param1Intent
.
getData
().
toString
());
String
str
=
param1Intent
.
getData
().
toString
();
if
(
str
.
length
()
<=
8
)
return
;
str
=
str
.
substring
(
8
);
if
(!
str
.
equals
(
AppInstallService
.
this
.
getPackageName
()))
{
try
{
Intent
intent
=
new
Intent
();
intent
.
setAction
(
"com.mints.goodmoney.updateInstallPkg"
);
intent
.
putExtra
(
"pkg"
,
str
);
AppInstallService
.
this
.
sendBroadcast
(
intent
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
}
};
private
void
initReceiver
()
{
IntentFilter
intentFilter
=
new
IntentFilter
();
intentFilter
.
addAction
(
"android.intent.action.PACKAGE_ADDED"
);
// intentFilter.addAction("android.intent.action.PACKAGE_REPLACED");
// intentFilter.addAction("android.intent.action.PACKAGE_REMOVED");
intentFilter
.
addDataScheme
(
"package"
);
registerReceiver
(
this
.
broadcastReceiver
,
intentFilter
);
}
...
...
@@ -45,7 +51,6 @@ public class MyService extends Service {
}
public
int
onStartCommand
(
Intent
paramIntent
,
int
paramInt1
,
int
paramInt2
)
{
Log
.
e
(
"aaa"
,
"22222222222"
);
return
super
.
onStartCommand
(
paramIntent
,
paramInt1
,
paramInt2
);
}
}
GoodMoney/app/src/main/java/com/mints/goodmoney/ui/activitys/AboutusActivity.kt
View file @
192d16bd
package
com.mints.goodmoney.ui.activitys
import
android.annotation.SuppressLint
import
android.os.Bundle
import
android.text.TextUtils
import
android.view.View
import
android.view.View.OnLongClickListener
import
com.bytedance.hume.readapk.HumeSDK
import
com.mints.goodmoney.MintsApplication
import
com.mints.goodmoney.R
...
...
@@ -21,6 +20,7 @@ import kotlinx.android.synthetic.main.header_layout.*
* 作者:孟崔广
* 时间:2020/9/23 18:39
*/
@SuppressLint
(
"SetTextI18n"
)
class
AboutusActivity
:
BaseActivity
(),
View
.
OnClickListener
{
override
fun
getContentViewLayoutID
()
=
R
.
layout
.
activity_aboutus
...
...
@@ -33,13 +33,13 @@ class AboutusActivity : BaseActivity(), View.OnClickListener {
iv_left_icon
.
visibility
=
View
.
VISIBLE
iv_left_icon
.
setImageResource
(
R
.
mipmap
.
ic_arrow_back
)
ivAboutasIcon
.
setOnLongClickListener
(
OnLongClickListener
{
ivAboutasIcon
.
setOnLongClickListener
{
ToastUtil
.
showLong
(
MintsApplication
.
getContext
(),
"自有渠道:"
+
CommonUtils
.
getAppMetaData
(
MintsApplication
.
getContext
(),
"CHANNEL_NAME"
)
+
"\n\n 广告代码位:"
+
AppConfig
.
user_channel_ad
+
"\n\n 头条渠道:"
+
HumeSDK
.
getChannel
(
context
)
+
"\n\n 头条version:"
+
HumeSDK
.
getVersion
())
true
}
)
}
initListener
()
}
...
...
GoodMoney/app/src/main/java/com/mints/goodmoney/ui/activitys/AccountMergeActivity.kt
View file @
192d16bd
package
com.mints.goodmoney.ui.activitys
import
android.annotation.SuppressLint
import
android.os.Bundle
import
android.view.View
import
androidx.core.content.ContextCompat
import
com.mints.goodmoney.R
import
com.mints.goodmoney.common.Constant
import
com.mints.goodmoney.manager.RsNewsManager
...
...
@@ -22,6 +24,7 @@ import kotlinx.android.synthetic.main.header_layout.*
* 作者:孟崔广
* 时间:2020/9/23 18:39
*/
@SuppressLint
(
"SetTextI18n"
)
class
AccountMergeActivity
:
BaseActivity
(),
View
.
OnClickListener
,
AccountMergeView
{
private
lateinit
var
mobile
:
String
...
...
@@ -93,7 +96,7 @@ class AccountMergeActivity : BaseActivity(), View.OnClickListener, AccountMergeV
private
fun
hintDialog
(
toDoKey
:
String
,
str
:
String
,
type
:
Int
)
{
val
content
=
SpanUtils
()
.
append
(
"保留后微信会跟手机号绑定\r\n仅保留"
)
.
append
(
str
+
"账号"
).
setForegroundColor
(
resources
.
getColor
(
R
.
color
.
color_FF2326
))
.
append
(
str
+
"账号"
).
setForegroundColor
(
ContextCompat
.
getColor
(
mContext
,
R
.
color
.
color_FF2326
))
.
append
(
"下的数据\r\n"
)
.
append
(
"另一个账号的数据将会被删除"
)
.
create
()
...
...
GoodMoney/app/src/main/java/com/mints/goodmoney/ui/activitys/AwardActivity.kt
View file @
192d16bd
...
...
@@ -257,6 +257,15 @@ class AwardActivity : BaseActivity(), AwardView, View.OnClickListener {
}
tvAwardNext
.
setText
(
"我知道了"
)
}
Constant
.
CARRIER_HIGH_ACTIVITY
->
{
if
(
curCoin
>
0
)
{
tvAwardContent
.
setText
(
"试玩奖励${curCoin}金币"
)
}
tvAwardNext
.
setText
(
"领取金币"
)
val
vo
=
HashMap
<
String
,
Any
>()
vo
[
"carrierType"
]
=
carrierType
awardPresenter
.
reportAddCoinMsg
(
vo
)
}
Constant
.
CARRIER_SIGNIN_HOMEPAGE_CARD
->
{
tvAwardContent
.
text
=
"奖励金币已发放"
tvAwardNext
.
visibility
=
View
.
GONE
...
...
@@ -326,7 +335,6 @@ class AwardActivity : BaseActivity(), AwardView, View.OnClickListener {
mTimer
=
null
try
{
// TTPreLoadExpressManager.getInstance().loadTtFrameLayout()
PreLoadExpressManager
.
loadADFrameLayout
()
}
catch
(
e
:
java
.
lang
.
Exception
)
{
e
.
printStackTrace
()
...
...
@@ -359,12 +367,11 @@ class AwardActivity : BaseActivity(), AwardView, View.OnClickListener {
Constant
.
CARRIER_OFFLINE_DOUBLE
,
Constant
.
CARRIER_SIGNIN_HOMEPAGE_CARD
,
Constant
.
CARRIER_CHALLENGE_TURN
,
Constant
.
CARRIER_CHALLENGE_CARD
,
Constant
.
CARRIER_WALK_BUBBLE
,
Constant
.
CARRIER_EATMEAL_SUBSIDY
,
Constant
.
CARRIER_WALK
,
Constant
.
CARRIER_HOMEWATER
,
Constant
.
CARRIER_RUISHINEWS_DOUBLE
->
{
Constant
.
CARRIER_WALK
,
Constant
.
CARRIER_HOMEWATER
->
{
awardVedio
()
}
Constant
.
CARRIER_BLESSINGBAG_DOUBLE
,
Constant
.
CARRIER_CHALLENGE_SHAREFRIEND_DOUBLE
,
Constant
.
CARRIER_HOMEVEDIO_DOUBLE
,
Constant
.
CARRIER_SMALLHOMEVEDIO_DOUBLE
->
{
Constant
.
CARRIER_HOMEVEDIO_DOUBLE
,
Constant
.
CARRIER_SMALLHOMEVEDIO_DOUBLE
,
Constant
.
CARRIER_RUISHINEWS_DOUBLE
->
{
pushUmengEvent
()
awardVedio
()
}
...
...
GoodMoney/app/src/main/java/com/mints/goodmoney/ui/activitys/BindMobileActivity.kt
View file @
192d16bd
...
...
@@ -21,8 +21,7 @@ import kotlinx.android.synthetic.main.header_layout.*
* 作者:孟崔广
* 时间:2020/9/22 13:55
*/
class
BindMobileActivity
:
BaseActivity
()
,
LoginView
,
View
.
OnClickListener
{
class
BindMobileActivity
:
BaseActivity
(),
LoginView
,
View
.
OnClickListener
{
private
val
loginPresenter
by
lazy
{
LoginPresenter
()
}
private
var
mobile
:
String
?
=
null
...
...
GoodMoney/app/src/main/java/com/mints/goodmoney/ui/activitys/DrawcashActivity.kt
View file @
192d16bd
...
...
@@ -56,7 +56,7 @@ class DrawcashActivity : BaseActivity(),
private
var
userConfig
:
DrawcashBean
?
=
null
private
var
isLoadRvItem
:
Boolean
=
true
//是否首次加载rv item
// private var isJDNewUser = false
// private var isJDNewUser = false
// private var jumpJdUrl: String? = null
private
var
jdTintDialog
:
JDTintDialog
?
=
null
...
...
@@ -355,36 +355,51 @@ class DrawcashActivity : BaseActivity(),
showToast
(
"手机号已注册京东金融"
)
}
override
fun
getCommonJdUrlSuc
(
JDUrl
:
String
?)
{
JDUrl
?.
let
{
val
bundle
=
Bundle
()
bundle
.
putString
(
WebActivity
.
WEB_TITLE
,
"京东金融"
)
bundle
.
putString
(
WebActivity
.
WEB_URL
,
it
)
readyGo
(
WebActivity
::
class
.
java
,
bundle
)
return
}
}
override
fun
onCheckedChanged
(
buttonView
:
CompoundButton
,
isChecked
:
Boolean
)
{
if
(
buttonView
.
isChecked
)
{
tvDrawWechat
.
isChecked
=
false
jdTintDialog
=
JDTintDialog
(
this
,
object
:
DialogListener
()
{
override
fun
onClick
(
v
:
View
?)
{
when
(
v
?.
id
)
{
R
.
id
.
ivClose
->
{
jdTintDialog
?.
dismiss
()
tvDrawJd
.
isChecked
=
false
tvDrawWechat
.
isChecked
=
true
}
R
.
id
.
btnBindMobile
->
{
if
(
jdTintDialog
?.
getMobileNum
()
!!
.
length
<
11
)
{
showToast
(
"请输入手机号"
)
return
}
val
mobileNum
=
jdTintDialog
?.
getMobileNum
()
!!
.
replace
(
" "
.
toRegex
(),
""
)
jdTintDialog
?.
dismiss
()
tvDrawJd
.
isChecked
=
false
tvDrawWechat
.
isChecked
=
true
drawcashPresenter
.
checkJDNewUsers
(
mobileNum
)
}
}
tvDrawJd
.
isChecked
=
false
tvDrawWechat
.
isChecked
=
true
}
drawcashPresenter
.
getCommonJdUrl
()
})
jdTintDialog
?.
show
()
// tvDrawWechat.isChecked = false
// jdTintDialog = JDTintDialog(this, object : DialogListener() {
// override fun onClick(v: View?) {
// when (v?.id) {
// R.id.ivClose -> {
// jdTintDialog?.dismiss()
// tvDrawJd.isChecked = false
// tvDrawWechat.isChecked = true
// }
// R.id.btnBindMobile -> {
// if (jdTintDialog?.getMobileNum()!!.length < 11) {
// showToast("请输入手机号")
// return
// }
// val mobileNum = jdTintDialog?.getMobileNum()!!.replace(" ".toRegex(), "")
// jdTintDialog?.dismiss()
// tvDrawJd.isChecked = false
// tvDrawWechat.isChecked = true
//
// drawcashPresenter.checkJDNewUsers(mobileNum)
// }
// }
//
// }
//
// })
// jdTintDialog?.show()
}
}
}
\ No newline at end of file
GoodMoney/app/src/main/java/com/mints/goodmoney/ui/activitys/MainActivity.kt
View file @
192d16bd
package
com.mints.goodmoney.ui.activitys
import
android.content.Context
import
android.content.Intent
import
android.media.AudioManager
import
android.os.Bundle
import
android.view.KeyEvent
...
...
@@ -10,7 +9,6 @@ import androidx.fragment.app.Fragment
import
androidx.fragment.app.FragmentManager
import
androidx.fragment.app.FragmentTransaction
import
com.ireader.ireadersdk.IreaderApi
import
com.mints.goodmoney.InitAppService
import
com.mints.goodmoney.R
import
com.mints.goodmoney.ad.vedio.VedioAdingManager
import
com.mints.goodmoney.common.AppConfig
...
...
@@ -18,7 +16,6 @@ import com.mints.goodmoney.common.Constant
import
com.mints.goodmoney.ad.express.TTPreLoadCarrierExpressManager
import
com.mints.goodmoney.manager.ZhangyueManager
import
com.mints.goodmoney.mvp.views.MainView
import
com.mints.goodmoney.service.MyService
import
com.mints.goodmoney.ui.activitys.base.BaseActivity
import
com.mints.goodmoney.ui.fragment.*
import
kotlinx.android.synthetic.main.activity_main.*
...
...
@@ -65,8 +62,6 @@ class MainActivity : BaseActivity(), MainView, View.OnClickListener {
tab_rl_channel
.
setOnClickListener
(
this
)
tab_rl_friends
.
setOnClickListener
(
this
)
tab_rl_my
.
setOnClickListener
(
this
)
startService
(
Intent
(
context
,
MyService
::
class
.
java
))
}
override
fun
isApplyKitKatTranslucency
()
=
false
...
...
GoodMoney/app/src/main/java/com/mints/goodmoney/ui/activitys/SettingsActivity.kt
View file @
192d16bd
...
...
@@ -10,13 +10,10 @@ import android.widget.TextView
import
androidx.appcompat.app.AlertDialog
import
cn.sharesdk.framework.ShareSDK
import
cn.sharesdk.wechat.friends.Wechat
import
com.fly.scenemodule.SceneUtil
import
com.mints.goodmoney.MintsApplication
import
com.mints.goodmoney.R
import
com.mints.goodmoney.common.Constant
import
com.mints.goodmoney.login.LoginApi
import
com.mints.goodmoney.login.OnLoginListener
import
com.mints.goodmoney.manager.SceneManager
import
com.mints.goodmoney.manager.UserManager
import
com.mints.goodmoney.mvp.model.DrawcashBean
import
com.mints.goodmoney.mvp.model.WXInfo
...
...
@@ -26,6 +23,7 @@ import com.mints.goodmoney.ui.activitys.base.BaseActivity
import
com.mints.goodmoney.ui.widgets.CustomDialogAsApple
import
com.mints.goodmoney.ui.widgets.DialogListener
import
com.mints.goodmoney.utils.CacheUtil
import
com.mints.goodmoney.utils.AppUtil
import
com.mints.library.utils.json.JsonUtil
import
kotlinx.android.synthetic.main.activity_settings.*
import
kotlinx.android.synthetic.main.header_layout.*
...
...
@@ -47,6 +45,8 @@ class SettingsActivity : BaseActivity(), View.OnClickListener, OnLoginListener,
override
fun
onResume
()
{
super
.
onResume
()
AppUtil
.
getAppUseTime
(
this
@SettingsActivity
,
"com.dangdang.reader"
)
if
(
userManager
.
mobile
.
isNotEmpty
())
{
item_phone
.
findViewById
<
TextView
>(
R
.
id
.
tv_right
).
text
=
userManager
.
mobile
...
...
GoodMoney/app/src/main/java/com/mints/goodmoney/ui/adapter/MainMyAdapter.kt
View file @
192d16bd
...
...
@@ -16,6 +16,9 @@ import com.mints.goodmoney.ui.adapter.listener.OnItemClickListener
class
MainMyAdapter
(
context
:
Context
,
taskData
:
MutableList
<
MyInfo
.
AutoListBean
>)
:
RecyclerView
.
Adapter
<
RecyclerView
.
ViewHolder
>()
{
companion
object
{
// 跳转首页
const
val
APP_HiGH_ACTIVITY
=
"APP_HiGH_ACTIVITY"
// 跳转首页
const
val
TO_HOME
=
"TO_HOME"
...
...
GoodMoney/app/src/main/java/com/mints/goodmoney/ui/fragment/MainFragment.kt
View file @
192d16bd
...
...
@@ -90,7 +90,6 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener {
vedioAdingManager
=
VedioAdingManager
.
getInstance
(
activity
)
// 奖励页预加载 信息流广告
// TTPreLoadExpressManager.getInstance().loadTtFrameLayout()
PreLoadExpressManager
.
loadADFrameLayout
()
// 刷新喜马拉雅信息流
...
...
GoodMoney/app/src/main/java/com/mints/goodmoney/ui/fragment/MyFragment.kt
View file @
192d16bd
This diff is collapsed.
Click to expand it.
GoodMoney/app/src/main/java/com/mints/goodmoney/utils/AppUtil.kt
0 → 100644
View file @
192d16bd
package
com.mints.goodmoney.utils
import
android.app.Service
import
android.app.usage.UsageStatsManager
import
android.content.Context
import
android.content.Intent
import
android.content.pm.PackageInfo
import
android.content.pm.PackageManager
import
android.os.Build
import
android.provider.Settings
import
com.mints.goodmoney.MintsApplication
/**
* 描述:应用使用记录权限管理
* 时间:2020/11/4 11:10
*/
object
AppUtil
{
/**
* 是否有应用使用情况权限
* @return flag
*/
fun
isHasUsageStats
():
Boolean
{
val
packageManager
:
PackageManager
=
MintsApplication
.
getContext
().
packageManager
val
intent
=
Intent
(
Settings
.
ACTION_USAGE_ACCESS_SETTINGS
)
val
list
=
packageManager
.
queryIntentActivities
(
intent
,
PackageManager
.
MATCH_DEFAULT_ONLY
)
return
list
.
size
>
0
}
/**
* 是否开启应用使用情况权限
* @return flag
*/
fun
isOpenUsageStats
():
Boolean
{
if
(
Build
.
VERSION
.
SDK_INT
>
Build
.
VERSION_CODES
.
LOLLIPOP
)
{
val
ts
=
System
.
currentTimeMillis
()
val
usageStatsManager
=
MintsApplication
.
getContext
().
getSystemService
(
Service
.
USAGE_STATS_SERVICE
)
as
UsageStatsManager
val
queryUsageStats
=
usageStatsManager
.
queryUsageStats
(
UsageStatsManager
.
INTERVAL_BEST
,
0
,
ts
)
if
(
queryUsageStats
==
null
||
queryUsageStats
.
isEmpty
())
{
return
false
}
return
true
}
return
false
}
fun
openUsageStats
(
ctx
:
Context
)
{
val
intent
=
Intent
(
Settings
.
ACTION_USAGE_ACCESS_SETTINGS
)
ctx
.
startActivity
(
intent
)
}
fun
getAppUseTime
(
ctx
:
Context
,
pkg
:
String
):
Long
{
var
time
=
0L
try
{
time
=
getLollipopFGAppUseTime
(
ctx
,
pkg
)
}
catch
(
e
:
Exception
)
{
e
.
printStackTrace
()
}
return
time
}
private
fun
getLollipopFGAppUseTime
(
ctx
:
Context
,
pkg
:
String
):
Long
{
try
{
val
usageStatsManager
=
ctx
.
getSystemService
(
"usagestats"
)
as
UsageStatsManager
val
time
=
System
.
currentTimeMillis
()
// 过去5分钟内app使用情况
val
queryUsageStats
=
usageStatsManager
.
queryUsageStats
(
UsageStatsManager
.
INTERVAL_DAILY
,
time
-
5
*
60
*
1000
,
time
)
var
totalTime
=
0L
if
(
queryUsageStats
.
size
>
0
)
{
for
(
usageStat
in
queryUsageStats
)
{
if
(
usageStat
.
packageName
==
pkg
)
{
totalTime
=
usageStat
.
totalTimeInForeground
}
}
}
return
totalTime
}
catch
(
e
:
Exception
)
{
e
.
printStackTrace
()
}
return
0L
}
fun
openThirdApp
(
ctx
:
Context
,
pkg
:
String
)
{
val
intent
:
Intent
?
=
ctx
.
packageManager
.
getLaunchIntentForPackage
(
pkg
)
if
(
intent
!=
null
)
{
// intent.putExtra("type", "-")
intent
.
flags
=
Intent
.
FLAG_ACTIVITY_NEW_TASK
ctx
.
startActivity
(
intent
)
}
}
/**
* 检查包是否存在
*
* @param pkg
* @return
*/
fun
checkPackInfo
(
ctx
:
Context
,
pkg
:
String
):
Boolean
{
var
packageInfo
:
PackageInfo
?
=
null
try
{
packageInfo
=
ctx
.
packageManager
.
getPackageInfo
(
pkg
,
0
)
}
catch
(
e
:
PackageManager
.
NameNotFoundException
)
{
e
.
printStackTrace
()
}
return
packageInfo
!=
null
}
}
\ No newline at end of file
GoodMoney/app/src/main/res/layout/activity_kyl_vedio.xml
View file @
192d16bd
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
xmlns:tools=
"http://schemas.android.com/tools"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:background=
"@color/black"
>
...
...
@@ -32,4 +31,5 @@
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintRight_toRightOf=
"parent"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
\ 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