This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<string name="some_string">Hello %1$s</string> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<TextView | |
android:layout_width="match_parent" | |
android:layout_height="wrap content" | |
android:text="Hello, gradient!" | |
app:background_gradient_colors="@{@intArray/some_colors}"/> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<resources> | |
<integer-array name="some_colors"> | |
<item>@color/color0</item> | |
<item>@color/color1</item> | |
<item>@color/color2</item> | |
<item>@color/color3</item> | |
<item>@color/color4</item> | |
</integer-array> | |
</resources> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
object ViewBindingAdapters { | |
@JvmStatic | |
@BindingAdapter("background_gradient_colors") | |
fun setBackgroundColors(view: View, colors: IntArray) { | |
view.background = GradientDrawable( | |
GradientDrawable.Orientation.LEFT_RIGHT, | |
colors | |
) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def localPropertyApiToken = … // read api token from local.properties | |
def systemEnvApiToken = … // read api token from system environment variable | |
ext.api_token = localPropertyApiToken != null ? localPropertyApiToken : systemEnvApiToken |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Properties properties = new Properties() | |
def propertiesFile = project.rootProject.file('local.properties') | |
if (propertiesFile.exists()) { | |
properties.load(propertiesFile.newDataInputStream()) | |
} | |
ext.apiToken = properties.getProperty('api.token') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ext.apiToken = System.getenv('API_TOKEN') // replace the ext. prefix with def if you don’t want to provide the API token to the default properties which you can then access from all your build scripts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
api.token=123456789abcdef |