green-code-initiative / ecoCode-challenge

Emboard in the hackhatons serie for improving ecoCode
3 stars 4 forks source link

[Team169Cibles][Android] Sobriety: animation-free (Lottie library and imports of Android Animation or Jetpack Compose API) #43

Closed tdeffains closed 9 months ago

tdeffains commented 1 year ago

Sobriety: animation-free (Lottie library and imports of Android Animation or Jetpack Compose API)

Platform

OS OS version Langage
Android - Gradle/Java/Kotlin

Main caracteristics

ID Title Category Sub-category
- Lottie library and imports of Android Animation or Jetpack Compose API Sobriety animation-free

Severity / Remediation Cost

Severity Remediation Cost
- -

Rule short description

Animations isn't ecofriendly for saving battery power

Rule complete description

Text

Lottie is a commonly used library for embedding animations https://github.com/airbnb/lottie-android Animation implementation requires to import Android classes https://developer.android.com/reference/android/animation/Animator https://developer.android.com/reference/android/view/animation/Animation Jetpack Compose is the new Google framework for Android UI and provides APIs for animations https://developer.android.com/reference/kotlin/androidx/compose/animation/package-summary

build.gradle

dependencies {
    //Animations Lottie
    implementation 'com.airbnb.android:lottie:[x.y.z]'
}

Java files

import android.animation.*
import android.view.animation.*

Kotlin files

import androidx.compose.animation.*

Implementation principle

Lottie library

olegoaer commented 9 months ago

Obviously a good practice, but the ecocode plugin must focus on detection of built-in animations. Taking into account the countless third-party animation libraries is too cumbersome.