Commit 422093e5 authored by 张释方's avatar 张释方

优化代码

parent b1c256a2
......@@ -96,6 +96,7 @@
<activity android:name=".main.my.PermissionsActivity"/>
<activity android:name=".main.my.OpenvipActivity"/>
<activity android:name=".main.home.HistoricalimageActivity"/>
<activity android:name=".main.my.BindMobileActivity"/>
<!-- ShareSDK start -->
<activity
......
package com.mints.street.login
import android.graphics.Color
import android.os.Bundle
import android.os.PersistableBundle
import android.view.View
import androidx.lifecycle.Observer
import com.fry.base.base.BaseActivity
......@@ -14,37 +16,45 @@ import me.goldze.mvvmhabit.utils.ToastUtils
* Created by 冯瑞雨 on 2021/7/2.
*/
class LoginActivity : BaseActivity<ActivityLoginBinding, LoginViewModel>(), View.OnClickListener {
override fun initContentView(savedInstanceState: Bundle?) = R.layout.activity_login
override fun initVariableId() = BR.viewModel
override fun initData() {
super.initData()
initView()
initListener()
}
private fun initView() {
private fun initListener() {
binding.button.setOnClickListener {
viewModel.login()
}
iv_left_icon.setImageResource(R.mipmap.iv_return_white)
// iv_left_icon.visibility = View.VISIBLE
iv_left_icon.setOnClickListener(this)
iv_left_icon.setOnClickListener(this)
}
private fun initView() {
iv_left_icon.setImageResource(R.mipmap.iv_return_white)
iv_left_icon.visibility = View.VISIBLE
}
override fun initViewObservable() {
super.initViewObservable()
viewModel.data.observe(this, Observer<String>{
ToastUtils.showLong("初始化成功")
})
}
override fun onClick(v: View?) {
when (v?.id) {
R.id.iv_left_icon -> {
finish()
}
R.id.iv_left_icon -> finish()
}
}
}
\ No newline at end of file
......@@ -17,15 +17,18 @@ class LoginViewModel(application: Application) : BaseViewModel(application) {
val data :MutableLiveData<String> = MutableLiveData()
fun login() {
ApiModel.coinMsg(lifecycleProvider).safeSubscribe(
object : HttpSubscribeImpl<BaseResponse<AwardBean>>(
this@LoginViewModel, true
) {
override fun onBusinessSuccess(response: BaseResponse<AwardBean>) {
data.value = response.message
KLog.e("sfdsdf", response.result.toString())
}
override fun onError(e: Throwable) {
data.value = "失败"
KLog.e("LoginViewModel", "登录错误")
}
......
......@@ -17,6 +17,11 @@ class AboutusActivity :BaseActivity<ActivityAboutusBinding, AboutusViewModel>(),
override fun initData() {
super.initData()
initView()
initListener()
}
private fun initListener() {
iv_left_icon.setOnClickListener(this)
}
private fun initView() {
......
......@@ -11,7 +11,6 @@ import com.mints.street.databinding.ActivityBindmobileBinding
import com.mints.street.utils.BackInputUtil
import com.tbruyelle.rxpermissions2.RxPermissions
import kotlinx.android.synthetic.main.activity_bindmobile.*
import kotlinx.android.synthetic.main.activity_container.*
import kotlinx.android.synthetic.main.include_header.*
import me.goldze.mvvmhabit.utils.ToastUtils
......
......@@ -43,9 +43,10 @@ class MoresettingsActivity : BaseActivity<ActivityMoresettingsBinding, Moresetti
val phone = ContextCompat.getDrawable(this, R.mipmap.icon_settings_tel)
phone?.setBounds(0, 0, 56, 56)
item_phone.findViewById<TextView>(R.id.tv_title).setCompoundDrawables(phone, null, null, null)
item_phone.findViewById<TextView>(R.id.tv_right).visibility = View.VISIBLE
item_phone.findViewById<ImageView>(R.id.iv_right).visibility = View.GONE
item_phone.findViewById<TextView>(R.id.tv_right).text = "未绑定"
// item_phone.findViewById<TextView>(R.id.tv_right).visibility=View.VISIBLE
// item_phone.findViewById<TextView>(R.id.tv_right).text = "未绑定"
item_phone.findViewById<TextView>(R.id.tv_right).visibility = View.GONE
item_phone.findViewById<ImageView>(R.id.iv_right).visibility = View.VISIBLE
item_userAgree.findViewById<TextView>(R.id.tv_title).text = "用户协议"
val userAgree = ContextCompat.getDrawable(this, R.mipmap.icon_settings_user)
......
......@@ -73,8 +73,8 @@ class MyFragment : BaseFragment<FragmentMyBinding, MyViewModel>(), View.OnClickL
override fun onClick(v: View?) {
when (v?.id) {
R.id.ly_aboutus -> {
// startActivity(AboutusActivity::class.java)
startActivity(HistoricalimageActivity::class.java)
startActivity(AboutusActivity::class.java)
// startActivity(HistoricalimageActivity::class.java)
}
R.id.ly_moresettings -> {
startActivity(MoresettingsActivity::class.java)
......
......@@ -10,13 +10,18 @@ import kotlinx.android.synthetic.main.activity_openvip.*
import kotlinx.android.synthetic.main.include_header.*
class OpenvipActivity: BaseActivity<ActivityOpenvipBinding, OpenvipViewModel>() {
class OpenvipActivity: BaseActivity<ActivityOpenvipBinding, OpenvipViewModel>(), View.OnClickListener {
override fun initVariableId() = BR.viewModel
override fun initContentView(savedInstanceState: Bundle?)= R.layout.activity_openvip
override fun initData() {
super.initData()
initView()
initListener()
}
private fun initListener() {
iv_left_icon.setOnClickListener(this)
}
private fun initView() {
......@@ -42,6 +47,12 @@ class OpenvipActivity: BaseActivity<ActivityOpenvipBinding, OpenvipViewModel>()
iv_left_icon.visibility= View.VISIBLE
}
override fun onClick(v: View?) {
when(v?.id){
R.id.iv_left_icon->finish()
}
}
}
......@@ -5,7 +5,7 @@
<data>
<variable
name="ViewModel"
name="viewModel"
type="com.mints.street.main.home.HistoricalimageModel" />
</data>
<LinearLayout
......
......@@ -14,7 +14,9 @@
android:background="#CC000000"
android:orientation="vertical">
<include layout="@layout/include_header"/>
<include
android:id="@+id/ic_q"
layout="@layout/include_header"/>
<TextView
android:layout_width="wrap_content"
......@@ -22,7 +24,8 @@
android:layout_gravity="center"
android:layout_marginTop="60dp"
android:text="在国内也能用的"
android:textSize="24dp" />
android:textSize="24dp"
/>
<TextView
android:layout_width="wrap_content"
......
......@@ -30,18 +30,6 @@
android:id="@+id/item_phone"
layout="@layout/item_settings" />
<include
android:id="@+id/item_wechat"
layout="@layout/item_settings" />
<include
android:id="@+id/item_invitedCode"
layout="@layout/item_settings" />
<include
android:id="@+id/item_cleanCache"
layout="@layout/item_settings" />
<include
android:id="@+id/item_userAgree"
layout="@layout/item_settings" />
......@@ -50,14 +38,6 @@
android:id="@+id/item_privacyAgree"
layout="@layout/item_settings" />
<include
android:id="@+id/item_aboutUs"
layout="@layout/item_settings" />
<include
android:id="@+id/item_feedBack"
layout="@layout/item_settings" />
<Button
android:id="@+id/btn_switch"
android:layout_width="200dp"
......
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