51 lines
2.0 KiB
Java
51 lines
2.0 KiB
Java
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);
|
|
// }
|
|
}
|
|
}
|
|
}
|