com.socks.jiandan.utils.ShowToast Java Examples
The following examples show how to use
com.socks.jiandan.utils.ShowToast.
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: PictureFragment.java From JianDan with Apache License 2.0 | 6 votes |
public void onEventMainThread(NetWorkEvent event) { if (event.getType() == NetWorkEvent.AVAILABLE) { if (NetWorkUtil.isWifiConnected(getActivity())) { mAdapter.setIsWifi(true); if (!isFirstChange && (System.currentTimeMillis() - lastShowTime) > 3000) { ShowToast.Short("已切换为WIFI模式,自动加载GIF图片"); lastShowTime = System.currentTimeMillis(); } } else { mAdapter.setIsWifi(false); if (!isFirstChange && (System.currentTimeMillis() - lastShowTime) > 3000) { ShowToast.Short("已切换为省流量模式,只加载GIF缩略图"); lastShowTime = System.currentTimeMillis(); } } isFirstChange = false; } }
Example #2
Source File: PictureFragment.java From JianDan_OkHttpWithVolley with Apache License 2.0 | 6 votes |
public void onEventMainThread(NetWorkEvent event) { if (event.getType() == NetWorkEvent.AVAILABLE) { if (NetWorkUtil.isWifiConnected(getActivity())) { mAdapter.setIsWifi(true); if (!isFirstChange && (System.currentTimeMillis() - lastShowTime) > 3000) { ShowToast.Short("已切换为WIFI模式,自动加载GIF图片"); lastShowTime = System.currentTimeMillis(); } } else { mAdapter.setIsWifi(false); if (!isFirstChange && (System.currentTimeMillis() - lastShowTime) > 3000) { ShowToast.Short("已切换为省流量模式,只加载GIF缩略图"); lastShowTime = System.currentTimeMillis(); } } isFirstChange = false; } }
Example #3
Source File: PictureFragment.java From JianDan_OkHttp with Apache License 2.0 | 6 votes |
public void onEventMainThread(NetWorkEvent event) { if (event.getType() == NetWorkEvent.AVAILABLE) { if (NetWorkUtil.isWifiConnected(getActivity())) { mAdapter.setIsWifi(true); if (!isFirstChange && (System.currentTimeMillis() - lastShowTime) > 3000) { ShowToast.Short("已切换为WIFI模式,自动加载GIF图片"); lastShowTime = System.currentTimeMillis(); } } else { mAdapter.setIsWifi(false); if (!isFirstChange && (System.currentTimeMillis() - lastShowTime) > 3000) { ShowToast.Short("已切换为省流量模式,只加载GIF缩略图"); lastShowTime = System.currentTimeMillis(); } } isFirstChange = false; } }
Example #4
Source File: VideoAdapter.java From JianDan_OkHttp with Apache License 2.0 | 5 votes |
private void loadCache() { mLoadResultCallBack.onSuccess(LoadResultCallBack.SUCCESS_OK, null); mLoadFinisCallBack.loadFinish(null); VideoCache videoCacheUtil = VideoCache.getInstance(mActivity); if (page == 1) { mVideos.clear(); ShowToast.Short(ConstantString.LOAD_NO_NETWORK); } mVideos.addAll(videoCacheUtil.getCacheByPage(page)); notifyDataSetChanged(); }
Example #5
Source File: JokeAdapter.java From JianDan_OkHttpWithVolley with Apache License 2.0 | 5 votes |
private void loadCache() { mLoadFinisCallBack.loadFinish(null); mLoadResultCallBack.onSuccess(LoadResultCallBack.SUCCESS_OK, null); JokeCache jokeCacheUtil = JokeCache.getInstance(mActivity); if (page == 1) { mJokes.clear(); ShowToast.Short(ConstantString.LOAD_NO_NETWORK); } mJokes.addAll(jokeCacheUtil.getCacheByPage(page)); notifyDataSetChanged(); }
Example #6
Source File: FreshNewsFragment.java From JianDan with Apache License 2.0 | 5 votes |
@Override public void onError(int code, String msg) { loading.stop(); ShowToast.Short(ConstantString.LOAD_FAILED); if (mSwipeRefreshLayout.isRefreshing()) { mSwipeRefreshLayout.setRefreshing(false); } }
Example #7
Source File: ImageDetailActivity.java From JianDan with Apache License 2.0 | 5 votes |
@OnClick({R.id.img_back, R.id.img_share, R.id.tv_unlike, R.id.tv_like, R.id.img_comment, R.id.img_download}) @Override public void onClick(View v) { switch (v.getId()) { case R.id.img_back: finish(); break; case R.id.img_share: ShareUtil.sharePicture(this, img_urls[0]); break; case R.id.tv_like: ShowToast.Short("别点了,这玩意不能用"); break; case R.id.tv_unlike: ShowToast.Short("别点了,这玩意不能用"); break; case R.id.img_comment: Intent intent = new Intent(this, CommentListActivity.class); intent.putExtra(DATA_THREAD_KEY, threadKey); startActivity(intent); break; case R.id.img_download: FileUtil.savePicture(this, img_urls[0], this); break; } }
Example #8
Source File: ImageDetailActivity.java From JianDan with Apache License 2.0 | 5 votes |
@JavascriptInterface public void img_loaded_error() { runOnUiThread(new Runnable() { @Override public void run() { ShowToast.Short(ConstantString.LOAD_FAILED); } }); }
Example #9
Source File: MainActivity.java From JianDan with Apache License 2.0 | 5 votes |
@Override public boolean onKeyDown(int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_BACK && event.getAction() == KeyEvent.ACTION_DOWN) { if ((System.currentTimeMillis() - exitTime) > 2000) { ShowToast.Short("再按一次退出程序"); exitTime = System.currentTimeMillis(); } else { finish(); } return true; } return super.onKeyDown(keyCode, event); }
Example #10
Source File: PushCommentActivity.java From JianDan with Apache License 2.0 | 5 votes |
@Override public void onResponse(Boolean response) { dialog.dismiss(); if (response) { setResult(RESULT_OK); finish(); } else { ShowToast.Short(ConstantString.COMMENT_FAILED); } }
Example #11
Source File: CommentListActivity.java From JianDan with Apache License 2.0 | 5 votes |
@Override public void onSuccess(int result, Object object) { if (result == LoadResultCallBack.SUCCESS_NONE) { ShowToast.Short(NO_COMMENTS); } loading.stop(); mSwipeRefreshLayout.setRefreshing(false); }
Example #12
Source File: TestClass.java From JianDan with Apache License 2.0 | 5 votes |
protected Response.ErrorListener errorListener() { return new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { ShowToast.Short(error.getMessage()); } }; }
Example #13
Source File: JokeAdapter.java From JianDan_OkHttp with Apache License 2.0 | 5 votes |
private void loadCache() { mLoadFinisCallBack.loadFinish(null); mLoadResultCallBack.onSuccess(LoadResultCallBack.SUCCESS_OK, null); JokeCache jokeCacheUtil = JokeCache.getInstance(mActivity); if (page == 1) { mJokes.clear(); ShowToast.Short(ConstantString.LOAD_NO_NETWORK); } mJokes.addAll(jokeCacheUtil.getCacheByPage(page)); notifyDataSetChanged(); }
Example #14
Source File: PictureAdapter.java From JianDan_OkHttp with Apache License 2.0 | 5 votes |
private void loadCache() { mLoadResultCallBack.onSuccess(LoadResultCallBack.SUCCESS_OK, null); mLoadFinisCallBack.loadFinish(null); PictureCache pictureCacheUtil = PictureCache.getInstance(mActivity); if (page == 1) { pictures.clear(); ShowToast.Short(ConstantString.LOAD_NO_NETWORK); } pictures.addAll(pictureCacheUtil.getCacheByPage(page)); notifyDataSetChanged(); }
Example #15
Source File: VideoFragment.java From JianDan with Apache License 2.0 | 5 votes |
@Override public void onError(int code, String msg) { loading.stop(); ShowToast.Short(ConstantString.LOAD_FAILED); if (mSwipeRefreshLayout.isRefreshing()) { mSwipeRefreshLayout.setRefreshing(false); } }
Example #16
Source File: JokeFragment.java From JianDan_OkHttp with Apache License 2.0 | 5 votes |
@Override public void onError(int code, String msg) { loading.stop(); ShowToast.Short(LOAD_FAILED); if (mSwipeRefreshLayout.isRefreshing()) { mSwipeRefreshLayout.setRefreshing(false); } }
Example #17
Source File: VideoFragment.java From JianDan_OkHttp with Apache License 2.0 | 5 votes |
@Override public void onError(int code, String msg) { loading.stop(); ShowToast.Short(ConstantString.LOAD_FAILED); if (mSwipeRefreshLayout.isRefreshing()) { mSwipeRefreshLayout.setRefreshing(false); } }
Example #18
Source File: FreshNewsFragment.java From JianDan_OkHttp with Apache License 2.0 | 5 votes |
@Override public void onError(int code, String msg) { loading.stop(); ShowToast.Short(ConstantString.LOAD_FAILED); if (mSwipeRefreshLayout.isRefreshing()) { mSwipeRefreshLayout.setRefreshing(false); } }
Example #19
Source File: ImageDetailActivity.java From JianDan_OkHttp with Apache License 2.0 | 5 votes |
@OnClick({R.id.img_back, R.id.img_share, R.id.tv_unlike, R.id.tv_like, R.id.img_comment, R.id.img_download}) @Override public void onClick(View v) { switch (v.getId()) { case R.id.img_back: finish(); break; case R.id.img_share: ShareUtil.sharePicture(this, img_urls[0]); break; case R.id.tv_like: ShowToast.Short("别点了,这玩意不能用"); break; case R.id.tv_unlike: ShowToast.Short("别点了,这玩意不能用"); break; case R.id.img_comment: Intent intent = new Intent(this, CommentListActivity.class); intent.putExtra(DATA_THREAD_KEY, threadKey); startActivity(intent); break; case R.id.img_download: FileUtil.savePicture(this, img_urls[0], this); break; } }
Example #20
Source File: ImageDetailActivity.java From JianDan_OkHttp with Apache License 2.0 | 5 votes |
@JavascriptInterface public void img_loaded_error() { runOnUiThread(new Runnable() { @Override public void run() { ShowToast.Short(ConstantString.LOAD_FAILED); } }); }
Example #21
Source File: MainActivity.java From JianDan_OkHttp with Apache License 2.0 | 5 votes |
@Override public boolean onKeyDown(int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_BACK && event.getAction() == KeyEvent.ACTION_DOWN) { if ((System.currentTimeMillis() - exitTime) > 2000) { ShowToast.Short("再按一次退出程序"); exitTime = System.currentTimeMillis(); } else { finish(); } return true; } return super.onKeyDown(keyCode, event); }
Example #22
Source File: CommentListActivity.java From JianDan_OkHttp with Apache License 2.0 | 5 votes |
@Override public void onSuccess(int result, Object object) { if (result == LoadResultCallBack.SUCCESS_NONE) { ShowToast.Short(NO_COMMENTS); } loading.stop(); mSwipeRefreshLayout.setRefreshing(false); }
Example #23
Source File: TestClass.java From JianDan_OkHttp with Apache License 2.0 | 5 votes |
protected Response.ErrorListener errorListener() { return new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { ShowToast.Short(error.getMessage()); } }; }
Example #24
Source File: PushCommentActivity.java From JianDan_OkHttpWithVolley with Apache License 2.0 | 5 votes |
@Override public void onResponse(Boolean response) { dialog.dismiss(); if (response) { setResult(RESULT_OK); finish(); } else { ShowToast.Short(ConstantString.COMMENT_FAILED); } }
Example #25
Source File: PictureAdapter.java From JianDan_OkHttpWithVolley with Apache License 2.0 | 5 votes |
private void loadCache() { mLoadResultCallBack.onSuccess(LoadResultCallBack.SUCCESS_OK, null); mLoadFinisCallBack.loadFinish(null); PictureCache pictureCacheUtil = PictureCache.getInstance(mActivity); if (page == 1) { pictures.clear(); ShowToast.Short(ConstantString.LOAD_NO_NETWORK); } pictures.addAll(pictureCacheUtil.getCacheByPage(page)); notifyDataSetChanged(); }
Example #26
Source File: PictureAdapter.java From JianDan_OkHttpWithVolley with Apache License 2.0 | 5 votes |
private void getCommentCounts(final ArrayList<Picture> pictures) { StringBuilder sb = new StringBuilder(); for (Picture joke : pictures) { sb.append("comment-" + joke.getComment_ID() + ","); } RequestManager.addRequest(new Request4CommentCounts(CommentNumber.getCommentCountsURL(sb.toString()), new Response .Listener<ArrayList<CommentNumber>>() { @Override public void onResponse(ArrayList<CommentNumber> response) { mLoadResultCallBack.onSuccess(LoadResultCallBack.SUCCESS_OK, null); mLoadFinisCallBack.loadFinish(null); for (int i = 0; i < pictures.size(); i++) { pictures.get(i).setComment_counts(response.get(i).getComments() + ""); } if (page == 1) { PictureAdapter.this.pictures.clear(); PictureCache.getInstance(mActivity).clearAllCache(); } PictureAdapter.this.pictures.addAll(pictures); notifyDataSetChanged(); //加载完毕后缓存 PictureCache.getInstance(mActivity).addResultCache(JSONParser.toString (pictures), page); } }, new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { ShowToast.Short(ConstantString.LOAD_FAILED); mLoadFinisCallBack.loadFinish(null); mLoadResultCallBack.onError(LoadResultCallBack.ERROR_NET, error.getMessage()); } } ), mActivity); }
Example #27
Source File: VideoAdapter.java From JianDan_OkHttpWithVolley with Apache License 2.0 | 5 votes |
private void loadCache() { mLoadResultCallBack.onSuccess(LoadResultCallBack.SUCCESS_OK, null); mLoadFinisCallBack.loadFinish(null); VideoCache videoCacheUtil = VideoCache.getInstance(mActivity); if (page == 1) { mVideos.clear(); ShowToast.Short(ConstantString.LOAD_NO_NETWORK); } mVideos.addAll(videoCacheUtil.getCacheByPage(page)); notifyDataSetChanged(); }
Example #28
Source File: JokeFragment.java From JianDan_OkHttpWithVolley with Apache License 2.0 | 5 votes |
@Override public void onError(int code, String msg) { loading.stop(); ShowToast.Short(LOAD_FAILED); if (mSwipeRefreshLayout.isRefreshing()) { mSwipeRefreshLayout.setRefreshing(false); } }
Example #29
Source File: VideoFragment.java From JianDan_OkHttpWithVolley with Apache License 2.0 | 5 votes |
@Override public void onError(int code, String msg) { loading.stop(); ShowToast.Short(ConstantString.LOAD_FAILED); if (mSwipeRefreshLayout.isRefreshing()) { mSwipeRefreshLayout.setRefreshing(false); } }
Example #30
Source File: FreshNewsFragment.java From JianDan_OkHttpWithVolley with Apache License 2.0 | 5 votes |
@Override public void onError(int code, String msg) { loading.stop(); ShowToast.Short(ConstantString.LOAD_FAILED); if (mSwipeRefreshLayout.isRefreshing()) { mSwipeRefreshLayout.setRefreshing(false); } }