Search in sources :

Example 21 with BaseResult

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

the class AppApiHelper method loadPorn91VideoByCategory.

@Override
public Observable<BaseResult<List<UnLimit91PornItem>>> loadPorn91VideoByCategory(String category, String viewType, int page, String m, boolean cleanCache, boolean isLoadMoreCleanCache) {
    // RxCache条件区别
    String condition;
    if (TextUtils.isEmpty(m)) {
        condition = category;
    } else {
        condition = category + m;
    }
    DynamicKeyGroup dynamicKeyGroup = new DynamicKeyGroup(condition, page);
    EvictDynamicKey evictDynamicKey = new EvictDynamicKey(cleanCache || isLoadMoreCleanCache);
    Observable<String> categoryPage = noLimit91PornServiceApi.getCategoryPage(category, viewType, page, m, HeaderUtils.getIndexHeader(addressHelper));
    return cacheProviders.getCategoryPage(categoryPage, dynamicKeyGroup, evictDynamicKey).map(new Function<Reply<String>, String>() {

        @Override
        public String apply(Reply<String> responseBody) throws Exception {
            return responseBody.getData();
        }
    }).map(new Function<String, BaseResult<List<UnLimit91PornItem>>>() {

        @Override
        public BaseResult<List<UnLimit91PornItem>> apply(String s) throws Exception {
            return Parse91PronVideo.parseHot(s);
        }
    });
}
Also used : Function(io.reactivex.functions.Function) BaseResult(com.dante.data.model.BaseResult) EvictDynamicKey(io.rx_cache2.EvictDynamicKey) Reply(io.rx_cache2.Reply) EvictDynamicKeyGroup(io.rx_cache2.EvictDynamicKeyGroup) DynamicKeyGroup(io.rx_cache2.DynamicKeyGroup) UnLimit91PornItem(com.dante.data.model.UnLimit91PornItem) FavoriteException(com.dante.exception.FavoriteException) MessageException(com.dante.exception.MessageException)

Example 22 with BaseResult

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

the class AppApiHelper method loadPorn91authorVideos.

@Override
public Observable<BaseResult<List<UnLimit91PornItem>>> loadPorn91authorVideos(String uid, String type, int page, boolean cleanCache) {
    // RxCache条件区别
    String condition = null;
    if (!TextUtils.isEmpty(uid)) {
        condition = uid;
    }
    DynamicKeyGroup dynamicKeyGroup = new DynamicKeyGroup(condition, page);
    EvictDynamicKey evictDynamicKey = new EvictDynamicKey(cleanCache);
    Observable<String> stringObservable = noLimit91PornServiceApi.authorVideos(uid, type, page);
    return cacheProviders.authorVideos(stringObservable, dynamicKeyGroup, evictDynamicKey).map(new Function<Reply<String>, String>() {

        @Override
        public String apply(Reply<String> responseBody) throws Exception {
            return responseBody.getData();
        }
    }).map(new Function<String, BaseResult<List<UnLimit91PornItem>>>() {

        @Override
        public BaseResult<List<UnLimit91PornItem>> apply(String s) throws Exception {
            return Parse91PronVideo.parseAuthorVideos(s);
        }
    });
}
Also used : Function(io.reactivex.functions.Function) BaseResult(com.dante.data.model.BaseResult) EvictDynamicKey(io.rx_cache2.EvictDynamicKey) Reply(io.rx_cache2.Reply) EvictDynamicKeyGroup(io.rx_cache2.EvictDynamicKeyGroup) DynamicKeyGroup(io.rx_cache2.DynamicKeyGroup) UnLimit91PornItem(com.dante.data.model.UnLimit91PornItem) FavoriteException(com.dante.exception.FavoriteException) MessageException(com.dante.exception.MessageException)

Aggregations

BaseResult (com.dante.data.model.BaseResult)22 ArrayList (java.util.ArrayList)14 List (java.util.List)14 Document (org.jsoup.nodes.Document)14 Element (org.jsoup.nodes.Element)14 Elements (org.jsoup.select.Elements)14 UnLimit91PornItem (com.dante.data.model.UnLimit91PornItem)10 MessageException (com.dante.exception.MessageException)7 Function (io.reactivex.functions.Function)6 DynamicKeyGroup (io.rx_cache2.DynamicKeyGroup)6 EvictDynamicKeyGroup (io.rx_cache2.EvictDynamicKeyGroup)6 Reply (io.rx_cache2.Reply)6 FavoriteException (com.dante.exception.FavoriteException)5 EvictDynamicKey (io.rx_cache2.EvictDynamicKey)4 PigAv (com.dante.data.model.PigAv)3 NonNull (android.support.annotation.NonNull)2 Forum91PronItem (com.dante.data.model.Forum91PronItem)2 MeiZiTu (com.dante.data.model.MeiZiTu)2 Mm99 (com.dante.data.model.Mm99)2 RetryWhenProcess (com.dante.rxjava.RetryWhenProcess)2