-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add navigation components dependencies
Start moving the main activity to a fragment Continue moving stuff from the main activity to a fragment Finish moving the SuperHeroesFragment Navigate to super hero detail Migrate edit super hero screen Start migrating tests Start migrating tests Fix tests Own code review Fix toolbar using the NavigationUI class
- Loading branch information
1 parent
6d0ed15
commit 3f74f1e
Showing
38 changed files
with
406 additions
and
309 deletions.
There are no files selected for viewing
Binary file removed
BIN
-14.5 KB
...jetpack.superheroes.ui.view.EditSuperHeroActivityTest_showsJustOneSuperHero.png
Binary file not shown.
Binary file added
BIN
+17.5 KB
...jetpack.superheroes.ui.view.EditSuperHeroFragmentTest_showsJustOneSuperHero.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed
BIN
-12 KB
...ActivityTest_doesNotShowAvengersBadgeIfASuperHeroIsNotPartOfTheAvengersTeam.png
Binary file not shown.
Binary file removed
BIN
-45.8 KB
...view.MainActivityTest_showsAvengersBadgeIfASuperHeroIsPartOfTheAvengersTeam.png
Binary file not shown.
Binary file removed
BIN
-7.96 KB
....superheroes.ui.view.MainActivityTest_showsEmptyCaseIfThereAreNoSuperHeroes.png
Binary file not shown.
Binary file removed
BIN
-9.23 KB
...m.karumi.jetpack.superheroes.ui.view.MainActivityTest_showsJustOneSuperHero.png
Binary file not shown.
Binary file removed
BIN
-12 KB
...erheroes.ui.view.MainActivityTest_showsSuperHeroesIfThereAreSomeSuperHeroes.png
Binary file not shown.
Binary file removed
BIN
-15 KB
...lActivityTest_doesNotShowAvengersBadgeIfSuperHeroIsNotPartOfTheAvengersTeam.png
Binary file not shown.
Binary file removed
BIN
-32 KB
...HeroDetailActivityTest_showsAvengersBadgeIfSuperHeroIsPartOfTheAvengersTeam.png
Binary file not shown.
Binary file added
BIN
+12.1 KB
...lFragmentTest_doesNotShowAvengersBadgeIfSuperHeroIsNotPartOfTheAvengersTeam.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+29.2 KB
...HeroDetailFragmentTest_showsAvengersBadgeIfSuperHeroIsPartOfTheAvengersTeam.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+8.35 KB
...FragmentTest_doesNotShowAvengersBadgeIfASuperHeroIsNotPartOfTheAvengersTeam.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+42.3 KB
...perHeroesFragmentTest_showsAvengersBadgeIfASuperHeroIsPartOfTheAvengersTeam.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+4.36 KB
...eroes.ui.view.SuperHeroesFragmentTest_showsEmptyCaseIfThereAreNoSuperHeroes.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+5.62 KB
...i.jetpack.superheroes.ui.view.SuperHeroesFragmentTest_showsJustOneSuperHero.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+8.35 KB
...s.ui.view.SuperHeroesFragmentTest_showsSuperHeroesIfThereAreSomeSuperHeroes.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
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
7 changes: 4 additions & 3 deletions
7
app/src/androidTest/java/com/karumi/jetpack/superheroes/ui/view/ScreenshotTest.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
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
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
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
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
52 changes: 52 additions & 0 deletions
52
app/src/main/java/com/karumi/jetpack/superheroes/ui/view/BaseFragment.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
package com.karumi.jetpack.superheroes.ui.view | ||
|
||
import android.os.Bundle | ||
import android.view.LayoutInflater | ||
import android.view.View | ||
import android.view.ViewGroup | ||
import androidx.databinding.DataBindingUtil | ||
import androidx.databinding.ViewDataBinding | ||
import androidx.fragment.app.Fragment | ||
import androidx.lifecycle.AndroidViewModel | ||
import androidx.lifecycle.ViewModelProvider | ||
import com.karumi.jetpack.superheroes.common.ViewModelFactory | ||
import org.kodein.di.Kodein | ||
import org.kodein.di.KodeinAware | ||
import org.kodein.di.android.closestKodein | ||
import org.kodein.di.erased.bind | ||
import org.kodein.di.erased.instance | ||
import org.kodein.di.erased.singleton | ||
|
||
abstract class BaseFragment<T : ViewDataBinding> : Fragment(), KodeinAware { | ||
|
||
private val appKodein by closestKodein { requireActivity() } | ||
override val kodein: Kodein = Kodein.lazy { | ||
extend(appKodein) | ||
includeViewModelFactory() | ||
import(activityModules) | ||
} | ||
|
||
abstract val layoutId: Int | ||
abstract val activityModules: Kodein.Module | ||
abstract val viewModel: AndroidViewModel | ||
protected lateinit var binding: T | ||
|
||
override fun onCreateView( | ||
inflater: LayoutInflater, | ||
container: ViewGroup?, | ||
savedInstanceState: Bundle? | ||
): View? { | ||
binding = DataBindingUtil.inflate(layoutInflater, layoutId, container, false) | ||
binding.setLifecycleOwner(this) | ||
configureBinding(binding) | ||
return binding.root | ||
} | ||
|
||
private fun Kodein.MainBuilder.includeViewModelFactory() { | ||
bind<ViewModelProvider.Factory>() with singleton { | ||
ViewModelFactory(instance(), instance()) | ||
} | ||
} | ||
|
||
abstract fun configureBinding(binding: T) | ||
} |
57 changes: 0 additions & 57 deletions
57
app/src/main/java/com/karumi/jetpack/superheroes/ui/view/EditSuperHeroActivity.kt
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.