• Stars
    star
    203
  • Rank 192,890 (Top 4 %)
  • Language
    Kotlin
  • License
    Apache License 2.0
  • Created about 5 years ago
  • Updated about 5 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A glorified layout file to which you can apply your Android theme

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
light mode dark mode

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)
)