Home

Awesome

Mistica for Android Mistica for Android

Platform Version Support Kotlin version badge

Mistica is a framework that contains reusable UI components and utilities.

Compose support

There is a currently work in progress compose version of the library. Check the documentation here

Installation

Inside the dependency block in the build.gradle of your application, add this line to add the library:

repositories {
    mavenCentral()
}
dependencies {
    ...
    implementation 'com.telefonica:mistica:$version'
    ...
}

In case you also want to include also the components catalog in your application:

dependencies {
    ...
    implementation 'com.telefonica:mistica:$version'
    implementation 'com.telefonica:mistica-catalog:$version'
    ...
}

Configuration

Mistica provides an Android theme for each brand supported by telefonica. Just set your App or any specific activity to use any of the following:

<manifest ...>
    <application
        ...
        android:theme="@style/MisticaTheme.Movistar" />
</manifest>

Components

Text Presets Styles

Library includes a set of available Text Appearance styles, applicable for all kind of TextViews.

Using fonts

Mistica defines 3 typographic styles to be used along with the library, these typefaces are defined as attributes and can be override using some allowed fonts. More info here

Working with semantic colors/gradients

For each supported brand, Mistica exposes a set of theme properties (attributes in xml) customized accordingly for each brand.

More info here

Demo app

There is a demo of currently implemented components in this repository. A full list of implemented components can be found here: Components.

The app can be downloaded here or manually built.

To compile the app manually run the App module in Android Studio.

<p align="left"> <img width="25%" src="./doc/images/catalog/catalog.png"> </p>

Working with this project locally

In case you are making a change in the library that yoy want to test in other client app but you don't want to release a new version or even an snapshot, then a local deployment of the lib can be done on your machine.

Some small changes that shouldn't be committed are needed:

/*
signing {
    def signingKeyId = findProperty("signingKeyId")
    def signingKey = findProperty("signingKey")
    def signingPassword = findProperty("signingPassword")
    useInMemoryPgpKeys(signingKeyId, signingKey, signingPassword)
    sign publishing.publications
}
*/
PUBLISH_VERSION = '1.0.0-SNAPSHOT'
./gradlew clean :library:assembleRelease :catalog:assembleRelease
./gradlew :library:publishReleasePublicationToMavenLocal :catalog:publishCatalogPublicationToMavenLocal
allprojects {
    repositories {
        mavenLocal() // It is recommended to place it on first place
        // ... your other repositories
    }
}

Snapshot generation with GitHub Action

To create a new snapshot go to the snapshot.yml Action, select a branch and enter the version, like x.x.x

After a while, the new version will be available, keep in mind that the version name will be x.x.x-SNAPSHOT

Design tokens

We have several tokens that are defined by the UX team (colors, radius and text presets) in a JSON format. Using these files, we generate XML and Kotlin files that are used in the library.

You should not modify manually the generated files. All the generated files have a comment at the beginning to identify them.

There is a more detailed documentation about how to work with this design tokens generation.

Library size

Library aar size is around 270 KB, without including transitive dependencies (Lottie, material and kotlin).

Your app size increase may depend on which of these transitive libraries are already being used, and also, the usage of them, so proguard can shrink more or less code.

Just to put an example, in a common scenario where your app is already using material and kotlin libs, app size increase should be around 400 KB

Contributing

See CONTRIBUTING.md

Upgrading guide

See UPGRADING.md