private static boolean isNightMode(Context context) {
    int nightModeMasked = context.getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK;
    return nightModeMasked == Configuration.UI_MODE_NIGHT_YES;
  }
It is important to include day/night in the cache key so that if it changes, the cache won't return an animation from the wrong bucket.
lottie/src/main/java/com/airbnb/lottie/LottieCompositionFactory.java