Commit 8ddb9756 authored by jyx's avatar jyx

合并页面

parent 445df8c3
package com.mints.goodmoney.mvp.model;
import java.io.Serializable;
public class AccountMsgBean implements Serializable {
/**
* toDoKey : C7852652F2EE0EDA035C39349A1AB1C05DA97B9C4BEABDFF4F7DBDB2B5E505F35F433703067DF5142735505C42F58997
* mobileUser : {"head":null,"contribution":0,"sons":0,"account":"18311400069","coin":0}
* wxUser : {"head":"https://thirdwx.qlogo.cn/mmopen/vi_32/zo9QSE4Hgv2M2zGLTyTHyyaM6SKxKkIeJJhU0nxNZxXGAQV0SnBKwqfXkspujZjI23tvgWBJMqlziaq5Cw7r0vg/132","contribution":0,"sons":0,"account":"神秘嘉宾 🦅","coin":2050}
*/
private String toDoKey;
private MobileUserBean mobileUser;
private WxUserBean wxUser;
public String getToDoKey() {
return toDoKey;
}
public void setToDoKey(String toDoKey) {
this.toDoKey = toDoKey;
}
public MobileUserBean getMobileUser() {
return mobileUser;
}
public void setMobileUser(MobileUserBean mobileUser) {
this.mobileUser = mobileUser;
}
public WxUserBean getWxUser() {
return wxUser;
}
public void setWxUser(WxUserBean wxUser) {
this.wxUser = wxUser;
}
public static class MobileUserBean implements Serializable {
/**
* head : null
* contribution : 0
* sons : 0
* account : 18311400069
* coin : 0
*/
private String head;
private int contribution;
private int sons;
private String account;
private int coin;
public String getHead() {
return head;
}
public void setHead(String head) {
this.head = head;
}
public int getContribution() {
return contribution;
}
public void setContribution(int contribution) {
this.contribution = contribution;
}
public int getSons() {
return sons;
}
public void setSons(int sons) {
this.sons = sons;
}
public String getAccount() {
return account;
}
public void setAccount(String account) {
this.account = account;
}
public int getCoin() {
return coin;
}
public void setCoin(int coin) {
this.coin = coin;
}
}
public static class WxUserBean implements Serializable {
/**
* head : https://thirdwx.qlogo.cn/mmopen/vi_32/zo9QSE4Hgv2M2zGLTyTHyyaM6SKxKkIeJJhU0nxNZxXGAQV0SnBKwqfXkspujZjI23tvgWBJMqlziaq5Cw7r0vg/132
* contribution : 0
* sons : 0
* account : 神秘嘉宾 🦅
* coin : 2050
*/
private String head;
private int contribution;
private int sons;
private String account;
private int coin;
public String getHead() {
return head;
}
public void setHead(String head) {
this.head = head;
}
public int getContribution() {
return contribution;
}
public void setContribution(int contribution) {
this.contribution = contribution;
}
public int getSons() {
return sons;
}
public void setSons(int sons) {
this.sons = sons;
}
public String getAccount() {
return account;
}
public void setAccount(String account) {
this.account = account;
}
public int getCoin() {
return coin;
}
public void setCoin(int coin) {
this.coin = coin;
}
}
}
......@@ -2,8 +2,8 @@ package com.mints.goodmoney.mvp.presenters
import com.google.gson.JsonObject
import com.mints.goodmoney.manager.AppHttpManager
import com.mints.goodmoney.mvp.model.AccountMsgBean
import com.mints.goodmoney.mvp.model.BaseResponse
import com.mints.goodmoney.mvp.model.UserBean
import com.mints.goodmoney.mvp.views.AccountMergeView
import com.mints.library.net.neterror.BaseSubscriber
import com.mints.library.net.neterror.Throwable
......@@ -19,19 +19,19 @@ class AccountMergePresenter : BasePresenter<AccountMergeView>() {
vo["keepOneAccountKey"] = keepOneAccountKey
AppHttpManager.getInstance(loanApplication)
.call(loanService.getKeepAccountMsg(vo),
object : BaseSubscriber<BaseResponse<JsonObject>>() {
object : BaseSubscriber<BaseResponse<AccountMsgBean>>() {
override fun onCompleted() {
}
override fun onError(e: Throwable) {
}
override fun onNext(baseResponse: BaseResponse<JsonObject>) {
override fun onNext(baseResponse: BaseResponse<AccountMsgBean>) {
val code = baseResponse.status
val message = baseResponse.message
when (code) {
200 -> {
view.getKeepAccountMsgSuc()
view.getKeepAccountMsgSuc(baseResponse.data)
}
else -> {
view.showToast(message)
......@@ -45,9 +45,10 @@ class AccountMergePresenter : BasePresenter<AccountMergeView>() {
/**
* 保留双账号用户信息
*/
fun toKeepAccount(keepOneAccountKey: String) {
fun toKeepAccount(toDoKey: String, saveType: Int) {
val vo = HashMap<String, Any>()
vo["keepOneAccountKey"] = keepOneAccountKey
vo["toDoKey"] = toDoKey
vo["saveType"] = saveType
AppHttpManager.getInstance(loanApplication)
.call(loanService.toKeepAccount(vo),
object : BaseSubscriber<BaseResponse<JsonObject>>() {
......
package com.mints.goodmoney.mvp.views
import com.mints.goodmoney.mvp.model.AccountMsgBean
interface AccountMergeView : BaseView {
fun getKeepAccountMsgSuc()
fun getKeepAccountMsgSuc(data: AccountMsgBean)
fun getKeepAccountMsgFail()
fun toKeepAccountSuc()
......
......@@ -4,9 +4,14 @@ import android.os.Bundle
import android.view.View
import com.mints.goodmoney.R
import com.mints.goodmoney.common.Constant
import com.mints.goodmoney.mvp.model.AccountMsgBean
import com.mints.goodmoney.mvp.presenters.AccountMergePresenter
import com.mints.goodmoney.mvp.views.AccountMergeView
import com.mints.goodmoney.ui.activitys.base.BaseActivity
import com.mints.goodmoney.ui.widgets.CustomDialogAsApple
import com.mints.goodmoney.ui.widgets.DialogListener
import com.mints.goodmoney.utils.SpanUtils
import com.mints.library.utils.GlideUtils
import kotlinx.android.synthetic.main.activity_account_merge.*
import kotlinx.android.synthetic.main.header_layout.*
......@@ -21,8 +26,16 @@ class AccountMergeActivity : BaseActivity(), View.OnClickListener, AccountMergeV
private lateinit var wxOpenId: String
private lateinit var keepOneAccountKey: String
private var cdaa: CustomDialogAsApple? = null
private var toDoKey: String? = null
private val accountMergePresenter by lazy { AccountMergePresenter() }
companion object {
const val TYPE_SAVE_MOBILE = 1
const val TYPE_SAVE_WECHAT = 2
}
override fun getContentViewLayoutID() = R.layout.activity_account_merge
override fun isApplyKitKatTranslucency() = false
......@@ -37,13 +50,15 @@ class AccountMergeActivity : BaseActivity(), View.OnClickListener, AccountMergeV
}
override fun initViewsAndEvents() {
tv_title.text = "账号绑定"
tv_title.text = "账号合并"
iv_left_icon.visibility = View.VISIBLE
iv_left_icon.setImageResource(R.mipmap.ic_arrow_back)
accountMergePresenter.attachView(this)
initListener()
accountMergePresenter.getKeepAccountMsg(keepOneAccountKey)
if (::keepOneAccountKey.isInitialized) {
accountMergePresenter.getKeepAccountMsg(keepOneAccountKey)
}
}
override fun onDestroy() {
......@@ -55,10 +70,14 @@ class AccountMergeActivity : BaseActivity(), View.OnClickListener, AccountMergeV
when (v?.id) {
R.id.iv_left_icon -> finish()
R.id.btn_invite_left -> {
toDoKey?.let {
hintDialog(it, "微信", TYPE_SAVE_WECHAT)
}
}
R.id.btn_invite_right -> {
toDoKey?.let {
hintDialog(it, "手机号", TYPE_SAVE_MOBILE)
}
}
}
}
......@@ -69,19 +88,66 @@ class AccountMergeActivity : BaseActivity(), View.OnClickListener, AccountMergeV
btn_invite_right.setOnClickListener(this)
}
override fun getKeepAccountMsgSuc() {
private fun hintDialog(toDoKey: String, str: String, type: Int) {
val content = if (type == TYPE_SAVE_WECHAT) {
SpanUtils()
.append("您确定要保留 ")
.append(str).setForegroundColor(resources.getColor(R.color.color_00895B))
.append(" 账号吗?")
.create()
} else {
SpanUtils()
.append("您确定要保留 ")
.append(str).setForegroundColor(resources.getColor(R.color.mainColor))
.append(" 账号吗?")
.create()
}
cdaa = CustomDialogAsApple(context, object : DialogListener() {
override fun onClick(v: View) {
if (cdaa != null && cdaa!!.isShowing) {
cdaa!!.dismiss()
}
when (v.id) {
R.id.dialog_btn_left -> {
}
R.id.dialog_btn_right -> {
accountMergePresenter.toKeepAccount(toDoKey, type)
}
}
}
})
cdaa!!.setTitle("提示")
cdaa!!.setContent(content)
cdaa!!.setLeft("取消")
cdaa!!.setRight("保留")
cdaa!!.show()
}
override fun getKeepAccountMsgFail() {
override fun getKeepAccountMsgSuc(data: AccountMsgBean) {
data.let {
toDoKey = it.toDoKey
GlideUtils.loadImageViewLoding(context, it.wxUser.head, civ_avatar_left, R.mipmap.ic_my, R.mipmap.ic_my)
GlideUtils.loadImageViewLoding(context, it.mobileUser.head, civ_avatar_right, R.mipmap.ic_my, R.mipmap.ic_my)
tv_name_left.text = "" + it.wxUser.account
tv_coin_left.text = "" + it.wxUser.coin
tv_bonus_left.text = "" + it.wxUser.contribution
tv_invited_left.text = "" + it.wxUser.sons
tv_name_right.text = "" + it.wxUser.account
tv_coin_right.text = "" + it.wxUser.coin
tv_bonus_right.text = "" + it.wxUser.contribution
tv_invited_right.text = "" + it.wxUser.sons
}
}
override fun toKeepAccountSuc() {
override fun getKeepAccountMsgFail() {}
override fun toKeepAccountSuc() {
showToast("账号合并成功!")
readyGoThenKill(MainActivity::class.java)
}
override fun toKeepAccountFail() {
}
override fun toKeepAccountFail() {}
}
package com.mints.goodmoney.ui.widgets;
import android.content.Context;
import androidx.core.content.ContextCompat;
import android.text.Spanned;
import android.text.TextUtils;
import android.text.method.ScrollingMovementMethod;
import android.view.Gravity;
import android.view.KeyEvent;
import android.view.View;
import android.view.WindowManager.LayoutParams;
import android.widget.Button;
......@@ -38,6 +41,11 @@ public class CustomDialogAsApple extends BaseDialog {
lp.windowAnimations = R.style.DialogAnimBottom;
getWindow().setAttributes(lp);
// 设置外部不可关闭
setCancelable(false);
setCanceledOnTouchOutside(false);
setOnKeyListener((dialog, keyCode, event) -> keyCode == KeyEvent.KEYCODE_BACK);
// 查找View
dialog_tv_title = findViewById(R.id.dialog_tv_title);
dialog_tv_content = findViewById(R.id.dialog_tv_content);
......
......@@ -96,8 +96,8 @@ class ShareDialog(context: Context) : Dialog(context, R.style.dialog) {
name1.text = userManager.wxName
name2.text = userManager.wxName
}
info1.text = "送你一个赚钱的新模式,快点加入跟我一起赚钱吧"
info2.text = "送你一个赚钱的新模式,快点加入跟我一起赚钱吧"
info1.text = "送你一个赚钱的新模式,\r\n快点加入跟我一起赚钱吧"
info2.text = "送你一个赚钱的新模式,\r\n快点加入跟我一起赚钱吧"
val cb2 = view2.findViewById<CheckBox>(R.id.item_cb_check)
val cb1 = view1.findViewById<CheckBox>(R.id.item_cb_check)
......
......@@ -25,10 +25,16 @@
android:gravity="center_horizontal"
android:orientation="vertical">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@mipmap/ic_draw_wx" />
<com.mints.goodmoney.ui.widgets.CircleImageView
android:id="@+id/civ_avatar_left"
android:layout_width="70dp"
android:layout_height="70dp"
android:layout_marginTop="20dp"
android:src="@mipmap/ic_my" />
<TextView
......@@ -36,8 +42,9 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:text="@string/app_name"
android:textColor="@color/black" />
android:text="@string/dot"
android:textColor="@color/black"
android:textSize="18sp" />
<TextView
android:id="@+id/tv_coin_left"
......@@ -45,9 +52,9 @@
android:layout_height="wrap_content"
android:layout_marginTop="30dp"
android:drawablePadding="6dp"
android:text="@string/app_name"
android:textColor="@color/black"
app:drawableStartCompat="@mipmap/ic_draw_gold" />
android:text="@string/dot"
android:textSize="16sp"
app:drawableStartCompat="@mipmap/ic_coin" />
<TextView
android:id="@+id/tv_bonus_left"
......@@ -55,9 +62,9 @@
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:drawablePadding="6dp"
android:text="@string/app_name"
android:textColor="@color/black"
app:drawableStartCompat="@mipmap/ic_friends_enable" />
android:text="@string/dot"
android:textSize="16sp"
app:drawableStartCompat="@mipmap/ic_gongxian" />
<TextView
android:id="@+id/tv_invited_left"
......@@ -65,9 +72,9 @@
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:drawablePadding="6dp"
android:text="@string/app_name"
android:textColor="@color/black"
app:drawableStartCompat="@mipmap/ic_friends_enable" />
android:text="@string/dot"
android:textSize="16sp"
app:drawableStartCompat="@mipmap/ic_invited" />
<Button
android:id="@+id/btn_invite_left"
......@@ -95,10 +102,16 @@
android:gravity="center_horizontal"
android:orientation="vertical">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@mipmap/ic_draw_phone" />
<com.mints.goodmoney.ui.widgets.CircleImageView
android:id="@+id/civ_avatar_right"
android:layout_width="70dp"
android:layout_height="70dp"
android:layout_marginTop="20dp"
android:src="@mipmap/ic_my" />
<TextView
......@@ -106,8 +119,9 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:text="@string/app_name"
android:textColor="@color/black" />
android:text="@string/dot"
android:textColor="@color/black"
android:textSize="18sp" />
<TextView
android:id="@+id/tv_coin_right"
......@@ -115,9 +129,9 @@
android:layout_height="wrap_content"
android:layout_marginTop="30dp"
android:drawablePadding="6dp"
android:text="@string/app_name"
android:textColor="@color/black"
app:drawableEndCompat="@mipmap/ic_draw_gold" />
android:text="@string/dot"
android:textSize="16sp"
app:drawableEndCompat="@mipmap/ic_coin" />
<TextView
android:id="@+id/tv_bonus_right"
......@@ -125,9 +139,9 @@
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:drawablePadding="6dp"
android:text="@string/app_name"
android:textColor="@color/black"
app:drawableEndCompat="@mipmap/ic_friends_enable" />
android:text="@string/dot"
android:textSize="16sp"
app:drawableEndCompat="@mipmap/ic_gongxian" />
<TextView
android:id="@+id/tv_invited_right"
......@@ -135,9 +149,9 @@
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:drawablePadding="6dp"
android:text="@string/app_name"
android:textColor="@color/black"
app:drawableEndCompat="@mipmap/ic_friends_enable" />
android:text="@string/dot"
android:textSize="16sp"
app:drawableEndCompat="@mipmap/ic_invited" />
<Button
android:id="@+id/btn_invite_right"
......
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white"
......@@ -30,17 +31,17 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:drawableStart="@mipmap/ic_draw_gold"
android:drawablePadding="4dp"
android:gravity="center_vertical"
android:text="我的金币"
android:textSize="16sp"
android:textStyle="bold" />
android:textStyle="bold"
app:drawableStartCompat="@mipmap/ic_draw_gold" />
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="60dp"
android:layout_alignParentRight="true">
android:layout_alignParentEnd="true">
<TextView
android:id="@+id/tvDrawcashGold"
......@@ -56,8 +57,8 @@
android:id="@+id/tvDrawcashGoldabout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="-10dp"
android:layout_toRightOf="@+id/tvDrawcashGold"
android:layout_marginStart="-10dp"
android:layout_toEndOf="@+id/tvDrawcashGold"
android:background="@mipmap/ic_goldtry_about"
android:gravity="center"
android:paddingLeft="1dp"
......@@ -74,7 +75,7 @@
android:layout_height="1px"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:background="@color/color_F8F8F8" />
android:background="@color/color_E6E6E6" />
<RelativeLayout
android:layout_width="match_parent"
......@@ -85,10 +86,10 @@
android:id="@+id/tvDrawcashName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:drawableStart="@mipmap/ic_draw_wx"
android:drawablePadding="4dp"
android:gravity="center_vertical"
android:text="微信昵称" />
android:text="微信昵称"
app:drawableStartCompat="@mipmap/ic_draw_wx" />
<TextView
android:id="@+id/tvDrawcashWx"
......
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