material design components showcase
Nick Rout added this awesome debug activity to MuVi which showcases Material components with a given theme. This library follows the same idea, but saves you from having to do the same in every app that you have!
Light preview | Dark preview |
---|---|
Add it as a dependency to your project:
allprojects {
repositories {
maven { url "https://jitpack.io" }
}
}
implementation 'com.github.ataulm:material-design-components-showcase:<latest-release-or-commit>'
Then open the included Activity:
class DebugActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_debug)
openThemeShowcaseButton.setOnClickListener {
startMdcShowcase()
}
}
}
We can specify a particular theme to load too (by default it'll take the application theme):
startMdcShowcase(R.style.Theme_Demo)
There's a MaterialToolbar too, which we can set with a flag:
startMdcShowcase(R.style.Theme_Demo, shouldSetSupportActionBar = true)
If you want to customise the layout, you can pass an ArrayList
of layout resources, each of which will be inflated as a separate row.
startMdcShowcase(R.style.Theme_Demo, inflatables = arrayListOf(R.layout.demo_custom_inflatable))
If you want to augment the default set, you can include the original one too:
startMdcShowcase(
R.style.Theme_Demo,
shouldSetSupportActionBar = true,
inflatables = arrayListOf(R.layout.mdcs__default_inflatable, R.layout.demo_custom_inflatable)
)