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,
baseModelClass = BaseView::class
)
class BlackView : RelativeLayout {
class BlackListView : RelativeLayout {
private lateinit var B: ViewBlackBinding

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -28,18 +28,18 @@ import com.airbnb.epoxy.CallbackProp
import com.airbnb.epoxy.ModelProp
import com.airbnb.epoxy.ModelView
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.store.R
import com.aurora.store.databinding.ViewAppUpdateBinding
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.bumptech.glide.load.resource.bitmap.RoundedCorners
import com.bumptech.glide.load.resource.drawable.DrawableTransitionOptions.withCrossFade
@ModelView(
autoLayout = ModelView.Size.WRAP_WIDTH_WRAP_HEIGHT,
autoLayout = ModelView.Size.MATCH_WIDTH_WRAP_HEIGHT,
baseModelClass = BaseView::class
)
class AppUpdateView : RelativeLayout {
@@ -77,7 +77,7 @@ class AppUpdateView : RelativeLayout {
}
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())
HtmlCompat.fromHtml(
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.databinding.ActivityGenericRecyclerBinding
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.viewmodel.all.BlacklistViewModel
@@ -94,7 +94,7 @@ class BlacklistActivity : BaseActivity() {
} else {
blackList.forEach {
add(
BlackViewModel_()
BlackListViewModel_()
.id(it.packageName.hashCode())
.black(it)
.markChecked(VM.selected.contains(it.packageName))