Commit 8777fc49 authored by mengcuiguang's avatar mengcuiguang

代码优化

parent e1d8d3c1
......@@ -40,6 +40,7 @@ class LoginActivity : BaseActivity()
private val loginApi by lazy { LoginApi() }
private var mobile: String? = null
private var channel: String = ""
private var wxInfo: WXInfo? = null
private var loginFlag: Boolean = false// false-登录 true-绑定手机号
......@@ -52,7 +53,7 @@ class LoginActivity : BaseActivity()
override fun initViewsAndEvents() {
loginPresenter.attachView(this)
channel = CommonUtils.getAppMetaData(MintsApplication.getContext(), "CHANNEL_NAME")
initView()
initListener()
}
......@@ -84,7 +85,6 @@ class LoginActivity : BaseActivity()
return true
}
val channel = CommonUtils.getAppMetaData(MintsApplication.getContext(), "CHANNEL_NAME")
if (!TextUtils.equals(channel, Constant.CHANNEL_SHARE)) {
finish()
}
......@@ -102,7 +102,6 @@ class LoginActivity : BaseActivity()
return
}
val channel = CommonUtils.getAppMetaData(MintsApplication.getContext(), "CHANNEL_NAME")
if (!TextUtils.equals(channel, Constant.CHANNEL_SHARE)) {
finish()
}
......@@ -202,7 +201,6 @@ class LoginActivity : BaseActivity()
progressDialog.dismiss()
}
val channel = CommonUtils.getAppMetaData(MintsApplication.getContext(), "CHANNEL_NAME")
if (TextUtils.equals(channel, Constant.CHANNEL_SHARE)) {
readyGo(MainActivity::class.java)
}
......@@ -234,6 +232,12 @@ class LoginActivity : BaseActivity()
}
private fun initView() {
if (TextUtils.equals(channel, Constant.CHANNEL_SHARE)) {
tvLoginWx.visibility = View.GONE
} else {
tvLoginWx.visibility = View.VISIBLE
}
// false-登录 true-绑定手机号
if (loginFlag) {
tvLoginWx.visibility = View.GONE
......
......@@ -70,7 +70,7 @@ class SettingsActivity : BaseActivity(), View.OnClickListener, OnLoginListener,
iv_left_icon.setOnClickListener(this)
item_phone.setOnClickListener(this)
item_wechat.setOnClickListener(this)
// item_wechat.setOnClickListener(this)
item_invitedCode.setOnClickListener(this)
item_cleanCache.setOnClickListener(this)
item_userAgree.setOnClickListener(this)
......@@ -91,17 +91,17 @@ class SettingsActivity : BaseActivity(), View.OnClickListener, OnLoginListener,
item_phone.findViewById<TextView>(R.id.tv_right).text = "未绑定"
}
item_wechat.findViewById<TextView>(R.id.tv_title).text = "微信昵称"
val wechat = resources.getDrawable(R.mipmap.icon_settings_wechat)
wechat.setBounds(0, 0, 56, 56)
item_wechat.findViewById<TextView>(R.id.tv_title).setCompoundDrawables(wechat, null, null, null)
item_wechat.findViewById<TextView>(R.id.tv_right).visibility = View.VISIBLE
item_wechat.findViewById<ImageView>(R.id.iv_right).visibility = View.GONE
if (userManager.wxOpenid.isNotEmpty()) {
item_wechat.findViewById<TextView>(R.id.tv_right).text = userManager.wxName
} else {
item_wechat.findViewById<TextView>(R.id.tv_right).text = "未授权"
}
// item_wechat.findViewById<TextView>(R.id.tv_title).text = "微信昵称"
// val wechat = resources.getDrawable(R.mipmap.icon_settings_wechat)
// wechat.setBounds(0, 0, 56, 56)
// item_wechat.findViewById<TextView>(R.id.tv_title).setCompoundDrawables(wechat, null, null, null)
// item_wechat.findViewById<TextView>(R.id.tv_right).visibility = View.VISIBLE
// item_wechat.findViewById<ImageView>(R.id.iv_right).visibility = View.GONE
// if (userManager.wxOpenid.isNotEmpty()) {
// item_wechat.findViewById<TextView>(R.id.tv_right).text = userManager.wxName
// } else {
// item_wechat.findViewById<TextView>(R.id.tv_right).text = "未授权"
// }
// item_invitedCode.findViewById<TextView>(R.id.tv_title).text = "邀请码"
// val invitedCode = resources.getDrawable(R.mipmap.icon_settings_invite)
......@@ -161,20 +161,20 @@ class SettingsActivity : BaseActivity(), View.OnClickListener, OnLoginListener,
readyGo(LoginActivity::class.java, bundle)
}
}
R.id.item_wechat -> {
if (userManager.wxOpenid.isEmpty()) {
val wechat = ShareSDK.getPlatform(Wechat.NAME)
if (!wechat.isClientValid) {
showToast("请先安装微信")
return
}
loginApi.setOnLoginListener(this)
loginApi.setPlatform(Wechat.NAME)
loginApi.login(this)
}
}
// R.id.item_wechat -> {
// if (userManager.wxOpenid.isEmpty()) {
//
// val wechat = ShareSDK.getPlatform(Wechat.NAME)
// if (!wechat.isClientValid) {
// showToast("请先安装微信")
// return
// }
//
// loginApi.setOnLoginListener(this)
// loginApi.setPlatform(Wechat.NAME)
// loginApi.login(this)
// }
// }
R.id.item_invitedCode -> {
submitInvitedCode()
}
......
......@@ -92,15 +92,10 @@ class MyFragment : BaseFragment(), MyView, OnItemChildClickListener, OnRefreshLi
initRecy()
if (!TextUtils.isEmpty(userManager.userID)) {
myPresenter.getAutoUserHallBaseMsg()
// 登录成功的用户初始化鱼丸盒子
if (userManager.userIsLogin()) {
YwhzManager.init(baseApplication)
}
} else {
// 游客登录
myPresenter.userLogin()
}
}
......@@ -219,12 +214,6 @@ class MyFragment : BaseFragment(), MyView, OnItemChildClickListener, OnRefreshLi
}
override fun signInHomePageSuc() {
if (signCardBean == null) {
showToast("网络异常,请检测网络!")
myPresenter.getSignInHomePageMsg()
return
}
val bundle = Bundle()
bundle.putInt(Constant.MAIN_CUR_COIN, curSignCoin)
bundle.putString(Constant.MAIN_CARRIER_TYPE, Constant.CARRIER_SIGNIN_HOMEPAGE_AWARD)
......
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