Description | V3 | V4 |
---|---|---|
Entry point - optional unless you have a custom GlideModule | Glide | GlideApp |
Bitmap transformations | bitmapTransform() |
transform() |
Release bitmap | Glide.clear() | GlideApp.with(context).clear() |
Custom animations | animate(android.R.anim.fade_in) | transition(GenericTransitionOptions.with(android.R.anim.fade_in)) |
Request builder | DrawableRequestBuilder<CustomModel> |
RequestBuilder<Drawable> |
Request builder | DrawableRequestBuilder<String> |
RequestBuilder<Drawable> |
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
private val globalId = AtomicInteger(1) | |
typealias OnGenreExpanded = (genre: Genre) -> Unit | |
data class Container( | |
val genres: List<GamesPerGenre>, | |
val onGenreExpanded: OnGenreExpanded | |
) | |
data class GamesPerGenre( |
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"?> | |
<layout | |
xmlns:android="http://schemas.android.com/apk/res/android" | |
xmlns:tools="http://schemas.android.com/tools"> | |
<data> | |
<variable name="game" type="com.nimroddayan.epoxysample.Game"/> | |
</data> | |
<TextView | |
android:layout_width="match_parent" | |
android:layout_height="48dp" |
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"?> | |
<layout xmlns:app="http://schemas.android.com/apk/res-auto" | |
xmlns:android="http://schemas.android.com/apk/res/android" | |
xmlns:tools="http://schemas.android.com/tools"> | |
<data> | |
<variable name="genre" type="com.nimroddayan.epoxysample.Genre"/> | |
<variable name="onHeaderExpanded" type="android.view.View.OnClickListener"/> | |
</data> | |
<androidx.constraintlayout.widget.ConstraintLayout | |
android:layout_width="match_parent" |
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 DetailActivity : DaggerAppCompatActivity() { | |
@Inject | |
lateinit var viewModelFactory: ViewModelFactory | |
private val viewModel by viewModels { viewModelFactory } | |
override fun onCreate(savedInstanceState: Bundle?) { | |
super.onCreate(savedInstanceState) | |
// Use viewModel here | |
viewModel.loadData() |
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
@Module | |
public abstract class DetailModule { | |
@Binds | |
@IntoMap | |
@ViewModelKey(DetailViewModel.class) | |
abstract ViewModelAssistedFactory<? extends ViewModel> bindFactory(DetailViewModel.Factory factory); | |
@Binds | |
abstract SavedStateRegistryOwner bindSavedStateRegistryOwner(DetailActivity detailActivity); |
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 ViewModelFactory @Inject constructor( | |
private val viewModelMap: MutableMap<Class<out ViewModel>, ViewModelAssistedFactory<out ViewModel>>, | |
owner: SavedStateRegistryOwner, | |
defaultArgs: Bundle? | |
) : AbstractSavedStateVMFactory(owner, defaultArgs) { | |
override fun <T : ViewModel?> create( | |
key: String, | |
modelClass: Class<T>, | |
handle: SavedStateHandle): T { |
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
@Module | |
abstract class DetailModule { | |
@Binds | |
@IntoMap | |
@ViewModelKey(DetailViewModel::class) | |
abstract fun bindFactory(DetailViewModel viewModel): ViewModelAssistedFactory<out ViewModel> | |
} |
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
@AssistedModule | |
@Module(includes = [AssistedInject_ViewModelAssistedFactoriesModule::class]) | |
abstract class ViewModelAssistedFactoriesModule |
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
@AssistedInject.Factory | |
interface Factory : ViewModelAssistedFactory<DetailViewModel> |