Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
android_goodmoney
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
android
android_goodmoney
Commits
bc4f39b7
Commit
bc4f39b7
authored
Dec 04, 2020
by
mengcuiguang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加微信登录方式,账号合并
parent
0eec1ad6
Changes
24
Hide whitespace changes
Inline
Side-by-side
Showing
24 changed files
with
360 additions
and
22 deletions
+360
-22
Constant.kt
.../app/src/main/java/com/mints/goodmoney/common/Constant.kt
+6
-9
UserManager.java
...rc/main/java/com/mints/goodmoney/manager/UserManager.java
+1
-0
UserBean.java
...src/main/java/com/mints/goodmoney/mvp/model/UserBean.java
+5
-0
DrawcashPresenter.java
...com/mints/goodmoney/mvp/presenters/DrawcashPresenter.java
+4
-1
LoginPresenter.kt
...java/com/mints/goodmoney/mvp/presenters/LoginPresenter.kt
+40
-1
SettingsPresenter.kt
...a/com/mints/goodmoney/mvp/presenters/SettingsPresenter.kt
+2
-1
DrawcashView.java
...main/java/com/mints/goodmoney/mvp/views/DrawcashView.java
+2
-0
LoginView.kt
.../src/main/java/com/mints/goodmoney/mvp/views/LoginView.kt
+1
-0
SettingsView.kt
...c/main/java/com/mints/goodmoney/mvp/views/SettingsView.kt
+2
-0
LoanService.java
...pp/src/main/java/com/mints/goodmoney/net/LoanService.java
+8
-0
AccountMergeActivity.kt
.../com/mints/goodmoney/ui/activitys/AccountMergeActivity.kt
+14
-1
BindMobileActivity.kt
...va/com/mints/goodmoney/ui/activitys/BindMobileActivity.kt
+11
-1
DrawcashActivity.kt
...java/com/mints/goodmoney/ui/activitys/DrawcashActivity.kt
+11
-1
MobileLoginActivity.kt
...a/com/mints/goodmoney/ui/activitys/MobileLoginActivity.kt
+4
-0
SettingsActivity.kt
...java/com/mints/goodmoney/ui/activitys/SettingsActivity.kt
+9
-1
WxLoginActivity.kt
.../java/com/mints/goodmoney/ui/activitys/WxLoginActivity.kt
+4
-0
CoinRecordAdapter.kt
.../java/com/mints/goodmoney/ui/adapter/CoinRecordAdapter.kt
+1
-1
DrawcashRecordAdapter.kt
...a/com/mints/goodmoney/ui/adapter/DrawcashRecordAdapter.kt
+1
-1
MainFragment.kt
...main/java/com/mints/goodmoney/ui/fragment/MainFragment.kt
+15
-1
BindWxDialog.kt
.../main/java/com/mints/goodmoney/ui/widgets/BindWxDialog.kt
+152
-0
shape_green.xml
GoodMoney/app/src/main/res/drawable/shape_green.xml
+1
-1
dialog_bindwx.xml
GoodMoney/app/src/main/res/layout/dialog_bindwx.xml
+64
-0
item_fragment_main_my_task.xml
...ey/app/src/main/res/layout/item_fragment_main_my_task.xml
+1
-1
colors.xml
GoodMoney/app/src/main/res/values/colors.xml
+1
-1
No files found.
GoodMoney/app/src/main/java/com/mints/goodmoney/common/Constant.kt
View file @
bc4f39b7
...
...
@@ -63,11 +63,6 @@ object Constant {
*/
const
val
FIRST_SHARE_INVITED
=
"first_share_invited"
/**
* 存储地址 /storage/emulated/0/test/
*/
var
ICASH_PATH
=
Environment
.
getExternalStorageDirectory
().
path
+
"/money/"
+
"apk/"
/**
* app应用首页 0-主页 1-横屏视频 2-pan 3-friends 4-我
*/
...
...
@@ -96,9 +91,6 @@ object Constant {
const
val
MAIN_CARRIER_TYPE
=
"main_carrier_type"
//载体
const
val
LOGIN_FLAG
=
"login_flag"
//登录标识
// 载体
const
val
CARRIER_VERSUS_VIDEO
=
"CHALLENGE_VEDIO"
//任务-视频
const
val
CARRIER_CHALLENGE_TURN
=
"CHALLENGE_TURN"
//大转盘
...
...
@@ -173,7 +165,7 @@ object Constant {
const
val
SHARE_TITLE
=
"发现一个二傻子平台,人傻钱多,速来~一起薅死他~~"
var
SHARE_CONTENT
=
"邀请码【${UserManager.getInstance().codeID}】,共享新模式,快来加入跟我一起赚钱吧"
// var SHARE_URL: String = BuildConfig.MainIp + "share/shareFriend.html?ruid=" + UserManager.getInstance().getUserID() + "&channel=" + CommonUtils.getAppMetaData(MintsApplication.getContext(), "CHANNEL_NAME")
var
SHARE_URL
:
String
=
BuildConfig
.
MainIp
+
"wxShare/toShare?shareId="
+
UserManager
.
getInstance
().
getUserID
()
+
"&channel="
+
CommonUtils
.
getAppMetaData
(
MintsApplication
.
getContext
(),
"CHANNEL_NAME"
)
var
SHARE_URL
:
String
=
BuildConfig
.
MainIp
+
"wxShare/toShare?shareId="
+
UserManager
.
getInstance
().
getUserID
()
// 首页视频时长 单位-秒
const
val
MAIN_VEDIO_TIME
=
"main_vedio_time"
...
...
@@ -183,4 +175,9 @@ object Constant {
// 游客首次登录弹窗
const
val
FIRST_VISITOR_FLAG
=
"first_visitor_flag"
// 账号合并
const
val
MERGE_MOBILE
=
"merge_mobile"
const
val
MERGE_WXOPENID
=
"merge_wxopenid"
const
val
MERGE_KEY
=
"merge_key"
}
\ No newline at end of file
GoodMoney/app/src/main/java/com/mints/goodmoney/manager/UserManager.java
View file @
bc4f39b7
...
...
@@ -394,6 +394,7 @@ public class UserManager {
ps
.
removeByKey
(
USER_CASH
);
// ps.removeByKey(GAME_INFO);
ps
.
removeByKey
(
USER_OLD
);
ps
.
removeByKey
(
WX_OPENID
);
ps
.
removeByKey
(
WX_NAME
);
ps
.
removeByKey
(
WX_HEADER
);
...
...
GoodMoney/app/src/main/java/com/mints/goodmoney/mvp/model/UserBean.java
View file @
bc4f39b7
...
...
@@ -11,12 +11,17 @@ import java.io.Serializable;
public
class
UserBean
implements
Serializable
{
private
String
token
;
private
String
toKeepAnAccount
;
private
ConsumerBean
consumer
;
public
String
getToken
()
{
return
token
;
}
public
String
getToKeepAnAccount
()
{
return
toKeepAnAccount
;
}
public
ConsumerBean
getConsumer
()
{
return
consumer
;
}
...
...
GoodMoney/app/src/main/java/com/mints/goodmoney/mvp/presenters/DrawcashPresenter.java
View file @
bc4f39b7
...
...
@@ -64,7 +64,7 @@ public class DrawcashPresenter extends BasePresenter<DrawcashView> {
/**
* 修改用户信息
*/
public
void
editUserMsg
(
String
wxInfo
)
{
public
void
editUserMsg
(
String
wx
Openid
,
String
wx
Info
)
{
HashMap
<
String
,
Object
>
vo
=
new
HashMap
<>();
vo
.
put
(
"type"
,
"OPENID"
);
vo
.
put
(
"value"
,
wxInfo
);
...
...
@@ -102,6 +102,9 @@ public class DrawcashPresenter extends BasePresenter<DrawcashView> {
view
.
editUserMsgSuc
();
}
break
;
case
612
:
view
.
mergeAccount
(
UserManager
.
getInstance
().
getMobile
(),
wxOpenid
,
baseResponse
.
getData
().
getToKeepAnAccount
());
break
;
default
:
view
.
showToast
(
message
);
break
;
...
...
GoodMoney/app/src/main/java/com/mints/goodmoney/mvp/presenters/LoginPresenter.kt
View file @
bc4f39b7
...
...
@@ -59,6 +59,44 @@ class LoginPresenter : BasePresenter<LoginView>() {
})
}
/**
* 绑定验证码
*
* @param mobile
*/
fun
sendMobileBindingCode
(
mobile
:
String
)
{
val
vo
=
HashMap
<
String
,
Any
>()
vo
[
"mobile"
]
=
mobile
AppHttpManager
.
getInstance
(
loanApplication
)
.
call
(
loanService
.
sendMobileBindingCode
(
vo
),
object
:
BaseSubscriber
<
BaseResponse
<
Any
>>()
{
override
fun
onCompleted
()
{
if
(
isLinkView
)
return
view
.
hideLoading
()
}
override
fun
onError
(
e
:
Throwable
)
{
if
(
isLinkView
)
return
view
.
hideLoading
()
view
.
showToast
(
e
.
message
)
}
override
fun
onNext
(
baseResponse
:
BaseResponse
<
Any
>)
{
if
(
isLinkView
)
return
val
code
:
Int
=
baseResponse
.
getStatus
()
val
message
:
String
=
baseResponse
.
getMessage
()
when
(
code
)
{
200
->
{
}
else
->
{
view
.
showToast
(
message
)
}
}
}
})
}
/**
* 绑定
*/
...
...
@@ -93,6 +131,7 @@ class LoginPresenter : BasePresenter<LoginView>() {
UserManager
.
getInstance
().
saveUserInfo
(
data
)
view
.
loginSuc
()
}
612
->
view
.
mergeAccount
(
mobile
,
UserManager
.
getInstance
().
wxOpenid
,
data
?.
toKeepAnAccount
!!
)
else
->
view
.
showToast
(
message
)
}
}
...
...
@@ -185,7 +224,7 @@ class LoginPresenter : BasePresenter<LoginView>() {
*
* @param context
*/
fun
saveTerminalInfo
(
userId
:
Long
)
{
fun
saveTerminalInfo
(
userId
:
Long
)
{
val
vo
=
HashMap
<
String
,
Any
>()
val
deviceInfo
:
DeviceInfo
=
DeviceInfo
.
instance
val
macAddress
:
String
=
deviceInfo
.
getMacAddress
()
...
...
GoodMoney/app/src/main/java/com/mints/goodmoney/mvp/presenters/SettingsPresenter.kt
View file @
bc4f39b7
...
...
@@ -14,7 +14,7 @@ class SettingsPresenter : BasePresenter<SettingsView>() {
/**
* 修改用户信息
*/
fun
editUserMsg
(
wxInfo
:
String
)
{
fun
editUserMsg
(
openId
:
String
,
wxInfo
:
String
)
{
val
vo
=
HashMap
<
String
,
Any
>()
vo
[
"type"
]
=
"OPENID"
vo
[
"value"
]
=
wxInfo
...
...
@@ -44,6 +44,7 @@ class SettingsPresenter : BasePresenter<SettingsView>() {
view
.
editUserMsgSuc
()
}
}
612
->
view
.
mergeAccount
(
UserManager
.
getInstance
().
mobile
,
openId
,
baseResponse
.
data
?.
toKeepAnAccount
!!
)
else
->
view
.
showToast
(
message
)
}
}
...
...
GoodMoney/app/src/main/java/com/mints/goodmoney/mvp/views/DrawcashView.java
View file @
bc4f39b7
...
...
@@ -13,4 +13,6 @@ public interface DrawcashView extends BaseView {
* 修改用户信息
*/
void
editUserMsgSuc
();
void
mergeAccount
(
String
mobile
,
String
wxOpenId
,
String
key
);
}
GoodMoney/app/src/main/java/com/mints/goodmoney/mvp/views/LoginView.kt
View file @
bc4f39b7
...
...
@@ -6,4 +6,5 @@ interface LoginView : BaseView {
*/
fun
loginSuc
()
fun
sendCodeSuc
()
fun
mergeAccount
(
mobile
:
String
,
wxOpenId
:
String
,
key
:
String
)
}
\ No newline at end of file
GoodMoney/app/src/main/java/com/mints/goodmoney/mvp/views/SettingsView.kt
View file @
bc4f39b7
...
...
@@ -12,4 +12,6 @@ interface SettingsView : BaseView {
* 获取用户配置信息成功
*/
fun
getUserTaskMsgSuc
(
data
:
DrawcashBean
)
fun
mergeAccount
(
mobile
:
String
,
wxOpenId
:
String
,
key
:
String
)
}
\ No newline at end of file
GoodMoney/app/src/main/java/com/mints/goodmoney/net/LoanService.java
View file @
bc4f39b7
...
...
@@ -131,6 +131,14 @@ public interface LoanService {
@POST
(
"api/sendMobileCode"
)
Observable
<
BaseResponse
<
Object
>>
sendMobileCode
(
@Body
Map
<
String
,
Object
>
vo
);
/**
* 绑定验证码
*
* @return
*/
@POST
(
"api/sendMobileBindingCode"
)
Observable
<
BaseResponse
<
Object
>>
sendMobileBindingCode
(
@Body
Map
<
String
,
Object
>
vo
);
/**
* 登录
*
...
...
GoodMoney/app/src/main/java/com/mints/goodmoney/ui/activitys/AccountMergeActivity.kt
View file @
bc4f39b7
package
com.mints.goodmoney.ui.activitys
import
android.os.Bundle
import
android.view.View
import
com.mints.goodmoney.R
import
com.mints.goodmoney.common.Constant
import
com.mints.goodmoney.mvp.presenters.AccountMergePresenter
import
com.mints.goodmoney.mvp.views.AccountMergeView
import
com.mints.goodmoney.ui.activitys.base.BaseActivity
...
...
@@ -15,7 +17,9 @@ import kotlinx.android.synthetic.main.header_layout.*
*/
class
AccountMergeActivity
:
BaseActivity
(),
View
.
OnClickListener
,
AccountMergeView
{
private
var
keepOneAccountKey
:
String
?
=
null
private
lateinit
var
mobile
:
String
private
lateinit
var
wxOpenId
:
String
private
lateinit
var
keepOneAccountKey
:
String
private
val
accountMergePresenter
by
lazy
{
AccountMergePresenter
()
}
...
...
@@ -23,6 +27,15 @@ class AccountMergeActivity : BaseActivity(), View.OnClickListener, AccountMergeV
override
fun
isApplyKitKatTranslucency
()
=
false
override
fun
getBundleExtras
(
extras
:
Bundle
?)
{
super
.
getBundleExtras
(
extras
)
extras
?.
let
{
mobile
=
it
.
getString
(
Constant
.
MERGE_MOBILE
,
""
)
wxOpenId
=
it
.
getString
(
Constant
.
MERGE_WXOPENID
,
""
)
keepOneAccountKey
=
it
.
getString
(
Constant
.
MERGE_KEY
,
""
)
}
}
override
fun
initViewsAndEvents
()
{
tv_title
.
text
=
"账号绑定"
iv_left_icon
.
visibility
=
View
.
VISIBLE
...
...
GoodMoney/app/src/main/java/com/mints/goodmoney/ui/activitys/BindMobileActivity.kt
View file @
bc4f39b7
package
com.mints.goodmoney.ui.activitys
import
android.Manifest
import
android.os.Bundle
import
android.text.TextUtils
import
android.view.View
import
com.mints.goodmoney.R
import
com.mints.goodmoney.common.Constant
import
com.mints.goodmoney.manager.UserManager
import
com.mints.goodmoney.mvp.presenters.LoginPresenter
import
com.mints.goodmoney.mvp.views.LoginView
...
...
@@ -56,7 +58,7 @@ class BindMobileActivity : BaseActivity()
sendCodeThread
()
mobile
=
mobile
.
replace
(
" "
.
toRegex
(),
""
)
loginPresenter
.
sendMobileCode
(
mobile
)
loginPresenter
.
sendMobile
Binding
Code
(
mobile
)
}
R
.
id
.
tvLoginNext
->
{
var
mobile
=
etLoginMobile
.
getText
().
toString
().
trim
()
...
...
@@ -96,6 +98,14 @@ class BindMobileActivity : BaseActivity()
}
override
fun
mergeAccount
(
mobile
:
String
,
wxOpenId
:
String
,
key
:
String
)
{
val
bundle
=
Bundle
()
bundle
.
putString
(
Constant
.
MERGE_MOBILE
,
mobile
)
bundle
.
putString
(
Constant
.
MERGE_WXOPENID
,
wxOpenId
)
bundle
.
putString
(
Constant
.
MERGE_KEY
,
key
)
readyGo
(
AccountMergeActivity
::
class
.
java
,
bundle
)
}
private
fun
initView
()
{
tv_title
.
text
=
"绑定手机号"
iv_left_icon
.
visibility
=
View
.
VISIBLE
...
...
GoodMoney/app/src/main/java/com/mints/goodmoney/ui/activitys/DrawcashActivity.kt
View file @
bc4f39b7
package
com.mints.goodmoney.ui.activitys
import
android.os.Bundle
import
android.text.TextUtils
import
android.view.View
import
androidx.recyclerview.widget.GridLayoutManager
import
cn.sharesdk.framework.ShareSDK
import
cn.sharesdk.wechat.friends.Wechat
import
com.mints.goodmoney.R
import
com.mints.goodmoney.common.Constant
import
com.mints.goodmoney.login.LoginApi
import
com.mints.goodmoney.login.OnLoginListener
import
com.mints.goodmoney.manager.UserManager
...
...
@@ -173,6 +175,14 @@ class DrawcashActivity : BaseActivity(),
drawcashPresenter
.
getUserTaskMsg
()
}
override
fun
mergeAccount
(
mobile
:
String
,
wxOpenId
:
String
,
key
:
String
)
{
val
bundle
=
Bundle
()
bundle
.
putString
(
Constant
.
MERGE_MOBILE
,
mobile
)
bundle
.
putString
(
Constant
.
MERGE_WXOPENID
,
wxOpenId
)
bundle
.
putString
(
Constant
.
MERGE_KEY
,
key
)
readyGo
(
AccountMergeActivity
::
class
.
java
,
bundle
)
}
override
fun
onLogin
(
platform
:
String
?,
res
:
HashMap
<
String
,
Any
>):
Boolean
{
try
{
wxInfo
=
WXInfo
()
...
...
@@ -188,7 +198,7 @@ class DrawcashActivity : BaseActivity(),
}
if
(!
isFinishing
)
{
drawcashPresenter
.
editUserMsg
(
JsonUtil
.
toJson
(
wxInfo
))
drawcashPresenter
.
editUserMsg
(
res
[
"openid"
].
toString
(),
JsonUtil
.
toJson
(
wxInfo
))
}
}
catch
(
e
:
Exception
)
{
e
.
printStackTrace
()
...
...
GoodMoney/app/src/main/java/com/mints/goodmoney/ui/activitys/MobileLoginActivity.kt
View file @
bc4f39b7
...
...
@@ -112,6 +112,10 @@ class MobileLoginActivity : BaseActivity()
}
}
override
fun
mergeAccount
(
mobile
:
String
,
wxOpenId
:
String
,
key
:
String
)
{
}
private
fun
initView
()
{
tv_title
.
text
=
"手机号登录"
iv_left_icon
.
visibility
=
View
.
VISIBLE
...
...
GoodMoney/app/src/main/java/com/mints/goodmoney/ui/activitys/SettingsActivity.kt
View file @
bc4f39b7
...
...
@@ -301,7 +301,7 @@ class SettingsActivity : BaseActivity(), View.OnClickListener, OnLoginListener,
}
if
(!
isFinishing
)
{
settingsPresenter
.
editUserMsg
(
JsonUtil
.
toJson
(
wxInfo
))
settingsPresenter
.
editUserMsg
(
res
[
"openid"
].
toString
(),
JsonUtil
.
toJson
(
wxInfo
))
}
}
catch
(
e
:
Exception
)
{
e
.
printStackTrace
()
...
...
@@ -318,4 +318,12 @@ class SettingsActivity : BaseActivity(), View.OnClickListener, OnLoginListener,
override
fun
getUserTaskMsgSuc
(
data
:
DrawcashBean
)
{
item_wechat
.
findViewById
<
TextView
>(
R
.
id
.
tv_right
).
text
=
data
.
nickName
}
override
fun
mergeAccount
(
mobile
:
String
,
wxOpenId
:
String
,
key
:
String
)
{
val
bundle
=
Bundle
()
bundle
.
putString
(
Constant
.
MERGE_MOBILE
,
mobile
)
bundle
.
putString
(
Constant
.
MERGE_WXOPENID
,
wxOpenId
)
bundle
.
putString
(
Constant
.
MERGE_KEY
,
key
)
readyGo
(
AccountMergeActivity
::
class
.
java
,
bundle
)
}
}
\ No newline at end of file
GoodMoney/app/src/main/java/com/mints/goodmoney/ui/activitys/WxLoginActivity.kt
View file @
bc4f39b7
...
...
@@ -131,6 +131,10 @@ class WxLoginActivity : BaseActivity()
}
override
fun
mergeAccount
(
mobile
:
String
,
wxOpenId
:
String
,
key
:
String
)
{
}
override
fun
onLogin
(
platform
:
String
?,
res
:
HashMap
<
String
,
Any
>):
Boolean
{
try
{
wxInfo
=
WXInfo
()
...
...
GoodMoney/app/src/main/java/com/mints/goodmoney/ui/adapter/CoinRecordAdapter.kt
View file @
bc4f39b7
...
...
@@ -84,7 +84,7 @@ class CoinRecordAdapter(context: Context, coinData: MutableList<GoldRecordBean.L
holder
.
tv_goldrecord_cash_type
.
text
=
"钻石"
}
holder
.
tv_goldrecord_cash
.
text
=
"-"
+
coinData
.
unitCoin
holder
.
tv_goldrecord_cash
.
setTextColor
(
ContextCompat
.
getColor
(
mContext
,
R
.
color
.
color_
7CCD7C
))
holder
.
tv_goldrecord_cash
.
setTextColor
(
ContextCompat
.
getColor
(
mContext
,
R
.
color
.
color_
4BB93F
))
}
}
}
...
...
GoodMoney/app/src/main/java/com/mints/goodmoney/ui/adapter/DrawcashRecordAdapter.kt
View file @
bc4f39b7
...
...
@@ -54,7 +54,7 @@ class DrawcashRecordAdapter(context: Context, invitedData: MutableList<DrawcashR
viewHolder
.
tv_drawcashrecord_account
.
setTextColor
(
ContextCompat
.
getColor
(
mContext
,
R
.
color
.
color_7EE2FF
))
}
else
{
viewHolder
.
tv_drawcashrecord_account
.
text
=
"提现账户:微信"
viewHolder
.
tv_drawcashrecord_account
.
setTextColor
(
ContextCompat
.
getColor
(
mContext
,
R
.
color
.
color_
7CCD7C
))
viewHolder
.
tv_drawcashrecord_account
.
setTextColor
(
ContextCompat
.
getColor
(
mContext
,
R
.
color
.
color_
4BB93F
))
}
val
errormsg
:
String
=
data
.
errormsg
if
(
TextUtils
.
isEmpty
(
errormsg
))
{
...
...
GoodMoney/app/src/main/java/com/mints/goodmoney/ui/fragment/MainFragment.kt
View file @
bc4f39b7
...
...
@@ -23,6 +23,7 @@ import com.mints.goodmoney.mvp.views.HomeView
import
com.mints.goodmoney.ui.activitys.AwardActivity
import
com.mints.goodmoney.ui.activitys.WebActivity
import
com.mints.goodmoney.ui.fragment.base.BaseFragment
import
com.mints.goodmoney.ui.widgets.BindWxDialog
import
com.mints.goodmoney.ui.widgets.DialogListener
import
com.mints.goodmoney.ui.widgets.PowerDialog
import
com.mints.goodmoney.utils.LogUtil
...
...
@@ -48,6 +49,7 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener {
private
val
userManager
by
lazy
{
UserManager
.
getInstance
()
}
private
val
ps
by
lazy
{
AppPreferences
(
context
)
}
private
var
powerDialog
:
PowerDialog
?
=
null
private
var
bindWxDialog
:
BindWxDialog
?
=
null
private
var
userMsgBean
:
UserTaskMsgBean
?
=
null
...
...
@@ -180,7 +182,7 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener {
// 新人福利 放到个人中心展示 防止首页红包转动异常
// 设置视频权限
vedioAdingManager
?.
initAdWeight
(
data
.
vedioRules
.
csJ_VEDIO
.
rate
,
data
.
vedioRules
.
ylH_VEDIO
.
rate
,
data
.
vedioRules
.
sdhZ_VEDIO
.
rate
)
vedioAdingManager
?.
initAdWeight
(
data
.
vedioRules
.
csJ_VEDIO
.
rate
,
data
.
vedioRules
.
ylH_VEDIO
.
rate
,
data
.
vedioRules
.
sdhZ_VEDIO
.
rate
)
LogUtil
.
d
(
TAG
,
"首页权重值:csjWeight:${data.vedioRules.csJ_VEDIO.rate} ylhWeight:${data.vedioRules.ylH_VEDIO.rate} sdhzWeight:${data.vedioRules.sdhZ_VEDIO.rate}"
)
// 广告视频数
AppConfig
.
csjVedioAdCount
=
data
.
vedioRules
.
csJ_VEDIO
.
surplus
...
...
@@ -190,6 +192,18 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener {
// 调用金币视频信息接口
homePresenter
.
getHomeVedioMsg
()
// 手机号登录未绑定微信 弹出界面不能关闭
if
(
userManager
.
userIsLogin
()
&&
TextUtils
.
isEmpty
(
userManager
.
wxOpenid
))
{
if
(
bindWxDialog
==
null
)
{
bindWxDialog
=
BindWxDialog
(
requireActivity
())
bindWxDialog
!!
.
show
()
}
}
else
{
if
(
bindWxDialog
!=
null
&&
bindWxDialog
!!
.
isShowing
)
{
bindWxDialog
?.
dismiss
()
}
}
}
override
fun
getHomeVedioMsgSuc
(
data
:
MainVedioMsgBean
)
{
...
...
GoodMoney/app/src/main/java/com/mints/goodmoney/ui/widgets/BindWxDialog.kt
0 → 100644
View file @
bc4f39b7
package
com.mints.goodmoney.ui.widgets
import
android.app.Activity
import
android.app.Dialog
import
android.content.Intent
import
android.os.Bundle
import
android.view.Gravity
import
android.view.KeyEvent
import
android.view.View
import
android.view.WindowManager
import
android.widget.TextView
import
cn.sharesdk.framework.ShareSDK
import
cn.sharesdk.wechat.friends.Wechat
import
com.mints.goodmoney.MintsApplication
import
com.mints.goodmoney.R
import
com.mints.goodmoney.common.Constant
import
com.mints.goodmoney.login.LoginApi
import
com.mints.goodmoney.login.OnLoginListener
import
com.mints.goodmoney.mvp.model.DrawcashBean
import
com.mints.goodmoney.mvp.model.WXInfo
import
com.mints.goodmoney.mvp.presenters.SettingsPresenter
import
com.mints.goodmoney.mvp.views.SettingsView
import
com.mints.goodmoney.ui.activitys.AccountMergeActivity
import
com.mints.goodmoney.ui.activitys.AwardActivity
import
com.mints.goodmoney.utils.ToastUtil
import
com.mints.library.utils.json.JsonUtil
import
com.mints.library.utils.nodoubleclick.AntiShake
import
java.util.*
/**
* 微信授权弹窗
*/
class
BindWxDialog
(
context
:
Activity
)
:
Dialog
(
context
,
R
.
style
.
dialog
),
OnLoginListener
,
SettingsView
,
View
.
OnClickListener
{
private
var
loginApi
:
LoginApi
?
=
null
private
var
settingsPresenter
:
SettingsPresenter
?
=
null
private
var
wxInfo
:
WXInfo
?
=
null
init
{
setContentView
(
R
.
layout
.
dialog_bindwx
)
// 设置window属性
val
lp
=
window
!!
.
attributes
lp
.
gravity
=
Gravity
.
CENTER
lp
.
width
=
WindowManager
.
LayoutParams
.
MATCH_PARENT
lp
.
windowAnimations
=
R
.
style
.
DialogAnimBottom
window
!!
.
attributes
=
lp
// 设置外部不可关闭
setCancelable
(
false
)
setCanceledOnTouchOutside
(
false
)
setOnKeyListener
{
_
,
i
,
_
->
i
==
KeyEvent
.
KEYCODE_BACK
}
findViewById
<
View
>(
R
.
id
.
btn_dialogper_next
).
setOnClickListener
(
this
)
loginApi
=
LoginApi
()
settingsPresenter
=
SettingsPresenter
()
settingsPresenter
?.
attachView
(
this
)
}
override
fun
dismiss
()
{
super
.
dismiss
()
loginApi
?.
setOnLoginListener
(
null
)
settingsPresenter
?.
detachView
()
}
override
fun
onClick
(
v
:
View
)
{
if
(
AntiShake
.
check
(
v
?.
id
))
return
when
(
v
.
id
)
{
R
.
id
.
btn_dialogper_next
->
{
val
wechat
=
ShareSDK
.
getPlatform
(
Wechat
.
NAME
)
if
(!
wechat
.
isClientValid
)
{
showToast
(
"请先安装微信"
)
return
}
loginApi
?.
let
{
it
.
setOnLoginListener
(
this
)
it
.
setPlatform
(
Wechat
.
NAME
)
it
.
login
(
context
)
}
}
}
}
override
fun
onLogin
(
platform
:
String
?,
res
:
HashMap
<
String
,
Any
>):
Boolean
{
try
{
wxInfo
=
WXInfo
()
wxInfo
?.
let
{
it
.
setUnionid
(
res
[
"unionid"
].
toString
()
+
""
)
it
.
setOpenid
(
res
[
"openid"
].
toString
()
+
""
)
it
.
setProvince
(
res
[
"province"
].
toString
()
+
""
)
it
.
setCity
(
res
[
"city"
].
toString
()
+
""
)
it
.
setCountry
(
res
[
"country"
].
toString
()
+
""
)
it
.
setHeadimgurl
(
res
[
"headimgurl"
].
toString
()
+
""
)
it
.
setNickname
(
res
[
"nickname"
].
toString
()
+
""
)
it
.
setSex
((
res
[
"sex"
].
toString
()
+
""
).
toInt
())
}
settingsPresenter
?.
editUserMsg
(
res
[
"openid"
].
toString
(),
JsonUtil
.
toJson
(
wxInfo
))
}
catch
(
e
:
Exception
)
{
e
.
printStackTrace
()
}
return
false
}
override
fun
mergeAccount
(
mobile
:
String
,
wxOpenId
:
String
,
key
:
String
)
{
val
bundle
=
Bundle
()
bundle
.
putString
(
Constant
.
MERGE_MOBILE
,
mobile
)
bundle
.
putString
(
Constant
.
MERGE_WXOPENID
,
wxOpenId
)
bundle
.
putString
(
Constant
.
MERGE_KEY
,
key
)
readyGo
(
AccountMergeActivity
::
class
.
java
,
bundle
)
dismiss
()
}
protected
fun
readyGo
(
clazz
:
Class
<
*
>?,
bundle
:
Bundle
?)
{
val
intent
=
Intent
(
context
,
clazz
)
if
(
null
!=
bundle
)
{
intent
.
putExtras
(
bundle
)
}
context
.
startActivity
(
intent
)
}
override
fun
editUserMsgSuc
()
{
ToastUtil
.
show
(
context
,
"微信绑定成功"
)
dismiss
()
}
override
fun
getUserTaskMsgSuc
(
data
:
DrawcashBean
)
{
}
override
fun
showLoading
(
msg
:
String
?)
{
}
override
fun
showToast
(
msg
:
String
?)
{
ToastUtil
.
showLong
(
context
,
msg
)
}
override
fun
hideLoading
()
{
}
override
fun
getBaseApplication
():
MintsApplication
{
return
MintsApplication
.
getContext
()
as
MintsApplication
}
}
\ No newline at end of file
GoodMoney/app/src/main/res/drawable/shape_green.xml
View file @
bc4f39b7
...
...
@@ -2,7 +2,7 @@
<shape
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:shape=
"rectangle"
>
<!-- 填充的颜色 -->
<solid
android:color=
"@color/color_
7CCD7C
"
/>
<solid
android:color=
"@color/color_
4BB93F
"
/>
<!-- 设置按钮的四个角为弧形 -->
<!-- android:radius 弧形的半径 -->
<corners
android:radius=
"30dip"
/>
...
...
GoodMoney/app/src/main/res/layout/dialog_bindwx.xml
0 → 100644
View file @
bc4f39b7
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
>
<LinearLayout
android:layout_width=
"420dp"
android:layout_height=
"wrap_content"
android:layout_centerInParent=
"true"
android:layout_marginLeft=
"40dp"
android:layout_marginRight=
"40dp"
android:background=
"@drawable/shape_bg_write"
android:orientation=
"vertical"
>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center_horizontal"
android:layout_marginTop=
"20dp"
android:text=
"温馨提示"
android:textColor=
"@color/black"
android:textSize=
"18sp"
android:textStyle=
"bold"
/>
<View
android:layout_width=
"match_parent"
android:layout_height=
"1px"
android:layout_marginTop=
"20dp"
android:layout_marginBottom=
"10dp"
android:background=
"#E1E1E1"
/>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center_horizontal"
android:layout_marginTop=
"10dp"
android:gravity=
"center_horizontal"
android:text=
"为了保证您的账户安全\n请先绑定微信"
android:textColor=
"@color/gray"
android:textSize=
"14sp"
/>
<ImageView
android:layout_width=
"50dp"
android:src=
"@mipmap/ic_share_wx"
android:layout_gravity=
"center_horizontal"
android:layout_marginTop=
"20dp"
android:layout_marginBottom=
"10dp"
android:layout_height=
"50dp"
/>
<TextView
android:id=
"@+id/btn_dialogper_next"
android:layout_width=
"match_parent"
android:layout_height=
"46dp"
android:layout_marginLeft=
"30dp"
android:layout_marginRight=
"30dp"
android:gravity=
"center"
android:layout_marginBottom=
"20dp"
android:background=
"@drawable/shape_green"
android:text=
"去绑定"
android:textColor=
"@color/white"
android:textSize=
"14sp"
/>
</LinearLayout>
</RelativeLayout>
GoodMoney/app/src/main/res/layout/item_fragment_main_my_task.xml
View file @
bc4f39b7
...
...
@@ -60,7 +60,7 @@
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginStart=
"10dp"
android:textColor=
"@color/color_
7CCD7C
"
android:textColor=
"@color/color_
4BB93F
"
android:textSize=
"12sp"
app:layout_constraintBottom_toBottomOf=
"@id/item_task_pb"
app:layout_constraintStart_toEndOf=
"@id/item_task_pb"
...
...
GoodMoney/app/src/main/res/values/colors.xml
View file @
bc4f39b7
...
...
@@ -24,7 +24,7 @@
<color
name=
"color_666"
>
#666666
</color>
<color
name=
"color_454A69"
>
#454A69
</color>
<color
name=
"color_333"
>
#333333
</color>
<color
name=
"color_
7CCD7C"
>
#7CCD7C
</color>
<color
name=
"color_
4BB93F"
>
#4BB93F
</color>
<color
name=
"color_FEB63D"
>
#FEB63D
</color>
<color
name=
"color_FF5E5E"
>
#FF5E5E
</color>
<color
name=
"color_172B54"
>
#172B54
</color>
...
...
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