In a 100% Compose app, is it possible to get rid o...
# compose
m
In a 100% Compose app, is it possible to get rid of the com.google.android.material:material dependency, since it has transitive appcompat dependencies..? It seems to be required only for the theme inside themes.xml, which itself is only required for the theme referenced from the AndroidManifest?
👌 1
👍 1
z
The tivi app does that I believe
1
m
Hmm, nice thanks!
👍🏽 1
a
You don't even need AppCompat in a pure compose app. See here.
m
Well that’s what I’m asking.. how to get rid of them..
a
I removed that depedency in one app. Only the
theme.xml
referenced it. I changed to another theme and all was well. It cut down the size of my app by quite a bit.
👍 2
t
@adjpd Is it possible to set the
statusBarColor
with just
@android:style/Theme
?
Copy code
<style name="MyTheme" parent="@android:style/Theme">
        <!-- Status bar color. -->
        <item name="android:statusBarColor">#FF0000</item>

    </style>
this doesn’t work though..
a
This works for me
Copy code
<resources xmlns:tools="<http://schemas.android.com/tools>">
    <style name="Theme.MyTheme" parent="android:Theme.DeviceDefault.NoActionBar">
        <item name="android:statusBarColor" tools:targetApi="l">#ff2e7d32</item>
        <item name="android:background">#ff2e7d32</item>
    </style>
</resources>
t
that works 😄 but I don’t understand the diff b/w
parent="android:Theme.
and
parent="@android:Theme.
. I mean what’s that
@
mean here ? 🤔 the latter fails with build error though.
a
No idea. The XML attribute incantations always passed me by.
theme.xml
is the only XML file I need to deal with now, bar Material's date and time picker, and I hope nothing more. The annoying thing about using Android views is that you need to define the styles in XML still, and then make sure they conform to your Compose styles, unless you decide to put all the styles in XML, and that feels like defeat.
1
m
Now that I use this Tivi method to remove all appcomat transitive dependencies, now I have a problem that I can’t include any library that has it’s own Activity build with legacy UI.. for e.g. like Chucker or Facebook SDK..?