Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Sign in / Register
Toggle navigation
M
magicbox
Project
Project
Details
Activity
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
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
王雪伟
magicbox
Commits
c8c518d2
Commit
c8c518d2
authored
Mar 10, 2022
by
王雪伟
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[提交人]:王雪伟
[提交简述] :加入paypal依赖 [实现方案] :
parent
f64f35b1
Hide whitespace changes
Inline
Side-by-side
Showing
22 changed files
with
227 additions
and
115 deletions
+227
-115
build.gradle
app/build.gradle
+3
-0
Appli.kt
app/src/main/java/com/zhangxin/magicbox/Appli.kt
+25
-1
version.properties
app/version.properties
+1
-1
build.gradle
build.gradle
+14
-2
build.gradle
cms/build.gradle
+15
-8
Response.java
cms/src/main/java/com/zxhl/cms/ad/upload/model/Response.java
+51
-0
Response.kt
cms/src/main/java/com/zxhl/cms/ad/upload/model/Response.kt
+0
-18
Constant.java
cms/src/main/java/com/zxhl/cms/common/Constant.java
+3
-0
GooglePayActivity.kt
...src/main/java/com/zxhl/cms/googlepay/GooglePayActivity.kt
+55
-55
GooglePayHelper.kt
cms/src/main/java/com/zxhl/cms/googlepay/GooglePayHelper.kt
+27
-3
ApiClient.kt
cms/src/main/java/com/zxhl/cms/net/ApiClient.kt
+7
-8
EventApiClient.kt
cms/src/main/java/com/zxhl/cms/net/EventApiClient.kt
+3
-2
BaseObserver.java
...src/main/java/com/zxhl/cms/net/callback/BaseObserver.java
+3
-0
DownloadInterceptor.kt
...ain/java/com/zxhl/cms/net/callback/DownloadInterceptor.kt
+1
-1
DownloadResponseBody.kt
...in/java/com/zxhl/cms/net/callback/DownloadResponseBody.kt
+3
-4
PayActivity.kt
cms/src/main/java/com/zxhl/cms/pay/PayActivity.kt
+1
-2
GsonInstance.java
cms/src/main/java/com/zxhl/cms/utils/GsonInstance.java
+1
-1
PhoneUtils.kt
cms/src/main/java/com/zxhl/cms/utils/PhoneUtils.kt
+5
-5
UserDataUtils.kt
cms/src/main/java/com/zxhl/cms/utils/UserDataUtils.kt
+0
-1
strings.xml
cms/src/main/res/values/strings.xml
+1
-1
build.gradle
moduleMain/build.gradle
+4
-1
build.gradle
moduleUc/build.gradle
+4
-1
No files found.
app/build.gradle
View file @
c8c518d2
...
@@ -127,6 +127,9 @@ android {
...
@@ -127,6 +127,9 @@ android {
sourceCompatibility
JavaVersion
.
VERSION_1_8
sourceCompatibility
JavaVersion
.
VERSION_1_8
targetCompatibility
JavaVersion
.
VERSION_1_8
targetCompatibility
JavaVersion
.
VERSION_1_8
}
}
kotlinOptions
{
jvmTarget
=
"1.8"
}
applicationVariants
.
all
{
variant
->
applicationVariants
.
all
{
variant
->
//这个修改输出的APK路径
//这个修改输出的APK路径
...
...
app/src/main/java/com/zhangxin/magicbox/Appli.kt
View file @
c8c518d2
...
@@ -3,6 +3,12 @@ package com.zhangxin.magicbox
...
@@ -3,6 +3,12 @@ package com.zhangxin.magicbox
import
android.app.Application
import
android.app.Application
import
android.text.TextUtils
import
android.text.TextUtils
import
com.mob.MobSDK
import
com.mob.MobSDK
import
com.paypal.checkout.PayPalCheckout
import
com.paypal.checkout.config.CheckoutConfig
import
com.paypal.checkout.config.Environment
import
com.paypal.checkout.config.SettingsConfig
import
com.paypal.checkout.createorder.CurrencyCode
import
com.paypal.checkout.createorder.UserAction
import
com.umeng.commonsdk.UMConfigure
import
com.umeng.commonsdk.UMConfigure
import
com.umeng.socialize.PlatformConfig
import
com.umeng.socialize.PlatformConfig
import
com.zxhl.cms.AppContext
import
com.zxhl.cms.AppContext
...
@@ -33,7 +39,25 @@ class Appli : Application() {
...
@@ -33,7 +39,25 @@ class Appli : Application() {
Config
.
init
(
this
)
Config
.
init
(
this
)
getOaid
()
getOaid
()
initByteDance
()
initByteDance
()
MobSDK
.
init
(
this
)
MobSDK
.
init
(
this
)
initPayPal
()
}
private
fun
initPayPal
()
{
val
config
=
CheckoutConfig
(
application
=
this
,
clientId
=
Constant
.
PAY_PAL_CLIENT_ID
,
environment
=
Environment
.
SANDBOX
,
//正式上线后,改为Environment.LIVE
returnUrl
=
"com.zhangxin.magicbox://paypalpay"
,
//创建应用时填的RETURN_URL
currencyCode
=
CurrencyCode
.
USD
,
//货币种类:CNY-人民币;HKD-港币;TWD-新台币;USD-美元...
userAction
=
UserAction
.
PAY_NOW
,
settingsConfig
=
SettingsConfig
(
loggingEnabled
=
true
)
)
if
(
android
.
os
.
Build
.
VERSION
.
SDK_INT
>=
android
.
os
.
Build
.
VERSION_CODES
.
M
)
{
PayPalCheckout
.
setConfig
(
config
)
}
}
}
private
fun
getOaid
()
{
private
fun
getOaid
()
{
...
...
app/version.properties
View file @
c8c518d2
PACKAGE_NAME
=
com.zhangxin.magicbox
PACKAGE_NAME
=
com.zhangxin.magicbox
VERSION_CODE
=
1
VERSION_CODE
=
2
VERSION_NAME
=
1.0.0
VERSION_NAME
=
1.0.0
build.gradle
View file @
c8c518d2
// Top-level build file where you can add configuration options common to all sub-projects/modules.
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript
{
buildscript
{
ext
.
kotlin_version
=
'1.4.21'
ext
.
kotlin_version
=
'1.4.32'
// ext.kotlin_version = '1.6.20-RC'
repositories
{
repositories
{
maven
{
maven
{
url
"https://mvn.mob.com/android"
url
"https://mvn.mob.com/android"
...
@@ -23,6 +24,17 @@ allprojects {
...
@@ -23,6 +24,17 @@ allprojects {
repositories
{
repositories
{
google
()
google
()
jcenter
()
jcenter
()
mavenCentral
()
// This private repository is required to resolve the Cardinal SDK transitive dependency.
maven
{
url
"https://cardinalcommerceprod.jfrog.io/artifactory/android"
credentials
{
// Be sure to add these non-sensitive credentials in order to retrieve dependencies from
// the private repository.
username
'paypal_sgerritz'
password
'AKCp8jQ8tAahqpT5JjZ4FRP2mW7GMoFZ674kGqHmupTesKeAY2G8NcmPKLuTxTGkKjDLRzDUQ'
}
}
}
}
}
}
...
@@ -31,6 +43,6 @@ task clean(type: Delete) {
...
@@ -31,6 +43,6 @@ task clean(type: Delete) {
}
}
ext
{
ext
{
targetSdkVersion
=
30
targetSdkVersion
=
30
minSdkVersion
=
17
minSdkVersion
=
21
compileSdkVersion
=
29
compileSdkVersion
=
29
}
}
cms/build.gradle
View file @
c8c518d2
...
@@ -18,7 +18,7 @@ android {
...
@@ -18,7 +18,7 @@ android {
}
}
}
}
compileOptions
{
compileOptions
{
sourceCompatibility
JavaVersion
.
VERSION_1_8
sourceCompatibility
JavaVersion
.
VERSION_1_8
targetCompatibility
JavaVersion
.
VERSION_1_8
targetCompatibility
JavaVersion
.
VERSION_1_8
...
@@ -64,8 +64,9 @@ android {
...
@@ -64,8 +64,9 @@ android {
}
}
}
}
kotlinOptions
{
jvmTarget
=
"1.8"
}
sourceSets
{
sourceSets
{
main
{
main
{
jniLibs
.
srcDirs
=
[
'libs'
]
jniLibs
.
srcDirs
=
[
'libs'
]
...
@@ -91,19 +92,20 @@ dependencies {
...
@@ -91,19 +92,20 @@ dependencies {
api
'com.android.support:design:28.0.0'
api
'com.android.support:design:28.0.0'
api
'com.android.support:support-v4:28.0.0'
api
'com.android.support:support-v4:28.0.0'
api
'org.jetbrains.kotlin:kotlin-stdlib-jre7:1.2.71'
// api 'org.jetbrains.kotlin:kotlin-stdlib-jre7:1.2.71'
api
"org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.4.32"
api
'com.squareup.retrofit2:adapter-rxjava2:2.2.0'
api
'com.squareup.retrofit2:adapter-rxjava2:2.2.0'
api
'com.trello.rxlifecycle2:rxlifecycle:2.2.0'
api
'com.trello.rxlifecycle2:rxlifecycle:2.2.0'
api
'com.trello.rxlifecycle2:rxlifecycle-components:2.2.0'
api
'com.trello.rxlifecycle2:rxlifecycle-components:2.2.0'
api
'com.squareup.retrofit2:retrofit:2.
3
.0'
api
'com.squareup.retrofit2:retrofit:2.
9
.0'
api
'com.squareup.retrofit2:converter-gson:2.
3
.0'
api
'com.squareup.retrofit2:converter-gson:2.
9
.0'
api
'com.squareup.okhttp3:logging-interceptor:
3.4
.1'
api
'com.squareup.okhttp3:logging-interceptor:
4.8
.1'
api
'org.jetbrains.anko:anko-common:0.9'
api
'org.jetbrains.anko:anko-common:0.9'
//友盟
//友盟
api
'com.badoo.mobile:android-weak-handler:1.1'
api
'com.badoo.mobile:android-weak-handler:1.1'
api
'com.umeng.umsdk:common:9.4.2'
// 必选
api
'com.umeng.umsdk:common:9.4.2'
// 必选
api
'com.umeng.umsdk:asms:1.4.1'
// 必选
api
'com.umeng.umsdk:asms:1.4.1'
// 必选
api
'com.umeng.umsdk:share-core:7.1.6'
//分享核心库,必选
api
'com.umeng.umsdk:share-core:7.1.6'
//分享核心库,必选
api
'com.umeng.umsdk:share-wx:7.1.6'
//微信完整版
api
'com.umeng.umsdk:share-wx:7.1.6'
//微信完整版
//glide配置
//glide配置
// api "com.github.bumptech.glide:glide:${glide_need_version}"
// api "com.github.bumptech.glide:glide:${glide_need_version}"
...
@@ -123,5 +125,10 @@ dependencies {
...
@@ -123,5 +125,10 @@ dependencies {
implementation
(
name:
'alipaySdk-15.6.4-20190611174341'
,
ext:
'aar'
)
implementation
(
name:
'alipaySdk-15.6.4-20190611174341'
,
ext:
'aar'
)
implementation
'androidx.constraintlayout:constraintlayout:2.0.4'
implementation
'androidx.constraintlayout:constraintlayout:2.0.4'
//implementation 'androidx.coordinatorlayout:coordinatorlayout:1.1.0'
//implementation 'androidx.coordinatorlayout:coordinatorlayout:1.1.0'
//GooglePay
implementation
(
"com.android.billingclient:billing:4.1.0"
)
implementation
(
"com.android.billingclient:billing:4.1.0"
)
//PayPal支付
api
'com.paypal.checkout:android-sdk:0.6.0'
// api "org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.4.10"
// api "androidx.core:core-ktx:1.6.0"
}
}
cms/src/main/java/com/zxhl/cms/ad/upload/model/Response.java
0 → 100644
View file @
c8c518d2
package
com
.
zxhl
.
cms
.
ad
.
upload
.
model
;
import
java.io.Serializable
;
/**
* @Description: java类作用描述
* @Author: lidandan
* @CreateDate: 2021/12/25 10:54 上午
*/
public
class
Response
<
T
>
implements
Serializable
{
private
String
status
=
""
;
private
String
msg
=
""
;
private
Result
<
T
>
result
=
null
;
public
String
getStatus
()
{
return
status
;
}
public
void
setStatus
(
String
status
)
{
this
.
status
=
status
;
}
public
String
getMsg
()
{
return
msg
;
}
public
void
setMsg
(
String
msg
)
{
this
.
msg
=
msg
;
}
public
Result
<
T
>
getResult
()
{
return
result
;
}
public
void
setResult
(
Result
<
T
>
result
)
{
this
.
result
=
result
;
}
public
static
class
Result
<
T
>
implements
Serializable
{
private
T
data
=
null
;
public
T
getData
()
{
return
data
;
}
public
void
setData
(
T
data
)
{
this
.
data
=
data
;
}
}
}
cms/src/main/java/com/zxhl/cms/ad/upload/model/Response.kt
deleted
100644 → 0
View file @
f64f35b1
package
com.zxhl.cms.ad.upload.model
import
java.io.Serializable
/**
* Created by gaoleichao on 2018/7/13.
*/
class
Response
<
T
>
{
var
status
:
String
?
=
""
var
msg
:
String
?
=
""
var
result
:
Result
<
T
>?
=
null
inner
class
Result
<
T
>
:
Serializable
{
var
data
:
T
?
=
null
}
}
cms/src/main/java/com/zxhl/cms/common/Constant.java
View file @
c8c518d2
...
@@ -8,6 +8,9 @@ import android.Manifest;
...
@@ -8,6 +8,9 @@ import android.Manifest;
public
class
Constant
{
public
class
Constant
{
public
static
String
PAY_PAL_CLIENT_ID
=
"AfYZMocYWtjeORYcG29SjvjJjS8L9_Mh8xlTi74ifLXboxFaVb43F_ZLc8geZVqLN47m2wr9PD24tRIh"
;
//公共参数
//公共参数
String
UMENG_APPKEY
=
"597dbf2abbea835685001b27"
;
String
UMENG_APPKEY
=
"597dbf2abbea835685001b27"
;
...
...
cms/src/main/java/com/zxhl/cms/googlepay/GooglePayActivity.kt
View file @
c8c518d2
...
@@ -12,17 +12,17 @@ import kotlinx.android.synthetic.main.activity_google_pay.*
...
@@ -12,17 +12,17 @@ import kotlinx.android.synthetic.main.activity_google_pay.*
class
GooglePayActivity
:
BaseActivity
()
{
class
GooglePayActivity
:
BaseActivity
()
{
private
val
TAG
=
"GooglePayActivity"
private
val
TAG
=
"GooglePayActivity"
private
val
purchasesUpdatedListener
=
//
private val purchasesUpdatedListener =
PurchasesUpdatedListener
{
billingResult
,
purchases
->
//
PurchasesUpdatedListener { billingResult, purchases ->
// To be implemented in a later section.
//
// To be implemented in a later section.
Log
.
d
(
TAG
,
"purchasesUpdatedListener"
+
billingResult
.
responseCode
)
//
Log.d(TAG, "purchasesUpdatedListener" + billingResult.responseCode)
Log
.
d
(
TAG
,
"purchasesUpdatedListener"
+
purchases
?.
size
)
//
Log.d(TAG, "purchasesUpdatedListener" + purchases?.size)
}
//
}
//
private
var
billingClient
=
BillingClient
.
newBuilder
(
AppContext
.
get
())
//
private var billingClient = BillingClient.newBuilder(AppContext.get())
.
setListener
(
purchasesUpdatedListener
)
//
.setListener(purchasesUpdatedListener)
.
enablePendingPurchases
()
//
.enablePendingPurchases()
.
build
()
//
.build()
override
fun
onClick
(
v
:
View
?)
{
override
fun
onClick
(
v
:
View
?)
{
...
@@ -36,50 +36,50 @@ class GooglePayActivity : BaseActivity() {
...
@@ -36,50 +36,50 @@ class GooglePayActivity : BaseActivity() {
id_btn_google_pay
.
setOnClickListener
{
id_btn_google_pay
.
setOnClickListener
{
}
}
startConnection
()
// startConnection()
// GooglePayHelper(this).init()
GooglePayHelper
(
this
,
""
).
init
()
}
fun
startConnection
()
{
if
(
billingClient
.
isReady
){
}
billingClient
.
startConnection
(
object
:
BillingClientStateListener
{
override
fun
onBillingSetupFinished
(
billingResult
:
BillingResult
)
{
if
(
billingResult
.
responseCode
==
BillingClient
.
BillingResponseCode
.
OK
)
{
// The BillingClient is ready. You can query purchases here.
// BillingClient准备好了。你可以在这里查询购买情况。
//querySkuDetails()
querySkuDetails
()
}
Log
.
d
(
TAG
,
billingResult
.
toString
())
}
override
fun
onBillingServiceDisconnected
()
{
// Try to restart the connection on the next request to
// 尝试在下一次请求时重新启动连接
// Google Play by calling the startConnection() method.
// 谷歌通过调用startConnection()方法来播放。
startConnection
()
Log
.
d
(
TAG
,
"onBillingServiceDisconnected"
)
}
})
}
fun
querySkuDetails
()
{
val
skuList
:
MutableList
<
String
>
=
ArrayList
()
skuList
.
add
(
"premium_upgrade"
)
skuList
.
add
(
"gas"
)
val
params
=
SkuDetailsParams
.
newBuilder
()
params
.
setSkusList
(
skuList
).
setType
(
SkuType
.
INAPP
)
billingClient
.
querySkuDetailsAsync
(
params
.
build
()
)
{
billingResult
,
skuDetailsList
->
// Process the result.
Log
.
d
(
TAG
,
"billingResult ${billingResult.responseCode}"
)
Log
.
d
(
TAG
,
"skuDetailsList ${skuDetailsList?.size}"
)
}
}
}
//
//
// fun startConnection() {
// if(billingClient.isReady){
//
// }
// billingClient.startConnection(object : BillingClientStateListener {
// override fun onBillingSetupFinished(billingResult: BillingResult) {
// if (billingResult.responseCode == BillingClient.BillingResponseCode.OK) {
// // The BillingClient is ready. You can query purchases here.
// // BillingClient准备好了。你可以在这里查询购买情况。
// //querySkuDetails()
// querySkuDetails()
// }
// Log.d(TAG, billingResult.toString())
// }
//
// override fun onBillingServiceDisconnected() {
// // Try to restart the connection on the next request to
// // 尝试在下一次请求时重新启动连接
// // Google Play by calling the startConnection() method.
// // 谷歌通过调用startConnection()方法来播放。
// startConnection()
// Log.d(TAG, "onBillingServiceDisconnected")
// }
// })
// }
//
// fun querySkuDetails() {
// val skuList: MutableList<String> = ArrayList()
// skuList.add("premium_upgrade")
// skuList.add("gas")
// val params = SkuDetailsParams.newBuilder()
// params.setSkusList(skuList).setType(SkuType.INAPP)
// billingClient.querySkuDetailsAsync(
// params.build()
// ) { billingResult, skuDetailsList ->
// // Process the result.
// Log.d(TAG, "billingResult ${billingResult.responseCode}")
// Log.d(TAG, "skuDetailsList ${skuDetailsList?.size}")
// }
// }
}
}
\ No newline at end of file
cms/src/main/java/com/zxhl/cms/googlepay/GooglePayHelper.kt
View file @
c8c518d2
...
@@ -3,6 +3,7 @@ package com.zxhl.cms.googlepay
...
@@ -3,6 +3,7 @@ package com.zxhl.cms.googlepay
import
android.app.Activity
import
android.app.Activity
import
android.util.Log
import
android.util.Log
import
com.android.billingclient.api.*
import
com.android.billingclient.api.*
import
com.android.billingclient.api.BillingClient.BillingResponseCode
import
com.android.billingclient.api.BillingClient.SkuType
import
com.android.billingclient.api.BillingClient.SkuType
import
com.zxhl.cms.AppContext
import
com.zxhl.cms.AppContext
...
@@ -17,7 +18,7 @@ class GooglePayHelper {
...
@@ -17,7 +18,7 @@ class GooglePayHelper {
private
var
mActivity
:
Activity
;
private
var
mActivity
:
Activity
;
private
var
mSku
:
String
=
""
private
var
mSku
:
String
=
""
constructor
(
mActivity
:
Activity
,
mSku
:
String
)
{
constructor
(
mActivity
:
Activity
,
mSku
:
String
)
{
this
.
mActivity
=
mActivity
this
.
mActivity
=
mActivity
this
.
mSku
=
mSku
this
.
mSku
=
mSku
}
}
...
@@ -45,12 +46,13 @@ class GooglePayHelper {
...
@@ -45,12 +46,13 @@ class GooglePayHelper {
Log
.
d
(
TAG
,
"init 开始连接"
)
Log
.
d
(
TAG
,
"init 开始连接"
)
billingClient
.
startConnection
(
object
:
BillingClientStateListener
{
billingClient
.
startConnection
(
object
:
BillingClientStateListener
{
override
fun
onBillingSetupFinished
(
billingResult
:
BillingResult
)
{
override
fun
onBillingSetupFinished
(
billingResult
:
BillingResult
)
{
Log
.
d
(
TAG
,
"init 开始连接 code:"
+
billingResult
.
responseCode
)
if
(
billingResult
.
responseCode
==
BillingClient
.
BillingResponseCode
.
OK
)
{
if
(
billingResult
.
responseCode
==
BillingClient
.
BillingResponseCode
.
OK
)
{
//BillingClient准备好了。你可以在这里查询购买情况。
//BillingClient准备好了。你可以在这里查询购买情况。
Log
.
d
(
TAG
,
"init 连接成功"
)
//查询商品购买
//查询商品购买
purchase
()
purchase
()
}
else
{
Log
.
d
(
TAG
,
"init 连接失败 code:"
+
billingResult
.
responseCode
)
}
}
}
}
...
@@ -88,6 +90,28 @@ class GooglePayHelper {
...
@@ -88,6 +90,28 @@ class GooglePayHelper {
Log
.
d
(
TAG
,
"purchase 查询失败"
)
Log
.
d
(
TAG
,
"purchase 查询失败"
)
}
}
}
}
}
}
fun
handlePurchase
(
purchase
:
Purchase
)
{
// Purchase retrieved from BillingClient#queryPurchasesAsync or your PurchasesUpdatedListener.
// Verify the purchase.
// Ensure entitlement was not already granted for this purchaseToken.
// Grant entitlement to the user.
val
consumeParams
=
ConsumeParams
.
newBuilder
()
.
setPurchaseToken
(
purchase
.
purchaseToken
)
.
build
()
val
listener
=
ConsumeResponseListener
{
billingResult
,
purchaseToken
->
if
(
billingResult
.
responseCode
==
BillingResponseCode
.
OK
)
{
// Handle the success of the consume operation.
}
}
billingClient
.
consumeAsync
(
consumeParams
,
listener
)
}
}
}
\ No newline at end of file
cms/src/main/java/com/zxhl/cms/net/ApiClient.kt
View file @
c8c518d2
package
com.zxhl.cms.net
package
com.zxhl.cms.net
import
android.text.TextUtils
import
com.zxhl.cms.utils.PhoneUtils
import
com.zxhl.cms.utils.PhoneUtils
import
com.zxhl.cms.common.NetConfig
import
com.zxhl.cms.common.NetConfig
import
com.zxhl.cms.net.api.*
import
com.zxhl.cms.net.api.*
import
com.zxhl.cms.utils.
LogUtils
import
com.zxhl.cms.utils.
GsonInstance
import
okhttp3.
*
import
okhttp3.
Interceptor
import
okhttp3.logging.HttpLoggingInterceptor
import
okhttp3.logging.HttpLoggingInterceptor
import
retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory
import
retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory
import
retrofit2.converter.gson.GsonConverterFactory
import
retrofit2.converter.gson.GsonConverterFactory
...
@@ -19,9 +18,9 @@ object ApiClient {
...
@@ -19,9 +18,9 @@ object ApiClient {
private
val
logInterceptor
=
HttpLoggingInterceptor
()
private
val
logInterceptor
=
HttpLoggingInterceptor
()
private
val
paramsInterceptor
=
Interceptor
{
chain
->
private
val
paramsInterceptor
=
Interceptor
{
chain
->
val
request
=
chain
.
request
()
val
request
=
chain
.
request
()
val
builder
=
request
.
url
()
.
newBuilder
()
val
builder
=
request
.
url
.
newBuilder
()
if
(
request
.
url
().
host
()
.
toString
().
contains
(
"zhangxinhulian.com"
))
{
if
(
request
.
url
.
host
.
toString
().
contains
(
"zhangxinhulian.com"
))
{
val
builder
=
request
.
url
()
.
newBuilder
()
val
builder
=
request
.
url
.
newBuilder
()
PhoneUtils
.
addParam
(
request
,
builder
)
PhoneUtils
.
addParam
(
request
,
builder
)
chain
.
proceed
(
request
.
newBuilder
().
url
(
builder
.
build
()).
build
())
chain
.
proceed
(
request
.
newBuilder
().
url
(
builder
.
build
()).
build
())
}
else
{
}
else
{
...
@@ -32,7 +31,7 @@ object ApiClient {
...
@@ -32,7 +31,7 @@ object ApiClient {
private
val
headInterceptor
=
Interceptor
{
chain
->
private
val
headInterceptor
=
Interceptor
{
chain
->
val
request
=
chain
.
request
()
val
request
=
chain
.
request
()
val
builder
=
request
.
newBuilder
()
val
builder
=
request
.
newBuilder
()
if
(
request
.
url
().
host
()
.
toString
().
contains
(
"zhangxinhulian.com"
))
{
if
(
request
.
url
.
host
.
toString
().
contains
(
"zhangxinhulian.com"
))
{
PhoneUtils
.
addHeader
(
builder
)
PhoneUtils
.
addHeader
(
builder
)
}
}
chain
.
proceed
(
builder
.
build
())
chain
.
proceed
(
builder
.
build
())
...
@@ -54,7 +53,7 @@ object ApiClient {
...
@@ -54,7 +53,7 @@ object ApiClient {
private
val
retrofit
=
retrofit2
.
Retrofit
.
Builder
()
private
val
retrofit
=
retrofit2
.
Retrofit
.
Builder
()
.
client
(
httpClient
)
.
client
(
httpClient
)
.
addCallAdapterFactory
(
RxJava2CallAdapterFactory
.
create
())
.
addCallAdapterFactory
(
RxJava2CallAdapterFactory
.
create
())
.
addConverterFactory
(
GsonConverterFactory
.
create
())
.
addConverterFactory
(
GsonConverterFactory
.
create
(
GsonInstance
.
getInstance
()
))
.
baseUrl
(
NetConfig
.
BASE_URL
)
.
baseUrl
(
NetConfig
.
BASE_URL
)
.
build
()
.
build
()
...
...
cms/src/main/java/com/zxhl/cms/net/EventApiClient.kt
View file @
c8c518d2
...
@@ -4,7 +4,8 @@ import com.zxhl.cms.common.Constant
...
@@ -4,7 +4,8 @@ import com.zxhl.cms.common.Constant
import
com.zxhl.cms.common.NetConfig
import
com.zxhl.cms.common.NetConfig
import
com.zxhl.cms.net.api.ICfgInfoApi
import
com.zxhl.cms.net.api.ICfgInfoApi
import
com.zxhl.cms.utils.PhoneUtils
import
com.zxhl.cms.utils.PhoneUtils
import
okhttp3.*
import
okhttp3.Interceptor
import
okhttp3.Request
import
okhttp3.logging.HttpLoggingInterceptor
import
okhttp3.logging.HttpLoggingInterceptor
import
retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory
import
retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory
import
retrofit2.converter.gson.GsonConverterFactory
import
retrofit2.converter.gson.GsonConverterFactory
...
@@ -18,7 +19,7 @@ object EventApiClient {
...
@@ -18,7 +19,7 @@ object EventApiClient {
private
val
logInterceptor
=
HttpLoggingInterceptor
()
private
val
logInterceptor
=
HttpLoggingInterceptor
()
private
val
paramsInterceptor
=
Interceptor
{
chain
->
private
val
paramsInterceptor
=
Interceptor
{
chain
->
val
request
=
chain
.
request
()
val
request
=
chain
.
request
()
val
builder
=
request
.
url
()
.
newBuilder
()
val
builder
=
request
.
url
.
newBuilder
()
val
params
=
PhoneUtils
.
addCommonParam
()
val
params
=
PhoneUtils
.
addCommonParam
()
val
putkeys
=
params
.
keys
val
putkeys
=
params
.
keys
for
(
s
in
putkeys
)
{
for
(
s
in
putkeys
)
{
...
...
cms/src/main/java/com/zxhl/cms/net/callback/BaseObserver.java
View file @
c8c518d2
...
@@ -2,6 +2,7 @@ package com.zxhl.cms.net.callback;
...
@@ -2,6 +2,7 @@ package com.zxhl.cms.net.callback;
import
android.content.Intent
;
import
android.content.Intent
;
import
android.text.TextUtils
;
import
android.text.TextUtils
;
import
android.util.Log
;
import
com.zxhl.cms.AppContext
;
import
com.zxhl.cms.AppContext
;
import
com.zxhl.cms.ad.upload.model.Response
;
import
com.zxhl.cms.ad.upload.model.Response
;
...
@@ -13,6 +14,8 @@ import com.zxhl.cms.utils.RxBus;
...
@@ -13,6 +14,8 @@ import com.zxhl.cms.utils.RxBus;
import
com.zxhl.cms.utils.Utils
;
import
com.zxhl.cms.utils.Utils
;
import
com.zxhl.cms.net.SettingPreference
;
import
com.zxhl.cms.net.SettingPreference
;
import
java.lang.reflect.Type
;
import
io.reactivex.Observer
;
import
io.reactivex.Observer
;
import
io.reactivex.annotations.NonNull
;
import
io.reactivex.annotations.NonNull
;
import
io.reactivex.disposables.Disposable
;
import
io.reactivex.disposables.Disposable
;
...
...
cms/src/main/java/com/zxhl/cms/net/callback/DownloadInterceptor.kt
View file @
c8c518d2
...
@@ -10,7 +10,7 @@ class DownloadInterceptor : Interceptor {
...
@@ -10,7 +10,7 @@ class DownloadInterceptor : Interceptor {
override
fun
intercept
(
chain
:
Interceptor
.
Chain
):
Response
{
override
fun
intercept
(
chain
:
Interceptor
.
Chain
):
Response
{
val
originalResponse
=
chain
.
proceed
(
chain
.
request
())
val
originalResponse
=
chain
.
proceed
(
chain
.
request
())
return
originalResponse
.
newBuilder
()
return
originalResponse
.
newBuilder
()
.
body
(
DownloadResponseBody
(
originalResponse
.
body
()
!!
))
.
body
(
DownloadResponseBody
(
originalResponse
.
body
!!
))
.
build
()
.
build
()
}
}
...
...
cms/src/main/java/com/zxhl/cms/net/callback/DownloadResponseBody.kt
View file @
c8c518d2
package
com.zxhl.cms.net.callback
package
com.zxhl.cms.net.callback
import
android.util.Log
import
com.zxhl.cms.common.Constant
import
com.zxhl.cms.common.Constant
import
com.zxhl.cms.net.model.other.FileLoadEvent
import
com.zxhl.cms.net.model.other.FileLoadEvent
import
com.zxhl.cms.utils.RxBus
import
com.zxhl.cms.utils.RxBus
...
@@ -23,11 +22,11 @@ class DownloadResponseBody : ResponseBody {
...
@@ -23,11 +22,11 @@ class DownloadResponseBody : ResponseBody {
override
fun
contentType
():
MediaType
?
=
responseBody
.
contentType
()
override
fun
contentType
():
MediaType
?
=
responseBody
.
contentType
()
override
fun
source
():
BufferedSource
?
{
override
fun
source
():
BufferedSource
{
if
(
bufferedSource
==
null
)
{
if
(
bufferedSource
==
null
)
{
bufferedSource
=
Okio
.
buffer
(
source
(
responseBody
.
source
())
);
bufferedSource
=
source
(
responseBody
.
source
()).
buffer
(
);
}
}
return
bufferedSource
return
bufferedSource
as
BufferedSource
}
}
private
fun
source
(
source
:
Source
):
Source
{
private
fun
source
(
source
:
Source
):
Source
{
...
...
cms/src/main/java/com/zxhl/cms/pay/PayActivity.kt
View file @
c8c518d2
...
@@ -73,7 +73,6 @@ class PayActivity : BaseActivity(), PayContract.View,
...
@@ -73,7 +73,6 @@ class PayActivity : BaseActivity(), PayContract.View,
)
)
id_img_back
?.
setOnClickListener
{
id_img_back
?.
setOnClickListener
{
finish
()
finish
()
// startActivity(Intent(this,GooglePayActivity::class.java))
}
}
id_activity_member_close
?.
setOnClickListener
{
id_activity_member_close
?.
setOnClickListener
{
finish
()
finish
()
...
@@ -231,7 +230,7 @@ class PayActivity : BaseActivity(), PayContract.View,
...
@@ -231,7 +230,7 @@ class PayActivity : BaseActivity(), PayContract.View,
}
}
EventUtils
.
onEvent
(
"member_page_show"
)
EventUtils
.
onEvent
(
"member_page_show"
)
// startActivity(Intent(this,GooglePayActivity::class.java))
}
}
fun
checkChoose
()
{
fun
checkChoose
()
{
...
...
cms/src/main/java/com/zxhl/cms/utils/GsonInstance.java
View file @
c8c518d2
...
@@ -17,7 +17,7 @@ public class GsonInstance {
...
@@ -17,7 +17,7 @@ public class GsonInstance {
}
}
synchronized
(
GsonInstance
.
class
)
{
synchronized
(
GsonInstance
.
class
)
{
if
(
sInstance
==
null
)
{
if
(
sInstance
==
null
)
{
sInstance
=
new
GsonBuilder
().
disableHtmlEscaping
().
create
();
sInstance
=
new
GsonBuilder
().
disableHtmlEscaping
().
serializeNulls
().
create
();
}
}
}
}
return
sInstance
;
return
sInstance
;
...
...
cms/src/main/java/com/zxhl/cms/utils/PhoneUtils.kt
View file @
c8c518d2
...
@@ -758,12 +758,12 @@ object PhoneUtils {
...
@@ -758,12 +758,12 @@ object PhoneUtils {
fun
addParam
(
request
:
Request
,
builder
:
HttpUrl
.
Builder
)
{
fun
addParam
(
request
:
Request
,
builder
:
HttpUrl
.
Builder
)
{
val
params
=
addCommonParam
()
val
params
=
addCommonParam
()
params
.
put
(
"appLs"
,
Constant
.
Param
.
APPLS
)
params
.
put
(
"appLs"
,
Constant
.
Param
.
APPLS
)
for
(
i
in
0
until
request
.
url
().
querySize
()
)
{
for
(
i
in
0
until
request
.
url
.
querySize
)
{
val
url
=
request
.
url
()
val
url
=
request
.
url
params
.
put
(
url
.
queryParameterName
(
i
),
url
.
queryParameterValue
(
i
))
params
.
put
(
url
.
queryParameterName
(
i
),
url
.
queryParameterValue
(
i
)
.
toString
()
)
}
}
for
(
i
in
0
until
request
.
url
().
querySize
()
)
{
for
(
i
in
0
until
request
.
url
.
querySize
)
{
val
url
=
request
.
url
()
val
url
=
request
.
url
builder
.
removeAllQueryParameters
(
url
.
queryParameterName
(
i
))
builder
.
removeAllQueryParameters
(
url
.
queryParameterName
(
i
))
}
}
...
...
cms/src/main/java/com/zxhl/cms/utils/UserDataUtils.kt
View file @
c8c518d2
package
com.zxhl.cms.utils
package
com.zxhl.cms.utils
import
android.text.TextUtils
import
com.zxhl.cms.ad.upload.model.Response
import
com.zxhl.cms.ad.upload.model.Response
import
com.zxhl.cms.net.ApiClient.userInfoAPi
import
com.zxhl.cms.net.ApiClient.userInfoAPi
import
com.zxhl.cms.net.RxSchedulers
import
com.zxhl.cms.net.RxSchedulers
...
...
cms/src/main/res/values/strings.xml
View file @
c8c518d2
<resources>
<resources>
<string
name=
"app_name"
>
Lucky
Box
</string>
<string
name=
"app_name"
>
Magic
Box
</string>
<string
name=
"login_faild"
>
登录失败
</string>
<string
name=
"login_faild"
>
登录失败
</string>
<string
name=
"login_success"
>
登录成功
</string>
<string
name=
"login_success"
>
登录成功
</string>
<string
name=
"reset_success"
>
修改成功
</string>
<string
name=
"reset_success"
>
修改成功
</string>
...
...
moduleMain/build.gradle
View file @
c8c518d2
...
@@ -4,7 +4,7 @@ if (isDebug.toBoolean()) {
...
@@ -4,7 +4,7 @@ if (isDebug.toBoolean()) {
}
else
{
}
else
{
apply
plugin:
'com.android.library'
apply
plugin:
'com.android.library'
}
}
apply
plugin:
'com.mob.sdk'
apply
plugin:
'kotlin-android'
apply
plugin:
'kotlin-android'
apply
plugin:
'kotlin-android-extensions'
apply
plugin:
'kotlin-android-extensions'
android
{
android
{
...
@@ -40,6 +40,9 @@ android {
...
@@ -40,6 +40,9 @@ android {
sourceCompatibility
JavaVersion
.
VERSION_1_8
sourceCompatibility
JavaVersion
.
VERSION_1_8
targetCompatibility
JavaVersion
.
VERSION_1_8
targetCompatibility
JavaVersion
.
VERSION_1_8
}
}
kotlinOptions
{
jvmTarget
=
"1.8"
}
}
}
repositories
{
repositories
{
flatDir
{
flatDir
{
...
...
moduleUc/build.gradle
View file @
c8c518d2
...
@@ -4,7 +4,7 @@ if (isDebug.toBoolean()) {
...
@@ -4,7 +4,7 @@ if (isDebug.toBoolean()) {
}
else
{
}
else
{
apply
plugin:
'com.android.library'
apply
plugin:
'com.android.library'
}
}
apply
plugin:
'com.mob.sdk'
apply
plugin:
'kotlin-android'
apply
plugin:
'kotlin-android'
apply
plugin:
'kotlin-android-extensions'
apply
plugin:
'kotlin-android-extensions'
android
{
android
{
...
@@ -40,6 +40,9 @@ android {
...
@@ -40,6 +40,9 @@ android {
sourceCompatibility
JavaVersion
.
VERSION_1_8
sourceCompatibility
JavaVersion
.
VERSION_1_8
targetCompatibility
JavaVersion
.
VERSION_1_8
targetCompatibility
JavaVersion
.
VERSION_1_8
}
}
kotlinOptions
{
jvmTarget
=
"1.8"
}
}
}
repositories
{
repositories
{
flatDir
{
flatDir
{
...
...
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