<file_sep>package com.miguan.otk.module.user;

import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;

import com.dsk.chain.bijection.Presenter;
import com.jude.exgridview.PieceViewGroup;
import com.jude.library.imageprovider.ImageProvider;
import com.jude.library.imageprovider.OnImageSelectListener;
import com.miguan.otk.model.ImageModel;
import com.miguan.otk.model.UserModel;
import com.miguan.otk.model.bean.Feedback;
import com.miguan.otk.model.services.ServicesResponse;
import com.miguan.otk.utils.LUtils;

import java.io.File;
import java.util.ArrayList;
import java.util.List;

import rx.Observable;
import rx.functions.Func1;

/**
 * Copyright (c) 2016/11/29. LiaoPeiKun Inc. All rights reserved.
 */

public class FeedbackPresenter extends Presenter<FeedbackActivity> implements OnImageSelectListener, PieceViewGroup.OnViewDeleteListener {

    private List<Uri> mUris;

    private ImageProvider mImageProvider;

    @Override
    protected void onCreate(FeedbackActivity view, Bundle saveState) {
        super.onCreate(view, saveState);
        mUris = new ArrayList<>();
        mImageProvider = new ImageProvider(getView());
    }

    public void pickImage(int type) {


        switch (type) {
            case 0:
                mImageProvider.getImageFromAlbum(this, 3 - mUris.size());
                break;
            case 1:
                mImageProvider.getImageFromCamera(this);
        }
    }

    public void save(int type, String contact, String content) {
        if (mUris.size() > 0) {
            Observable.from(mUris)
                    .map(uri -> new File(uri.getPath()))
                    .flatMap(new Func1<File, Observable<String>>() {
                        @Override
                        public Observable<String> call(File file) {
                            return ImageModel.getInstance().uploadImageAsync(file);
                        }
                    })
                    .toList()
                    .flatMap(new Func1<List<String>, Observable<Feedback>>() {
                        @Override
                        public Observable<Feedback> call(List<String> list) {
                            return UserModel.getInstance().saveFeedback(type, contact, content, getImages(list));
                        }
                    })
                    .unsafeSubscribe(new ServicesResponse<Feedback>() {
                        @Override
                        public void onNext(Feedback feedback) {
                            getView().finish();
                            LUtils.toast("谢谢反馈");
                        }
                    });
        } else {
            UserModel.getInstance().saveFeedback(type, contact, content, "")
                    .unsafeSubscribe(new ServicesResponse<Feedback>() {
                        @Override
                        public void onNext(Feedback feedback) {
                            getView().finish();
                            LUtils.toast("谢谢反馈");
                        }
                    });
        }
    }

    @Override
    public void onImageSelect() {
    }

    @Override
    public void onImageLoaded(Uri uri) {
        getView().dismissDialog();
        getView().addImage(ImageProvider.readImageWithSize(uri, 200, 200));
        mUris.add(uri);
    }

    @Override
    public void onError() {

    }

    @Override
    protected void onResult(int requestCode, int resultCode, Intent data) {
        mImageProvider.onActivityResult(requestCode, resultCode, data);
    }

    @Override
    public void onViewDelete(int index) {
        mUris.remove(index);
    }

    private String getImages(List<String> list) {
        StringBuilder builder = new StringBuilder();
        for (int i = 0; i < list.size(); i++) {
            String image = list.get(i);
            builder.append(image);
            if (i != list.size() - 1) builder.append("|");
        }
        return builder.toString();
    }

}
<file_sep>package com.miguan.otk.module.match;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.dsk.chain.bijection.RequiresPresenter;
import com.dsk.chain.expansion.data.BaseDataFragment;
import com.miguan.otk.R;
import com.miguan.otk.model.bean.Match;
import com.miguan.otk.module.news.NewsDetailPresenter;

import butterknife.Bind;
import butterknife.ButterKnife;

/**
 * Copyright (c) 2016/11/25. LiaoPeiKun Inc. All rights reserved.
 */
@RequiresPresenter(MatchRulesPresenter.class)
public class MatchRulesFragment extends BaseDataFragment<MatchRulesPresenter, Match> {

    @Bind(R.id.tv_rule_mode_final)
    TextView mTvFinal;

    @Bind(R.id.tv_rule_mode_semifinal)
    TextView mTvSemifinal;

    @Bind(R.id.tv_rule_mode_battle)
    TextView mTvBattle;

    @Bind(R.id.tv_rule_mode)
    TextView mTvMode;

    @Bind(R.id.tv_rule_content)
    TextView mTvContent;

    @Bind(R.id.tv_rule_general)
    TextView mTvGeneral;

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.match_fragment_rules, container, false);
        ButterKnife.bind(this, view);

        return view;
    }

    @Override
    public void setData(Match match) {
        mTvFinal.setText(match.getFinal_battle_mode());
        mTvSemifinal.setText(match.getSemifinal_battle_mode());
        mTvBattle.setText(match.getBattle_mode());
        mTvMode.setText(match.getPattern());
        mTvContent.setText(match.getRule());
        mTvGeneral.setOnClickListener(v -> NewsDetailPresenter.start(getActivity(), match.getArticle_id()));
    }
}<file_sep>package com.miguan.otk.adapter.viewholder;

import android.app.Activity;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;

import com.jude.easyrecyclerview.adapter.BaseViewHolder;
import com.miguan.otk.R;
import com.miguan.otk.model.MatchModel;
import com.miguan.otk.model.bean.Mission;
import com.miguan.otk.model.services.ServicesResponse;

import butterknife.Bind;
import butterknife.ButterKnife;

/**
 * Copyright (c) 2016/12/23. LiaoPeiKun Inc. All rights reserved.
 */

public class MissionViewHolder extends BaseViewHolder<Mission> {

    private static final int[] ICONS = new int[] {R.mipmap.ic_mission_enroll, R.mipmap.ic_mission_against, R.mipmap.ic_mission_winner};

    @Bind(R.id.iv_mission_image)
    ImageView mIvIcon;

    @Bind(R.id.tv_mission_name)
    TextView mTvName;

    @Bind(R.id.tv_mission_desc)
    TextView mTvDesc;

    @Bind(R.id.btn_mission_dole)
    Button mBtnDole;

    public MissionViewHolder(ViewGroup parent) {
        super(parent, R.layout.item_list_mission);
        ButterKnife.bind(this, itemView);
    }

    @Override
    public void setData(Mission data) {
        mIvIcon.setImageResource(ICONS[getLayoutPosition() % ICONS.length]);
        mTvName.setText(data.getTitle());
        mTvDesc.setText(data.getComment() + " +" + data.getScore() + "撒币");
        if (data.getStatus() == 0) {
            mBtnDole.setText("领取奖励");
            mBtnDole.setEnabled(true);
            mBtnDole.setOnClickListener(v -> {
                MatchModel.getInstance().doleMission(data.getMission_id()).unsafeSubscribe(new ServicesResponse<Mission>() {
                    @Override
                    public void onNext(Mission mission) {
                        mBtnDole.setEnabled(false);
                        mBtnDole.setText("已完成");
                    }
                });
            });
        } else if (data.getStatus() == 1) {
            mBtnDole.setText("已完成");
            mBtnDole.setEnabled(false);
        } else {
            mBtnDole.setText("去完成");
            mBtnDole.setEnabled(true);
            mBtnDole.setOnClickListener(v -> ((Activity) getContext()).finish());
        }
    }

}
<file_sep>package com.miguan.otk.module.settings;

import com.dsk.chain.bijection.Presenter;

/**
 * Copyright (c) 2016/12/21. LiaoPeiKun Inc. All rights reserved.
 */

public class AboutPresenter extends Presenter<AboutActivity> {

}
<file_sep>package com.miguan.otk.model.bean;

import android.os.Parcel;
import android.os.Parcelable;

/**
 * Copyright (c) 2017/2/14. LiaoPeiKun Inc. All rights reserved.
 */

public class Screenshot implements Parcelable {

    private String cpic1;

    private String cpic2;

    private String pic1;

    private String pic2;

    private String pic3;

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(this.cpic1);
        dest.writeString(this.cpic2);
        dest.writeString(this.pic1);
        dest.writeString(this.pic2);
        dest.writeString(this.pic3);
    }

    public Screenshot() {
    }

    protected Screenshot(Parcel in) {
        this.cpic1 = in.readString();
        this.cpic2 = in.readString();
        this.pic1 = in.readString();
        this.pic2 = in.readString();
        this.pic3 = in.readString();
    }

    public static final Creator<Screenshot> CREATOR = new Creator<Screenshot>() {
        @Override
        public Screenshot createFromParcel(Parcel source) {
            return new Screenshot(source);
        }

        @Override
        public Screenshot[] newArray(int size) {
            return new Screenshot[size];
        }
    };

    public String getCpic1() {
        return cpic1;
    }

    public void setCpic1(String cpic1) {
        this.cpic1 = cpic1;
    }

    public String getCpic2() {
        return cpic2;
    }

    public void setCpic2(String cpic2) {
        this.cpic2 = cpic2;
    }

    public String getPic1() {
        return pic1;
    }

    public void setPic1(String pic1) {
        this.pic1 = pic1;
    }

    public String getPic2() {
        return pic2;
    }

    public void setPic2(String pic2) {
        this.pic2 = pic2;
    }

    public String getPic3() {
        return pic3;
    }

    public void setPic3(String pic3) {
        this.pic3 = pic3;
    }
}
<file_sep>package com.miguan.otk.model.bean;

import android.os.Parcel;
import android.os.Parcelable;

/**
 * Copyright (c) 2017/1/11. LiaoPeiKun Inc. All rights reserved.
 */

public class Sign implements Parcelable {

    private String[] cause;

    private String score;

    private String money;

    private String currency;

    private int istoday;

    private int isqiandao;

    private int baoxiangscore;

    private String visits;

    private String description;

    public String[] getCause() {
        return cause;
    }

    public void setCause(String[] cause) {
        this.cause = cause;
    }

    public String getScore() {
        return score;
    }

    public void setScore(String score) {
        this.score = score;
    }

    public String getMoney() {
        return money;
    }

    public void setMoney(String money) {
        this.money = money;
    }

    public String getCurrency() {
        return currency;
    }

    public void setCurrency(String currency) {
        this.currency = currency;
    }

    public int getIstoday() {
        return istoday;
    }

    public void setIstoday(int istoday) {
        this.istoday = istoday;
    }

    public int getIsqiandao() {
        return isqiandao;
    }

    public void setIsqiandao(int isqiandao) {
        this.isqiandao = isqiandao;
    }

    public int getBaoxiangscore() {
        return baoxiangscore;
    }

    public void setBaoxiangscore(int baoxiangscore) {
        this.baoxiangscore = baoxiangscore;
    }

    public String getVisits() {
        return visits;
    }

    public void setVisits(String visits) {
        this.visits = visits;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeStringArray(this.cause);
        dest.writeString(this.score);
        dest.writeString(this.money);
        dest.writeString(this.currency);
        dest.writeInt(this.istoday);
        dest.writeInt(this.isqiandao);
        dest.writeInt(this.baoxiangscore);
        dest.writeString(this.visits);
        dest.writeString(this.description);
    }

    public Sign() {
    }

    protected Sign(Parcel in) {
        this.cause = in.createStringArray();
        this.score = in.readString();
        this.money = in.readString();
        this.currency = in.readString();
        this.istoday = in.readInt();
        this.isqiandao = in.readInt();
        this.baoxiangscore = in.readInt();
        this.visits = in.readString();
        this.description = in.readString();
    }

    public static final Creator<Sign> CREATOR = new Creator<Sign>() {
        @Override
        public Sign createFromParcel(Parcel source) {
            return new Sign(source);
        }

        @Override
        public Sign[] newArray(int size) {
            return new Sign[size];
        }
    };
}
<file_sep>package com.miguan.otk.module.settings;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AlertDialog;
import android.widget.Button;
import android.widget.FrameLayout;
import android.widget.TextView;

import com.dsk.chain.bijection.ChainBaseActivity;
import com.dsk.chain.bijection.RequiresPresenter;
import com.miguan.otk.R;

import butterknife.Bind;
import butterknife.ButterKnife;

@RequiresPresenter(SettingsPresenter.class)
public class SettingsActivity extends ChainBaseActivity<SettingsPresenter> {

    @Bind(R.id.ly_setting_clear)
    FrameLayout mLyClear;

    @Bind(R.id.tv_setting_clear_cache)
    TextView mTvCache;

    @Bind(R.id.tv_setting_about_us)
    TextView mTvAbout;

    @Bind(R.id.btn_setting_logout)
    Button mBtnLogout;

    @Bind(R.id.ly_setting_update)
    FrameLayout mLyUpdate;

    @Bind(R.id.tv_setting_version)
    TextView mTvVersion;

    @Bind(R.id.tv_setting_push)
    TextView mTvPush;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.settings_activity);
        setToolbarTitle(R.string.title_activity_settings);
        ButterKnife.bind(this);

        mLyClear.setOnClickListener(v -> showDialog());
        mTvAbout.setOnClickListener(v -> startActivity(new Intent(this, AboutActivity.class)));
        mLyUpdate.setOnClickListener(v -> getPresenter().checkUpdate());
        mBtnLogout.setOnClickListener(v -> getPresenter().logout());
        mTvPush.setOnClickListener(v -> startActivity(new Intent(this, SettingPushActivity.class)));
    }

    public void setData(String cache, String version) {
        mTvCache.setText(cache);
        mTvVersion.setText(String.format(getString(R.string.label_current_version), version));
    }

    private void showDialog() {
        AlertDialog.Builder builder = new AlertDialog.Builder(this);
        builder.setMessage(R.string.dialog_clear_cache)
                .setNegativeButton(R.string.btn_cancel, null)
                .setPositiveButton(R.string.btn_ok, (dialog, which) -> getPresenter().clearCache())
                .show();
    }

}
<file_sep>package com.miguan.otk.module.match;

import android.os.Bundle;

import com.dsk.chain.expansion.list.BaseListActivityPresenter;
import com.miguan.otk.R;
import com.miguan.otk.model.MatchModel;
import com.miguan.otk.model.bean.User;

/**
 * Copyright (c) 2016/12/22. LiaoPeiKun Inc. All rights reserved.
 */

public class CompetitorListPresenter extends BaseListActivityPresenter<CompetitorListActivity, User> {

    private int mCompetitionID;

    private int mType;

    @Override
    protected void onCreate(CompetitorListActivity view, Bundle saveState) {
        super.onCreate(view, saveState);
        mCompetitionID = getView().getIntent().getIntExtra("match_id", 0);
        mType = getView().getIntent().getIntExtra("type", 1);
    }

    @Override
    protected void onCreateView(CompetitorListActivity view) {
        super.onCreateView(view);
        if (mType == 1) getView().setToolbarTitle(R.string.title_activity_enroll);
        else getView().setToolbarTitle(R.string.title_activity_bench);
        onRefresh();
    }

    @Override
    public void onRefresh() {
        MatchModel.getInstance().getCompetitors(mCompetitionID, mType).unsafeSubscribe(getRefreshSubscriber());
    }

}
<file_sep>package com.miguan.otk.module.user;

import android.os.Bundle;
import android.support.design.widget.TabLayout;
import android.support.v4.app.Fragment;
import android.support.v4.view.ViewPager;

import com.dsk.chain.bijection.ChainBaseActivity;
import com.dsk.chain.bijection.RequiresPresenter;
import com.miguan.otk.R;
import com.miguan.otk.adapter.TitlePagerAdapter;
import com.miguan.otk.module.store.OrderListFragment;

import java.util.ArrayList;
import java.util.List;

import butterknife.Bind;
import butterknife.ButterKnife;

@RequiresPresenter(MyOrderPresenter.class)
public class MyOrderActivity extends ChainBaseActivity<MyOrderPresenter> {

    @Bind(R.id.tab_my_order)
    TabLayout mTabLayout;

    @Bind(R.id.pager_my_order)
    ViewPager mPager;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.user_activity_my_order);
        setToolbarTitle(R.string.title_activity_my_order);
        ButterKnife.bind(this);

        mPager.setAdapter(new TitlePagerAdapter(this, R.array.tab_my_order, getList(), getSupportFragmentManager()));
        mTabLayout.setupWithViewPager(mPager);
    }

    private List<Fragment> getList() {
        List<Fragment> list = new ArrayList<>();
        for (int i=0; i<2; i++) {
            OrderListFragment fragment = new OrderListFragment();
            list.add(fragment);
        }
        return list;
    }

}
<file_sep>package com.miguan.otk.model.bean;

import android.os.Parcel;
import android.os.Parcelable;

/**
 * Copyright (c) 2017/1/23. LiaoPeiKun Inc. All rights reserved.
 */

public class Hero implements Parcelable {

    private String name;

    private int index;

    private boolean isCheck;

    private boolean isBan;

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(this.name);
        dest.writeInt(this.index);
        dest.writeByte(this.isCheck ? (byte) 1 : (byte) 0);
        dest.writeByte(this.isBan ? (byte) 1 : (byte) 0);
    }

    public Hero() {
    }

    protected Hero(Parcel in) {
        this.name = in.readString();
        this.index = in.readInt();
        this.isCheck = in.readByte() != 0;
        this.isBan = in.readByte() != 0;
    }

    public static final Creator<Hero> CREATOR = new Creator<Hero>() {
        @Override
        public Hero createFromParcel(Parcel source) {
            return new Hero(source);
        }

        @Override
        public Hero[] newArray(int size) {
            return new Hero[size];
        }
    };

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getIndex() {
        return index;
    }

    public void setIndex(int index) {
        this.index = index;
    }

    public boolean isCheck() {
        return isCheck;
    }

    public void setCheck(boolean check) {
        isCheck = check;
    }

    public boolean isBan() {
        return isBan;
    }

    public void setBan(boolean ban) {
        isBan = ban;
    }
}
<file_sep>package com.miguan.otk.adapter.viewholder;

import android.net.Uri;
import android.view.ViewGroup;
import android.widget.TextView;

import com.facebook.drawee.view.SimpleDraweeView;
import com.jude.easyrecyclerview.adapter.BaseViewHolder;
import com.miguan.otk.R;
import com.miguan.otk.model.bean.Comment;
import com.miguan.otk.utils.LUtils;

import butterknife.Bind;
import butterknife.ButterKnife;

/**
 * Copyright (c) 2016/11/25. LiaoPeiKun Inc. All rights reserved.
 */

public class CommentViewHolder extends BaseViewHolder<Comment> {

    @Bind(R.id.dv_comment_avatar)
    SimpleDraweeView mDvAvatar;

    @Bind(R.id.tv_comment_name)
    TextView mTvName;

    @Bind(R.id.tv_comment_content)
    TextView mTvContent;

    @Bind(R.id.tv_comment_date)
    TextView mTvDate;

    @Bind(R.id.tv_comment_like)
    TextView mTvLike;

    public CommentViewHolder(ViewGroup parent) {
        super(parent, R.layout.item_list_comment);
        ButterKnife.bind(this, itemView);
    }

    @Override
    public void setData(Comment comment) {
        mDvAvatar.setImageURI(Uri.parse(comment.getAvatar()));
        mTvName.setText(comment.getUsername());
        mTvContent.setText(comment.getContent());
        mTvDate.setText(comment.getDate());
        mTvLike.setText(comment.getLike_num());
        mTvLike.setOnClickListener(v -> LUtils.toast("点赞"));
    }
}
<file_sep>package com.miguan.otk.module.user;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;

import com.dsk.chain.expansion.list.BaseListActivityPresenter;
import com.miguan.otk.model.AddressModel;
import com.miguan.otk.model.bean.Area;

import org.greenrobot.eventbus.EventBus;

import java.util.List;

import rx.Observable;

/**
 * Copyright (c) 2017/1/19. LiaoPeiKun Inc. All rights reserved.
 */

public class AreaPresenter extends BaseListActivityPresenter<AreaActivity, Area> {

    private StringBuilder mName = new StringBuilder();

    @Override
    protected void onCreate(AreaActivity view, Bundle saveState) {
        super.onCreate(view, saveState);
    }

    @Override
    protected void onCreateView(AreaActivity view) {
        super.onCreateView(view);
        onRefresh();
        getAdapter().setOnItemClickListener(position -> {
            Area data = getAdapter().getItem(position);
            mName.append(data.getName() + " ");
            Intent intent = new Intent(getView(), AreaActivity.class);
            if (data.getCity() != null) {
                intent.putExtra("area_list", data.getCity());
                getView().setIntent(intent);
                onRefresh();
            } else if (data.getArea() != null) {
                intent.putExtra("area_list", data.getArea());
                getView().setIntent(intent);
                onRefresh();
            } else {
                getView().setResult(Activity.RESULT_OK, intent);
                EventBus.getDefault().post(mName);
                getView().finish();
            }
        });
    }

    @Override
    public void onRefresh() {
        List<Area> areaList = getView().getIntent().getParcelableArrayListExtra("area_list");
        if (areaList != null) {
            Observable.just(areaList).unsafeSubscribe(getRefreshSubscriber());
        } else {
            AddressModel.getInstance().getAreaList().unsafeSubscribe(getRefreshSubscriber());
        }
    }

}
<file_sep>package com.miguan.otk.module.main;

import com.dsk.chain.expansion.data.BaseDataFragmentPresenter;
import com.miguan.otk.model.bean.League;

/**
 * Created by LPK on 2016/11/22.
 */

public class MainLeaguePresenter extends BaseDataFragmentPresenter<MainLeagueFragment, League> {



}
<file_sep>package com.miguan.otk.module.user;

import android.graphics.Color;
import android.os.Bundle;
import android.support.v7.app.AlertDialog;
import android.text.SpannableString;
import android.text.Spanned;
import android.text.style.ForegroundColorSpan;
import android.view.View;
import android.view.ViewGroup;
import android.webkit.WebView;
import android.widget.Button;
import android.widget.TextView;

import com.dsk.chain.bijection.RequiresPresenter;
import com.dsk.chain.expansion.data.BaseDataActivity;
import com.miguan.otk.R;
import com.miguan.otk.model.bean.Sign;
import com.miguan.otk.widget.SignedDateDecorator;
import com.prolificinteractive.materialcalendarview.MaterialCalendarView;

import java.util.Calendar;

import butterknife.Bind;
import butterknife.ButterKnife;

@RequiresPresenter(SignPresenter.class)
public class SignActivity extends BaseDataActivity<SignPresenter, Sign> {

    @Bind(R.id.tv_sign_series_desc)
    TextView mTvSeriesDesc;

    @Bind(R.id.calendarView)
    MaterialCalendarView mCalendarView;

    @Bind(R.id.btn_sign_now)
    Button mBtnSign;

    @Bind(R.id.wv_sign_rules)
    WebView mWvRules;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.user_activity_sign_in);
        setToolbarTitle(R.string.title_activity_sign_in);
        ButterKnife.bind(this);

        showSuccessDialog(null);

        Calendar cal = Calendar.getInstance(); //获取当前日期
        cal.add(Calendar.MONTH, -1);
        cal.set(Calendar.DAY_OF_MONTH,1);
        mCalendarView.setOnMonthChangedListener(getPresenter());
        mCalendarView.state().edit()
                .setMinimumDate(cal)
                .setMaximumDate(Calendar.getInstance())
                .commit();
    }

    @Override
    public void setData(Sign sign) {
        if (sign.getIsqiandao() == 1) {
            mBtnSign.setEnabled(false);
            mBtnSign.setText("已签到");
        } else {
            mBtnSign.setOnClickListener(v -> getPresenter().sign());
        }
        SpannableString span = new SpannableString(String.format(getString(R.string.text_sign_series_desc), 7 - sign.getIstoday()));
        span.setSpan(new ForegroundColorSpan(Color.parseColor("#fab02e")), 13, 14, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
        mTvSeriesDesc.setText(span);
        mWvRules.loadData(sign.getDescription(), "text/html; charset=utf-8", null);
        setCalendar(sign);
    }

    public void setCalendar(Sign sign) {
        if (sign.getCause() != null && sign.getCause().length > 0) {
            mCalendarView.addDecorator(new SignedDateDecorator(this, sign.getCause()));
        }
    }

    public void setBtnDisable() {
        mBtnSign.setEnabled(false);
        mBtnSign.setText("已签到");
    }

    public void showSuccessDialog(Sign sign) {
//        String result = sign.getBaoxiangscore() != 0 ?
//                String.format(getString(R.string.text_sign_series_bonus), sign.getBaoxiangscore()) : "";

        View view = getLayoutInflater().inflate(R.layout.dialog_sign_success,
                (ViewGroup) getWindow().getDecorView(), false);

        new AlertDialog.Builder(this)
                .setView(view)
                .create()
                .show();

    }

}
<file_sep>package com.miguan.otk.wxapi;

import com.umeng.socialize.UMShareListener;
import com.umeng.socialize.bean.SHARE_MEDIA;

/**
 * Copyright (c) 2017/3/2. LiaoPeiKun Inc. All rights reserved.
 */

public class ShareCallback implements UMShareListener {

    @Override
    public void onStart(SHARE_MEDIA share_media) {

    }

    @Override
    public void onResult(SHARE_MEDIA share_media) {

    }

    @Override
    public void onError(SHARE_MEDIA share_media, Throwable throwable) {

    }

    @Override
    public void onCancel(SHARE_MEDIA share_media) {

    }
}
<file_sep>package com.miguan.otk.model.services;

import com.miguan.otk.model.bean.Balance;
import com.miguan.otk.model.bean.Chatroom;
import com.miguan.otk.model.bean.Feedback;
import com.miguan.otk.model.bean.Game;
import com.miguan.otk.model.bean.Home;
import com.miguan.otk.model.bean.Match;
import com.miguan.otk.model.bean.Message;
import com.miguan.otk.model.bean.Mission;
import com.miguan.otk.model.bean.News;
import com.miguan.otk.model.bean.Battle;
import com.miguan.otk.model.bean.Schedule;
import com.miguan.otk.model.bean.Screenshot;
import com.miguan.otk.model.bean.Sign;
import com.miguan.otk.model.bean.Splash;
import com.miguan.otk.model.bean.User;
import com.miguan.otk.model.bean.Version;
import com.miguan.otk.model.bean.Withdraw;

import java.util.List;
import java.util.Map;

import retrofit2.http.Field;
import retrofit2.http.FieldMap;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.GET;
import retrofit2.http.POST;
import retrofit2.http.Path;
import retrofit2.http.Query;
import rx.Observable;

/**
 * Copyright (c) 2015. LiaoPeiKun Inc. All rights reserved.
 */

public interface Services {

    String BASE_URL = "http://api.beta.otkpk.com/v1/";

    //////////////////用户相关/////////////////////
    /**
     * 用户登录
     * @param username 用户名
     * @param password 密码
     * @return 是否成功
     */
    @FormUrlEncoded
    @POST("user/user/login")
    Observable<User> login(
            @Field("username") CharSequence username,
            @Field("password") CharSequence password
    );

    /**
     * 用户注册
     *
     * @param username 用户名
     * @param password 密码
     * @param mobile 手机
     * @param captcha 验证码
     * @return 结果
     */
    @FormUrlEncoded
    @POST("user/user/sign-up")
    Observable<User> register(
            @Field("username") CharSequence username,
            @Field("mobile") CharSequence mobile,
            @Field("captcha") CharSequence captcha,
            @Field("password") CharSequence password
    );

    /**
     * 发送注册验证码
     * @param mobile 手机号
     * @return 是否成功
     */
    @FormUrlEncoded
    @POST("user/user/captcha-register")
    Observable<Boolean> sendCaptchaRegister(
            @Field("mobile") CharSequence mobile
    );

    /**
     * 发送重置密码验证码
     * @param mobile 手机号
     * @return 是否成功
     */
    @FormUrlEncoded
    @POST("user/user/captcha-reset")
    Observable<Boolean> sendCaptchaReset(
            @Field("mobile") CharSequence mobile
    );

    /**
     * 其他验证码
     * @param mobile 手机号
     * @return 是否成功
     */
    @FormUrlEncoded
    @POST("user/user/captcha-update")
    Observable<Boolean> sendCaptchaUpdate(
            @Field("mobile") CharSequence mobile,
            @Field("token") CharSequence token
    );

    /**
     * 忘记密码
     *
     * @param newPwd 新密码
     * @param mobile 手机
     * @param captcha 验证码
     * @return
     */
    @FormUrlEncoded
    @POST("user/user/reset-password")
    Observable<Boolean> modifyPwd(
            @Field("mobile") CharSequence mobile,
            @Field("captcha") CharSequence captcha,
            @Field("password") CharSequence newPwd
    );

    /**
     * 个人中心
     *
     * @param token 登录令牌
     * @return
     */
    @FormUrlEncoded
    @POST("user/center/index")
    Observable<User> userInfo(
            @Field("token") CharSequence token
    );

    /**
     * 个人资料
     *
     * @param token 登录令牌
     * @return
     */
    @FormUrlEncoded
    @POST("user/message/index")
    Observable<User> userProfile(
            @Field("token") CharSequence token
    );

    /**
     * 个人资料修改
     * token
     * photo
     * qq
     * email
     * actuality
     * birthday
     * province
     * city
     * sign
     * @return
     */
    @FormUrlEncoded
    @POST("user/message/edit")
    Observable<Boolean> modifyProfile(
            @FieldMap Map<String, String> request
    );

    /**
     * 立即签到
     *
     * @param token 登录令牌
     * @return
     */
    @FormUrlEncoded
    @POST("user/sign/index")
    Observable<Sign> sign(
            @Field("token") CharSequence token
    );

    /**
     * 签到信息
     *
     * @param token 登录令牌
     * @return
     */
    @FormUrlEncoded
    @POST("user/sign/signdata")
    Observable<Sign> signDetail(
            @Field("token") CharSequence token,
            @Field("month") String month,
            @Field("year") Integer year
    );

    /**
     * 参赛记录
     *
     * @param token 登录令牌
     * @return
     */
    @GET("user/banner/index")
    Observable<List<Match>> myMatchList(
            @Query("token") CharSequence token,
            @Query("page") Integer page
    );

    /**
     * 对战记录
     *
     * @param token 登录令牌
     * @return
     */
    @GET("user/banner/record")
    Observable<List<Battle>> againstList(
            @Query("token") CharSequence token,
            @Query("page") Integer page
    );

    /**
     * 余额明细
     * @param type 余额类型 money-元宝 score-撒币
     * @param token 登录令牌
     * @param page 页数
     * @return
     */
    @GET("user/balance/{type}")
    Observable<List<Balance>> balanceList(
            @Path("type") String type,
            @Query("token") CharSequence token,
            @Query("page") Integer page
    );

    /**
     * 提现记录首页
     * @param token 登录令牌
     * @return
     */
    @GET("user/record/getcashrecord")
    Observable<Withdraw> withdrawRecord(
            @Query("token") CharSequence token
    );

    /**
     * 提现记录列表
     * @param token 登录令牌
     * @param page 页数
     * @return
     */
    @GET("user/record/getcashrecord2")
    Observable<List<Withdraw>> withdrawRecord(
            @Query("token") CharSequence token,
            @Query("page") Integer page
    );

    /**
     * 提现记录列表
     * @param token 登录令牌
     * @param money 提现金额
     * @return
     */
    @GET("user/record/deposit")
    Observable<Boolean> withdraw(
            @Query("token") CharSequence token,
            @Query("money") Integer money
    );

    /**
     * 绑定支付宝
     */
    @FormUrlEncoded
    @POST("user/record/alipaybind")
    Observable<Boolean> bindAlipay(
            @Field("token") String token,
            @Field("mobile") String mobile,
            @Field("alipay_account") String account,
            @Field("captcha") String captcha
    );

    /**
     * 游戏账号列表
     * @param token 登录令牌
     * @return
     */
    @FormUrlEncoded
    @POST("user/gameaccount/gameinfo")
    Observable<List<Game>> gameAccounts(
            @Field("token") String token
    );

    /**
     * 添加游戏账号
     */
    @FormUrlEncoded
    @POST("user/gameaccount/accountadd")
    Observable<Boolean> addGameAccount(
            @Field("token") String token,
            @Field("game_name") String game_name,
            @Field("game_account") String game_account
    );

    /**
     * 编辑游戏账号
     */
    @FormUrlEncoded
    @POST("user/gameaccount/accountupdate")
    Observable<Boolean> updateGameAccount(
            @Field("token") String token,
            @Field("id") int id,
            @Field("game_account") String game_account
    );

    /**
     * 消息分类最新一条
     */
    @FormUrlEncoded
    @POST("user/systemmessage/message")
    Observable<List<Message>> getMessageDesc(
            @Field("token") String token
    );

    /**
     * 消息列表
     */
    @FormUrlEncoded
    @POST("user/systemmessage/system-message")
    Observable<List<Message>> getMessageList(
            @Field("token") String token,
            @Field("type") Integer type,
            @Field("page") Integer page
    );

    /**
     * 吐槽一下
     * @param token 登录令牌
     * @param type  类型（0:产品建议、1:发现BUG、2:举报作弊、3:其他）
     * @param contact 联系方式
     * @param content 吐槽内容
     * @param img 上传照片
     * @param source 信息来源（来源 0:安卓 1：IOS）
     * @return
     */
    @FormUrlEncoded
    @POST("user/feedback/feedback")
    Observable<Feedback> feedback(
            @Field("token") String token,
            @Field("type") Integer type,
            @Field("contact") String contact,
            @Field("content") String content,
            @Field("img") String img,
            @Field("source") int source
    );

    ////////////////////比赛相关//////////////////////

    /**
     * 比赛首页
     *
     * @param token 登录令牌 可选
     * @return
     */
    @GET("home/home/index")
    Observable<Home> homeMatch(
            @Query("token") String token
    );

    /**
     * 赛事详情
     *
     * @param matchID 赛事ID
     * @param token 登录令牌
     * @return
     */
    @FormUrlEncoded
    @POST("competition/competition/index")
    Observable<Match> matchDetail(
            @Field("token") String token,
            @Field("competition_id") int matchID
    );

    /**
     * 赛事参与用户列表
     *
     * @param matchID 赛事ID
     * @param type 参赛人员类型(1：正常，2：替补)
     * @return
     */

    @GET("competition/competition/competitors")
    Observable<List<User>> competitors(
            @Query("competition_id") int matchID,
            @Query("type") int type
    );

    /**
     * 赛事规则
     *
     * @param matchID 赛事ID
     * @return
     */

    @GET("competition/competition/rule")
    Observable<Match> competitionRule(
            @Query("competition_id") int matchID
    );

    /**
     * 对战表
     *
     * @param matchID 赛事ID
     * @param round 比赛第几轮（从0开始）
     * @return
     */
    @FormUrlEncoded
    @POST("competition/competition/table")
    Observable<Schedule> competitionSchedule(
            @Field("competition_id") int matchID,
            @Field("round") int round
    );

    /**
     * 赛事报名
     *
     * @param matchID 赛事ID
     * @param password 密码(选填)
     * @param code 邀请码(选填)
     * @return
     */
    @FormUrlEncoded
    @POST("competition/competition/join")
    Observable<Battle> competitionEnter(
            @Field("token") String token,
            @Field("competition_id") int matchID,
            @Field("password") String password,
            @Field("invitation_code") String code
    );

    /**
     * 对战页面
     *
     * @param battleID 赛事ID
     * @return
     */
    @FormUrlEncoded
    @POST("competition/battle/index")
    Observable<Battle> battleDetail(
            @Field("token") String token,
            @Field("battle_id") int battleID
    );

    /**
     * 对战准备
     *
     * @param matchID 赛事ID
     * @return
     */
    @FormUrlEncoded
    @POST("competition/battle/ready")
    Observable<Battle> ready(
            @Field("token") String token,
            @Field("battle_id") int matchID
    );

    /**
     * 对战pick
     *
     * @param battle_id 对战ID
     * @return
     */
    @FormUrlEncoded
    @POST("competition/battle/pick")
    Observable<Battle> pick(
            @Field("token") String token,
            @Field("battle_id") int battle_id,
            @FieldMap() Map<String, Integer> carPics
    );

    /**
     * 对战ban
     *
     * @param battleID 赛事ID
     * @return
     */
    @FormUrlEncoded
    @POST("competition/battle/ban")
    Observable<Battle> ban(
            @Field("token") String token,
            @Field("battle_id") int battleID,
            @Field("ban") Integer ban
    );

    /**
     * 对战提交结果
     *
     * @param battleID 赛事ID
     * @return
     */
    @FormUrlEncoded
    @POST("competition/battle/record")
    Observable<Battle> submitResult(
            @Field("token") String token,
            @Field("battle_id") Integer battleID,
            @Field("role") Integer role
    );

    /**
     * 重置对战结果
     *
     * @param battleID 赛事ID
     * @return
     */
    @FormUrlEncoded
    @POST("competition/battle/unrecord")
    Observable<Battle> resubmitResult(
            @Field("token") String token,
            @Field("battle_id") Integer battleID
    );

    /**
     * 赛事签到
     *
     * @param matchID 赛事ID
     * @return
     */
    @FormUrlEncoded
    @POST("competition/competition/joinsign")
    Observable<Boolean> competitionSign(
            @Field("token") String token,
            @Field("competition_id") int matchID
    );

    /**
     * 获取对战信息
     *
     * @param competitionID 赛事ID
     * @return
     */
    @FormUrlEncoded
    @POST("competition/competition/battle")
    Observable<Battle> battleID(
            @Field("token") String token,
            @Field("competition_id") int competitionID
    );

    /**
     * 对战截图列表
     *
     * @param battleID 对战ID
     * @return
     */
    @FormUrlEncoded
    @POST("competition/battle/uploadinfo")
    Observable<Screenshot> battleUploadInfo(
            @Field("token") String token,
            @Field("battle_id") int battleID,
            @Field("role") String role
    );

    /**
     * 对战提交截图
     *
     * @param battleID 对战ID
     * @return
     */
    @FormUrlEncoded
    @POST("competition/battle/upload")
    Observable<Battle> battleUpload(
            @Field("token") String token,
            @Field("battle_id") int battleID,
            @Field("kind") String kind,
            @Field("photo") String photo
    );

    /**
     * 获取聊天室ID
     *
     * @param room_type 房间类型（c:比赛房间，b:对战房间）
     * @param id 对战ID或者比赛ID
     * @return
     */
    @FormUrlEncoded
    @POST("competition/chat/room")
    Observable<Chatroom> chatRoomID(
            @Field("token") String token,
            @Field("room_type") String room_type,
            @Field("id") int id
    );

    ////////////////////其他//////////////////////
    /**
     * 资讯列表
     *
     * @param type 文章类型 '1'=>'新闻','2'=>'行业','3'=>'攻略','4'=>'评测','5'=>'活动',
     * @param page 当前页数
     * @return
     */
    @GET("article/article/article-list")
    Observable<List<News>> newsList(
            @Query("type") int type,
            @Query("page") int page
    );

    /**
     * 广告图
     *
     * @param type 广告图位置 read-splash-闪屏； read-opening-首页弹窗
     * @param mobile 手机系统类型(1:android, 2:ios)
     * @return
     */
    @GET("system/system/{type}")
    Observable<Splash> splash(
            @Path("type") String type,
            @Query("mobile") Integer mobile
    );

    /**
     * 每日任务
     *
     * @param token 登录
     * @return
     */
    @FormUrlEncoded
    @POST("user/task/task")
    Observable<List<Mission>> missionList(
            @Field("token") String token
    );

    /**
     * 每日任务领取奖励
     *
     * @param token 登录
     * @return
     */
    @FormUrlEncoded
    @POST("user/task/taskscore")
    Observable<Mission> missionDole(
            @Field("token") String token,
            @Field("id") int missionID
    );

    /**
     * 检测更新
     *
     * @param version 当前版本号
     * @return
     */
    @GET("system/system/version-upgrade")
    Observable<Version> checkUpdate(
            @Query("version") String version
    );

}
<file_sep>KEYSTORE_FILE = keystore
KEYSTORE_PASSWORD = <PASSWORD>
KEY_ALIAS = otk
KEY_PASSWORD = <PASSWORD><file_sep>package com.miguan.otk.module.account;

import android.os.Bundle;

import com.dsk.chain.bijection.ChainBaseActivity;
import com.dsk.chain.bijection.RequiresPresenter;
import com.miguan.otk.R;

import butterknife.ButterKnife;

@RequiresPresenter(ModifyPwdPresenter.class)
public class ModifyPwdActivity extends ChainBaseActivity<ModifyPwdPresenter> {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.user_activity_modify_pwd);
        setToolbarTitle(R.string.title_activity_modify_pwd);
        ButterKnife.bind(this);
    }
}
<file_sep>package com.miguan.otk.adapter.viewholder;

import android.view.ViewGroup;
import android.widget.TextView;

import com.jude.easyrecyclerview.adapter.BaseViewHolder;
import com.miguan.otk.R;
import com.miguan.otk.model.bean.Message;

import butterknife.Bind;
import butterknife.ButterKnife;

/**
 * Copyright (c) 2016/12/26. LiaoPeiKun Inc. All rights reserved.
 */

public class MessageViewHolder extends BaseViewHolder<Message> {

    @Bind(R.id.tv_message_date)
    TextView mTvDate;

    @Bind(R.id.tv_message_content)
    TextView mTvContent;

    public MessageViewHolder(ViewGroup parent) {
        super(parent, R.layout.item_list_message);
        ButterKnife.bind(this, itemView);
    }

    @Override
    public void setData(Message data) {
        mTvDate.setText(data.getCreate_time());
        mTvContent.setText(data.getContent());
    }
}
<file_sep>package com.miguan.otk.module.league;

import com.dsk.chain.bijection.Presenter;

/**
 * Copyright (c) 2016/11/28. LiaoPeiKun Inc. All rights reserved.
 */

public class AddLeaguePresenter extends Presenter {
}
<file_sep>package com.miguan.otk.module.news;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.dsk.chain.bijection.RequiresPresenter;
import com.dsk.chain.expansion.list.BaseListFragment;
import com.dsk.chain.expansion.list.ListConfig;
import com.jude.easyrecyclerview.adapter.BaseViewHolder;
import com.jude.easyrecyclerview.decoration.SpaceDecoration;
import com.miguan.otk.model.bean.News;
import com.miguan.otk.utils.LUtils;


/**
 * Copyright (c) 2015. LiaoPeiKun Inc. All rights reserved.
 */
@RequiresPresenter(NewsListPresenter.class)
public class NewsListFragment extends BaseListFragment<NewsListPresenter, News> {

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        View view = super.onCreateView(inflater, container, savedInstanceState);
        getListView().setRecyclerPadding(0, LUtils.dp2px(5), 0, 0);
        getListView().setClipToPadding(false);
        getListView().setClipChildren(false);
        return view;
    }

    @Override
    public BaseViewHolder<News> createViewHolder(ViewGroup parent, int viewType) {
        return viewType == 1 ? new NewsViewHolder(parent) : new NewsMultiViewHolder(parent);
    }

    @Override
    public int getViewType(int position) {
        News news = getPresenter().getAdapter().getItem(position);
        return news.getImg().length == 1 ? 1 : 0;
    }

    @Override
    public ListConfig getListConfig() {
        SpaceDecoration itemDecoration = new SpaceDecoration(LUtils.dp2px(1));
        itemDecoration.setPaddingStart(true);
        return super.getListConfig().setItemDecoration(itemDecoration);
    }
}
<file_sep>package com.miguan.otk.module.match;

import com.dsk.chain.expansion.list.BaseListActivityPresenter;
import com.miguan.otk.model.MatchModel;
import com.miguan.otk.model.bean.Mission;

/**
 * Copyright (c) 2016/12/23. LiaoPeiKun Inc. All rights reserved.
 */

public class MissionListPresenter extends BaseListActivityPresenter<MissionListActivity, Mission> {

    @Override
    protected void onCreateView(MissionListActivity view) {
        super.onCreateView(view);
        onRefresh();
    }

    @Override
    public void onRefresh() {
        MatchModel.getInstance().getMissionList().unsafeSubscribe(getRefreshSubscriber());
    }

}
<file_sep>package com.miguan.otk.module.user;

import android.app.Activity;
import android.os.Bundle;

import com.dsk.chain.bijection.Presenter;
import com.miguan.otk.model.UserModel;
import com.miguan.otk.model.bean.User;
import com.miguan.otk.model.services.ServicesResponse;


/**
 * Copyright (c) 2017/1/10. LiaoPeiKun Inc. All rights reserved.
 */

public class ProfileModifyPresenter extends Presenter<ProfileModifyActivity> {

    private User mUser;

    @Override
    protected void onCreate(ProfileModifyActivity view, Bundle saveState) {
        super.onCreate(view, saveState);
        mUser = getView().getIntent().getParcelableExtra("user");
    }

    public void submit(String key, String value) {
        UserModel.getInstance().setProfile(key, value)
                .unsafeSubscribe(new ServicesResponse<Boolean>() {
                    @Override
                    public void onNext(Boolean aBoolean) {
                        if (aBoolean) {
                            getView().setResult(Activity.RESULT_OK);
                            getView().finish();
                        }
                    }
                });
    }

}
<file_sep>package com.miguan.otk.module.battle;

import android.os.Bundle;

import com.dsk.chain.expansion.data.BaseDataActivityPresenter;
import com.miguan.otk.model.bean.Battle;

/**
 * Copyright (c) 2017/1/3. LiaoPeiKun Inc. All rights reserved.
 */

public class ShotDetailPresenter extends BaseDataActivityPresenter<ShotDetailActivity, Battle> {

    private Battle mBattle;

    @Override
    protected void onCreate(ShotDetailActivity view, Bundle saveState) {
        super.onCreate(view, saveState);
        mBattle = getView().getIntent().getParcelableExtra("battle");
    }

    @Override
    protected void onCreateView(ShotDetailActivity view) {
        super.onCreateView(view);
        publishObject(mBattle);
    }
}
<file_sep>package com.miguan.otk.module.battle;

import android.graphics.Color;
import android.view.ViewGroup;

import com.dsk.chain.bijection.RequiresPresenter;
import com.dsk.chain.expansion.list.BaseListFragment;
import com.dsk.chain.expansion.list.ListConfig;
import com.jude.easyrecyclerview.adapter.BaseViewHolder;
import com.jude.easyrecyclerview.decoration.DividerDecoration;
import com.miguan.otk.adapter.viewholder.BattleRecordViewHolder;
import com.miguan.otk.model.bean.Battle;
import com.miguan.otk.utils.LUtils;


/**
 * Copyright (c) 2016/12/20. LiaoPeiKun Inc. All rights reserved.
 */
@RequiresPresenter(BattleRecordPresenter.class)
public class BattleRecordFragment extends BaseListFragment<BattleRecordPresenter, Battle> {

    @Override
    public BaseViewHolder<Battle> createViewHolder(ViewGroup parent, int viewType) {
        return new BattleRecordViewHolder(parent);
    }

    @Override
    public ListConfig getListConfig() {
        DividerDecoration decoration = new DividerDecoration(Color.TRANSPARENT, LUtils.dp2px(8));
        return super.getListConfig().setItemDecoration(decoration);
    }
}
<file_sep>package com.miguan.otk.base;

import android.app.Application;

import com.dsk.chain.Chain;
import com.dsk.chain.model.ModelManager;
import com.facebook.drawee.backends.pipeline.Fresco;
import com.miguan.otk.utils.LUtils;
import com.umeng.message.IUmengRegisterCallback;
import com.umeng.message.PushAgent;
import com.umeng.socialize.Config;
import com.umeng.socialize.PlatformConfig;
import com.umeng.socialize.UMShareAPI;

/**
 * Created by LPK on 2016/11/21.
 */

public class App extends Application {

    @Override
    public void onCreate() {
        super.onCreate();
        LUtils.initialize(this);
        Fresco.initialize(this);
        ModelManager.init(this);
        Chain.setLifeCycleDelegateProvide(ActivityDelegate::new);
        initShare();

        PushAgent pushAgent = PushAgent.getInstance(this);
        pushAgent.register(new IUmengRegisterCallback() {

            @Override
            public void onSuccess(String deviceToken) {
//                注册成功会返回device token
                LUtils.log("token: " + deviceToken);
            }

            @Override
            public void onFailure(String s, String s1) {
                LUtils.log("failure: " + s + ", " + s1);
            }
        });

    }

    public void initShare() {
        UMShareAPI.get(this);
        Config.DEBUG = true;
        PlatformConfig.setSinaWeibo("3724165953", "6c218cd5b1938037096aa8886409ba6a", "http://sns.whalecloud.com/sina2/callback");
        PlatformConfig.setWeixin("wxfe7723ef510fe37f", "d13d6bdc14d5fe5ac6ffd2a9927a3adf");
        PlatformConfig.setQQZone("1105939765", "EYDkf1MlqGDw0RPn");
    }

}
<file_sep>package com.miguan.otk.model.local;


import com.miguan.otk.utils.LUtils;

/**
 * Copyright (c) 2017/2/23. LiaoPeiKun Inc. All rights reserved.
 */

public class UserPreferences {

    private static final String KEY_USER_ID = "user_id";

    private static final String KEY_TOKEN ="token";

    private static final String KEY_USER_NIM_TOKEN = "auth_key";

    public static String getUserID() {
        return getString(KEY_USER_ID);
    }

    public static String getToken() {
        return getString(KEY_TOKEN);
    }

    public static String getNIMToken() {
        return getString(KEY_USER_NIM_TOKEN);
    }

    public static void setUserID(String value) {
        setString(KEY_USER_ID, value);
    }

    public static void setToken(String value) {
        setString(KEY_TOKEN, value);
    }

    public static void setNIMToken(String value) {
        setString(KEY_USER_NIM_TOKEN, value);
    }

    private static String getString(String key) {
        return LUtils.getPreferences().getString(key, "").trim();
    }

    private static void setString(String key, String value) {
        LUtils.getPreferences().edit().putString(key, value).apply();
    }

}
<file_sep>package com.miguan.otk.module.account;

import com.dsk.chain.bijection.Presenter;
import com.miguan.otk.model.UserModel;
import com.miguan.otk.model.services.ServicesResponse;
import com.miguan.otk.utils.LUtils;


/**
 * Copyright (c) 2015. LiaoPeiKun Inc. All rights reserved.
 */
public class ForgotPresenter extends Presenter<ForgotActivity> {


    public void sendCaptcha(String mobile) {
        UserModel.getInstance().forgotCaptcha(mobile).subscribe(new ServicesResponse<Boolean>());
    }

    public void changePwd(String mobile, String captcha, String newPwd) {
        UserModel.getInstance().modifyPwd(mobile, captcha, newPwd).subscribe(new ServicesResponse<Boolean>() {
            @Override
            public void onNext(Boolean aBoolean) {
                LUtils.getPreferences().edit().putString("token", "").apply();
                getView().finish();
            }
        });
    }

}
<file_sep>package com.miguan.otk.module.league;

import com.dsk.chain.expansion.data.BaseDataActivityPresenter;

/**
 * Copyright (c) 2016/11/25. LiaoPeiKun Inc. All rights reserved.
 */

public class LeagueDetailPresenter extends BaseDataActivityPresenter {

}
<file_sep>package com.miguan.otk.model.bean;

import android.os.Parcel;
import android.os.Parcelable;

/**
 * Copyright (c) 2017/2/22. LiaoPeiKun Inc. All rights reserved.
 */

public class Chatroom implements Parcelable {

    private String room_id;

    public String getRoom_id() {
        return room_id;
    }

    public void setRoom_id(String room_id) {
        this.room_id = room_id;
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(this.room_id);
    }

    public Chatroom() {
    }

    protected Chatroom(Parcel in) {
        this.room_id = in.readString();
    }

    public static final Creator<Chatroom> CREATOR = new Creator<Chatroom>() {
        @Override
        public Chatroom createFromParcel(Parcel source) {
            return new Chatroom(source);
        }

        @Override
        public Chatroom[] newArray(int size) {
            return new Chatroom[size];
        }
    };
}
<file_sep>package com.miguan.otk.model.constant;

/**
 * Copyright (c) 2017/3/6. LiaoPeiKun Inc. All rights reserved.
 */

public interface QQAction {

    // 客服QQ(安娜)
    String Service = "mqqwpa://im/chat?chat_type=wpa&uin=1655647371";

    // 官方QQ群
    String Group = "mqqopensdkapi://bizAgent/qm/qr?url=http%3A%2F%2Fqm.qq.com%2Fcgi-bin%2Fqm%2Fqr%3Ffrom%3Dapp%26p%3Dandroid%26k%3D" + "YTT9mPgKCC-LR_48OUvlQWF3dBpRSJ0j";

}
<file_sep>package com.miguan.otk.model.bean;

import android.os.Parcel;
import android.os.Parcelable;

/**
 * Created by LPK on 2016/11/22.
 */
public class Match implements Parcelable {

    private int competition_id;

    private String title;

    private String content;

    private String start_time;

    private String game_name;

    private String game_img;

    private String game_desc;

    private String game_status;

    private String game_time;

    private int game_type;

    private String game_all;

    private int rank;

    private int status;

    /**
     * 可参与人数
     */
    private String competitors;

    /**
     * 已经参与人数
     */
    private String count_competitor;

    /**
     * 可参与替补数
     */
    private String substitute_competitors;

    /**
     * 已经参与替补数
     */
    private String count_sub_competitor;

    private int cost;

    private String qq_group_url;

    private String share_url;

    /**
     * 规则内容
     */
    private String rule;

    /**
     * 半决赛前比赛模式
     */
    private String battle_mode;

    /**
     * 决赛比赛模式
     */
    private String final_battle_mode;

    /**
     * 半决赛比赛模式
     */
    private String semifinal_battle_mode;

    /**
     * 通用赛事文章id
     */
    private String article_id;

    /**
     * 游戏模式
     */
    private String pattern;

    private long reward_money;

    private int reward_1;

    private int reward_2;

    private int reward_3_4;

    private int reward_5_8;

    private int reward_9_16;

    private int reward_17_32;

    private int reward_33_64;

    private long reward_sb;

    private int sb_reward_1;

    private int sb_reward_2;

    private int sb_reward_3_4;

    private int sb_reward_5_8;

    private int sb_reward_9_16;

    private int sb_reward_17_32;

    private int sb_reward_33_64;

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeInt(this.competition_id);
        dest.writeString(this.title);
        dest.writeString(this.content);
        dest.writeString(this.start_time);
        dest.writeString(this.game_name);
        dest.writeString(this.game_img);
        dest.writeString(this.game_desc);
        dest.writeString(this.game_status);
        dest.writeString(this.game_time);
        dest.writeInt(this.game_type);
        dest.writeString(this.game_all);
        dest.writeInt(this.rank);
        dest.writeInt(this.status);
        dest.writeString(this.competitors);
        dest.writeString(this.count_competitor);
        dest.writeString(this.substitute_competitors);
        dest.writeString(this.count_sub_competitor);
        dest.writeInt(this.cost);
        dest.writeString(this.qq_group_url);
        dest.writeString(this.share_url);
        dest.writeString(this.rule);
        dest.writeString(this.battle_mode);
        dest.writeString(this.final_battle_mode);
        dest.writeString(this.semifinal_battle_mode);
        dest.writeString(this.article_id);
        dest.writeString(this.pattern);
        dest.writeLong(this.reward_money);
        dest.writeInt(this.reward_1);
        dest.writeInt(this.reward_2);
        dest.writeInt(this.reward_3_4);
        dest.writeInt(this.reward_5_8);
        dest.writeInt(this.reward_9_16);
        dest.writeInt(this.reward_17_32);
        dest.writeInt(this.reward_33_64);
        dest.writeLong(this.reward_sb);
        dest.writeInt(this.sb_reward_1);
        dest.writeInt(this.sb_reward_2);
        dest.writeInt(this.sb_reward_3_4);
        dest.writeInt(this.sb_reward_5_8);
        dest.writeInt(this.sb_reward_9_16);
        dest.writeInt(this.sb_reward_17_32);
        dest.writeInt(this.sb_reward_33_64);
    }

    public Match() {
    }

    protected Match(Parcel in) {
        this.competition_id = in.readInt();
        this.title = in.readString();
        this.content = in.readString();
        this.start_time = in.readString();
        this.game_name = in.readString();
        this.game_img = in.readString();
        this.game_desc = in.readString();
        this.game_status = in.readString();
        this.game_time = in.readString();
        this.game_type = in.readInt();
        this.game_all = in.readString();
        this.rank = in.readInt();
        this.status = in.readInt();
        this.competitors = in.readString();
        this.count_competitor = in.readString();
        this.substitute_competitors = in.readString();
        this.count_sub_competitor = in.readString();
        this.cost = in.readInt();
        this.qq_group_url = in.readString();
        this.share_url = in.readString();
        this.rule = in.readString();
        this.battle_mode = in.readString();
        this.final_battle_mode = in.readString();
        this.semifinal_battle_mode = in.readString();
        this.article_id = in.readString();
        this.pattern = in.readString();
        this.reward_money = in.readLong();
        this.reward_1 = in.readInt();
        this.reward_2 = in.readInt();
        this.reward_3_4 = in.readInt();
        this.reward_5_8 = in.readInt();
        this.reward_9_16 = in.readInt();
        this.reward_17_32 = in.readInt();
        this.reward_33_64 = in.readInt();
        this.reward_sb = in.readLong();
        this.sb_reward_1 = in.readInt();
        this.sb_reward_2 = in.readInt();
        this.sb_reward_3_4 = in.readInt();
        this.sb_reward_5_8 = in.readInt();
        this.sb_reward_9_16 = in.readInt();
        this.sb_reward_17_32 = in.readInt();
        this.sb_reward_33_64 = in.readInt();
    }

    public static final Creator<Match> CREATOR = new Creator<Match>() {
        @Override
        public Match createFromParcel(Parcel source) {
            return new Match(source);
        }

        @Override
        public Match[] newArray(int size) {
            return new Match[size];
        }
    };

    public int getCompetition_id() {
        return competition_id;
    }

    public void setCompetition_id(int competition_id) {
        this.competition_id = competition_id;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public String getStart_time() {
        return start_time;
    }

    public void setStart_time(String start_time) {
        this.start_time = start_time;
    }

    public String getGame_name() {
        return game_name;
    }

    public void setGame_name(String game_name) {
        this.game_name = game_name;
    }

    public String getGame_img() {
        return game_img;
    }

    public void setGame_img(String game_img) {
        this.game_img = game_img;
    }

    public String getGame_desc() {
        return game_desc;
    }

    public void setGame_desc(String game_desc) {
        this.game_desc = game_desc;
    }

    public String getGame_status() {
        return game_status;
    }

    public void setGame_status(String game_status) {
        this.game_status = game_status;
    }

    public String getGame_time() {
        return game_time;
    }

    public void setGame_time(String game_time) {
        this.game_time = game_time;
    }

    public int getGame_type() {
        return game_type;
    }

    public void setGame_type(int game_type) {
        this.game_type = game_type;
    }

    public String getGame_all() {
        return game_all;
    }

    public void setGame_all(String game_all) {
        this.game_all = game_all;
    }

    public int getRank() {
        return rank;
    }

    public void setRank(int rank) {
        this.rank = rank;
    }

    public int getStatus() {
        return status;
    }

    public void setStatus(int status) {
        this.status = status;
    }

    public String getCompetitors() {
        return competitors;
    }

    public void setCompetitors(String competitors) {
        this.competitors = competitors;
    }

    public String getCount_competitor() {
        return count_competitor;
    }

    public void setCount_competitor(String count_competitor) {
        this.count_competitor = count_competitor;
    }

    public String getSubstitute_competitors() {
        return substitute_competitors;
    }

    public void setSubstitute_competitors(String substitute_competitors) {
        this.substitute_competitors = substitute_competitors;
    }

    public String getCount_sub_competitor() {
        return count_sub_competitor;
    }

    public void setCount_sub_competitor(String count_sub_competitor) {
        this.count_sub_competitor = count_sub_competitor;
    }

    public int getCost() {
        return cost;
    }

    public void setCost(int cost) {
        this.cost = cost;
    }

    public String getQq_group_url() {
        return qq_group_url;
    }

    public void setQq_group_url(String qq_group_url) {
        this.qq_group_url = qq_group_url;
    }

    public String getShare_url() {
        return share_url;
    }

    public void setShare_url(String share_url) {
        this.share_url = share_url;
    }

    public String getRule() {
        return rule;
    }

    public void setRule(String rule) {
        this.rule = rule;
    }

    public String getBattle_mode() {
        return battle_mode;
    }

    public void setBattle_mode(String battle_mode) {
        this.battle_mode = battle_mode;
    }

    public String getFinal_battle_mode() {
        return final_battle_mode;
    }

    public void setFinal_battle_mode(String final_battle_mode) {
        this.final_battle_mode = final_battle_mode;
    }

    public String getSemifinal_battle_mode() {
        return semifinal_battle_mode;
    }

    public void setSemifinal_battle_mode(String semifinal_battle_mode) {
        this.semifinal_battle_mode = semifinal_battle_mode;
    }

    public String getArticle_id() {
        return article_id;
    }

    public void setArticle_id(String article_id) {
        this.article_id = article_id;
    }

    public String getPattern() {
        return pattern;
    }

    public void setPattern(String pattern) {
        this.pattern = pattern;
    }

    public long getReward_money() {
        return reward_money;
    }

    public void setReward_money(long reward_money) {
        this.reward_money = reward_money;
    }

    public int getReward_1() {
        return reward_1;
    }

    public void setReward_1(int reward_1) {
        this.reward_1 = reward_1;
    }

    public int getReward_2() {
        return reward_2;
    }

    public void setReward_2(int reward_2) {
        this.reward_2 = reward_2;
    }

    public int getReward_3_4() {
        return reward_3_4;
    }

    public void setReward_3_4(int reward_3_4) {
        this.reward_3_4 = reward_3_4;
    }

    public int getReward_5_8() {
        return reward_5_8;
    }

    public void setReward_5_8(int reward_5_8) {
        this.reward_5_8 = reward_5_8;
    }

    public int getReward_9_16() {
        return reward_9_16;
    }

    public void setReward_9_16(int reward_9_16) {
        this.reward_9_16 = reward_9_16;
    }

    public int getReward_17_32() {
        return reward_17_32;
    }

    public void setReward_17_32(int reward_17_32) {
        this.reward_17_32 = reward_17_32;
    }

    public int getReward_33_64() {
        return reward_33_64;
    }

    public void setReward_33_64(int reward_33_64) {
        this.reward_33_64 = reward_33_64;
    }

    public long getReward_sb() {
        return reward_sb;
    }

    public void setReward_sb(long reward_sb) {
        this.reward_sb = reward_sb;
    }

    public int getSb_reward_1() {
        return sb_reward_1;
    }

    public void setSb_reward_1(int sb_reward_1) {
        this.sb_reward_1 = sb_reward_1;
    }

    public int getSb_reward_2() {
        return sb_reward_2;
    }

    public void setSb_reward_2(int sb_reward_2) {
        this.sb_reward_2 = sb_reward_2;
    }

    public int getSb_reward_3_4() {
        return sb_reward_3_4;
    }

    public void setSb_reward_3_4(int sb_reward_3_4) {
        this.sb_reward_3_4 = sb_reward_3_4;
    }

    public int getSb_reward_5_8() {
        return sb_reward_5_8;
    }

    public void setSb_reward_5_8(int sb_reward_5_8) {
        this.sb_reward_5_8 = sb_reward_5_8;
    }

    public int getSb_reward_9_16() {
        return sb_reward_9_16;
    }

    public void setSb_reward_9_16(int sb_reward_9_16) {
        this.sb_reward_9_16 = sb_reward_9_16;
    }

    public int getSb_reward_17_32() {
        return sb_reward_17_32;
    }

    public void setSb_reward_17_32(int sb_reward_17_32) {
        this.sb_reward_17_32 = sb_reward_17_32;
    }

    public int getSb_reward_33_64() {
        return sb_reward_33_64;
    }

    public void setSb_reward_33_64(int sb_reward_33_64) {
        this.sb_reward_33_64 = sb_reward_33_64;
    }
}
<file_sep>package com.miguan.otk.module.battle;

import android.os.Bundle;
import android.widget.Button;

import com.dsk.chain.bijection.RequiresPresenter;
import com.dsk.chain.expansion.data.BaseDataActivity;
import com.miguan.otk.R;
import com.miguan.otk.model.bean.Battle;

import butterknife.Bind;
import butterknife.ButterKnife;

@RequiresPresenter(BattlePresenter.class)
public class BattleActivity extends BaseDataActivity<BattlePresenter, Battle> {

    private BattleHeaderPanel mHeaderPanel;

    private BattleBodyPanel mBodyPanel;

    @Bind(R.id.btn_battle_status_save)
    Button mBtnSave;

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

    }

    @Override
    public void setData(Battle battle) {
//        if (battle.getBattle_status_user() == mCurrentStatus) return;
//        mCurrentStatus = battle.getBattle_status_user();
        setToolbarTitle(String.format(getString(R.string.label_battle_id), battle.getBattle_id()));

        if (mHeaderPanel == null) {
            mHeaderPanel = new BattleHeaderPanel(this, getContent(), battle);
        } else {
            mHeaderPanel.load(battle);
        }

        if (mBodyPanel == null) {
            mBodyPanel = new BattleBodyPanel(this, getContent(), battle, getPresenter());
        } else {
            mBodyPanel.load(battle);
        }

    }

//    public void setStatus(Battle battle) {
//
//        mBtnCopy.setOnClickListener(v -> getPresenter().copyName(mTvOpponent.getText().toString().trim()));
//        mTvContact.setOnClickListener(v -> startActivity(new Intent(this, ContactJudgeActivity.class)));
//        mTvScreenshot.setOnClickListener(v -> getPresenter().toShot(battle));
//        mTvChatroom.setOnClickListener(v -> ChatRoomActivityPresenter.start(this, battle.getBattle_id()));
//
//        // 观战模式 用户类型为游客或未参赛
//        if (battle.getUser_type() == 0 || battle.getUser_type() == 3) {
//            setSimpleDesc();
//            mBtnSave.setVisibility(View.GONE);
//            mSection.setTitle("比赛阶段")
//                    .setDesc(String.format("%s阶段比赛正在进行中", battle.getBattle_times()));
//            return;
//        }
//
//        // 等待对手生成
//        if (battle.getBattle_status() == 0) {
//            setSimpleDesc();
//            mSection.setTitle("等待对手生成")
//                    .setDesc("您的对手还没有结束当前比赛，请耐心等待");
//            mBtnSave.setVisibility(View.GONE);
//            return;
//        }
//
//        // 准备阶段
//        if (battle.getBattle_status() == 1) {
//            setSimpleDesc();
//            mSection.setTitle(R.string.text_prepare_phase)
//                    .setDesc(R.string.text_ready_desc);
//            if ((battle.getUser_type() == 1 && battle.getBattle_status_user() == 2) || (battle.getUser_type() == 2 && battle.getBattle_status_user() == 3)) {
//                mBtnSave.setText("已准备");
//                mBtnSave.setEnabled(false);
//            } else {
//                mBtnSave.setText("准备");
//                mBtnSave.setOnClickListener(v -> getPresenter().ready());
//            }
//            return;
//        }
//
//        // 结束
//        if (battle.getBattle_status() == 5) {
//            setSimpleDesc();
//            mSection.setTitle(R.string.text_battle_ended)
//                    .setDesc(String.format(getString(R.string.text_battle_ended_desc), battle.getWinner_id() == battle.getA_user_id() ? battle.getA_username() : (battle.getWinner_id() == battle.getB_user_id() ? battle.getB_username() : "无结果")));
//
//            if (battle.getWinner_id() == 1 && battle.getNext_battle_id() > 0) {
//                mBtnSave.setText("进入下一轮");
//                mBtnSave.setOnClickListener(v -> EventBus.getDefault().post(battle));
//            } else if (battle.getIs_end()) {
//                mBtnSave.setVisibility(View.GONE);
//            } else {
//                mBtnSave.setText("结束");
//                mBtnSave.setOnClickListener(v -> {
//                    Intent intent = new Intent(this, BattleActivity.class);
//                    intent.putExtra("battle_id", battle.getBattle_id());
//                    startActivity(intent);
//                });
//            }
//            return;
//        }
//
//        mLyOperation.setVisibility(View.VISIBLE);
//        mTvOpponent.setText(battle.getUser_type() == 1 ? battle.getB_gameaccount() : battle.getA_gameaccount());
//
//        // 比赛处于pick阶段
//        if (battle.getBattle_status() == 2) {
//            mSection.setVisibility(View.VISIBLE);
//            mBtnSave.setVisibility(View.VISIBLE);
//            if (battle.getBattle_status_user() == 5 && battle.getUser_type() == 1
//                    || battle.getBattle_status_user() == 6 && battle.getUser_type() == 2) {
//                mSection.setTitle(R.string.text_pick_title)
//                        .setDesc(R.string.text_picked_desc)
//                        .setNotice("");
//                mGridHeros.setVisibility(View.GONE);
//                mBtnSave.setText("已提交");
//                mBtnSave.setEnabled(false);
//            } else {
//                mGridHeros.setVisibility(View.VISIBLE);
//
//                mSection.setTitle(R.string.text_pick_title)
//                        .setNotice(R.string.text_pick_notice)
//                        .setDesc(R.string.text_pick_desc);
//
//                BanPickAdapter adapter = new BanPickAdapter(this, BanPickAdapter.MODE_PICK);
//                adapter.setOnItemClickListener(hero -> {
//                    if (mSelected.contains(hero)) {
//                        mSelected.remove(hero);
//                        adapter.select(hero);
//                    } else {
//                        if ((battle.getBattle_mode().equals("BO3") && mSelected.size() >= 3)
//                                || (battle.getBattle_mode().equals("BO5") && mSelected.size() >= 4)) {
//                            LUtils.toast("已达最大数量");
//                        } else {
//                            mSelected.add(hero);
//                            adapter.select(hero);
//                        }
//                    }
//                });
//                mGridHeros.setAdapter(adapter);
//
//                mBtnSave.setText("提交");
//                mBtnSave.setEnabled(true);
//                mBtnSave.setOnClickListener(v -> {
//                    if (mSelected.size() != 3) LUtils.toast("必须选择3个");
//                    else getPresenter().pick(mSelected);
//                });
//            }
//        }
//
//        // 比赛处于ban阶段
//        if (battle.getBattle_status() == 3) {
//
//            if (battle.getBattle_status_user() == 8 && battle.getUser_type() == 1 || battle.getBattle_status_user() == 9 && battle.getUser_type() == 2) {
//                mSection.setTitle(R.string.text_ban_title)
//                        .setDesc(R.string.text_baned_desc);
//                mGridHeros.setVisibility(View.GONE);
//                mBtnSave.setText("已提交");
//                mBtnSave.setEnabled(false);
//            } else {
//                mGridHeros.setVisibility(View.VISIBLE);
//                mSection.setTitle(R.string.text_ban_title)
//                        .setNotice(R.string.text_ban_notice)
//                        .setDesc(R.string.text_ban_desc);
//
//                List<Hero> list = new ArrayList<>();
//                for (int i=1; i<(battle.getBattle_mode().equals("BO4") ? 5 : 4); i++) {
//                    Hero hero = new Hero();
//                    try {
//                        Method method = battle.getClass().getMethod("get" + (battle.getUser_type() == 2 ? "A" : "B") + "_car" + i);
//                        hero.setIndex(Integer.valueOf((String) method.invoke(battle)));
//                    } catch (NoSuchMethodException e) {
//                        e.printStackTrace();
//                    } catch (InvocationTargetException e) {
//                        e.printStackTrace();
//                    } catch (IllegalAccessException e) {
//                        e.printStackTrace();
//                    }
//                    list.add(hero);
//                }
//
//                BanPickAdapter adapter = new BanPickAdapter(this, list, BanPickAdapter.MODE_BAN);
//                adapter.setOnItemClickListener(index -> {
//                    if (mSelected.contains(index)) {
//                        mSelected.remove(index);
//                        adapter.select(index);
//                    } else {
//                        if (mSelected.size() >= 1) {
//                            LUtils.toast("只能Ban一个");
//                        } else {
//                            mSelected.add(index);
//                            adapter.select(index);
//                        }
//                    }
//                });
//
//                mGridHeros.removeAllViews();
//                mGridHeros.setAdapter(adapter);
//                mBtnSave.setText("提交");
//                mBtnSave.setEnabled(true);
//                mBtnSave.setOnClickListener(v -> {
//                    if (mSelected.size() != 1) LUtils.toast("必须Ban一个英雄");
//                    else getPresenter().ban(mSelected.get(0).getIndex());
//                });
//            }
//        }
//
//        // 进行中
//        if (battle.getBattle_status() == 4) {
//            if (battle.getBattle_status_user() == 11  && battle.getUser_type() == 1 || battle.getBattle_status_user() == 12 && battle.getUser_type() == 2) {
//                mBtnSave.setText("已提交");
//                mBtnSave.setEnabled(false);
//                mGridHeros.setVisibility(View.GONE);
//                mSection.setTitle("提交比赛结果")
//                        .setDesc(String.format(getString(R.string.text_submit_result_desc), battle.getBattle_times(), battle.getWinner_id() == battle.getA_user_id() ? battle.getA_username() : (battle.getWinner_id() == battle.getB_user_id() ? battle.getB_username() : "无结果")));
//            } else {
//                mSection.setVisibility(View.GONE);
//                mGridHeros.setVisibility(View.GONE);
//                mBtnSave.setVisibility(View.GONE);
//                mLyResult.setVisibility(View.VISIBLE);
//                mBtnImWin.setOnClickListener(v -> getPresenter().submit(battle.getUser_type() == 1 ? battle.getA_user_id() : battle.getB_user_id()));
//                mBtnImLost.setOnClickListener(v -> getPresenter().submit(battle.getUser_type() == 2 ? battle.getA_user_id() : battle.getB_user_id()));
//
//                if (!battle.getBattle_mode().equals("BO1")) {
//                    mLyOngoing.setVisibility(View.VISIBLE);
//                    mTvAAccount.setText(battle.getA_gameaccount());
//                    mTvBAccount.setText(battle.getB_gameaccount());
//
//                    List<Hero> listA = new ArrayList<>();
//                    List<Hero> listB = new ArrayList<>();
//                    for (int i=1; i<(battle.getBattle_mode().equals("BO4") ? 5 : 4); i++) {
//                        Hero heroA = new Hero();
//                        Hero heroB = new Hero();
//                        try {
//                            String carA = (String) battle.getClass().getMethod("getA_" + "car" + i).invoke(battle);
//                            heroA.setIndex(Integer.valueOf(carA));
//                            heroA.setBan(carA.equals(battle.getA_ban()));
//
//                            String carB = (String) battle.getClass().getMethod("getB_" + "car" + i).invoke(battle);
//                            heroB.setIndex(Integer.valueOf(carB));
//                            heroB.setBan(carB.equals(battle.getB_ban()));
//                        } catch (NoSuchMethodException e) {
//                            e.printStackTrace();
//                        } catch (InvocationTargetException e) {
//                            e.printStackTrace();
//                        } catch (IllegalAccessException e) {
//                            e.printStackTrace();
//                        }
//                        listA.add(heroA);
//                        listB.add(heroB);
//                    }
//
//                    BanPickAdapter adapterA = new BanPickAdapter(this, listA, BanPickAdapter.MODE_SHOW);
//                    mGridABans.setAdapter(adapterA);
//
//                    BanPickAdapter adapterB = new BanPickAdapter(this, listB, BanPickAdapter.MODE_SHOW);
//                    mGridBBans.setAdapter(adapterB);
//                }
//
//            }
//        }
//
//        // 争议
//        if (battle.getBattle_status() == 6) {
//            mSection.setVisibility(View.VISIBLE);
//            mGridHeros.setVisibility(View.GONE);
//            mSection.setTitle("提交比赛结果").setDesc(R.string.text_controversial_desc);
//            mBtnSave.setText("重新提交");
//            mBtnSave.setOnClickListener(v -> getPresenter().resubmit());
//        }
//
//    }

}
<file_sep>package com.miguan.otk.model.constant;

import com.miguan.otk.R;

/**
 * Copyright (c) 2017/3/7. LiaoPeiKun Inc. All rights reserved.
 */

public enum Hero {

    WARRIOR(R.mipmap.ic_warrior, 1, "战士", false, false),
    MAGE(R.mipmap.ic_mage, 2, "法师", false, false);
//    WARRIOR(R.mipmap.ic_warrior, 1, "战士", false, false);
//    WARRIOR(R.mipmap.ic_warrior, 1, "战士", false, false);
//    WARRIOR(R.mipmap.ic_warrior, 1, "战士", false, false);
//    WARRIOR(R.mipmap.ic_warrior, 1, "战士", false, false);
//    WARRIOR(R.mipmap.ic_warrior, 1, "战士", false, false);
//    WARRIOR(R.mipmap.ic_warrior, 1, "战士", false, false);
//    WARRIOR(R.mipmap.ic_warrior, 1, "战士", false, false);

    public final int mResID;

    public final int mType;

    public final String name;

    public boolean mIsCheck;

    public boolean mIsBan;

    Hero(int resID, int type, String name, boolean isCheck, boolean isBan) {
        mResID = resID;
        mType = type;
        this.name = name;
        mIsCheck = isCheck;
        mIsBan = isBan;
    }

    public int getType() {
        return mType;
    }

    public boolean isBan() {
        return mIsBan;
    }

    public void setBan(boolean isBan) {
        this.mIsBan = isBan;
    }

    public boolean isCheck() {
        return mIsCheck;
    }

    public void setCheck(boolean isCheck) {
        this.mIsCheck = isCheck;
    }

    public static Hero getHeroFromType(int type) {
        for (Hero hero : Hero.values()) {
            if (type == hero.mType) return hero;
        }
        return WARRIOR;
    }

}
<file_sep>package com.miguan.otk.module.account;

import android.content.Intent;
import android.os.Bundle;
import android.text.TextUtils;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;

import com.dsk.chain.bijection.ChainBaseActivity;
import com.dsk.chain.bijection.RequiresPresenter;
import com.miguan.otk.R;
import com.miguan.otk.utils.LUtils;

import butterknife.Bind;
import butterknife.ButterKnife;

/**
 * Copyright (c) 2015. LiaoPeiKun Inc. All rights reserved.
 */
@RequiresPresenter(LoginPresenter.class)
public class LoginActivity extends ChainBaseActivity<LoginPresenter> {

    @Bind(R.id.iv_login_back)
    ImageView mIvBack;

    @Bind(R.id.et_login_username)
    EditText mEtMobile;

    @Bind(R.id.et_login_password)
    EditText mEtPassword;

    @Bind(R.id.tv_login_forgot)
    TextView mTvForgot;

    @Bind(R.id.tv_login_register)
    TextView mTvRegister;

    @Bind(R.id.btn_login_submit)
    Button mBtnLogin;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.user_activity_login);
        setToolbarTitle(R.string.title_activity_login);
        ButterKnife.bind(this);

        mIvBack.setOnClickListener(v -> finish());
        mTvForgot.setOnClickListener(v -> startActivity(new Intent(this, ForgotActivity.class)));
        mTvRegister.setOnClickListener(v -> startActivity(new Intent(this, RegisterActivity.class)));
        mBtnLogin.setOnClickListener(v -> checkInput());
//        mTvQQ.setOnClickListener(v -> getPresenter().doOauthVerify(SHARE_MEDIA.QQ));
//        mTvWx.setOnClickListener(v -> getPresenter().doOauthVerify(SHARE_MEDIA.WEIXIN));
    }

    private void checkInput() {
        if (TextUtils.isEmpty(mEtMobile.getText())) {
            LUtils.toast("用户名不能为空");
            return;
        }
        if (TextUtils.isEmpty(mEtPassword.getText())) {
            LUtils.toast("请输入密码");
            return;
        }

        getPresenter().login(mEtMobile.getText().toString().trim(), mEtPassword.getText().toString().trim());
    }

}
<file_sep>package com.miguan.otk.module.news;

import android.content.Intent;
import android.os.Bundle;

import com.dsk.chain.expansion.list.BaseListFragmentPresenter;
import com.miguan.otk.model.NewsModel;
import com.miguan.otk.model.bean.News;

/**
 * Copyright (c) 2015. LiaoPeiKun Inc. All rights reserved.
 */
public class NewsListPresenter extends BaseListFragmentPresenter<NewsListFragment, News> {

    private int mType = 1;

    @Override
    protected void onCreate(NewsListFragment view, Bundle saveState) {
        super.onCreate(view, saveState);
        if (view.getArguments() != null) {
            mType = view.getArguments().getInt("type");
        }
    }

    @Override
    protected void onCreateView(NewsListFragment view) {
        super.onCreateView(view);
        onRefresh();
        getAdapter().setOnItemClickListener(position -> {
            News news = getAdapter().getItem(position);
            Intent intent = new Intent(getView().getActivity(), NewsDetailActivity.class);
            intent.putExtra("news", news);
            getView().startActivity(intent);
        });
    }

    @Override
    public void onRefresh() {
        NewsModel.getInstance().getNewsList(mType, 1).unsafeSubscribe(getRefreshSubscriber());
    }

    @Override
    public void onLoadMore() {
        NewsModel.getInstance().getNewsList(mType, getCurPage()).unsafeSubscribe(getMoreSubscriber());
    }
}
<file_sep>package com.miguan.otk.module.match;

import android.content.Intent;
import android.os.Bundle;
import android.os.CountDownTimer;
import android.support.design.widget.TabLayout;
import android.support.v4.view.ViewPager;
import android.support.v4.widget.SwipeRefreshLayout;
import android.support.v7.app.AlertDialog;
import android.text.InputType;
import android.text.Spannable;
import android.text.SpannableString;
import android.text.Spanned;
import android.text.TextUtils;
import android.text.style.ForegroundColorSpan;
import android.text.style.ImageSpan;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;

import com.dsk.chain.bijection.RequiresPresenter;
import com.dsk.chain.expansion.data.BaseDataActivity;
import com.miguan.otk.R;
import com.miguan.otk.adapter.TitlePagerAdapter;
import com.miguan.otk.model.bean.Match;
import com.miguan.otk.model.local.UserPreferences;
import com.miguan.otk.module.account.LoginActivity;
import com.miguan.otk.utils.DateUtils;
import com.miguan.otk.widget.StickyNavLayout;

import org.greenrobot.eventbus.EventBus;

import butterknife.Bind;
import butterknife.ButterKnife;

@RequiresPresenter(MatchDetailPresenter.class)
public class MatchDetailActivity extends BaseDataActivity<MatchDetailPresenter, Match> {

    @Bind(R.id.sticky_match_detail)
    StickyNavLayout mSticky;

    @Bind(R.id.refresh_match_detail)
    SwipeRefreshLayout mRefresh;

    @Bind(R.id.tv_match_detail_title)
    TextView mTvTitle;

    @Bind(R.id.tv_match_detail_cost)
    TextView mTvCost;

    @Bind(R.id.tv_match_detail_status)
    TextView mTvStatus;

    @Bind(R.id.btn_match_detail_status)
    Button mBtnStatus;

    @Bind(R.id.id_stickynavlayout_tab)
    TabLayout mTabLayout;

    @Bind(R.id.id_stickynavlayout_viewpager)
    ViewPager mPager;
    private CountDownTimer mCountDownTimer;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.match_activity_detail);
        setToolbarTitle(R.string.title_activity_match_detail);
        ButterKnife.bind(this);

        mRefresh.setOnRefreshListener(getPresenter());
        mSticky.setOnHeaderScrollListener((scrollY, isHidden) -> {
            if (scrollY == 0) mRefresh.setEnabled(true);
            else mRefresh.setEnabled(false);
        });
        mPager.setAdapter(new TitlePagerAdapter(this, R.array.tab_match_detail, getPresenter().getFragments(), getSupportFragmentManager()));
        mTabLayout.setupWithViewPager(mPager);
        mTabLayout.addOnTabSelectedListener(new TabLayout.OnTabSelectedListener() {
            @Override
            public void onTabSelected(TabLayout.Tab tab) {
                if (tab.getPosition() > 1) mBtnStatus.setVisibility(View.GONE);
                else mBtnStatus.setVisibility(View.VISIBLE);
            }

            @Override
            public void onTabUnselected(TabLayout.Tab tab) {

            }

            @Override
            public void onTabReselected(TabLayout.Tab tab) {

            }
        });
    }

    @Override
    public void setData(Match match) {
        if (mRefresh.isRefreshing()) mRefresh.setRefreshing(false);

        EventBus.getDefault().post(match); // 更新底下四个fragment
        mTvCost.setText(String.format(getString(R.string.label_match_id_cost), match.getCompetition_id(), match.getCost()));

        SpannableString spanString = new SpannableString(match.getTitle());
        if (match.getGame_type() > 0) {
            spanString = new SpannableString(match.getTitle() + " img");
            ImageSpan imageSpan = new ImageSpan(this, match.getGame_type() == 1 ? R.mipmap.ic_match_type_private : R.mipmap.ic_match_type_invite);
            spanString.setSpan(imageSpan, (match.getTitle() + " ").length(), (match.getTitle() + " img").length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
        }
        mTvTitle.setText(spanString);

        long time = Long.valueOf(match.getGame_time());
        if (time > 0) {
            mCountDownTimer = new CountDownTimer(time * 1000, 1000) {

                @Override
                public void onTick(long millisUntilFinished) {
                    String time = DateUtils.getFormatDay(millisUntilFinished);
                    String status = String.format(getString(R.string.label_match_state), match.getGame_desc(), time);
                    SpannableString spannableString = new SpannableString(status);
                    ForegroundColorSpan colorSpan = new ForegroundColorSpan(getResources().getColor(R.color.colorAccent));
                    spannableString.setSpan(colorSpan, status.length() - time.length(), status.length(), Spanned.SPAN_INCLUSIVE_INCLUSIVE);
                    mTvStatus.setText(spannableString);
                }

                @Override
                public void onFinish() {
                    getPresenter().onRefresh();
                }

            }.start();
        } else {
            if (mCountDownTimer != null) {
                mCountDownTimer.cancel();
            }
            mTvStatus.setText("赛事状态：" + match.getGame_status());
        }

        mBtnStatus.setText(match.getGame_status());
        switch (match.getStatus()) {
            case 2 & 3: // 报名
                mBtnStatus.setEnabled(true);
                mBtnStatus.setOnClickListener(status -> checkEnroll(match.getCost(), match.getGame_type()));
                break;
            case 5: // 已报名
                setEnrolled();
                break;
            case 6: // 签到
                mBtnStatus.setEnabled(true);
                mBtnStatus.setOnClickListener(v -> getPresenter().sign());
                break;
            case 7: // 已签到
                setSigned();
                break;
            case 8 & 9: // 准备 & 正在进行
                mBtnStatus.setEnabled(true);
                mBtnStatus.setOnClickListener(v -> getPresenter().getBattleID());
                break;
            default:
                mBtnStatus.setEnabled(false);
//                mBtnStatus.setOnClickListener(v -> getPresenter().getBattleID());
                break;
        }
    }

    public void checkEnroll(int cost, int type) {
        // TODO 检测是否有绑定游戏账号

        if (TextUtils.isEmpty(UserPreferences.getToken())) {
            startActivity(new Intent(this, LoginActivity.class));
        } else if (cost > 0) {
            new AlertDialog.Builder(this)
                    .setMessage(String.format("是否消耗%d撒币报名比赛", cost))
                    .setPositiveButton(getString(R.string.btn_ok), (dialog, which) -> checkType(type))
                    .setNegativeButton(getString(R.string.btn_cancel), null)
                    .show();
        } else {
            checkType(type);
        }
    }

    public void checkType(int type) {
        if (type == 0) {
            getPresenter().enter(null, null);
        } else {
            View view = LayoutInflater.from(this).inflate(R.layout.dialog_enter_password, null);
            AlertDialog dialog = new AlertDialog.Builder(MatchDetailActivity.this).setView(view).show();
            TextView tvTitle = (TextView) view.findViewById(R.id.tv_dialog_enter_title);
            EditText etPwd = (EditText) view.findViewById(R.id.et_dialog_enter_password);
            Button btnOk = (Button) view.findViewById(R.id.btn_dialog_ok);
            Button btnCancel = (Button) view.findViewById(R.id.btn_dialog_cancel);

            tvTitle.setText(type == 1 ? R.string.text_match_input_password : R.string.text_match_input_invite);
            etPwd.setInputType(InputType.TYPE_NUMBER_VARIATION_PASSWORD);
            btnOk.setOnClickListener(v -> {
                dialog.dismiss();
                String pwd = etPwd.getText().toString().trim();
                getPresenter().enter(type == 1 ? pwd : null, type == 2 ? pwd : null);
            });
            btnCancel.setOnClickListener(v -> dialog.dismiss());
        }
    }

    public void setEnrolled() {
        mBtnStatus.setText("已报名");
        mBtnStatus.setEnabled(false);
    }

    public void setSigned() {
        mBtnStatus.setText("已签到");
        mBtnStatus.setEnabled(false);
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        getMenuInflater().inflate(R.menu.menu_share, menu);
        return super.onCreateOptionsMenu(menu);
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        getPresenter().share();
        return super.onOptionsItemSelected(item);
    }

}
<file_sep>package com.miguan.otk.adapter.viewholder;

import android.content.Intent;
import android.view.ViewGroup;
import android.widget.TextView;

import com.jude.easyrecyclerview.adapter.BaseViewHolder;
import com.miguan.otk.R;
import com.miguan.otk.model.bean.Schedule;
import com.miguan.otk.module.battle.BattleActivity;

import butterknife.Bind;
import butterknife.ButterKnife;

/**
 * Copyright (c) 2016/12/23. LiaoPeiKun Inc. All rights reserved.
 */

public class ScheduleViewHolder extends BaseViewHolder<Schedule> {

    @Bind(R.id.tv_schedule_a_score)
    TextView mTvAScore;

    @Bind(R.id.tv_schedule_a_username)
    TextView mTvAUsername;

    @Bind(R.id.tv_schedule_b_score)
    TextView mTvBScore;

    @Bind(R.id.tv_schedule_b_username)
    TextView mTvBUsername;

    public ScheduleViewHolder(ViewGroup parent) {
        super(parent, R.layout.item_list_schedule);
        ButterKnife.bind(this, itemView);
    }

    @Override
    public void setData(Schedule schedule) {
        int colorPrimary = getContext().getResources().getColor(R.color.colorPrimaryDark);
        int colorWhite = getContext().getResources().getColor(R.color.white);
        int textBody = getContext().getResources().getColor(R.color.textBody);
        mTvAScore.setBackgroundColor(schedule.getA_score() > schedule.getB_score() ? colorPrimary : colorWhite);
        mTvAScore.setTextColor(schedule.getA_score() > schedule.getB_score() ? colorWhite : textBody);
        mTvBScore.setBackgroundColor(schedule.getB_score() > schedule.getA_score() ? colorPrimary : colorWhite);
        mTvBScore.setTextColor(schedule.getB_score() > schedule.getA_score() ? colorWhite : textBody);

        mTvAScore.setText(schedule.getA_score() + "");
        mTvAUsername.setText(schedule.getA_name());
        mTvBScore.setText(schedule.getB_score() + "");
        mTvBUsername.setText(schedule.getB_name());

        itemView.setOnClickListener(v -> {
            Intent intent = new Intent(getContext(), BattleActivity.class);
            intent.putExtra("battle_id", schedule.getBattle_id());
            getContext().startActivity(intent);
        });
    }
}
<file_sep>package com.miguan.otk.module.account;

import android.os.Bundle;
import android.text.TextUtils;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;

import com.dsk.chain.bijection.ChainBaseActivity;
import com.dsk.chain.bijection.RequiresPresenter;
import com.miguan.otk.R;
import com.miguan.otk.utils.LUtils;

import butterknife.Bind;
import butterknife.ButterKnife;

@RequiresPresenter(ForgotPresenter.class)
public class ForgotActivity extends ChainBaseActivity<ForgotPresenter> {

    @Bind(R.id.iv_forgot_back)
    ImageView mIvBack;

    @Bind(R.id.et_forgot_mobile)
    EditText mEtMobile;

    @Bind(R.id.et_forgot_new)
    EditText mEtNewPwd;

    @Bind(R.id.et_forgot_confirm)
    EditText mEtConfirm;

    @Bind(R.id.et_forgot_captcha)
    EditText mEtCaptcha;

    @Bind(R.id.btn_forgot_captcha)
    Button mBtnCaptcha;

    @Bind(R.id.btn_forgot_save)
    Button mBtnSave;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.user_activity_forgot);
        setToolbarTitle(R.string.title_activity_forgot);
        ButterKnife.bind(this);

        mIvBack.setOnClickListener(v -> finish());
        mBtnCaptcha.setOnClickListener(v -> checkCaptcha());
        mBtnSave.setOnClickListener(v -> checkInput());
    }

    private void checkCaptcha() {
        if (mEtMobile.length() != 11) {
            LUtils.toast("请输入正确的手机号码");
            return;
        }
        getPresenter().sendCaptcha(mEtMobile.getText().toString().trim());
    }

    private void checkInput() {
        if (mEtMobile.length() != 11) {
            LUtils.toast("请输入正确的手机号码");
            return;
        }
        if (TextUtils.isEmpty(mEtConfirm.getText())) {
            LUtils.toast("请再次输入密码");
            return;
        }
        if (!mEtConfirm.getText().toString().equals(mEtNewPwd.getText().toString())) {
            LUtils.toast("再次密码输入不一致");
            return;
        }
        getPresenter().changePwd(
                mEtMobile.getText().toString().trim(),
                mEtNewPwd.getText().toString().trim(),
                mEtCaptcha.getText().toString().trim()
        );
    }

}
<file_sep>package com.miguan.otk.module.battle;

import android.app.Activity;
import android.content.ClipData;
import android.content.ClipboardManager;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.support.v7.app.AlertDialog;
import android.text.TextUtils;
import android.view.View;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.jude.exgridview.ExGridView;
import com.miguan.otk.R;
import com.miguan.otk.adapter.BPAdapter;
import com.miguan.otk.adapter.BanPickAdapter;
import com.miguan.otk.model.bean.Battle;
import com.miguan.otk.model.bean.Hero;
import com.miguan.otk.utils.LUtils;

import org.greenrobot.eventbus.EventBus;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.List;

import butterknife.Bind;
import butterknife.ButterKnife;

/**
 * Copyright (c) 2017/2/28. LiaoPeiKun Inc. All rights reserved.
 */

public class BattleBodyPanel {

    @Bind(R.id.layout_battle_status)
    LinearLayout mLyStatus;

    @Bind(R.id.tv_battle_a_status)
    TextView mTvAStatus;

    @Bind(R.id.tv_battle_b_status)
    TextView mTvBStatus;

    @Bind(R.id.include_battle_operation)
    View mLyOperation;

    @Bind(R.id.tv_battling_opponent)
    TextView mTvOpponent;

    @Bind(R.id.btn_pick_copy)
    Button mBtnCopy;

    @Bind(R.id.tv_battling_judge)
    TextView mTvContact;

    @Bind(R.id.tv_battling_screenshot)
    TextView mTvScreenshot;

    @Bind(R.id.tv_battling_chatroom)
    TextView mTvChatroom;

    @Bind(R.id.layout_battle_desc)
    LinearLayout mLyDesc;

    @Bind(R.id.tv_battle_status_title)
    TextView mTvTitle;

    @Bind(R.id.tv_battle_status_notice)
    TextView mTvNotice;

    @Bind(R.id.tv_battle_status_desc)
    TextView mTvDesc;

    @Bind(R.id.grid_battling_list)
    ExGridView mGridHeros;

    @Bind(R.id.layout_battling_ongoing)
    LinearLayout mLyOngoing;

    @Bind(R.id.tv_battling_a_account)
    TextView mTvAAccount;

    @Bind(R.id.grid_battling_a_bans)
    ExGridView mGridABans;

    @Bind(R.id.tv_battling_b_account)
    TextView mTvBAccount;

    @Bind(R.id.grid_battling_b_bans)
    ExGridView mGridBBans;

    @Bind(R.id.btn_battle_status_save)
    Button mBtnSave;

    @Bind(R.id.ly_battling_submit_result)
    LinearLayout mLyResult;

    @Bind(R.id.btn_battling_im_win)
    Button mBtnImWin;

    @Bind(R.id.btn_battling_im_lost)
    Button mBtnImLost;

    private List<Hero> mSelected = new ArrayList<>();

    private Activity mActivity;

    private Battle mBattle;

    private BattleProxy mProxy;

    public BattleBodyPanel(Activity activity, View view, Battle battle, BattleProxy proxy) {
        mActivity = activity;
        mProxy = proxy;

        ButterKnife.bind(this, view);

        load(battle);
    }

    public void load(Battle battle) {
        if (mBattle != null && mBattle.getBattle_status_user() == battle.getBattle_status_user()) {
            return;
        }
        mBattle = battle;

        hideAllLayout();
        if (battle.getUser_type() == 0 || battle.getUser_type() == 3) { // 观战模式 用户类型为游客或未参赛
            setDescText("比赛阶段", String.format("%s阶段比赛正在进行中", battle.getBattle_times()), "");
        } else if (battle.getBattle_status() == 0) { // 等待对手生成
            setDescText("等待对手生成", "您的对手还没有结束当前比赛，请耐心等待", "");
        } else if (battle.getBattle_status() == 1) { // 准备阶段
            setUserStatus();
            setDescText("准备阶段", "点击“准备”按钮进入比赛，准备截断结束之后必须互相添加对手，同事在网页聊天室、游戏里说明是否进行卡组选择界面的截图", "");
            mBtnSave.setVisibility(View.VISIBLE);
            if ((battle.getUser_type() == 1 && battle.getBattle_status_user() == 2) || (battle.getUser_type() == 2 && battle.getBattle_status_user() == 3)) {
                mBtnSave.setText("已准备");
                mBtnSave.setEnabled(false);
            } else {
                mBtnSave.setText("准备");
                mBtnSave.setOnClickListener(v -> mProxy.ready());
            }
        } else if (battle.getBattle_status() == 2) { // 比赛处于pick阶段
            setOperation();
            mSelected.clear();
            if (battle.getBattle_status_user() == 5 && battle.getUser_type() == 1
                    || battle.getBattle_status_user() == 6 && battle.getUser_type() == 2) {
                setDescText(R.string.text_battle_pick_title, R.string.text_battle_picked_desc, 0);
                setButtonDisable();
            } else {
                setDescText(
                        R.string.text_battle_pick_title,
                        R.string.text_battle_pick_desc,
                        R.string.text_battle_pick_notice
                );
                setPick();
            }
        } else if (battle.getBattle_status() == 3) { // 比赛处于ban阶段
            setOperation();
            mSelected.clear();
            if (battle.getBattle_status_user() == 8 && battle.getUser_type() == 1 || battle.getBattle_status_user() == 9 && battle.getUser_type() == 2) {
                setDescText(R.string.text_battle_ban_title, R.string.text_battle_baned_desc, 0);
                setButtonDisable();
            } else {
                setDescText(
                        R.string.text_battle_ban_title,
                        R.string.text_battle_ban_desc,
                        R.string.text_battle_ban_notice
                );

                setBan();
            }
        } else if (battle.getBattle_status() == 4) { // 进行中
            setOperation();
            mSelected.clear();
            if (battle.getBattle_status_user() == 11 && battle.getUser_type() == 1 || battle.getBattle_status_user() == 12 && battle.getUser_type() == 2) {
                mLyDesc.setVisibility(View.VISIBLE);
                mTvTitle.setText(R.string.text_battle_submit_result);
                mTvDesc.setText(getSubmitResult());
                setButtonDisable();
            } else {
                setBPList();
                setSubmitButton();
            }
        } else if (battle.getBattle_status() == 5) { // 结束
            setUserStatus();
            setDescText("比赛结束", getResult(), "");

            if (battle.getWinner_id() == 1 && battle.getNext_battle_id() > 0) {
                mBtnSave.setText("进入下一轮");
                mBtnSave.setOnClickListener(v -> EventBus.getDefault().post(battle));
            } else if (battle.getIs_end()) {
                mBtnSave.setVisibility(View.GONE);
            } else {
                mBtnSave.setText("结束");
                mBtnSave.setOnClickListener(v -> {
                    Intent intent = new Intent(mActivity, BattleActivity.class);
                    intent.putExtra("battle_id", battle.getBattle_id());
                    mActivity.startActivity(intent);
                });
            }
        } else if (battle.getBattle_status() == 6) { // 争议
            setOperation();
            setDescText(R.string.text_battle_submit_result, R.string.text_battle_controversial_desc, 0);

            mBtnSave.setVisibility(View.VISIBLE);
            mBtnSave.setEnabled(true);
            mBtnSave.setText("重新提交");
            mBtnSave.setOnClickListener(v -> mProxy.cancelResult());
        }
    }

    // 设置用户状态
    private void setUserStatus() {
        mLyStatus.setVisibility(View.VISIBLE);
        mTvAStatus.setText(getUserStatusText(mBattle.getA_status()));
        mTvBStatus.setText(getUserStatusText(mBattle.getB_status()));
    }

    private void setOperation() {
        mLyOperation.setVisibility(View.VISIBLE);
        mTvOpponent.setText(mBattle.getUser_type() == 1 ? mBattle.getB_gameaccount() : mBattle.getA_gameaccount());
        mBtnCopy.setOnClickListener(v -> copyName(mTvOpponent.getText().toString().trim()));
        mTvContact.setOnClickListener(v -> mActivity.startActivity(new Intent(mActivity, ContactJudgeActivity.class)));
        mTvScreenshot.setOnClickListener(v -> toShot(mBattle));
        mTvChatroom.setOnClickListener(v -> {
            String qq = mBattle.getUser_type() == 1 ? mBattle.getB_qq() : mBattle.getA_qq();
            if (TextUtils.isEmpty(qq)) {
                LUtils.toast("对方未设置QQ");
            } else {
                Intent intent = new Intent();
                intent.setData(Uri.parse("mqqwpa://im/chat?chat_type=wpa&uin=" + qq));
                try {
                    mActivity.startActivity(intent);
                } catch (Exception e) {
                    LUtils.toast("未安装手Q或安装的版本不支持");
                }
            }
        });
    }

    // 显示Pick界面
    private void setPick() {
        mGridHeros.setVisibility(View.VISIBLE);
        mBtnSave.setVisibility(View.VISIBLE);

        BanPickAdapter adapter = new BanPickAdapter(mActivity);
        adapter.setOnItemClickListener(hero -> {
            if (mSelected.contains(hero)) {
                mSelected.remove(hero);
                adapter.select(hero);
            } else {
                if ((mBattle.getBattle_mode().equals("BO3") && mSelected.size() >= 3)
                        || (mBattle.getBattle_mode().equals("BO5") && mSelected.size() >= 4)) {
                    LUtils.toast("已达最大数量");
                } else {
                    mSelected.add(hero);
                    adapter.select(hero);
                }
            }
        });
        BPAdapter bpAdapter = new BPAdapter(mActivity);
        mGridHeros.setAdapter(adapter);

        mBtnSave.setText("提交");
        mBtnSave.setEnabled(true);
        mBtnSave.setOnClickListener(v -> {
            int count = mBattle.getBattle_mode().equals("BO5") ? 4 : 3;
            if (mSelected.size() != count) LUtils.toast("必须选择" + count + "个");
            else mProxy.pick(mSelected);
        });
    }

    // 设置Ban界面
    private void setBan() {
        mGridHeros.setVisibility(View.VISIBLE);
        mBtnSave.setVisibility(View.VISIBLE);

        List<Hero> list = new ArrayList<>();
        for (int i = 1; i < (mBattle.getBattle_mode().equals("BO5") ? 5 : 4); i++) {
            Hero hero = new Hero();
            try {
                Method method = mBattle.getClass().getMethod("get" + (mBattle.getUser_type() == 2 ? "A" : "B") + "_car" + i);
                int type = Integer.valueOf((String) method.invoke(mBattle));
                hero.setIndex(type);
            } catch (NoSuchMethodException e) {
                e.printStackTrace();
            } catch (InvocationTargetException e) {
                e.printStackTrace();
            } catch (IllegalAccessException e) {
                e.printStackTrace();
            }
            list.add(hero);
        }

        BanPickAdapter adapter = new BanPickAdapter(mActivity, list, BanPickAdapter.MODE_BAN);
        adapter.setOnItemClickListener(hero -> {
            if (mSelected.contains(hero)) {
                mSelected.remove(hero);
                adapter.select(hero);
            } else {
                if (mSelected.size() >= 1) {
                    LUtils.toast("只能Ban一个");
                } else {
                    mSelected.add(hero);
                    adapter.select(hero);
                }
            }
        });

        mGridHeros.removeAllViews();
        mGridHeros.setAdapter(adapter);
        mBtnSave.setText("提交");
        mBtnSave.setEnabled(true);
        mBtnSave.setOnClickListener(v -> {
            if (mSelected.size() != 1) LUtils.toast("必须Ban一个英雄");
            else mProxy.ban(mSelected.get(0).getIndex());
        });
    }

    // 设置按钮不可用
    private void setButtonDisable() {
        mBtnSave.setVisibility(View.VISIBLE);
        mBtnSave.setText("已提交");
        mBtnSave.setEnabled(false);
    }

    // 设置提交结果按钮
    private void setSubmitButton() {
        mBtnSave.setVisibility(View.GONE);
        mLyResult.setVisibility(View.VISIBLE);
        mBtnImWin.setOnClickListener(v -> showSubmitResultDialog(mBtnImWin.getText().toString().trim(), mBattle.getUser_type() == 1 ? mBattle.getA_user_id() : mBattle.getB_user_id()));
        mBtnImLost.setOnClickListener(v -> showSubmitResultDialog(mBtnImLost.getText().toString().trim(), mBattle.getUser_type() == 2 ? mBattle.getA_user_id() : mBattle.getB_user_id()));
    }

    // 显示两个用户BP列表
    private void setBPList() {
        mLyOngoing.setVisibility(View.VISIBLE);

        if (!mBattle.getBattle_mode().equals("BO1")) {
            mTvAAccount.setText(mBattle.getA_gameaccount());
            mTvBAccount.setText(mBattle.getB_gameaccount());

            List<Hero> listA = new ArrayList<>();
            List<Hero> listB = new ArrayList<>();
            for (int i = 1; i < (mBattle.getBattle_mode().equals("BO5") ? 5 : 4); i++) {
                Hero heroA = new Hero();
                Hero heroB = new Hero();
                try {
                    String carA = (String) mBattle.getClass().getMethod("getA_" + "car" + i).invoke(mBattle);
                    heroA.setIndex(Integer.valueOf(carA));
                    heroA.setBan(carA.equals(mBattle.getA_ban()));

                    String carB = (String) mBattle.getClass().getMethod("getB_" + "car" + i).invoke(mBattle);
                    heroB.setIndex(Integer.valueOf(carB));
                    heroB.setBan(carB.equals(mBattle.getB_ban()));

//                    com.miguan.otk.model.constant.Hero hero = com.miguan.otk.model.constant.Hero.getHeroFromType(Integer.valueOf(carA));
//                    hero.setIsCheck(carA.equals(mBattle.getA_ban()));
                } catch (NoSuchMethodException e) {
                    e.printStackTrace();
                } catch (InvocationTargetException e) {
                    e.printStackTrace();
                } catch (IllegalAccessException e) {
                    e.printStackTrace();
                }
                listA.add(heroA);
                listB.add(heroB);
            }

            BanPickAdapter adapterA = new BanPickAdapter(mActivity, listA, BanPickAdapter.MODE_SHOW);
            mGridABans.removeAllViews();
            mGridABans.setAdapter(adapterA);

            BanPickAdapter adapterB = new BanPickAdapter(mActivity, listB, BanPickAdapter.MODE_SHOW);
            mGridBBans.removeAllViews();
            mGridBBans.setAdapter(adapterB);
        }

    }

    // 设置描述文本
    private void setDescText(int titleRes, int descRes, int noticeRes) {
        mLyDesc.setVisibility(View.VISIBLE);
        mTvTitle.setText(mActivity.getString(titleRes));
        mTvDesc.setText(mActivity.getString(descRes));
        if (noticeRes > 0) {
            mTvNotice.setVisibility(View.VISIBLE);
            mTvNotice.setText(mActivity.getString(noticeRes));
        } else {
            mTvNotice.setVisibility(View.GONE);
        }
    }

    // 设置描述文本
    private void setDescText(String title, String desc, String notice) {
        mLyDesc.setVisibility(View.VISIBLE);
        mTvTitle.setText(title);
        mTvDesc.setText(desc);
        if (TextUtils.isEmpty(notice)) {
            mTvNotice.setVisibility(View.GONE);
        } else {
            mTvNotice.setVisibility(View.VISIBLE);
            mTvNotice.setText(notice);
        }
    }

    // 隐藏所有布局
    private void hideAllLayout() {
        mLyStatus.setVisibility(View.GONE);
        mLyOperation.setVisibility(View.GONE);
        mLyDesc.setVisibility(View.GONE);
        mGridHeros.setVisibility(View.GONE);
        mLyOngoing.setVisibility(View.GONE);
        mLyResult.setVisibility(View.GONE);
        mBtnSave.setVisibility(View.GONE);
    }

    // 获取用户状态
    private String getUserStatusText(String userStatus) {
        if (TextUtils.isEmpty(userStatus)) return mBattle.getBattle_status() == 1 ? "未准备" : "失败";
        if (userStatus.equals("准备")) return "已准备";
        return userStatus;
    }

    // 获取提交结果
    private String getSubmitResult() {
        String result = mBattle.getUser_type() == 1 ? mBattle.getA_battle_record() : mBattle.getB_battle_record();
        String username = result.equals("a") ? mBattle.getA_username() : mBattle.getB_username();
        return String.format(mActivity.getString(R.string.text_battle_submit_result_desc), mBattle.getBattle_times(), username);
    }

    // 获取比赛结果
    private String getResult() {
        if (mBattle.getWinner_id() <= 0) return "双方比赛超时没有人获得胜利";

        return String.format(mActivity.getString(R.string.text_battle_ended_desc), mBattle.getWinner_id() == mBattle.getA_user_id() ? mBattle.getA_username() : mBattle.getB_username());
    }

    // 显示提交结果确认窗口
    private void showSubmitResultDialog(String msg, int winnerID) {
        new AlertDialog.Builder(mActivity)
                .setTitle("是否提交比赛结果")
                .setMessage(msg)
                .setNegativeButton(R.string.btn_cancel, null)
                .setPositiveButton(R.string.btn_ok, (dialog, which) -> mProxy.submitResult(winnerID))
                .show();
    }

    public void copyName(String name) {
        ClipboardManager cm = (ClipboardManager) (mActivity).getSystemService(Context.CLIPBOARD_SERVICE);
        cm.setPrimaryClip(ClipData.newPlainText(null, name));
        LUtils.toast("复制成功");
    }

    public void toShot(Battle battle) {
        Intent intent = new Intent(mActivity, ShotDetailActivity.class);
        intent.putExtra("battle", battle);
        mActivity.startActivity(intent);
    }

}
<file_sep>package com.miguan.otk.module.battle;

import android.content.Intent;
import android.net.Uri;

import com.dsk.chain.bijection.Presenter;
import com.miguan.otk.model.constant.QQAction;
import com.miguan.otk.utils.LUtils;


/**
 * Copyright (c) 2017/1/6. LiaoPeiKun Inc. All rights reserved.
 */

public class ContactJudgePresenter extends Presenter<ContactJudgeActivity> {

    public void startQQ() {
        Intent intent = new Intent();
        intent.setData(Uri.parse(QQAction.Service));
        try {
            getView().startActivity(intent);
        } catch (Exception e) {
            LUtils.toast("未安装手Q或安装的版本不支持");
        }
    }

    public void joinQQGroup() {
        Intent intent = new Intent();
        intent.setData(Uri.parse(QQAction.Group));
        // 此Flag可根据具体产品需要自定义，如设置，则在加群界面按返回，返回手Q主界面，不设置，按返回会返回到呼起产品界面
//        intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        try {
            getView().startActivity(intent);
        } catch (Exception e) {
            LUtils.toast("未安装手Q或安装的版本不支持");
        }
    }

}
<file_sep>package com.miguan.otk.module.store;

import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.dsk.chain.bijection.RequiresPresenter;
import com.dsk.chain.expansion.data.BaseDataActivity;
import com.facebook.drawee.view.SimpleDraweeView;
import com.miguan.otk.R;
import com.miguan.otk.model.bean.Address;
import com.miguan.otk.model.bean.Order;
import com.miguan.otk.module.user.AddressListActivity;

import butterknife.Bind;
import butterknife.ButterKnife;

@RequiresPresenter(PayPresenter.class)
public class PayActivity extends BaseDataActivity<PayPresenter, Order> {

    @Bind(R.id.layout_order_address)
    LinearLayout mLayoutAddress;

    @Bind(R.id.tv_address_consignee)
    TextView mTvConsignee;

    @Bind(R.id.tv_address_mobile)
    TextView mTvMobile;

    @Bind(R.id.tv_address_info)
    TextView mTvAddress;

    @Bind(R.id.dv_goods_thumb)
    SimpleDraweeView mDvThumb;

    @Bind(R.id.tv_goods_name)
    TextView mTvName;

    @Bind(R.id.tv_goods_spec)
    TextView mTvSpec;

    @Bind(R.id.tv_goods_price)
    TextView mTvPrice;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.store_activity_pay);
        setToolbarTitle(R.string.title_activity_pay);
        ButterKnife.bind(this);
    }

    @Override
    public void setData(Order order) {
        mLayoutAddress.setOnClickListener(v -> startActivityForResult(new Intent(this, AddressListActivity.class), 0));
        setAddress(order.getAddress());
        mTvSpec.setText(order.getSpec());
        mTvPrice.setText(order.getGoods().getGoods_price());
        mTvName.setText(order.getGoods().getGoods_name());
        mDvThumb.setImageURI(Uri.parse(order.getGoods().getGoods_image_url()));
    }

    public void setAddress(Address address) {
        mTvConsignee.setText(String.format(getResources().getString(R.string.label_consignee), address.getTrue_name()));
        mTvMobile.setText(address.getMob_phone());
        mTvAddress.setText(String.format(getString(R.string.label_consignee_address), address.getAddress()));
    }

}
<file_sep>package com.miguan.otk.module.battle;

import android.os.Bundle;
import android.widget.TextView;

import com.dsk.chain.bijection.ChainBaseActivity;
import com.dsk.chain.bijection.RequiresPresenter;
import com.miguan.otk.R;

import butterknife.Bind;
import butterknife.ButterKnife;

@RequiresPresenter(ContactJudgePresenter.class)
public class ContactJudgeActivity extends ChainBaseActivity<ContactJudgePresenter> {

    @Bind(R.id.tv_judge_qq)
    TextView mTvQQ;

    @Bind(R.id.tv_judge_qq_group)
    TextView mTvQQGroup;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.against_activity_contact_judge);
        setToolbarTitle(R.string.title_activity_contact_judge);
        ButterKnife.bind(this);

        mTvQQ.setOnClickListener(v -> getPresenter().startQQ());
        mTvQQGroup.setOnClickListener(v -> getPresenter().joinQQGroup());
    }

}
<file_sep>package com.miguan.otk.module.league;

import android.os.Bundle;

import com.dsk.chain.bijection.ChainBaseActivity;
import com.dsk.chain.bijection.RequiresPresenter;
import com.miguan.otk.R;

import butterknife.ButterKnife;

@RequiresPresenter(AddLeaguePresenter.class)
public class AddLeagueActivity extends ChainBaseActivity<AddLeaguePresenter> {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.league_activity_add);
        setToolbarTitle(R.string.title_activity_league_add);
        ButterKnife.bind(this);


    }
}
<file_sep>package com.miguan.otk.module.battle;

import android.net.Uri;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;

import com.dsk.chain.bijection.ChainBaseActivity;
import com.dsk.chain.bijection.RequiresPresenter;
import com.facebook.drawee.view.SimpleDraweeView;
import com.miguan.otk.R;

import butterknife.Bind;
import butterknife.ButterKnife;

@RequiresPresenter(ShotBrowsePresenter.class)
public class ShotBrowseActivity extends ChainBaseActivity<ShotBrowsePresenter> {

    @Bind(R.id.dv_image_browse)
    SimpleDraweeView mDvImage;

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

        Uri uri = getIntent().getParcelableExtra("uri");
        mDvImage.setImageURI(uri);
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        int battleID = getIntent().getIntExtra("battle_id", 0);
        if (battleID > 0) getMenuInflater().inflate(R.menu.menu_save, menu);
        return super.onCreateOptionsMenu(menu);
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        getPresenter().upload();
        return super.onOptionsItemSelected(item);
    }
}
<file_sep>include ':app', ':chain', ':PushSDK', ':umshare'
<file_sep>package com.miguan.otk.module.match;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import com.dsk.chain.bijection.RequiresPresenter;
import com.dsk.chain.expansion.list.BaseListFragment;
import com.dsk.chain.expansion.list.ListConfig;
import com.jude.easyrecyclerview.adapter.BaseViewHolder;
import com.miguan.otk.R;
import com.miguan.otk.adapter.viewholder.ScheduleViewHolder;
import com.miguan.otk.model.bean.Schedule;

import butterknife.Bind;
import butterknife.ButterKnife;

/**
 * Copyright (c) 2016/12/22. LiaoPeiKun Inc. All rights reserved.
 */
@RequiresPresenter(ScheduleListPresenter.class)
public class ScheduleListFragment extends BaseListFragment<ScheduleListPresenter, Schedule> {

    @Bind(R.id.tv_schedule_round)
    TextView mTvRound;

    @Bind(R.id.iv_schedule_left)
    ImageView mIvLeft;

    @Bind(R.id.iv_schedule_right)
    ImageView mIvRight;

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        View view = super.onCreateView(inflater, container, savedInstanceState);
        ButterKnife.bind(this, view);
        return view;
    }

    public void setData(Schedule schedule) {
        mTvRound.setText(String.format(getString(R.string.text_which_rounds), schedule.getRound() + 1));
        if (schedule.getRound() >= schedule.getRound_count()) {
            mIvRight.setVisibility(View.INVISIBLE);
        } else {
            mIvRight.setVisibility(View.VISIBLE);
            mIvRight.setOnClickListener(v -> getPresenter().changeRound(1));
        }
        if (schedule.getRound() == 0) {
            mIvLeft.setVisibility(View.INVISIBLE);
        } else {
            mIvLeft.setVisibility(View.VISIBLE);
            mIvLeft.setOnClickListener(v -> getPresenter().changeRound(-1));
        }
    }

    @Override
    public BaseViewHolder<Schedule> createViewHolder(ViewGroup parent, int viewType) {
        return new ScheduleViewHolder(parent);
    }

    @Override
    public int getLayout() {
        return R.layout.match_fragment_schedule_list;
    }

    @Override
    public ListConfig getListConfig() {
        return super.getListConfig()
                .setContainerEmptyRes(R.layout.empty_against_list)
                .hasItemDecoration(false)
                .setLoadMoreAble(false)
                .setRefreshAble(false)
                .setNoMoreAble(false);
    }

}
<file_sep>apply plugin: 'com.android.application'
apply plugin: 'me.tatarka.retrolambda' // lambda插件

Properties properties = new Properties();
properties.load(new FileInputStream(file("../config/signing.properties")))

android {
    compileSdkVersion 25
    buildToolsVersion "25.0.2"
    defaultConfig {
        applicationId "com.miguan.otk"
        minSdkVersion 15
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    signingConfigs {
        release {
            keyAlias properties['KEY_ALIAS']
            keyPassword properties['KEY_PASSWORD']
            storeFile file(properties['KEYSTORE_FILE'])
            storePassword properties['KEY_PASSWORD']
        }
        debug {
            storeFile file('debug.keystore')
            storePassword "<PASSWORD>"
            keyAlias "androiddebugkey"
            keyPassword "<PASSWORD>"
        }
    }
    buildTypes {
        release {
            minifyEnabled false
            signingConfig signingConfigs.debug
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
        debug {
            minifyEnabled false
            signingConfig signingConfigs.debug
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
}

dependencies {
    // 日历控件

    //    compile 'com.squareup.okhttp3:logging-interceptor:3.1.2'
    //    compile 'com.squareup.okhttp3:okhttp:3.5.0'
    //    compile 'com.android.support:gridlayout-v7:25.1.1'
    compile fileTree(include: ['*.jar'], dir: 'libs')
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile project(':chain')
    compile project(':PushSDK')
    compile project(':umshare')
    final RETROFIT_VERSION = '2.1.0'
    compile "com.squareup.retrofit2:retrofit:$RETROFIT_VERSION"
    compile "com.squareup.retrofit2:converter-gson:$RETROFIT_VERSION"
    compile "com.squareup.retrofit2:adapter-rxjava:$RETROFIT_VERSION"
    compile 'com.facebook.fresco:fresco:0.14.1'
    compile 'org.greenrobot:eventbus:3.0.0'
    compile 'com.jude:imageprovider:2.1.1'
    compile 'com.jude:exgridview:1.1.5'
    compile 'com.prolificinteractive:material-calendarview:1.4.2'
    compile 'com.android.support:cardview-v7:25.2.0'
    compile 'com.android.support:design:25.2.0'
    compile 'com.jakewharton:butterknife:7.0.1'
    testCompile 'junit:junit:4.12'
}
<file_sep>package com.miguan.otk.module.main;

import android.content.Intent;
import android.os.Bundle;
import android.os.CountDownTimer;
import android.widget.Button;

import com.dsk.chain.bijection.ChainBaseActivity;
import com.dsk.chain.bijection.RequiresPresenter;
import com.facebook.drawee.view.SimpleDraweeView;
import com.miguan.otk.R;
import com.miguan.otk.model.bean.Splash;

import butterknife.Bind;
import butterknife.ButterKnife;

@RequiresPresenter(AdPresenter.class)
public class AdActivity extends ChainBaseActivity<AdPresenter> {

    @Bind(R.id.dv_ad_image)
    SimpleDraweeView mDvImage;

    @Bind(R.id.btn_ad_skip)
    Button mBtnSkip;

    private CountDownTimer mDownTimer;

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

        mBtnSkip.setOnClickListener(v -> {
            mDownTimer.cancel();
            startActivity(new Intent(this, MainActivity.class));
            finish();
        });
        setData();
    }

    private void setData() {
        Splash splash = getIntent().getParcelableExtra("splash");
        mDvImage.setImageURI(splash.getImg_and());
        mBtnSkip.setText(String.format(getString(R.string.btn_skip), splash.getShow_time()));
        mDownTimer = new CountDownTimer(splash.getShow_time() * 1000, 1000) {

            @Override
            public void onTick(long millisUntilFinished) {
                mBtnSkip.setText(String.format(getString(R.string.btn_skip), millisUntilFinished / 1000));
            }

            @Override
            public void onFinish() {
                getPresenter().skip();
            }

        }.start();
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        mDownTimer.cancel();
    }

}
<file_sep>package com.miguan.otk.module.user;

import android.view.ViewGroup;

import com.dsk.chain.bijection.RequiresPresenter;
import com.dsk.chain.expansion.list.BaseListActivity;
import com.dsk.chain.expansion.list.ListConfig;
import com.jude.easyrecyclerview.adapter.BaseViewHolder;
import com.miguan.otk.R;
import com.miguan.otk.adapter.viewholder.AreaViewHolder;
import com.miguan.otk.model.bean.Area;

/**
 * Copyright (c) 2017/1/19. LiaoPeiKun Inc. All rights reserved.
 */

@RequiresPresenter(AreaPresenter.class)
public class AreaActivity extends BaseListActivity<AreaPresenter> {

    @Override
    public BaseViewHolder<Area> createViewHolder(ViewGroup parent, int viewType) {
        return new AreaViewHolder(parent);
    }

    @Override
    protected int getLayout() {
        return R.layout.activity_toolbar_list;
    }

    @Override
    public ListConfig getListConfig() {
        return super.getListConfig().setLoadMoreAble(false).setNoMoreAble(false).setRefreshAble(false);
    }
}
<file_sep>package com.miguan.otk.module.main;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.design.widget.TabLayout;
import android.support.v4.app.Fragment;
import android.support.v4.view.ViewPager;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.dsk.chain.bijection.ChainFragment;
import com.dsk.chain.bijection.RequiresPresenter;
import com.miguan.otk.R;
import com.miguan.otk.adapter.TitlePagerAdapter;
import com.miguan.otk.module.news.NewsListFragment;

import java.util.ArrayList;
import java.util.List;

import butterknife.Bind;
import butterknife.ButterKnife;

/**
 * Copyright (c) 2016/12/15. LiaoPeiKun Inc. All rights reserved.
 */
@RequiresPresenter(MainNewsPresenter.class)
public class MainNewsFragment extends ChainFragment<MainNewsPresenter> {

    @Bind(R.id.tab_main_news)
    TabLayout mTabLayout;

    @Bind(R.id.pager_main_news)
    ViewPager mPager;

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.main_fragment_news, container, false);
        ButterKnife.bind(this, view);

        List<Fragment> fragments = new ArrayList<>();
        for (int i = 1; i < getResources().getStringArray(R.array.tab_news_list).length + 1; i++) {
            NewsListFragment fragment = new NewsListFragment();
            Bundle bundle = new Bundle();
            bundle.putInt("type", i);
            fragment.setArguments(bundle);
            fragments.add(fragment);
        }

        mPager.setAdapter(new TitlePagerAdapter(getActivity(), R.array.tab_news_list, fragments, getChildFragmentManager()));
        mTabLayout.setupWithViewPager(mPager);

        return view;
    }

    @Override
    public void setMenuVisibility(boolean menuVisible) {
        super.setMenuVisibility(menuVisible);
        if (getView() != null) {
            getView().setVisibility(menuVisible ? View.VISIBLE : View.GONE);
        }
    }

}
<file_sep>package com.miguan.otk.model;

import com.dsk.chain.model.AbsModel;
import com.miguan.otk.model.bean.News;
import com.miguan.otk.model.services.DefaultTransform;
import com.miguan.otk.model.services.ServicesClient;

import java.util.List;

import rx.Observable;

/**
 * Copyright (c) 2017/1/10. LiaoPeiKun Inc. All rights reserved.
 */

public class NewsModel extends AbsModel {

    public static NewsModel getInstance() {
        return getInstance(NewsModel.class);
    }

    public Observable<List<News>> getNewsList(int type, int page) {
        return ServicesClient.getServices().newsList(type, page).compose(new DefaultTransform<>());
    }

}
<file_sep>package com.miguan.otk.module.user;

import android.os.Bundle;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.dsk.chain.bijection.RequiresPresenter;
import com.dsk.chain.expansion.data.BaseDataActivity;
import com.miguan.otk.R;
import com.miguan.otk.model.bean.Message;

import java.util.List;

import butterknife.Bind;
import butterknife.ButterKnife;

@RequiresPresenter(MessagePresenter.class)
public class MessageActivity extends BaseDataActivity<MessagePresenter, List<Message>> {

    @Bind(R.id.ly_message_system)
    RelativeLayout mLySystem;

    @Bind(R.id.tv_message_system)
    TextView mTvSystem;

    @Bind(R.id.tv_message_match)
    TextView mTvMatch;

    @Bind(R.id.ly_message_match)
    RelativeLayout mLyMatch;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.user_activity_message);
        setToolbarTitle(R.string.title_activity_message);
        ButterKnife.bind(this);

        mLySystem.setOnClickListener(v -> getPresenter().showMessageList(1));
        mLyMatch.setOnClickListener(v -> getPresenter().showMessageList(2));
    }

    @Override
    public void setData(List<Message> messages) {
        if (messages.size() > 0) mTvSystem.setText(messages.get(0).getContent());
        if (messages.size() > 1) mTvMatch.setText(messages.get(1).getContent());
    }
}
<file_sep>package com.miguan.otk.module.user;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;

import com.dsk.chain.expansion.list.BaseListActivityPresenter;
import com.miguan.otk.model.bean.Address;

import java.util.ArrayList;
import java.util.List;

import rx.Observable;

/**
 * Copyright (c) 2016/12/19. LiaoPeiKun Inc. All rights reserved.
 */

public class AddressListPresenter extends BaseListActivityPresenter<AddressListActivity, Address> {

    /**
     * 选择模式，在订单确认页面中
     */
    public static final int TYPE_CHOICE = 0x100;

    /**
     * 列表浏览模式
     */
    public static final int TYPE_LIST = 0x200;

    private int mType;

    @Override
    protected void onCreate(AddressListActivity view, Bundle saveState) {
        super.onCreate(view, saveState);
        mType = getView().getIntent().getIntExtra("type", 0);
        getAdapter().setOnItemClickListener(position -> {
            Intent intent = new Intent();
            intent.putExtra("address", getAdapter().getItem(position));
            getView().setResult(Activity.RESULT_OK, intent);
            getView().finish();
        });
    }

    @Override
    protected void onCreateView(AddressListActivity view) {
        super.onCreateView(view);
        onRefresh();
    }

    @Override
    public void onRefresh() {
        List<Address> list = new ArrayList<>();
        for (int i=0; i<10; i++) {
            Address address = new Address();
            address.setTrue_name("廖培坤");
            address.setCity("福建省  厦门市");
            address.setMob_phone("13215698921");
            address.setAddress("思明区望海路16号之一301米冠网络");
            list.add(address);
        }
        Observable.just(list).unsafeSubscribe(getRefreshSubscriber());
    }
}
<file_sep>package com.miguan.otk.model.bean;

import android.os.Parcel;
import android.os.Parcelable;

/**
 * Copyright (c) 2017/1/13. LiaoPeiKun Inc. All rights reserved.
 */

public class Splash implements Parcelable {

    private String url;

    private String img;

    private String img_and;

    private String img_ios;

    private int show_time;

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(this.url);
        dest.writeString(this.img);
        dest.writeString(this.img_and);
        dest.writeString(this.img_ios);
        dest.writeInt(this.show_time);
    }

    public Splash() {
    }

    protected Splash(Parcel in) {
        this.url = in.readString();
        this.img = in.readString();
        this.img_and = in.readString();
        this.img_ios = in.readString();
        this.show_time = in.readInt();
    }

    public static final Creator<Splash> CREATOR = new Creator<Splash>() {
        @Override
        public Splash createFromParcel(Parcel source) {
            return new Splash(source);
        }

        @Override
        public Splash[] newArray(int size) {
            return new Splash[size];
        }
    };

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public String getImg() {
        return img;
    }

    public void setImg(String img) {
        this.img = img;
    }

    public String getImg_and() {
        return img_and;
    }

    public void setImg_and(String img_and) {
        this.img_and = img_and;
    }

    public String getImg_ios() {
        return img_ios;
    }

    public void setImg_ios(String img_ios) {
        this.img_ios = img_ios;
    }

    public int getShow_time() {
        return show_time;
    }

    public void setShow_time(int show_time) {
        this.show_time = show_time;
    }
}
<file_sep>package com.miguan.otk.module.user;

import android.os.Bundle;
import android.text.InputFilter;
import android.text.InputType;
import android.text.TextUtils;
import android.view.Gravity;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.dsk.chain.bijection.ChainBaseActivity;
import com.dsk.chain.bijection.RequiresPresenter;
import com.miguan.otk.R;
import com.miguan.otk.model.bean.User;
import com.miguan.otk.utils.LUtils;

import butterknife.Bind;
import butterknife.ButterKnife;

@RequiresPresenter(ProfileModifyPresenter.class)
public class ProfileModifyActivity extends ChainBaseActivity<ProfileModifyPresenter> {

    @Bind(R.id.tv_profile_modify_label)
    TextView mTvLabel;

    @Bind(R.id.et_profile_modify_input)
    EditText mEtInput;

    @Bind(R.id.btn_profile_modify_submit)
    Button mBtnSubmit;

    private User mUser;

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

        mUser = getIntent().getParcelableExtra("user");
        setLayout();
    }

    private void setLayout() {
        switch (getIntent().getIntExtra("type", 0)) {
            case 0:
                setToolbarTitle(R.string.label_qq);
                mTvLabel.setText(R.string.label_qq);
                mEtInput.setHint(R.string.hint_qq);
                mEtInput.setInputType(InputType.TYPE_CLASS_NUMBER);
                mEtInput.setFilters(new InputFilter[]{new InputFilter.LengthFilter(13)});
                if (!TextUtils.isEmpty(mUser.getQq())) {
                    mEtInput.setText(mUser.getQq());
                    mEtInput.setSelection(mUser.getQq().length());
                }
                mBtnSubmit.setOnClickListener(v -> checkInput("qq"));
                break;
            case 1:
                setToolbarTitle(R.string.label_email);
                mTvLabel.setText(R.string.label_email);
                mEtInput.setInputType(InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS);
                mEtInput.setHint(R.string.hint_email);
                if (!TextUtils.isEmpty(mUser.getEmail())) {
                    mEtInput.setText(mUser.getEmail());
                    mEtInput.setSelection(mUser.getEmail().length());
                }
                mBtnSubmit.setOnClickListener(v -> checkInput("email"));
                break;
            case 2:
                setToolbarTitle(R.string.label_introduction);
                mTvLabel.setText(R.string.label_introduction);
                if (!TextUtils.isEmpty(mUser.getSign())) {
                    mEtInput.setText(mUser.getSign());
                    mEtInput.setSelection(mEtInput.getText().length());
                }
                mEtInput.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, LUtils.dp2px(128)));
                mEtInput.setGravity(Gravity.TOP & Gravity.START);
                int padding = (int) getResources().getDimension(R.dimen.horizontal_margin);
                mEtInput.setPadding(padding, padding, padding, padding);
                mEtInput.setHint(R.string.hint_introduction);
                mBtnSubmit.setOnClickListener(v -> checkInput("sign"));
                break;
        }
    }

    private void checkInput(String key) {
        if (TextUtils.isEmpty(mEtInput.getText().toString().trim())) {
            LUtils.toast("请输入内容");
            return;
        }
        getPresenter().submit(key, mEtInput.getText().toString().trim());
    }

}
<file_sep>package com.miguan.otk.module.main;

import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;

import com.dsk.chain.bijection.RequiresPresenter;
import com.dsk.chain.expansion.data.BaseDataFragment;
import com.miguan.otk.R;
import com.miguan.otk.model.bean.League;
import com.miguan.otk.module.league.AddLeagueActivity;
import com.miguan.otk.module.league.LeagueDetailActivity;

import butterknife.Bind;
import butterknife.ButterKnife;

/**
 * Created by LPK on 2016/11/22.
 */
@RequiresPresenter(MainLeaguePresenter.class)
public class MainLeagueFragment extends BaseDataFragment<MainLeaguePresenter, League> {

    @Bind(R.id.tv_league_detail)
    Button mBtnDetail;

    @Bind(R.id.tv_league_add)
    Button mBtnAdd;

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.main_fragment_league, null);
        ButterKnife.bind(this, view);

        mBtnDetail.setOnClickListener(v -> startActivity(new Intent(getActivity(), LeagueDetailActivity.class)));
        mBtnAdd.setOnClickListener(v -> startActivity(new Intent(getActivity(), AddLeagueActivity.class)));

        return view;
    }

    @Override
    public void setMenuVisibility(boolean menuVisible) {
        super.setMenuVisibility(menuVisible);
        if (getView() != null) {
            getView().setVisibility(menuVisible ? View.VISIBLE : View.GONE);
        }
    }

}
<file_sep>package com.miguan.otk.module.user;

import android.app.AlertDialog;
import android.app.DatePickerDialog;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.support.design.widget.BottomSheetDialog;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.dsk.chain.bijection.RequiresPresenter;
import com.dsk.chain.expansion.data.BaseDataActivity;
import com.facebook.drawee.view.SimpleDraweeView;
import com.jude.exgridview.ExGridView;
import com.miguan.otk.R;
import com.miguan.otk.model.bean.User;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.Locale;

import butterknife.Bind;
import butterknife.ButterKnife;

@RequiresPresenter(ProfilePresenter.class)
public class ProfileActivity extends BaseDataActivity<ProfilePresenter, User> {

    @Bind(R.id.ly_profile_avatar)
    LinearLayout mLyAvatar;

    @Bind(R.id.dv_profile_avatar)
    SimpleDraweeView mDvAvatar;

    @Bind(R.id.tv_profile_username)
    TextView mTvUsername;

    @Bind(R.id.tv_profile_uid)
    TextView mTvUid;

    @Bind(R.id.tv_profile_qq)
    TextView mTvQQ;

    @Bind(R.id.tv_profile_email)
    TextView mTvEmail;

    @Bind(R.id.tv_profile_job)
    TextView mTvJob;

    @Bind(R.id.tv_profile_born)
    TextView mTvBorn;

    @Bind(R.id.tv_profile_area)
    TextView mTvArea;

    @Bind(R.id.tv_profile_intro)
    TextView mTvIntro;

    private BottomSheetDialog mDialog;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.user_activity_profile);
        setToolbarTitle(R.string.title_activity_profile);
        ButterKnife.bind(this);

        mLyAvatar.setOnClickListener(v -> showPickDialog());
        mTvArea.setOnClickListener(v -> startActivityForResult(new Intent(this, AreaActivity.class), 2));
    }

    @Override
    public void setData(User user) {
        setAvatar(Uri.parse(user.getPhoto()));
        mTvUsername.setText(user.getUsername());
        mTvUid.setText(String.format("%s", user.getUid()));
        mTvQQ.setText(user.getQq());
        mTvEmail.setText(user.getEmail());
        mTvJob.setText(user.getActuality());
        mTvJob.setOnClickListener(v -> showJobItems());
        mTvBorn.setText(user.getBirthday());
        mTvBorn.setOnClickListener(v -> showDatePick());
        mTvArea.setText(String.format("%1$s %2$s %3$s", user.getProvince(), user.getCity(), user.getArea()));
        mTvIntro.setText(user.getSign());
        mTvQQ.setOnClickListener(v -> getPresenter().toModify(user, 0));
        mTvEmail.setOnClickListener(v -> getPresenter().toModify(user, 1));
        mTvIntro.setOnClickListener(v -> getPresenter().toModify(user, 2));
    }

    public void setAvatar(Uri uri) {
        mDvAvatar.setImageURI(uri);
    }

    private void showPickDialog() {
        if (mDialog == null) {
            mDialog = new BottomSheetDialog(this);

            View view = View.inflate(this, R.layout.dialog_bottom_pick_picture, null);
            Button btnGallery = (Button) view.findViewById(R.id.btn_pick_from_gallery);
            Button btnCamera = (Button) view.findViewById(R.id.btn_pick_from_camera);
            Button btnDefault = (Button) view.findViewById(R.id.btn_pick_from_default);
            Button btnCancel = (Button) view.findViewById(R.id.btn_pick_cancel);

            btnDefault.setVisibility(View.VISIBLE);
            btnGallery.setOnClickListener(v -> getPresenter().pickImage(0));
            btnCamera.setOnClickListener(v -> getPresenter().pickImage(1));
            btnDefault.setOnClickListener(v -> showDefaultDialog());
            btnCancel.setOnClickListener(v -> dismissDialog());
            mDialog.setContentView(view);
            mDialog.getWindow().findViewById(R.id.design_bottom_sheet).setBackgroundResource(android.R.color.transparent);
        }
        mDialog.show();
    }

    public void showJobItems() {
        new AlertDialog.Builder(this).setItems(R.array.items_profile_jobs, (dialog, which) -> {
            mTvJob.setText(getResources().getStringArray(R.array.items_profile_jobs)[which]);
            getPresenter().setProfile("actuality", which + "");
        }).show();
    }

    public void showDatePick() {
        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd", Locale.CHINA);
        try {
            Date date = format.parse(mTvBorn.getText().toString().trim().isEmpty() ? "1970-01-01" : mTvBorn.getText().toString().trim());
            Calendar calendar = Calendar.getInstance();
            calendar.setTime(date);
            DatePickerDialog dialog = new DatePickerDialog(this,
                    (datePicker, year, monthOfYear, dayOfMonth) -> {
                        String born = year + "-" + String.format("%02d", monthOfYear + 1) + "-" + dayOfMonth;
                        mTvBorn.setText(born);
                        getPresenter().setProfile("birthday", born);
                    },
                    calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH), calendar.get(Calendar.DATE));
            dialog.show();
        } catch (ParseException e) {
            e.printStackTrace();
        }
    }

    private void showDefaultDialog() {
        View view = View.inflate(this, R.layout.dialog_default_avatar, null);
        AlertDialog dialog = new AlertDialog.Builder(this).setView(view).show();
        ExGridView gridView = (ExGridView) view.findViewById(R.id.grid_default_avatar);
        String[] urlList = getResources().getStringArray(R.array.default_avatar_urls);
        for (int i=0; i<urlList.length; i++) {
            ImageView iv = new ImageView(this);
            String avatar = urlList[i];
            iv.setImageResource(getResources().getIdentifier("default_avatar_" + i, "mipmap", getPackageName()));
            iv.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));
            iv.setOnClickListener(clickView -> {
                getPresenter().setProfile("photo", avatar);
                dialog.dismiss();
            });
            gridView.addView(iv);
        }
        view.findViewById(R.id.btn_default_avatar_cancel).setOnClickListener(v -> dialog.dismiss());
    }

    public void dismissDialog() {
        if (null != mDialog && mDialog.isShowing()) mDialog.dismiss();
    }

}
<file_sep>package com.miguan.otk.model.bean;

import android.os.Parcel;
import android.os.Parcelable;

/**
 * Copyright (c) 2017/1/13. LiaoPeiKun Inc. All rights reserved.
 */

public class Version implements Parcelable {

    private String version_number;

    /**
     * (0:不升级，1:提醒升级，2:强制升级)
     */
    private int type;

    private String apk_url;

    private String upgrade_content;

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(this.version_number);
        dest.writeInt(this.type);
        dest.writeString(this.apk_url);
        dest.writeString(this.upgrade_content);
    }

    public Version() {
    }

    protected Version(Parcel in) {
        this.version_number = in.readString();
        this.type = in.readInt();
        this.apk_url = in.readString();
        this.upgrade_content = in.readString();
    }

    public static final Creator<Version> CREATOR = new Creator<Version>() {
        @Override
        public Version createFromParcel(Parcel source) {
            return new Version(source);
        }

        @Override
        public Version[] newArray(int size) {
            return new Version[size];
        }
    };

    public String getVersion_number() {
        return version_number;
    }

    public void setVersion_number(String version_number) {
        this.version_number = version_number;
    }

    public int getType() {
        return type;
    }

    public void setType(int type) {
        this.type = type;
    }

    public String getApk_url() {
        return apk_url;
    }

    public void setApk_url(String apk_url) {
        this.apk_url = apk_url;
    }

    public String getUpgrade_content() {
        return upgrade_content;
    }

    public void setUpgrade_content(String upgrade_content) {
        this.upgrade_content = upgrade_content;
    }
}
<file_sep>package com.miguan.otk.model;


import com.dsk.chain.model.AbsModel;
import com.miguan.otk.model.local.UserPreferences;
import com.miguan.otk.model.bean.Balance;
import com.miguan.otk.model.bean.Feedback;
import com.miguan.otk.model.bean.Game;
import com.miguan.otk.model.bean.Message;
import com.miguan.otk.model.bean.Sign;
import com.miguan.otk.model.bean.User;
import com.miguan.otk.model.bean.Withdraw;
import com.miguan.otk.model.services.DefaultTransform;
import com.miguan.otk.model.services.ServicesClient;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import rx.Observable;

/**
 * Copyright (c) 2015. LiaoPeiKun Inc. All rights reserved.
 */
public class UserModel extends AbsModel {

    public static UserModel getInstance() {
        return getInstance(UserModel.class);
    }

    /**
     * 注册验证码
     * @param mobile 手机号
     * @return 发送结果
     */
    public Observable<Boolean> registerCaptcha(String mobile) {
        return ServicesClient.getServices().sendCaptchaRegister(mobile).compose(new DefaultTransform<>());
    }

    /**
     * 忘记密码验证码
     * @param mobile 手机号
     * @return 发送结果
     */
    public Observable<Boolean> forgotCaptcha(String mobile) {
        return ServicesClient.getServices().sendCaptchaReset(mobile).compose(new DefaultTransform<>());
    }

    /**
     * 忘记密码验证码
     * @param mobile 手机号
     * @return 发送结果
     */
    public Observable<Boolean> updateCaptcha(String mobile) {
        return ServicesClient.getServices().sendCaptchaUpdate(mobile, UserPreferences.getToken()).compose(new DefaultTransform<>());
    }

    public Observable<User> login(String mobile, String password) {
        return ServicesClient.getServices().login(mobile, password)
                .doOnNext(this::saveAccount)
//                .flatMap(new Func1<User, Observable<User>>() {
//                    @Override
//                    public Observable<User> call(User user) {
//                        return Observable.create(subscriber -> {
//                            String account = UserPreferences.getUserID();
//                            String token = UserPreferences.getNIMToken();
//
//                            LUtils.log("account: " + account + ", token: " + token);
//
//                            NimUIKit.doLogin(new LoginInfo(account, token), new RequestCallback<LoginInfo>() {
//                                @Override
//                                public void onSuccess(LoginInfo info) {
//                                    LUtils.log("登录成功 account: " + info.getAccount() + ", token: " + info.getToken());
//                                    subscriber.onNext(user);
//                                }
//
//                                @Override
//                                public void onFailed(int code) {
//                                    if (code == 302 || code == 404) {
//                                        LUtils.toast("账号或密码错误");
//                                        subscriber.onError(new ServiceException(code, "账号或密码错误"));
//                                    } else {
//                                        LUtils.toast("登录失败: " + code);
//                                        subscriber.onError(new ServiceException(code, "登录失败: " + code));
//                                    }
//                                }
//
//                                @Override
//                                public void onException(Throwable throwable) {
//                                    LUtils.toast("无效输入");
//                                    subscriber.onError(new ServiceException(0, "无效输入"));
//                                }
//                            });
//                        });
//                    }
//                })
                .compose(new DefaultTransform<>());
    }

    public Observable<User> register(String username, String mobile, String code, String password) {
        return ServicesClient.getServices().register(username, mobile, code, password)
                .doOnNext(this::saveAccount)
                .compose(new DefaultTransform<>());
    }

    public Observable<User> userInfo() {
        return ServicesClient.getServices().userInfo(UserPreferences.getToken())
                .compose(new DefaultTransform<>());
    }

    public Observable<Boolean> modifyPwd(String mobile, String code, String newPwd) {
        return ServicesClient.getServices().modifyPwd(mobile, code, newPwd).compose(new DefaultTransform<>());
    }

    public Observable<User> getProfile() {
        return ServicesClient.getServices().userProfile(UserPreferences.getToken()).compose(new DefaultTransform<>());
    }

    public Observable<Boolean> setProfile(Map<String, String> map) {
        map.put("token", UserPreferences.getToken());
        return ServicesClient.getServices().modifyProfile(map).compose(new DefaultTransform<>());
    }

    public Observable<Boolean> setProfile(String key, String value) {
        Map<String, String> map = new HashMap<>();
        map.put("token", UserPreferences.getToken());
        map.put(key, value);
        return ServicesClient.getServices().modifyProfile(map).compose(new DefaultTransform<>());
    }

    /**
     * 签到信息
     * @return
     */
    public Observable<Sign> getSignInfo(String month, Integer year) {
        return ServicesClient.getServices().signDetail(UserPreferences.getToken(), month, year).compose(new DefaultTransform<>());
    }

    /**
     * 签到
     * @return
     */
    public Observable<Sign> sign() {
        return ServicesClient.getServices().sign(UserPreferences.getToken()).compose(new DefaultTransform<>());
    }

    public Observable<List<Balance>> getBalanceList(String type, Integer page) {
        return ServicesClient.getServices().balanceList(type, UserPreferences.getToken(), page)
                .compose(new DefaultTransform<>());
    }

    /**
     * 提现记录
     */
    public Observable<Withdraw> getWithdrawList() {
        return ServicesClient.getServices().withdrawRecord(UserPreferences.getToken())
                .compose(new DefaultTransform<>());
    }

    /**
     * 提现记录
     */
    public Observable<List<Withdraw>> getWithdrawList(Integer page) {
        return ServicesClient.getServices().withdrawRecord(UserPreferences.getToken(), page)
                .compose(new DefaultTransform<>());
    }

    /**
     * 提现
     */
    public Observable<Boolean> withdraw(Integer money) {
        return ServicesClient.getServices().withdraw(UserPreferences.getToken(), money).compose(new DefaultTransform<>());
    }

    /**
     * 绑定支付宝
     */
    public Observable<Boolean> bindAlipay(String mobile, String account, String captcha) {
        return ServicesClient.getServices().bindAlipay(UserPreferences.getToken(), mobile, account, captcha).compose(new DefaultTransform<>());
    }

    /**
     * 游戏帐号
     */
    public Observable<List<Game>> getGameAccounts() {
        return ServicesClient.getServices().gameAccounts(UserPreferences.getToken()).compose(new DefaultTransform<>());
    }

    /**
     * 添加游戏帐号
     */
    public Observable<Boolean> addGameAccount(String name, String account) {
        return ServicesClient.getServices().addGameAccount(UserPreferences.getToken(), name, account).compose(new DefaultTransform<>());
    }

    /**
     * 编辑游戏帐号
     */
    public Observable<Boolean> updateGameAccount(int id, String account) {
        return ServicesClient.getServices().updateGameAccount(UserPreferences.getToken(), id, account).compose(new DefaultTransform<>());
    }

    /**
     * 消息分类最新一条
     */
    public Observable<List<Message>> getMessageDesc() {
        return ServicesClient.getServices().getMessageDesc(UserPreferences.getToken()).compose(new DefaultTransform<>());
    }

    /**
     * 消息列表
     */
    public Observable<List<Message>> getMessageList(Integer type, Integer page) {
        return ServicesClient.getServices().getMessageList(UserPreferences.getToken(), type, page).compose(new DefaultTransform<>());
    }

    /**
     * 吐槽一下
     * @param type
     * @return
     */
    public Observable<Feedback> saveFeedback(Integer type, String contact, String content, String img) {
        return ServicesClient.getServices()
                .feedback(UserPreferences.getToken(), type, contact, content, img, 0)
                .compose(new DefaultTransform<>());
    }

    private void saveAccount(User user) {
        UserPreferences.setUserID(user.getUser_id() + "");
        UserPreferences.setNIMToken(user.getAuth_key());
        UserPreferences.setToken(user.getToken());
    }

}
<file_sep>package com.miguan.otk.model.services;

import com.google.gson.Gson;
import com.miguan.otk.utils.LUtils;

import org.json.JSONException;
import org.json.JSONObject;

import java.io.IOException;
import java.lang.reflect.Type;

import okhttp3.ResponseBody;
import retrofit2.Converter;

/**
 * Copyright (c) 2015. LiaoPeiKun Inc. All rights reserved.
 */

public class WrapperResponseBodyConverter<T> implements Converter<ResponseBody, T> {

    private static final String TAG = "WrapperResponseBodyConverter";

    private final Type mType;

    WrapperResponseBodyConverter(Type type) {
        this.mType = type;
    }

    @Override
    public T convert(ResponseBody value) throws IOException {
        try {
            JSONObject data = new JSONObject(value.string());

            LUtils.log(TAG, data.toString());

            int status = data.getInt("status");
            if (status != 1) {
                throw new ServiceException(status, data.getString("msg"));
            }

            String result = "";
            if (data.has("data")) {
                if (!data.isNull("data")) result = data.opt("data").toString();
                else return null;
            } else {
                return new Gson().fromJson(data.toString(), mType);
            }

            return new Gson().fromJson(result, mType);
        } catch (JSONException e) {
            throw new ServiceException(0, "数据解析错误");
        }
    }

}
<file_sep>package com.miguan.otk.model;

import com.dsk.chain.model.AbsModel;
import com.miguan.otk.model.local.UserPreferences;
import com.miguan.otk.model.bean.Battle;
import com.miguan.otk.model.bean.Home;
import com.miguan.otk.model.bean.Match;
import com.miguan.otk.model.bean.Mission;
import com.miguan.otk.model.bean.Schedule;
import com.miguan.otk.model.bean.User;
import com.miguan.otk.model.services.DefaultTransform;
import com.miguan.otk.model.services.ServicesClient;

import java.util.List;

import rx.Observable;

/**
 * Copyright (c) 2017/1/6. LiaoPeiKun Inc. All rights reserved.
 */

public class MatchModel extends AbsModel {

    public static MatchModel getInstance() {
        return getInstance(MatchModel.class);
    }

    public Observable<Home> getHome() {
        return ServicesClient.getServices().homeMatch(UserPreferences.getToken()).compose(new DefaultTransform<>());
    }

    /**
     * 赛事详情
     * @param matchID 赛事ID
     * @return
     */
    public Observable<Match> getMatchDetail(int matchID) {
        return ServicesClient.getServices()
                .matchDetail(UserPreferences.getToken(), matchID)
                .compose(new DefaultTransform<>());
    }

    /**
     * 赛事参加用户列表
     * @param matchID 赛事ID
     * @return
     */
    public Observable<List<User>> getCompetitors(int matchID, int type) {
        return ServicesClient.getServices().competitors(matchID, type).compose(new DefaultTransform<>());
    }

    /**
     * 赛事参加用户列表
     * @param matchID 赛事ID
     * @return
     */
    public Observable<Match> getCompetitionRule(int matchID) {
        return ServicesClient.getServices().competitionRule(matchID).compose(new DefaultTransform<>());
    }

    /**
     * 赛事对战表
     * @param matchID 赛事ID
     * @return
     */
    public Observable<Schedule> getCompetitionSchedule(int matchID, int round) {
        return ServicesClient.getServices().competitionSchedule(matchID, round).compose(new DefaultTransform<>());
    }

    /**
     * 赛事报名
     * @param matchID 赛事ID
     * @return
     */
    public Observable<Battle> enter(int matchID, String password, String code) {
        return ServicesClient.getServices().competitionEnter(UserPreferences.getToken(), matchID, password, code).compose(new DefaultTransform<>());
    }

    /**
     * 赛事签到
     * @param matchID 赛事ID
     * @return
     */
    public Observable<Boolean> sign(int matchID) {
        return ServicesClient.getServices().competitionSign(UserPreferences.getToken(), matchID).compose(new DefaultTransform<>());
    }

    public Observable<Battle> getBattleID(int competitionID) {
        return ServicesClient.getServices().battleID(UserPreferences.getToken(), competitionID).compose(new DefaultTransform<>());
    }

    /**
     * 我的参赛列表
     * @param page 当前页数
     * @return
     */
    public Observable<List<Match>> getMyMatchList(int page) {
        return ServicesClient.getServices().myMatchList(UserPreferences.getToken(), page).compose(new DefaultTransform<>());
    }

    /**
     * 每日任务列表
     */
    public Observable<List<Mission>> getMissionList() {
        return ServicesClient.getServices().missionList(UserPreferences.getToken()).compose(new DefaultTransform<>());
    }

    /**
     * 每日任务奖励领取
     */
    public Observable<Mission> doleMission(int missionID) {
        return ServicesClient.getServices().missionDole(UserPreferences.getToken(), missionID).compose(new DefaultTransform<>());
    }

}
<file_sep>package com.miguan.otk.adapter.viewholder;

import android.support.annotation.LayoutRes;
import android.view.ViewGroup;
import android.widget.TextView;

import com.jude.easyrecyclerview.adapter.BaseViewHolder;
import com.miguan.otk.R;
import com.miguan.otk.model.bean.Address;

import butterknife.Bind;
import butterknife.ButterKnife;

/**
 * Copyright (c) 2016/12/19. LiaoPeiKun Inc. All rights reserved.
 */

public class AddressViewHolder extends BaseViewHolder<Address> {

    @Bind(R.id.tv_address_consignee)
    TextView mTvConsignee;

    @Bind(R.id.tv_address_mobile)
    TextView mTvMobile;

    @Bind(R.id.tv_address_city)
    TextView mTvCity;

    @Bind(R.id.tv_address_info)
    TextView mTvInfo;

    public AddressViewHolder(ViewGroup parent) {
        this(parent, R.layout.item_list_address);
    }

    public AddressViewHolder(ViewGroup parent, @LayoutRes int res) {
        super(parent, res);
        ButterKnife.bind(this, itemView);
    }

    @Override
    public void setData(Address data) {
        mTvConsignee.setText(data.getTrue_name());
        mTvMobile.setText(data.getMob_phone());
        mTvCity.setText(data.getCity());
        mTvInfo.setText(data.getAddress());
    }
}
<file_sep>package com.miguan.otk.module.settings;

import android.os.Bundle;
import android.widget.CompoundButton;
import android.widget.Switch;

import com.dsk.chain.bijection.ChainBaseActivity;
import com.dsk.chain.bijection.RequiresPresenter;
import com.miguan.otk.R;
import com.miguan.otk.model.local.PushPreferences;
import com.miguan.otk.utils.LUtils;
import com.umeng.message.IUmengCallback;
import com.umeng.message.PushAgent;

import butterknife.Bind;
import butterknife.ButterKnife;

@RequiresPresenter(SettingPushPresenter.class)
public class SettingPushActivity extends ChainBaseActivity<SettingPushPresenter> implements CompoundButton.OnCheckedChangeListener, IUmengCallback  {

    @Bind(R.id.switch_push_all)
    Switch mSwitchAll;

    @Bind(R.id.switch_push_match)
    Switch mSwitchMatch;

    private PushAgent mPushAgent;

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

        mPushAgent = PushAgent.getInstance(this);

        mSwitchAll.setChecked(PushPreferences.isPushAll());
        mSwitchMatch.setChecked(PushPreferences.isPushMatch());
        mSwitchAll.setOnCheckedChangeListener(this);
        mSwitchMatch.setOnCheckedChangeListener(this);
    }

    @Override
    public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
        LUtils.log("onCheckedChanged : " + isChecked);

        if (isChecked) {
            mPushAgent.enable(this);
        } else {
            if (buttonView.getId() == R.id.switch_push_all) mSwitchMatch.setChecked(false);
            mPushAgent.disable(this);
        }
    }

    @Override
    public void onSuccess() {
//        PushPreferences.setPushAll(!PushPreferences.isPushAll());
        LUtils.log("onSuccess");
    }

    @Override
    public void onFailure(String s, String s1) {
        LUtils.log("onFailure: " + s + ", " + s1);
    }
}
<file_sep>package com.miguan.otk.adapter.viewholder;

import android.net.Uri;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.facebook.drawee.view.SimpleDraweeView;
import com.jude.easyrecyclerview.adapter.BaseViewHolder;
import com.miguan.otk.R;
import com.miguan.otk.model.bean.User;

import butterknife.Bind;
import butterknife.ButterKnife;

/**
 * Copyright (c) 2016/12/22. LiaoPeiKun Inc. All rights reserved.
 */

public class CompetitorViewHolder extends BaseViewHolder<User> {

    @Bind(R.id.dv_player_avatar)
    SimpleDraweeView mDvAvatar;

    @Bind(R.id.tv_player_username)
    TextView mTvUsername;

    @Bind(R.id.tv_player_status)
    TextView mTvStatus;

    public CompetitorViewHolder(ViewGroup parent) {
        super(parent, R.layout.item_list_enroll);
        ButterKnife.bind(this, itemView);
    }

    @Override
    public void setData(User data) {
        mDvAvatar.setImageURI(Uri.parse(data.getPhoto()));
        mTvUsername.setText(data.getUsername());
        mTvStatus.setVisibility(data.getSign().equals("Y") ? View.VISIBLE : View.GONE);
    }
}
<file_sep>package com.miguan.otk.adapter;

import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.support.v4.view.PagerAdapter;
import android.view.View;
import android.view.ViewGroup;

import com.facebook.drawee.drawable.ScalingUtils;
import com.facebook.drawee.generic.GenericDraweeHierarchy;
import com.facebook.drawee.generic.GenericDraweeHierarchyBuilder;
import com.facebook.drawee.view.SimpleDraweeView;
import com.miguan.otk.R;
import com.miguan.otk.model.bean.Banner;
import com.miguan.otk.model.bean.News;
import com.miguan.otk.module.common.WebActivity;
import com.miguan.otk.module.match.MatchDetailActivity;
import com.miguan.otk.module.news.NewsDetailActivity;
import com.miguan.otk.utils.LUtils;

import java.util.ArrayList;
import java.util.List;

/**
 * Copyright (c) 2015. LiaoPeiKun Inc. All rights reserved.
 */

public class BannerPagerAdapter extends PagerAdapter {

    private Context mContext;

    private List<Banner> mBannerList;

    private List<View> mViewList;

    public BannerPagerAdapter(Context context, List<Banner> banners) {
        this.mContext = context;
        this.mBannerList = banners;

        mViewList = new ArrayList<>();
    }

    @Override
    public Object instantiateItem(ViewGroup container, int position) {
        GenericDraweeHierarchyBuilder builder = new GenericDraweeHierarchyBuilder(mContext.getResources());
        GenericDraweeHierarchy hierarchy = builder
                .setFadeDuration(300)
                .setPlaceholderImage(R.mipmap.def_image_loading)
                .setPlaceholderImageScaleType(ScalingUtils.ScaleType.CENTER_CROP)
                .setActualImageScaleType(ScalingUtils.ScaleType.CENTER_CROP)
                .build();
        SimpleDraweeView dv = new SimpleDraweeView(mContext, hierarchy);
        int height = LUtils.getScreenWidth() * 8 / 15;
        ViewGroup.LayoutParams lp = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, height);
        dv.setLayoutParams(lp);

        Banner banner = mBannerList.get(position);
        dv.setImageURI(Uri.parse(banner.getImg()));
        dv.setOnClickListener(v -> {
            switch (banner.getType()) {
                case 1 :
                    Intent newsIntent = new Intent(mContext, NewsDetailActivity.class);
                    News news = new News();
                    news.setUrl(banner.getUrl());
                    news.setTitle(banner.getTitle());
                    newsIntent.putExtra("news", news);
                    mContext.startActivity(newsIntent);
                    break;
                case 2 :
                    Intent matchIntent = new Intent(mContext, MatchDetailActivity.class);
                    matchIntent.putExtra("match_id", banner.getUrl());
                    mContext.startActivity(matchIntent);
                    break;
                default :
                    Intent intent = new Intent(mContext, WebActivity.class);
                    intent.putExtra("url", banner.getUrl());
                    mContext.startActivity(intent);
                    break;
            }
        });

        container.addView(dv);
        mViewList.add(dv);
        return dv;
    }

    @Override
    public int getCount() {
        return mBannerList.size();
    }

    @Override
    public boolean isViewFromObject(View view, Object object) {
        return view == object;
    }

    @Override
    public void destroyItem(ViewGroup container, int position, Object object) {
        container.removeView(mViewList.get(position));
    }
}
<file_sep>package com.miguan.otk.module.news;

import android.util.TypedValue;
import android.view.LayoutInflater;
import android.view.ViewGroup;
import android.widget.TextView;

import com.facebook.drawee.view.SimpleDraweeView;
import com.jude.easyrecyclerview.adapter.BaseViewHolder;
import com.jude.exgridview.ExGridView;
import com.miguan.otk.R;
import com.miguan.otk.model.bean.News;
import com.miguan.otk.utils.LUtils;

import butterknife.Bind;
import butterknife.ButterKnife;

/**
 * Copyright (c) 2017/1/11. LiaoPeiKun Inc. All rights reserved.
 */

public class NewsMultiViewHolder extends BaseViewHolder<News> {

    @Bind(R.id.tv_news_title)
    TextView mTvTitle;

    @Bind(R.id.grid_news_images)
    ExGridView mGridImages;

    @Bind(R.id.tv_news_date)
    TextView mTvDate;

    public NewsMultiViewHolder(ViewGroup parent) {
        super(parent, R.layout.item_list_news_multi);
        ButterKnife.bind(this, itemView);
        if (LUtils.getScreenWidth() >= 1080) {
            mTvTitle.setTextSize(TypedValue.COMPLEX_UNIT_PX, getContext().getResources().getDimension(R.dimen.text_size_title_material));
        }
    }

    @Override
    public void setData(News news) {
        mTvTitle.setText(news.getTitle());
        mTvDate.setText(news.getCreate_time());

        int height = (2 * (LUtils.getScreenWidth() - 4 * LUtils.dp2px(8)) / 9);
        ViewGroup.LayoutParams layoutParams = mGridImages.getLayoutParams();
        layoutParams.height = height;
        mGridImages.setLayoutParams(layoutParams);

        int width = (LUtils.getScreenWidth() - 4 * LUtils.dp2px(8)) / 3;
        for (int i=0; i<news.getImg().length; i++) {
            SimpleDraweeView dv = (SimpleDraweeView) LayoutInflater.from(getContext()).inflate(R.layout.item_grid_image, mGridImages, false);
            dv.setImageURI(news.getImg()[i]);

            mGridImages.addView(dv, width, height);
        }
    }

}
<file_sep>package com.miguan.otk.module.user;

import android.app.Activity;
import android.content.Intent;

import com.dsk.chain.expansion.list.BaseListActivityPresenter;
import com.miguan.otk.model.UserModel;
import com.miguan.otk.model.bean.Game;

/**
 * Copyright (c) 2016/12/20. LiaoPeiKun Inc. All rights reserved.
 */

public class GameAccountPresenter extends BaseListActivityPresenter<GameAccountActivity, Game> {

    @Override
    protected void onCreateView(GameAccountActivity view) {
        super.onCreateView(view);
        onRefresh();
    }

    @Override
    public void onRefresh() {
        UserModel.getInstance().getGameAccounts().unsafeSubscribe(getRefreshSubscriber());
    }

    @Override
    protected void onResult(int requestCode, int resultCode, Intent data) {
        super.onResult(requestCode, resultCode, data);
        if (resultCode == Activity.RESULT_OK && requestCode == 1) {
            onRefresh();
        }
    }
}
<file_sep>package com.miguan.otk.module.store;

import com.dsk.chain.expansion.list.BaseListFragmentPresenter;
import com.miguan.otk.model.bean.Goods;
import com.miguan.otk.model.bean.Order;

import java.util.ArrayList;
import java.util.List;

import rx.Observable;

/**
 * Copyright (c) 2016/12/19. LiaoPeiKun Inc. All rights reserved.
 */
public class OrderListPresenter extends BaseListFragmentPresenter<OrderListFragment, Order> {

    @Override
    protected void onCreateView(OrderListFragment view) {
        super.onCreateView(view);
        onRefresh();
    }

    @Override
    public void onRefresh() {
        List<Order> list = new ArrayList<>();
        for (int i=0; i<10; i++) {
            Order order = new Order();
            order.setOrder_num(i + "574676765374564");
            order.setState(i%2==0 ? "审核中" : "已完成");

            Goods goods = new Goods();
            order.setSpec("薄荷绿" + i);
            goods.setGoods_name(i + "萌萌哒创意小耳机萌萌哒创意小耳机萌萌哒");
            goods.setGoods_price("4000" + i);
            goods.setGoods_image_url("http://static.otkpk.com/uploads/article/1481871059679989.jpg");
            order.setGoods(goods);
            list.add(order);
        }
        Observable.just(list).unsafeSubscribe(getRefreshSubscriber());
    }
}
<file_sep>package com.miguan.otk.model.bean;

import android.os.Parcel;
import android.os.Parcelable;

/**
 * Copyright (c) 2016/12/19. LiaoPeiKun Inc. All rights reserved.
 */

public class Order implements Parcelable {

    private int order_id;

    private String order_num;

    private String state;

    private Address address;

    private Goods goods;

    private String spec;

    public Order() {
    }

    public int getOrder_id() {
        return order_id;
    }

    public void setOrder_id(int order_id) {
        this.order_id = order_id;
    }

    public Address getAddress() {
        return address;
    }

    public void setAddress(Address address) {
        this.address = address;
    }

    public Goods getGoods() {
        return goods;
    }

    public void setGoods(Goods goods) {
        this.goods = goods;
    }

    public String getSpec() {
        return spec;
    }

    public void setSpec(String spec) {
        this.spec = spec;
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeInt(this.order_id);
        dest.writeString(this.order_num);
        dest.writeString(this.state);
        dest.writeParcelable(this.address, flags);
        dest.writeParcelable(this.goods, flags);
        dest.writeString(this.spec);
    }

    protected Order(Parcel in) {
        this.order_id = in.readInt();
        this.order_num = in.readString();
        this.state = in.readString();
        this.address = in.readParcelable(Address.class.getClassLoader());
        this.goods = in.readParcelable(Goods.class.getClassLoader());
        this.spec = in.readString();
    }

    public static final Creator<Order> CREATOR = new Creator<Order>() {
        @Override
        public Order createFromParcel(Parcel source) {
            return new Order(source);
        }

        @Override
        public Order[] newArray(int size) {
            return new Order[size];
        }
    };

    public String getOrder_num() {
        return order_num;
    }

    public void setOrder_num(String order_num) {
        this.order_num = order_num;
    }

    public String getState() {
        return state;
    }

    public void setState(String state) {
        this.state = state;
    }
}
<file_sep>package com.miguan.otk.module.main;

import android.content.Intent;

import com.dsk.chain.bijection.Presenter;

/**
 * Copyright (c) 2017/1/13. LiaoPeiKun Inc. All rights reserved.
 */

public class AdPresenter extends Presenter<AdActivity> {

    public void skip() {
        getView().startActivity(new Intent(getView(), MainActivity.class));
        getView().finish();
    }

}
<file_sep>package com.miguan.otk.module.user;

import com.dsk.chain.bijection.Presenter;

/**
 * Copyright (c) 2016/12/19. LiaoPeiKun Inc. All rights reserved.
 */

public class MyOrderPresenter extends Presenter<MyOrderActivity> {
}
<file_sep>package com.miguan.otk.module.user;

import android.os.Bundle;
import android.text.TextUtils;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;

import com.dsk.chain.bijection.ChainBaseActivity;
import com.dsk.chain.bijection.RequiresPresenter;
import com.jude.exgridview.ExGridView;
import com.miguan.otk.R;
import com.miguan.otk.utils.LUtils;

import butterknife.Bind;
import butterknife.ButterKnife;

@RequiresPresenter(GameAccountAddPresenter.class)
public class GameAccountAddActivity extends ChainBaseActivity<GameAccountAddPresenter> {

    @Bind(R.id.grid_game_type)
    ExGridView mGridType;

    @Bind(R.id.et_game_account)
    EditText mEtAccount;

    @Bind(R.id.btn_game_save)
    Button mBtnSave;

    private TextView mCurChecked;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.user_activity_game_account_add);
        setToolbarTitle(R.string.title_activity_add_account);
        ButterKnife.bind(this);

        mBtnSave.setOnClickListener(v -> checkInput());

        for (int i=0; i<mGridType.getChildCount(); i++) {
            TextView tv = (TextView) mGridType.getChildAt(i);
            if (i == 0) {
                mCurChecked = tv;
                tv.setSelected(true);
            }
            tv.setTag(i);
            tv.setOnClickListener(v -> {
                mCurChecked.setSelected(false);
                v.setSelected(true);
                mCurChecked = tv;
            });
        }
    }

    private void checkInput() {
        if (TextUtils.isEmpty(mEtAccount.getText())) {
            LUtils.toast("游戏帐号不能为空");
            return;
        }
        getPresenter().save(mCurChecked.getText().toString().trim(), mEtAccount.getText().toString().trim());
    }

}
<file_sep>package com.miguan.otk.module.user;

import android.view.ViewGroup;

import com.dsk.chain.bijection.RequiresPresenter;
import com.dsk.chain.expansion.list.BaseListActivity;
import com.dsk.chain.expansion.list.ListConfig;
import com.jude.easyrecyclerview.adapter.BaseViewHolder;
import com.miguan.otk.R;
import com.miguan.otk.adapter.viewholder.MessageViewHolder;

@RequiresPresenter(MessageListPresenter.class)
public class MessageListActivity extends BaseListActivity<MessageListPresenter> {

    @Override
    protected BaseViewHolder createViewHolder(ViewGroup parent, int viewType) {
        return new MessageViewHolder(parent);
    }

    @Override
    protected int getLayout() {
        return R.layout.activity_toolbar_list;
    }

    @Override
    public ListConfig getListConfig() {
        return super.getListConfig().hasItemDecoration(false);
    }
}
<file_sep>package com.miguan.otk.adapter;

import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import com.facebook.drawee.view.SimpleDraweeView;
import com.miguan.otk.R;
import com.miguan.otk.model.bean.Match;
import com.miguan.otk.module.match.MatchDetailActivity;

import java.util.List;

import butterknife.Bind;
import butterknife.ButterKnife;

/**
 * Copyright (c) 2017/1/12. LiaoPeiKun Inc. All rights reserved.
 */

public class HomeMatchAdapter extends RecyclerView.Adapter<HomeMatchAdapter.MatchHomeViewHolder> {

    private Context mContext;

    private List<Match> mMatches;

    public HomeMatchAdapter(Context context, List<Match> matches) {
        mContext = context;
        mMatches = matches;
    }

    @Override
    public MatchHomeViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        return new MatchHomeViewHolder(LayoutInflater.from(mContext).inflate(R.layout.item_list_match_home, parent, false));
    }

    @Override
    public void onBindViewHolder(MatchHomeViewHolder holder, int position) {
        Match match = mMatches.get(position);
        holder.mTvTitle.setText(match.getTitle());
        holder.mTvTime.setText(match.getGame_time());
        holder.mTvFee.setText(match.getGame_all());
        holder.mTvStatus.setText(match.getGame_status());
        holder.mTvName.setText(match.getGame_name());
        holder.mDvIcon.setImageURI(Uri.parse(match.getGame_img()));
        holder.mIvType.setImageResource(match.getGame_type() == 0 ? 0 : (match.getGame_type() == 1 ? R.mipmap.ic_match_type_private : R.mipmap.ic_match_type_invite));
        holder.itemView.setOnClickListener(v -> {
            Intent intent = new Intent(mContext, MatchDetailActivity.class);
            intent.putExtra("match_id", match.getCompetition_id());
            mContext.startActivity(intent);
        });
    }

    @Override
    public int getItemCount() {
        return mMatches.size();
    }

    class MatchHomeViewHolder extends RecyclerView.ViewHolder {

        @Bind(R.id.tv_match_home_title)
        TextView mTvTitle;

        @Bind(R.id.tv_match_home_time)
        TextView mTvTime;

        @Bind(R.id.tv_match_home_fee)
        TextView mTvFee;

        @Bind(R.id.tv_match_home_status)
        TextView mTvStatus;

        @Bind(R.id.dv_match_home_game_icon)
        SimpleDraweeView mDvIcon;

        @Bind(R.id.tv_match_home_game_name)
        TextView mTvName;

        @Bind(R.id.iv_match_home_type)
        ImageView mIvType;

        public MatchHomeViewHolder(View itemView) {
            super(itemView);
            ButterKnife.bind(this, itemView);
        }
    }

}
<file_sep>package com.miguan.otk.adapter.viewholder;

import android.content.Intent;
import android.net.Uri;
import android.view.ViewGroup;
import android.widget.TextView;

import com.facebook.drawee.view.SimpleDraweeView;
import com.jude.easyrecyclerview.adapter.BaseViewHolder;
import com.miguan.otk.R;
import com.miguan.otk.model.bean.Goods;
import com.miguan.otk.module.store.GoodsDetailActivity;

import butterknife.Bind;
import butterknife.ButterKnife;

/**
 * Copyright (c) 2016/12/16. LiaoPeiKun Inc. All rights reserved.
 */

public class GoodsViewHolder extends BaseViewHolder<Goods> {

    @Bind(R.id.dv_goods_thumb)
    SimpleDraweeView mDvThumb;

    @Bind(R.id.tv_goods_name)
    TextView mTvName;

    @Bind(R.id.tv_goods_price)
    TextView mTvPrice;

    public GoodsViewHolder(ViewGroup parent) {
        super(parent, R.layout.item_list_store_goods);
        ButterKnife.bind(this, itemView);
    }

    @Override
    public void setData(Goods data) {
        mDvThumb.setImageURI(Uri.parse(data.getGoods_image_url()));
        mTvName.setText(data.getGoods_name());
        mTvPrice.setText(data.getGoods_price());
        itemView.setOnClickListener(v -> {
            Intent intent = new Intent(getContext(), GoodsDetailActivity.class);
            intent.putExtra("goods_id", data.getGoods_id());
            intent.putExtra("goods", data);
            getContext().startActivity(intent);
        });
    }
}
<file_sep>package com.miguan.otk.adapter;

import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.TextView;

import com.miguan.otk.R;

/**
 * Copyright (c) 2016/12/16. LiaoPeiKun Inc. All rights reserved.
 */

public class RecyclerStringAdapter extends RecyclerView.Adapter<RecyclerStringAdapter.SpecViewHolder> {

    private Context mContext;

    private String[] mList;

    public RecyclerStringAdapter(Context context, String[] list) {
        mContext = context;
        mList = list;
    }

    @Override
    public SpecViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        TextView textView = new Button(mContext);
        textView.setBackgroundResource(R.drawable.btn_stroke_gray_radius_shape);
        return new SpecViewHolder(textView);
    }

    @Override
    public void onBindViewHolder(SpecViewHolder holder, int position) {
        holder.mText.setText(mList[position]);
    }

    @Override
    public int getItemCount() {
        return mList.length;
    }

    class SpecViewHolder extends RecyclerView.ViewHolder {

        TextView mText;

        SpecViewHolder(View itemView) {
            super(itemView);
            mText = (TextView) itemView;
        }
    }

}
