Search in sources :

Example 1 with OnNetWorkErrorListener

use of com.github.jdsjlzx.interfaces.OnNetWorkErrorListener in project Palm300Heroes by nicolite.

the class FightSkillActivity 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 LinearLayoutManager(context, OrientationHelper.VERTICAL, false));
    lRecyclerViewAdapter = new LRecyclerViewAdapter(new FightSkillAdapter(context, dataList));
    lRecyclerView.setAdapter(lRecyclerViewAdapter);
    lRecyclerView.addItemDecoration(new DividerItemDecoration(context, OrientationHelper.VERTICAL));
    lRecyclerView.setLoadMoreEnabled(false);
    fightSkillPresenter = new FightSkillPresenter(this, this);
    lRecyclerView.setOnRefreshListener(new OnRefreshListener() {

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

        @Override
        public void reload() {
            fightSkillPresenter.showFightSkill(true);
        }
    });
    fightSkillPresenter.showFightSkill(false);
}
Also used : OnNetWorkErrorListener(com.github.jdsjlzx.interfaces.OnNetWorkErrorListener) LRecyclerViewAdapter(com.github.jdsjlzx.recyclerview.LRecyclerViewAdapter) FightSkillPresenter(cn.nicolite.palm300heroes.presenter.FightSkillPresenter) FightSkillAdapter(cn.nicolite.palm300heroes.view.adapter.FightSkillAdapter) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) DividerItemDecoration(android.support.v7.widget.DividerItemDecoration) IFightSkillView(cn.nicolite.palm300heroes.view.iview.IFightSkillView) BindView(butterknife.BindView) TextView(android.widget.TextView) LRecyclerView(com.github.jdsjlzx.recyclerview.LRecyclerView) View(android.view.View) ActionBar(android.support.v7.app.ActionBar) OnRefreshListener(com.github.jdsjlzx.interfaces.OnRefreshListener)

Example 2 with OnNetWorkErrorListener

use of com.github.jdsjlzx.interfaces.OnNetWorkErrorListener in project Palm300Heroes by nicolite.

the class VideoFragment method doBusiness.

@Override
protected void doBusiness() {
    lRecyclerView.setLayoutManager(new LinearLayoutManager(context, OrientationHelper.VERTICAL, false));
    lRecyclerViewAdapter = new LRecyclerViewAdapter(new VideoAdapter(context, videoList));
    lRecyclerView.setAdapter(lRecyclerViewAdapter);
    videoPresenter = new VideoPresenter(this, this);
    lRecyclerView.setOnRefreshListener(new OnRefreshListener() {

        @Override
        public void onRefresh() {
            currentPage = 1;
            videoPresenter.loadVideoList();
        }
    });
    lRecyclerView.setOnLoadMoreListener(new OnLoadMoreListener() {

        @Override
        public void onLoadMore() {
            videoPresenter.loadMore(++currentPage);
        }
    });
    lRecyclerView.setOnNetWorkErrorListener(new OnNetWorkErrorListener() {

        @Override
        public void reload() {
            videoPresenter.loadMore(currentPage);
        }
    });
    lRecyclerViewAdapter.setOnItemClickListener(new OnItemClickListener() {

        @Override
        public void onItemClick(View view, int position) {
            Bilibili.DataBean.VlistBean vlistBean = videoList.get(position);
            Bundle bundle = new Bundle();
            bundle.putInt("type", WebViewActivity.TYPE_VIDEO);
            bundle.putString("title", vlistBean.getTitle());
            bundle.putString("url", "https://m.bilibili.com/video/av" + vlistBean.getAid() + ".html");
            startActivity(WebViewActivity.class, bundle);
        }
    });
}
Also used : OnLoadMoreListener(com.github.jdsjlzx.interfaces.OnLoadMoreListener) OnNetWorkErrorListener(com.github.jdsjlzx.interfaces.OnNetWorkErrorListener) OnItemClickListener(com.github.jdsjlzx.interfaces.OnItemClickListener) VideoAdapter(cn.nicolite.palm300heroes.view.adapter.VideoAdapter) Bundle(android.os.Bundle) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) WebViewActivity(cn.nicolite.palm300heroes.view.activity.WebViewActivity) IVideoView(cn.nicolite.palm300heroes.view.iview.IVideoView) BindView(butterknife.BindView) LRecyclerView(com.github.jdsjlzx.recyclerview.LRecyclerView) View(android.view.View) LRecyclerViewAdapter(com.github.jdsjlzx.recyclerview.LRecyclerViewAdapter) Bilibili(cn.nicolite.palm300heroes.model.bean.Bilibili) VideoPresenter(cn.nicolite.palm300heroes.presenter.VideoPresenter) OnRefreshListener(com.github.jdsjlzx.interfaces.OnRefreshListener)

Example 3 with OnNetWorkErrorListener

use of com.github.jdsjlzx.interfaces.OnNetWorkErrorListener 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)

Example 4 with OnNetWorkErrorListener

use of com.github.jdsjlzx.interfaces.OnNetWorkErrorListener in project Palm300Heroes by nicolite.

the class HeroListFragment method doBusiness.

@Override
protected void doBusiness() {
    heroListPresenter = new HeroListPresenter(this, this);
    // 根据屏幕宽度计算一行能放多少个
    int spanCount = (int) (ScreenUtils.getScreenWidth(context) / ScreenUtils.dp2px(context, 80));
    // 防止每行个数为0
    if (spanCount == 0) {
        spanCount = 4;
    }
    lRecyclerView.setLayoutManager(new GridLayoutManager(context, spanCount, OrientationHelper.VERTICAL, false));
    lRecyclerViewAdapter = new LRecyclerViewAdapter(new HeroAdapter(context, dataList));
    lRecyclerView.setAdapter(lRecyclerViewAdapter);
    lRecyclerView.setLoadMoreEnabled(false);
    lRecyclerView.setOnRefreshListener(new OnRefreshListener() {

        @Override
        public void onRefresh() {
            heroListPresenter.showHeroList(true);
        }
    });
    lRecyclerView.setOnLoadMoreListener(new OnLoadMoreListener() {

        @Override
        public void onLoadMore() {
        }
    });
    lRecyclerView.setOnNetWorkErrorListener(new OnNetWorkErrorListener() {

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

        @Override
        public void onItemClick(View view, int position) {
            Hero hero = dataList.get(position);
            Bundle bundle = new Bundle();
            bundle.putString("heroName", hero.getHeroName());
            bundle.putString("heroType", hero.getHeroType());
            bundle.putString("heroUNCode", hero.getUNCode());
            bundle.putString("heroImage", hero.getPictureUrl());
            bundle.putString("heroBackground", hero.getBackground());
            bundle.putString("heroCoins", hero.getCoinsPrice());
            bundle.putString("heroDiamond", hero.getDiamondPrice());
            startActivity(HeroesDetailActivity.class, bundle);
        }
    });
    if (isFirstVisible && ListUtils.isEmpty(dataList)) {
        heroListPresenter.showHeroList(false);
    }
}
Also used : OnLoadMoreListener(com.github.jdsjlzx.interfaces.OnLoadMoreListener) OnNetWorkErrorListener(com.github.jdsjlzx.interfaces.OnNetWorkErrorListener) OnItemClickListener(com.github.jdsjlzx.interfaces.OnItemClickListener) Bundle(android.os.Bundle) HeroListPresenter(cn.nicolite.palm300heroes.presenter.HeroListPresenter) BindView(butterknife.BindView) IHeroListView(cn.nicolite.palm300heroes.view.iview.IHeroListView) LRecyclerView(com.github.jdsjlzx.recyclerview.LRecyclerView) View(android.view.View) LRecyclerViewAdapter(com.github.jdsjlzx.recyclerview.LRecyclerViewAdapter) GridLayoutManager(android.support.v7.widget.GridLayoutManager) HeroesDetailActivity(cn.nicolite.palm300heroes.view.activity.HeroesDetailActivity) HeroAdapter(cn.nicolite.palm300heroes.view.adapter.HeroAdapter) Hero(cn.nicolite.palm300heroes.model.bean.Hero) OnRefreshListener(com.github.jdsjlzx.interfaces.OnRefreshListener)

Example 5 with OnNetWorkErrorListener

use of com.github.jdsjlzx.interfaces.OnNetWorkErrorListener in project Palm300Heroes by nicolite.

the class EquJJCFragment method doBusiness.

@Override
protected void doBusiness() {
    // 根据屏幕宽度计算一行能放多少个
    int spanCount = (int) (ScreenUtils.getScreenWidth(context) / ScreenUtils.dp2px(context, 80));
    // 防止每行个数为0
    if (spanCount == 0) {
        spanCount = 4;
    }
    equJJCPresenter = new EquJJCPresenter(this, this);
    lRecyclerView.setLayoutManager(new GridLayoutManager(context, spanCount, OrientationHelper.VERTICAL, false));
    lRecyclerViewAdapter = new LRecyclerViewAdapter(new EquipmentJJCAdapter(context, dataList));
    lRecyclerView.setAdapter(lRecyclerViewAdapter);
    lRecyclerView.setLoadMoreEnabled(false);
    lRecyclerView.setOnRefreshListener(new OnRefreshListener() {

        @Override
        public void onRefresh() {
            equJJCPresenter.showEquJJCList(true);
        }
    });
    lRecyclerView.setOnLoadMoreListener(new OnLoadMoreListener() {

        @Override
        public void onLoadMore() {
        }
    });
    lRecyclerView.setOnNetWorkErrorListener(new OnNetWorkErrorListener() {

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

        @Override
        public void onItemClick(View view, int position) {
            Equipment equipment = dataList.get(position);
            String purchasePrice = equipment.getPurchasePrice() == null ? "" : String.valueOf(equipment.getPurchasePrice());
            String compoundPrice = equipment.getCompoundPrice() == null ? "无法合成" : String.valueOf(equipment.getCompoundPrice());
            String attribute = TextUtils.isEmpty(equipment.getAttribute()) ? "无" : equipment.getAttribute();
            String skill = TextUtils.isEmpty(equipment.getSkill()) ? "无" : equipment.getSkill();
            Bundle bundle = new Bundle();
            bundle.putString("picture", equipment.getPicture());
            bundle.putString("name", equipment.getName());
            bundle.putString("pp", purchasePrice);
            bundle.putString("cp", compoundPrice);
            bundle.putString("attribute", attribute);
            bundle.putString("skill", skill);
            if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.KITKAT) {
                startActivity(EquJJCDetailActivity.class, bundle);
            } else {
                Bundle options = ActivityOptionsCompat.makeSceneTransitionAnimation(activity, view, "equJJCTransition").toBundle();
                startActivity(EquJJCDetailActivity.class, bundle, options);
            }
        }
    });
}
Also used : OnLoadMoreListener(com.github.jdsjlzx.interfaces.OnLoadMoreListener) OnNetWorkErrorListener(com.github.jdsjlzx.interfaces.OnNetWorkErrorListener) OnItemClickListener(com.github.jdsjlzx.interfaces.OnItemClickListener) Bundle(android.os.Bundle) EquipmentJJCAdapter(cn.nicolite.palm300heroes.view.oldAdapter.EquipmentJJCAdapter) BindView(butterknife.BindView) LRecyclerView(com.github.jdsjlzx.recyclerview.LRecyclerView) View(android.view.View) IEquJJCView(cn.nicolite.palm300heroes.view.iview.IEquJJCView) EquJJCDetailActivity(cn.nicolite.palm300heroes.view.activity.EquJJCDetailActivity) LRecyclerViewAdapter(com.github.jdsjlzx.recyclerview.LRecyclerViewAdapter) GridLayoutManager(android.support.v7.widget.GridLayoutManager) Equipment(cn.nicolite.palm300heroes.model.bean.Equipment) EquJJCPresenter(cn.nicolite.palm300heroes.presenter.EquJJCPresenter) OnRefreshListener(com.github.jdsjlzx.interfaces.OnRefreshListener)

Aggregations

View (android.view.View)6 BindView (butterknife.BindView)6 OnNetWorkErrorListener (com.github.jdsjlzx.interfaces.OnNetWorkErrorListener)6 OnRefreshListener (com.github.jdsjlzx.interfaces.OnRefreshListener)6 LRecyclerView (com.github.jdsjlzx.recyclerview.LRecyclerView)6 LRecyclerViewAdapter (com.github.jdsjlzx.recyclerview.LRecyclerViewAdapter)6 Bundle (android.os.Bundle)5 OnItemClickListener (com.github.jdsjlzx.interfaces.OnItemClickListener)4 GridLayoutManager (android.support.v7.widget.GridLayoutManager)3 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)3 OnLoadMoreListener (com.github.jdsjlzx.interfaces.OnLoadMoreListener)3 ActionBar (android.support.v7.app.ActionBar)2 TextView (android.widget.TextView)2 WebViewActivity (cn.nicolite.palm300heroes.view.activity.WebViewActivity)2 DividerItemDecoration (android.support.v7.widget.DividerItemDecoration)1 ImageView (android.widget.ImageView)1 BGABanner (cn.bingoogolapple.bgabanner.BGABanner)1 Bilibili (cn.nicolite.palm300heroes.model.bean.Bilibili)1 Equipment (cn.nicolite.palm300heroes.model.bean.Equipment)1 Hero (cn.nicolite.palm300heroes.model.bean.Hero)1