// Path: app/src/main/java/io/whz/synapse/pojo/event/MANEvent.java
// public class MANEvent<T> extends TypeEvent<T> {
//     public static final int CLICK_DOWNLOAD = 0x01;
//     public static final int DOWNLOAD_COMPLETE = 0x01 << 1;
//     public static final int DECOMPRESS_COMPLETE = 0x01 << 2;
//     public static final int REJECT_MSG = 0x01 << 3;
//     public static final int JUMP_TO_PLAY = 0x01 << 4;
//     public static final int JUMP_TO_TRAINED = 0x01 << 5;
//     public static final int JUMP_TO_TRAINING = 0x01 << 6;
// 
//     @IntDef({
//             CLICK_DOWNLOAD, DOWNLOAD_COMPLETE, DECOMPRESS_COMPLETE,
//             REJECT_MSG, JUMP_TO_PLAY, JUMP_TO_TRAINED, JUMP_TO_TRAINING
//     })
//     @Retention(RetentionPolicy.SOURCE)
//     public @interface Event {
//     }
// 
//     public MANEvent(int what, T obj) {
//         super(what, obj);
//     }
// 
//     public MANEvent(int what) {
//         super(what);
//     }
// }
// 
// Path: app/src/main/java/io/whz/synapse/pojo/multiple/item/WelcomeItem.java
// public class WelcomeItem {
//     @Retention(RetentionPolicy.SOURCE)
//     @IntDef({UNREADY, WAITING, READY})
//     public @interface State {}
// 
//     public static final int UNREADY = 0x01;
//     public static final int WAITING = 0x01 << 1;
//     public static final int READY = 0x01 << 2;
// 
//     @State
//     private final int mState;
// 
//     public WelcomeItem(@State int state) {
//         mState = state;
//     }
// 
//     @State
//     public int state() {
//         return mState;
//     }
// 
//     @Override
//     public boolean equals(Object obj) {
//         return (obj instanceof WelcomeItem)
//                 && ((WelcomeItem) obj).state() == this.state();
//     }
// }


import android.content.res.Resources;
import android.support.annotation.NonNull;
import android.support.transition.TransitionManager;
import android.support.v4.content.res.ResourcesCompat;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import org.greenrobot.eventbus.EventBus;
import io.whz.synapse.R;
import io.whz.synapse.pojo.event.MANEvent;
import io.whz.synapse.pojo.multiple.item.WelcomeItem;
import me.drakeet.multitype.ItemViewBinder;
package io.whz.synapse.pojo.multiple.binder;




public class WelcomeViewBinder extends ItemViewBinder<WelcomeItem, WelcomeViewBinder.WelcomeHolder>
        implements View.OnClickListener {

    @NonNull
    @Override
    protected WelcomeHolder onCreateViewHolder(@NonNull LayoutInflater layoutInflater, @NonNull ViewGroup viewGroup) {
        final WelcomeHolder holder = WelcomeHolder.newInstance(layoutInflater, viewGroup);

        holder.download.setOnClickListener(this);

        return holder;
    }

    @Override
    protected void onBindViewHolder(@NonNull WelcomeHolder holder, @NonNull WelcomeItem dataSet) {
        final Resources resources = holder.download.getResources();
        TransitionManager.beginDelayedTransition((ViewGroup) holder.itemView);

        switch (dataSet.state()) {
            case WelcomeItem.READY:
                holder.download.setText(R.string.data_ready);
                holder.download.setTextColor(ResourcesCompat.getColor(resources, R.color.data_ready_text, null));
                holder.download.setClickable(false);
                holder.progress.setVisibility(View.GONE);
                break;

            case WelcomeItem.WAITING:
                holder.download.setTextColor(ResourcesCompat.getColor(resources, R.color.data_waiting_text, null));
                holder.download.setText(R.string.data_waiting);
                holder.download.setClickable(true);
                holder.progress.setVisibility(View.VISIBLE);
// Path: app/src/main/java/io/whz/synapse/pojo/event/MANEvent.java
// public class MANEvent<T> extends TypeEvent<T> {
//     public static final int CLICK_DOWNLOAD = 0x01;
//     public static final int DOWNLOAD_COMPLETE = 0x01 << 1;
//     public static final int DECOMPRESS_COMPLETE = 0x01 << 2;
//     public static final int REJECT_MSG = 0x01 << 3;
//     public static final int JUMP_TO_PLAY = 0x01 << 4;
//     public static final int JUMP_TO_TRAINED = 0x01 << 5;
//     public static final int JUMP_TO_TRAINING = 0x01 << 6;
// 
//     @IntDef({
//             CLICK_DOWNLOAD, DOWNLOAD_COMPLETE, DECOMPRESS_COMPLETE,
//             REJECT_MSG, JUMP_TO_PLAY, JUMP_TO_TRAINED, JUMP_TO_TRAINING
//     })
//     @Retention(RetentionPolicy.SOURCE)
//     public @interface Event {
//     }
// 
//     public MANEvent(int what, T obj) {
//         super(what, obj);
//     }
// 
//     public MANEvent(int what) {
//         super(what);
//     }
// }
// 
// Path: app/src/main/java/io/whz/synapse/pojo/multiple/item/WelcomeItem.java
// public class WelcomeItem {
//     @Retention(RetentionPolicy.SOURCE)
//     @IntDef({UNREADY, WAITING, READY})
//     public @interface State {}
// 
//     public static final int UNREADY = 0x01;
//     public static final int WAITING = 0x01 << 1;
//     public static final int READY = 0x01 << 2;
// 
//     @State
//     private final int mState;
// 
//     public WelcomeItem(@State int state) {
//         mState = state;
//     }
// 
//     @State
//     public int state() {
//         return mState;
//     }
// 
//     @Override
//     public boolean equals(Object obj) {
//         return (obj instanceof WelcomeItem)
//                 && ((WelcomeItem) obj).state() == this.state();
//     }
// }


// Path: app/src/main/java/io/whz/synapse/pojo/multiple/binder/WelcomeViewBinder.java
import android.content.res.Resources;
import android.support.annotation.NonNull;
import android.support.transition.TransitionManager;
import android.support.v4.content.res.ResourcesCompat;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import org.greenrobot.eventbus.EventBus;
import io.whz.synapse.R;
import io.whz.synapse.pojo.event.MANEvent;
import io.whz.synapse.pojo.multiple.item.WelcomeItem;
import me.drakeet.multitype.ItemViewBinder;

package io.whz.synapse.pojo.multiple.binder;




public class WelcomeViewBinder extends ItemViewBinder<WelcomeItem, WelcomeViewBinder.WelcomeHolder>
        implements View.OnClickListener {

    @NonNull
    @Override
    protected WelcomeHolder onCreateViewHolder(@NonNull LayoutInflater layoutInflater, @NonNull ViewGroup viewGroup) {
        final WelcomeHolder holder = WelcomeHolder.newInstance(layoutInflater, viewGroup);

        holder.download.setOnClickListener(this);

        return holder;
    }

    @Override
    protected void onBindViewHolder(@NonNull WelcomeHolder holder, @NonNull WelcomeItem dataSet) {
        final Resources resources = holder.download.getResources();
        TransitionManager.beginDelayedTransition((ViewGroup) holder.itemView);

        switch (dataSet.state()) {
            case WelcomeItem.READY:
                holder.download.setText(R.string.data_ready);
                holder.download.setTextColor(ResourcesCompat.getColor(resources, R.color.data_ready_text, null));
                holder.download.setClickable(false);
                holder.progress.setVisibility(View.GONE);
                break;

            case WelcomeItem.WAITING:
                holder.download.setTextColor(ResourcesCompat.getColor(resources, R.color.data_waiting_text, null));
                holder.download.setText(R.string.data_waiting);
                holder.download.setClickable(true);
                holder.progress.setVisibility(View.VISIBLE);
                break;