package com.luolc.emojirain.sample;

import android.graphics.BitmapFactory;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.widget.EditText;
import android.widget.Toast;

import com.annimon.stream.Stream;
import com.luolc.emojirain.EmojiRainLayout;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

/**
 * EmojiRain sample activity.
 *
 * @author LuoLiangchen
 * @since 2016/12/16
 */
public class MainActivity extends AppCompatActivity {

    @BindView(R.id.group_emoji_container) EmojiRainLayout mContainer;

    @BindView(R.id.et_per) EditText mPer;

    @BindView(R.id.et_duration) EditText mDuration;

    @BindView(R.id.et_drop_duration) EditText mDropDuration;

    @BindView(R.id.et_frequency) EditText mFrequency;

    @OnClick(R.id.btn_drop)
    void onClickDrop() {
        if (!checkInputParams(mPer, mDuration, mDropDuration, mFrequency)) {
            Toast.makeText(this, R.string.please_input_all_params, Toast.LENGTH_SHORT).show();
            return;
        }
        mContainer.stopDropping();
        int per = Integer.parseInt(mPer.getText().toString());
        int duration = Integer.parseInt(mDuration.getText().toString());
        int dropDuration = Integer.parseInt(mDropDuration.getText().toString());
        int frequency = Integer.parseInt(mFrequency.getText().toString());
        mContainer.setPer(per);
        mContainer.setDuration(duration);
        mContainer.setDropDuration(dropDuration);
        mContainer.setDropFrequency(frequency);

        mContainer.startDropping();
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        ButterKnife.bind(this);

        mContainer.addEmoji(BitmapFactory.decodeResource(getResources(), R.drawable.emoji_1_3));
        mContainer.addEmoji(BitmapFactory.decodeResource(getResources(), R.drawable.emoji_2_3));
        mContainer.addEmoji(BitmapFactory.decodeResource(getResources(), R.drawable.emoji_3_3));
        mContainer.addEmoji(BitmapFactory.decodeResource(getResources(), R.drawable.emoji_4_3));
        mContainer.addEmoji(BitmapFactory.decodeResource(getResources(), R.drawable.emoji_5_3));
    }

    private boolean checkInputParams(EditText... params) {
        return Stream.of(params).allMatch(param -> param.getText().length() != 0);
    }
}

@@ -34,47 +34,8 @@
 e;%0A%0A
-import android.graphics.BitmapFactory;%0A
 impo
@@ -1787,53 +1787,8 @@
 oji(
-BitmapFactory.decodeResource(getResources(), 
 R.dr
@@ -1804,17 +1804,16 @@
 oji_1_3)
-)
 ;%0A      
@@ -1838,53 +1838,8 @@
 oji(
-BitmapFactory.decodeResource(getResources(), 
 R.dr
@@ -1855,17 +1855,16 @@
 oji_2_3)
-)
 ;%0A      
@@ -1889,53 +1889,8 @@
 oji(
-BitmapFactory.decodeResource(getResources(), 
 R.dr
@@ -1906,17 +1906,16 @@
 oji_3_3)
-)
 ;%0A      
@@ -1940,53 +1940,8 @@
 oji(
-BitmapFactory.decodeResource(getResources(), 
 R.dr
@@ -1957,17 +1957,16 @@
 oji_4_3)
-)
 ;%0A      
@@ -1991,53 +1991,8 @@
 oji(
-BitmapFactory.decodeResource(getResources(), 
 R.dr
@@ -2008,17 +2008,16 @@
 oji_5_3)
-)
 ;%0A    %7D%0A

Simplify demo