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
4b707ddc
Commit
4b707ddc
authored
Jan 22, 2021
by
jyx
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
圣安地CPD下载试玩任务
parent
218b2db6
Changes
25
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
25 changed files
with
1164 additions
and
121 deletions
+1164
-121
build.gradle
GoodMoney/app/build.gradle
+2
-2
InitAppService.kt
...y/app/src/main/java/com/mints/goodmoney/InitAppService.kt
+3
-0
Constant.kt
.../app/src/main/java/com/mints/goodmoney/common/Constant.kt
+4
-0
AppTryPlayManager.kt
...ain/java/com/mints/goodmoney/manager/AppTryPlayManager.kt
+6
-3
CpdManager.kt
...p/src/main/java/com/mints/goodmoney/manager/CpdManager.kt
+51
-2
BaseResponse.java
...main/java/com/mints/goodmoney/mvp/model/BaseResponse.java
+13
-0
CpdModelBean.java
...main/java/com/mints/goodmoney/mvp/model/CpdModelBean.java
+415
-0
TzTaskBean.java
...c/main/java/com/mints/goodmoney/mvp/model/TzTaskBean.java
+49
-10
HomePresenter.kt
.../java/com/mints/goodmoney/mvp/presenters/HomePresenter.kt
+26
-1
TaskPresenter.kt
.../java/com/mints/goodmoney/mvp/presenters/TaskPresenter.kt
+55
-5
TaskView.kt
...p/src/main/java/com/mints/goodmoney/mvp/views/TaskView.kt
+5
-1
CpdService.java
...app/src/main/java/com/mints/goodmoney/net/CpdService.java
+20
-6
DomainInterceptor.java
.../main/java/com/mints/goodmoney/net/DomainInterceptor.java
+80
-0
LoanService.java
...pp/src/main/java/com/mints/goodmoney/net/LoanService.java
+18
-0
AwardActivity.kt
...in/java/com/mints/goodmoney/ui/activitys/AwardActivity.kt
+5
-2
MainActivity.kt
...ain/java/com/mints/goodmoney/ui/activitys/MainActivity.kt
+1
-0
TaskActivity.kt
...ain/java/com/mints/goodmoney/ui/activitys/TaskActivity.kt
+154
-51
TaskAdapter.kt
...c/main/java/com/mints/goodmoney/ui/adapter/TaskAdapter.kt
+42
-15
MainFragment.kt
...main/java/com/mints/goodmoney/ui/fragment/MainFragment.kt
+1
-0
MyFragment.kt
...c/main/java/com/mints/goodmoney/ui/fragment/MyFragment.kt
+0
-4
IPUtil.java
...y/app/src/main/java/com/mints/goodmoney/utils/IPUtil.java
+122
-0
NetUtils.java
...c/main/java/com/mints/library/net/netstatus/NetUtils.java
+30
-0
activity_task.xml
GoodMoney/app/src/main/res/layout/activity_task.xml
+3
-17
item_task_recy.xml
GoodMoney/app/src/main/res/layout/item_task_recy.xml
+5
-2
item_task_recy_cpd.xml
GoodMoney/app/src/main/res/layout/item_task_recy_cpd.xml
+54
-0
No files found.
GoodMoney/app/build.gradle
View file @
4b707ddc
...
...
@@ -9,8 +9,8 @@ android {
applicationId
"com.mints.goodmoney"
minSdkVersion
rootProject
.
ext
.
androidMinSdkVersion
targetSdkVersion
rootProject
.
ext
.
androidTargetSdkVersion
versionCode
1
4
versionName
"1.1.
3
"
versionCode
1
5
versionName
"1.1.
4
"
flavorDimensions
"default"
// dex突破65535的限制
...
...
GoodMoney/app/src/main/java/com/mints/goodmoney/InitAppService.kt
View file @
4b707ddc
...
...
@@ -9,9 +9,11 @@ import cn.jpush.android.api.JPushInterface
import
com.downloader.PRDownloader
import
com.downloader.PRDownloaderConfig
import
com.mints.goodmoney.manager.BxmManager.initBxm
import
com.mints.goodmoney.net.LoanService
import
com.mob.MobSDK
import
com.tencent.mm.opensdk.openapi.WXAPIFactory
import
com.xiangzi.articlesdk.XzArticleSdk
import
okhttp3.HttpUrl.Companion.toHttpUrlOrNull
/**
* 子线程初始化SDK
...
...
@@ -69,6 +71,7 @@ class InitAppService : IntentService("InitializeService") {
// PR下载附件
initPRDownloader
()
}
/**
...
...
GoodMoney/app/src/main/java/com/mints/goodmoney/common/Constant.kt
View file @
4b707ddc
...
...
@@ -130,6 +130,7 @@ object Constant {
const
val
CARRIER_HIGH_ACTIVITY
=
"HIGH_ACTIVITY"
//高额任务
const
val
CARRIER_SHARE_NEWS
=
"SHARE_NEWS"
//分享新闻
const
val
CARRIER_CPD
=
"CPD"
//珊瑚CPD下载试玩任务
const
val
CARRIER_CPD_SYD
=
"CPD_SYD"
//SYDCPD下载试玩任务
const
val
CHALLENGE_SHAREFRIEND
=
"CHALLENGE_SHAREFRIEND"
//邀请好友
...
...
@@ -228,4 +229,7 @@ object Constant {
// 高额任务分享包名变量存储
const
val
HIGH_TASK_PKG_NAME
=
"high_task_pkg_name"
// 外网IP地址
const
val
OUT_NET_IP
=
"out_net_ip"
}
GoodMoney/app/src/main/java/com/mints/goodmoney/manager/AppTryPlayManager.kt
View file @
4b707ddc
package
com.mints.goodmoney.manager
import
android.app.Activity
import
android.content.Context
import
android.view.View
import
com.mints.goodmoney.MintsApplication
...
...
@@ -8,6 +9,7 @@ import com.mints.goodmoney.ui.widgets.CustomDialogAsApple
import
com.mints.goodmoney.ui.widgets.DialogListener
import
com.mints.goodmoney.utils.AppUtil
import
com.mints.goodmoney.utils.LogUtil
import
java.lang.ref.WeakReference
/**
* APP试玩管理类
...
...
@@ -30,8 +32,9 @@ object AppTryPlayManager {
/**
* 打开应用使用记录授权弹框
*/
fun
openAppUsageStats
(
context
:
Context
)
{
cdaa
=
CustomDialogAsApple
(
context
,
object
:
DialogListener
()
{
fun
openAppUsageStats
(
activity
:
Activity
)
{
val
weakReference
=
WeakReference
<
Activity
>(
activity
)
cdaa
=
CustomDialogAsApple
(
weakReference
.
get
(),
object
:
DialogListener
()
{
override
fun
onClick
(
v
:
View
)
{
if
(
cdaa
!=
null
&&
cdaa
!!
.
isShowing
)
{
cdaa
!!
.
dismiss
()
...
...
@@ -42,7 +45,7 @@ object AppTryPlayManager {
}
R
.
id
.
dialog_btn_right
->
{
cdaa
!!
.
dismiss
()
AppUtil
.
openUsageStats
(
c
ontext
)
AppUtil
.
openUsageStats
(
weakReference
.
get
()
as
C
ontext
)
}
}
}
...
...
GoodMoney/app/src/main/java/com/mints/goodmoney/manager/CpdManager.kt
View file @
4b707ddc
package
com.mints.goodmoney.manager
import
com.mints.goodmoney.MintsApplication
import
com.mints.goodmoney.common.DeviceInfo
import
com.mints.goodmoney.net.CpdService
import
com.mints.goodmoney.utils.MD5
import
com.mints.library.net.netstatus.NetUtils
import
okhttp3.MediaType.Companion.toMediaTypeOrNull
import
okhttp3.RequestBody
import
org.json.JSONException
import
org.json.JSONObject
/**
* Cpd下载
*/
object
CpdManager
{
const
val
BUSINESS_ID
=
"guest"
const
val
TOKEN
=
"00000000000000000000000000000000"
const
val
BUSINESS_ID
=
"m8908"
const
val
KEY
=
"sywnTAWBilog6LYancoe8wQFxK070X7B"
fun
getCpdUrl
():
String
{
val
currentTimeMillis
=
System
.
currentTimeMillis
().
toString
()
val
token
=
MD5
.
GetMD5Code
(
BUSINESS_ID
+
KEY
+
currentTimeMillis
)
// token=MD5(id + apikey+ timestamp)
return
CpdService
.
CPD_IP
+
"?businessId="
+
BUSINESS_ID
+
"&token="
+
token
+
"×tamp="
+
currentTimeMillis
}
fun
getCpdBody
(
ip
:
String
):
RequestBody
{
val
deviceInfo
=
DeviceInfo
.
instance
val
param
=
JSONObject
()
val
application
=
JSONObject
()
val
equipment
=
JSONObject
()
try
{
application
.
put
(
"app_pkg_name"
,
"com.mints.goodmoney"
)
application
.
put
(
"app_ver_code"
,
deviceInfo
.
versionCode
)
application
.
put
(
"app_ver_name"
,
deviceInfo
.
versionName
)
// 设备类型 4-手机
equipment
.
put
(
"type"
,
"4"
)
// 系统类型 1:android
equipment
.
put
(
"os_type"
,
"1"
)
equipment
.
put
(
"android_id"
,
deviceInfo
.
androidId
)
equipment
.
put
(
"imei"
,
deviceInfo
.
iMEI
)
equipment
.
put
(
"mac"
,
deviceInfo
.
getMacAddress
())
equipment
.
put
(
"net_type"
,
NetUtils
.
getNetworkStateForCpd
(
MintsApplication
.
getContext
()))
equipment
.
put
(
"ip"
,
ip
)
equipment
.
put
(
"brand"
,
deviceInfo
.
brand
)
equipment
.
put
(
"model"
,
deviceInfo
.
mobileModel
)
param
.
put
(
"application"
,
application
)
param
.
put
(
"equipment"
,
equipment
)
}
catch
(
e
:
JSONException
)
{
e
.
printStackTrace
()
}
return
RequestBody
.
create
(
"application/json"
.
toMediaTypeOrNull
(),
param
.
toString
())
}
}
\ No newline at end of file
GoodMoney/app/src/main/java/com/mints/goodmoney/mvp/model/BaseResponse.java
View file @
4b707ddc
...
...
@@ -15,11 +15,24 @@ public class BaseResponse<T> implements Serializable {
*/
private
int
status
;
/**
* 状态码
*/
private
int
code
;
/**
* 内容
*/
private
String
message
=
""
;
public
int
getCode
()
{
return
code
;
}
public
void
setCode
(
int
code
)
{
this
.
code
=
code
;
}
/**
* 结果
*/
...
...
GoodMoney/app/src/main/java/com/mints/goodmoney/mvp/model/CpdModelBean.java
0 → 100644
View file @
4b707ddc
This diff is collapsed.
Click to expand it.
GoodMoney/app/src/main/java/com/mints/goodmoney/mvp/model/TzTaskBean.java
View file @
4b707ddc
package
com
.
mints
.
goodmoney
.
mvp
.
model
;
import
com.tz.sdk.coral.ad.CoralAD
;
public
class
TzTaskBean
{
private
String
icon
;
private
String
title
;
private
String
app_url
;
private
boolean
isShCpd
;
private
CoralAD
coralAd
;
private
CpdModelBean
.
DataBean
.
MaterialsBean
.
TrackerBean
trackerBean
;
private
int
coin
;
private
int
state
;
private
String
currentPkgName
;
public
TzTaskBean
(
String
icon
,
String
title
,
boolean
isShCpd
,
int
coin
,
int
state
,
String
currentPkgName
)
{
this
.
icon
=
icon
;
this
.
title
=
title
;
this
.
isShCpd
=
isShCpd
;
this
.
coralAd
=
coralAd
;
this
.
coin
=
coin
;
this
.
state
=
state
;
this
.
currentPkgName
=
currentPkgName
;
}
public
CoralAD
getCoralAd
()
{
return
coralAd
;
}
public
String
getApp_url
()
{
return
app_url
;
}
public
void
setApp_url
(
String
app_url
)
{
this
.
app_url
=
app_url
;
}
public
CpdModelBean
.
DataBean
.
MaterialsBean
.
TrackerBean
getTrackerBean
()
{
return
trackerBean
;
}
public
void
setTrackerBean
(
CpdModelBean
.
DataBean
.
MaterialsBean
.
TrackerBean
trackerBean
)
{
this
.
trackerBean
=
trackerBean
;
}
public
void
setCoralAd
(
CoralAD
coralAd
)
{
this
.
coralAd
=
coralAd
;
}
public
int
getCoin
()
{
return
coin
;
...
...
@@ -13,10 +56,6 @@ public class TzTaskBean {
this
.
coin
=
coin
;
}
private
int
coin
;
private
int
state
;
private
String
currentPkgName
;
public
String
getIcon
()
{
return
icon
;
}
...
...
@@ -25,12 +64,12 @@ public class TzTaskBean {
this
.
icon
=
icon
;
}
public
TzTaskBean
(
String
icon
,
String
title
,
int
coin
,
int
state
,
String
currentPkgName
)
{
this
.
icon
=
icon
;
this
.
title
=
title
;
this
.
coin
=
coin
;
this
.
state
=
state
;
this
.
currentPkgName
=
currentPkgName
;
public
boolean
isShCpd
(
)
{
return
isShCpd
;
}
public
void
setShCpd
(
boolean
shCpd
)
{
isShCpd
=
shCpd
;
}
public
String
getTitle
()
{
...
...
GoodMoney/app/src/main/java/com/mints/goodmoney/mvp/presenters/HomePresenter.kt
View file @
4b707ddc
...
...
@@ -2,14 +2,20 @@ package com.mints.goodmoney.mvp.presenters
import
android.text.TextUtils
import
com.mints.goodmoney.MintsApplication
import
com.mints.goodmoney.common.Constant
import
com.mints.goodmoney.common.DeviceInfo
import
com.mints.goodmoney.manager.*
import
com.mints.goodmoney.manager.AppHttpManager
import
com.mints.goodmoney.manager.ShumeiManager
import
com.mints.goodmoney.manager.UserManager
import
com.mints.goodmoney.mvp.model.BaseResponse
import
com.mints.goodmoney.mvp.model.MainVideoMsgBean
import
com.mints.goodmoney.mvp.model.UserBean
import
com.mints.goodmoney.mvp.model.UserTaskMsgBean
import
com.mints.goodmoney.mvp.views.HomeView
import
com.mints.goodmoney.utils.DeviceUuidFactory
import
com.mints.goodmoney.utils.IPUtil
import
com.mints.goodmoney.utils.LogUtil
import
com.mints.goodmoney.utils.SPUtil
import
com.mints.library.net.neterror.BaseSubscriber
import
com.mints.library.net.neterror.Throwable
import
net.grandcentrix.tray.AppPreferences
...
...
@@ -190,4 +196,23 @@ class HomePresenter : BasePresenter<HomeView>() {
})
}
/**
* 获取外网ip地址
*/
fun
getNetWorkIp
()
{
if
(
loanApplication
==
null
)
{
return
}
val
spUtil
=
SPUtil
.
getInstance
(
loanApplication
)
if
(
spUtil
.
getString
(
Constant
.
OUT_NET_IP
).
isEmpty
())
{
Thread
{
val
outNetIp
:
String
?
=
IPUtil
.
getOutNetIp
()
if
(
outNetIp
!=
null
)
{
LogUtil
.
d
(
"AA -> "
+
outNetIp
)
spUtil
.
putString
(
Constant
.
OUT_NET_IP
,
outNetIp
)
}
}.
start
()
}
}
}
\ No newline at end of file
GoodMoney/app/src/main/java/com/mints/goodmoney/mvp/presenters/TaskPresenter.kt
View file @
4b707ddc
package
com.mints.goodmoney.mvp.presenters
import
com.google.gson.Gson
import
com.google.gson.JsonObject
import
com.mints.goodmoney.manager.AppHttpManager
import
com.mints.goodmoney.manager.CpdManager
import
com.mints.goodmoney.mvp.model.BaseResponse
import
com.mints.goodmoney.mvp.model.CpdModelBean
import
com.mints.goodmoney.mvp.views.TaskView
import
com.mints.goodmoney.net.CpdService
import
com.mints.goodmoney.utils.LogUtil
import
com.mints.library.net.neterror.BaseSubscriber
import
com.mints.library.net.neterror.Throwable
class
TaskPresenter
:
BasePresenter
<
TaskView
>()
{
fun
getShCpdTime
()
{
view
.
showLoading
(
"加载中..."
)
AppHttpManager
.
getInstance
(
loanApplication
)
.
call
(
loanService
.
getShCpdTime
()
,
.
call
(
loanService
.
shCpdTime
,
object
:
BaseSubscriber
<
BaseResponse
<
JsonObject
>>()
{
override
fun
onCompleted
()
{
}
...
...
@@ -21,13 +27,13 @@ class TaskPresenter : BasePresenter<TaskView>() {
override
fun
onNext
(
baseResponse
:
BaseResponse
<
JsonObject
>)
{
if
(
isLinkView
)
return
val
code
=
baseResponse
.
getStatus
()
val
message
=
baseResponse
.
getMessage
()
val
code
=
baseResponse
.
status
val
message
=
baseResponse
.
message
val
data
=
baseResponse
.
data
when
(
code
)
{
200
->{
200
->
{
if
(
data
!=
null
)
{
view
.
getShCpdTimeSuc
(
data
.
get
(
"needSeconds"
).
asInt
)
view
.
getShCpdTimeSuc
(
data
.
get
(
"needSeconds"
).
asInt
,
data
.
get
(
"CPD"
).
asInt
,
data
.
get
(
"CPD_SYD"
).
asInt
)
}
}
else
->
view
.
showToast
(
message
)
...
...
@@ -36,4 +42,48 @@ class TaskPresenter : BasePresenter<TaskView>() {
})
}
fun
cmtImp
(
url
:
String
)
{
AppHttpManager
.
getInstance
(
loanApplication
)
.
call
(
CpdService
.
Factory
.
getInstance
().
cmtImp
(
url
),
object
:
BaseSubscriber
<
BaseResponse
<
JsonObject
>>()
{
override
fun
onCompleted
()
{
}
override
fun
onError
(
e
:
Throwable
)
{
}
override
fun
onNext
(
baseResponse
:
BaseResponse
<
JsonObject
>)
{
if
(
isLinkView
)
return
}
})
}
fun
getCpdDetail
(
ip
:
String
)
{
AppHttpManager
.
getInstance
(
loanApplication
)
.
call
(
CpdService
.
Factory
.
getInstance
().
getAdVedio
(
CpdManager
.
getCpdUrl
(),
CpdManager
.
getCpdBody
(
ip
)),
object
:
BaseSubscriber
<
JsonObject
>()
{
override
fun
onCompleted
()
{
}
override
fun
onError
(
e
:
Throwable
)
{
LogUtil
.
d
(
e
.
code
)
}
override
fun
onNext
(
t
:
JsonObject
?)
{
if
(
isLinkView
)
return
val
gson
=
Gson
()
val
response
=
gson
.
fromJson
<
CpdModelBean
>(
t
.
toString
(),
CpdModelBean
::
class
.
java
)
if
(
response
.
code
==
0
)
{
val
data
=
response
.
data
if
(
data
!=
null
)
{
view
.
getCpdModelSuc
(
data
)
}
}
else
{
view
.
showToast
(
response
.
message
)
}
}
})
}
}
\ No newline at end of file
GoodMoney/app/src/main/java/com/mints/goodmoney/mvp/views/TaskView.kt
View file @
4b707ddc
package
com.mints.goodmoney.mvp.views
import
com.mints.goodmoney.mvp.model.CpdModelBean
interface
TaskView
:
BaseView
{
fun
getShCpdTimeSuc
(
time
:
Int
)
fun
getShCpdTimeSuc
(
time
:
Int
,
CPD
:
Int
,
CPD_SYD
:
Int
)
fun
getCpdModelSuc
(
dataBean
:
CpdModelBean
.
DataBean
)
}
\ No newline at end of file
GoodMoney/app/src/main/java/com/mints/goodmoney/net/CpdService.java
View file @
4b707ddc
...
...
@@ -3,13 +3,13 @@ package com.mints.goodmoney.net;
import
android.text.TextUtils
;
import
com.google.gson.JsonObject
;
import
com.mints.goodmoney.BuildConfig
;
import
com.orhanobut.logger.Logger
;
import
java.util.Map
;
import
java.util.concurrent.TimeUnit
;
import
okhttp3.OkHttpClient
;
import
okhttp3.RequestBody
;
import
okhttp3.logging.HttpLoggingInterceptor
;
import
retrofit2.Retrofit
;
import
retrofit2.adapter.rxjava.RxJavaCallAdapterFactory
;
...
...
@@ -26,15 +26,15 @@ import rx.Observable;
*/
public
interface
CpdService
{
String
CPD_IP
=
"http://api.musesmobi.com:8111/"
;
//测试
String
CPD_IP
=
"http://api.musesmobi.com:8111/
api/cpd/1/detail/default/
"
;
//测试
/**
* 请求广告
*
* @return
*/
@POST
(
"api/cpd/1/detail/default"
)
Observable
<
Object
>
getAdVedio
(
@Body
Map
<
String
,
Object
>
vo
);
@POST
Observable
<
JsonObject
>
getAdVedio
(
@Url
String
url
,
@Body
RequestBody
requestBody
);
/**
* 提交监测
...
...
@@ -45,7 +45,21 @@ public interface CpdService {
Observable
<
Object
>
cmtImp
(
@Url
String
url
);
class
Factory
{
public
static
CpdService
create
()
{
private
Factory
()
{
}
private
static
CpdService
sCpdService
;
public
static
CpdService
getInstance
()
{
if
(
sCpdService
==
null
)
{
return
sCpdService
=
create
();
}
else
{
return
sCpdService
;
}
}
private
static
CpdService
create
()
{
OkHttpClient
.
Builder
builder
=
new
OkHttpClient
.
Builder
();
builder
.
retryOnConnectionFailure
(
false
);
...
...
GoodMoney/app/src/main/java/com/mints/goodmoney/net/DomainInterceptor.java
0 → 100644
View file @
4b707ddc
package
com
.
mints
.
goodmoney
.
net
;
import
android.text.TextUtils
;
import
com.mints.goodmoney.utils.LogUtil
;
import
java.io.IOException
;
import
java.util.List
;
import
okhttp3.HttpUrl
;
import
okhttp3.Interceptor
;
import
okhttp3.Request
;
import
okhttp3.Response
;
class
DomainInterceptor
implements
Interceptor
{
public
static
final
String
DOMAIN_NAME
=
"domain_name"
;
@Override
public
Response
intercept
(
Chain
chain
)
throws
IOException
{
return
chain
.
proceed
(
processRequest
(
chain
.
request
()));
}
private
Request
processRequest
(
Request
request
)
{
if
(
request
==
null
)
return
null
;
Request
.
Builder
newBuilder
=
request
.
newBuilder
();
// 是否有切换标识
String
domain_name
=
obtainDomainNameFromHeaders
(
request
);
HttpUrl
domain_url
;
if
(!
TextUtils
.
isEmpty
(
domain_name
))
{
domain_url
=
LoanService
.
Factory
.
sDomainHostUrl
.
get
(
domain_name
);
// 删除标识header
newBuilder
.
removeHeader
(
DOMAIN_NAME
);
// 更改httpUrl
if
(
null
!=
domain_url
)
{
HttpUrl
httpUrl
=
request
.
url
()
.
newBuilder
()
.
scheme
(
domain_url
.
scheme
())
.
host
(
domain_url
.
host
())
.
port
(
domain_url
.
port
())
.
build
();
if
(
httpUrl
.
url
().
toString
().
contains
(
"api-gm"
))
{
String
replaceUrl
=
httpUrl
.
url
().
toString
().
replace
(
"/api-gm"
,
""
);
return
newBuilder
.
url
(
replaceUrl
)
.
build
();
}
return
newBuilder
.
url
(
httpUrl
.
url
())
.
build
();
}
}
return
newBuilder
.
build
();
}
/**
* @return DomainName
*/
public
static
String
obtainDomainNameFromHeaders
(
Request
request
)
{
List
<
String
>
headers
=
request
.
headers
(
DOMAIN_NAME
);
if
(
headers
.
size
()
==
0
)
return
null
;
if
(
headers
.
size
()
>
1
)
throw
new
IllegalArgumentException
(
"Only one Domain-Name in the headers"
);
return
request
.
header
(
DOMAIN_NAME
);
}
}
GoodMoney/app/src/main/java/com/mints/goodmoney/net/LoanService.java
View file @
4b707ddc
...
...
@@ -28,14 +28,18 @@ import com.mints.goodmoney.mvp.model.XmlyUnlockBean;
import
com.mints.goodmoney.utils.AESUtils
;
import
com.orhanobut.logger.Logger
;
import
java.util.HashMap
;
import
java.util.Map
;
import
java.util.concurrent.TimeUnit
;
import
okhttp3.HttpUrl
;
import
okhttp3.OkHttpClient
;
import
okhttp3.logging.HttpLoggingInterceptor
;
import
retrofit2.Retrofit
;
import
retrofit2.adapter.rxjava.RxJavaCallAdapterFactory
;
import
retrofit2.http.Body
;
import
retrofit2.http.HeaderMap
;
import
retrofit2.http.Headers
;
import
retrofit2.http.POST
;
import
retrofit2.http.Url
;
import
rx.Observable
;
...
...
@@ -543,10 +547,22 @@ public interface LoanService {
@POST
(
"common/commonMainMsg"
)
Observable
<
BaseResponse
<
CommonParamBean
>>
getCommonHallBaseMsg
(
@Body
Map
<
String
,
Object
>
vo
);
/**
* 获取用户配置信息
*
* @return
*/
// @Headers({"domain_name: domain_musesmobi"})
@POST
(
"api/cpd/1/detail/default"
)
Observable
<
BaseResponse
<
JsonObject
>>
getCpdDetail
(
@HeaderMap
Map
<
String
,
String
>
headers
,
@Body
Map
<
String
,
Object
>
vo
);
/**
* 默认http工厂
*/
class
Factory
{
public
static
Map
<
String
,
HttpUrl
>
sDomainHostUrl
=
new
HashMap
<>();
public
static
LoanService
create
()
{
OkHttpClient
.
Builder
builder
=
new
OkHttpClient
.
Builder
();
...
...
@@ -579,7 +595,9 @@ public interface LoanService {
builder
.
interceptors
().
add
(
logging
);
}
DomainInterceptor
domainInterceptor
=
new
DomainInterceptor
();
OkHttpInterceptor
okHttpInterceptor
=
new
OkHttpInterceptor
(
AESUtils
.
getDefaultKey
());
builder
.
interceptors
().
add
(
domainInterceptor
);
builder
.
interceptors
().
add
(
okHttpInterceptor
);
Retrofit
retrofit
=
new
Retrofit
.
Builder
()
...
...
GoodMoney/app/src/main/java/com/mints/goodmoney/ui/activitys/AwardActivity.kt
View file @
4b707ddc
...
...
@@ -160,6 +160,8 @@ class AwardActivity : BaseActivity(), AwardView, View.OnClickListener {
Utils
.
hideBottomUIMenu
(
this
)
// 开启3秒倒计时
startTime
()
// 第一次进来上送友盟
pushUmengEvent
()
}
...
...
@@ -453,11 +455,12 @@ class AwardActivity : BaseActivity(), AwardView, View.OnClickListener {
Constant
.
CARRIER_CHALLENGE_TURN
,
Constant
.
CARRIER_CHALLENGE_CARD
,
Constant
.
CARRIER_WALK_BUBBLE
,
Constant
.
CARRIER_EATMEAL_SUBSIDY
,
Constant
.
CARRIER_WALK
,
Constant
.
CARRIER_HOMEWATER
->
{
pushUmengEvent
()
awardVideo
()
}
Constant
.
CARRIER_BLESSINGBAG_DOUBLE
,
Constant
.
CARRIER_CHALLENGE_SHAREFRIEND_DOUBLE
,
Constant
.
CARRIER_HOMEVEDIO_DOUBLE
,
Constant
.
CARRIER_SMALLHOMEVEDIO_DOUBLE
,
Constant
.
CARRIER_RUISHINEWS_DOUBLE
->
{
Constant
.
CARRIER_HOMEVEDIO_DOUBLE
,
Constant
.
CARRIER_SMALLHOMEVEDIO_DOUBLE
,
Constant
.
CARRIER_RUISHINEWS_DOUBLE
->
{
// 翻倍载体上送友盟
pushUmengEvent
()
awardVideo
()
}
...
...
GoodMoney/app/src/main/java/com/mints/goodmoney/ui/activitys/MainActivity.kt
View file @
4b707ddc
...
...
@@ -18,6 +18,7 @@ import com.mints.goodmoney.manager.ZhangyueManager
import
com.mints.goodmoney.mvp.views.MainView
import
com.mints.goodmoney.ui.activitys.base.BaseActivity
import
com.mints.goodmoney.ui.fragment.*
import
com.mints.goodmoney.utils.IPUtil
import
kotlinx.android.synthetic.main.activity_main.*
/**
...
...
GoodMoney/app/src/main/java/com/mints/goodmoney/ui/activitys/TaskActivity.kt
View file @
4b707ddc
This diff is collapsed.
Click to expand it.
GoodMoney/app/src/main/java/com/mints/goodmoney/ui/adapter/TaskAdapter.kt
View file @
4b707ddc
...
...
@@ -13,37 +13,51 @@ import com.mints.goodmoney.mvp.model.TzTaskBean
import
com.mints.goodmoney.ui.adapter.listener.OnItemChildClickListener
import
com.mints.goodmoney.ui.adapter.listener.OnItemClickListener
import
com.mints.library.utils.GlideUtils
import
com.tz.sdk.coral.ad.CoralAD
import
com.tz.sdk.core.ui.ADContainer
import
java.lang.ref.WeakReference
class
TaskAdapter
(
val
dataList
:
List
<
TzTaskBean
>,
val
taskList
:
List
<
CoralAD
>,
val
context
:
Context
)
:
RecyclerView
.
Adapter
<
TaskAdapter
.
ViewHolder
>()
{
class
TaskAdapter
(
val
dataList
:
List
<
TzTaskBean
>,
val
context
:
Context
)
:
RecyclerView
.
Adapter
<
RecyclerView
.
ViewHolder
>()
{
private
var
mCurrentPosition
=
0
lateinit
var
mOnItemClickListener
:
OnItemClickListener
lateinit
var
mOnItemChildClickListener
:
OnItemChildClickListener
inner
class
ViewHolder
(
view
:
View
)
:
RecyclerView
.
ViewHolder
(
view
)
{
val
ivAvatar
:
ImageView
=
view
.
findViewById
(
R
.
id
.
item_iv_avatar
)
val
tvTitle
:
TextView
=
view
.
findViewById
(
R
.
id
.
item_tv_title
)
val
tvCoin
:
TextView
=
view
.
findViewById
(
R
.
id
.
item_tv_coin
)
val
adContainer
:
ADContainer
=
view
.
findViewById
(
R
.
id
.
ad_container
)
val
btnSubmit
:
Button
=
view
.
findViewById
(
R
.
id
.
item_btn_submit
)
companion
object
{
const
val
HOLDER_TYPE_SH_CPD
=
0
const
val
HOLDER_TYPE_CPD
=
1
}
override
fun
onCreateViewHolder
(
parent
:
ViewGroup
,
viewType
:
Int
):
ViewHolder
{
val
view
=
LayoutInflater
.
from
(
context
).
inflate
(
R
.
layout
.
item_task_recy
,
parent
,
false
)
return
ViewHolder
(
view
)
override
fun
getItemViewType
(
position
:
Int
):
Int
{
if
(
dataList
[
position
].
isShCpd
)
{
return
HOLDER_TYPE_SH_CPD
}
return
HOLDER_TYPE_CPD
}
override
fun
onBindViewHolder
(
holder
:
ViewHolder
,
position
:
Int
)
{
override
fun
onCreateViewHolder
(
parent
:
ViewGroup
,
viewType
:
Int
):
RecyclerView
.
ViewHolder
{
if
(
viewType
==
HOLDER_TYPE_SH_CPD
)
{
// AdContainer 可能引起内存泄漏
val
weakReference
=
WeakReference
<
Context
>(
context
)
val
view
=
LayoutInflater
.
from
(
weakReference
.
get
()).
inflate
(
R
.
layout
.
item_task_recy
,
parent
,
false
)
return
SHViewHolder
(
view
)
}
val
view
=
LayoutInflater
.
from
(
context
).
inflate
(
R
.
layout
.
item_task_recy_cpd
,
parent
,
false
)
return
CPDViewHolder
(
view
)
}
override
fun
onBindViewHolder
(
viewHolder
:
RecyclerView
.
ViewHolder
,
position
:
Int
)
{
val
data
=
dataList
[
position
]
val
task
=
taskList
[
position
]
if
(
viewHolder
is
SHViewHolder
)
{
viewHolder
.
adContainer
.
setAdModel
(
data
.
coralAd
)
}
val
holder
=
viewHolder
as
BaseViewHolder
GlideUtils
.
loadImageView
(
context
,
data
.
icon
,
holder
.
ivAvatar
)
holder
.
tvTitle
.
text
=
data
.
title
holder
.
tvCoin
.
text
=
"+"
+
data
.
coin
+
"金币"
holder
.
adContainer
.
setAdModel
(
task
)
when
(
data
.
state
)
{
0
->
{
holder
.
btnSubmit
.
text
=
"立即下载"
...
...
@@ -75,7 +89,7 @@ class TaskAdapter(val dataList: List<TzTaskBean>, val taskList: List<CoralAD>, v
setPosition
(
position
)
mOnItemChildClickListener
.
onItemChildClick
(
it
,
position
)
}
}
else
{
}
else
{
holder
.
btnSubmit
.
setOnClickListener
(
null
)
}
}
...
...
@@ -97,4 +111,17 @@ class TaskAdapter(val dataList: List<TzTaskBean>, val taskList: List<CoralAD>, v
}
override
fun
getItemCount
()
=
dataList
.
size
inner
class
SHViewHolder
(
view
:
View
)
:
BaseViewHolder
(
view
)
{
val
adContainer
:
ADContainer
=
view
.
findViewById
(
R
.
id
.
ad_container
)
}
inner
class
CPDViewHolder
(
view
:
View
)
:
BaseViewHolder
(
view
)
open
class
BaseViewHolder
(
view
:
View
)
:
RecyclerView
.
ViewHolder
(
view
)
{
val
ivAvatar
:
ImageView
=
view
.
findViewById
(
R
.
id
.
item_iv_avatar
)
val
tvTitle
:
TextView
=
view
.
findViewById
(
R
.
id
.
item_tv_title
)
val
tvCoin
:
TextView
=
view
.
findViewById
(
R
.
id
.
item_tv_coin
)
val
btnSubmit
:
Button
=
view
.
findViewById
(
R
.
id
.
item_btn_submit
)
}
}
\ No newline at end of file
GoodMoney/app/src/main/java/com/mints/goodmoney/ui/fragment/MainFragment.kt
View file @
4b707ddc
...
...
@@ -112,6 +112,7 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener {
private
fun
innerApp
()
{
if
(
userManager
.
userIsLogin
())
{
homePresenter
.
getNetWorkIp
()
TrackManager
.
getInstance
().
innerApp
()
}
}
...
...
GoodMoney/app/src/main/java/com/mints/goodmoney/ui/fragment/MyFragment.kt
View file @
4b707ddc
...
...
@@ -464,8 +464,6 @@ class MyFragment : BaseFragment(),
val
bundle
=
Bundle
()
bundle
.
putInt
(
TaskActivity
.
TASK_COIN
,
taskBean
.
otherConfig
.
coin
)
bundle
.
putInt
(
TaskActivity
.
TASK_USE_MAX
,
taskBean
.
otherConfig
.
max
)
bundle
.
putInt
(
TaskActivity
.
TASK_USE_COMPLETE
,
taskBean
.
otherConfig
.
complete
)
readyGo
(
TaskActivity
::
class
.
java
,
bundle
)
}
// 跳转高额视频
...
...
@@ -910,8 +908,6 @@ class MyFragment : BaseFragment(),
if
(
listBean
.
baseConfig
.
taskId
==
MainMyAdapter
.
TO_SHARE_NEWS
)
{
val
bundle
=
Bundle
()
bundle
.
putInt
(
TaskActivity
.
TASK_COIN
,
listBean
.
otherConfig
.
coin
)
bundle
.
putInt
(
TaskActivity
.
TASK_USE_MAX
,
listBean
.
otherConfig
.
max
)
bundle
.
putInt
(
TaskActivity
.
TASK_USE_COMPLETE
,
listBean
.
otherConfig
.
complete
)
readyGo
(
TaskActivity
::
class
.
java
,
bundle
)
return
}
...
...
GoodMoney/app/src/main/java/com/mints/goodmoney/utils/IPUtil.java
0 → 100644
View file @
4b707ddc
package
com
.
mints
.
goodmoney
.
utils
;
import
org.json.JSONException
;
import
org.json.JSONObject
;
import
java.io.BufferedReader
;
import
java.io.InputStream
;
import
java.io.InputStreamReader
;
import
java.net.HttpURLConnection
;
import
java.net.URL
;
public
class
IPUtil
{
/**
* 获取外网IP
*
* @return
*/
public
static
String
getOutNetIp
()
{
try
{
String
address
=
"http://pv.sohu.com/cityjson?ie=utf-8"
;
// String address = "http://1212.ip138.com/ic.asp";
URL
url
=
new
URL
(
address
);
HttpURLConnection
connection
=
(
HttpURLConnection
)
url
.
openConnection
();
connection
.
setUseCaches
(
false
);
connection
.
setRequestMethod
(
"GET"
);
// 淘宝 设置浏览器ua 保证不出现503 必须添加此段代码,因为app端请求会不处理
// connection.setRequestProperty("user-agent",
// "Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.7 Safari/537.36");
if
(
connection
.
getResponseCode
()
==
HttpURLConnection
.
HTTP_OK
)
{
InputStream
in
=
connection
.
getInputStream
();
// 将流转化为字符串
BufferedReader
reader
=
new
BufferedReader
(
new
InputStreamReader
(
in
,
"gb2312"
));
StringBuilder
builder
=
new
StringBuilder
();
String
line
;
while
((
line
=
reader
.
readLine
())
!=
null
)
builder
.
append
(
line
+
"\n"
);
in
.
close
();
// 从反馈的结果中提取出IP地址
int
start
=
builder
.
indexOf
(
"{"
);
int
end
=
builder
.
indexOf
(
"}"
);
String
json
=
builder
.
substring
(
start
,
end
+
1
);
if
(
json
!=
null
)
{
try
{
JSONObject
jsonObject
=
new
JSONObject
(
json
);
line
=
jsonObject
.
optString
(
"cip"
);
}
catch
(
JSONException
e
)
{
e
.
printStackTrace
();
}
}
return
line
;
// String tmpString;
// StringBuilder retJSON = new StringBuilder();
// while ((tmpString = reader.readLine()) != null) {
// retJSON.append(tmpString + "\n");
// }
// JSONObject jsonObject = new JSONObject(retJSON.toString());
// String code = jsonObject.getString("code");
//
// if (code.equals("0")) {
// JSONObject data = jsonObject.getJSONObject("data");
// out_ip = new IpData(data.getString("ip"),
// data.getString("region"),
// data.getString("city"));
//// String country = data.getString("country");
//// String area = data.getString("area");
//// String region = data.getString("region");
//// String city = data.getString("city");
//// String isp = data.getString("isp");
// return out_ip;
// }
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
return
null
;
}
public
static
class
IpData
{
IpData
(
String
ip
,
String
ipProvince
,
String
ipCity
)
{
this
.
ip
=
ip
;
this
.
ipProvince
=
ipProvince
;
this
.
ipCity
=
ipCity
;
}
String
ip
;
String
ipProvince
;
String
ipCity
;
public
String
getIp
()
{
return
ip
;
}
public
void
setIp
(
String
ip
)
{
this
.
ip
=
ip
;
}
public
String
getIpProvince
()
{
return
ipProvince
;
}
public
void
setIpProvince
(
String
ipProvince
)
{
this
.
ipProvince
=
ipProvince
;
}
public
String
getIpCity
()
{
return
ipCity
;
}
public
void
setIpCity
(
String
ipCity
)
{
this
.
ipCity
=
ipCity
;
}
}
}
GoodMoney/app/src/main/java/com/mints/library/net/netstatus/NetUtils.java
View file @
4b707ddc
...
...
@@ -149,6 +149,9 @@ public class NetUtils {
case
TelephonyManager
.
NETWORK_TYPE_LTE
:
strNetworkType
=
"4G"
;
break
;
case
TelephonyManager
.
NETWORK_TYPE_NR
:
strNetworkType
=
"5G"
;
break
;
default
:
if
(
subtypeName
.
equalsIgnoreCase
(
"TD-SCDMA"
)
||
subtypeName
.
equalsIgnoreCase
(
"WCDMA"
)
||
subtypeName
.
equalsIgnoreCase
(
"CDMA2000"
))
{
strNetworkType
=
"3G"
;
...
...
@@ -161,6 +164,33 @@ public class NetUtils {
return
strNetworkType
;
}
public
static
String
getNetworkStateForCpd
(
Context
context
)
{
String
networkState
=
getNetworkState
(
context
);
String
networkStateForCpd
;
switch
(
networkState
)
{
case
"WIFI"
:
networkStateForCpd
=
"1"
;
break
;
case
"2G"
:
networkStateForCpd
=
"2"
;
break
;
case
"3G"
:
networkStateForCpd
=
"3"
;
break
;
case
"4G"
:
networkStateForCpd
=
"4"
;
break
;
case
"5G"
:
networkStateForCpd
=
"5"
;
break
;
default
:
networkStateForCpd
=
"0"
;
break
;
}
return
networkStateForCpd
;
}
/**
* 根据传入的URL获取一级域名
*
...
...
GoodMoney/app/src/main/res/layout/activity_task.xml
View file @
4b707ddc
...
...
@@ -19,24 +19,10 @@
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
/>
<FrameLayout
<androidx.recyclerview.widget.RecyclerView
android:id=
"@+id/recy_task"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
>
<androidx.recyclerview.widget.RecyclerView
android:id=
"@+id/recy_task"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
/>
<ImageView
android:id=
"@+id/iv_empty"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center"
android:src=
"@mipmap/ic_record_empty"
android:visibility=
"gone"
/>
</FrameLayout>
android:layout_height=
"wrap_content"
/>
</com.scwang.smartrefresh.layout.SmartRefreshLayout>
</LinearLayout>
\ No newline at end of file
GoodMoney/app/src/main/res/layout/item_task_recy.xml
View file @
4b707ddc
...
...
@@ -16,6 +16,7 @@
android:layout_height=
"wrap_content"
android:gravity=
"center_horizontal"
android:orientation=
"vertical"
>
<ImageView
android:id=
"@+id/item_iv_avatar"
android:layout_width=
"50dp"
...
...
@@ -40,7 +41,7 @@
android:layout_marginTop=
"10dp"
android:text=
"+300金币"
android:textColor=
"@color/color_FF9837"
android:textSize=
"1
8
sp"
/>
android:textSize=
"1
6
sp"
/>
<TextView
android:id=
"@+id/item_tv_text"
...
...
@@ -55,11 +56,13 @@
<Button
android:id=
"@+id/item_btn_submit"
android:layout_width=
"
70dp
"
android:layout_width=
"
wrap_content
"
android:layout_height=
"32dp"
android:layout_marginTop=
"10dp"
android:layout_marginBottom=
"10dp"
android:background=
"@drawable/shape_btn_switch"
android:paddingStart=
"5dp"
android:paddingEnd=
"5dp"
android:textColor=
"@color/white"
/>
</LinearLayout>
\ No newline at end of file
GoodMoney/app/src/main/res/layout/item_task_recy_cpd.xml
0 → 100644
View file @
4b707ddc
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:background=
"@drawable/shape_dialog_bg"
android:gravity=
"center_horizontal"
android:orientation=
"vertical"
>
<ImageView
android:id=
"@+id/item_iv_avatar"
android:layout_width=
"50dp"
android:layout_height=
"50dp"
android:layout_marginTop=
"10dp"
android:src=
"@mipmap/ic_launcher_main"
/>
<TextView
android:id=
"@+id/item_tv_title"
android:layout_width=
"80dp"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"10dp"
android:ellipsize=
"end"
android:gravity=
"center_horizontal"
android:lines=
"1"
android:maxLines=
"1"
/>
<TextView
android:id=
"@+id/item_tv_coin"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"10dp"
android:text=
"+300金币"
android:textColor=
"@color/color_FF9837"
android:textSize=
"16sp"
/>
<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"
/>
<Button
android:id=
"@+id/item_btn_submit"
android:layout_width=
"wrap_content"
android:layout_height=
"32dp"
android:layout_marginTop=
"10dp"
android:layout_marginBottom=
"10dp"
android:background=
"@drawable/shape_btn_switch"
android:paddingStart=
"5dp"
android:paddingEnd=
"5dp"
android:textColor=
"@color/white"
/>
</LinearLayout>
\ 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