Search in sources :

Example 1 with OnLoadViewListener

use of com.helper.loadviewhelper.help.OnLoadViewListener in project 91Pop by DanteAndroid.

the class VideoListFragment method onViewCreated.

@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    unbinder = ButterKnife.bind(this, view);
    // Setup contentView == SwipeRefreshView
    contentView.setOnRefreshListener(this);
    recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
    recyclerView.setAdapter(mUnLimit91Adapter);
    mUnLimit91Adapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() {

        @Override
        public void onItemClick(BaseQuickAdapter adapter, View view, int position) {
            UnLimit91PornItem unLimit91PornItems = (UnLimit91PornItem) adapter.getItem(position);
            goToPlayVideo(unLimit91PornItems);
        }
    });
    // 使用缓存的FragmentPagerAdapter之后会导致新方法的加载更多失效,暂时切换回过时api,可正常运行
    mUnLimit91Adapter.setOnLoadMoreListener(new BaseQuickAdapter.RequestLoadMoreListener() {

        @Override
        public void onLoadMoreRequested() {
            presenter.loadVideoListData(false, false, category.getCategoryValue(), 0);
        }
    });
    helper = new LoadViewHelper(recyclerView);
    helper.setListener(new OnLoadViewListener() {

        @Override
        public void onRetryClick() {
            loadData(false, true, 0);
        }
    });
    // loadData(false);
    AppUtils.setColorSchemeColors(context, contentView);
    handlerSkipPage();
}
Also used : BaseQuickAdapter(com.chad.library.adapter.base.BaseQuickAdapter) OnLoadViewListener(com.helper.loadviewhelper.help.OnLoadViewListener) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) LoadViewHelper(com.helper.loadviewhelper.load.LoadViewHelper) BindView(butterknife.BindView) View(android.view.View) RecyclerView(android.support.v7.widget.RecyclerView) UnLimit91PornItem(com.dante.data.model.UnLimit91PornItem)

Example 2 with OnLoadViewListener

use of com.helper.loadviewhelper.help.OnLoadViewListener in project 91Pop by DanteAndroid.

the class ProxySettingActivity method init.

private void init() {
    testAlertDialog = DialogUtils.initLodingDialog(this, "测试中,请稍候...");
    String proxyHost = dataManager.getProxyIpAddress();
    int port = dataManager.getProxyPort();
    etDialogProxySettingIpAddress.setIpAddressStr(proxyHost);
    etDialogProxySettingPort.setText(port == 0 ? "" : String.valueOf(port));
    List<ProxyModel> data = new ArrayList<>();
    proxyAdapter = new ProxyAdapter(R.layout.item_proxy, data);
    recyclerViewProxySetting.setLayoutManager(new LinearLayoutManager(this));
    recyclerViewProxySetting.addItemDecoration(new DividerItemDecoration(this, DividerItemDecoration.VERTICAL));
    View view = getLayoutInflater().inflate(R.layout.item_proxy, recyclerViewProxySetting, false);
    proxyAdapter.setHeaderView(view);
    proxyAdapter.setOnLoadMoreListener(new BaseQuickAdapter.RequestLoadMoreListener() {

        @Override
        public void onLoadMoreRequested() {
            presenter.parseXiCiDaiLi(false);
        }
    }, recyclerViewProxySetting);
    proxyAdapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() {

        @Override
        public void onItemClick(BaseQuickAdapter adapter, View view, int position) {
            ProxyModel proxyModel = (ProxyModel) adapter.getItem(position);
            if (proxyModel == null) {
                showMessage("数据出错了", TastyToast.WARNING);
                return;
            }
            proxyAdapter.setClickPosition(position);
            if (proxyModel.getType() != ProxyModel.TYPE_SOCKS) {
                etDialogProxySettingIpAddress.setIpAddressStr(proxyModel.getProxyIp());
                etDialogProxySettingPort.setText(proxyModel.getProxyPort());
            } else {
                showMessage("暂不支持socket代理", TastyToast.INFO);
            }
        }
    });
    recyclerViewProxySetting.setAdapter(proxyAdapter);
    helper = new LoadViewHelper(recyclerViewProxySetting);
    helper.setListener(new OnLoadViewListener() {

        @Override
        public void onRetryClick() {
            presenter.parseXiCiDaiLi(false);
        }
    });
    presenter.parseXiCiDaiLi(false);
}
Also used : ArrayList(java.util.ArrayList) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) DividerItemDecoration(android.support.v7.widget.DividerItemDecoration) BindView(butterknife.BindView) View(android.view.View) RecyclerView(android.support.v7.widget.RecyclerView) BaseQuickAdapter(com.chad.library.adapter.base.BaseQuickAdapter) OnLoadViewListener(com.helper.loadviewhelper.help.OnLoadViewListener) ProxyAdapter(com.dante.adapter.ProxyAdapter) LoadViewHelper(com.helper.loadviewhelper.load.LoadViewHelper) ProxyModel(com.dante.data.model.ProxyModel)

Example 3 with OnLoadViewListener

use of com.helper.loadviewhelper.help.OnLoadViewListener in project 91Pop by DanteAndroid.

the class BasePlayVideo method initLoadHelper.

private void initLoadHelper() {
    helper = new LoadViewHelper(flLoadHolder);
    helper.setListener(new OnLoadViewListener() {

        @Override
        public void onRetryClick() {
            if (isVideoError) {
                presenter.loadVideoUrl(unLimit91PornItem);
            } else {
                // 加载评论
                if (unLimit91PornItem.getVideoResultId() == 0) {
                    return;
                }
                presenter.loadVideoComment(unLimit91PornItem.getVideoResult().getVideoId(), unLimit91PornItem.getViewKey(), true);
            }
        }
    });
}
Also used : OnLoadViewListener(com.helper.loadviewhelper.help.OnLoadViewListener) LoadViewHelper(com.helper.loadviewhelper.load.LoadViewHelper)

Example 4 with OnLoadViewListener

use of com.helper.loadviewhelper.help.OnLoadViewListener in project 91Pop by DanteAndroid.

the class FavoriteActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_favorite);
    ButterKnife.bind(this);
    deleteAlertDialog = DialogUtils.initLodingDialog(this, "删除中,请稍后...");
    initToolBar(toolbar);
    toolbar.setContentInsetStartWithNavigation(0);
    // Setup contentView == SwipeRefreshView
    contentView.setOnRefreshListener(this);
    List<UnLimit91PornItem> mUnLimit91PornItemList = new ArrayList<>();
    mUnLimit91Adapter = new FavoriteAdapter(R.layout.item_right_menu_delete, mUnLimit91PornItemList);
    recyclerView.setLayoutManager(new LinearLayoutManager(this));
    recyclerView.setAdapter(mUnLimit91Adapter);
    mUnLimit91Adapter.setEmptyView(R.layout.empty_view, recyclerView);
    mUnLimit91Adapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() {

        @Override
        public void onItemClick(BaseQuickAdapter adapter, View view, int position) {
            goToPlayVideo((UnLimit91PornItem) adapter.getItem(position));
        }
    });
    mUnLimit91Adapter.setOnItemChildClickListener(new BaseQuickAdapter.OnItemChildClickListener() {

        @Override
        public void onItemChildClick(BaseQuickAdapter adapter, View view, int position) {
            SwipeItemLayout swipeItemLayout = (SwipeItemLayout) view.getParent();
            swipeItemLayout.close();
            if (view.getId() == R.id.right_menu_delete) {
                UnLimit91PornItem unLimit91PornItem = (UnLimit91PornItem) adapter.getItem(position);
                if (unLimit91PornItem == null || unLimit91PornItem.getVideoResult() == null) {
                    showMessage("信息错误,无法删除", TastyToast.WARNING);
                    return;
                }
                presenter.deleteFavorite(unLimit91PornItem.getVideoResult().getVideoId());
            }
        }
    });
    mUnLimit91Adapter.setOnLoadMoreListener(new BaseQuickAdapter.RequestLoadMoreListener() {

        @Override
        public void onLoadMoreRequested() {
            presenter.loadRemoteFavoriteData(false);
        }
    }, recyclerView);
    helper = new LoadViewHelper(recyclerView);
    helper.setListener(new OnLoadViewListener() {

        @Override
        public void onRetryClick() {
            presenter.loadRemoteFavoriteData(false);
        }
    });
    boolean needRefresh = dataManager.isFavoriteNeedRefresh();
    presenter.loadRemoteFavoriteData(needRefresh);
}
Also used : ArrayList(java.util.ArrayList) SwipeItemLayout(com.aitsuki.swipe.SwipeItemLayout) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) BindView(butterknife.BindView) View(android.view.View) SwipeMenuRecyclerView(com.aitsuki.swipe.SwipeMenuRecyclerView) BaseQuickAdapter(com.chad.library.adapter.base.BaseQuickAdapter) OnLoadViewListener(com.helper.loadviewhelper.help.OnLoadViewListener) FavoriteAdapter(com.dante.adapter.FavoriteAdapter) LoadViewHelper(com.helper.loadviewhelper.load.LoadViewHelper) UnLimit91PornItem(com.dante.data.model.UnLimit91PornItem)

Example 5 with OnLoadViewListener

use of com.helper.loadviewhelper.help.OnLoadViewListener in project 91Pop by DanteAndroid.

the class SearchActivity method init.

private void init() {
    initToolBar(toolbar);
    searchView.setQueryHint("搜索视频");
    searchView.onActionViewExpanded();
    List<String> datasetSortBy = new LinkedList<>(Arrays.asList(getResources().getStringArray(R.array.sort_by)));
    niceSpinnerSortBy.attachDataSource(datasetSortBy);
    List<String> datasetSearch = new LinkedList<>(Arrays.asList(getResources().getStringArray(R.array.search)));
    niceSpinnerSearch.attachDataSource(datasetSearch);
    List<UnLimit91PornItem> mUnLimit91PornItemList = new ArrayList<>();
    mUnLimit91Adapter = new UnLimit91Adapter(R.layout.item_unlimit_91porn, mUnLimit91PornItemList);
    mUnLimit91Adapter.openLoadAnimation();
    recyclerView.setLayoutManager(new LinearLayoutManager(this));
    recyclerView.setAdapter(mUnLimit91Adapter);
    mUnLimit91Adapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() {

        @Override
        public void onItemClick(BaseQuickAdapter adapter, View view, int position) {
            UnLimit91PornItem unLimit91PornItems = (UnLimit91PornItem) adapter.getData().get(position);
            goToPlayVideo(unLimit91PornItems);
        }
    });
    mUnLimit91Adapter.setOnLoadMoreListener(new BaseQuickAdapter.RequestLoadMoreListener() {

        @Override
        public void onLoadMoreRequested() {
            presenter.searchVideos(searchId, sort, false);
        }
    }, recyclerView);
    helper = new LoadViewHelper(recyclerView);
    helper.setListener(new OnLoadViewListener() {

        @Override
        public void onRetryClick() {
            presenter.searchVideos(searchId, sort, false);
        }
    });
}
Also used : ArrayList(java.util.ArrayList) UnLimit91Adapter(com.dante.adapter.UnLimit91Adapter) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) BindView(butterknife.BindView) View(android.view.View) AdapterView(android.widget.AdapterView) RecyclerView(android.support.v7.widget.RecyclerView) LinkedList(java.util.LinkedList) BaseQuickAdapter(com.chad.library.adapter.base.BaseQuickAdapter) OnLoadViewListener(com.helper.loadviewhelper.help.OnLoadViewListener) LoadViewHelper(com.helper.loadviewhelper.load.LoadViewHelper) UnLimit91PornItem(com.dante.data.model.UnLimit91PornItem)

Aggregations

OnLoadViewListener (com.helper.loadviewhelper.help.OnLoadViewListener)7 LoadViewHelper (com.helper.loadviewhelper.load.LoadViewHelper)7 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)6 View (android.view.View)6 BindView (butterknife.BindView)6 BaseQuickAdapter (com.chad.library.adapter.base.BaseQuickAdapter)6 RecyclerView (android.support.v7.widget.RecyclerView)5 UnLimit91PornItem (com.dante.data.model.UnLimit91PornItem)5 ArrayList (java.util.ArrayList)4 UnLimit91Adapter (com.dante.adapter.UnLimit91Adapter)2 Intent (android.content.Intent)1 SwipeRefreshLayout (android.support.v4.widget.SwipeRefreshLayout)1 DividerItemDecoration (android.support.v7.widget.DividerItemDecoration)1 AdapterView (android.widget.AdapterView)1 SwipeItemLayout (com.aitsuki.swipe.SwipeItemLayout)1 SwipeMenuRecyclerView (com.aitsuki.swipe.SwipeMenuRecyclerView)1 FavoriteAdapter (com.dante.adapter.FavoriteAdapter)1 ProxyAdapter (com.dante.adapter.ProxyAdapter)1 ProxyModel (com.dante.data.model.ProxyModel)1 LinkedList (java.util.LinkedList)1