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
4e5583cc
Commit
4e5583cc
authored
Jan 20, 2021
by
mengcuiguang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加珊瑚CPD广告数曝光,时间配置。大转盘页面修改。代码位修改
parent
7dabf76c
Changes
23
Hide whitespace changes
Inline
Side-by-side
Showing
23 changed files
with
753 additions
and
276 deletions
+753
-276
build.gradle
GoodMoney/app/build.gradle
+2
-2
CoralDownload.java
...n/java/com/mints/goodmoney/ad/download/CoralDownload.java
+6
-5
CsjVideoAdManager.java
.../java/com/mints/goodmoney/ad/video/CsjVideoAdManager.java
+1
-1
ShVideoAdManager.kt
...ain/java/com/mints/goodmoney/ad/video/ShVideoAdManager.kt
+1
-5
AppConfig.java
...p/src/main/java/com/mints/goodmoney/common/AppConfig.java
+5
-0
CpdManager.kt
...p/src/main/java/com/mints/goodmoney/manager/CpdManager.kt
+12
-0
TtCsjAdManager.java
...main/java/com/mints/goodmoney/manager/TtCsjAdManager.java
+16
-13
TzManager.kt
...pp/src/main/java/com/mints/goodmoney/manager/TzManager.kt
+1
-2
YlhAdManager.kt
...src/main/java/com/mints/goodmoney/manager/YlhAdManager.kt
+15
-13
PanActionInfo.java
...ain/java/com/mints/goodmoney/mvp/model/PanActionInfo.java
+37
-0
CommonGsonConverterFactory.java
...a/com/mints/goodmoney/net/CommonGsonConverterFactory.java
+109
-0
CpdService.java
...app/src/main/java/com/mints/goodmoney/net/CpdService.java
+83
-0
MainActivity.kt
...ain/java/com/mints/goodmoney/ui/activitys/MainActivity.kt
+16
-1
TaskActivity.kt
...ain/java/com/mints/goodmoney/ui/activitys/TaskActivity.kt
+140
-113
TaskAdapter.kt
...c/main/java/com/mints/goodmoney/ui/adapter/TaskAdapter.kt
+28
-27
MainFragment.kt
...main/java/com/mints/goodmoney/ui/fragment/MainFragment.kt
+7
-0
MoneyFragment.kt
...ain/java/com/mints/goodmoney/ui/fragment/MoneyFragment.kt
+82
-56
MyFragment.kt
...c/main/java/com/mints/goodmoney/ui/fragment/MyFragment.kt
+25
-2
PanFragment.kt
.../main/java/com/mints/goodmoney/ui/fragment/PanFragment.kt
+113
-3
TaskDialog.kt
...rc/main/java/com/mints/goodmoney/ui/widgets/TaskDialog.kt
+2
-2
fragment_main_my.xml
GoodMoney/app/src/main/res/layout/fragment_main_my.xml
+8
-1
item_task_recy.xml
GoodMoney/app/src/main/res/layout/item_task_recy.xml
+43
-30
view_title.xml
GoodMoney/app/src/main/res/layout/view_title.xml
+1
-0
No files found.
GoodMoney/app/build.gradle
View file @
4e5583cc
...
@@ -9,8 +9,8 @@ android {
...
@@ -9,8 +9,8 @@ android {
applicationId
"com.mints.goodmoney"
applicationId
"com.mints.goodmoney"
minSdkVersion
rootProject
.
ext
.
androidMinSdkVersion
minSdkVersion
rootProject
.
ext
.
androidMinSdkVersion
targetSdkVersion
rootProject
.
ext
.
androidTargetSdkVersion
targetSdkVersion
rootProject
.
ext
.
androidTargetSdkVersion
versionCode
1
3
versionCode
1
4
versionName
"1.1.
2
"
versionName
"1.1.
3
"
flavorDimensions
"default"
flavorDimensions
"default"
// dex突破65535的限制
// dex突破65535的限制
...
...
GoodMoney/app/src/main/java/com/mints/goodmoney/ad/download/CoralDownload.java
View file @
4e5583cc
...
@@ -33,11 +33,12 @@ public final class CoralDownload {
...
@@ -33,11 +33,12 @@ public final class CoralDownload {
public
void
pull
()
{
public
void
pull
()
{
int
type
;
int
type
;
if
(
BuildConfig
.
DEBUG
)
{
// if (BuildConfig.DEBUG) {
type
=
RELEASE_TASK_TYPE_DEBUG
;
// type = RELEASE_TASK_TYPE_DEBUG;
}
else
{
// } else {
type
=
RELEASE_TASK_TYPE_RELEASE
;
// type = RELEASE_TASK_TYPE_RELEASE;
}
// }
type
=
RELEASE_TASK_TYPE_RELEASE
;
new
ADLoader
(
MintsApplication
.
getContext
())
new
ADLoader
(
MintsApplication
.
getContext
())
.
get
(
ADType
.
APP_DOWNLOAD
)
.
get
(
ADType
.
APP_DOWNLOAD
)
...
...
GoodMoney/app/src/main/java/com/mints/goodmoney/ad/video/CsjVideoAdManager.java
View file @
4e5583cc
...
@@ -118,7 +118,7 @@ public class CsjVideoAdManager extends BaseVideoAd {
...
@@ -118,7 +118,7 @@ public class CsjVideoAdManager extends BaseVideoAd {
case
Constant
.
CARRIER_SMALLHOMEVEDIO_DOUBLE
:
// 短视频翻倍
case
Constant
.
CARRIER_SMALLHOMEVEDIO_DOUBLE
:
// 短视频翻倍
codeId
=
TtCsjAdManager
.
TT_AD_VEDIO_SMALLHOMEVEDIO
;
codeId
=
TtCsjAdManager
.
TT_AD_VEDIO_SMALLHOMEVEDIO
;
break
;
break
;
default
:
// 在线收益翻倍
default
:
codeId
=
TtCsjAdManager
.
TT_AD_VEDIO_MOREDIALOG
;
codeId
=
TtCsjAdManager
.
TT_AD_VEDIO_MOREDIALOG
;
break
;
break
;
}
}
...
...
GoodMoney/app/src/main/java/com/mints/goodmoney/ad/video/ShVideoAdManager.kt
View file @
4e5583cc
...
@@ -66,11 +66,7 @@ class ShVideoAdManager private constructor(activity: Activity) :
...
@@ -66,11 +66,7 @@ class ShVideoAdManager private constructor(activity: Activity) :
this
.
activity
=
activity
this
.
activity
=
activity
isClickScreen
=
true
isClickScreen
=
true
val
type
=
if
(
BuildConfig
.
DEBUG
)
{
val
type
=
TZ_REWRAD_TYPE_RELEASE
TZ_REWRAD_TYPE_DEBUG
}
else
{
TZ_REWRAD_TYPE_RELEASE
}
ADLoader
(
activity
)
ADLoader
(
activity
)
.
get
(
ADType
.
REWARD_VIDEO
)
.
get
(
ADType
.
REWARD_VIDEO
)
...
...
GoodMoney/app/src/main/java/com/mints/goodmoney/common/AppConfig.java
View file @
4e5583cc
...
@@ -53,6 +53,11 @@ public class AppConfig {
...
@@ -53,6 +53,11 @@ public class AppConfig {
*/
*/
public
static
boolean
xmlyAdFlag
=
false
;
public
static
boolean
xmlyAdFlag
=
false
;
/**
* 广告隐藏显示 true-走原有流程
*/
public
static
boolean
showAdFlag
=
true
;
/**
/**
* app应用首页 0-主页 1-大转盘 2-邀请好友 3-我
* app应用首页 0-主页 1-大转盘 2-邀请好友 3-我
*/
*/
...
...
GoodMoney/app/src/main/java/com/mints/goodmoney/manager/CpdManager.kt
0 → 100644
View file @
4e5583cc
package
com.mints.goodmoney.manager
/**
* Cpd下载
*/
object
CpdManager
{
const
val
BUSINESS_ID
=
"guest"
const
val
TOKEN
=
"00000000000000000000000000000000"
}
\ No newline at end of file
GoodMoney/app/src/main/java/com/mints/goodmoney/manager/TtCsjAdManager.java
View file @
4e5583cc
...
@@ -27,17 +27,19 @@ public class TtCsjAdManager {
...
@@ -27,17 +27,19 @@ public class TtCsjAdManager {
public
static
String
TT_AD_BANNER_JULEYUN
=
"945675532"
;
// 聚乐云
public
static
String
TT_AD_BANNER_JULEYUN
=
"945675532"
;
// 聚乐云
/*激励视频*/
/*激励视频*/
public
static
String
TT_AD_VEDIO_MAIN_DEV
=
"945561938"
;
// 开发使用
public
static
String
TT_AD_VEDIO_MAIN_DEV
=
"945561938"
;
// 开发使用
public
static
String
TT_AD_VEDIO_DRINK
=
"945562032"
;
//喝水打卡
public
static
String
TT_AD_VEDIO_MAIN
=
"945562036"
;
// 我的界面视频
public
static
String
TT_AD_VEDIO_DRINK
=
"945562040"
;
//喝水打卡
public
static
String
TT_AD_VEDIO_ERASE
=
"945562037"
;
// 刮刮乐
public
static
String
TT_AD_VEDIO_MAIN
=
"945562040"
;
// 我的界面视频
public
static
String
TT_AD_VEDIO_TURNABLE
=
"945562039"
;
// 大转盘
public
static
String
TT_AD_VEDIO_ERASE
=
"945562040"
;
// 刮刮乐
public
static
String
TT_AD_VEDIO_TURNABLE
=
"945562040"
;
// 大转盘
public
static
String
TT_AD_VEDIO_MOREDIALOG
=
"945562040"
;
// 气泡
public
static
String
TT_AD_VEDIO_MOREDIALOG
=
"945562040"
;
// 气泡
public
static
String
TT_AD_VEDIO_SIGN
=
"945
730109
"
;
// 签到
public
static
String
TT_AD_VEDIO_SIGN
=
"945
562040
"
;
// 签到
public
static
String
TT_AD_VEDIO_OFFINELINE
=
"945
730111
"
;
// 离线弹框
public
static
String
TT_AD_VEDIO_OFFINELINE
=
"945
562040
"
;
// 离线弹框
public
static
String
TT_AD_VEDIO_BLESSINGBAG
=
"945730117"
;
// 福袋
public
static
String
TT_AD_VEDIO_GAME
=
"945562067"
;
// 猎豹
public
static
String
TT_AD_VEDIO_GAME
=
"945562067"
;
// 猎豹
public
static
String
TT_AD_VEDIO_JULEYUN
=
"945675529"
;
// 聚乐云
public
static
String
TT_AD_VEDIO_JULEYUN
=
"945675529"
;
// 聚乐云
public
static
String
TT_AD_VEDIO_BIANXIANMAO
=
"945743459"
;
// 变现猫
public
static
String
TT_AD_VEDIO_BIANXIANMAO
=
"945743459"
;
// 变现猫
public
static
String
TT_AD_VEDIO_BLESSINGBAG
=
"945730117"
;
// 福袋
public
static
String
TT_AD_VEDIO_HOMEVEDIO
=
"945744137"
;
// 首页视频翻倍
public
static
String
TT_AD_VEDIO_HOMEVEDIO
=
"945744137"
;
// 首页视频翻倍
public
static
String
TT_AD_VEDIO_SMALLHOMEVEDIO
=
"945744186"
;
// 短视频翻倍
public
static
String
TT_AD_VEDIO_SMALLHOMEVEDIO
=
"945744186"
;
// 短视频翻倍
/*全屏视频*/
/*全屏视频*/
...
@@ -175,14 +177,15 @@ public class TtCsjAdManager {
...
@@ -175,14 +177,15 @@ public class TtCsjAdManager {
TT_AD_NATIVEEXPRESS_MORNINGCLOCK
=
"945627921"
;
TT_AD_NATIVEEXPRESS_MORNINGCLOCK
=
"945627921"
;
TT_AD_NATIVEEXPRESS_EAT
=
"945627922"
;
TT_AD_NATIVEEXPRESS_EAT
=
"945627922"
;
// 激励视频
// 激励视频
TT_AD_VEDIO_DRINK
=
"9455620
32
"
;
TT_AD_VEDIO_DRINK
=
"9455620
40
"
;
TT_AD_VEDIO_MAIN
=
"9455620
36
"
;
TT_AD_VEDIO_MAIN
=
"9455620
40
"
;
TT_AD_VEDIO_ERASE
=
"9455620
37
"
;
TT_AD_VEDIO_ERASE
=
"9455620
40
"
;
TT_AD_VEDIO_TURNABLE
=
"9455620
39
"
;
TT_AD_VEDIO_TURNABLE
=
"9455620
40
"
;
TT_AD_VEDIO_MOREDIALOG
=
"945562040"
;
TT_AD_VEDIO_MOREDIALOG
=
"945562040"
;
TT_AD_VEDIO_OFFINELINE
=
"945730111"
;
TT_AD_VEDIO_OFFINELINE
=
"945562040"
;
TT_AD_VEDIO_SIGN
=
"945562040"
;
TT_AD_VEDIO_BLESSINGBAG
=
"945730117"
;
TT_AD_VEDIO_BLESSINGBAG
=
"945730117"
;
TT_AD_VEDIO_SIGN
=
"945730109"
;
TT_AD_VEDIO_HOMEVEDIO
=
"945744137"
;
TT_AD_VEDIO_HOMEVEDIO
=
"945744137"
;
TT_AD_VEDIO_SMALLHOMEVEDIO
=
"945744186"
;
TT_AD_VEDIO_SMALLHOMEVEDIO
=
"945744186"
;
// banner
// banner
...
...
GoodMoney/app/src/main/java/com/mints/goodmoney/manager/TzManager.kt
View file @
4e5583cc
package
com.mints.goodmoney.manager
package
com.mints.goodmoney.manager
import
android.app.Application
import
android.app.Application
import
com.mints.goodmoney.BuildConfig
import
com.mints.goodmoney.MintsApplication
import
com.mints.goodmoney.MintsApplication
import
com.mints.library.utils.CommonUtils
import
com.mints.library.utils.CommonUtils
import
com.tz.sdk.core.engine.ADEngine
import
com.tz.sdk.core.engine.ADEngine
...
@@ -22,7 +21,7 @@ object TzManager {
...
@@ -22,7 +21,7 @@ object TzManager {
.
appKey
(
"547ffff6446c5a8acd4175fb7a71a0d1"
)
.
appKey
(
"547ffff6446c5a8acd4175fb7a71a0d1"
)
.
appSecret
(
"1c00e59f2257bdfdd4ad9363b41621b5"
)
.
appSecret
(
"1c00e59f2257bdfdd4ad9363b41621b5"
)
.
appChannel
(
CommonUtils
.
getAppMetaData
(
MintsApplication
.
getContext
(),
"CHANNEL_NAME"
))
.
appChannel
(
CommonUtils
.
getAppMetaData
(
MintsApplication
.
getContext
(),
"CHANNEL_NAME"
))
.
forTest
(
BuildConfig
.
DEBUG
)
.
forTest
(
false
)
.
build
(),
.
build
(),
object
:
IADEngineState
{
object
:
IADEngineState
{
override
fun
onIdle
()
{}
override
fun
onIdle
()
{}
...
...
GoodMoney/app/src/main/java/com/mints/goodmoney/manager/YlhAdManager.kt
View file @
4e5583cc
...
@@ -22,16 +22,17 @@ object YlhAdManager {
...
@@ -22,16 +22,17 @@ object YlhAdManager {
var
YLH_AD_SPLASH_POSTID
=
"7021944730189381"
var
YLH_AD_SPLASH_POSTID
=
"7021944730189381"
/* vedio-postid */
/* vedio-postid */
var
YLH_AD_VEDIO_DRINK_POSTID
=
"
2031043750380462
"
//喝水打卡
var
YLH_AD_VEDIO_DRINK_POSTID
=
"
9001346780383626
"
//喝水打卡
var
YLH_AD_VEDIO_MAIN_POSTID
=
"
8081940760988417
"
//我的界面视频
var
YLH_AD_VEDIO_MAIN_POSTID
=
"
9001346780383626
"
//我的界面视频
var
YLH_AD_VEDIO_ERASE_POSTID
=
"90
61142700180449
"
//挑战刮刮乐
var
YLH_AD_VEDIO_ERASE_POSTID
=
"90
01346780383626
"
//挑战刮刮乐
var
YLH_AD_VEDIO_TURNABLE_POSTID
=
"
7001353223571334
"
//大转盘
var
YLH_AD_VEDIO_TURNABLE_POSTID
=
"
9001346780383626
"
//大转盘
var
YLH_AD_VEDIO_MOREDIALOG_POSTID
=
"9001346780383626"
//气泡
var
YLH_AD_VEDIO_MOREDIALOG_POSTID
=
"9001346780383626"
//气泡
var
YLH_AD_VEDIO_SIGN_POSTID
=
"
2091354158635490
"
//签到
var
YLH_AD_VEDIO_SIGN_POSTID
=
"
9001346780383626
"
//签到
var
YLH_AD_VEDIO_OFFINELINE_POSTID
=
"
2031954198632389
"
//离线弹框
var
YLH_AD_VEDIO_OFFINELINE_POSTID
=
"
9001346780383626
"
//离线弹框
var
YLH_AD_VEDIO_BLESSINGBAG_POSTID
=
"1081758148138388"
//福袋
var
YLH_AD_VEDIO_GAME_POSTID
=
"9051646750686770"
//猎豹游戏
var
YLH_AD_VEDIO_GAME_POSTID
=
"9051646750686770"
//猎豹游戏
var
YLH_AD_VEDIO_JULEYUN_POSTID
=
"1011746770898338"
//聚乐云
var
YLH_AD_VEDIO_JULEYUN_POSTID
=
"1011746770898338"
//聚乐云
var
YLH_AD_VEDIO_BLESSINGBAG_POSTID
=
"1081758148138388"
//福袋
var
YLH_AD_VEDIO_HOMEVEDIO_POSTID
=
"4051451341464487"
// 首页视频翻倍
var
YLH_AD_VEDIO_HOMEVEDIO_POSTID
=
"4051451341464487"
// 首页视频翻倍
var
YLH_AD_VEDIO_SMALLHOMEVEDIO_POSTID
=
"9051152341362610"
// 短视频翻倍
var
YLH_AD_VEDIO_SMALLHOMEVEDIO_POSTID
=
"9051152341362610"
// 短视频翻倍
...
@@ -105,14 +106,15 @@ object YlhAdManager {
...
@@ -105,14 +106,15 @@ object YlhAdManager {
// 开屏
// 开屏
YLH_AD_SPLASH_POSTID
=
"7021944730189381"
YLH_AD_SPLASH_POSTID
=
"7021944730189381"
// 激励视频
// 激励视频
YLH_AD_VEDIO_DRINK_POSTID
=
"
2031043750380462
"
YLH_AD_VEDIO_DRINK_POSTID
=
"
9001346780383626
"
YLH_AD_VEDIO_MAIN_POSTID
=
"
8081940760988417
"
YLH_AD_VEDIO_MAIN_POSTID
=
"
9001346780383626
"
YLH_AD_VEDIO_ERASE_POSTID
=
"90
61142700180449
"
YLH_AD_VEDIO_ERASE_POSTID
=
"90
01346780383626
"
YLH_AD_VEDIO_TURNABLE_POSTID
=
"
7001353223571334
"
YLH_AD_VEDIO_TURNABLE_POSTID
=
"
9001346780383626
"
YLH_AD_VEDIO_MOREDIALOG_POSTID
=
"9001346780383626"
YLH_AD_VEDIO_MOREDIALOG_POSTID
=
"9001346780383626"
YLH_AD_VEDIO_SIGN_POSTID
=
"9001346780383626"
YLH_AD_VEDIO_OFFINELINE_POSTID
=
"9001346780383626"
YLH_AD_VEDIO_BLESSINGBAG_POSTID
=
"1081758148138388"
YLH_AD_VEDIO_BLESSINGBAG_POSTID
=
"1081758148138388"
YLH_AD_VEDIO_SIGN_POSTID
=
"2091354158635490"
YLH_AD_VEDIO_OFFINELINE_POSTID
=
"2031954198632389"
YLH_AD_VEDIO_HOMEVEDIO_POSTID
=
"4051451341464487"
YLH_AD_VEDIO_HOMEVEDIO_POSTID
=
"4051451341464487"
YLH_AD_VEDIO_SMALLHOMEVEDIO_POSTID
=
"9051152341362610"
YLH_AD_VEDIO_SMALLHOMEVEDIO_POSTID
=
"9051152341362610"
...
...
GoodMoney/app/src/main/java/com/mints/goodmoney/mvp/model/PanActionInfo.java
0 → 100644
View file @
4e5583cc
package
com
.
mints
.
goodmoney
.
mvp
.
model
;
import
java.io.Serializable
;
public
class
PanActionInfo
implements
Serializable
{
private
int
actionType
;
//0-微转,1-珊瑚下载,2-分红,3-鱼丸盒子,4-每日任务
private
String
emark
;
private
int
max
;
private
int
complete
;
private
int
time
;
private
int
coin
;
public
int
getActionType
()
{
return
actionType
;
}
public
String
getEmark
()
{
return
emark
;
}
public
int
getMax
()
{
return
max
;
}
public
int
getComplete
()
{
return
complete
;
}
public
int
getTime
()
{
return
time
;
}
public
int
getCoin
()
{
return
coin
;
}
}
GoodMoney/app/src/main/java/com/mints/goodmoney/net/CommonGsonConverterFactory.java
0 → 100755
View file @
4e5583cc
package
com
.
mints
.
goodmoney
.
net
;
import
com.google.gson.Gson
;
import
java.io.IOException
;
import
java.io.OutputStreamWriter
;
import
java.io.Reader
;
import
java.io.Writer
;
import
java.lang.annotation.Annotation
;
import
java.lang.reflect.Type
;
import
java.nio.charset.Charset
;
import
okhttp3.MediaType
;
import
okhttp3.RequestBody
;
import
okhttp3.ResponseBody
;
import
okio.Buffer
;
import
retrofit2.Converter
;
import
retrofit2.Retrofit
;
/**
* common gson
*/
public
class
CommonGsonConverterFactory
extends
Converter
.
Factory
{
private
final
Gson
gson
;
public
static
CommonGsonConverterFactory
create
()
{
return
create
(
new
Gson
());
}
public
static
CommonGsonConverterFactory
create
(
Gson
gson
)
{
return
new
CommonGsonConverterFactory
(
gson
);
}
private
CommonGsonConverterFactory
(
Gson
gson
)
{
if
(
gson
==
null
)
throw
new
NullPointerException
(
"gson == null"
);
this
.
gson
=
gson
;
}
@Override
public
Converter
<
ResponseBody
,
?>
responseBodyConverter
(
Type
type
,
Annotation
[]
annotations
,
Retrofit
retrofit
)
{
return
new
GsonResponseBodyConverter
<>(
gson
,
type
);
}
@Override
public
Converter
<?,
RequestBody
>
requestBodyConverter
(
Type
type
,
Annotation
[]
parameterAnnotations
,
Annotation
[]
methodAnnotations
,
Retrofit
retrofit
)
{
return
new
GsonRequestBodyConverter
<>(
gson
,
type
);
}
// 这里创建从ResponseBody其它类型的Converter
// 主要用于对响应体的处理
final
class
GsonResponseBodyConverter
<
T
>
implements
Converter
<
ResponseBody
,
T
>
{
private
final
Gson
gson
;
private
final
Type
type
;
GsonResponseBodyConverter
(
Gson
gson
,
Type
type
)
{
this
.
gson
=
gson
;
this
.
type
=
type
;
}
@Override
public
T
convert
(
ResponseBody
value
)
throws
IOException
{
Reader
reader
=
value
.
charStream
();
try
{
T
t
=
gson
.
fromJson
(
reader
,
type
);
// loginInvalid(t);
return
t
;
}
finally
{
try
{
if
(
reader
!=
null
)
reader
.
close
();
}
catch
(
IOException
ignored
)
{
ignored
.
printStackTrace
();
}
}
}
}
// 在这里创建 从自定类型到ResponseBody 的Converter
// 主要用于对Part、PartMap、Body注解的处理
final
class
GsonRequestBodyConverter
<
T
>
implements
Converter
<
T
,
RequestBody
>
{
private
final
MediaType
MEDIA_TYPE
=
MediaType
.
parse
(
"application/json; charset=UTF-8"
);
private
final
Charset
UTF_8
=
Charset
.
forName
(
"UTF-8"
);
private
final
Gson
gson
;
private
final
Type
type
;
GsonRequestBodyConverter
(
Gson
gson
,
Type
type
)
{
this
.
gson
=
gson
;
this
.
type
=
type
;
}
@Override
public
RequestBody
convert
(
T
value
)
throws
IOException
{
Buffer
buffer
=
new
Buffer
();
Writer
writer
=
new
OutputStreamWriter
(
buffer
.
outputStream
(),
UTF_8
);
gson
.
toJson
(
value
,
type
,
writer
);
writer
.
flush
();
return
RequestBody
.
create
(
MEDIA_TYPE
,
buffer
.
readByteString
());
}
}
}
GoodMoney/app/src/main/java/com/mints/goodmoney/net/CpdService.java
0 → 100755
View file @
4e5583cc
package
com
.
mints
.
goodmoney
.
net
;
import
android.text.TextUtils
;
import
com.mints.goodmoney.BuildConfig
;
import
com.orhanobut.logger.Logger
;
import
java.util.Map
;
import
java.util.concurrent.TimeUnit
;
import
okhttp3.OkHttpClient
;
import
okhttp3.logging.HttpLoggingInterceptor
;
import
retrofit2.Retrofit
;
import
retrofit2.adapter.rxjava.RxJavaCallAdapterFactory
;
import
retrofit2.http.Body
;
import
retrofit2.http.GET
;
import
retrofit2.http.POST
;
import
retrofit2.http.Url
;
import
rx.Observable
;
/**
* 描述:CPD 服务器交互
* 作者:孟崔广
* 时间:2021/1/18 13:46
*/
public
interface
CpdService
{
String
CPD_IP
=
"http://api.musesmobi.com:8111/"
;
//测试
/**
* 请求广告
*
* @return
*/
@POST
(
"api/cpd/1/detail/default"
)
Observable
<
Object
>
getAdVedio
(
@Body
Map
<
String
,
Object
>
vo
);
/**
* 提交监测
*
* @return
*/
@GET
Observable
<
Object
>
cmtImp
(
@Url
String
url
);
class
Factory
{
public
static
CpdService
create
()
{
OkHttpClient
.
Builder
builder
=
new
OkHttpClient
.
Builder
();
builder
.
retryOnConnectionFailure
(
false
);
builder
.
connectTimeout
(
20
,
TimeUnit
.
SECONDS
);
builder
.
readTimeout
(
20
,
TimeUnit
.
SECONDS
);
builder
.
writeTimeout
(
20
,
TimeUnit
.
SECONDS
);
if
(
BuildConfig
.
DEBUG
)
{
HttpLoggingInterceptor
logging
=
new
HttpLoggingInterceptor
(
message
->
{
if
(
TextUtils
.
isEmpty
(
message
))
return
;
String
s
=
message
.
substring
(
0
,
1
);
String
request
=
message
.
substring
(
0
,
4
);
if
(
"{"
.
equals
(
s
)
||
"["
.
equals
(
s
))
{
Logger
.
json
(
message
);
}
else
if
(
request
.
contains
(
"-->"
)
||
request
.
contains
(
"<--"
))
{
Logger
.
d
(
"Method"
+
message
);
}
else
{
Logger
.
d
(
"params:"
+
message
);
}
});
logging
.
setLevel
(
HttpLoggingInterceptor
.
Level
.
BODY
);
builder
.
interceptors
().
add
(
logging
);
}
Retrofit
retrofit
=
new
Retrofit
.
Builder
()
.
client
(
builder
.
build
())
.
baseUrl
(
CPD_IP
)
.
addConverterFactory
(
CommonGsonConverterFactory
.
create
())
.
addCallAdapterFactory
(
RxJavaCallAdapterFactory
.
create
())
.
build
();
return
retrofit
.
create
(
CpdService
.
class
);
}
}
}
GoodMoney/app/src/main/java/com/mints/goodmoney/ui/activitys/MainActivity.kt
View file @
4e5583cc
...
@@ -156,6 +156,13 @@ class MainActivity : BaseActivity(), MainView, View.OnClickListener {
...
@@ -156,6 +156,13 @@ class MainActivity : BaseActivity(), MainView, View.OnClickListener {
}
}
}
}
fun
turnDayTask
()
{
clickTab5Layout
()
myFragment
?.
let
{
(
it
as
MyFragment
).
turnDayTask
()
}
}
/**
/**
* 点击第二个tab
* 点击第二个tab
*/
*/
...
@@ -181,7 +188,7 @@ class MainActivity : BaseActivity(), MainView, View.OnClickListener {
...
@@ -181,7 +188,7 @@ class MainActivity : BaseActivity(), MainView, View.OnClickListener {
/**
/**
* 点击第四个tab
* 点击第四个tab
*/
*/
private
fun
clickTab4Layout
()
{
fun
clickTab4Layout
()
{
AppConfig
.
fragmentClickFlag
=
Constant
.
FRAGMENT_CLICK_FRIENDS
AppConfig
.
fragmentClickFlag
=
Constant
.
FRAGMENT_CLICK_FRIENDS
if
(
friendsFragment
==
null
)
{
if
(
friendsFragment
==
null
)
{
friendsFragment
=
FriendsFragment
()
friendsFragment
=
FriendsFragment
()
...
@@ -259,4 +266,12 @@ class MainActivity : BaseActivity(), MainView, View.OnClickListener {
...
@@ -259,4 +266,12 @@ class MainActivity : BaseActivity(), MainView, View.OnClickListener {
}
}
currentFragment
=
fragment
currentFragment
=
fragment
}
}
fun
showShortVedioLayout
(){
if
(
AppConfig
.
showAdFlag
)
{
tab_rl_channel
.
visibility
=
View
.
VISIBLE
}
else
{
tab_rl_channel
.
visibility
=
View
.
GONE
}
}
}
}
\ No newline at end of file
GoodMoney/app/src/main/java/com/mints/goodmoney/ui/activitys/TaskActivity.kt
View file @
4e5583cc
...
@@ -25,6 +25,7 @@ import com.mints.goodmoney.utils.AppUtil
...
@@ -25,6 +25,7 @@ import com.mints.goodmoney.utils.AppUtil
import
com.mints.goodmoney.utils.CacheUtil
import
com.mints.goodmoney.utils.CacheUtil
import
com.mints.goodmoney.utils.LogUtil
import
com.mints.goodmoney.utils.LogUtil
import
com.mints.goodmoney.utils.SpacesItemDecoration
import
com.mints.goodmoney.utils.SpacesItemDecoration
import
com.mints.library.utils.json.JsonUtil
import
com.scwang.smartrefresh.layout.api.RefreshLayout
import
com.scwang.smartrefresh.layout.api.RefreshLayout
import
com.scwang.smartrefresh.layout.listener.OnRefreshListener
import
com.scwang.smartrefresh.layout.listener.OnRefreshListener
import
com.tz.sdk.coral.ad.CoralAD
import
com.tz.sdk.coral.ad.CoralAD
...
@@ -36,7 +37,12 @@ import kotlinx.android.synthetic.main.header_layout.*
...
@@ -36,7 +37,12 @@ import kotlinx.android.synthetic.main.header_layout.*
*
*
* 描述:试玩任务
* 描述:试玩任务
*/
*/
class
TaskActivity
:
BaseActivity
(),
OnItemClickListener
,
OnRefreshListener
,
CoralDownload
.
OnAdLoadListener
,
OnItemChildClickListener
,
View
.
OnClickListener
,
DownloadApkManager
.
OnMyDownloadListener
{
class
TaskActivity
:
BaseActivity
(),
OnRefreshListener
,
CoralDownload
.
OnAdLoadListener
,
OnItemChildClickListener
,
View
.
OnClickListener
,
DownloadApkManager
.
OnMyDownloadListener
{
private
var
mTaskAdapter
:
TaskAdapter
?
=
null
private
var
mTaskAdapter
:
TaskAdapter
?
=
null
...
@@ -61,15 +67,22 @@ class TaskActivity : BaseActivity(), OnItemClickListener, OnRefreshListener, Cor
...
@@ -61,15 +67,22 @@ class TaskActivity : BaseActivity(), OnItemClickListener, OnRefreshListener, Cor
companion
object
{
companion
object
{
const
val
TASK_COIN
=
"task_coin"
const
val
TASK_COIN
=
"task_coin"
const
val
TASK_USE_TIME
=
"task_use_time"
const
val
TASK_USE_TIME
=
"task_use_time"
const
val
TASK_USE_MAX
=
"task_use_max"
const
val
TASK_USE_COMPLETE
=
"task_use_complete"
}
}
private
var
mCoin
=
0
private
var
mCoin
=
0
private
var
needUseTime
=
0
private
var
needUseTime
=
0
private
var
max
=
3
//广告最大填充数
private
var
complete
=
0
//本地判断:领取金币,完成数+1
private
var
loadCountTime
=
0
// 加载广告次数
override
fun
getBundleExtras
(
extras
:
Bundle
)
{
override
fun
getBundleExtras
(
extras
:
Bundle
)
{
super
.
getBundleExtras
(
extras
)
super
.
getBundleExtras
(
extras
)
mCoin
=
extras
.
getInt
(
TASK_COIN
)
mCoin
=
extras
.
getInt
(
TASK_COIN
)
needUseTime
=
extras
.
getInt
(
TASK_USE_TIME
)
needUseTime
=
extras
.
getInt
(
TASK_USE_TIME
)
max
=
extras
.
getInt
(
TASK_USE_MAX
,
3
)
complete
=
extras
.
getInt
(
TASK_USE_COMPLETE
,
0
)
}
}
override
fun
getContentViewLayoutID
()
=
R
.
layout
.
activity_task
override
fun
getContentViewLayoutID
()
=
R
.
layout
.
activity_task
...
@@ -93,10 +106,9 @@ class TaskActivity : BaseActivity(), OnItemClickListener, OnRefreshListener, Cor
...
@@ -93,10 +106,9 @@ class TaskActivity : BaseActivity(), OnItemClickListener, OnRefreshListener, Cor
val
gridLayoutManager
=
GridLayoutManager
(
this
,
3
)
val
gridLayoutManager
=
GridLayoutManager
(
this
,
3
)
recy_task
.
layoutManager
=
gridLayoutManager
recy_task
.
layoutManager
=
gridLayoutManager
recy_task
.
addItemDecoration
(
SpacesItemDecoration
(
3
,
SpacesItemDecoration
.
px2dp
(
10f
)))
recy_task
.
addItemDecoration
(
SpacesItemDecoration
(
3
,
SpacesItemDecoration
.
px2dp
(
10f
)))
mTaskAdapter
=
TaskAdapter
(
mFakeTaskList
,
this
)
mTaskAdapter
=
TaskAdapter
(
mFakeTaskList
,
mTaskList
,
this
)
recy_task
.
adapter
=
mTaskAdapter
recy_task
.
adapter
=
mTaskAdapter
recy_task
.
setItemViewCacheSize
(
20
)
recy_task
.
setItemViewCacheSize
(
20
)
mTaskAdapter
?.
setOnItemClickListener
(
this
)
mTaskAdapter
?.
setOnItemChildClickListener
(
this
)
mTaskAdapter
?.
setOnItemChildClickListener
(
this
)
iv_left_icon
.
setOnClickListener
(
this
)
iv_left_icon
.
setOnClickListener
(
this
)
}
}
...
@@ -117,93 +129,37 @@ class TaskActivity : BaseActivity(), OnItemClickListener, OnRefreshListener, Cor
...
@@ -117,93 +129,37 @@ class TaskActivity : BaseActivity(), OnItemClickListener, OnRefreshListener, Cor
}
}
}
}
/**
* 刷新高额任务
*/
private
fun
refreshDemoTask
()
{
mTaskAdapter
?.
let
{
val
position
=
it
.
getPosition
()
if
(
mFakeTaskList
.
size
==
0
||
mFakeTaskList
[
position
].
state
==
3
)
return
val
currentPkgName
=
mFakeTaskList
[
position
].
currentPkgName
if
(
currentPkgName
!=
null
)
{
if
(
AppTryPlayManager
.
getTryPlayIsOK
(
currentPkgName
,
needUseTime
))
{
// 完成试玩任务
mFakeTaskList
[
position
].
state
=
2
it
.
notifyItemChanged
(
position
)
// 上报激活完成
mDownloadProcess
?.
reportAppActivated
()
}
else
{
if
(
AppTryPlayManager
.
getTryPlayIsOK
(
currentPkgName
,
5
))
{
// 试玩时间不足
if
(
tryTimeOut
)
{
return
}
tryTimeOut
=
true
mFakeTaskList
[
position
].
state
=
4
it
.
notifyItemChanged
(
it
.
getPosition
())
val
bundle
=
Bundle
()
bundle
.
putInt
(
Constant
.
MAIN_CUR_COIN
,
0
)
bundle
.
putString
(
Constant
.
MAIN_CARRIER_TYPE
,
Constant
.
CARRIER_CPD
)
readyGo
(
AwardActivity
::
class
.
java
,
bundle
)
}
else
{
// 试玩时间不足5秒
mFakeTaskList
[
position
].
state
=
1
it
.
notifyItemChanged
(
it
.
getPosition
())
}
}
}
}
}
private
fun
loadData
()
{
showLoading
(
"加载中..."
)
mCoralDownload
?.
pull
()
}
override
fun
isApplyKitKatTranslucency
()
=
false
override
fun
isApplyKitKatTranslucency
()
=
false
override
fun
onItemClick
(
view
:
View
?,
position
:
Int
)
{
}
private
fun
clickDialog
(
position
:
Int
)
{
taskDialog
=
TaskDialog
(
this
)
taskDialog
?.
setData
(
mTaskList
[
position
],
needUseTime
,
mCoin
)
taskDialog
?.
show
()
}
override
fun
onRefresh
(
refreshLayout
:
RefreshLayout
)
{
override
fun
onRefresh
(
refreshLayout
:
RefreshLayout
)
{
loadData
()
loadData
()
}
}
override
fun
onLoadSuccess
(
dataList
:
MutableList
<
CoralAD
>?)
{
override
fun
onLoadSuccess
(
dataList
:
MutableList
<
CoralAD
>?)
{
iv_empty
.
visibility
=
View
.
GONE
hideLoading
()
srl_task
.
finishRefresh
()
dataList
?.
let
{
dataList
?.
let
{
mFakeTaskList
.
clear
()
for
(
coralAD
in
it
)
{
for
(
coralAD
in
it
)
{
mFakeTaskList
.
add
(
TzTaskBean
(
coralAD
.
icon
,
coralAD
.
description
,
mCoin
,
0
,
null
))
mFakeTaskList
.
add
(
TzTaskBean
(
coralAD
.
icon
,
coralAD
.
description
,
mCoin
,
0
,
null
))
mTaskList
.
add
(
coralAD
)
}
}
}
mTaskList
.
clear
()
// 多拉取的广告
mTaskList
.
addAll
(
it
)
if
(
loadCountTime
==
max
-
complete
-
1
)
{
hideLoading
()
// iv_empty.visibility = View.GONE
srl_task
.
finishRefresh
()
mTaskAdapter
?.
notifyDataSetChanged
()
mTaskAdapter
?.
notifyDataSetChanged
()
}
}
}
}
override
fun
onLoadFail
()
{
override
fun
onLoadFail
()
{
hideLoading
()
// 次数刷新完 且未拿到数据 提示
showToast
(
"加载失败,请下拉刷新重试"
)
if
(
mFakeTaskList
.
size
==
0
&&
loadCountTime
==
max
-
complete
-
1
)
{
hideLoading
()
mTaskList
.
clear
()
// iv_empty.visibility = View.VISIBLE
mTaskAdapter
?.
notifyDataSetChanged
()
// showToast("加载失败,请下拉刷新重试")
iv_empty
.
visibility
=
View
.
VISIBLE
srl_task
.
finishRefresh
(
false
)
}
srl_task
.
finishRefresh
(
false
)
}
}
override
fun
onSDKDownloadStart
()
{
override
fun
onSDKDownloadStart
()
{
...
@@ -252,41 +208,6 @@ class TaskActivity : BaseActivity(), OnItemClickListener, OnRefreshListener, Cor
...
@@ -252,41 +208,6 @@ class TaskActivity : BaseActivity(), OnItemClickListener, OnRefreshListener, Cor
backDialog
()
backDialog
()
}
}
/**
* 注册试玩任务监听
*/
private
fun
registerBroad
()
{
if
(
mReceiverBroadcastReceiver
!=
null
)
return
mContext
.
startService
(
Intent
(
context
,
AppInstallService
::
class
.
java
))
mReceiverBroadcastReceiver
=
object
:
BroadcastReceiver
()
{
override
fun
onReceive
(
context
:
Context
?,
intent
:
Intent
?)
{
if
(
intent
==
null
)
return
try
{
taskDialog
?.
dismiss
()
val
pkg
=
intent
.
getStringExtra
(
"pkg"
)
mTaskAdapter
?.
let
{
mFakeTaskList
[
it
.
getPosition
()].
currentPkgName
=
pkg
mFakeTaskList
[
it
.
getPosition
()].
state
=
1
it
.
notifyItemChanged
(
it
.
getPosition
())
// 上报安装完成
mDownloadProcess
?.
reportInstallSuccess
(
false
)
}
}
catch
(
e
:
Exception
)
{
e
.
printStackTrace
()
}
}
}
val
intentFilter
=
IntentFilter
()
intentFilter
.
addAction
(
AppInstallService
.
APP_INSTALL_ACTION
)
mContext
.
registerReceiver
(
this
.
mReceiverBroadcastReceiver
,
intentFilter
)
}
override
fun
onItemChildClick
(
view
:
View
?,
position
:
Int
)
{
override
fun
onItemChildClick
(
view
:
View
?,
position
:
Int
)
{
when
(
mFakeTaskList
[
position
].
state
)
{
when
(
mFakeTaskList
[
position
].
state
)
{
// 0 立即下载, 1 去试玩, 2 领取奖励 3 已领取 4 继续试玩
// 0 立即下载, 1 去试玩, 2 领取奖励 3 已领取 4 继续试玩
...
@@ -325,11 +246,16 @@ class TaskActivity : BaseActivity(), OnItemClickListener, OnRefreshListener, Cor
...
@@ -325,11 +246,16 @@ class TaskActivity : BaseActivity(), OnItemClickListener, OnRefreshListener, Cor
bundle
.
putString
(
Constant
.
MAIN_CARRIER_TYPE
,
Constant
.
CARRIER_CPD
)
bundle
.
putString
(
Constant
.
MAIN_CARRIER_TYPE
,
Constant
.
CARRIER_CPD
)
readyGo
(
AwardActivity
::
class
.
java
,
bundle
)
readyGo
(
AwardActivity
::
class
.
java
,
bundle
)
// 重置当前列表状态
// 本地判断:领取金币,完成数+1
mTaskAdapter
?.
let
{
complete
++
mFakeTaskList
[
it
.
getPosition
()].
state
=
3
it
.
notifyItemChanged
(
it
.
getPosition
())
loadData
()
}
// // 重置当前列表状态
// mTaskAdapter?.let {
// mFakeTaskList[it.getPosition()].state = 3
// it.notifyItemChanged(it.getPosition())
// }
}
}
3
->
{
3
->
{
showToast
(
"当前任务已完成,试试其他任务吧!"
)
showToast
(
"当前任务已完成,试试其他任务吧!"
)
...
@@ -357,6 +283,107 @@ class TaskActivity : BaseActivity(), OnItemClickListener, OnRefreshListener, Cor
...
@@ -357,6 +283,107 @@ class TaskActivity : BaseActivity(), OnItemClickListener, OnRefreshListener, Cor
}
}
}
}
private
fun
clickDialog
(
position
:
Int
)
{
taskDialog
=
TaskDialog
(
this
)
taskDialog
?.
setData
(
mTaskList
[
position
],
needUseTime
,
mCoin
)
taskDialog
?.
show
()
}
/**
* 注册试玩任务监听
*/
private
fun
registerBroad
()
{
if
(
mReceiverBroadcastReceiver
!=
null
)
return
mContext
.
startService
(
Intent
(
context
,
AppInstallService
::
class
.
java
))
mReceiverBroadcastReceiver
=
object
:
BroadcastReceiver
()
{
override
fun
onReceive
(
context
:
Context
?,
intent
:
Intent
?)
{
if
(
intent
==
null
)
return
try
{
taskDialog
?.
dismiss
()
val
pkg
=
intent
.
getStringExtra
(
"pkg"
)
mTaskAdapter
?.
let
{
mFakeTaskList
[
it
.
getPosition
()].
currentPkgName
=
pkg
mFakeTaskList
[
it
.
getPosition
()].
state
=
1
it
.
notifyItemChanged
(
it
.
getPosition
())
// 上报安装完成
mDownloadProcess
?.
reportInstallSuccess
(
false
)
}
}
catch
(
e
:
Exception
)
{
e
.
printStackTrace
()
}
}
}
val
intentFilter
=
IntentFilter
()
intentFilter
.
addAction
(
AppInstallService
.
APP_INSTALL_ACTION
)
mContext
.
registerReceiver
(
this
.
mReceiverBroadcastReceiver
,
intentFilter
)
}
/**
* 刷新高额任务
*/
private
fun
refreshDemoTask
()
{
mTaskAdapter
?.
let
{
val
position
=
it
.
getPosition
()
if
(
mFakeTaskList
.
size
==
0
||
mFakeTaskList
[
position
].
state
==
3
)
return
val
currentPkgName
=
mFakeTaskList
[
position
].
currentPkgName
if
(
currentPkgName
!=
null
)
{
if
(
AppTryPlayManager
.
getTryPlayIsOK
(
currentPkgName
,
needUseTime
))
{
// 完成试玩任务
mFakeTaskList
[
position
].
state
=
2
it
.
notifyItemChanged
(
position
)
// 上报激活完成
mDownloadProcess
?.
reportAppActivated
()
}
else
{
if
(
AppTryPlayManager
.
getTryPlayIsOK
(
currentPkgName
,
5
))
{
// 试玩时间不足
if
(
tryTimeOut
)
{
return
}
tryTimeOut
=
true
mFakeTaskList
[
position
].
state
=
4
it
.
notifyItemChanged
(
it
.
getPosition
())
val
bundle
=
Bundle
()
bundle
.
putInt
(
Constant
.
MAIN_CUR_COIN
,
0
)
bundle
.
putString
(
Constant
.
MAIN_CARRIER_TYPE
,
Constant
.
CARRIER_CPD
)
readyGo
(
AwardActivity
::
class
.
java
,
bundle
)
}
else
{
// 试玩时间不足5秒
mFakeTaskList
[
position
].
state
=
1
it
.
notifyItemChanged
(
it
.
getPosition
())
}
}
}
}
}
private
fun
loadData
()
{
if
(
complete
>=
max
)
{
showToast
(
"今日任务已完成,请明日再试"
)
finish
()
return
}
showLoading
(
"加载中..."
)
mFakeTaskList
.
clear
()
mTaskList
.
clear
()
for
(
i
in
0
until
max
-
complete
)
{
loadCountTime
=
i
mCoralDownload
?.
pull
()
}
}
private
fun
backDialog
()
{
private
fun
backDialog
()
{
cdaa
=
CustomDialogAsApple
(
context
,
object
:
DialogListener
()
{
cdaa
=
CustomDialogAsApple
(
context
,
object
:
DialogListener
()
{
override
fun
onClick
(
v
:
View
)
{
override
fun
onClick
(
v
:
View
)
{
...
...
GoodMoney/app/src/main/java/com/mints/goodmoney/ui/adapter/TaskAdapter.kt
View file @
4e5583cc
...
@@ -13,8 +13,10 @@ import com.mints.goodmoney.mvp.model.TzTaskBean
...
@@ -13,8 +13,10 @@ import com.mints.goodmoney.mvp.model.TzTaskBean
import
com.mints.goodmoney.ui.adapter.listener.OnItemChildClickListener
import
com.mints.goodmoney.ui.adapter.listener.OnItemChildClickListener
import
com.mints.goodmoney.ui.adapter.listener.OnItemClickListener
import
com.mints.goodmoney.ui.adapter.listener.OnItemClickListener
import
com.mints.library.utils.GlideUtils
import
com.mints.library.utils.GlideUtils
import
com.tz.sdk.coral.ad.CoralAD
import
com.tz.sdk.core.ui.ADContainer
class
TaskAdapter
(
val
dataList
:
List
<
TzTaskBean
>,
val
context
:
Context
)
:
RecyclerView
.
Adapter
<
TaskAdapter
.
ViewHolder
>()
{
class
TaskAdapter
(
val
dataList
:
List
<
TzTaskBean
>,
val
taskList
:
List
<
CoralAD
>,
val
context
:
Context
)
:
RecyclerView
.
Adapter
<
TaskAdapter
.
ViewHolder
>()
{
private
var
mCurrentPosition
=
0
private
var
mCurrentPosition
=
0
...
@@ -25,8 +27,7 @@ class TaskAdapter(val dataList: List<TzTaskBean>, val context: Context) : Recycl
...
@@ -25,8 +27,7 @@ class TaskAdapter(val dataList: List<TzTaskBean>, val context: Context) : Recycl
val
ivAvatar
:
ImageView
=
view
.
findViewById
(
R
.
id
.
item_iv_avatar
)
val
ivAvatar
:
ImageView
=
view
.
findViewById
(
R
.
id
.
item_iv_avatar
)
val
tvTitle
:
TextView
=
view
.
findViewById
(
R
.
id
.
item_tv_title
)
val
tvTitle
:
TextView
=
view
.
findViewById
(
R
.
id
.
item_tv_title
)
val
tvCoin
:
TextView
=
view
.
findViewById
(
R
.
id
.
item_tv_coin
)
val
tvCoin
:
TextView
=
view
.
findViewById
(
R
.
id
.
item_tv_coin
)
val
adContainer
:
ADContainer
=
view
.
findViewById
(
R
.
id
.
ad_container
)
// val tvText: TextView = view.findViewById(R.id.item_tv_text)
val
btnSubmit
:
Button
=
view
.
findViewById
(
R
.
id
.
item_btn_submit
)
val
btnSubmit
:
Button
=
view
.
findViewById
(
R
.
id
.
item_btn_submit
)
}
}
...
@@ -37,34 +38,30 @@ class TaskAdapter(val dataList: List<TzTaskBean>, val context: Context) : Recycl
...
@@ -37,34 +38,30 @@ class TaskAdapter(val dataList: List<TzTaskBean>, val context: Context) : Recycl
override
fun
onBindViewHolder
(
holder
:
ViewHolder
,
position
:
Int
)
{
override
fun
onBindViewHolder
(
holder
:
ViewHolder
,
position
:
Int
)
{
val
data
=
dataList
[
position
]
val
data
=
dataList
[
position
]
val
task
=
taskList
[
position
]
GlideUtils
.
loadImageView
(
context
,
data
.
icon
,
holder
.
ivAvatar
)
GlideUtils
.
loadImageView
(
context
,
data
.
icon
,
holder
.
ivAvatar
)
holder
.
tvTitle
.
text
=
data
.
title
holder
.
tvTitle
.
text
=
data
.
title
holder
.
tvCoin
.
text
=
"+"
+
data
.
coin
+
"金币"
holder
.
tvCoin
.
text
=
"+"
+
data
.
coin
+
"金币"
holder
.
adContainer
.
setAdModel
(
task
)
when
(
data
.
state
)
{
when
(
data
.
state
)
{
0
->
holder
.
btnSubmit
.
text
=
"立即下载"
0
->
{
1
->
holder
.
btnSubmit
.
text
=
"去试玩"
holder
.
btnSubmit
.
text
=
"立即下载"
2
->
holder
.
btnSubmit
.
text
=
"立即领取"
}
3
->
holder
.
btnSubmit
.
text
=
"已完成"
1
->
{
4
->
holder
.
btnSubmit
.
text
=
"继续试玩"
holder
.
btnSubmit
.
text
=
"去试玩"
}
2
->
{
holder
.
btnSubmit
.
text
=
"立即领取"
}
3
->
{
holder
.
btnSubmit
.
text
=
"已完成"
}
4
->
{
holder
.
btnSubmit
.
text
=
"继续试玩"
}
}
}
//当前选中
// if (getPosition() == position) {
// holder.tvTitle.setTextColor(ContextCompat.getColor(context, R.color.white))
// holder.tvCoin.setTextColor(ContextCompat.getColor(context, R.color.white))
// holder.tvText.setTextColor(ContextCompat.getColor(context, R.color.white))
// holder.itemView.setBackgroundResource(R.drawable.shape_vip_adapter_none)
// holder.btnSubmit.setBackgroundResource(R.drawable.shape_my_red)
// } else {
// holder.tvTitle.setTextColor(ContextCompat.getColor(context, R.color.black))
// holder.tvCoin.setTextColor(ContextCompat.getColor(context, R.color.color_FF9837))
// holder.tvText.setTextColor(ContextCompat.getColor(context, R.color.gray))
// holder.itemView.setBackgroundResource(R.drawable.shape_dialog_bg)
// holder.btnSubmit.setBackgroundResource(R.drawable.shape_btn_switch)
// }
if
(
::
mOnItemClickListener
.
isInitialized
)
{
if
(
::
mOnItemClickListener
.
isInitialized
)
{
holder
.
itemView
.
setOnClickListener
{
holder
.
itemView
.
setOnClickListener
{
setPosition
(
position
)
setPosition
(
position
)
...
@@ -73,9 +70,13 @@ class TaskAdapter(val dataList: List<TzTaskBean>, val context: Context) : Recycl
...
@@ -73,9 +70,13 @@ class TaskAdapter(val dataList: List<TzTaskBean>, val context: Context) : Recycl
}
}
if
(
::
mOnItemChildClickListener
.
isInitialized
)
{
if
(
::
mOnItemChildClickListener
.
isInitialized
)
{
holder
.
btnSubmit
.
setOnClickListener
{
if
(
holder
.
btnSubmit
.
visibility
==
View
.
VISIBLE
)
{
setPosition
(
position
)
holder
.
btnSubmit
.
setOnClickListener
{
mOnItemChildClickListener
.
onItemChildClick
(
it
,
position
)
setPosition
(
position
)
mOnItemChildClickListener
.
onItemChildClick
(
it
,
position
)
}
}
else
{
holder
.
btnSubmit
.
setOnClickListener
(
null
)
}
}
}
}
}
}
...
...
GoodMoney/app/src/main/java/com/mints/goodmoney/ui/fragment/MainFragment.kt
View file @
4e5583cc
...
@@ -25,6 +25,7 @@ import com.mints.goodmoney.mvp.model.UserTaskMsgBean
...
@@ -25,6 +25,7 @@ import com.mints.goodmoney.mvp.model.UserTaskMsgBean
import
com.mints.goodmoney.mvp.presenters.HomePresenter
import
com.mints.goodmoney.mvp.presenters.HomePresenter
import
com.mints.goodmoney.mvp.views.HomeView
import
com.mints.goodmoney.mvp.views.HomeView
import
com.mints.goodmoney.ui.activitys.AwardActivity
import
com.mints.goodmoney.ui.activitys.AwardActivity
import
com.mints.goodmoney.ui.activitys.MainActivity
import
com.mints.goodmoney.ui.activitys.WebActivity
import
com.mints.goodmoney.ui.activitys.WebActivity
import
com.mints.goodmoney.ui.fragment.base.BaseFragment
import
com.mints.goodmoney.ui.fragment.base.BaseFragment
import
com.mints.goodmoney.ui.widgets.BindWxDialog
import
com.mints.goodmoney.ui.widgets.BindWxDialog
...
@@ -223,6 +224,12 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener {
...
@@ -223,6 +224,12 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener {
}
}
ChannelManager
.
updataCodeIdForRegisterChannel
(
data
.
adcode
)
ChannelManager
.
updataCodeIdForRegisterChannel
(
data
.
adcode
)
// 隐藏 短视频、首页视频、书城
val
activity
:
MainActivity
?
=
activity
as
MainActivity
?
activity
?.
let
{
it
.
showShortVedioLayout
()
}
// 新人福利 放到个人中心展示 防止首页红包转动异常
// 新人福利 放到个人中心展示 防止首页红包转动异常
// 设置视频权重
// 设置视频权重
...
...
GoodMoney/app/src/main/java/com/mints/goodmoney/ui/fragment/MoneyFragment.kt
View file @
4e5583cc
...
@@ -5,6 +5,7 @@ import androidx.fragment.app.FragmentManager
...
@@ -5,6 +5,7 @@ import androidx.fragment.app.FragmentManager
import
androidx.fragment.app.FragmentTransaction
import
androidx.fragment.app.FragmentTransaction
import
com.androidkun.xtablayout.XTabLayout
import
com.androidkun.xtablayout.XTabLayout
import
com.mints.goodmoney.R
import
com.mints.goodmoney.R
import
com.mints.goodmoney.common.AppConfig
import
com.mints.goodmoney.ui.fragment.base.BaseFragment
import
com.mints.goodmoney.ui.fragment.base.BaseFragment
import
kotlinx.android.synthetic.main.fragment_main_money.*
import
kotlinx.android.synthetic.main.fragment_main_money.*
...
@@ -41,12 +42,18 @@ class MoneyFragment : BaseFragment(), XTabLayout.OnTabSelectedListener {
...
@@ -41,12 +42,18 @@ class MoneyFragment : BaseFragment(), XTabLayout.OnTabSelectedListener {
}
}
override
fun
onHiddenChanged
(
hidden
:
Boolean
)
{
override
fun
onHiddenChanged
(
hidden
:
Boolean
)
{
if
(
curPosition
==
0
)
{
if
(
AppConfig
.
showAdFlag
)
{
mainFragment
?.
onHiddenChanged
(
hidden
)
if
(
curPosition
==
0
)
{
}
mainFragment
?.
onHiddenChanged
(
hidden
)
else
if
(
curPosition
==
3
)
{
}
else
if
(
curPosition
==
3
)
{
liebaoGameFragment
?.
onHiddenChanged
(
hidden
)
liebaoGameFragment
?.
onHiddenChanged
(
hidden
)
}
}
else
{
if
(
curPosition
==
1
)
{
liebaoGameFragment
?.
onHiddenChanged
(
hidden
)
}
}
}
super
.
onHiddenChanged
(
hidden
)
super
.
onHiddenChanged
(
hidden
)
}
}
...
@@ -58,55 +65,58 @@ class MoneyFragment : BaseFragment(), XTabLayout.OnTabSelectedListener {
...
@@ -58,55 +65,58 @@ class MoneyFragment : BaseFragment(), XTabLayout.OnTabSelectedListener {
}
}
private
fun
initView
()
{
private
fun
initView
()
{
// val tabs: MutableList<String> = ArrayList()
if
(
AppConfig
.
showAdFlag
)
{
// tabs.add("视频")
if
(
mainFragment
==
null
)
{
// tabs.add("书城")
mainFragment
=
MainFragment
()
// tabs.add("新闻")
}
// tabs.add("游戏")
if
(!
mainFragment
!!
.
isAdded
)
{
//
// 提交事务
// val fragments: MutableList<Fragment> = ArrayList()
childFragmentManager
.
beginTransaction
().
add
(
R
.
id
.
fragment_container
,
mainFragment
!!
).
commitAllowingStateLoss
()
// mainFragment = MainFragment()
// 记录当前Fragment
// liebaoGameFragment = LiebaoGameFragment()
currentFragment
=
mainFragment
// fragments.add(mainFragment!!)
}
// fragments.add(MyZhangyueFragment())
// fragments.add(RsNewsFragment())
// fragments.add(liebaoGameFragment!!)
//
// //去除两侧应阴影
// vpFragmentMoney.overScrollMode = ViewPager.OVER_SCROLL_NEVER
// vpFragmentMoney.offscreenPageLimit = tabs.size + 3
// val adapter = MessageFragAdapter(childFragmentManager, fragments, tabs)
// vpFragmentMoney.adapter = adapter
// xtFragmentMoney.setxTabDisplayNum(tabs.size)
// xtFragmentMoney.setupWithViewPager(vpFragmentMoney)
if
(
mainFragment
==
null
)
{
mainFragment
=
MainFragment
()
}
if
(!
mainFragment
!!
.
isAdded
)
{
// 提交事务
childFragmentManager
.
beginTransaction
().
add
(
R
.
id
.
fragment_container
,
mainFragment
!!
).
commitAllowingStateLoss
()
// 记录当前Fragment
currentFragment
=
mainFragment
}
xtFragmentMoney
.
setxTabDisplayNum
(
4
)
xtFragmentMoney
.
setxTabDisplayNum
(
4
)
val
newTab1
=
xtFragmentMoney
.
newTab
()
val
newTab1
=
xtFragmentMoney
.
newTab
()
newTab1
.
text
=
"视频"
newTab1
.
text
=
"视频"
val
newTab2
=
xtFragmentMoney
.
newTab
()
val
newTab2
=
xtFragmentMoney
.
newTab
()
newTab2
.
text
=
"书城"
newTab2
.
text
=
"书城"
// val newTab3 = xtFragmentMoney.newTab()
// val newTab3 = xtFragmentMoney.newTab()
// newTab3.text = "新闻"
// newTab3.text = "新闻"
val
newTab4
=
xtFragmentMoney
.
newTab
()
val
newTab4
=
xtFragmentMoney
.
newTab
()
newTab4
.
text
=
"听书"
newTab4
.
text
=
"听书"
val
newTab5
=
xtFragmentMoney
.
newTab
()
val
newTab5
=
xtFragmentMoney
.
newTab
()
newTab5
.
text
=
"游戏"
newTab5
.
text
=
"游戏"
xtFragmentMoney
.
addTab
(
newTab1
)
xtFragmentMoney
.
addTab
(
newTab1
)
xtFragmentMoney
.
addTab
(
newTab2
)
xtFragmentMoney
.
addTab
(
newTab2
)
// xtFragmentMoney.addTab(newTab3)
xtFragmentMoney
.
addTab
(
newTab4
)
xtFragmentMoney
.
addTab
(
newTab5
)
xtFragmentMoney
.
addOnTabSelectedListener
(
this
)
}
else
{
if
(
xmlyGameFragment
==
null
)
{
xmlyGameFragment
=
XmlyFragment
()
}
if
(!
xmlyGameFragment
!!
.
isAdded
)
{
// 提交事务
childFragmentManager
.
beginTransaction
().
add
(
R
.
id
.
fragment_container
,
xmlyGameFragment
!!
).
commitAllowingStateLoss
()
// 记录当前Fragment
currentFragment
=
xmlyGameFragment
}
xtFragmentMoney
.
setxTabDisplayNum
(
2
)
val
newTab4
=
xtFragmentMoney
.
newTab
()
newTab4
.
text
=
"听书"
val
newTab5
=
xtFragmentMoney
.
newTab
()
newTab5
.
text
=
"游戏"
// xtFragmentMoney.addTab(newTab3)
// xtFragmentMoney.addTab(newTab3)
xtFragmentMoney
.
addTab
(
newTab4
)
xtFragmentMoney
.
addTab
(
newTab4
)
xtFragmentMoney
.
addTab
(
newTab5
)
xtFragmentMoney
.
addTab
(
newTab5
)
xtFragmentMoney
.
addOnTabSelectedListener
(
this
)
xtFragmentMoney
.
addOnTabSelectedListener
(
this
)
}
}
}
/**
/**
...
@@ -171,16 +181,32 @@ class MoneyFragment : BaseFragment(), XTabLayout.OnTabSelectedListener {
...
@@ -171,16 +181,32 @@ class MoneyFragment : BaseFragment(), XTabLayout.OnTabSelectedListener {
// }
// }
when
(
tab
.
position
)
{
when
(
tab
.
position
)
{
0
->
{
0
->
{
if
(
mainFragment
==
null
)
{
if
(
AppConfig
.
showAdFlag
)
{
mainFragment
=
MainFragment
()
if
(
mainFragment
==
null
)
{
mainFragment
=
MainFragment
()
}
addOrShowFragment
(
childFragmentManager
,
mainFragment
!!
,
FRAGMENT_TAG_VIDEO
)
}
else
{
if
(
xmlyGameFragment
==
null
)
{
xmlyGameFragment
=
XmlyFragment
()
}
addOrShowFragment
(
childFragmentManager
,
xmlyGameFragment
!!
,
FRAGMENT_TAG_XMLY
)
}
}
addOrShowFragment
(
childFragmentManager
,
mainFragment
!!
,
FRAGMENT_TAG_VIDEO
)
}
}
1
->
{
1
->
{
if
(
bookStoreFragment
==
null
)
{
if
(
AppConfig
.
showAdFlag
)
{
bookStoreFragment
=
ZhangyueFragment
()
if
(
bookStoreFragment
==
null
)
{
bookStoreFragment
=
ZhangyueFragment
()
}
addOrShowFragment
(
childFragmentManager
,
bookStoreFragment
!!
,
FRAGMENT_TAG_BOOKSTORE
)
}
else
{
if
(
liebaoGameFragment
==
null
)
{
liebaoGameFragment
=
LiebaoGameFragment
()
}
addOrShowFragment
(
childFragmentManager
,
liebaoGameFragment
!!
,
FRAGMENT_TAG_GAME
)
}
}
addOrShowFragment
(
childFragmentManager
,
bookStoreFragment
!!
,
FRAGMENT_TAG_BOOKSTORE
)
}
}
// 2 -> {
// 2 -> {
// if (newsFragment == null) {
// if (newsFragment == null) {
...
...
GoodMoney/app/src/main/java/com/mints/goodmoney/ui/fragment/MyFragment.kt
View file @
4e5583cc
...
@@ -17,7 +17,6 @@ import com.mints.goodmoney.R
...
@@ -17,7 +17,6 @@ import com.mints.goodmoney.R
import
com.mints.goodmoney.ad.banner.BannerManager
import
com.mints.goodmoney.ad.banner.BannerManager
import
com.mints.goodmoney.ad.express.TTPreLoadCarrierExpressManager
import
com.mints.goodmoney.ad.express.TTPreLoadCarrierExpressManager
import
com.mints.goodmoney.ad.express.TTPreLoadExpressXmlyManager
import
com.mints.goodmoney.ad.express.TTPreLoadExpressXmlyManager
import
com.mints.goodmoney.ad.video.VideoAdingManager
import
com.mints.goodmoney.ad.video.VideoAdingManager
import
com.mints.goodmoney.common.AppConfig
import
com.mints.goodmoney.common.AppConfig
import
com.mints.goodmoney.common.Constant
import
com.mints.goodmoney.common.Constant
...
@@ -35,7 +34,10 @@ import com.mints.goodmoney.ui.widgets.CustomDialogAsApple
...
@@ -35,7 +34,10 @@ import com.mints.goodmoney.ui.widgets.CustomDialogAsApple
import
com.mints.goodmoney.ui.widgets.DialogListener
import
com.mints.goodmoney.ui.widgets.DialogListener
import
com.mints.goodmoney.ui.widgets.ShareDialog
import
com.mints.goodmoney.ui.widgets.ShareDialog
import
com.mints.goodmoney.ui.widgets.seekbar.BubbleUtils
import
com.mints.goodmoney.ui.widgets.seekbar.BubbleUtils
import
com.mints.goodmoney.utils.*
import
com.mints.goodmoney.utils.AppUtil
import
com.mints.goodmoney.utils.LogUtil
import
com.mints.goodmoney.utils.QQJumpUtil
import
com.mints.goodmoney.utils.SpanUtils
import
com.mints.library.net.netstatus.NetUtils
import
com.mints.library.net.netstatus.NetUtils
import
com.mints.library.utils.CommonUtils
import
com.mints.library.utils.CommonUtils
import
com.mints.library.utils.GlideUtils
import
com.mints.library.utils.GlideUtils
...
@@ -56,6 +58,7 @@ import kotlinx.android.synthetic.main.view_title.*
...
@@ -56,6 +58,7 @@ import kotlinx.android.synthetic.main.view_title.*
import
net.grandcentrix.tray.AppPreferences
import
net.grandcentrix.tray.AppPreferences
import
java.math.BigDecimal
import
java.math.BigDecimal
import
java.util.*
import
java.util.*
import
kotlin.concurrent.schedule
private
val
TAG
=
MyFragment
::
class
.
java
.
simpleName
private
val
TAG
=
MyFragment
::
class
.
java
.
simpleName
...
@@ -462,6 +465,8 @@ class MyFragment : BaseFragment(),
...
@@ -462,6 +465,8 @@ class MyFragment : BaseFragment(),
val
bundle
=
Bundle
()
val
bundle
=
Bundle
()
bundle
.
putInt
(
TaskActivity
.
TASK_COIN
,
taskBean
.
otherConfig
.
coin
)
bundle
.
putInt
(
TaskActivity
.
TASK_COIN
,
taskBean
.
otherConfig
.
coin
)
bundle
.
putInt
(
TaskActivity
.
TASK_USE_TIME
,
taskBean
.
otherConfig
.
needSeconds
)
bundle
.
putInt
(
TaskActivity
.
TASK_USE_TIME
,
taskBean
.
otherConfig
.
needSeconds
)
bundle
.
putInt
(
TaskActivity
.
TASK_USE_MAX
,
taskBean
.
otherConfig
.
max
)
bundle
.
putInt
(
TaskActivity
.
TASK_USE_COMPLETE
,
taskBean
.
otherConfig
.
complete
)
readyGo
(
TaskActivity
::
class
.
java
,
bundle
)
readyGo
(
TaskActivity
::
class
.
java
,
bundle
)
}
}
// 跳转高额视频
// 跳转高额视频
...
@@ -907,6 +912,8 @@ class MyFragment : BaseFragment(),
...
@@ -907,6 +912,8 @@ class MyFragment : BaseFragment(),
val
bundle
=
Bundle
()
val
bundle
=
Bundle
()
bundle
.
putInt
(
TaskActivity
.
TASK_COIN
,
listBean
.
otherConfig
.
coin
)
bundle
.
putInt
(
TaskActivity
.
TASK_COIN
,
listBean
.
otherConfig
.
coin
)
bundle
.
putInt
(
TaskActivity
.
TASK_USE_TIME
,
listBean
.
otherConfig
.
needSeconds
)
bundle
.
putInt
(
TaskActivity
.
TASK_USE_TIME
,
listBean
.
otherConfig
.
needSeconds
)
bundle
.
putInt
(
TaskActivity
.
TASK_USE_MAX
,
listBean
.
otherConfig
.
max
)
bundle
.
putInt
(
TaskActivity
.
TASK_USE_COMPLETE
,
listBean
.
otherConfig
.
complete
)
readyGo
(
TaskActivity
::
class
.
java
,
bundle
)
readyGo
(
TaskActivity
::
class
.
java
,
bundle
)
return
return
}
}
...
@@ -1306,4 +1313,20 @@ class MyFragment : BaseFragment(),
...
@@ -1306,4 +1313,20 @@ class MyFragment : BaseFragment(),
intentFilter
.
addAction
(
AppInstallService
.
APP_INSTALL_ACTION
)
intentFilter
.
addAction
(
AppInstallService
.
APP_INSTALL_ACTION
)
mContext
.
registerReceiver
(
this
.
mReceiverBroadcastReceiver
,
intentFilter
)
mContext
.
registerReceiver
(
this
.
mReceiverBroadcastReceiver
,
intentFilter
)
}
}
/**
* 坐标移动至每日任务
*/
fun
turnDayTask
()
{
if
(
signCardBean
!=
null
)
{
scrollviewMy
.
scrollTo
(
0
,
llMyRoot
.
height
-
viewTitleDayTask
.
height
)
return
}
Timer
().
schedule
(
800
)
{
activity
?.
runOnUiThread
{
scrollviewMy
.
scrollTo
(
0
,
llMyRoot
.
height
-
viewTitleDayTask
.
height
)
}
}
}
}
}
\ No newline at end of file
GoodMoney/app/src/main/java/com/mints/goodmoney/ui/fragment/PanFragment.kt
View file @
4e5583cc
package
com.mints.goodmoney.ui.fragment
package
com.mints.goodmoney.ui.fragment
import
android.os.Build
import
android.os.Bundle
import
android.os.Bundle
import
android.text.TextUtils
import
android.text.TextUtils
import
android.view.MotionEvent
import
android.view.MotionEvent
import
android.view.View
import
android.webkit.WebChromeClient
import
android.webkit.WebChromeClient
import
androidx.annotation.RequiresApi
import
com.component.dly.xzzq_ywsdk.YwSDK_WebActivity
import
com.github.lzyzsd.jsbridge.CallBackFunction
import
com.github.lzyzsd.jsbridge.CallBackFunction
import
com.github.lzyzsd.jsbridge.DefaultHandler
import
com.github.lzyzsd.jsbridge.DefaultHandler
import
com.mints.goodmoney.BuildConfig
import
com.mints.goodmoney.BuildConfig
...
@@ -11,12 +15,20 @@ import com.mints.goodmoney.R
...
@@ -11,12 +15,20 @@ import com.mints.goodmoney.R
import
com.mints.goodmoney.common.AppConfig
import
com.mints.goodmoney.common.AppConfig
import
com.mints.goodmoney.common.Constant
import
com.mints.goodmoney.common.Constant
import
com.mints.goodmoney.manager.UserManager
import
com.mints.goodmoney.manager.UserManager
import
com.mints.goodmoney.manager.YwhzManager
import
com.mints.goodmoney.mvp.model.PanActionInfo
import
com.mints.goodmoney.mvp.model.TurntableBean
import
com.mints.goodmoney.mvp.model.TurntableBean
import
com.mints.goodmoney.mvp.presenters.PanPresenter
import
com.mints.goodmoney.mvp.presenters.PanPresenter
import
com.mints.goodmoney.mvp.views.PanView
import
com.mints.goodmoney.mvp.views.PanView
import
com.mints.goodmoney.ui.activitys.AwardActivity
import
com.mints.goodmoney.ui.activitys.AwardActivity
import
com.mints.goodmoney.ui.activitys.MainActivity
import
com.mints.goodmoney.ui.activitys.TaskActivity
import
com.mints.goodmoney.ui.activitys.WxLoginActivity
import
com.mints.goodmoney.ui.fragment.base.BaseFragment
import
com.mints.goodmoney.ui.fragment.base.BaseFragment
import
com.mints.library.utils.json.JsonUtil
import
com.mints.library.utils.json.JsonUtil
import
com.xiangzi.articlesdk.callback.IXzArticleSdkInitCallback
import
com.xiangzi.articlesdk.core.XzArticleCoreImpl
import
com.xiangzi.articlesdk.exception.XzSdkException
import
kotlinx.android.synthetic.main.fragment_main_pan.*
import
kotlinx.android.synthetic.main.fragment_main_pan.*
/**
/**
...
@@ -28,13 +40,19 @@ class PanFragment : BaseFragment(), PanView {
...
@@ -28,13 +40,19 @@ class PanFragment : BaseFragment(), PanView {
private
val
panPresenter
by
lazy
{
PanPresenter
()
}
private
val
panPresenter
by
lazy
{
PanPresenter
()
}
private
val
userManager
by
lazy
{
UserManager
.
getInstance
()
}
private
val
userManager
by
lazy
{
UserManager
.
getInstance
()
}
private
var
isLoadPanSuc
=
false
// 是否加载大转盘成功
private
val
carrierType
=
Constant
.
CARRIER_CHALLENGE_TURN
private
val
carrierType
=
Constant
.
CARRIER_CHALLENGE_TURN
override
fun
getContentViewLayoutID
()
=
R
.
layout
.
fragment_main_pan
override
fun
getContentViewLayoutID
()
=
R
.
layout
.
fragment_main_pan
override
fun
initViewsAndEvents
()
{
override
fun
initViewsAndEvents
()
{
panPresenter
.
attachView
(
this
)
panPresenter
.
attachView
(
this
)
if
(!
TextUtils
.
isEmpty
(
userManager
.
userID
))
{
// 登录成功的用户初始化鱼丸盒子
if
(
userManager
.
userIsLogin
())
{
YwhzManager
.
init
(
baseApplication
)
}
}
}
}
override
fun
onHiddenChanged
(
hidden
:
Boolean
)
{
override
fun
onHiddenChanged
(
hidden
:
Boolean
)
{
...
@@ -72,9 +90,17 @@ class PanFragment : BaseFragment(), PanView {
...
@@ -72,9 +90,17 @@ class PanFragment : BaseFragment(), PanView {
*/
*/
private
fun
loadTurnUrl
()
{
private
fun
loadTurnUrl
()
{
getTurnUrl
()
getTurnUrl
()
blTurntableWebview
.
setOnTouchListener
{
_
,
event
->
event
.
action
==
MotionEvent
.
ACTION_MOVE
}
//
blTurntableWebview.setOnTouchListener { _, event -> event.action == MotionEvent.ACTION_MOVE }
blTurntableWebview
.
setDefaultHandler
(
DefaultHandler
())
blTurntableWebview
.
setDefaultHandler
(
DefaultHandler
())
blTurntableWebview
.
webChromeClient
=
WebChromeClient
()
blTurntableWebview
.
webChromeClient
=
WebChromeClient
()
// if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
// blTurntableWebview.setOnScrollChangeListener(
// object : View.OnScrollChangeListener {
// override fun onScrollChange(v: View?, scrollX: Int, scrollY: Int, oldScrollX: Int, oldScrollY: Int) {
// blTurntableWebview.scrollTo(0,scrollY)
// }
// })
// }
blTurntableWebview
.
setOnLongClickListener
{
true
}
blTurntableWebview
.
setOnLongClickListener
{
true
}
//注册监听方法当js中调用callHandler方法时会调用此方法(handlerName必须和js中相同)
//注册监听方法当js中调用callHandler方法时会调用此方法(handlerName必须和js中相同)
blTurntableWebview
.
registerHandler
(
"getTurnResult"
)
{
data
,
_
->
blTurntableWebview
.
registerHandler
(
"getTurnResult"
)
{
data
,
_
->
...
@@ -87,6 +113,9 @@ class PanFragment : BaseFragment(), PanView {
...
@@ -87,6 +113,9 @@ class PanFragment : BaseFragment(), PanView {
androidCallJsReferse
()
androidCallJsReferse
()
}
}
blTurntableWebview
.
registerHandler
(
"actionPageForType"
)
{
data
,
_
->
actionPageForType
(
data
)
}
blTurntableWebview
.
setDefaultHandler
(
object
:
DefaultHandler
()
{
blTurntableWebview
.
setDefaultHandler
(
object
:
DefaultHandler
()
{
override
fun
handler
(
data
:
String
,
function
:
CallBackFunction
)
{
override
fun
handler
(
data
:
String
,
function
:
CallBackFunction
)
{
showToast
(
data
)
showToast
(
data
)
...
@@ -94,12 +123,70 @@ class PanFragment : BaseFragment(), PanView {
...
@@ -94,12 +123,70 @@ class PanFragment : BaseFragment(), PanView {
})
})
}
}
private
fun
actionPageForType
(
data
:
String
?)
{
if
(
TextUtils
.
isEmpty
(
data
))
return
val
panActionInfo
:
PanActionInfo
=
JsonUtil
.
parseJson
(
data
,
PanActionInfo
::
class
.
java
)
//0-微转,1-珊瑚下载,2-分红,3-鱼丸盒子,4-每日任务
when
(
panActionInfo
.
actionType
)
{
0
->
{
if
(!
userManager
.
userIsLogin
())
{
readyGo
(
WxLoginActivity
::
class
.
java
)
return
}
shareArticle
(
panActionInfo
.
coin
)
}
1
->
{
if
(!
userManager
.
userIsLogin
())
{
readyGo
(
WxLoginActivity
::
class
.
java
)
return
}
val
bundle
=
Bundle
()
bundle
.
putInt
(
TaskActivity
.
TASK_COIN
,
panActionInfo
.
coin
)
bundle
.
putInt
(
TaskActivity
.
TASK_USE_TIME
,
panActionInfo
.
time
)
bundle
.
putInt
(
TaskActivity
.
TASK_USE_MAX
,
panActionInfo
.
max
)
bundle
.
putInt
(
TaskActivity
.
TASK_USE_COMPLETE
,
panActionInfo
.
complete
)
readyGo
(
TaskActivity
::
class
.
java
,
bundle
)
}
2
->
{
if
(!
userManager
.
userIsLogin
())
{
readyGo
(
WxLoginActivity
::
class
.
java
)
return
}
val
activity
:
MainActivity
?
=
activity
as
MainActivity
?
activity
?.
clickTab4Layout
()
}
3
->
{
if
(!
userManager
.
userIsLogin
())
{
readyGo
(
WxLoginActivity
::
class
.
java
)
return
}
try
{
activity
?.
let
{
YwSDK_WebActivity
.
open
(
it
)
}
}
catch
(
e
:
Exception
)
{
e
.
printStackTrace
()
showToast
(
"请重新退出账号登录"
)
}
}
4
->
{
val
activity
:
MainActivity
?
=
activity
as
MainActivity
?
activity
?.
let
{
it
.
turnDayTask
()
}
}
}
}
/**
/**
* 获取转盘url
* 获取转盘url
*/
*/
private
fun
getTurnUrl
()
{
private
fun
getTurnUrl
()
{
val
tokenID
=
userManager
.
tokenID
val
tokenID
=
userManager
.
tokenID
val
url
:
String
=
BuildConfig
.
MainIp
+
"turn/turn.html?carrierType="
+
carrierType
+
"&token="
+
tokenID
val
url
:
String
=
BuildConfig
.
MainIp
+
"turn/turn
WithInner
.html?carrierType="
+
carrierType
+
"&token="
+
tokenID
blTurntableWebview
.
loadUrl
(
url
)
blTurntableWebview
.
loadUrl
(
url
)
}
}
...
@@ -112,4 +199,27 @@ class PanFragment : BaseFragment(), PanView {
...
@@ -112,4 +199,27 @@ class PanFragment : BaseFragment(), PanView {
}
}
}
}
/**
* 分享文章
*/
private
fun
shareArticle
(
coin
:
Int
)
{
if
(
XzArticleCoreImpl
.
get
().
initIsSuccess
())
{
XzArticleCoreImpl
.
get
().
openArticleListActivity
(
requireActivity
())
}
else
{
try
{
XzArticleCoreImpl
.
get
().
initUser
(
userManager
.
userID
,
coin
.
toString
(),
"金币"
,
object
:
IXzArticleSdkInitCallback
{
override
fun
initSuccess
()
{
shareArticle
(
coin
)
}
override
fun
initFailed
(
errMsg
:
String
)
{
showToast
(
"初始化失败,请稍候重试~"
)
}
})
}
catch
(
e
:
XzSdkException
)
{
e
.
printStackTrace
()
}
}
}
}
}
\ No newline at end of file
GoodMoney/app/src/main/java/com/mints/goodmoney/ui/widgets/TaskDialog.kt
View file @
4e5583cc
...
@@ -58,9 +58,9 @@ class TaskDialog(context: Context) :
...
@@ -58,9 +58,9 @@ class TaskDialog(context: Context) :
fun
setData
(
data
:
CoralAD
,
seconds
:
Int
,
coin
:
Int
)
{
fun
setData
(
data
:
CoralAD
,
seconds
:
Int
,
coin
:
Int
)
{
tvText1
.
text
=
"下载并试玩$seconds"
+
"秒"
tvText1
.
text
=
"下载并试玩$seconds"
+
"秒"
tvText2
.
text
=
"+$coin"
+
"金币"
tvText2
.
text
=
"+$coin"
+
"金币"
tvTitle
.
text
=
data
.
description
tvTitle
.
text
=
data
.
title
GlideUtils
.
loadImageView
(
context
,
data
.
icon
,
ivAvatar
)
GlideUtils
.
loadImageView
(
context
,
data
.
icon
,
ivAvatar
)
tvInfo
.
text
=
data
.
title
tvInfo
.
text
=
data
.
description
adContainer
?.
setAdModel
(
data
)
adContainer
?.
setAdModel
(
data
)
}
}
...
...
GoodMoney/app/src/main/res/layout/fragment_main_my.xml
View file @
4e5583cc
...
@@ -21,6 +21,7 @@
...
@@ -21,6 +21,7 @@
android:layout_height=
"wrap_content"
/>
android:layout_height=
"wrap_content"
/>
<androidx.core.widget.NestedScrollView
<androidx.core.widget.NestedScrollView
android:id=
"@+id/scrollviewMy"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:overScrollMode=
"never"
>
android:overScrollMode=
"never"
>
...
@@ -30,6 +31,12 @@
...
@@ -30,6 +31,12 @@
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:orientation=
"vertical"
>
android:orientation=
"vertical"
>
<LinearLayout
android:id=
"@+id/llMyRoot"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:orientation=
"vertical"
>
<include
layout=
"@layout/item_fragment_main_my_title"
/>
<include
layout=
"@layout/item_fragment_main_my_title"
/>
<include
layout=
"@layout/item_fragment_main_my_clock"
/>
<include
layout=
"@layout/item_fragment_main_my_clock"
/>
...
@@ -49,7 +56,7 @@
...
@@ -49,7 +56,7 @@
<include
layout=
"@layout/item_divider_gray"
/>
<include
layout=
"@layout/item_divider_gray"
/>
<include
layout=
"@layout/view_title"
/>
<include
layout=
"@layout/view_title"
/>
</LinearLayout>
<androidx.recyclerview.widget.RecyclerView
<androidx.recyclerview.widget.RecyclerView
android:id=
"@+id/recy_my"
android:id=
"@+id/recy_my"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
...
...
GoodMoney/app/src/main/res/layout/item_task_recy.xml
View file @
4e5583cc
...
@@ -6,39 +6,52 @@
...
@@ -6,39 +6,52 @@
android:gravity=
"center_horizontal"
android:gravity=
"center_horizontal"
android:orientation=
"vertical"
>
android:orientation=
"vertical"
>
<ImageView
<com.tz.sdk.core.ui.ADContainer
android:id=
"@+id/item_iv_avatar"
android:id=
"@+id/ad_container"
android:layout_width=
"50dp"
android:layout_width=
"wrap_content"
android:layout_height=
"50dp"
android:layout_height=
"wrap_content"
>
android:layout_marginTop=
"10dp"
android:src=
"@mipmap/ic_launcher_main"
/>
<TextView
<LinearLayout
android:id=
"@+id/item_tv_title"
android:layout_width=
"wrap_content"
android:layout_width=
"80dp"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:gravity=
"center_horizontal"
android:layout_marginTop=
"10dp"
android:orientation=
"vertical"
>
android:ellipsize=
"end"
<ImageView
android:gravity=
"center_vertical"
android:id=
"@+id/item_iv_avatar"
android:lines=
"1"
android:layout_width=
"50dp"
android:maxLines=
"1"
/>
android:layout_height=
"50dp"
android:layout_marginTop=
"10dp"
android:src=
"@mipmap/ic_launcher_main"
/>
<TextView
<TextView
android:id=
"@+id/item_tv_coin"
android:id=
"@+id/item_tv_title"
android:layout_width=
"wrap_content"
android:layout_width=
"80dp"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"10dp"
android:layout_marginTop=
"10dp"
android:text=
"+300金币"
android:ellipsize=
"end"
android:textColor=
"@color/color_FF9837"
android:gravity=
"center_vertical"
android:textSize=
"18sp"
/>
android:lines=
"1"
android:maxLines=
"1"
/>
<TextView
<TextView
android:id=
"@+id/item_tv_text"
android:id=
"@+id/item_tv_coin"
android:layout_width=
"wrap_content"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"剩余99+份"
android:layout_marginTop=
"10dp"
android:textColor=
"@color/color_ccc"
android:text=
"+300金币"
android:textSize=
"12sp"
/>
android:textColor=
"@color/color_FF9837"
android:textSize=
"18sp"
/>
<TextView
android:id=
"@+id/item_tv_text"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"剩余99+份"
android:textColor=
"@color/color_ccc"
android:textSize=
"12sp"
/>
</LinearLayout>
</com.tz.sdk.core.ui.ADContainer>
<Button
<Button
android:id=
"@+id/item_btn_submit"
android:id=
"@+id/item_btn_submit"
...
...
GoodMoney/app/src/main/res/layout/view_title.xml
View file @
4e5583cc
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
android:id=
"@+id/viewTitleDayTask"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"50dp"
android:layout_height=
"50dp"
android:layout_marginStart=
"15dp"
android:layout_marginStart=
"15dp"
...
...
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