Commit 8777fc49 authored by mengcuiguang's avatar mengcuiguang

代码优化

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