Fully customizable implementation of "Snowfall View" on Android.

Overview

Android-Snowfall

Android Arsenal Release API AndroidWeekly AndroidDev Digest

Fully customizable implementation of "Snowfall View" on Android.

That's how we use it in our app Hotellook

image

Compatibility

This library is compatible from API 16 (Android 4.1).

Download

Add it in your root build.gradle at the end of repositories:

allprojects {
    repositories {
        ...
        maven { url "https://jitpack.io" }
    }
}

Add the dependency

dependencies {
    compile 'com.github.jetradarmobile:android-snowfall:1.2.1'
}

Usage

Default implementation with round snowflakes:

<com.jetradarmobile.snowfall.SnowfallView
      android:layout_width="match_parent"
      android:layout_height="match_parent"/>

Fully customized implementation:

<com.jetradarmobile.snowfall.SnowfallView
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      app:snowflakesNum="250"
      app:snowflakeAlphaMin="150"
      app:snowflakeAlphaMax="255"
      app:snowflakeAngleMax="5"
      app:snowflakeSizeMin="8dp"
      app:snowflakeSizeMax="32dp"
      app:snowflakeSpeedMin="4"
      app:snowflakeSpeedMax="12"
      app:snowflakesFadingEnabled="true"
      app:snowflakesAlreadyFalling="false"
      app:snowflakeImage="@drawable/snowflake"/>

License

Copyright 2016 JetRadar

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Comments
  • Add general fixes and optimizations to the project

    Add general fixes and optimizations to the project

    Change list:

    • Remove lazy accessors for fields. They are adding extra overhead in terms of memory and they are way too heavy for one threaded environment complex for Android world
    • Remove kotlin stdlib methods in onDraw. They are just adding extra allocations while trying to draw on Android canvas
    • Some code overall clean up
    • Migrate sample to AndroidX
    • Update dependencies for Kotlin and plugins
    opened by dniHze 3
  • Fix memory leak related to inner HandlerThread

    Fix memory leak related to inner HandlerThread

    We were using this library and noticed that it would leak the activity that contains the SnowfallView. This was due to the HandlerThread being an inner class, therefore having a reference to the view.

    I also ensured that the thread is not started until the view is attached. And that we call quit() when detached.

    I tested the changes with the sample app and the android studio memory analyser.

    opened by ivacf 2
  • Add ability to stop snowfall without making it disappear

    Add ability to stop snowfall without making it disappear

    Previously, the only way to stop the snowfall was to make the SnowfallView GONE, meaning that the snow would immediately disappear. With this change, one can stop the snowfall, but any snowflakes that are already visible on the screen will continue falling.

    This functionality was added for use within the Expedia app in December 2017. ezgif-4-d8771ec81e

    opened by scottdweber 2
  • tweak builds

    tweak builds

    I saw this on Android Weekly. Just need to figure out where I can use it...

    I noticed the build had rotted a bit, so I updated a few things. Hope the PR's ok.

    opened by jonathan-caryl 1
  • Getting class cast exception

    Getting class cast exception

    I am using default implementation as provided in Readme and getting this problem :

    java.lang.ClassCastException: com.jetradarmobile.snowfall.SnowfallView cannot be cast to android.view.ViewGroup
    	at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:859)
    	at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:70)
    	at android.view.LayoutInflater.rInflate(LayoutInflater.java:834)
    	at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:821)
    	at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:861)
    	at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:70)
    	at android.view.LayoutInflater.rInflate(LayoutInflater.java:834)
    	at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:821)
    	at android.view.LayoutInflater.inflate(LayoutInflater.java:518)
    	at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
    	at com.android.layoutlib.bridge.impl.RenderSessionImpl.inflate(RenderSessionImpl.java:324)
    	at com.android.layoutlib.bridge.Bridge.createSession(Bridge.java:429)
    	at com.android.ide.common.rendering.LayoutLibrary.createSession(LayoutLibrary.java:389)
    	at com.android.tools.idea.rendering.RenderTask$2.compute(RenderTask.java:548)
    	at com.android.tools.idea.rendering.RenderTask$2.compute(RenderTask.java:533)
    	at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:966)
    	at com.android.tools.idea.rendering.RenderTask.createRenderSession(RenderTask.java:533)
    	at com.android.tools.idea.rendering.RenderTask.lambda$inflate$70(RenderTask.java:659)
    	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    	at java.lang.Thread.run(Thread.java:745)
    
    
    opened by ahmadalibaloch 1
  • Setting visibility to visible when invoking restartFalling

    Setting visibility to visible when invoking restartFalling

    If I invoke stopFalling() on SnowfallView and wait for all snowflakes to fall out of view, calling restartFalling() does not render the snowflakes unless I set the visibility back to VISIBLE.

    Ideally this should be taken care of in restartFalling().

    Also cleaned up a few lint warnings.

    opened by rojanthomas 0
  • Orientation change

    Orientation change

    Starts falling again from top when orientation change i think in to the library project configurationwith screenlayout change isnt added in activity .in manifest

    opened by champrocks3190 0
  • doesn't change image programmatically

    doesn't change image programmatically

    I want to change snow flake image programmatically. Please do something and let me know through email. Above issues is the only missing in this library. Thank you so much for this library.

    opened by HarshilVasundhara 1
  • Performance  issue with recyclerview

    Performance issue with recyclerview

    I am trying to integrate this snowfall effect in recyclerview and it is looking quite good. But without snowfall effect recyclerview is scrolling smoothly and integration of snowfall makes recyclerview scrolling hazy.

    Do you know this is happening ? Any direction and guide will be really helpful. Thanks.

    opened by aboutgaurav 0
  • Page loading slow when i use snow fall animation.

    Page loading slow when i use snow fall animation.

    I have my Editext field and snow fall animations at the same page. When i try to enter text in the edittext field it takes more time for the text to be show. It is because of the animations in the page makes the text to appear slow. Is there any way to view the text as soon as possible after it is being typed?

    Thanks in Advance.

    opened by ManikandanS910 0
Releases(1.2.1)
  • 1.2.1(Dec 25, 2020)

    • Remove lazy accessors for fields. They are adding extra overhead in terms of memory and they are way too heavy for one threaded environment complex for Android world.
    • Remove kotlin stdlib methods in onDraw. They are just adding extra allocations while trying to draw on Android canvas.
    • Some code overall clean up.
    • Migrate sample to AndroidX.
    • Update dependencies for Kotlin and plugins.
    Source code(tar.gz)
    Source code(zip)
  • 1.2.0(Feb 14, 2018)

  • 1.1.6(Dec 29, 2016)

  • 1.1.5(Dec 29, 2016)

  • 1.1.4(Dec 28, 2016)

  • 1.1.3(Dec 28, 2016)

  • 1.1.2(Dec 27, 2016)

  • 1.1.1(Dec 26, 2016)

    • Support different start position on y-axis for snowflakes (attr snowflakesAlreadyFalling).
    • Rename attr snowflakeFadingEnabled to snowflakesFadingEnabled.
    • Fixed animation lags.
    • Fixed API 15 support.
    Source code(tar.gz)
    Source code(zip)
  • 1.1.0(Dec 25, 2016)

    • Support custom snowflake image (attr snowflakeImage).
    • Support custom snowflake angle (attr snowflakeAngleMax).
    • Support custom snowflake speed (attrs snowflakeSpeedMin, snowflakeSpeedMax).
    • All snowflakes are unique (size, speed, angle, alpha, start position).
    • Calculate size by using gaussian ("normally") distribution.
    Source code(tar.gz)
    Source code(zip)
  • 1.0.0(Dec 23, 2016)

Owner
Jetradar Mobile
Cheap flights and airline tickets
Jetradar Mobile
⚡️A highly customizable, powerful and easy-to-use alerting library for Android.

Flashbar A highly customizable, powerful and easy-to-use alerting library for Android. Specs This library allows you to show messages or alerts in you

Aritra Roy 1.7k Dec 7, 2022
A simple, customizable and easy to use swipeable view stack for Android.

SwipeStack A simple, customizable and easy to use swipeable view stack for Android. QuickStart Include the Gradle dependency dependencies { compil

Frederik Schweiger 1.5k Dec 30, 2022
A nicer-looking, more intuitive and highly customizable alternative for radio buttons and dropdowns for Android.

SwipeSelector Undergoing for some API changes for a 2.0 major version, see example usage in the sample module! What and why? Bored of dull looking rad

Iiro Krankka 1.1k Dec 30, 2022
Customizable Item Setting View Android

ItemSettingView Simple ItemSettingView and Custom Installation Add it in your root build.gradle at the end of repositories: allprojects { reposito

Andhika Yuana 15 Aug 19, 2022
Highly customizable SlidingLayer as you have seen in Wunderlist

6Wunderkinder SlidingLayer for Android This repository hosts a library that provides an easy way to include an autonomous layer/view that slides from

Microsoft Archive 942 Nov 28, 2022
The CustomCalendarView provides an easy and customizable calendar to create a Calendar. It dispaly the days of a month in a grid layout and allows to navigate between months

Custom-Calendar-View To use the CustomCalendarView in your application, you first need to add the library to your application. You can do this by eith

Nilanchala Panigrahy 113 Nov 29, 2022
A simple and customizable two or three states Switch View

RMSwitch A simple View that works like a switch, but with more customizations. With the option to choose between two or three states. (from v1.1.0) **

Riccardo Moro 656 Dec 2, 2022
Highly customizable SlidingLayer as you have seen in Wunderlist

6Wunderkinder SlidingLayer for Android This repository hosts a library that provides an easy way to include an autonomous layer/view that slides from

Microsoft Archive 942 Nov 28, 2022
A customizable debug screen to view and edit flags that can be used for development in Jetpack Compose applications

Tweaks A customizable debug screen to view and edit flags that can be used for development in Jetpack Compose applications To include the library add

Guillermo Merino Jiménez 4 Jan 14, 2022
Wizard Pager is a library that provides an example implementation of a Wizard UI on Android, it's based of Roman Nurik's wizard pager (https://github.com/romannurik/android-wizardpager)

Wizard Pager Wizard Pager is a library that provides an example implementation of a Wizard UI on Android, it's based of Roman Nurik's wizard pager (ht

Julián Suárez 520 Nov 11, 2022
Material Design implementation for Android 4.0+. Shadows, ripples, vectors, fonts, animations, widgets, rounded corners and more.

Carbon Material Design implementation for Android 4.0 and newer. This is not the exact copy of the Lollipop's API and features. It's a custom implemen

null 3k Dec 30, 2022
AndroidTreeView. TreeView implementation for android

AndroidTreeView Recent changes 2D scrolling mode added, keep in mind this comes with few limitations: you won't be able not place views on right side

Bogdan Melnychuk 2.9k Jan 2, 2023
Proof of concept Android WebView implementation based on Chromium code

Deprecation Notice This project is un-maintained. The recommended alternative is the Crosswalk Project. I did not have the time to keep the project up

Victor Costan 1.7k Dec 25, 2022
Wizard Pager is a library that provides an example implementation of a Wizard UI on Android

Wizard Pager is a library that provides an example implementation of a Wizard UI on Android, it's based of Roman Nurik's wizard pager.

Julián Suárez 520 Nov 11, 2022
This is a sample Android Studio project that shows the necessary code to create a note list widget, And it's an implementation of a lesson on the Pluralsight platform, but with some code improvements

NoteKeeper-Custom-Widgets This is a sample Android Studio project that shows the necessary code to create a note list widget, And it's an implementati

Ibrahim Mushtaha 3 Oct 29, 2022
Multi Roots TreeView implementation for Android Platform with a lot of options and customization

Multi roots TreeView :palm_tree: implementation for Android Platform with a lot of options and customization

Amr Hesham 112 Jan 3, 2023
An implementation of tap targets from the Material Design guidelines for feature discovery.

TapTargetView An implementation of tap targets from Google's Material Design guidelines on feature discovery. Min SDK: 14 JavaDoc Installation TapTar

Keepsafe 5.2k Dec 30, 2022
Implementation of the fragment with the ability to display indeterminate progress indicator when you are waiting for the initial data.

Android-ProgressFragment Implementation of the fragment with the ability to display indeterminate progress indicator when you are waiting for the init

Evgeny Shishkin 813 Nov 11, 2022
A simple implementation of swipe card like StreetView

A simple implementation of swipe card like StreetView!! DONATIONS This project needs you! If you would like to support this project's further developm

Michele Lacorte 831 Jan 4, 2023