Search in sources :

Example 1 with TalentPresenter

use of cn.nicolite.palm300heroes.presenter.TalentPresenter in project Palm300Heroes by nicolite.

the class TalentActivity method doBusiness.

@Override
protected void doBusiness() {
    toolbarTitle.setText("天赋技能");
    setSupportActionBar(toolbar);
    toolbar.setNavigationOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View view) {
            finish();
        }
    });
    ActionBar actionBar = getSupportActionBar();
    if (actionBar != null) {
        actionBar.setDisplayHomeAsUpEnabled(true);
        actionBar.setDisplayShowTitleEnabled(false);
    }
    lRecyclerView.setLayoutManager(new GridLayoutManager(context, 3, OrientationHelper.VERTICAL, false));
    lRecyclerViewAdapter = new LRecyclerViewAdapter(new TalentAdapter(context, dataList));
    lRecyclerView.setAdapter(lRecyclerViewAdapter);
    lRecyclerView.setLoadMoreEnabled(false);
    talentPresenter = new TalentPresenter(this, this);
    lRecyclerView.setOnRefreshListener(new OnRefreshListener() {

        @Override
        public void onRefresh() {
            talentPresenter.showTalent(true);
        }
    });
    lRecyclerView.setOnNetWorkErrorListener(new OnNetWorkErrorListener() {

        @Override
        public void reload() {
            talentPresenter.showTalent(true);
        }
    });
    lRecyclerViewAdapter.setOnItemClickListener(new OnItemClickListener() {

        @Override
        public void onItemClick(View view, int position) {
            Talent talent = dataList.get(position);
            Bundle bundle = new Bundle();
            bundle.putString("picture", talent.getPicture());
            bundle.putString("name", talent.getName());
            bundle.putString("recommend", talent.getRecommend());
            bundle.putString("belongTo", talent.getBelongTo());
            bundle.putString("skill", talent.getSkill());
            bundle.putString("level", String.valueOf(talent.getLevel()));
            startActivity(TalentDetailActivity.class, bundle);
        }
    });
    talentPresenter.showTalent(false);
}
Also used : OnNetWorkErrorListener(com.github.jdsjlzx.interfaces.OnNetWorkErrorListener) OnItemClickListener(com.github.jdsjlzx.interfaces.OnItemClickListener) Bundle(android.os.Bundle) Talent(cn.nicolite.palm300heroes.model.bean.Talent) ITalentView(cn.nicolite.palm300heroes.view.iview.ITalentView) BindView(butterknife.BindView) TextView(android.widget.TextView) LRecyclerView(com.github.jdsjlzx.recyclerview.LRecyclerView) View(android.view.View) LRecyclerViewAdapter(com.github.jdsjlzx.recyclerview.LRecyclerViewAdapter) TalentPresenter(cn.nicolite.palm300heroes.presenter.TalentPresenter) GridLayoutManager(android.support.v7.widget.GridLayoutManager) TalentAdapter(cn.nicolite.palm300heroes.view.adapter.TalentAdapter) ActionBar(android.support.v7.app.ActionBar) OnRefreshListener(com.github.jdsjlzx.interfaces.OnRefreshListener)

Aggregations

Bundle (android.os.Bundle)1 ActionBar (android.support.v7.app.ActionBar)1 GridLayoutManager (android.support.v7.widget.GridLayoutManager)1 View (android.view.View)1 TextView (android.widget.TextView)1 BindView (butterknife.BindView)1 Talent (cn.nicolite.palm300heroes.model.bean.Talent)1 TalentPresenter (cn.nicolite.palm300heroes.presenter.TalentPresenter)1 TalentAdapter (cn.nicolite.palm300heroes.view.adapter.TalentAdapter)1 ITalentView (cn.nicolite.palm300heroes.view.iview.ITalentView)1 OnItemClickListener (com.github.jdsjlzx.interfaces.OnItemClickListener)1 OnNetWorkErrorListener (com.github.jdsjlzx.interfaces.OnNetWorkErrorListener)1 OnRefreshListener (com.github.jdsjlzx.interfaces.OnRefreshListener)1 LRecyclerView (com.github.jdsjlzx.recyclerview.LRecyclerView)1 LRecyclerViewAdapter (com.github.jdsjlzx.recyclerview.LRecyclerViewAdapter)1