com.socks.jiandan.callback.LoadFinishCallBack Java Examples
The following examples show how to use
com.socks.jiandan.callback.LoadFinishCallBack.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: JDApi.java From JianDanRxJava with Apache License 2.0 | 6 votes |
public static Observable<ArrayList<Comment4FreshNews>> getCommentator4FreshNews(final String thread_key, LoadFinishCallBack callBack) { return Observable.create(new Observable.OnSubscribe<ArrayList<Comment4FreshNews>>() { @Override public void call(Subscriber<? super ArrayList<Comment4FreshNews>> subscriber) { String url = Comment4FreshNews.getUrlComments(thread_key); try { subscriber.onNext(new FreshNewsCommentParser(callBack).parse(OkHttpProxy.get() .url(url) .execute())); subscriber.onCompleted(); } catch (IOException e) { subscriber.onError(e); } } }).compose(applySchedulers()); }
Example #2
Source File: JDApi.java From JianDanRxJava with Apache License 2.0 | 6 votes |
public static Observable<ArrayList<Commentator>> getCommentator(final String thread_key, LoadFinishCallBack callBack) { return Observable.create(new Observable.OnSubscribe<ArrayList<Commentator>>() { @Override public void call(Subscriber<? super ArrayList<Commentator>> subscriber) { String url = Commentator.getUrlCommentList(thread_key); try { subscriber.onNext(new CommentListParser(callBack).parse(OkHttpProxy.get() .url(url) .execute())); subscriber.onCompleted(); } catch (IOException e) { subscriber.onError(e); } } }).compose(applySchedulers()); }
Example #3
Source File: FileUtil.java From JianDan with Apache License 2.0 | 5 votes |
/** * 保存图片 * * @param activity * @param picUrl */ public static void savePicture(Activity activity, String picUrl, LoadFinishCallBack loadFinishCallBack) { boolean isSmallPic = false; String[] urls = picUrl.split("\\."); File cacheFile = ImageLoader.getInstance().getDiskCache().get(picUrl); //如果是GIF格式,优先保存GIF动态图,如果不存在,则保存缩略图 if (!cacheFile.exists()) { String cacheUrl = picUrl.replace("mw600", "small").replace("mw1200", "small") .replace("large", "small"); cacheFile = ImageLoader.getInstance().getDiskCache().get(cacheUrl); isSmallPic = true; } File picDir = new File(CacheUtil.getSaveDirPath()); if (!picDir.exists()) { picDir.mkdir(); } final File newFile = new File(picDir, CacheUtil.getSavePicName(cacheFile, urls)); if (FileUtil.copyTo(cacheFile, newFile)) { Bundle bundle = new Bundle(); bundle.putBoolean(BaseActivity.DATA_IS_SIAMLL_PIC, isSmallPic); bundle.putString(BaseActivity.DATA_FILE_PATH, newFile.getAbsolutePath()); loadFinishCallBack.loadFinish(bundle); } else { ShowToast.Short(ConstantString.SAVE_FAILED); } }
Example #4
Source File: FileUtil.java From JianDanRxJava with Apache License 2.0 | 5 votes |
public static void savePicture(String picUrl, LoadFinishCallBack<Bundle> loadFinishCallBack) { boolean isSmallPic = false; String[] urls = picUrl.split("\\."); File cacheFile = ImageLoader.getInstance().getDiskCache().get(picUrl); //如果是GIF格式,优先保存GIF动态图,如果不存在,则保存缩略图 if (!cacheFile.exists()) { String cacheUrl = picUrl.replace("mw600", "small").replace("mw1200", "small") .replace("large", "small"); cacheFile = ImageLoader.getInstance().getDiskCache().get(cacheUrl); isSmallPic = true; } File picDir = new File(CacheUtil.getSaveDirPath()); if (!picDir.exists()) { if (picDir.mkdir()) { final File newFile = new File(picDir, CacheUtil.getSavePicName(cacheFile, urls)); if (FileUtil.copyTo(cacheFile, newFile)) { Bundle bundle = new Bundle(); bundle.putBoolean(BaseActivity.DATA_IS_SMALL_PIC, isSmallPic); bundle.putString(BaseActivity.DATA_FILE_PATH, newFile.getAbsolutePath()); loadFinishCallBack.loadFinish(bundle); } else { ToastHelper.Short(ConstantString.SAVE_FAILED); } } } }
Example #5
Source File: Request4CommentList.java From JianDan with Apache License 2.0 | 5 votes |
public Request4CommentList(String url, Response .Listener<ArrayList<Commentator>> listener, Response.ErrorListener errorListener, LoadFinishCallBack callBack) { super(Method.GET, url, errorListener); this.listener = listener; this.callBack = callBack; }
Example #6
Source File: FileUtil.java From JianDan_OkHttpWithVolley with Apache License 2.0 | 5 votes |
/** * 保存图片 * * @param activity * @param picUrl */ public static void savePicture(Activity activity, String picUrl, LoadFinishCallBack loadFinishCallBack) { boolean isSmallPic = false; String[] urls = picUrl.split("\\."); File cacheFile = ImageLoader.getInstance().getDiskCache().get(picUrl); //如果是GIF格式,优先保存GIF动态图,如果不存在,则保存缩略图 if (!cacheFile.exists()) { String cacheUrl = picUrl.replace("mw600", "small").replace("mw1200", "small") .replace("large", "small"); cacheFile = ImageLoader.getInstance().getDiskCache().get(cacheUrl); isSmallPic = true; } File picDir = new File(CacheUtil.getSaveDirPath()); if (!picDir.exists()) { picDir.mkdir(); } final File newFile = new File(picDir, CacheUtil.getSavePicName(cacheFile, urls)); if (FileUtil.copyTo(cacheFile, newFile)) { Bundle bundle = new Bundle(); bundle.putBoolean(BaseActivity.DATA_IS_SIAMLL_PIC, isSmallPic); bundle.putString(BaseActivity.DATA_FILE_PATH, newFile.getAbsolutePath()); loadFinishCallBack.loadFinish(bundle); } else { ShowToast.Short(ConstantString.SAVE_FAILED); } }
Example #7
Source File: PictureAdapter.java From JianDanRxJava with Apache License 2.0 | 5 votes |
public PictureAdapter(BaseActivity activity, LoadResultCallBack loadResultCallBack, LoadFinishCallBack<Object> loadFinisCallBack, int type) { mActivity = activity; mType = type; mLoadFinisCallBack = loadFinisCallBack; mLoadResultCallBack = loadResultCallBack; mPictures = new ArrayList<>(); isWifiConnected = NetWorkUtil.isWifiConnected(mActivity); }
Example #8
Source File: FileUtil.java From JianDan_OkHttp with Apache License 2.0 | 5 votes |
/** * 保存图片 * * @param activity * @param picUrl */ public static void savePicture(Activity activity, String picUrl, LoadFinishCallBack loadFinishCallBack) { boolean isSmallPic = false; String[] urls = picUrl.split("\\."); File cacheFile = ImageLoader.getInstance().getDiskCache().get(picUrl); //如果是GIF格式,优先保存GIF动态图,如果不存在,则保存缩略图 if (!cacheFile.exists()) { String cacheUrl = picUrl.replace("mw600", "small").replace("mw1200", "small") .replace("large", "small"); cacheFile = ImageLoader.getInstance().getDiskCache().get(cacheUrl); isSmallPic = true; } File picDir = new File(CacheUtil.getSaveDirPath()); if (!picDir.exists()) { picDir.mkdir(); } final File newFile = new File(picDir, CacheUtil.getSavePicName(cacheFile, urls)); if (FileUtil.copyTo(cacheFile, newFile)) { Bundle bundle = new Bundle(); bundle.putBoolean(BaseActivity.DATA_IS_SIAMLL_PIC, isSmallPic); bundle.putString(BaseActivity.DATA_FILE_PATH, newFile.getAbsolutePath()); loadFinishCallBack.loadFinish(bundle); } else { ShowToast.Short(ConstantString.SAVE_FAILED); } }
Example #9
Source File: FreshNewsAdapter.java From JianDan with Apache License 2.0 | 5 votes |
public FreshNewsAdapter(Activity activity, LoadFinishCallBack loadFinisCallBack, LoadResultCallBack loadResultCallBack, boolean isLargeMode) { this.mActivity = activity; this.isLargeMode = isLargeMode; this.mLoadFinisCallBack = loadFinisCallBack; this.mLoadResultCallBack = loadResultCallBack; mFreshNews = new ArrayList<>(); int loadingResource = isLargeMode ? R.drawable.ic_loading_large : R.drawable.ic_loading_small; options = ImageLoadProxy.getOptions4PictureList(loadingResource); }
Example #10
Source File: PictureAdapter.java From JianDan with Apache License 2.0 | 5 votes |
public PictureAdapter(Activity activity, LoadResultCallBack loadResultCallBack, LoadFinishCallBack loadFinisCallBack, Picture.PictureType type) { mActivity = activity; mType = type; mLoadFinisCallBack = loadFinisCallBack; mLoadResultCallBack = loadResultCallBack; pictures = new ArrayList<>(); isWifiConnected = NetWorkUtil.isWifiConnected(mActivity); }
Example #11
Source File: PictureAdapter.java From JianDan_OkHttp with Apache License 2.0 | 5 votes |
public PictureAdapter(Activity activity, LoadResultCallBack loadResultCallBack, LoadFinishCallBack loadFinisCallBack, Picture.PictureType type) { mActivity = activity; mType = type; mLoadFinisCallBack = loadFinisCallBack; mLoadResultCallBack = loadResultCallBack; pictures = new ArrayList<>(); isWifiConnected = NetWorkUtil.isWifiConnected(mActivity); }
Example #12
Source File: Request4CommentList.java From JianDan_OkHttpWithVolley with Apache License 2.0 | 5 votes |
public Request4CommentList(String url, Response .Listener<ArrayList<Commentator>> listener, Response.ErrorListener errorListener, LoadFinishCallBack callBack) { super(Method.GET, url, errorListener); this.listener = listener; this.callBack = callBack; }
Example #13
Source File: FreshNewsAdapter.java From JianDanRxJava with Apache License 2.0 | 5 votes |
public FreshNewsAdapter(BaseActivity activity, LoadFinishCallBack<Object> loadFinisCallBack, LoadResultCallBack loadResultCallBack) { this.mActivity = activity; this.isLargeMode = SPHelper.getBoolean(SettingFragment.ENABLE_FRESH_BIG, true); this.mLoadFinisCallBack = loadFinisCallBack; this.mLoadResultCallBack = loadResultCallBack; mFreshNews = new ArrayList<>(); int loadingResource = isLargeMode ? R.drawable.ic_loading_large : R.drawable.ic_loading_small; options = ImageLoadProxy.getOptions4PictureList(loadingResource); }
Example #14
Source File: FreshNewsAdapter.java From JianDan_OkHttp with Apache License 2.0 | 5 votes |
public FreshNewsAdapter(Activity activity, LoadFinishCallBack loadFinisCallBack, LoadResultCallBack loadResultCallBack, boolean isLargeMode) { this.mActivity = activity; this.isLargeMode = isLargeMode; this.mLoadFinisCallBack = loadFinisCallBack; this.mLoadResultCallBack = loadResultCallBack; mFreshNews = new ArrayList<>(); int loadingResource = isLargeMode ? R.drawable.ic_loading_large : R.drawable.ic_loading_small; options = ImageLoadProxy.getOptions4PictureList(loadingResource); }
Example #15
Source File: FreshNewsAdapter.java From JianDan_OkHttpWithVolley with Apache License 2.0 | 5 votes |
public FreshNewsAdapter(Activity activity, LoadFinishCallBack loadFinisCallBack, LoadResultCallBack loadResultCallBack, boolean isLargeMode) { this.mActivity = activity; this.isLargeMode = isLargeMode; this.mLoadFinisCallBack = loadFinisCallBack; this.mLoadResultCallBack = loadResultCallBack; mFreshNews = new ArrayList<>(); int loadingResource = isLargeMode ? R.drawable.ic_loading_large : R.drawable.ic_loading_small; options = ImageLoadProxy.getOptions4PictureList(loadingResource); }
Example #16
Source File: PictureAdapter.java From JianDan_OkHttpWithVolley with Apache License 2.0 | 5 votes |
public PictureAdapter(Activity activity, LoadResultCallBack loadResultCallBack, LoadFinishCallBack loadFinisCallBack, Picture.PictureType type) { mActivity = activity; mType = type; mLoadFinisCallBack = loadFinisCallBack; mLoadResultCallBack = loadResultCallBack; pictures = new ArrayList<>(); isWifiConnected = NetWorkUtil.isWifiConnected(mActivity); }
Example #17
Source File: Request4CommentList.java From JianDan_OkHttp with Apache License 2.0 | 5 votes |
public Request4CommentList(String url, Response .Listener<ArrayList<Commentator>> listener, Response.ErrorListener errorListener, LoadFinishCallBack callBack) { super(Method.GET, url, errorListener); this.listener = listener; this.callBack = callBack; }
Example #18
Source File: FreshNewsCommentParser.java From JianDanRxJava with Apache License 2.0 | 4 votes |
public FreshNewsCommentParser(LoadFinishCallBack<String> callBack) { mCallBack = callBack; }
Example #19
Source File: JokeAdapter.java From JianDanRxJava with Apache License 2.0 | 4 votes |
public JokeAdapter(BaseActivity activity, LoadFinishCallBack<Object> loadFinisCallBack, LoadResultCallBack loadResultCallBack) { mActivity = activity; mLoadFinisCallBack = loadFinisCallBack; mLoadResultCallBack = loadResultCallBack; mJokes = new ArrayList<>(); }
Example #20
Source File: CommentListParser.java From JianDan_OkHttp with Apache License 2.0 | 4 votes |
public CommentListParser(LoadFinishCallBack callBack) { this.callBack = callBack; }
Example #21
Source File: FreshNewsCommentParser.java From JianDan_OkHttp with Apache License 2.0 | 4 votes |
public FreshNewsCommentParser(LoadFinishCallBack mCallBack) { this.mCallBack = mCallBack; }
Example #22
Source File: JokeAdapter.java From JianDan_OkHttp with Apache License 2.0 | 4 votes |
public JokeAdapter(Activity activity, LoadFinishCallBack loadFinisCallBack, LoadResultCallBack loadResultCallBack) { mActivity = activity; mLoadFinisCallBack = loadFinisCallBack; mLoadResultCallBack = loadResultCallBack; mJokes = new ArrayList<>(); }
Example #23
Source File: PictureAdapter.java From JianDan_OkHttp with Apache License 2.0 | 4 votes |
public void setmSaveFileCallBack(LoadFinishCallBack mSaveFileCallBack) { this.mSaveFileCallBack = mSaveFileCallBack; }
Example #24
Source File: VideoAdapter.java From JianDan_OkHttp with Apache License 2.0 | 4 votes |
public VideoAdapter(Activity activity, LoadResultCallBack loadResultCallBack, LoadFinishCallBack loadFinisCallBack) { mActivity = activity; mLoadFinisCallBack = loadFinisCallBack; mLoadResultCallBack = loadResultCallBack; mVideos = new ArrayList<>(); }
Example #25
Source File: Request4FreshNewsCommentList.java From JianDan_OkHttp with Apache License 2.0 | 4 votes |
public Request4FreshNewsCommentList(String url, Response.Listener<ArrayList<Comment4FreshNews>> listener, Response.ErrorListener errorListener, LoadFinishCallBack callBack) { super(Method.GET, url, errorListener); mListener = listener; mCallBack = callBack; }
Example #26
Source File: CommentListParser.java From JianDanRxJava with Apache License 2.0 | 4 votes |
public CommentListParser(LoadFinishCallBack<String> callBack) { this.mCallBack = callBack; }
Example #27
Source File: VideoAdapter.java From JianDanRxJava with Apache License 2.0 | 4 votes |
public VideoAdapter(BaseActivity activity, LoadResultCallBack loadResultCallBack, LoadFinishCallBack<Object> loadFinisCallBack) { mActivity = activity; mLoadFinisCallBack = loadFinisCallBack; mLoadResultCallBack = loadResultCallBack; mVideos = new ArrayList<>(); }
Example #28
Source File: PictureAdapter.java From JianDanRxJava with Apache License 2.0 | 4 votes |
public void setSaveFileCallBack(LoadFinishCallBack mSaveFileCallBack) { this.mSaveFileCallBack = mSaveFileCallBack; }
Example #29
Source File: Request4FreshNewsCommentList.java From JianDan with Apache License 2.0 | 4 votes |
public Request4FreshNewsCommentList(String url, Response.Listener<ArrayList<Comment4FreshNews>> listener, Response.ErrorListener errorListener, LoadFinishCallBack callBack) { super(Method.GET, url, errorListener); mListener = listener; mCallBack = callBack; }
Example #30
Source File: CommentAdapter.java From JianDan with Apache License 2.0 | 4 votes |
public void loadData() { RequestManager.addRequest(new Request4CommentList(Commentator.getUrlCommentList(thread_key), new Response .Listener<ArrayList<Commentator>>() { @Override public void onResponse(ArrayList<Commentator> response) { if (response.size() == 0) { mLoadResultCallBack.onSuccess(LoadResultCallBack.SUCCESS_NONE, null); } else { commentators.clear(); ArrayList<Commentator> hotCommentator = new ArrayList<>(); ArrayList<Commentator> normalComment = new ArrayList<>(); //添加热门评论 for (Commentator commentator : response) { if (commentator.getTag().equals(Commentator.TAG_HOT)) { hotCommentator.add(commentator); } else { normalComment.add(commentator); } } //添加热门评论标签 if (hotCommentator.size() != 0) { Collections.sort(hotCommentator); Commentator hotCommentFlag = new Commentator(); hotCommentFlag.setType(Commentator.TYPE_HOT); hotCommentator.add(0, hotCommentFlag); commentators.addAll(hotCommentator); } //添加最新评论及标签 if (normalComment.size() != 0) { Commentator newCommentFlag = new Commentator(); newCommentFlag.setType(Commentator.TYPE_NEW); commentators.add(newCommentFlag); Collections.sort(normalComment); commentators.addAll(normalComment); } notifyDataSetChanged(); mLoadResultCallBack.onSuccess(LoadResultCallBack.SUCCESS_OK, null); } } }, new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { mLoadResultCallBack.onError(LoadResultCallBack.ERROR_NET, error.getMessage()); } }, new LoadFinishCallBack() { @Override public void loadFinish(Object obj) { thread_id = (String) obj; } }), mActivity); }