first
This commit is contained in:
50
app/src/main/java/com/ckkj/water/utils/PreviewFileUtil.java
Normal file
50
app/src/main/java/com/ckkj/water/utils/PreviewFileUtil.java
Normal file
@@ -0,0 +1,50 @@
|
||||
package com.ckkj.water.utils;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.ckkj.water.custom.view.PhotoViewActivity;
|
||||
|
||||
public class PreviewFileUtil {
|
||||
/**
|
||||
* 预览文件
|
||||
* @param suffix
|
||||
* @param fileUrl
|
||||
*/
|
||||
public static void previewFiles(Context mContext,String suffix, String fileUrl) {
|
||||
if(!TextUtils.isEmpty(suffix)){
|
||||
if(suffix.contains(".jpg") || suffix.contains(".jpeg") || suffix.contains(".png")){
|
||||
Intent intent = new Intent(mContext, PhotoViewActivity.class);
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putSerializable("img_url", fileUrl);
|
||||
bundle.putInt("img_item", 0);
|
||||
intent.putExtras(bundle);
|
||||
mContext.startActivity(intent);
|
||||
}
|
||||
// else if(suffix.equals("doc")
|
||||
// || suffix.equals("docx")){
|
||||
// Intent intent = new Intent(mContext, FileWebActivity.class);
|
||||
// Bundle bundle = new Bundle();
|
||||
// bundle.putString("file_url",fileUrl);
|
||||
// intent.putExtras(bundle);
|
||||
// mContext.startActivity(intent);
|
||||
// }else if(suffix.equals("xlsx")
|
||||
// || suffix.equals("xltx")
|
||||
// || suffix.equals("xls")){
|
||||
// Intent intent = new Intent(mContext,FileWebActivity.class);
|
||||
// Bundle bundle = new Bundle();
|
||||
// bundle.putString("file_url",fileUrl);
|
||||
// intent.putExtras(bundle);
|
||||
// mContext.startActivity(intent);
|
||||
// }else if(suffix.equals("pdf")){
|
||||
// Intent intent = new Intent(mContext, PDFWebActivity.class);
|
||||
// Bundle bundle = new Bundle();
|
||||
// bundle.putString("file_url",fileUrl);
|
||||
// intent.putExtras(bundle);
|
||||
// mContext.startActivity(intent);
|
||||
// }
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user