Skip to content
/ Androtecture Public template

Stuff that spares you boilerplate code, for example in fragment you'll find base fragment classes you could use to extend and remove duplications regarding layout inflation either with or without databinding support, also with a convenient callback to initialize your layout views in.

License

Notifications You must be signed in to change notification settings

tomeeeS/Androtecture

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Fragment

BaseFragment takes care of layout inflation and provides onLayoutInit, a convenient callback to initialize your layout views in.

Usage of BaseFragment:

class <YourFragment> :
    BaseFragment(R.layout.<your_fragment_layout>)  // extend it, pass your layout
{

    // use this callback to initialize your views. no need for onCreateView, onViewCreated.
    override fun onLayoutInit() {         
        val text1 = requireView().findViewById<TextView>(R.id.text1).apply { 
            text = "foo"
        }
        // or with Android ktx (which allows us to use views from your layout easily and 
        // type-safely without findViewById) :
        // text1.text = "foo"
    } 
    
    ...
}

About

Stuff that spares you boilerplate code, for example in fragment you'll find base fragment classes you could use to extend and remove duplications regarding layout inflation either with or without databinding support, also with a convenient callback to initialize your layout views in.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

Packages

No packages published

Languages