com.socks.jiandan.utils.FileUtil Java Examples
The following examples show how to use
com.socks.jiandan.utils.FileUtil.
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: ImageDetailActivity.java From JianDanRxJava with Apache License 2.0 | 6 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}) void click(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: ToastHelper.Short(UN_CLICK); break; case R.id.tv_unlike: ToastHelper.Short(UN_CLICK); 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(img_urls[0], this); break; } }
Example #2
Source File: ImageDetailActivity.java From JianDan_OkHttpWithVolley 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 #3
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 #4
Source File: SettingFragment.java From JianDanRxJava with Apache License 2.0 | 5 votes |
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); addPreferencesFromResource(R.xml.preferences); clearCache = findPreference(CLEAR_CACHE); aboutApp = findPreference(ABOUT_APP); appVersion = findPreference(APP_VERSION); enableSister = (CheckBoxPreference) findPreference(ENABLE_SISTER); enableBig = (CheckBoxPreference) findPreference(ENABLE_FRESH_BIG); appVersion.setTitle(AppInfoUtil.getVersionName(getActivity())); File cacheFile = ImageLoader.getInstance().getDiskCache().getDirectory(); DecimalFormat decimalFormat = new DecimalFormat("#0.00"); clearCache.setSummary(getString(R.string.cache_size) + decimalFormat.format(FileUtil.getDirSize(cacheFile)) + "M"); enableSister.setOnPreferenceChangeListener((preference, newValue) -> { ToastHelper.Short(((Boolean) newValue) ? getString(R.string.open_sister_mode) : getString(R.string.close_sister_mode)); return true; }); enableBig.setOnPreferenceChangeListener((preference, newValue) -> { ToastHelper.Short(((Boolean) newValue) ? getString(R.string.picture_mode_big) : getString(R.string.picture_mode_small)); return true; }); clearCache.setOnPreferenceClickListener(this); aboutApp.setOnPreferenceClickListener(this); }
Example #5
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 #6
Source File: PictureAdapter.java From JianDanRxJava with Apache License 2.0 | 4 votes |
@Override public void onBindViewHolder(final PictureViewHolder holder, final int position) { final Picture picture = mPictures.get(position); String picUrl = picture.getPics()[0]; if (picUrl.endsWith(".gif")) { holder.img_gif.setVisibility(View.VISIBLE); //非WIFI网络情况下,GIF图只加载缩略图,详情页才加载真实图片 if (!isWifiConnected) { picUrl = picUrl.replace("mw600", "small").replace("mw1200", "small").replace ("large", "small"); } } else { holder.img_gif.setVisibility(View.GONE); } holder.progress.setProgress(0); holder.progress.setVisibility(View.VISIBLE); ImageLoadProxy.displayImageList(picUrl, holder.img, R.drawable.ic_loading_large, new SimpleImageLoadingListener() { @Override public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) { super.onLoadingComplete(imageUri, view, loadedImage); holder.progress.setVisibility(View.GONE); } }, (imageUri, view, current, total) -> holder.progress.setProgress((int) (current * 100f / total))); if (TextUtil.isNull(picture.getText_content().trim())) { holder.tv_content.setVisibility(View.GONE); } else { holder.tv_content.setVisibility(View.VISIBLE); holder.tv_content.setText(picture.getText_content().trim()); } holder.img.setOnClickListener(v -> IntentHelper.toImageDetailActivity(mActivity, picture)); holder.tv_author.setText(picture.getComment_author()); holder.tv_time.setText(String2TimeUtil.dateString2GoodExperienceFormat(picture.getComment_date())); holder.tv_like.setText(picture.getVote_positive()); holder.tv_comment_count.setText(picture.getComment_counts()); //用于恢复默认的文字 holder.tv_like.setTypeface(Typeface.DEFAULT); holder.tv_like.setTextColor(mActivity.getResources().getColor( secondary_text_default_material_light)); holder.tv_support_des.setTextColor(mActivity.getResources().getColor( secondary_text_default_material_light)); holder.tv_unlike.setText(picture.getVote_negative()); holder.tv_unlike.setTypeface(Typeface.DEFAULT); holder.tv_unlike.setTextColor(mActivity.getResources().getColor( secondary_text_default_material_light)); holder.tv_un_support_des.setTextColor(mActivity.getResources().getColor( secondary_text_default_material_light)); holder.img_share.setOnClickListener(v -> new MaterialDialog.Builder(mActivity) .items(R.array.picture_dialog) .backgroundColor(mActivity.getResources().getColor(JDApplication.COLOR_OF_DIALOG)) .contentColor(JDApplication.COLOR_OF_DIALOG_CONTENT) .itemsCallback((dialog, view, which, text) -> { switch (which) { case 0: ShareUtil.sharePicture(mActivity, picture .getPics()[0]); break; case 1: FileUtil.savePicture(picture .getPics()[0], mSaveFileCallBack); break; } }) .show()); holder.ll_comment.setOnClickListener(v -> { Intent intent = new Intent(mActivity, CommentListActivity.class); intent.putExtra(BaseActivity.DATA_THREAD_KEY, "comment-" + picture.getComment_ID()); mActivity.startActivity(intent); }); setAnimation(holder.card, position); }