katalog icon indicating copy to clipboard operation
katalog copied to clipboard

Please consider ditching the material dependency from the manifest!

Open zoltish opened this issue 2 years ago • 4 comments

What happened?

The library declares android:theme="@style/Theme.MaterialComponents.DayNight.NoActionBar" in its manifest.

Unfortunately this breaks things for projects like mine that dont depend on material at all. Please consider ditching it, if thats viable for you too! :)

zoltish avatar Jul 06 '22 16:07 zoltish

Thanks for your report!

What specific problems do you encounter? Android Theme in Preview can be replaced with an extension.

dependencies {
    implementation("jp.co.cyberagent.katalog:katalog:`LATEST_VERSION`")
    implementation("jp.co.cyberagent.katalog:katalog-androidview:`LATEST_VERSION`")
    implementation("jp.co.cyberagent.katalog:katalog-ext-androidtheme:`LATEST_VERSION`")
}
registerKatalog(
    title = "Android Sample",
    extensions = listOf(
        AndroidThemeExt(R.style.MyTheme) // add this line
    )
) {
    view("Text View") {
        TextView(context).apply {
            text = "Hello, World"
        }
    }
}

Details

mori-atsushi avatar Jul 07 '22 01:07 mori-atsushi

Actually, there's a PR for this specific issue; #110

yshrsmz avatar Jul 07 '22 01:07 yshrsmz

@Mori-Atsushi Thank you, that works :)

While on the topic, I saw that appcompat would replace material - is it possible to make both optional? My application is entirely written in compose and Im able to trim the aab/apk size quite massively by removing these libraries. My activity just extends ComponentActivity.

zoltish avatar Jul 07 '22 03:07 zoltish

This is a debug tool, so if you care about app size, it's best not to include it in your production code. You can use it only in debug build or an independent application.

mori-atsushi avatar Jul 13 '22 06:07 mori-atsushi