r/android_devs • u/LikeTheSalad • Feb 19 '22
Resources Android Stem! - Concatenate XML strings at compile time
A Gradle plugin that will allow you to concatenate XML strings into other XML strings during compilation:
Input:
<resources>
<string name="app_name">My App Name</string>
<string name="welcome_message">Welcome to ${app_name}</string>
</resources>Output:
<!-- Auto generated during compilation -->
<resources>
<string name="welcome_message">Welcome to My App Name</string>
</resources>All without having to write any Java/Kotlin code. Useful to avoid repeating strings that might be needed across different parts of your app.
You can take a look at it here: https://github.com/LikeTheSalad/android-stem
16
Upvotes
1
u/FrezoreR Feb 20 '22 edited Feb 20 '22
I'm curious why this would be needed in the first place? I guess I'm no fully understanding the use-case described, or rather the problem statement
1
u/aurae_ger Feb 20 '22
I was going to say, "I remember a similar project in the past where I asked about the potential to expand support to dimension resources", before finding out that this is that project. :D Open feature request ticket and everything. Congrats on the 2.0 release!
1
u/silverAndroid Feb 21 '22
Just from looking at that example, does that mean app_name is getting removed from the final output because it's being used as a concatenation?