This file contains hidden or 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 MovieListController( | |
private val context: Context, | |
private val clickListener: MovieClickListener | |
) : PagedListEpoxyController<MovieModel>() { | |
private val loadMoreView = LoadMoreView_().apply { id(LoadMoreView::class.java.simpleName) } | |
var loadingMore = false | |
set(value) { | |
field = value | |
requestModelBuild() |
This file contains hidden or 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.holder_movie_landscape) | |
abstract class MovieListEpoxyModel : EpoxyModelWithHolder<MovieListEpoxyModel.Holder>() { | |
@EpoxyAttribute | |
var movieId = "" | |
@EpoxyAttribute | |
var imagePoster = "" | |
... | |
@EpoxyAttribute(EpoxyAttribute.Option.DoNotHash) | |
var itemClickListener: (String) -> Unit = {} |
This file contains hidden or 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
MovieHomeLargeBindingModel_() | |
.id("${movieCategory}${this.id}") | |
.movieId(this.id) | |
.posterImage(this.getPosterUrl()) | |
.title(this.displayTitle()) | |
.rating(this.voteAverage) | |
.voteCount(this.displayVoteCount()) | |
.duration(this.displayDuration()) | |
.clickListener(clickListener) |
This file contains hidden or 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"?> | |
<layout 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"> | |
<data> | |
<variable | |
name="movieId" | |
type="String" /> | |
<variable |
This file contains hidden or 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
@EpoxyDataBindingPattern(rClass = R.class, layoutPrefix = "item") | |
package com.enginebai.moviehunt; | |
import com.airbnb.epoxy.EpoxyDataBindingPattern; |
This file contains hidden or 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 DropdownItemView @JvmOverloads constructor( | |
context: Context, | |
attrs: AttributeSet? = null, | |
defStyleAttr: Int = 0 | |
) : LinearLayout(context, attrs, defStyleAttr) { | |
@TextProp | |
var itemText: CharSequence? = null |
This file contains hidden or 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 LargeEpoxyModel : EpoxyModel { | |
override fun bind() { | |
// binding implementation | |
} | |
} | |
class NormalEpoxyModel : EpoxyModel { | |
override fun bind() { | |
// binding implementation | |
} |
This file contains hidden or 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
data class MovieModel( | |
... | |
val largeSize: Boolean | |
) | |
class MovieHomeAdapter(private val movieList: List<MovieModel>) : RecyclerView.Adapter<RecyclerView.ViewHolder>() { | |
override fun getItemViewType(position: Int): Int { | |
return if (movieList.get(position).largeSize) { | |
R.layout.item_movie_large |
This file contains hidden or 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 MovieDetailViewModel : BaseViewModel() { | |
private val movieRepo: MovieRepo by inject() | |
private val _movieDetail = MutableLiveData<MovieModel>() | |
val posterUrl: LiveData<String> = Transformations.map(_movieDetail) { it.getPosterUrl() } | |
val title: LiveData<String> = Transformations.map(_movieDetail) { it.displayTitle() } | |
val rating: LiveData<Float> = Transformations.map(_movieDetail) { it.display5StarsRating() } | |
val voteCount: LiveData<String> = Transformations.map(_movieDetail) { it.displayVoteCount() } | |
val duration: LiveData<String> = Transformations.map(_movieDetail) { it.displayDuration() } | |
val releaseDate: LiveData<String> = Transformations.map(_movieDetail) { it.displayReleaseDate() } |
This file contains hidden or 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 MovieListFragment : BaseFragment(), MovieClickListener { | |
private val viewModel by sharedViewModel<MovieListViewModelV1>() | |
override fun onViewCreated(view: View, savedInstanceState: Bundle?) { | |
super.onViewCreated(view, savedInstanceState) | |
... | |
viewModel.fetchMovieList(movieCategory) |