Skip to content

Commit

Permalink
优化代码。
Browse files Browse the repository at this point in the history
  • Loading branch information
TanJiaJunBeyond committed Jul 26, 2021
1 parent af19e22 commit 4825107
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class RepositoryFragment private constructor()
handlers = this@RepositoryFragment
}
}
this@RepositoryFragment.viewModel.isShowErrorView.observe(this@RepositoryFragment, Observer { isShowErrorView ->
this@RepositoryFragment.viewModel.isShowErrorView.observe(viewLifecycleOwner, Observer { isShowErrorView ->
if (isShowErrorView) {
if (!vsError.isInflated) {
vsError.viewStub?.inflate()?.also { errorView = it }
Expand All @@ -72,7 +72,7 @@ class RepositoryFragment private constructor()
private fun initData() =
with(viewModel) {
getRepositories(language)
repositories.observe(this@RepositoryFragment, Observer {
repositories.observe(viewLifecycleOwner, Observer {
adapter.setItems(it)
})
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ package com.tanjiajun.androidgenericframework.utils
*/
sealed class BooleanExt<out T>

class TransferData<T>(val data: T) : BooleanExt<T>()
class TransferData<out T>(val data: T) : BooleanExt<T>()
object Otherwise : BooleanExt<Nothing>()

inline fun <T> Boolean.yes(block: () -> T): BooleanExt<T> =
Expand Down

0 comments on commit 4825107

Please sign in to comment.