Hello everyone. I've just open-sourced a project ...
# feed
p
Hello everyone. I've just open-sourced a project that I've been working on for quite some time called Gamedge. The aim is to showcase the latest trends in Android development by utilizing the best practices, libraries, and tools to develop a fully-fledged Android application. It utilizes: • MVI/MVVM Architecture • Coroutines and Flow (including StateFlow) • Dagger Hilt • Jetpack DataStore (both preferences and protocol buffer versions) • MotionLayout • AssertJ, MockK, Turbine for unit and instrumentation tests • and lots of other libraries. If anyone want to take a look, here's a link to the GitHub.
👍🏽 1
😍 4
K 26
👍🏼 1
👍 17
t
Put it on the Google Play Store? I will download it.
😄 1
m
@Paul your focus on tests is impressive, did you measured test coverage ?
p
@Michal Harakal I did not measure it actually. My goal was to show how an app can be architected with testability in mind. The project has by no means 100% coverage, but more than enough examples that pave the way for more test coverage in the future.
👍 2
s
@Paul great project, really inspires to try out new things I have a question about BaseFragment view destroy check:
Copy code
final override fun onCreateView(
        inflater: LayoutInflater,
        container: ViewGroup?,
        savedInstanceState: Bundle?
    ): View? {
        // Prevent the view from recreation until onDestroy is called
        return if(isViewCreated) {
            viewBinding.root
        } else {
            super.onCreateView(inflater, container, savedInstanceState)
        }
    }
Could you explain why this is wanted? Is there ever a possibility that fragment’s view will be created twice, not being destroyed beforehand?
👍 1
p
@solidogen Sure. The reason why this is needed is because most of the screens in the application are heavy, meaning they contains lots of views and whatnot. This means that due to screens' complexity, which causes view recreation to be an expensive process that happens every time a user navigates from screen to screen (as well as other issues like state restoration in some views), I find it much more easier to just retain the Fragment's view until Fragment's
onDestroy
method is called. The Fragment's view gets cleared inside
onDestroy
method, which means that up until that method is called, the Fragment always returns a cached-in view inside
onCreateView
. Therefore, it's not possible that Fragment's view will be created twice. Hope it helps.
👍 1
s
thanks a lot, I see. I’m using google’s multiple backstack hack for bottom navigation and immediately after switching tab view gets destroyed, then is restored later from saved state, this is why I experienced different behaviour
👍 1
t
Perfect.
🙂 1
t
So many features in Android, gets a little overwhelming lol 🙂
p
@therealbluepandabear It sure does.