Zebra Design System components for Android.
🚧 Note: This has been verified with
compileSdkVersion 34
. Other sdk versions may require additional work.
ZDS-Android is hosted in maven on Zebra's internal Artifactory repository. Credentials for this are required, and can be obtained by logging onto Artifactory.
To access the tokens through maven in Android Studio, you will need to provide credentials. The username will be your personal Zebra Core ID, and a password will need to be generated from Artifactory.
Once logged in with SSO, select your username in the top right corner, and select Edit Profile
. Under Authentication Settings, select Generate an Identity Token
. On the next screen, add a memorable description for the token that will be generated; select Next
. This generated token is your password.
These credentials will need to be passed into Gradle, but they should not be committed to source control. It is recommended for individuals to save their username and password in their global gradle.properties
file in the <USER_HOME>/.gradle
directory (This file may need to be created). The following format is only an example, and any names can be given.
mavenUsername=XXX
mavenPassword=YYY
These credentials should never be shared.
Your username(core id) and password(generated token) need to be provided into a settings.gradle file. THe following examples show how this would be done assuming the credentials have been saved as per step 2 for both settings.gradle
and settings.gradle.kts
.
settings.gradle
dependencyResolutionManagement {
repositories {
maven{
url "https://artifactory-us.zebra.com/artifactory/dmo-mvn-rel/"
credentials {
username = "${mavenUsername}"
password = "${mavenPassword}"
}
}
}
}
settings.gradle.kts
import java.lang.System.getProperty
...
dependencyResolutionManagement {
repositories {
google()
mavenCentral()
maven{
url = uri("https://artifactory-us.zebra.com/artifactory/dmo-mvn-rel/")
credentials {
username = getProperty("mavenUsername")
password = getProperty("mavenPassword")
}
}
}
}
This step is needed to ensure that gradle can sync and pull data from the maven repository. In Android studio, click the 'Make Module' button in the toolbar (hammer icon).
This file should be located within the app directory of your project (not the root level); below are examples for both build.gradle
and build.gradle.kts
`build.gradle`
dependencies {
...
implementation 'com.zebra:zds:1.1.0'
}
build.gradle.kts
dependencies { ... implementation("com.zebra:zds:1.1.0") }
Once you have done this, and performed a sync and build, the IDE should recommend this line be refactored into the new style below:
dependencies {
...
implementation(libs.zds)
}
For the components to work and receive the correct theme values, we must add the theme in AndroidManifest.xml
. Be sure to remove other themes which could override this and prevent the components from working.
<application
...
android:theme="@style/Theme.ZdsBase"
...
/>
<com.zebra.zds.ZdsButton
style="@style/Zds.Button.Primary"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="Button"
android:theme="@style/Zds.Button.Primary"/>
Ensure you read the docs, as some components may have extra parameters.