当前位置: 首页>>代码示例>>Java>>正文


Java ResHelper.getCachePath方法代码示例

本文整理汇总了Java中com.mob.tools.utils.ResHelper.getCachePath方法的典型用法代码示例。如果您正苦于以下问题:Java ResHelper.getCachePath方法的具体用法?Java ResHelper.getCachePath怎么用?Java ResHelper.getCachePath使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.mob.tools.utils.ResHelper的用法示例。


在下文中一共展示了ResHelper.getCachePath方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: shareDataToShareParams

import com.mob.tools.utils.ResHelper; //导入方法依赖的package包/类
final ShareParams shareDataToShareParams(Platform plat) {
	if (plat == null || shareParamsMap == null) {
		toast("ssdk_oks_share_failed");
		return null;
	}

	try {
		String imagePath = ResHelper.forceCast(shareParamsMap.get("imagePath"));
		Bitmap viewToShare = ResHelper.forceCast(shareParamsMap.get("viewToShare"));
		if (TextUtils.isEmpty(imagePath) && viewToShare != null && !viewToShare.isRecycled()) {
			String path = ResHelper.getCachePath(plat.getContext(), "screenshot");
			File ss = new File(path, String.valueOf(System.currentTimeMillis()) + ".jpg");
			FileOutputStream fos = new FileOutputStream(ss);
			viewToShare.compress(CompressFormat.JPEG, 100, fos);
			fos.flush();
			fos.close();
			shareParamsMap.put("imagePath", ss.getAbsolutePath());
		}
	} catch (Throwable t) {
		t.printStackTrace();
		toast("ssdk_oks_share_failed");
		return null;
	}

	return new ShareParams(shareParamsMap);
}
 
开发者ID:Zyj163,项目名称:yyox,代码行数:27,代码来源:OnekeyShareThemeImpl.java

示例2: shareDataToShareParams

import com.mob.tools.utils.ResHelper; //导入方法依赖的package包/类
final ShareParams shareDataToShareParams(Platform plat) {
	if (plat == null || shareParamsMap == null) {
		toast("ssdk_oks_share_failed");
		return null;
	}

	try {
		String imagePath = ResHelper.forceCast(shareParamsMap.get("imagePath"));
		Bitmap viewToShare = ResHelper.forceCast(shareParamsMap.get("viewToShare"));
		if (TextUtils.isEmpty(imagePath) && viewToShare != null && !viewToShare.isRecycled()) {
			String path = ResHelper.getCachePath(MobSDK.getContext(), "screenshot");
			File ss = new File(path, String.valueOf(System.currentTimeMillis()) + ".jpg");
			FileOutputStream fos = new FileOutputStream(ss);
			viewToShare.compress(CompressFormat.JPEG, 100, fos);
			fos.flush();
			fos.close();
			shareParamsMap.put("imagePath", ss.getAbsolutePath());
		}
	} catch (Throwable t) {
		t.printStackTrace();
		toast("ssdk_oks_share_failed");
		return null;
	}

	return new ShareParams(shareParamsMap);
}
 
开发者ID:Horrarndoo,项目名称:YiZhi,代码行数:27,代码来源:OnekeyShareThemeImpl.java

示例3: repick

import com.mob.tools.utils.ResHelper; //导入方法依赖的package包/类
public void repick() {
	pickResult = null;
	output = (ResHelper.getCachePath(activity, "images") + System.currentTimeMillis() + ".jpg");
	if (cameraType) {
		Intent i = new Intent("android.media.action.IMAGE_CAPTURE");
		Uri uri;
		if (Build.VERSION.SDK_INT >= 24) {
			ContentValues values = new ContentValues(1);
			values.put(MediaStore.Images.Media.MIME_TYPE, "image/jpg");
			uri = activity.getContentResolver().insert(
					MediaStore.Images.Media.EXTERNAL_CONTENT_URI, values);
			output = ResHelper.contentUriToPath(activity, uri);
		} else {
			uri = Uri.fromFile(new File(output));
		}
		i.putExtra("output", uri);
		i.putExtra("android.intent.extra.videoQuality", 1);
		startActivityForResult(i, REQ_PICK_IMAGE_FROM_CAMERA);
	} else {
		Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
		intent.setFlags(0x00080000); // 0x00080000 == FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET或者FLAG_ACTIVITY_NEW_DOCUMENT
		intent.setType("image/*");
		startActivityForResult(intent, REQ_PICK_IMAGE_FROM_ALBUM);
	}
}
 
开发者ID:MobClub,项目名称:BBSSDK-for-Android,代码行数:26,代码来源:PhotoCropPage.java

示例4: loadContent

import com.mob.tools.utils.ResHelper; //导入方法依赖的package包/类
protected void loadContent(final String filePath, final String extension, final LoadContentListener loadContentListener) {
	htmlPath = null;
	//2. 将文件转成html
	String tmpPath = ResHelper.getCachePath(getContext(), "attachment/html");
	final String fileMd5 = Data.MD5(filePath);
	String htmlName = fileMd5 + ".html";
	final File htmlFile = new File(tmpPath, htmlName);
	htmlPath = htmlFile.getAbsolutePath();
	if (htmlFile.exists()) {
		//如果已经转换过了,则直接使用webview打开html
		webView.loadUrl("file:///" + htmlPath);
		loadContentListener.onLoadFinished(true);
	} else {
		//如果没有转换,则起线程开始转换
		new Thread() {
			public void run() {
				try {
					String imagePath = ResHelper.getCachePath(getContext(), "attachment/html/img/" + fileMd5);
					OfficeConverter converter = new OfficeConverter(filePath, extension, htmlPath, imagePath);
					converter.convertToHtml();
				} catch (Throwable t) {
					htmlFile.delete();
					t.printStackTrace();
				}
				new UIHandler().sendEmptyMessage(0, new Handler.Callback() {
					public boolean handleMessage(Message msg) {
						if (!TextUtils.isEmpty(htmlPath) && new File(htmlPath).exists()) {
							//转换成功,则使用webview打开html
							webView.loadUrl("file:///" + htmlPath);
							loadContentListener.onLoadFinished(true);
						} else {
							loadContentListener.onLoadFinished(false);
						}
						return false;
					}
				});
			}
		}.start();
	}
}
 
开发者ID:MobClub,项目名称:BBSSDK-for-Android,代码行数:41,代码来源:PageOfficeViewer.java


注:本文中的com.mob.tools.utils.ResHelper.getCachePath方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。