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
<?xml version="1.0" encoding="utf-8"?> | |
<RelativeLayout | |
xmlns:android="http://schemas.android.com/apk/res/android" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent"> | |
<ImageView | |
android:id="@+id/imageview_avatar" | |
android:layout_width="150dp" | |
android:layout_height="150dp" |
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
<ViewStub android:id="@+id/stub" | |
android:inflatedId="@+id/layout_banned_user" | |
android:layout="@layout/banned_user" | |
android:layout_width="match_parent" | |
android:layout_height="wrap_content" /> |
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
{ | |
"formatted_address": "กรุงเทพมหานคร ประเทศไทย", | |
"name": "กรุงเทพมหานคร", | |
"types": [ | |
"locality", | |
"political" | |
], | |
"routes": [ | |
{ | |
"distance": { |
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
val controller = MyController().apply{ | |
banners = getBanners(), | |
productItems = getPromotionProducts() | |
} | |
recyclerView.layoutManager = LinearLayoutManager(this) | |
recyclerView.setHasFixedSize(false) | |
recyclerView.setController(controller) |
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
class Controller : EpoxyController() { | |
private var productItems = emptyList<Product>() | |
fun setProductItems(productItems: List<Product>) { | |
this.productItems = productItems | |
requestModelBuild() | |
} | |
override fun buildModels() { | |
LabelEpoxyModel_() // Model from LabelEpoxy.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
class Controller : EpoxyController() { | |
private var banner: Banner? = null | |
fun setBanner(banner: Banner?) { | |
this.banner = banner | |
requestModelBuild() | |
} | |
override fun buildModels() { |
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
<?xml version="1.0" encoding="utf-8"?> | |
<com.minibugdev.epoxyexample.epoxy.models.BannerEpoxy | |
xmlns:android="http://schemas.android.com/apk/res/android" | |
xmlns:app="http://schemas.android.com/apk/res-auto" | |
xmlns:tools="http://schemas.android.com/tools" | |
android:layout_width="match_parent" | |
android:layout_height="wrap_content"> | |
<ImageView | |
android:id="@+id/imageViewBanner" |
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
@EpoxyModelClass(layout = R.layout.row_product_item) | |
abstract class ProductItemEpoxy : EpoxyModelWithHolder<Holder>() { | |
@EpoxyAttribute lateinit var product: Product | |
override fun bind(holder: Holder) { | |
with(holder) { | |
Glide.with(this.productImage) | |
.load(product.image) | |
.centerCrop() |
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
@ModelView(autoLayout = ModelView.Size.MATCH_WIDTH_WRAP_HEIGHT) | |
class LabelEpoxy @JvmOverloads constructor( | |
context: Context, | |
attrs: AttributeSet? = null, | |
defStyleAttr: Int = 0 | |
) : AppCompatTextView(context, attrs, defStyleAttr) { | |
@TextProp | |
fun setLabel(label: CharSequence?) { | |
this.text = label |