Improve Epoxy view models

This commit is contained in:
Rahul Kumar Patel
2021-02-25 23:08:01 +05:30
parent 55e24c091f
commit 6b5de5509e
9 changed files with 13 additions and 13 deletions

View File

@@ -38,7 +38,7 @@ import com.bumptech.glide.load.resource.bitmap.RoundedCorners
autoLayout = ModelView.Size.MATCH_WIDTH_WRAP_HEIGHT, autoLayout = ModelView.Size.MATCH_WIDTH_WRAP_HEIGHT,
baseModelClass = BaseView::class baseModelClass = BaseView::class
) )
class BlackView : RelativeLayout { class BlackListView : RelativeLayout {
private lateinit var B: ViewBlackBinding private lateinit var B: ViewBlackBinding

View File

@@ -34,7 +34,7 @@ import com.aurora.extensions.load
import com.bumptech.glide.load.resource.drawable.DrawableTransitionOptions import com.bumptech.glide.load.resource.drawable.DrawableTransitionOptions
@ModelView( @ModelView(
autoLayout = ModelView.Size.WRAP_WIDTH_WRAP_HEIGHT, autoLayout = ModelView.Size.MATCH_WIDTH_WRAP_HEIGHT,
baseModelClass = BaseView::class baseModelClass = BaseView::class
) )
class CategoryView : RelativeLayout { class CategoryView : RelativeLayout {

View File

@@ -45,7 +45,7 @@ import java.lang.reflect.Modifier
import java.util.* import java.util.*
@ModelView( @ModelView(
autoLayout = ModelView.Size.WRAP_WIDTH_WRAP_HEIGHT, autoLayout = ModelView.Size.MATCH_WIDTH_WRAP_HEIGHT,
baseModelClass = BaseView::class baseModelClass = BaseView::class
) )
class DownloadView : RelativeLayout { class DownloadView : RelativeLayout {

View File

@@ -30,7 +30,7 @@ import com.aurora.store.R
import com.aurora.store.databinding.ViewEditorHeadBinding import com.aurora.store.databinding.ViewEditorHeadBinding
@ModelView( @ModelView(
autoLayout = ModelView.Size.WRAP_WIDTH_WRAP_HEIGHT, autoLayout = ModelView.Size.MATCH_WIDTH_WRAP_HEIGHT,
baseModelClass = BaseView::class baseModelClass = BaseView::class
) )
class EditorHeadView : RelativeLayout { class EditorHeadView : RelativeLayout {

View File

@@ -32,7 +32,7 @@ import com.aurora.store.databinding.ViewHeaderBinding
@ModelView( @ModelView(
autoLayout = ModelView.Size.WRAP_WIDTH_WRAP_HEIGHT, autoLayout = ModelView.Size.MATCH_WIDTH_WRAP_HEIGHT,
baseModelClass = BaseView::class baseModelClass = BaseView::class
) )
class HeaderView : RelativeLayout { class HeaderView : RelativeLayout {

View File

@@ -31,7 +31,7 @@ import com.aurora.store.databinding.ViewActionHeaderBinding
@ModelView( @ModelView(
autoLayout = ModelView.Size.WRAP_WIDTH_WRAP_HEIGHT, autoLayout = ModelView.Size.MATCH_WIDTH_WRAP_HEIGHT,
baseModelClass = BaseView::class baseModelClass = BaseView::class
) )
class MinimalHeaderView : RelativeLayout { class MinimalHeaderView : RelativeLayout {

View File

@@ -31,7 +31,7 @@ import com.aurora.store.databinding.ViewHeaderUpdateBinding
@ModelView( @ModelView(
autoLayout = ModelView.Size.WRAP_WIDTH_WRAP_HEIGHT, autoLayout = ModelView.Size.MATCH_WIDTH_WRAP_HEIGHT,
baseModelClass = BaseView::class baseModelClass = BaseView::class
) )
class UpdateHeaderView : RelativeLayout { class UpdateHeaderView : RelativeLayout {

View File

@@ -28,18 +28,18 @@ import com.airbnb.epoxy.CallbackProp
import com.airbnb.epoxy.ModelProp import com.airbnb.epoxy.ModelProp
import com.airbnb.epoxy.ModelView import com.airbnb.epoxy.ModelView
import com.airbnb.epoxy.OnViewRecycled import com.airbnb.epoxy.OnViewRecycled
import com.aurora.extensions.clear
import com.aurora.extensions.load
import com.aurora.gplayapi.data.models.App import com.aurora.gplayapi.data.models.App
import com.aurora.store.R import com.aurora.store.R
import com.aurora.store.databinding.ViewAppUpdateBinding import com.aurora.store.databinding.ViewAppUpdateBinding
import com.aurora.store.util.CommonUtil import com.aurora.store.util.CommonUtil
import com.aurora.extensions.clear
import com.aurora.extensions.load
import com.aurora.store.view.epoxy.views.BaseView import com.aurora.store.view.epoxy.views.BaseView
import com.bumptech.glide.load.resource.bitmap.RoundedCorners import com.bumptech.glide.load.resource.bitmap.RoundedCorners
import com.bumptech.glide.load.resource.drawable.DrawableTransitionOptions.withCrossFade import com.bumptech.glide.load.resource.drawable.DrawableTransitionOptions.withCrossFade
@ModelView( @ModelView(
autoLayout = ModelView.Size.WRAP_WIDTH_WRAP_HEIGHT, autoLayout = ModelView.Size.MATCH_WIDTH_WRAP_HEIGHT,
baseModelClass = BaseView::class baseModelClass = BaseView::class
) )
class AppUpdateView : RelativeLayout { class AppUpdateView : RelativeLayout {
@@ -77,7 +77,7 @@ class AppUpdateView : RelativeLayout {
} }
B.txtLine2.text = app.developerName B.txtLine2.text = app.developerName
B.txtLine3.text = CommonUtil.addSiPrefix(app.size) B.txtLine3.text = ("${CommonUtil.addSiPrefix(app.size)}${app.updatedOn}")
B.txtChangelog.text = if (app.changes.isNotEmpty()) B.txtChangelog.text = if (app.changes.isNotEmpty())
HtmlCompat.fromHtml( HtmlCompat.fromHtml(
app.changes, app.changes,

View File

@@ -26,7 +26,7 @@ import com.aurora.store.data.model.Black
import com.aurora.store.data.providers.BlacklistProvider import com.aurora.store.data.providers.BlacklistProvider
import com.aurora.store.databinding.ActivityGenericRecyclerBinding import com.aurora.store.databinding.ActivityGenericRecyclerBinding
import com.aurora.extensions.close import com.aurora.extensions.close
import com.aurora.store.view.epoxy.views.BlackViewModel_ import com.aurora.store.view.epoxy.views.BlackListViewModel_
import com.aurora.store.view.epoxy.views.shimmer.AppListViewShimmerModel_ import com.aurora.store.view.epoxy.views.shimmer.AppListViewShimmerModel_
import com.aurora.store.viewmodel.all.BlacklistViewModel import com.aurora.store.viewmodel.all.BlacklistViewModel
@@ -94,7 +94,7 @@ class BlacklistActivity : BaseActivity() {
} else { } else {
blackList.forEach { blackList.forEach {
add( add(
BlackViewModel_() BlackListViewModel_()
.id(it.packageName.hashCode()) .id(it.packageName.hashCode())
.black(it) .black(it)
.markChecked(VM.selected.contains(it.packageName)) .markChecked(VM.selected.contains(it.packageName))