XmasSnow is a fully customizable android library that adds a snowfall to an activity. It also includes a snowfall view.
Here are the screenshots:
Download the sample apk here.
Usage:
Step 1: Install
Add this to your root build.gradle
file:
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
Now add the dependency to your app build.gradle
file:
implementation 'com.github.marcoscgdev:XmasSnow:1.0.1'
Step 2: Show into an Activity
Here is a complete snippet of it usage:
XmasSnow.on(this)
.belowActionBar(true)
.belowStatusBar(true) // Always true if belowActionBar() is set to true
.onlyOnChristmas(true) // Only the 25th of december
.setInterval("12/25/2017", "1/7/2018") // 25th of december to 7th of january (not included). Date format: MM/dd/yyyy
.start();
Step 3: Insert as a view
<com.marcoscg.xmassnow.SnowView
android:id="@+id/snowview"
android:layout_width="match_parent"
android:layout_height="match_parent" />
SnowView snowView = findViewById(R.id.snowview);
snowView.onlyOnChristmas(true);
snowView.setInterval("12/25/2017", "1/7/201
Full Example
Here is a full example:
1. Layouts
activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.marcoscg.xmassnowsample.MainActivity">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello World!" />
</RelativeLayout>
2. Code
MainActivity.java
package com.marcoscg.xmassnowsample;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import com.marcoscg.xmassnow.XmasSnow;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
XmasSnow.on(this)
.belowActionBar(true)
.start();
}
}
Reference
Download code here.
Read more here.
Follow code author here.