Commit 5b098e6f by yjiucheng

壳工程中支付功能下沉

parent 98db7101
ext {
kotlin_version = "1.3.21"
dev_mode = false
dev_mode = true
ydl_app = [
appName : "心理咨询壹点灵",
......
......@@ -50,7 +50,7 @@ import com.yidianling.course.bean.CourseMediaDetailBean
import com.yidianling.course.coursePlay.presenter.CoursePlayPresenter
import com.yidianling.course.router.CourseIn
import com.yidianling.course.widget.VideoFloatHelper
import com.yidianling.ydl_pay.CommonPayDialog
import com.yidianling.ydl_pay.common.CommonPayDialog
import kotlinx.android.synthetic.main.activity_course_play.*
import org.json.JSONException
import org.json.JSONObject
......
......@@ -22,7 +22,7 @@ import com.yidianling.dynamic.thank.ShowIntroduceDialogFragment
import com.yidianling.dynamic.thank.ThankActivity
import com.yidianling.dynamic.thank.WorryDetailAnswer
import com.yidianling.dynamic.thank.data.ThxData
import com.yidianling.ydl_pay.CommonPayDialog
import com.yidianling.ydl_pay.common.CommonPayDialog
import de.greenrobot.event.EventBus
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.schedulers.Schedulers
......
......@@ -3,4 +3,10 @@
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<application>
<activity
android:name=".pay.PayActivity"
android:screenOrientation="portrait" />
</application>
</manifest>
package com.yidianling.ydl_pay.bean; import android.text.TextUtils; import java.util.Map; public class PayResult { private String resultStatus; private String result; private String memo; public PayResult(Map<String, String> rawResult) { if (rawResult == null) { return; } for (String key : rawResult.keySet()) { if (TextUtils.equals(key, "resultStatus")) { resultStatus = rawResult.get(key); } else if (TextUtils.equals(key, "result")) { result = rawResult.get(key); } else if (TextUtils.equals(key, "memo")) { memo = rawResult.get(key); } } } @Override public String toString() { return "resultStatus={" + resultStatus + "};memo={" + memo + "};result={" + result + "}"; } /** * @return the resultStatus */ public String getResultStatus() { return resultStatus; } /** * @return the memo */ public String getMemo() { return memo; } /** * @return the result */ public String getResult() { return result; }}
\ No newline at end of file
package com.yidianling.ydl_pay
package com.yidianling.ydl_pay.common
import android.annotation.SuppressLint
import android.app.Activity
......@@ -15,14 +15,15 @@ import com.alipay.sdk.app.PayTask
import com.tencent.mm.opensdk.modelpay.PayReq
import com.tencent.mm.opensdk.openapi.WXAPIFactory
import com.yidianling.common.tools.RxImageTool
import com.yidianling.ydl_pay.bean.*
import com.yidianling.ydl_pay.bean.params.*
import com.yidianling.ydl_pay.http.HttpUtils
import com.yidianling.ydl_pay.http.utils.NetUtils
import com.yidianling.ydl_pay.http.utils.RxDeviceTool
import com.yidianling.ydl_pay.toast.ToastHelper
import com.yidianling.ydl_pay.widget.PayCouponView
import com.yidianling.ydl_pay.widget.PayInfoDetailView
import com.yidianling.ydl_pay.R
import com.yidianling.ydl_pay.common.bean.*
import com.yidianling.ydl_pay.common.bean.params.*
import com.yidianling.ydl_pay.common.http.HttpUtils
import com.yidianling.ydl_pay.common.http.utils.NetUtils
import com.yidianling.ydl_pay.common.http.utils.RxDeviceTool
import com.yidianling.ydl_pay.common.toast.ToastHelper
import com.yidianling.ydl_pay.common.widget.PayCouponView
import com.yidianling.ydl_pay.common.widget.PayInfoDetailView
import de.greenrobot.event.EventBus
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.schedulers.Schedulers
......@@ -135,39 +136,41 @@ class CommonPayDialog : Dialog {
private fun initThanksPayInfoDetailView(bean: OrderInfoBean) {
view_pager.setScanScroll(false)
detailView =
PayInfoDetailView(activity, object : PayInfoDetailView.OnCouponDetailClickListener {
override fun selectCoupon(couponId: String) {
}
PayInfoDetailView(
activity,
object : PayInfoDetailView.OnCouponDetailClickListener {
override fun selectCoupon(couponId: String) {
}
override fun ensurePay(
payWay: Int,
payMoney: Float,
useMoneyType: Int,
code: String,
couponType: String
) {
//感谢的时候比较暴力:payid是外部传过来的、余额一定会被扣掉
if (payBusinessType == TYPE_TRENDS_THANKS) {
showProgressDialog()
if (payMoney > 0) {
when (payWay) {
PAY_WECHAT -> {
getWeiXinPayOrderId(
thankPayId!!,
if (useMoneyType == 2) 1 else 0
)
}
else -> {
getAliPayOrderId(thankPayId!!, if (useMoneyType == 2) 1 else 0)
override fun ensurePay(
payWay: Int,
payMoney: Float,
useMoneyType: Int,
code: String,
couponType: String
) {
//感谢的时候比较暴力:payid是外部传过来的、余额一定会被扣掉
if (payBusinessType == TYPE_TRENDS_THANKS) {
showProgressDialog()
if (payMoney > 0) {
when (payWay) {
PAY_WECHAT -> {
getWeiXinPayOrderId(
thankPayId!!,
if (useMoneyType == 2) 1 else 0
)
}
else -> {
getAliPayOrderId(thankPayId!!, if (useMoneyType == 2) 1 else 0)
}
}
} else {
//余额支付
payByCharge()
}
} else {
//余额支付
payByCharge()
}
}
}
})
})
if (bean.maxCoupon != null) {
//最优的优惠券id为0时,把最优优惠券对象置为null,因为正常的可用的优惠券id一定不为0,这里接口为了前端页面展示,返回的maxCoupon对象不为null,
//但maxCoupon的属性均为null或初始值
......@@ -262,25 +265,27 @@ class CommonPayDialog : Dialog {
private fun updateDataOnView(bean: OrderInfoBean) {
view_pager.setScanScroll(false)
detailView =
PayInfoDetailView(activity, object : PayInfoDetailView.OnCouponDetailClickListener {
override fun selectCoupon(couponId: String) {
if (couponListBean != null) {
view_pager.currentItem = 1
} else {
getAllCoupon()
PayInfoDetailView(
activity,
object : PayInfoDetailView.OnCouponDetailClickListener {
override fun selectCoupon(couponId: String) {
if (couponListBean != null) {
view_pager.currentItem = 1
} else {
getAllCoupon()
}
}
}
override fun ensurePay(
payWay: Int,
payMoney: Float,
useMoneyType: Int,
code: String,
couponType: String
) {
createOrder(payWay, payMoney, useMoneyType, code, couponType)
}
})
override fun ensurePay(
payWay: Int,
payMoney: Float,
useMoneyType: Int,
code: String,
couponType: String
) {
createOrder(payWay, payMoney, useMoneyType, code, couponType)
}
})
if (bean.maxCoupon != null) {
//最优的优惠券id为0时,把最优优惠券对象置为null,因为正常的可用的优惠券id一定不为0,这里接口为了前端页面展示,返回的maxCoupon对象不为null,
//但maxCoupon的属性均为null或初始值
......
package com.yidianling.ydl_pay.actionpoint
package com.yidianling.ydl_pay.common.actionpoint
import android.content.Context
import android.net.ConnectivityManager
import android.net.NetworkInfo
import com.yidianling.ydl_pay.http.HttpUtils
import com.yidianling.ydl_pay.http.utils.RxDeviceTool
import com.yidianling.ydl_pay.common.http.HttpUtils
import com.yidianling.ydl_pay.common.http.utils.RxDeviceTool
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.schedulers.Schedulers
......
package com.yidianling.ydl_pay.actionpoint
package com.yidianling.ydl_pay.common.actionpoint
/**
* Created by xj on 2019/6/22.
......
package com.yidianling.ydl_pay.actionpoint
package com.yidianling.ydl_pay.common.actionpoint
/**
* Created by xj on 2019/7/1.
......
package com.yidianling.ydl_pay.adapter
package com.yidianling.ydl_pay.common.adapter
import android.annotation.SuppressLint
import android.content.Context
......@@ -7,13 +7,13 @@ import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.TextView
import com.yidianling.ydl_pay.actionpoint.ActionCountUtils
import com.yidianling.ydl_pay.actionpoint.BIConstants
import com.yidianling.ydl_pay.http.HttpConfig
import com.yidianling.ydl_pay.widget.CouponInfoDetailView
import com.yidianling.ydl_pay.common.actionpoint.ActionCountUtils
import com.yidianling.ydl_pay.common.actionpoint.BIConstants
import com.yidianling.ydl_pay.common.http.HttpConfig
import com.yidianling.ydl_pay.common.widget.CouponInfoDetailView
import com.yidianling.ydl_pay.R
import com.yidianling.ydl_pay.bean.AllCouponListBean
import com.yidianling.ydl_pay.bean.CommonCouponBean
import com.yidianling.ydl_pay.common.bean.AllCouponListBean
import com.yidianling.ydl_pay.common.bean.CommonCouponBean
import kotlinx.android.synthetic.main.item_coupon_title.view.*
/**
......
package com.yidianling.ydl_pay.bean;
package com.yidianling.ydl_pay.common.bean;
import java.util.ArrayList;
import java.util.List;
......
package com.yidianling.ydl_pay.bean
package com.yidianling.ydl_pay.common.bean
/**
* @author jiucheng
......
package com.yidianling.ydl_pay.bean
package com.yidianling.ydl_pay.common.bean
/**
* author : Zhangwenchao
......
package com.yidianling.ydl_pay.common.bean; import android.text.TextUtils; import java.util.Map; public class PayResult { private String resultStatus; private String result; private String memo; public PayResult(Map<String, String> rawResult) { if (rawResult == null) { return; } for (String key : rawResult.keySet()) { if (TextUtils.equals(key, "resultStatus")) { resultStatus = rawResult.get(key); } else if (TextUtils.equals(key, "result")) { result = rawResult.get(key); } else if (TextUtils.equals(key, "memo")) { memo = rawResult.get(key); } } } @Override public String toString() { return "resultStatus={" + resultStatus + "};memo={" + memo + "};result={" + result + "}"; } /** * @return the resultStatus */ public String getResultStatus() { return resultStatus; } /** * @return the memo */ public String getMemo() { return memo; } /** * @return the result */ public String getResult() { return result; }}
\ No newline at end of file
package com.yidianling.ydl_pay.bean.params;
package com.yidianling.ydl_pay.common.bean.params;
/**
* @author jiucheng
......
package com.yidianling.ydl_pay.bean.params;
package com.yidianling.ydl_pay.common.bean.params;
import com.ydl.ydlcommon.data.http.BaseCommand;
......
package com.yidianling.ydl_pay.bean.params;
package com.yidianling.ydl_pay.common.bean.params;
import com.ydl.ydlcommon.data.http.BaseCommand;
......
package com.yidianling.ydl_pay.bean.params;
package com.yidianling.ydl_pay.common.bean.params;
import com.ydl.ydlcommon.data.http.BaseCommand;
......
package com.yidianling.ydl_pay.bean.params;
package com.yidianling.ydl_pay.common.bean.params;
import com.ydl.ydlcommon.data.http.BaseCommand;
......
package com.yidianling.ydl_pay.bean.params;
package com.yidianling.ydl_pay.common.bean.params;
import com.ydl.ydlcommon.base.BaseApp;
import com.ydl.ydlcommon.base.config.YDLConstants;
......
package com.yidianling.ydl_pay.http
package com.yidianling.ydl_pay.common.http
/**
* @author jiucheng
......
package com.yidianling.ydl_pay.http
package com.yidianling.ydl_pay.common.http
import com.google.gson.Gson
import com.ydl.ydlcommon.data.http.BaseCommand
import com.ydl.ydlcommon.data.http.BaseResponse
import com.ydl.ydlcommon.utils.NetworkParamsUtils
import com.ydl.ydlnet.YDLHttpUtils
import com.yidianling.ydl_pay.actionpoint.ActionDataBean
import com.yidianling.ydl_pay.bean.*
import com.yidianling.ydl_pay.bean.params.CheckRequestCouponBean
import com.yidianling.ydl_pay.bean.params.CreateOrderRequestBean
import com.yidianling.ydl_pay.bean.params.GetAllCouponRequestBean
import com.yidianling.ydl_pay.bean.params.OrderRequestBean
import com.yidianling.ydl_pay.common.actionpoint.ActionDataBean
import com.yidianling.ydl_pay.common.bean.*
import com.yidianling.ydl_pay.common.bean.params.CheckRequestCouponBean
import com.yidianling.ydl_pay.common.bean.params.CreateOrderRequestBean
import com.yidianling.ydl_pay.common.bean.params.GetAllCouponRequestBean
import com.yidianling.ydl_pay.common.bean.params.OrderRequestBean
import com.yidianling.ydl_pay.pay.bean.RechargeBean
import io.reactivex.Observable
import okhttp3.MediaType
import okhttp3.RequestBody
......@@ -112,6 +113,23 @@ class HttpUtils {
return YDLHttpUtils.obtainApi(PayServices::class.java).pay(map)
}
/**
* 获得充值单号
*/
fun recharge(bean: BaseCommand): Observable<BaseResponse<RechargeBean>> {
var params = NetworkParamsUtils.getPostList(bean)
var map = NetworkParamsUtils.getMaps(params)
return YDLHttpUtils.obtainApi(PayServices::class.java).recharge(map)
}
/**
* 微信充值
*/
fun wxRecharge(bean: BaseCommand): Observable<BaseResponse<CommonWXPayBean>> {
var params = NetworkParamsUtils.getPostList(bean)
var map = NetworkParamsUtils.getMaps(params)
return YDLHttpUtils.obtainApi(PayServices::class.java).wxRecharge(map)
}
/**
* 行为数据埋点统计接口
......
package com.yidianling.ydl_pay.http
package com.yidianling.ydl_pay.common.http
import com.ydl.ydlcommon.base.config.YDL_DOMAIN
import com.ydl.ydlcommon.base.config.YDL_DOMAIN_JAVA
import com.ydl.ydlcommon.data.http.BaseResponse
import com.yidianling.ydl_pay.bean.*
import com.yidianling.ydl_pay.common.bean.*
import com.yidianling.ydl_pay.pay.bean.RechargeBean
import io.reactivex.Observable
import okhttp3.RequestBody
import retrofit2.http.*
......@@ -75,4 +76,14 @@ interface PayServices {
@FormUrlEncoded
@POST("pay/vcount-pay")
fun pay(@FieldMap params: Map<String, String>): Observable<BaseResponse<Any>>
//获得充值单号
@FormUrlEncoded
@POST("pay/recharge")
fun recharge(@FieldMap params: Map<String, String>): Observable<BaseResponse<RechargeBean>>
//微信充值
@FormUrlEncoded
@POST("pay/recharge-wx-option")
fun wxRecharge(@FieldMap params: Map<String, String>): Observable<BaseResponse<CommonWXPayBean>>
}
\ No newline at end of file
package com.yidianling.ydl_pay.http.log;
package com.yidianling.ydl_pay.common.http.log;
import android.util.Log;
......
package com.yidianling.ydl_pay.http.utils;
package com.yidianling.ydl_pay.common.http.utils;
import com.yidianling.ydl_pay.BuildConfig;
......
package com.yidianling.ydl_pay.http.utils;
package com.yidianling.ydl_pay.common.http.utils;
import android.content.Context;
import android.content.Intent;
......
package com.yidianling.ydl_pay.http.utils;
package com.yidianling.ydl_pay.common.http.utils;
import android.app.Activity;
import android.app.KeyguardManager;
......
package com.yidianling.ydl_pay.toast
package com.yidianling.ydl_pay.common.toast
import android.content.Context
import android.support.annotation.StringRes
......@@ -24,11 +24,13 @@ class ToastHelper private constructor() {
}
fun show(context: Context, text: String) {
getInstance().show(context.applicationContext, text)
getInstance()
.show(context.applicationContext, text)
}
fun show(context: Context, @StringRes resId: Int) {
getInstance().show(context.applicationContext, resId)
getInstance()
.show(context.applicationContext, resId)
}
}
......
package com.yidianling.ydl_pay.widget
package com.yidianling.ydl_pay.common.widget
import android.annotation.SuppressLint
import android.content.Context
......@@ -7,7 +7,7 @@ import android.view.View
import android.view.ViewGroup
import android.widget.RelativeLayout
import com.yidianling.ydl_pay.R
import com.yidianling.ydl_pay.bean.CommonCouponBean
import com.yidianling.ydl_pay.common.bean.CommonCouponBean
import kotlinx.android.synthetic.main.view_coupon_info_detail.view.*
import java.lang.Float
import java.math.BigDecimal
......
package com.yidianling.ydl_pay.widget;
package com.yidianling.ydl_pay.common.widget;
import android.content.Context;
import android.support.v4.view.ViewPager;
......
package com.yidianling.ydl_pay.widget
package com.yidianling.ydl_pay.common.widget
import android.content.Context
import android.os.Handler
......@@ -13,14 +13,14 @@ import android.view.inputmethod.InputMethodManager
import android.widget.EditText
import android.widget.LinearLayout
import android.widget.TextView
import com.yidianling.ydl_pay.adapter.SelectCouponAdapter
import com.yidianling.ydl_pay.http.HttpUtils
import com.yidianling.ydl_pay.toast.ToastHelper
import com.yidianling.ydl_pay.common.adapter.SelectCouponAdapter
import com.yidianling.ydl_pay.common.http.HttpUtils
import com.yidianling.ydl_pay.common.toast.ToastHelper
import com.yidianling.ydl_pay.R
import com.yidianling.ydl_pay.bean.AllCouponListBean
import com.yidianling.ydl_pay.bean.CommonCouponBean
import com.yidianling.ydl_pay.bean.params.CheckRequestCouponBean
import com.yidianling.ydl_pay.http.utils.NetUtils
import com.yidianling.ydl_pay.common.bean.AllCouponListBean
import com.yidianling.ydl_pay.common.bean.CommonCouponBean
import com.yidianling.ydl_pay.common.bean.params.CheckRequestCouponBean
import com.yidianling.ydl_pay.common.http.utils.NetUtils
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.schedulers.Schedulers
import kotlinx.android.synthetic.main.head_course_code_view.view.*
......
package com.yidianling.ydl_pay.widget
package com.yidianling.ydl_pay.common.widget
import android.annotation.SuppressLint
import android.content.Context
......@@ -6,8 +6,8 @@ import android.view.View
import android.view.ViewGroup
import android.widget.LinearLayout
import com.yidianling.ydl_pay.R
import com.yidianling.ydl_pay.bean.CommonCouponBean
import com.yidianling.ydl_pay.bean.OrderInfoBean
import com.yidianling.ydl_pay.common.bean.CommonCouponBean
import com.yidianling.ydl_pay.common.bean.OrderInfoBean
import kotlinx.android.synthetic.main.view_pay_info_detail.view.*
import java.math.BigDecimal
......
package com.yidianling.ydl_pay.pay
import android.os.Parcel
import android.os.Parcelable
/**
* author : Zhangwenchao
* e-mail : zhangwch@yidianling.com
* time : 2018/04/24
* update : yuanWai 2018/10/29
*/
data class PayParams(
var inlet : Int = INLET_NORMAL,
/**
* 类型 1 -> 充值,2 -> 付款
*/
var type: Int = PAY,
/**
* 类型标题
*/
var title: String = "",
/**
* 是否显示付款保障
*/
var visibleIndemnity: Boolean = false,
/**
* 支付按钮显示的文本
*/
var btnPayText: String = "确认",
/**
* 需要支付的金额
*/
var needPay: Float = 0F,
/**
* 订单id(如果是测评入口的话 就是测试题Id)
*/
var payId: String = "",
/**
* 已使用的红包金额(代付款列表入口 使用)
*/
var coupon_money: Float = 0F
) : Parcelable {
constructor(parcel: Parcel) : this(
parcel.readInt(),
parcel.readInt(),
parcel.readString(),
parcel.readByte() != 0.toByte(),
parcel.readString(),
parcel.readFloat(),
parcel.readString(),
parcel.readFloat())
override fun writeToParcel(parcel: Parcel, flags: Int) {
parcel.writeInt(inlet)
parcel.writeInt(type)
parcel.writeString(title)
parcel.writeByte(if (visibleIndemnity) 1 else 0)
parcel.writeString(btnPayText)
parcel.writeFloat(needPay)
parcel.writeString(payId)
parcel.writeFloat(coupon_money)
}
override fun describeContents(): Int {
return 0
}
companion object CREATOR : Parcelable.Creator<PayParams> {
/**
* 1.充值 2.付款
*/
const val RECHARGE = 1
const val PAY = 2
/**
* 入口类型
* 1.正常入口(默认) 2.测评入口
*/
const val INLET_NORMAL = 1
const val INLET_TEST = 2
override fun createFromParcel(parcel: Parcel): PayParams {
return PayParams(parcel)
}
override fun newArray(size: Int): Array<PayParams?> {
return arrayOfNulls(size)
}
}
}
\ No newline at end of file
package com.yidianling.ydl_pay.pay
import io.reactivex.Observable
import io.reactivex.subjects.PublishSubject
import io.reactivex.subjects.Subject
/**
* author : Zhangwenchao
* e-mail : zhangwch@yidianling.com
* time : 2018/04/18
*/
class RxBus private constructor(){
companion object {
fun getInstance(): RxBus {
return Holder.INSTANCE
}
}
private val mBus: Subject<Any>
init {
mBus = PublishSubject.create()
}
fun <T>toObservable(tClass: Class<T>): Observable<T> {
return mBus.ofType(tClass)
}
fun post(any: Any) {
mBus.onNext(any)
}
private object Holder {
val INSTANCE = RxBus()
}
}
\ No newline at end of file
package com.yidianling.ydl_pay.pay
import android.app.Activity
import android.content.Context
import com.alipay.sdk.app.PayTask
import com.yidianling.ydl_pay.pay.bean.PayStatus
import com.tencent.mm.opensdk.constants.Build
import com.tencent.mm.opensdk.modelpay.PayReq
import com.tencent.mm.opensdk.openapi.WXAPIFactory
import com.yidianling.ydl_pay.pay.bean.WXPayEvent
import com.ydl.ydlcommon.data.http.CustomThrowable
import com.yidianling.ydl_pay.common.bean.PayResult
import de.greenrobot.event.EventBus
import io.reactivex.Emitter
import io.reactivex.Observable
import io.reactivex.schedulers.Schedulers
/**
* author : Zhangwenchao
* e-mail : zhangwch@yidianling.com
* time : 2018/04/18
*/
object RxPay {
init {
EventBus.getDefault().register(this)
}
private var emitter: Emitter<PayStatus>? = null
// 微信支付
fun wxPay(context: Context, option: WXPay.WXOption): Observable<PayStatus> {
return Observable.create<PayStatus> { e ->
val api = WXAPIFactory.createWXAPI(context, null)
if (api.wxAppSupportAPI < Build.PAY_SUPPORTED_SDK_INT) {
e.onError(CustomThrowable("目前您的微信版本过低或未安装微信,需要安装微信才能使用"))
e.onComplete()
}
emitter = e
api.registerApp(option.appid)
val request = PayReq()
request.appId = option.appid
request.partnerId = option.partnerid
request.prepayId = option.prepayid
request.packageValue = "Sign=WXPay"
request.nonceStr = option.noncestr
request.timeStamp = option.timestamp
request.sign = option.sign
api.sendReq(request)
}.subscribeOn(Schedulers.io())
}
// 支付宝支付
fun aliPay(activity: Activity, aliSign: String): Observable<PayStatus> {
return Observable.create<PayStatus> {
val alipay = PayTask(activity)
val result = alipay.payV2(aliSign, true)
val payResult = PayResult(result)
when {
"9000" == payResult.resultStatus -> it.onNext(PayStatus(true))
else -> it.onError(CustomThrowable(payResult.memo))
}
it.onComplete()
}
}
fun onEvent(event: WXPayEvent) {
if (event.status.success) {
emitter?.onNext(event.status)
} else {
emitter?.onError(Throwable("支付失败", null))
}
emitter?.onComplete()
}
}
\ No newline at end of file
package com.yidianling.ydl_pay.pay.bean
data class AliInfo(val alipayPartner: String,
val alipayKey: String,
val alipaySellerEmail: String,
val alipayNotifyUrl: String,
val alirsakey: String)
\ No newline at end of file
package com.yidianling.ydl_pay.pay.bean
/**
* author : Zhangwenchao
* e-mail : zhangwch@yidianling.com
* time : 2018/04/20
*/
open class PayParam(payId: String, val type: String) {
data class WxPayParam(val payId: String) : PayParam(payId, "wxapp_hz")
data class AliPayParam(val payId: String) : PayParam(payId, "aliapp")
}
\ No newline at end of file
package com.yidianling.ydl_pay.pay.bean
import android.support.annotation.Keep
/**
* author : Zhangwenchao
* e-mail : zhangwch@yidianling.com
* time : 2018/04/18
*
* 支付状态
*/
@Keep
data class PayStatus(val success: Boolean)
\ No newline at end of file
package com.yidianling.ydl_pay.pay.bean
import android.support.annotation.Keep
/**
* author : Zhangwenchao
* e-mail : zhangwch@yidianling.com
* time : 2018/04/19
*/
@Keep
data class RechargeBean(val rechargeId: String,
/**
* 支付金额
*/
val money : String,
val aliInfo: AliInfo,
/**
* 支付宝 加签
*/
val aliSign : String)
\ No newline at end of file
package com.yidianling.ydl_pay.pay.bean;
import com.ydl.ydlcommon.data.http.BaseCommand;
/**
* @author jiucheng
* @描述:
* @Copyright Copyright (c) 2018
* @Company 壹点灵
* @date 2020/2/6
*/
public class RechargeParam extends BaseCommand {
public String money;
public RechargeParam(String money) {
this.money = money;
}
}
package com.yidianling.ydl_pay.pay.bean
/**
* @author yuanWai
* @描述:测评下单接口 数据接收bean
* @Copyright Copyright (c) 2018
* @Company 壹点灵
* @date 2018/10/26
*/
data class TestAddOrderBean(
/**
* 支付ID
*/
val payId : String?,
/**
* 订单ID
*/
val orderId : String?,
/**
* 需支付金额
*/
val money : String?,
/**
* 商品名称
*/
val title : String?,
/**
* 用户 ID
*/
val uid : String?,
/**
* 支付成功跳转链接
*/
val succ : String?)
\ No newline at end of file
package com.yidianling.ydl_pay.pay.bean
/**
* @author : Zhangwenchao
* @e-mail : zhangwch@yidianling.com
* @time : 2018/6/4
*/
data class WXPayEvent(val status: PayStatus)
\ No newline at end of file
package com.yidianling.ydl_pay.pay.bean;
import com.ydl.ydlcommon.data.http.BaseCommand;
/**
* @author jiucheng
* @描述:
* @Copyright Copyright (c) 2018
* @Company 壹点灵
* @date 2020/2/6
*/
public class WXRechargeIdParam extends BaseCommand {
public String rechargeId;
public WXRechargeIdParam(String rechargeId) {
this.rechargeId = rechargeId;
}
}
package com.yidianling.ydl_pay.pay.payDialog
/**
* 倾诉支付参数
*/
class ConfidePayParams{
var payTitle : String? = null
//订单金额
var orderPrice : Double? = null
//优惠金额
var coupnPrice : Double? = null
//可用余额
var avliableMoney : Double? = null
//支付id
var payId : String? = null
//支付成功跳转地址
var confideUrl : String? = null
constructor(payTitle: String?, orderPrice: Double?, coupnPrice: Double?, avliableMoney: Double?, payId: String?, confideUrl: String?) {
this.payTitle = payTitle
this.orderPrice = orderPrice
this.coupnPrice = coupnPrice
this.avliableMoney = avliableMoney
this.payId = payId
this.confideUrl = confideUrl
}
}
\ No newline at end of file
package com.yidianling.ydl_pay.pay.payDialog
import android.annotation.SuppressLint
import android.app.Activity
import android.app.Dialog
import android.graphics.Point
import android.os.Bundle
import android.support.v7.app.AlertDialog
import android.view.*
import com.ydl.ydlcommon.data.http.RxUtils
import com.ydl.ydlcommon.utils.StringUtils
import com.ydl.ydlcommon.utils.log.LogHelper
import com.ydl.ydlcommon.utils.remind.ToastHelper
import com.yidianling.ydl_pay.R
import com.yidianling.ydl_pay.common.bean.params.AliPayParam
import com.yidianling.ydl_pay.common.bean.params.WxPayParam
import com.yidianling.ydl_pay.common.http.HttpUtils
import com.yidianling.ydl_pay.pay.RxPay
import com.yidianling.ydl_pay.pay.bean.PayStatus
import io.reactivex.Observable
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.schedulers.Schedulers
import kotlinx.android.synthetic.main.pay_dialog_pay.*
import kotlinx.android.synthetic.main.pay_fragment_loading_dialog.view.*
import java.util.concurrent.TimeUnit
import kotlin.properties.Delegates
@SuppressLint("ValidFragment")
//新的支付弹窗
class PayDialog : Dialog {
//回调函数
private var callBack: CallBack? = null
/**
* 支付类型
* 1.微信支付 2.支付宝支付
*/
private val PAY_WECHAT = 1
private val PAY_ALI = 2
//加载中弹窗
private var dialog: AlertDialog? = null
private var dialogContentView: View? = null
/**
* 已选择支付方式
*/
private var payType = PAY_WECHAT
private var data: ConfidePayParams? = null
private var activity: Activity by Delegates.notNull()
constructor(context: Activity) : super(context) {
this.activity = context
}
override fun onStart() {
super.onStart()
//设置 dialog 的宽高
window.setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)
//设置 dialog 的背景为 null
window.setBackgroundDrawable(null)
}
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
//去除标题栏
requestWindowFeature(Window.FEATURE_NO_TITLE)
val lp = window.attributes
lp.gravity = Gravity.BOTTOM //底部
lp.width = WindowManager.LayoutParams.MATCH_PARENT
// lp.windowAnimations = R.style.BottomDialogAnimation
window.attributes = lp
setContentView(R.layout.pay_dialog_pay)
initView()
if (data != null) {
text_title.text = data!!.payTitle ?: "倾诉服务"
setFoodPrice("¥${StringUtils.save2Double(data?.orderPrice ?: 0.00)}")
setSaleText("-¥${StringUtils.save2Double(data?.coupnPrice ?: 0.00)}")
setAvliableMoney("-¥${StringUtils.save2Double(data?.avliableMoney ?: 0.00)}")
setPayMoney()
}
}
fun initView() {
//确定支付
text_pay.setOnClickListener {
appPay()
}
//切换支付方式
ll_wechat.setOnClickListener {
payType = PAY_WECHAT
iv_wechat.setImageResource(R.drawable.pay_img_select)
iv_alipay.setImageResource(R.drawable.pay_img_no_select)
}
ll_alipay.setOnClickListener {
payType = PAY_ALI
iv_wechat.setImageResource(R.drawable.pay_img_no_select)
iv_alipay.setImageResource(R.drawable.pay_img_select)
}
}
//设置回调函数
fun setCallback(callBack: CallBack): PayDialog {
this.callBack = callBack
return this
}
//设置数据
fun show(data: ConfidePayParams?) {
this.data = data
show()
}
//设置三方支付是否显示
fun setOtherPayVisibity(visibity: Int) {
text_paytip.visibility = visibity
lin_pay.visibility = visibity
}
//设置商品价格
fun setFoodPrice(moeny: String) {
text_oldmoney.text = moeny
}
//设置可用余额
fun setAvliableMoney(moeny: String) {
text_yu_e.text = moeny
}
//设置优惠信息
fun setSaleText(money: String) {
text_youhui.text = money
}
//设置应支付金额
fun setPayMoney() {
if (data != null && data!!.orderPrice != null && data!!.coupnPrice != null && data!!.avliableMoney != null) {
var price: Double = data!!.orderPrice!! - data!!.coupnPrice!! - data!!.avliableMoney!!
if (price < 0.00) {
price = 0.00
}
text_money.text = "¥${StringUtils.save2Double(price)}"
} else {
text_money.text = "--"
}
}
/**
* app 支付,微信或支付宝
*/
@SuppressLint("CheckResult")
private fun appPay() {
if (data?.payId == null) {
ToastHelper.show("支付id有误,请返回重试")
return
}
Observable.just(payType)
.subscribeOn(Schedulers.io())
.flatMap {
when (it) {
0, 1 -> {
wxPayById(data?.payId!!)
}
else -> {
aliPayById(data?.payId!!)
}
}
}
.observeOn(AndroidSchedulers.mainThread())
.doOnSubscribe { showProgressDialog("") }
.doAfterTerminate { if (!activity.isFinishing) dismissProgressDialog() }
.subscribe({
//防止支付后支付端和服务端通知同步延迟 , 1.5秒后回调callback
Observable.timer(1500, TimeUnit.MILLISECONDS)
.observeOn(AndroidSchedulers.mainThread())
.subscribe {
if (activity != null && !activity.isFinishing) dismissProgressDialog()
this.callBack?.onSuccess()
}
LogHelper.getInstance().writeLogSync("支付成功")
this.callBack?.onSuccess()
dismiss()
}, {
ToastHelper.show(it.message ?: "支付失败")
LogHelper.getInstance().writeLogSync("支付失败:${it.message}")
})
}
/**
* 微信支付
* @param payId 支付id
*/
private fun wxPayById(payId: String): Observable<PayStatus> {
val bean = WxPayParam(payId, 1)
return HttpUtils.wxPay(bean)
.compose(RxUtils.resultData())
.observeOn(AndroidSchedulers.mainThread())
.flatMap { RxPay.wxPay(activity, it.option) }
}
/**
* 支付宝支付
* @param payId 支付Id
*/
private fun aliPayById(payId: String): Observable<PayStatus> {
var bean = AliPayParam(payId, 1)
return HttpUtils.getAliPayOrderId(bean)
.compose(RxUtils.resultData())
.flatMap {
RxPay.aliPay(activity, it.aliSign)
}
}
/**
* 显示加载中弹窗
*/
private fun showProgressDialog(str: String?) {
if (activity == null || activity.isFinishing) {
return
}
if (dialog != null && dialog!!.isShowing) {
return
}
if (dialog == null) {
dialog = AlertDialog.Builder(activity)
.create()
}
if (dialogContentView == null) {
dialogContentView = LayoutInflater.from(activity).inflate(R.layout.pay_fragment_loading_dialog, null)
dialogContentView?.tvMsg?.visibility = View.GONE
}
dialog?.show()
dialog?.window?.setContentView(dialogContentView)
dialog?.window?.setGravity(Gravity.CENTER)
val p = dialog?.window!!.attributes //获取对话框当前的参数值
var point = Point()
activity.windowManager.defaultDisplay.getSize(point)// 获取屏幕宽、高用
p.height = (point.y * 0.2).toInt()
p.width = (point.x * 0.35).toInt()
dialog?.window!!.attributes = p //设置生效
}
/**
* 隐藏加载中弹窗
*/
private fun dismissProgressDialog() {
if (dialog != null && dialog!!.isShowing) {
dialog!!.dismiss()
}
}
}
/**
* 支付成功回调函数
*/
interface CallBack {
fun onSuccess()
fun onError()
}
\ No newline at end of file
package com.yidianling.ydl_pay.pay.redpacket
import android.os.Parcel
import android.os.Parcelable
/**
* @author yuanwai
* @描述:红包数据bean
* @Copyright Copyright (c) 2018
* @Company 壹点灵
* @date 2018/10/23
*/
data class RedPacketBean(
/**
* 红包 ID
*/
val id : String? = "",
/**
* 红包金额
*/
val coupon_money : Float? = 0F,
/**
* 用户 ID
*/
val uid : String? = "",
/**
* 红包标题
*/
val title : String? = "",
/**
* 红包说明
*/
val explain : String? = "",
/**
* 使用类型 1永久使用 2 有效期内使用
*/
val use_type : Int? = 2,
/**
* 是否选中
*/
val selected : Boolean? = false,
/**
* 截止日期
*/
val use_time_end : String? = ""): Parcelable {
constructor(parcel: Parcel) : this(
parcel.readString(),
parcel.readFloat(),
parcel.readString(),
parcel.readString(),
parcel.readString(),
parcel.readInt(),
parcel.readByte() != 0.toByte(),
parcel.readString()) {
}
override fun writeToParcel(parcel: Parcel, flags: Int) {
parcel.writeString(id)
parcel.writeFloat(coupon_money!!)
parcel.writeString(uid)
parcel.writeString(title)
parcel.writeString(explain)
parcel.writeInt(use_type!!)
parcel.writeByte(if (selected!!) 1 else 0)
parcel.writeString(use_time_end)
}
override fun describeContents(): Int {
return 0
}
companion object CREATOR : Parcelable.Creator<RedPacketBean> {
override fun createFromParcel(parcel: Parcel): RedPacketBean {
return RedPacketBean(parcel)
}
override fun newArray(size: Int): Array<RedPacketBean?> {
return arrayOfNulls(size)
}
}
}
\ No newline at end of file
package com.yidianling.ydl_pay.pay.redpacket
/**
* @author yuanWai
* @描述:
* @Copyright Copyright (c) 2018
* @Company 壹点灵
* @date 2018/10/25
*/
data class RedPacketParam(val p : String)
\ No newline at end of file
package com.yidianling.ydl_pay.pay.redpacket
import android.os.Parcel
import android.os.Parcelable
import com.yidianling.ydl_pay.pay.PayParams
/**
* @author yuanWai
* @描述:
* @Copyright Copyright (c) 2018
* @Company 壹点灵
* @date 2018/10/25
*/
data class RedPacketPayBean(val payParams: PayParams,
val data: ArrayList<RedPacketBean>): Parcelable {
constructor(parcel: Parcel) : this(
parcel.readParcelable(PayParams::class.java.classLoader),
parcel.createTypedArrayList(RedPacketBean.CREATOR)) {
}
override fun writeToParcel(parcel: Parcel, flags: Int) {
parcel.writeParcelable(payParams, flags)
parcel.writeTypedList(data)
}
override fun describeContents(): Int {
return 0
}
companion object CREATOR : Parcelable.Creator<RedPacketPayBean> {
override fun createFromParcel(parcel: Parcel): RedPacketPayBean {
return RedPacketPayBean(parcel)
}
override fun newArray(size: Int): Array<RedPacketPayBean?> {
return arrayOfNulls(size)
}
}
}
\ No newline at end of file
package com.yidianling.ydl_pay.pay.redpacket
import android.annotation.SuppressLint
import android.app.Activity
import android.graphics.drawable.BitmapDrawable
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.ImageView
import android.widget.LinearLayout
import android.widget.RelativeLayout
import com.ydl.ydlcommon.utils.Utils
import com.yidianling.common.tools.RxImageTool
import com.yidianling.common.view.popupwindow.BasePopupWindow
import com.yidianling.ydl_pay.R
@Suppress("DEPRECATION")
/**
* @author yuanWai
* @描述:红包弹窗
* @Copyright Copyright (c) 2018
* @Company 壹点灵
* @date 2018/10/23
*/
class RedPacketPopWindow : BasePopupWindow {
//红包集合
var list : ArrayList<RedPacketBean>? = null
//选中红包监听器
var listener : OnSelectListener? = null
//选中的索引
private var selectIndex : Int = 0
constructor(mActivity: Activity, dataList : ArrayList<RedPacketBean>?, onSelectListener: OnSelectListener) : super(mActivity){
if (null == list){
list = ArrayList()
}else{
list!!.clear()
}
if (dataList != null) {
list!!.addAll(dataList)
}
initPopupwindow()
this.listener = onSelectListener
}
@SuppressLint("InflateParams")
override fun initPopupwindow() {
super.initPopupwindow()
mView = LayoutInflater.from(mContext).inflate(R.layout.pay_redpacket_pop_layout, null, false)
popupWindow!!.width = ViewGroup.LayoutParams.MATCH_PARENT
popupWindow!!.height = (Utils.getScreenHeight(mContext) * 0.66).toInt()
popupWindow!!.setBackgroundDrawable(BitmapDrawable())
popupWindow!!.setOnDismissListener(this)
popupWindow!!.contentView = mView
//创建view
createView(mView!!)
//填充数据
bindData()
mView?.findViewById<RelativeLayout>(R.id.rl_notUse)?.setOnClickListener {
selectRedPacket(null,-1)
}
}
/**
* 根据数据创建红包View
* 如果原有的view少于数据的个数 那就add
* 如果原有的view大于数据的个数 那就remove
*/
private fun createView(view : View){
val llContent = view.findViewById<LinearLayout>(R.id.ll_content)
if (llContent.childCount - 1 < list!!.size){
//如果数据源个数大于view个数 则add
for (index in 0 until list!!.size){
val marginTop = if (index == 0){
RxImageTool.dip2px(20f)
}else{
0
}
if (index+1 > llContent.childCount - 1){
val redPacketView = RedPacketView(mContext!!,marginTop)
llContent.addView(redPacketView)
}
}
}else{
//如果数据源个数小于view个数 则remove
val count = llContent.childCount - 1 - list!!.size
if (count == 0){
return
}
val end = llContent.childCount - 1 - count
val start = llContent.childCount - 1 - 1
for (index in start..end){
llContent.removeViewAt(index)
}
}
}
/**
* 根据现有的view个数进行数据填充
*/
fun bindData(){
if (selectIndex == -1){
mView!!.findViewById<ImageView>(R.id.imgCheck).visibility = View.VISIBLE
}else{
mView!!.findViewById<ImageView>(R.id.imgCheck).visibility = View.INVISIBLE
}
val llContent = mView!!.findViewById<LinearLayout>(R.id.ll_content)
for (index in 0 until list!!.size){
val redPacketView = llContent.getChildAt(index + 1)
if (redPacketView is RedPacketView){
redPacketView.initData(list!![index],index,object : RedPacketView.ICheckedListener {
override fun checked(bean: RedPacketBean, position : Int) {
selectRedPacket(bean,position)
}
})
redPacketView.checked(selectIndex == index)
}
}
}
/**
* 选择红包
* @param bean 红包数据 如果为null 就是不使用红包
* @param position 选择红包的索引
*/
private fun selectRedPacket(bean: RedPacketBean?, position : Int){
listener?.select(bean)
selectIndex = position
dismiss()
}
interface OnSelectListener {
//选中的红包
fun select(bean: RedPacketBean?)
}
}
\ No newline at end of file
package com.yidianling.ydl_pay.pay.redpacket
import android.annotation.SuppressLint
import android.content.Context
import android.util.AttributeSet
import android.view.View
import android.view.ViewGroup
import android.widget.LinearLayout
import android.widget.RelativeLayout
import com.yidianling.common.tools.RxImageTool
import com.yidianling.ydl_pay.R
import kotlinx.android.synthetic.main.pay_redpacket_view.view.*
/**
* @author yuanWai
* @描述:红包View
* @Copyright Copyright (c) 2018
* @Company 壹点灵
* @date 2018/10/24
*/
class RedPacketView : RelativeLayout{
private var listener : ICheckedListener? = null
constructor(mContext : Context):super(mContext){
initView(0)
}
constructor(mContext : Context,marginTop : Int):super(mContext){
initView(marginTop)
}
constructor(mContext : Context, attrs : AttributeSet) : super(mContext,attrs){
initView(0)
}
constructor(mContext: Context,attrs : AttributeSet,defStyleAttr : Int) : super(mContext,attrs,defStyleAttr){
initView(0)
}
private fun initView(marginTop : Int){
View.inflate(context, R.layout.pay_redpacket_view,this)
var params = LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,RxImageTool.dip2px(90f))
val dp15 = RxImageTool.dip2px(15f)
params.setMargins(dp15,marginTop,dp15,RxImageTool.dip2px(20f))
layoutParams = params
setBackgroundResource(R.drawable.pay_redpacket_item_bg)
}
@SuppressLint("SimpleDateFormat")
fun initData(data : RedPacketBean?, position: Int, listener : ICheckedListener){
this.listener = listener
if (null == data){
visibility = View.GONE
return
}
visibility = View.VISIBLE
val sb = StringBuffer()
// val nf = NumberFormat.getInstance()
sb.append("¥").append(if (null == data.coupon_money) 0 else data.coupon_money.toInt())
//红包说明
tv_title.text = data.title
//截止日期
val timeBuffer = StringBuffer()
if (1 == data.use_type){
//永久使用
timeBuffer.append("永久有效")
}else{
//有效期内使用
timeBuffer.append("有效期至").append(data.use_time_end)
}
tvTimeEnd.text = timeBuffer.toString()
//红包金额
tvMoney.text = sb.toString()
//选择红包监听
setOnClickListener {
if (null != this.listener){
this.listener!!.checked(data,position)
}
}
}
fun checked(isChecked: Boolean){
if (isChecked){
imgCheck.visibility = View.VISIBLE
}else{
imgCheck.visibility = View.GONE
}
}
interface ICheckedListener{
fun checked(bean : RedPacketBean, position : Int)
}
}
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:topRightRadius="10dp" android:topLeftRadius="10dp" />
<solid android:color="@color/white" />
<stroke
android:width="1dp"
android:color="@color/white" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item>
<shape android:shape="rectangle" >
<stroke
android:width="0.5dp"
android:color="#F0F0F0" />
</shape>
</item>
<item
android:bottom="1dp"
android:right="1dp"
android:top="1dp">
<!-- 在实际使用中我发现1dp达不到显示效果,而2dp正好可以显示边框 -->
<shape android:shape="rectangle" >
<solid android:color="@color/white" />
</shape>
</item>
</layer-list>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="6dp"/>
<stroke android:color="#F0F0F0" android:width="0.5dp"/>
</shape>
\ No newline at end of file
......@@ -23,7 +23,7 @@
</RelativeLayout>
<com.yidianling.ydl_pay.widget.NoScrollViewPager
<com.yidianling.ydl_pay.common.widget.NoScrollViewPager
android:id="@+id/view_pager"
android:layout_width="match_parent"
android:layout_height="425dp"
......
<?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="match_parent"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical"
xmlns:app="http://schemas.android.com/apk/res-auto">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingLeft="15dp"
android:background="@drawable/pay_bg_radius_top_white_10"
android:paddingRight="15dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="60dp">
<TextView
android:id="@+id/text_title"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:text="倾诉服务"
android:gravity="center|left"
android:textStyle="bold"
android:textColor="@color/platform_color_242424"
android:textSize="17sp"
android:layout_weight="1"/>
<TextView
android:id="@+id/text_oldmoney"
android:layout_width="wrap_content"
android:layout_height="match_parent"
tools:text="129.00"
android:textColor="@color/platform_color_242424"
android:textStyle="bold"
android:textSize="16sp"
android:gravity="center_vertical"/>
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="0.5dp"
android:background="@color/platform_color_E0E0E0"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="60dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:text="优惠"
android:textSize="15sp"
android:textColor="@color/platform_color_242424"
android:gravity="center|left"
android:layout_weight="1"/>
<TextView
android:id="@+id/text_youhui"
android:layout_width="wrap_content"
android:layout_height="match_parent"
tools:text="50"
android:textSize="15sp"
android:textColor="@color/platform_color_666666"
android:drawablePadding="5dp"
android:gravity="center_vertical"/>
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="0.5dp"
android:background="@color/platform_color_E0E0E0"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="60dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:text="使用余额"
android:textSize="15sp"
android:textColor="@color/platform_color_242424"
android:gravity="center|left"
android:layout_weight="1"/>
<TextView
android:id="@+id/text_yu_e"
android:layout_width="wrap_content"
android:layout_height="match_parent"
tools:text="-9.00"
android:textSize="15sp"
android:textColor="@color/platform_color_666666"
android:gravity="center_vertical"/>
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="0.5dp"
android:background="@color/platform_color_E0E0E0"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="60dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:text="还需支付"
android:textSize="15sp"
android:textColor="@color/platform_color_242424"
android:gravity="center|left"
android:layout_weight="1"/>
<TextView
android:id="@+id/text_money"
android:layout_width="wrap_content"
android:layout_height="match_parent"
tools:text="129.00"
android:textSize="20dp"
android:textColor="@color/platform_color_FF5A4C"
android:gravity="center_vertical"/>
</LinearLayout>
</LinearLayout>
<TextView
android:id="@+id/text_paytip"
android:layout_width="match_parent"
android:layout_height="30dp"
android:text="选择支付方式"
android:textSize="12dp"
android:paddingLeft="15dp"
android:gravity="center_vertical"
android:textColor="@color/platform_color_999999"
android:background="@color/platform_color_F7F7F7"/>
<LinearLayout
android:id="@+id/lin_pay"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/white"
android:paddingLeft="15dp"
android:paddingRight="15dp"
android:orientation="vertical">
<LinearLayout
android:id="@+id/ll_wechat"
android:layout_width="match_parent"
android:layout_height="55dp"
android:gravity="center_vertical"
android:orientation="horizontal">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/pay_wechat_for_pay" />
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_weight="1"
android:text="微信支付"
android:textColor="@color/platform_color_242424"
android:textSize="15sp" />
<ImageView
android:id="@+id/iv_wechat"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/pay_img_select" />
</LinearLayout>
<ImageView
android:layout_width="match_parent"
android:layout_height="@dimen/divide_line_stroke_width"
android:background="#EDEDED" />
<LinearLayout
android:id="@+id/ll_alipay"
android:layout_width="match_parent"
android:layout_height="55dp"
android:gravity="center_vertical"
android:orientation="horizontal">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/pay_zhifubao_for_pay" />
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_weight="1"
android:text="支付宝支付"
android:textColor="@color/platform_color_242424"
android:textSize="15sp" />
<ImageView
android:id="@+id/iv_alipay"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/pay_img_no_select" />
</LinearLayout>
</LinearLayout>
<TextView
android:id="@+id/text_pay"
android:layout_width="match_parent"
android:layout_height="55dp"
android:text="确认付款"
android:gravity="center"
android:textColor="@color/white"
android:textSize="17dp"
android:background="#FF3D9EFF"/>
</LinearLayout>
\ No newline at end of file
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="horizontal"
android:padding="24dp">
<ProgressBar
style="?android:attr/progressBarStyleSmall"
android:layout_width="32dp"
android:layout_height="32dp"/>
<TextView
android:id="@+id/tvMsg"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginStart="16dp"
android:textColor="#ff666666"
android:text="加载中…"/>
</LinearLayout>
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/ll_layout"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="17dp"
android:textSize="16dp"
android:textColor="@color/color_3D3D3D"
android:text="可使用红包"/>
<View
android:layout_width="match_parent"
android:layout_height="0.5dp"
android:layout_marginTop="16dp"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:background="#F0F0F0"/>
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:id="@+id/ll_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="20dp"
android:orientation="vertical">
<!--这样写是因为 padding不好用了 调UI好烦-->
<RelativeLayout
android:id="@+id/rl_notUse"
android:layout_width="match_parent"
android:layout_height="48dp"
android:orientation="horizontal"
android:layout_marginTop="19.5dp"
android:layout_marginStart="15dp"
android:layout_marginEnd="15dp"
android:background="@drawable/pay_redpacket_tv_bg">
<TextView
android:layout_width="wrap_content"
android:layout_height="48dp"
android:gravity="center_vertical"
android:textColor="@color/platform_color_666666"
android:textSize="14sp"
android:text="不使用红包"
android:layout_marginStart="15dp"
tools:ignore="RtlSymmetry" />
<ImageView
android:id="@+id/imgCheck"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_centerVertical="true"
android:layout_marginRight="12dp"
android:layout_alignParentRight="true"
android:visibility="invisible"
android:background="@drawable/pay_img_select"/>
</RelativeLayout>
</LinearLayout>
</ScrollView>
</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<merge xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<LinearLayout
android:id="@+id/ll_Red"
android:layout_width="114dp"
android:layout_height="90dp"
android:background="@drawable/pay_redpacket_icon"
android:orientation="vertical">
<TextView
android:id="@+id/tvMoney"
android:layout_width="114dp"
android:layout_height="90dp"
android:gravity="center"
android:textColor="@color/white"
android:textSize="38dp"
android:textStyle="bold"
tools:text="¥3"/>
</LinearLayout>
<TextView
android:id="@+id/tv_title"
android:layout_toEndOf="@+id/ll_Red"
android:layout_marginTop="17dp"
android:layout_marginStart="12dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="14sp"
android:textColor="@color/platform_color_666666"
android:textStyle="bold"
tools:text="心理测试专属红包"
tools:ignore="SpUsage" />
<TextView
android:id="@+id/tvTimeEnd"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="@+id/ll_Red"
android:layout_alignParentBottom="true"
android:layout_marginStart="12dp"
android:layout_marginBottom="16dp"
android:textSize="10sp"
android:textColor="@color/platform_color_999999"
tools:text="有效期至2018-08-31"/>
<ImageView
android:id="@+id/imgCheck"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_marginTop="16dp"
android:layout_marginRight="12dp"
android:layout_alignParentRight="true"
android:background="@drawable/pay_img_select"/>
</merge>
\ No newline at end of file
......@@ -219,7 +219,7 @@ class LogHelper private constructor() {
return File(yunxin)
}
//获取声网日志
private fun getAgoraLog(context: Context):File{
private fun getAgoraLog(context: Context):File{
val agora = FileUtils.getSDDirectory()+"/"+context.packageName+"/agorasdk.log"
return File(agora)
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment