Search in sources :

Example 26 with UnLimit91PornItem

use of com.dante.data.model.UnLimit91PornItem 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)

Example 27 with UnLimit91PornItem

use of com.dante.data.model.UnLimit91PornItem in project 91Pop by DanteAndroid.

the class AuthorActivity method init.

private void init() {
    swipeLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {

        @Override
        public void onRefresh() {
            presenter.authorVideos(uid, true);
        }
    });
    swipeLayout.setEnabled(false);
    List<UnLimit91PornItem> mUnLimit91PornItemList = new ArrayList<>();
    mUnLimit91Adapter = new UnLimit91Adapter(R.layout.item_unlimit_91porn, mUnLimit91PornItemList);
    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);
            Intent intent = new Intent();
            intent.putExtra(Keys.KEY_INTENT_UNLIMIT91PORNITEM, unLimit91PornItems);
            setResult(AUTHORACTIVITY_RESULT_CODE, intent);
            onBackPressed();
        }
    });
    mUnLimit91Adapter.setOnLoadMoreListener(new BaseQuickAdapter.RequestLoadMoreListener() {

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

        @Override
        public void onRetryClick() {
            swipeLayout.setEnabled(false);
            presenter.authorVideos(uid, true);
        }
    });
    presenter.authorVideos(uid, false);
}
Also used : ArrayList(java.util.ArrayList) UnLimit91Adapter(com.dante.adapter.UnLimit91Adapter) Intent(android.content.Intent) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) SwipeRefreshLayout(android.support.v4.widget.SwipeRefreshLayout) BindView(butterknife.BindView) RecyclerView(android.support.v7.widget.RecyclerView) View(android.view.View) 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)

Example 28 with UnLimit91PornItem

use of com.dante.data.model.UnLimit91PornItem in project 91Pop by DanteAndroid.

the class IndexFragment 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 = mUnLimit91PornItemList.get(position);
            goToPlayVideo(unLimit91PornItems);
        }
    });
    helper = new LoadViewHelper(recyclerView);
    helper.setListener(new OnLoadViewListener() {

        @Override
        public void onRetryClick() {
            loadData(false, true);
        }
    });
    AppUtils.setColorSchemeColors(context, contentView);
}
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 29 with UnLimit91PornItem

use of com.dante.data.model.UnLimit91PornItem in project 91Pop by DanteAndroid.

the class DownloadManager method saveDownloadInfo.

/**
 * 实时保存下载信息
 *
 * @param task 任务信息
 */
private void saveDownloadInfo(BaseDownloadTask task) {
    UnLimit91PornItem unLimit91PornItem = dataManager.findUnLimit91PornItemByDownloadId(task.getId());
    if (unLimit91PornItem == null) {
        // 不存在的任务清除掉
        FileDownloader.getImpl().clear(task.getId(), task.getPath());
        if (!BuildConfig.DEBUG) {
            Bugsnag.notify(new Throwable(TAG + "::save download info failure:" + task.getUrl()), Severity.WARNING);
        }
        return;
    }
    int soFarBytes = task.getSmallFileSoFarBytes();
    int totalBytes = task.getSmallFileTotalBytes();
    if (soFarBytes > 0) {
        unLimit91PornItem.setSoFarBytes(soFarBytes);
    }
    if (totalBytes > 0) {
        unLimit91PornItem.setTotalFarBytes(totalBytes);
    }
    if (totalBytes > 0) {
        int p = (int) (((float) soFarBytes / totalBytes) * 100);
        unLimit91PornItem.setProgress(p);
    }
    if (task.getStatus() == FileDownloadStatus.completed) {
        unLimit91PornItem.setFinishedDownloadDate(new Date());
    }
    unLimit91PornItem.setSpeed(task.getSpeed());
    unLimit91PornItem.setStatus(task.getStatus());
    dataManager.updateUnLimit91PornItem(unLimit91PornItem);
    if (task.getStatus() == FileDownloadStatus.completed) {
        complete(task);
    } else {
        update(task);
    }
}
Also used : UnLimit91PornItem(com.dante.data.model.UnLimit91PornItem) Date(java.util.Date)

Aggregations

UnLimit91PornItem (com.dante.data.model.UnLimit91PornItem)29 BaseResult (com.dante.data.model.BaseResult)10 ArrayList (java.util.ArrayList)10 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)8 View (android.view.View)8 BindView (butterknife.BindView)8 BaseQuickAdapter (com.chad.library.adapter.base.BaseQuickAdapter)8 List (java.util.List)7 RecyclerView (android.support.v7.widget.RecyclerView)6 MessageException (com.dante.exception.MessageException)6 NonNull (android.support.annotation.NonNull)5 OnLoadViewListener (com.helper.loadviewhelper.help.OnLoadViewListener)5 LoadViewHelper (com.helper.loadviewhelper.load.LoadViewHelper)5 Function (io.reactivex.functions.Function)5 Document (org.jsoup.nodes.Document)5 Element (org.jsoup.nodes.Element)5 Elements (org.jsoup.select.Elements)5 VideoResult (com.dante.data.model.VideoResult)4 FavoriteException (com.dante.exception.FavoriteException)4 Disposable (io.reactivex.disposables.Disposable)4