-
Notifications
You must be signed in to change notification settings - Fork 629
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
51 changed files
with
827 additions
and
3,237 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
[{"outputType":{"type":"APK"},"apkData":{"type":"MAIN","splits":[],"versionCode":16,"versionName":"1.1.6","enabled":true,"outputFile":"app-release.apk","fullName":"release","baseName":"release","dirName":""},"path":"app-release.apk","properties":{}}] | ||
[{"outputType":{"type":"APK"},"apkData":{"type":"MAIN","splits":[],"versionCode":18,"versionName":"1.1.8","enabled":true,"outputFile":"app-release.apk","fullName":"release","baseName":"release","dirName":""},"path":"app-release.apk","properties":{}}] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
app/src/main/java/me/hgj/jetpackmvvm/demo/ui/activity/TestActivity.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
package me.hgj.jetpackmvvm.demo.ui.activity | ||
|
||
import android.os.Bundle | ||
import androidx.activity.viewModels | ||
import androidx.lifecycle.Observer | ||
import kotlinx.android.synthetic.main.activity_test.* | ||
import me.hgj.jetpackmvvm.base.viewmodel.BaseViewModel | ||
import me.hgj.jetpackmvvm.demo.R | ||
import me.hgj.jetpackmvvm.demo.app.base.BaseActivity | ||
import me.hgj.jetpackmvvm.demo.app.ext.showMessage | ||
import me.hgj.jetpackmvvm.demo.databinding.ActivityTestBinding | ||
import me.hgj.jetpackmvvm.demo.ui.adapter.TestAdapter | ||
import me.hgj.jetpackmvvm.demo.viewmodel.request.RequestLoginRegisterViewModel | ||
import me.hgj.jetpackmvvm.ext.parseState | ||
import me.hgj.jetpackmvvm.ext.util.logd | ||
|
||
/** | ||
* @author : hgj | ||
* @date : 2020/8/26 | ||
*/ | ||
|
||
class TestActivity : BaseActivity<BaseViewModel, ActivityTestBinding>() { | ||
|
||
val viewModel: RequestLoginRegisterViewModel by viewModels() | ||
|
||
val adapter: TestAdapter by lazy { TestAdapter(arrayListOf()) } | ||
|
||
override fun layoutId() = R.layout.activity_test | ||
|
||
|
||
override fun initView(savedInstanceState: Bundle?) { | ||
|
||
//强烈注意:使用addLoadingObserve 将非绑定当前activity的viewmodel绑定loading回调 防止出现请求时不显示 loading 弹窗bug | ||
addLoadingObserve(viewModel) | ||
|
||
adapter.run { | ||
clickAction = { position, item, state -> | ||
"海王收到了点击事件,并准备发一个红包".logd() | ||
} | ||
} | ||
button.setOnClickListener { | ||
viewModel.loginReq("123", "123456") | ||
} | ||
} | ||
|
||
override fun createObserver() { | ||
//测试在activity中 loading弹窗是否正确 | ||
viewModel.loginResult.observe(this, Observer { | ||
parseState(it, { | ||
showMessage(it.nickname) | ||
}, { | ||
showMessage(it.errorMsg) | ||
}) | ||
}) | ||
} | ||
} | ||
|
Oops, something went wrong.