diff --git a/app/build.gradle b/app/build.gradle
index f1c88eed..4103627f 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -131,6 +131,7 @@ dependencies {
implementation 'com.github.bumptech.glide:glide:4.11.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.11.0'
+ implementation 'com.yanzhenjie:permission:2.0.0-rc12'
}
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 85f0d9e1..0e4c5933 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -28,6 +28,9 @@
android:theme="@style/AppTheme"
tools:ignore="GoogleAppIndexingWarning"
tools:node="merge">
+
diff --git a/app/src/main/java/com/bonait/bnframework/common/base/BaseFragment.java b/app/src/main/java/com/bonait/bnframework/common/base/BaseFragment.java
index 3097412f..151abbde 100644
--- a/app/src/main/java/com/bonait/bnframework/common/base/BaseFragment.java
+++ b/app/src/main/java/com/bonait/bnframework/common/base/BaseFragment.java
@@ -8,6 +8,10 @@ import androidx.annotation.Nullable;
import com.bonait.bnframework.MainApplication;
import com.bonait.bnframework.common.constant.Constants;
+import com.bonait.bnframework.common.filepicker.PickerManager;
+import com.bonait.bnframework.common.filepicker.adapter.FilePickerShowAdapter;
+import com.bonait.bnframework.common.filepicker.adapter.OnFileItemClickListener;
+import com.bonait.bnframework.common.filepicker.util.OpenFile;
import com.bonait.bnframework.common.utils.AlertDialogUtils;
import com.bonait.bnframework.common.utils.ToastUtils;
import com.qmuiteam.qmui.arch.QMUIFragment;
diff --git a/app/src/main/java/com/bonait/bnframework/common/constant/Constants.java b/app/src/main/java/com/bonait/bnframework/common/constant/Constants.java
index 93c84309..77ad7c86 100644
--- a/app/src/main/java/com/bonait/bnframework/common/constant/Constants.java
+++ b/app/src/main/java/com/bonait/bnframework/common/constant/Constants.java
@@ -21,6 +21,8 @@ public interface Constants {
// 申请权限跳转到设置界面code
int APP_SETTING_DIALOG_REQUEST_CODE = 1;
+ //选择文件事件
+ int REQ_CODE = 0X08;
// 申请权限code
int ALL_PERMISSION = 100;
diff --git a/app/src/main/java/com/bonait/bnframework/common/filepicker/FileAllFragment.java b/app/src/main/java/com/bonait/bnframework/common/filepicker/FileAllFragment.java
new file mode 100644
index 00000000..53d88eb2
--- /dev/null
+++ b/app/src/main/java/com/bonait/bnframework/common/filepicker/FileAllFragment.java
@@ -0,0 +1,182 @@
+package com.bonait.bnframework.common.filepicker;
+
+import android.os.Bundle;
+import android.os.Environment;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.TextView;
+import android.widget.Toast;
+
+import androidx.annotation.Nullable;
+import androidx.fragment.app.Fragment;
+import androidx.recyclerview.widget.LinearLayoutManager;
+import androidx.recyclerview.widget.RecyclerView;
+
+import com.bonait.bnframework.R;
+import com.bonait.bnframework.common.filepicker.adapter.AllFileAdapter;
+import com.bonait.bnframework.common.filepicker.adapter.OnFileItemClickListener;
+import com.bonait.bnframework.common.filepicker.model.FileEntity;
+import com.bonait.bnframework.common.filepicker.util.FileUtils;
+import com.yanzhenjie.permission.Action;
+import com.yanzhenjie.permission.AndPermission;
+import com.yanzhenjie.permission.Permission;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * 作者:chs on 2017-08-24 11:05
+ * 邮箱:657083984@qq.com
+ * 全部文件
+ */
+
+public class FileAllFragment extends Fragment {
+ private RecyclerView mRecyclerView;
+ private TextView mEmptyView,tv_back;
+ private String mPath;
+ private String rootPath;
+ private List mListFiles;
+ private FileSelectFilter mFilter;
+ //筛选类型条件
+ private String[] mFileTypes = new String[]{};
+ private AllFileAdapter mAllFileAdapter;
+ private OnUpdateDataListener mOnUpdateDataListener;
+
+ public void setOnUpdateDataListener(OnUpdateDataListener onUpdateDataListener) {
+ mOnUpdateDataListener = onUpdateDataListener;
+ }
+ public static FileAllFragment newInstance(){
+ return new FileAllFragment();
+ }
+ @Nullable
+ @Override
+ public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
+ View view = inflater.inflate(R.layout.fragment_file_all,null);
+ initView(view);
+ initData();
+ initEvent();
+ if(mOnUpdateDataListener!=null){
+
+ mOnUpdateDataListener.replacement();
+ }
+ return view;
+ }
+
+ private void initView(View view) {
+ LinearLayoutManager layoutManager = new LinearLayoutManager(getContext());
+ layoutManager.setOrientation(LinearLayoutManager.VERTICAL);
+ mRecyclerView = (RecyclerView) view.findViewById(R.id.rl_all_file);
+ mRecyclerView.setLayoutManager(layoutManager);
+ mEmptyView = (TextView) view.findViewById(R.id.empty_view);
+ tv_back = (TextView) view.findViewById(R.id.tv_back);
+ }
+
+ private void initData() {
+ AndPermission.with(this)
+ .runtime()
+ .permission(Permission.Group.STORAGE)
+ .onGranted(new Action>() {
+ @Override
+ public void onAction(List data) {
+ getData();
+ }
+ })
+ .onDenied(new Action>() {
+ @Override
+ public void onAction(List data) {
+ Toast.makeText(getContext(),"读写sdk权限被拒绝",Toast.LENGTH_LONG).show();
+ }
+ })
+ .start();
+ }
+
+ private void getData(){
+ if (!Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {
+ Toast.makeText(getContext(), R.string.not_available, Toast.LENGTH_SHORT).show();
+ return;
+ }
+ mPath = Environment.getExternalStorageDirectory().getAbsolutePath();
+ rootPath = Environment.getExternalStorageDirectory().getAbsolutePath();
+ mFilter = new FileSelectFilter(mFileTypes);
+ mListFiles = getFileList(mPath);
+ mAllFileAdapter = new AllFileAdapter(getContext(),mListFiles,mFilter);
+ mRecyclerView.setAdapter(mAllFileAdapter);
+
+ }
+
+ private void initEvent() {
+ tv_back.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ String tempPath = new File(mPath).getParent();
+ if (tempPath == null || mPath.equals(rootPath)) {
+ Toast.makeText(getContext(),"最外层了",Toast.LENGTH_SHORT).show();
+ return;
+ }
+ mPath = tempPath;
+ mListFiles = getFileList(mPath);
+ mAllFileAdapter.updateListData(mListFiles);
+ mAllFileAdapter.notifyDataSetChanged();
+ }
+ });
+ mAllFileAdapter.setOnItemClickListener(new OnFileItemClickListener() {
+ @Override
+ public void click(int position) {
+ FileEntity entity = mListFiles.get(position);
+ //如果是文件夹点击进入文件夹
+ if (entity.getFile().isDirectory()) {
+ getIntoChildFolder(position);
+ }else {
+ File file = entity.getFile();
+ ArrayList files = PickerManager.getInstance().files;
+ if(files.contains(entity)){
+ files.remove(entity);
+ if(mOnUpdateDataListener!=null){
+ mOnUpdateDataListener.update(-file.length());
+ }
+ entity.setSelected(!entity.isSelected());
+ mAllFileAdapter.notifyDataSetChanged();
+ }else {
+ if(PickerManager.getInstance().files.size()
+ */
+ private List getFileList(String path) {
+ List fileListByDirPath = FileUtils.getFileListByDirPath(path, mFilter);
+ if(fileListByDirPath.size()>0){
+ mEmptyView.setVisibility(View.GONE);
+ }else {
+ mEmptyView.setVisibility(View.VISIBLE);
+ }
+ return fileListByDirPath;
+ }
+}
diff --git a/app/src/main/java/com/bonait/bnframework/common/filepicker/FileCommonFragment.java b/app/src/main/java/com/bonait/bnframework/common/filepicker/FileCommonFragment.java
new file mode 100644
index 00000000..376df4c2
--- /dev/null
+++ b/app/src/main/java/com/bonait/bnframework/common/filepicker/FileCommonFragment.java
@@ -0,0 +1,127 @@
+package com.bonait.bnframework.common.filepicker;
+
+import android.os.Bundle;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.ProgressBar;
+import android.widget.TextView;
+import android.widget.Toast;
+
+import androidx.annotation.Nullable;
+import androidx.fragment.app.Fragment;
+import androidx.recyclerview.widget.LinearLayoutManager;
+import androidx.recyclerview.widget.RecyclerView;
+
+import com.bonait.bnframework.R;
+import com.bonait.bnframework.common.filepicker.adapter.CommonFileAdapter;
+import com.bonait.bnframework.common.filepicker.adapter.OnFileItemClickListener;
+import com.bonait.bnframework.common.filepicker.model.FileEntity;
+import com.yanzhenjie.permission.Action;
+import com.yanzhenjie.permission.AndPermission;
+import com.yanzhenjie.permission.Permission;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * 作者:chs on 2017-08-24 11:04
+ * 邮箱:657083984@qq.com
+ * 常用文件
+ */
+
+public class FileCommonFragment extends Fragment implements FileScannerTask.FileScannerListener {
+ private RecyclerView mRecyclerView;
+ private TextView mEmptyView;
+ private ProgressBar mProgressBar;
+ private CommonFileAdapter mCommonFileAdapter;
+ private OnUpdateDataListener mOnUpdateDataListener;
+
+ public void setOnUpdateDataListener(OnUpdateDataListener onUpdateDataListener) {
+ mOnUpdateDataListener = onUpdateDataListener;
+ }
+
+ public static FileCommonFragment newInstance(){
+ return new FileCommonFragment();
+ }
+ @Nullable
+ @Override
+ public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
+ View view = inflater.inflate(R.layout.fragment_file_normal,null);
+ initView(view);
+ initData();
+ return view;
+ }
+
+ private void initView(View view) {
+ LinearLayoutManager layoutManager = new LinearLayoutManager(getContext());
+ layoutManager.setOrientation(LinearLayoutManager.VERTICAL);
+ mRecyclerView = (RecyclerView) view.findViewById(R.id.rl_normal_file);
+ mRecyclerView.setLayoutManager(layoutManager);
+ mEmptyView = (TextView) view.findViewById(R.id.empty_view);
+ mProgressBar = (ProgressBar) view.findViewById(R.id.progress);
+ mProgressBar.setVisibility(View.VISIBLE);
+ }
+
+ private void initData() {
+ AndPermission.with(this)
+ .runtime()
+ .permission(Permission.Group.STORAGE)
+ .onGranted(new Action>() {
+ @Override
+ public void onAction(List data) {
+ new FileScannerTask(getContext(), FileCommonFragment.this).execute();
+ }
+ })
+ .onDenied(new Action>() {
+ @Override
+ public void onAction(List data) {
+ Toast.makeText(getContext(),"读写sdk权限被拒绝",Toast.LENGTH_LONG).show();
+ }
+ })
+ .start();
+ }
+
+ private void iniEvent(final List entities) {
+ mCommonFileAdapter.setOnItemClickListener(new OnFileItemClickListener() {
+ @Override
+ public void click(int position) {
+ FileEntity entity = entities.get(position);
+ String absolutePath = entity.getPath();
+ ArrayList files = PickerManager.getInstance().files;
+ if(files.contains(entity)){
+ files.remove(entity);
+ if(mOnUpdateDataListener!=null){
+ mOnUpdateDataListener.update(-Long.parseLong(entity.getSize()));
+ }
+ entity.setSelected(!entity.isSelected());
+ mCommonFileAdapter.notifyDataSetChanged();
+ }else {
+ if(PickerManager.getInstance().files.size() entities) {
+ mProgressBar.setVisibility(View.GONE);
+ if(entities.size()>0){
+ mEmptyView.setVisibility(View.GONE);
+ }else {
+ mEmptyView.setVisibility(View.VISIBLE);
+ }
+ mCommonFileAdapter = new CommonFileAdapter(getContext(),entities);
+ mRecyclerView.setAdapter(mCommonFileAdapter);
+ iniEvent(entities);
+ }
+}
diff --git a/app/src/main/java/com/bonait/bnframework/common/filepicker/FileScannerTask.java b/app/src/main/java/com/bonait/bnframework/common/filepicker/FileScannerTask.java
new file mode 100644
index 00000000..e7efd8ab
--- /dev/null
+++ b/app/src/main/java/com/bonait/bnframework/common/filepicker/FileScannerTask.java
@@ -0,0 +1,147 @@
+package com.bonait.bnframework.common.filepicker;
+
+import android.content.Context;
+import android.database.Cursor;
+import android.os.AsyncTask;
+import android.provider.MediaStore;
+import android.text.TextUtils;
+import android.webkit.MimeTypeMap;
+
+import com.bonait.bnframework.common.filepicker.model.FileEntity;
+import com.bonait.bnframework.common.filepicker.model.FileType;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+
+import static android.provider.BaseColumns._ID;
+import static android.provider.MediaStore.MediaColumns.DATA;
+import static com.bonait.bnframework.common.filepicker.util.FileUtils.getFileType;
+
+/**
+ * 作者:chs on 2017-08-24 14:39
+ * 邮箱:657083984@qq.com
+ * 扫描媒体库获取数据
+ */
+
+public class FileScannerTask extends AsyncTask> {
+ public interface FileScannerListener {
+ void scannerResult(List entities);
+ }
+
+ private final String[] DOC_PROJECTION = {
+ MediaStore.Images.Media._ID,
+ MediaStore.Images.Media.DATA,
+ MediaStore.Files.FileColumns.MIME_TYPE,
+ MediaStore.Files.FileColumns.SIZE,
+ MediaStore.Images.Media.DATE_ADDED,
+ MediaStore.Files.FileColumns.TITLE
+ };
+
+ private Context context;
+ private FileScannerListener mFileScannerListener;
+
+ public FileScannerTask(Context context, FileScannerListener fileScannerListener) {
+ this.context = context;
+ mFileScannerListener = fileScannerListener;
+ }
+
+ //MediaStore.Files存储了所有应用中共享的文件,包括图片、文件、视频、音乐等多媒体文件,包括非多媒体文件。
+ @Override
+ protected List doInBackground(Void... params) {
+ List fileEntities = new ArrayList<>();
+ String selection =
+ MediaStore.Files.FileColumns.MIME_TYPE + "= ? "
+// + " or " + MediaStore.Files.FileColumns.MIME_TYPE + " = ? "
+// + " or " + MediaStore.Files.FileColumns.MIME_TYPE + " = ? "
+// + " or " + MediaStore.Files.FileColumns.MIME_TYPE + " = ? "
+// + " or " + MediaStore.Files.FileColumns.MIME_TYPE + " = ? "
+// + " or " + MediaStore.Files.FileColumns.MIME_TYPE + " = ? "
+// + " or " + MediaStore.Files.FileColumns.MIME_TYPE + " = ? "
+// + " or " + MediaStore.Files.FileColumns.MIME_TYPE + " = ? "
+// + " or " + MediaStore.Files.FileColumns.MIME_TYPE + " = ? "
+// + " or " + MediaStore.Files.FileColumns.MIME_TYPE + " = ? "
+// + " or " + MediaStore.Files.FileColumns.MIME_TYPE + " = ? "
+// + " or " + MediaStore.Files.FileColumns.MIME_TYPE + " = ? "
+// + " or " + MediaStore.Files.FileColumns.MIME_TYPE + " = ? "
+// + " or " + MediaStore.Files.FileColumns.MIME_TYPE + " = ? "
+ + " or " + MediaStore.Files.FileColumns.MIME_TYPE + " = ? "
+ + " or " + MediaStore.Files.FileColumns.MIME_TYPE + " = ? "
+ + " or " + MediaStore.Files.FileColumns.MIME_TYPE + " = ? "
+ + " or " + MediaStore.Files.FileColumns.MIME_TYPE + " = ? ";
+ String[] selectionArgs = new String[]{
+// MimeTypeMap.getSingleton().getMimeTypeFromExtension("text"),
+// MimeTypeMap.getSingleton().getMimeTypeFromExtension("doc"),
+// MimeTypeMap.getSingleton().getMimeTypeFromExtension("docx"),
+// MimeTypeMap.getSingleton().getMimeTypeFromExtension("dotx"),
+// MimeTypeMap.getSingleton().getMimeTypeFromExtension("dotx"),
+// MimeTypeMap.getSingleton().getMimeTypeFromExtension("pdf"),
+// MimeTypeMap.getSingleton().getMimeTypeFromExtension("ppt"),
+// MimeTypeMap.getSingleton().getMimeTypeFromExtension("pptx"),
+// MimeTypeMap.getSingleton().getMimeTypeFromExtension("potx"),
+// MimeTypeMap.getSingleton().getMimeTypeFromExtension("ppsx"),
+// MimeTypeMap.getSingleton().getMimeTypeFromExtension("xls"),
+// MimeTypeMap.getSingleton().getMimeTypeFromExtension("xlsx"),
+// MimeTypeMap.getSingleton().getMimeTypeFromExtension("xltx"),
+ MimeTypeMap.getSingleton().getMimeTypeFromExtension("jpg"),
+ MimeTypeMap.getSingleton().getMimeTypeFromExtension("jpg"),
+ MimeTypeMap.getSingleton().getMimeTypeFromExtension("png"),
+ MimeTypeMap.getSingleton().getMimeTypeFromExtension("svg"),
+ MimeTypeMap.getSingleton().getMimeTypeFromExtension("gif")
+ };
+// for (String str : selectionArgs) {
+// Log.i("selectionArgs" , str);
+// }
+ final Cursor cursor = context.getContentResolver().query(
+ MediaStore.Files.getContentUri("external"),//数据源
+ DOC_PROJECTION,//查询类型
+ selection,//查询条件
+ selectionArgs,
+ MediaStore.Files.FileColumns.DATE_ADDED + " DESC");
+ if (cursor != null) {
+ fileEntities = getFiles(cursor);
+ cursor.close();
+ }
+ return fileEntities;
+ }
+
+ @Override
+ protected void onPostExecute(List entities) {
+ super.onPostExecute(entities);
+ if (mFileScannerListener != null) {
+ mFileScannerListener.scannerResult(entities);
+ }
+ }
+
+ private List getFiles(Cursor cursor) {
+ List fileEntities = new ArrayList<>();
+ while (cursor.moveToNext()) {
+ int id = cursor.getInt(cursor.getColumnIndexOrThrow(_ID));
+ String path = cursor.getString(cursor.getColumnIndexOrThrow(DATA));
+ String title = cursor.getString(cursor.getColumnIndexOrThrow(MediaStore.Files.FileColumns.TITLE));
+ if (path != null) {
+ FileType fileType = getFileType(PickerManager.getInstance().getFileTypes(), path);
+ if (fileType != null && !(new File(path).isDirectory())) {
+
+ FileEntity entity = new FileEntity(id, title, path);
+ entity.setFileType(fileType);
+
+ String mimeType = cursor.getString(cursor.getColumnIndexOrThrow(MediaStore.Files.FileColumns.MIME_TYPE));
+ if (mimeType != null && !TextUtils.isEmpty(mimeType))
+ entity.setMimeType(mimeType);
+ else {
+ entity.setMimeType("");
+ }
+
+ entity.setSize(cursor.getString(cursor.getColumnIndexOrThrow(MediaStore.Files.FileColumns.SIZE)));
+ if(PickerManager.getInstance().files.contains(entity)){
+ entity.setSelected(true);
+ }
+ if (!fileEntities.contains(entity))
+ fileEntities.add(entity);
+ }
+ }
+ }
+ return fileEntities;
+ }
+}
diff --git a/app/src/main/java/com/bonait/bnframework/common/filepicker/FileSelectFilter.java b/app/src/main/java/com/bonait/bnframework/common/filepicker/FileSelectFilter.java
new file mode 100644
index 00000000..82176ff3
--- /dev/null
+++ b/app/src/main/java/com/bonait/bnframework/common/filepicker/FileSelectFilter.java
@@ -0,0 +1,33 @@
+package com.bonait.bnframework.common.filepicker;
+
+import java.io.File;
+import java.io.FileFilter;
+
+/**
+ * 作者:chs on 2017-08-08 14:30
+ * 邮箱:657083984@qq.com
+ * File的筛选
+ */
+
+public class FileSelectFilter implements FileFilter {
+ private String[] mTypes;
+ public FileSelectFilter(String[] types) {
+ this.mTypes = types;
+ }
+ @Override
+ public boolean accept(File file) {
+ if (file.isDirectory()) {
+ return true;
+ }
+ if (mTypes != null && mTypes.length > 0) {
+ for (int i = 0; i < mTypes.length; i++) {
+ if (file.getName().endsWith(mTypes[i].toLowerCase()) || file.getName().endsWith(mTypes[i].toUpperCase())) {
+ return true;
+ }
+ }
+ }else {
+ return true;
+ }
+ return false;
+ }
+}
diff --git a/app/src/main/java/com/bonait/bnframework/common/filepicker/OnUpdateDataListener.java b/app/src/main/java/com/bonait/bnframework/common/filepicker/OnUpdateDataListener.java
new file mode 100644
index 00000000..cb9f7a8c
--- /dev/null
+++ b/app/src/main/java/com/bonait/bnframework/common/filepicker/OnUpdateDataListener.java
@@ -0,0 +1,11 @@
+package com.bonait.bnframework.common.filepicker;
+
+/**
+ * 作者:chs on 2017-08-25 10:39
+ * 邮箱:657083984@qq.com
+ */
+
+public interface OnUpdateDataListener {
+ void update(long size);
+ void replacement();
+}
diff --git a/app/src/main/java/com/bonait/bnframework/common/filepicker/PickerManager.java b/app/src/main/java/com/bonait/bnframework/common/filepicker/PickerManager.java
new file mode 100644
index 00000000..1499924a
--- /dev/null
+++ b/app/src/main/java/com/bonait/bnframework/common/filepicker/PickerManager.java
@@ -0,0 +1,73 @@
+package com.bonait.bnframework.common.filepicker;
+
+import com.bonait.bnframework.R;
+import com.bonait.bnframework.common.filepicker.model.FileEntity;
+import com.bonait.bnframework.common.filepicker.model.FileType;
+
+import java.util.ArrayList;
+
+/**
+ * 作者:chs on 2017-08-24 14:34
+ * 邮箱:657083984@qq.com
+ */
+
+public class PickerManager {
+ public static PickerManager getInstance() {
+ return SingletonHolder.INSTANCE;
+ }
+ private static class SingletonHolder{
+ private static final PickerManager INSTANCE = new PickerManager();
+ }
+ /**
+ * 最多能选的文件的个数
+ */
+ public int maxCount = 50;
+ /**
+ * 保存结果
+ */
+ public ArrayList files;
+ /**
+ * 筛选条件 类型
+ */
+ public ArrayList mFileTypes;
+ /**
+ * 文件夹筛选
+ * 这里包括 微信和QQ中的下载的文件和图片
+ */
+ public String[] mFilterFolder = new String[]{"MicroMsg/Download","WeiXin","QQfile_recv","MobileQQ/photo"};
+ private PickerManager() {
+ files = new ArrayList<>();
+ mFileTypes = new ArrayList<>();
+ addDocTypes();
+ }
+ public void addDocTypes()
+ {
+ String[] pdfs = {"pdf"};
+ mFileTypes.add(new FileType("PDF",pdfs, R.mipmap.file_picker_pdf));
+
+ String[] docs = {"doc","docx", "dot","dotx"};
+ mFileTypes.add(new FileType("DOC",docs,R.mipmap.file_picker_word));
+
+ String[] ppts = {"ppt","pptx"};
+ mFileTypes.add(new FileType("PPT",ppts,R.mipmap.file_picker_ppt));
+
+ String[] xlss = {"xls","xlt","xlsx","xltx"};
+ mFileTypes.add(new FileType("XLS",xlss,R.mipmap.file_picker_excle));
+
+ String[] txts = {"txt"};
+ mFileTypes.add(new FileType("TXT",txts, R.mipmap.file_picker_txt));
+
+ String[] imgs = {"png","jpg","jpeg","gif"};
+ mFileTypes.add(new FileType("IMG",imgs,0));
+ }
+
+ public ArrayList getFileTypes() {
+ return mFileTypes;
+ }
+
+
+ public PickerManager setMaxCount(int maxCount) {
+ this.maxCount = maxCount;
+ return this;
+ }
+}
diff --git a/app/src/main/java/com/bonait/bnframework/common/filepicker/adapter/AllFileAdapter.java b/app/src/main/java/com/bonait/bnframework/common/filepicker/adapter/AllFileAdapter.java
new file mode 100644
index 00000000..982ff6de
--- /dev/null
+++ b/app/src/main/java/com/bonait/bnframework/common/filepicker/adapter/AllFileAdapter.java
@@ -0,0 +1,97 @@
+package com.bonait.bnframework.common.filepicker.adapter;
+
+import android.content.Context;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+
+import androidx.recyclerview.widget.RecyclerView;
+
+import com.bonait.bnframework.R;
+import com.bonait.bnframework.common.filepicker.model.FileEntity;
+import com.bonait.bnframework.common.filepicker.util.FileUtils;
+import com.bumptech.glide.Glide;
+
+import java.io.File;
+import java.io.FileFilter;
+import java.util.List;
+
+/**
+ * 作者:chs on 2017-08-08 14:40
+ * 邮箱:657083984@qq.com
+ */
+
+public class AllFileAdapter extends RecyclerView.Adapter {
+ private List mListData;
+ private Context mContext;
+ private FileFilter mFileFilter;
+ private OnFileItemClickListener onItemClickListener;
+
+ public void setOnItemClickListener(OnFileItemClickListener onItemClickListener) {
+ this.onItemClickListener = onItemClickListener;
+ }
+
+ public AllFileAdapter(Context context, List listData, FileFilter fileFilter) {
+ mListData = listData;
+ mContext = context;
+ mFileFilter = fileFilter;
+ }
+
+ @Override
+ public FilePickerViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
+ View view = LayoutInflater.from(mContext).inflate(R.layout.item_file_picker, parent, false);
+ return new FilePickerViewHolder(view);
+ }
+
+ @Override
+ public void onBindViewHolder(final FilePickerViewHolder holder, int positon) {
+ final FileEntity entity = mListData.get(positon);
+ final File file = entity.getFile();
+ holder.tvName.setText(file.getName());
+ if (file.isDirectory()) {
+ holder.ivType.setImageResource(R.mipmap.file_picker_folder);
+ holder.ivChoose.setVisibility(View.GONE);
+ } else {
+ if(entity.getFileType()!=null){
+ String title = entity.getFileType().getTitle();
+ if (title.equals("IMG")) {
+ Glide.with(mContext).load(new File(entity.getPath())).into(holder.ivType);
+ } else {
+ holder.ivType.setImageResource(entity.getFileType().getIconStyle());
+ }
+ }else {
+ holder.ivType.setImageResource(R.mipmap.file_picker_def);
+ }
+ holder.ivChoose.setVisibility(View.VISIBLE);
+ holder.tvDetail.setText(FileUtils.getReadableFileSize(file.length()));
+
+ if (entity.isSelected()) {
+ holder.ivChoose.setImageResource(R.mipmap.file_choice);
+ } else {
+ holder.ivChoose.setImageResource(R.mipmap.file_no_selection);
+ }
+ }
+ holder.layoutRoot.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ if (onItemClickListener != null) {
+ onItemClickListener.click(holder.getAdapterPosition());
+ }
+ }
+ });
+ }
+
+ @Override
+ public int getItemCount() {
+ return mListData.size();
+ }
+
+ /**
+ * 更新数据源
+ *
+ * @param mListData
+ */
+ public void updateListData(List mListData) {
+ this.mListData = mListData;
+ }
+}
diff --git a/app/src/main/java/com/bonait/bnframework/common/filepicker/adapter/CommonFileAdapter.java b/app/src/main/java/com/bonait/bnframework/common/filepicker/adapter/CommonFileAdapter.java
new file mode 100644
index 00000000..46d42acb
--- /dev/null
+++ b/app/src/main/java/com/bonait/bnframework/common/filepicker/adapter/CommonFileAdapter.java
@@ -0,0 +1,72 @@
+package com.bonait.bnframework.common.filepicker.adapter;
+
+import android.content.Context;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+
+import androidx.recyclerview.widget.RecyclerView;
+
+import com.bonait.bnframework.R;
+import com.bonait.bnframework.common.filepicker.model.FileEntity;
+import com.bumptech.glide.Glide;
+import java.io.File;
+import java.util.List;
+
+/**
+ * 作者:chs on 2017-08-24 15:43
+ * 邮箱:657083984@qq.com
+ */
+
+public class CommonFileAdapter extends RecyclerView.Adapter {
+ private Context mContext;
+ private List mData;
+ private OnFileItemClickListener onItemClickListener;
+
+ public void setOnItemClickListener(OnFileItemClickListener onItemClickListener) {
+ this.onItemClickListener = onItemClickListener;
+ }
+
+ public CommonFileAdapter(Context context, List data) {
+ this.mContext = context;
+ mData = data;
+ }
+
+ @Override
+ public FilePickerViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
+ View itemView = LayoutInflater.from(mContext).inflate(R.layout.item_file_picker, parent, false);
+ return new FilePickerViewHolder(itemView);
+ }
+
+ @Override
+ public void onBindViewHolder(final FilePickerViewHolder holder, int position) {
+ final FileEntity entity = mData.get(position);
+ holder.tvName.setText(entity.getName());
+ holder.tvDetail.setText(entity.getMimeType());
+ String title = entity.getFileType().getTitle();
+ if (entity.isSelected()) {
+ holder.ivChoose.setImageResource(R.mipmap.file_choice);
+ } else {
+ holder.ivChoose.setImageResource(R.mipmap.file_no_selection);
+ }
+ if (title.equals("IMG")) {
+ Glide.with(mContext).load(new File(entity.getPath())).into(holder.ivType);
+ } else {
+ holder.ivType.setImageResource(entity.getFileType().getIconStyle());
+ }
+ holder.layoutRoot.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ if (onItemClickListener != null) {
+ onItemClickListener.click(holder.getAdapterPosition());
+ }
+ }
+ });
+ }
+
+ @Override
+ public int getItemCount() {
+ return mData.size();
+ }
+
+}
diff --git a/app/src/main/java/com/bonait/bnframework/common/filepicker/adapter/FilePickerShowAdapter.java b/app/src/main/java/com/bonait/bnframework/common/filepicker/adapter/FilePickerShowAdapter.java
new file mode 100644
index 00000000..1a3e20df
--- /dev/null
+++ b/app/src/main/java/com/bonait/bnframework/common/filepicker/adapter/FilePickerShowAdapter.java
@@ -0,0 +1,118 @@
+package com.bonait.bnframework.common.filepicker.adapter;
+
+import android.content.Context;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.ImageView;
+import android.widget.TextView;
+
+import androidx.annotation.NonNull;
+import androidx.recyclerview.widget.RecyclerView;
+
+import com.bonait.bnframework.R;
+import com.bonait.bnframework.common.filepicker.model.FileEntity;
+import com.bonait.bnframework.common.filepicker.util.FileUtils;
+import com.bonait.bnframework.common.image.MyBitmapUtils;
+import com.bonait.bnframework.common.utils.AlertDialogUtils;
+import com.bonait.bnframework.modules.home.adapter.image_sp_adapter;
+import com.bumptech.glide.Glide;
+import com.qmuiteam.qmui.widget.dialog.QMUIDialog;
+import com.qmuiteam.qmui.widget.dialog.QMUIDialogAction;
+
+import java.io.File;
+import java.util.ArrayList;
+
+/**
+ * 作者:chs on 2017-08-28 10:54
+ * 邮箱:657083984@qq.com
+ * 选择附件后显示
+ */
+
+public class FilePickerShowAdapter extends RecyclerView.Adapter {
+ private final LayoutInflater mLayoutInflater;
+ private Context mContext;
+ private ArrayList mDataList;
+ private OnDeleteListener mOnDeleteListener;
+ private OnFileItemClickListener mOnItemClickListener;
+
+ public void setOnItemClickListener(OnFileItemClickListener mOnItemClickListener) {
+ this.mOnItemClickListener = mOnItemClickListener;
+ }
+
+ public void setOnDeleteListener(OnDeleteListener onDeleteListener) {
+ mOnDeleteListener = onDeleteListener;
+ }
+
+ public FilePickerShowAdapter(Context context, ArrayList dataList) {
+ mContext = context;
+ mLayoutInflater = LayoutInflater.from(context);
+ mDataList = dataList;
+ }
+
+ @Override
+ public FileShowViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
+ View view =mLayoutInflater.inflate(R.layout.item_file_picker_show, parent, false);
+ return new FileShowViewHolder(view);
+ }
+ @Override
+ public void onBindViewHolder(@NonNull RecyclerView.ViewHolder myViewHolder, int position) {
+ try {
+ FileShowViewHolder holder = (FileShowViewHolder) myViewHolder;
+ final FileEntity fileEntity = mDataList.get(position);
+ final File file = fileEntity.getFile();
+ holder.mTvName.setText(file.getName());
+ holder.mTvDetail.setText(FileUtils.getReadableFileSize(file.length()));
+ if (fileEntity.getFileType() != null) {
+ String title = fileEntity.getFileType().getTitle();
+ if (title.equals("IMG")) {
+ Glide.with(mContext).load(new File(fileEntity.getPath())).into(holder.mIvType);
+ } else {
+ holder.mIvType.setImageResource(fileEntity.getFileType().getIconStyle());
+ }
+ } else {
+ holder.mIvType.setImageResource(R.mipmap.file_picker_def);
+ }
+
+ holder.itemView.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ if (mOnItemClickListener != null) {
+ mOnItemClickListener.click(holder.getAdapterPosition());
+ }
+ }
+ });
+ holder.mIvDelete.setVisibility(View.VISIBLE);
+ holder.mIvDelete.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ mDataList.remove(holder.getAdapterPosition());
+ if (mOnDeleteListener != null)
+ mOnDeleteListener.delete(holder.getAdapterPosition());
+ notifyDataSetChanged();
+ }
+ });
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+
+ @Override
+ public int getItemCount() {
+ return mDataList.size();
+ }
+
+ class FileShowViewHolder extends RecyclerView.ViewHolder {
+ private ImageView mIvType, mIvDelete;
+ private TextView mTvName, mTvDetail;
+
+ public FileShowViewHolder(View itemView) {
+ super(itemView);
+ mIvType = (ImageView) itemView.findViewById(R.id.iv_type);
+ mIvDelete = (ImageView) itemView.findViewById(R.id.iv_delete);
+ mTvName = (TextView) itemView.findViewById(R.id.tv_name);
+ mTvDetail = (TextView) itemView.findViewById(R.id.tv_detail);
+ }
+ }
+}
diff --git a/app/src/main/java/com/bonait/bnframework/common/filepicker/adapter/FilePickerViewHolder.java b/app/src/main/java/com/bonait/bnframework/common/filepicker/adapter/FilePickerViewHolder.java
new file mode 100644
index 00000000..bd40fb44
--- /dev/null
+++ b/app/src/main/java/com/bonait/bnframework/common/filepicker/adapter/FilePickerViewHolder.java
@@ -0,0 +1,30 @@
+package com.bonait.bnframework.common.filepicker.adapter;
+import android.view.View;
+import android.widget.CheckBox;
+import android.widget.ImageView;
+import android.widget.RelativeLayout;
+import android.widget.TextView;
+
+import androidx.recyclerview.widget.RecyclerView;
+
+import com.bonait.bnframework.R;
+
+/**
+ * 作者:chs on 2017-08-24 17:13
+ * 邮箱:657083984@qq.com
+ */
+
+public class FilePickerViewHolder extends RecyclerView.ViewHolder {
+ protected RelativeLayout layoutRoot;
+ protected ImageView ivType,ivChoose;
+ protected TextView tvName;
+ protected TextView tvDetail;
+ public FilePickerViewHolder(View itemView) {
+ super(itemView);
+ ivType = (ImageView) itemView.findViewById(R.id.iv_type);
+ layoutRoot = (RelativeLayout) itemView.findViewById(R.id.layout_item_root);
+ tvName = (TextView) itemView.findViewById(R.id.tv_name);
+ tvDetail = (TextView) itemView.findViewById(R.id.tv_detail);
+ ivChoose = (ImageView) itemView.findViewById(R.id.iv_choose);
+ }
+}
diff --git a/app/src/main/java/com/bonait/bnframework/common/filepicker/adapter/OnDeleteListener.java b/app/src/main/java/com/bonait/bnframework/common/filepicker/adapter/OnDeleteListener.java
new file mode 100644
index 00000000..9b55fdfe
--- /dev/null
+++ b/app/src/main/java/com/bonait/bnframework/common/filepicker/adapter/OnDeleteListener.java
@@ -0,0 +1,10 @@
+package com.bonait.bnframework.common.filepicker.adapter;
+
+/**
+ * 作者:chs on 2017-09-06 14:57
+ * 邮箱:657083984@qq.com
+ */
+
+public interface OnDeleteListener {
+ void delete(int position);
+}
diff --git a/app/src/main/java/com/bonait/bnframework/common/filepicker/adapter/OnFileItemClickListener.java b/app/src/main/java/com/bonait/bnframework/common/filepicker/adapter/OnFileItemClickListener.java
new file mode 100644
index 00000000..a52466fa
--- /dev/null
+++ b/app/src/main/java/com/bonait/bnframework/common/filepicker/adapter/OnFileItemClickListener.java
@@ -0,0 +1,11 @@
+package com.bonait.bnframework.common.filepicker.adapter;
+
+/**
+ * 作者:chs on 2017-08-25 10:15
+ * 邮箱:657083984@qq.com
+ * 条目点击
+ */
+
+public interface OnFileItemClickListener {
+ void click(int position);
+}
diff --git a/app/src/main/java/com/bonait/bnframework/common/filepicker/model/FileEntity.java b/app/src/main/java/com/bonait/bnframework/common/filepicker/model/FileEntity.java
new file mode 100644
index 00000000..37252c33
--- /dev/null
+++ b/app/src/main/java/com/bonait/bnframework/common/filepicker/model/FileEntity.java
@@ -0,0 +1,153 @@
+package com.bonait.bnframework.common.filepicker.model;
+
+import android.os.Parcel;
+import android.os.Parcelable;
+
+import java.io.File;
+
+/**
+ * 作者:chs on 2017-08-24 14:41
+ * 邮箱:657083984@qq.com
+ */
+
+public class FileEntity implements Parcelable {
+ private int id;
+ private String name;
+ private String path;
+ private String mimeType;
+ private String size;
+ private String date;
+ private FileType fileType;
+ private boolean isSelected;
+ /* File 用于全部文件*/
+ private File mFile;
+
+ public FileEntity(int id, String name, String path) {
+ this.id = id;
+ this.name = name;
+ this.path = path;
+ }
+
+ public FileEntity(String path,File file, boolean isSelected) {
+ this.path = path;
+ mFile = file;
+ this.isSelected = isSelected;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (!(o instanceof FileEntity)) return false;
+
+ FileEntity entity = (FileEntity) o;
+
+ return path .equals(entity.path);
+ }
+ protected FileEntity(Parcel in) {
+ id = in.readInt();
+ name = in.readString();
+ path = in.readString();
+ mimeType = in.readString();
+ size = in.readString();
+ date = in.readString();
+ }
+
+ public static final Creator CREATOR = new Creator() {
+ @Override
+ public FileEntity createFromParcel(Parcel in) {
+ return new FileEntity(in);
+ }
+
+ @Override
+ public FileEntity[] newArray(int size) {
+ return new FileEntity[size];
+ }
+ };
+
+ @Override
+ public int describeContents() {
+ return 0;
+ }
+
+ @Override
+ public void writeToParcel(Parcel dest, int flags) {
+ dest.writeInt(id);
+ dest.writeString(name);
+ dest.writeString(path);
+ dest.writeString(mimeType);
+ dest.writeString(size);
+ dest.writeString(date);
+ }
+
+ public int getId() {
+ return id;
+ }
+
+ public void setId(int id) {
+ this.id = id;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getPath() {
+ return path;
+ }
+
+ public void setPath(String path) {
+ this.path = path;
+ }
+
+ public String getMimeType() {
+ return mimeType;
+ }
+
+ public void setMimeType(String mimeType) {
+ this.mimeType = mimeType;
+ }
+
+ public String getSize() {
+ return size;
+ }
+
+ public void setSize(String size) {
+ this.size = size;
+ }
+
+ public String getDate() {
+ return date;
+ }
+
+ public void setDate(String date) {
+ this.date = date;
+ }
+
+ public FileType getFileType() {
+ return fileType;
+ }
+
+ public void setFileType(FileType fileType) {
+ this.fileType = fileType;
+ }
+
+ public File getFile() {
+ return mFile;
+ }
+
+ public void setFile(File file) {
+ mFile = file;
+ }
+
+ public boolean isSelected() {
+ return isSelected;
+ }
+
+ public void setSelected(boolean selected) {
+ isSelected = selected;
+ }
+}
diff --git a/app/src/main/java/com/bonait/bnframework/common/filepicker/model/FileType.java b/app/src/main/java/com/bonait/bnframework/common/filepicker/model/FileType.java
new file mode 100644
index 00000000..bfbca56b
--- /dev/null
+++ b/app/src/main/java/com/bonait/bnframework/common/filepicker/model/FileType.java
@@ -0,0 +1,63 @@
+package com.bonait.bnframework.common.filepicker.model;
+
+import android.os.Parcel;
+import android.os.Parcelable;
+
+/**
+ * 作者:chs on 2017-08-24 15:19
+ * 邮箱:657083984@qq.com
+ */
+
+public class FileType implements Parcelable{
+ private String title;
+ private int iconStyle;
+ public String[] filterType;
+
+ public FileType(String title,String[] filterType,int iconStyle) {
+ this.title = title;
+ this.iconStyle = iconStyle;
+ this.filterType = filterType;
+ }
+
+ protected FileType(Parcel in) {
+ title = in.readString();
+ iconStyle = in.readInt();
+ filterType = in.createStringArray();
+ }
+
+ public static final Creator CREATOR = new Creator() {
+ @Override
+ public FileType createFromParcel(Parcel in) {
+ return new FileType(in);
+ }
+
+ @Override
+ public FileType[] newArray(int size) {
+ return new FileType[size];
+ }
+ };
+
+ public String getTitle() {
+ return title;
+ }
+
+ public int getIconStyle() {
+ return iconStyle;
+ }
+
+ public String[] getFilterType() {
+ return filterType;
+ }
+
+ @Override
+ public int describeContents() {
+ return 0;
+ }
+
+ @Override
+ public void writeToParcel(Parcel dest, int flags) {
+ dest.writeString(title);
+ dest.writeInt(iconStyle);
+ dest.writeStringArray(filterType);
+ }
+}
diff --git a/app/src/main/java/com/bonait/bnframework/common/filepicker/util/FileComparator.java b/app/src/main/java/com/bonait/bnframework/common/filepicker/util/FileComparator.java
new file mode 100644
index 00000000..152f20be
--- /dev/null
+++ b/app/src/main/java/com/bonait/bnframework/common/filepicker/util/FileComparator.java
@@ -0,0 +1,26 @@
+package com.bonait.bnframework.common.filepicker.util;
+
+import java.io.File;
+import java.util.Comparator;
+
+/**
+ *
+ */
+public class FileComparator implements Comparator {
+ @Override
+ public int compare(File f1, File f2) {
+ if(f1 == f2) {
+ return 0;
+ }
+ if(f1.isDirectory() && f2.isFile()) {
+ // Show directories above files
+ return -1;
+ }
+ if(f1.isFile() && f2.isDirectory()) {
+ // Show files below directories
+ return 1;
+ }
+ // Sort the directories alphabetically
+ return f1.getName().compareToIgnoreCase(f2.getName());
+ }
+}
diff --git a/app/src/main/java/com/bonait/bnframework/common/filepicker/util/FileUtils.java b/app/src/main/java/com/bonait/bnframework/common/filepicker/util/FileUtils.java
new file mode 100644
index 00000000..546295c1
--- /dev/null
+++ b/app/src/main/java/com/bonait/bnframework/common/filepicker/util/FileUtils.java
@@ -0,0 +1,104 @@
+package com.bonait.bnframework.common.filepicker.util;
+
+
+import com.bonait.bnframework.common.filepicker.PickerManager;
+import com.bonait.bnframework.common.filepicker.model.FileEntity;
+import com.bonait.bnframework.common.filepicker.model.FileType;
+
+import java.io.File;
+import java.io.FileFilter;
+import java.text.DecimalFormat;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+
+public class FileUtils {
+ /**
+ * 根据路径获取file的集合
+ *
+ * @param path
+ * @param filter
+ * @return
+ */
+ public static List getFileListByDirPath(String path, FileFilter filter) {
+ File directory = new File(path);
+ File[] files = directory.listFiles(filter);
+
+ if (files == null) {
+ return new ArrayList<>();
+ }
+
+ List result = Arrays.asList(files);
+ Collections.sort(result, new FileComparator());
+
+ List entities = new ArrayList<>();
+ for (File f : result) {
+ String absolutePath = f.getAbsolutePath();
+ FileEntity e;
+ if (checkExits(absolutePath)) {
+ e = new FileEntity(absolutePath, f, true);
+ } else {
+ e = new FileEntity(absolutePath, f, false);
+ }
+
+ if(f.isFile())
+ {
+ FileType fileType = getFileTypeNoFolder(PickerManager.getInstance().mFileTypes, absolutePath);
+ if(fileType!=null)
+ {
+ e.setFileType(fileType);
+ if (PickerManager.getInstance().files.contains(e)) {
+ e.setSelected(true);
+ }
+ entities.add(e);
+ }
+ }else
+ {
+ entities.add(e);
+ }
+ }
+ return entities;
+ }
+
+ private static boolean checkExits(String path) {
+ for (FileEntity entity : PickerManager.getInstance().files) {
+ if (entity.getPath().equals(path)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public static String getReadableFileSize(long size) {
+ if (size <= 0) return "0";
+ final String[] units = new String[]{"B", "KB", "MB", "GB", "TB"};
+ int digitGroups = (int) (Math.log10(size) / Math.log10(1024));
+ return new DecimalFormat("#.##").format(size / Math.pow(1024, digitGroups)) + " " + units[digitGroups];
+ }
+
+ public static FileType getFileType(ArrayList fileTypes, String path) {
+ for (String str : PickerManager.getInstance().mFilterFolder) {//按文件夹筛选
+ if (path.contains(str)) {
+ for (int index = 0; index < fileTypes.size(); index++) {//按照文件类型筛选
+ for (String string : fileTypes.get(index).filterType) {
+ if (path.endsWith(string))
+ return fileTypes.get(index);
+ }
+ }
+ }
+ }
+ return null;
+ }
+
+ //不包含文件夹
+ public static FileType getFileTypeNoFolder(ArrayList fileTypes, String path) {
+ for (int index = 0; index < fileTypes.size(); index++) {//按照文件类型筛选
+ for (String string : fileTypes.get(index).filterType) {
+ if (path.endsWith(string))
+ return fileTypes.get(index);
+ }
+ }
+ return null;
+ }
+}
diff --git a/app/src/main/java/com/bonait/bnframework/common/filepicker/util/OpenFile.java b/app/src/main/java/com/bonait/bnframework/common/filepicker/util/OpenFile.java
new file mode 100644
index 00000000..5c5d2036
--- /dev/null
+++ b/app/src/main/java/com/bonait/bnframework/common/filepicker/util/OpenFile.java
@@ -0,0 +1,199 @@
+package com.bonait.bnframework.common.filepicker.util;
+
+import android.content.Context;
+import android.content.Intent;
+import android.net.Uri;
+import android.os.Build;
+
+import androidx.core.content.FileProvider;
+
+import java.io.File;
+
+/**
+ * 打开文件
+ */
+
+public class OpenFile {
+ private static Context mContext;
+ public static Intent openFile(String filePath, Context context){
+ mContext = context;
+ File file = new File(filePath);
+ if(!file.exists()) return null;
+ /* 取得扩展名 */
+ String end=file.getName().substring(file.getName().lastIndexOf(".") + 1,file.getName().length()).toLowerCase();
+ /* 依扩展名的类型决定MimeType */
+ if(end.equals("m4a")||end.equals("mp3")||end.equals("mid")||
+ end.equals("xmf")||end.equals("ogg")||end.equals("wav")){
+ return getAudioFileIntent(filePath);
+ }else if(end.equals("3gp")||end.equals("mp4")){
+ return getAudioFileIntent(filePath);
+ }else if(end.equals("jpg")||end.equals("gif")||end.equals("png")||
+ end.equals("jpeg")||end.equals("bmp")){
+ return getImageFileIntent(filePath);
+ }else if(end.equals("apk")){
+ return getApkFileIntent(filePath);
+ }else if(end.equals("ppt")){
+ return getPptFileIntent(filePath);
+ }else if(end.equals("xls")){
+ return getExcelFileIntent(filePath);
+ }else if(end.equals("doc")){
+ return getWordFileIntent(filePath);
+ }else if(end.equals("pdf")){
+ return getPdfFileIntent(filePath);
+ }else if(end.equals("chm")){
+ return getChmFileIntent(filePath);
+ }else if(end.equals("txt")){
+ return getTextFileIntent(filePath,false);
+ }else{
+ return getAllIntent(filePath);
+ }
+ }
+ private static Uri getUri(String path){
+ Uri uri;
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
+ String authority = mContext.getPackageName() + ".provider";
+ uri = FileProvider.getUriForFile(mContext, authority, new File(path));
+ } else {
+ uri = Uri.fromFile(new File(path));
+ }
+ return uri;
+ }
+ //Android获取一个用于打开APK文件的intent
+ public static Intent getAllIntent(String param ) {
+
+ Intent intent = new Intent();
+ intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+ intent.setAction(Intent.ACTION_VIEW);//动作
+ Uri uri = getUri(param);
+ intent.setDataAndType(uri,"*/*");
+ return intent;
+ }
+ //Android获取一个用于打开APK文件的intent
+ public static Intent getApkFileIntent(String param ) {
+
+ Intent intent = new Intent();
+ intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+ intent.setAction(Intent.ACTION_VIEW);
+ Uri uri = getUri(param);
+ intent.setDataAndType(uri,"application/vnd.android.package-archive");
+ return intent;
+ }
+
+ //Android获取一个用于打开VIDEO文件的intent
+ public static Intent getVideoFileIntent(String param ) {
+
+ Intent intent = new Intent("android.intent.action.VIEW");
+ intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
+ intent.putExtra("oneshot", 0);
+ intent.putExtra("configchange", 0);
+ Uri uri = getUri(param);
+ intent.setDataAndType(uri, "video/*");
+ return intent;
+ }
+
+ //Android获取一个用于打开AUDIO文件的intent
+ public static Intent getAudioFileIntent(String param ){
+
+ Intent intent = new Intent("android.intent.action.VIEW");
+ intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
+ intent.putExtra("oneshot", 0);
+ intent.putExtra("configchange", 0);
+ Uri uri = getUri(param);
+ intent.setDataAndType(uri, "audio/*");
+ return intent;
+ }
+
+ //Android获取一个用于打开Html文件的intent
+ public static Intent getHtmlFileIntent(String param ){
+
+ Uri uri = Uri.parse(param ).buildUpon().encodedAuthority("com.android.htmlfileprovider").scheme("content").encodedPath(param ).build();
+ Intent intent = new Intent("android.intent.action.VIEW");
+ intent.setDataAndType(uri, "text/html");
+ return intent;
+ }
+
+ //Android获取一个用于打开图片文件的intent
+ public static Intent getImageFileIntent(String param ) {
+
+ Intent intent = new Intent("android.intent.action.VIEW");
+ intent.addCategory("android.intent.category.DEFAULT");
+ intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+ Uri uri = getUri(param);
+ intent.setDataAndType(uri, "image/*");
+ return intent;
+ }
+
+ //Android获取一个用于打开PPT文件的intent
+ public static Intent getPptFileIntent(String param ){
+
+ Intent intent = new Intent("android.intent.action.VIEW");
+ intent.addCategory("android.intent.category.DEFAULT");
+ intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+ Uri uri = getUri(param);
+ intent.setDataAndType(uri, "application/vnd.ms-powerpoint");
+ return intent;
+ }
+
+ //Android获取一个用于打开Excel文件的intent
+ public static Intent getExcelFileIntent(String param ){
+
+ Intent intent = new Intent("android.intent.action.VIEW");
+ intent.addCategory("android.intent.category.DEFAULT");
+ intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+ Uri uri = getUri(param);
+ intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
+ intent.setDataAndType(uri, "application/vnd.ms-excel");
+ return intent;
+ }
+
+ //Android获取一个用于打开Word文件的intent
+ public static Intent getWordFileIntent(String param ){
+
+ Intent intent = new Intent("android.intent.action.VIEW");
+ intent.addCategory("android.intent.category.DEFAULT");
+ intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+ Uri uri = getUri(param);
+ intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
+ intent.setDataAndType(uri, "application/msword");
+ return intent;
+ }
+
+ //Android获取一个用于打开CHM文件的intent
+ public static Intent getChmFileIntent(String param ){
+
+ Intent intent = new Intent("android.intent.action.VIEW");
+ intent.addCategory("android.intent.category.DEFAULT");
+ intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+ Uri uri = getUri(param);
+ intent.setDataAndType(uri, "application/x-chm");
+ return intent;
+ }
+
+ //Android获取一个用于打开文本文件的intent
+ public static Intent getTextFileIntent(String param, boolean paramBoolean){
+
+ Intent intent = new Intent("android.intent.action.VIEW");
+ intent.addCategory("android.intent.category.DEFAULT");
+ intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+ if (paramBoolean){
+ Uri uri1 = getUri(param);
+ intent.setDataAndType(uri1, "text/plain");
+ }else{
+ Uri uri2 = getUri(param);
+ intent.setDataAndType(uri2, "text/plain");
+ }
+ intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
+ return intent;
+ }
+ //Android获取一个用于打开PDF文件的intent
+ public static Intent getPdfFileIntent(String param ){
+
+ Intent intent = new Intent("android.intent.action.VIEW");
+ intent.addCategory("android.intent.category.DEFAULT");
+ intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+ Uri uri = getUri(param);
+ intent.setDataAndType(uri, "application/pdf");
+ return intent;
+ }
+}
+
diff --git a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/FileActivity.java b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/FileActivity.java
new file mode 100644
index 00000000..9c212092
--- /dev/null
+++ b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/FileActivity.java
@@ -0,0 +1,149 @@
+package com.bonait.bnframework.modules.home.fragment.from;
+
+import androidx.appcompat.app.AppCompatActivity;
+import androidx.core.content.ContextCompat;
+import androidx.fragment.app.Fragment;
+import androidx.fragment.app.FragmentManager;
+import androidx.fragment.app.FragmentTransaction;
+
+import android.os.Bundle;
+import android.view.View;
+import android.widget.Button;
+import android.widget.TextView;
+
+import com.bonait.bnframework.R;
+import com.bonait.bnframework.common.filepicker.FileAllFragment;
+import com.bonait.bnframework.common.filepicker.FileCommonFragment;
+import com.bonait.bnframework.common.filepicker.OnUpdateDataListener;
+import com.bonait.bnframework.common.filepicker.PickerManager;
+import com.bonait.bnframework.common.filepicker.model.FileEntity;
+import com.bonait.bnframework.common.filepicker.util.FileUtils;
+import com.qmuiteam.qmui.widget.QMUITopBar;
+
+import java.io.File;
+
+public class FileActivity extends AppCompatActivity implements View.OnClickListener, OnUpdateDataListener {
+ private QMUITopBar mTopBar;
+ private Button btn_common,btn_all;
+ private TextView tv_size,tv_confirm;
+ private Fragment commonFileFragment,allFileFragment;
+ private boolean isConfirm = false;
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_file);
+ initView();
+ initEvent();
+ setFragment(1);
+ }
+
+ private void initEvent() {
+ btn_common.setOnClickListener(this);
+ btn_all.setOnClickListener(this);
+ tv_confirm.setOnClickListener(this);
+ }
+
+ private void initView() {
+ btn_common = (Button) findViewById(R.id.btn_common);
+ btn_all = (Button) findViewById(R.id.btn_all);
+ tv_size = (TextView) findViewById(R.id.tv_size);
+ tv_confirm = (TextView) findViewById(R.id.tv_confirm);
+ mTopBar=findViewById(R.id.topbar);
+ mTopBar.setTitle("图片选择");
+ mTopBar.addLeftImageButton(R.mipmap.fanhui,R.id.topbar).setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ finish();
+ }
+ });
+ }
+
+ private void setFragment(int type) {
+ FragmentManager fragmentManager = getSupportFragmentManager();
+ FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
+ hideFragment(fragmentTransaction);
+ switch (type){
+ case 1:
+ if(commonFileFragment==null){
+ commonFileFragment = FileCommonFragment.newInstance();
+ ((FileCommonFragment)commonFileFragment).setOnUpdateDataListener(this);
+ fragmentTransaction.add(R.id.fl_content,commonFileFragment);
+ }else {
+ fragmentTransaction.show(commonFileFragment);
+ }
+ break;
+ case 2:
+ if(allFileFragment==null){
+ allFileFragment = FileAllFragment.newInstance();
+ ((FileAllFragment)allFileFragment).setOnUpdateDataListener(this);
+ fragmentTransaction.add(R.id.fl_content,allFileFragment);
+ }else {
+ fragmentTransaction.show(allFileFragment);
+ }
+ break;
+ }
+ fragmentTransaction.commit();
+ }
+ private void hideFragment(FragmentTransaction transaction) {
+ if (commonFileFragment != null) {
+ transaction.hide(commonFileFragment);
+ }
+ if (allFileFragment != null) {
+ transaction.hide(allFileFragment);
+ }
+ }
+ @Override
+ public void onClick(View v) {
+ switch (v.getId()){
+ case R.id.btn_common:
+ setFragment(1);
+ btn_common.setBackgroundResource(R.mipmap.no_read_pressed);
+ btn_common.setTextColor(ContextCompat.getColor(this,R.color.white));
+ btn_all.setBackgroundResource(R.mipmap.already_read);
+ btn_all.setTextColor(ContextCompat.getColor(this,R.color.blue));
+ break;
+ case R.id.btn_all:
+ setFragment(2);
+ btn_common.setBackgroundResource(R.mipmap.no_read);
+ btn_common.setTextColor(ContextCompat.getColor(this,R.color.blue));
+ btn_all.setBackgroundResource(R.mipmap.already_read_pressed);
+ btn_all.setTextColor(ContextCompat.getColor(this,R.color.white));
+ break;
+ case R.id.tv_confirm:
+ isConfirm = true;
+ setResult(RESULT_OK);
+ finish();
+ break;
+ }
+ }
+ private long currentSize;
+ @Override
+ public void update(long size) {
+ currentSize+=size;
+ tv_size.setText(getString(R.string.already_select, FileUtils.getReadableFileSize(currentSize)));
+ String res = "("+ PickerManager.getInstance().files.size()+"/"+PickerManager.getInstance().maxCount+")";
+ tv_confirm.setText(getString(R.string.file_select_res,res));
+ }
+
+ @Override
+ public void replacement() {
+ long length=0;
+ for (FileEntity item:PickerManager.getInstance().files)
+ {
+ File file=item.getFile();
+ length+= file.length();
+ }
+ currentSize=length;
+ tv_size.setText(getString(R.string.already_select, FileUtils.getReadableFileSize(currentSize)));
+ String res = "("+ PickerManager.getInstance().files.size()+"/"+PickerManager.getInstance().maxCount+")";
+ tv_confirm.setText(getString(R.string.file_select_res,res));
+ }
+
+ @Override
+ public void onBackPressed() {
+ super.onBackPressed();
+ if(!isConfirm){
+ PickerManager.getInstance().files.clear();
+ }
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/fragment/systeminternetfragment.java b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/fragment/systeminternetfragment.java
index 06da5d04..6fde8f0b 100644
--- a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/fragment/systeminternetfragment.java
+++ b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/fragment/systeminternetfragment.java
@@ -4,18 +4,54 @@ import android.content.Context;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
+import androidx.recyclerview.widget.LinearLayoutManager;
+import androidx.recyclerview.widget.RecyclerView;
+
+import android.content.Intent;
+import android.graphics.Bitmap;
+import android.graphics.BitmapFactory;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
+import android.widget.Button;
+import android.widget.EditText;
import com.bonait.bnframework.R;
import com.bonait.bnframework.common.base.BaseFragment;
+import com.bonait.bnframework.common.constant.ConfigName;
+import com.bonait.bnframework.common.constant.Constants;
+import com.bonait.bnframework.common.db.QueryDB;
+import com.bonait.bnframework.common.db.mode.BPA_SYSTEMSET;
+import com.bonait.bnframework.common.filepicker.PickerManager;
+import com.bonait.bnframework.common.filepicker.adapter.FilePickerShowAdapter;
+import com.bonait.bnframework.common.filepicker.adapter.OnFileItemClickListener;
+import com.bonait.bnframework.common.filepicker.model.FileEntity;
+import com.bonait.bnframework.common.filepicker.util.OpenFile;
+import com.bonait.bnframework.common.image.utils.LocalCacheUtils;
+import com.bonait.bnframework.common.image.utils.MD5Encoder;
+import com.bonait.bnframework.common.utils.ToastUtils;
+import com.bonait.bnframework.common.view.MyLayoutManager;
+import com.bonait.bnframework.modules.home.fragment.from.FileActivity;
import com.orhanobut.logger.Logger;
+import com.qmuiteam.qmui.arch.QMUIFragment;
-import butterknife.ButterKnife;
+import java.io.File;
+import java.io.FileInputStream;
+import java.util.List;
-public class systeminternetfragment extends BaseFragment {
+import butterknife.BindView;
+import butterknife.ButterKnife;
+import butterknife.OnClick;
+import pub.devrel.easypermissions.EasyPermissions;
+/**
+ * 资源管理
+ */
+public class systeminternetfragment extends BaseFragment{
+ @BindView(R.id.rl_file)
+ RecyclerView mRecyclerView;
+ @BindView(R.id.baocunbendi)
+ Button baocunbendi;
private Context context;
@Override
protected View onCreateView() {
@@ -31,6 +67,49 @@ public class systeminternetfragment extends BaseFragment {
context = getContext();
}
+ @OnClick({R.id.xuanzhewenjian,R.id.baocunbendi})
+ public void onViewClicked(View view) {
+ switch (view.getId()) {
+ case R.id.xuanzhewenjian://保存按钮
+ Intent intent = new Intent(context, FileActivity.class);
+ startActivityForResult(intent, Constants.REQ_CODE);
+ break;
+ case R.id.baocunbendi://保存按钮
+ BitmapFactory.Options options = new BitmapFactory.Options();
+ options.inSampleSize=2;//宽高压缩为原来的1/2
+ for (FileEntity item:PickerManager.getInstance().files)
+ {
+ File file= item.getFile();
+ try {
+ Bitmap bitmap1= BitmapFactory.decodeStream(new FileInputStream(file));
+ new LocalCacheUtils().setBitmapToLocal(file.getName(),bitmap1);
+ } catch (Exception e) {
+ }
+ }
+ ToastUtils.info("添加成功!");
+ break;
+ }
+ }
+
+ @Override
+ public void onActivityResult(int requestCode, int resultCode, Intent data) {
+ super.onActivityResult(requestCode, resultCode, data);
+ if(requestCode == Constants.REQ_CODE){
+ mRecyclerView.setLayoutManager(new LinearLayoutManager(context));
+ FilePickerShowAdapter adapter = new FilePickerShowAdapter(context,PickerManager.getInstance().files);
+ mRecyclerView.setAdapter(adapter);
+
+ String res = "("+ PickerManager.getInstance().files.size()+"/"+PickerManager.getInstance().maxCount+")";
+ baocunbendi.setText(getString(R.string.file_select_res1,res));
+// adapter.setOnItemClickListener(new OnFileItemClickListener() {
+// @Override
+// public void click(int position) {
+// startActivity(Intent.createChooser(OpenFile.openFile(PickerManager.getInstance().files.get(position).getPath(),getBaseFragmentActivity()), "选择程序"));
+// }
+// });
+ }
+ }
+
@Override
public void onDestroy() {
super.onDestroy();
diff --git a/app/src/main/res/drawable/bottom_line.xml b/app/src/main/res/drawable/bottom_line.xml
new file mode 100644
index 00000000..a0e88ca3
--- /dev/null
+++ b/app/src/main/res/drawable/bottom_line.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_file.xml b/app/src/main/res/layout/activity_file.xml
new file mode 100644
index 00000000..d5216ce5
--- /dev/null
+++ b/app/src/main/res/layout/activity_file.xml
@@ -0,0 +1,69 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/fragment_system_internet.xml b/app/src/main/res/layout/fragment_system_internet.xml
index 448d2db5..33b75b79 100644
--- a/app/src/main/res/layout/fragment_system_internet.xml
+++ b/app/src/main/res/layout/fragment_system_internet.xml
@@ -10,10 +10,41 @@
android:layout_height="match_parent"
android:orientation="vertical"
android:background="@color/main_background">
-
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/item/layout/fragment_file_all.xml b/app/src/main/res/layout/item/layout/fragment_file_all.xml
new file mode 100644
index 00000000..ca889a04
--- /dev/null
+++ b/app/src/main/res/layout/item/layout/fragment_file_all.xml
@@ -0,0 +1,38 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/item/layout/fragment_file_normal.xml b/app/src/main/res/layout/item/layout/fragment_file_normal.xml
new file mode 100644
index 00000000..b89a2cb5
--- /dev/null
+++ b/app/src/main/res/layout/item/layout/fragment_file_normal.xml
@@ -0,0 +1,27 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/item/layout/item_file_picker.xml b/app/src/main/res/layout/item/layout/item_file_picker.xml
new file mode 100644
index 00000000..9e1cfa95
--- /dev/null
+++ b/app/src/main/res/layout/item/layout/item_file_picker.xml
@@ -0,0 +1,66 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/item/layout/item_file_picker_show.xml b/app/src/main/res/layout/item/layout/item_file_picker_show.xml
new file mode 100644
index 00000000..16425820
--- /dev/null
+++ b/app/src/main/res/layout/item/layout/item_file_picker_show.xml
@@ -0,0 +1,60 @@
+
+
+
+
+
+
+
+
+
+
+ />
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/mipmap-xxhdpi/already_read.png b/app/src/main/res/mipmap-xxhdpi/already_read.png
new file mode 100644
index 00000000..dfc97c5f
Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/already_read.png differ
diff --git a/app/src/main/res/mipmap-xxhdpi/already_read_pressed.png b/app/src/main/res/mipmap-xxhdpi/already_read_pressed.png
new file mode 100644
index 00000000..5319bf6c
Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/already_read_pressed.png differ
diff --git a/app/src/main/res/mipmap-xxhdpi/back.png b/app/src/main/res/mipmap-xxhdpi/back.png
new file mode 100644
index 00000000..0a828dcd
Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/back.png differ
diff --git a/app/src/main/res/mipmap-xxhdpi/file_choice.png b/app/src/main/res/mipmap-xxhdpi/file_choice.png
new file mode 100644
index 00000000..d37e2128
Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/file_choice.png differ
diff --git a/app/src/main/res/mipmap-xxhdpi/file_no_selection.png b/app/src/main/res/mipmap-xxhdpi/file_no_selection.png
new file mode 100644
index 00000000..e3a1dac6
Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/file_no_selection.png differ
diff --git a/app/src/main/res/mipmap-xxhdpi/file_picker_def.png b/app/src/main/res/mipmap-xxhdpi/file_picker_def.png
new file mode 100644
index 00000000..f05d9032
Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/file_picker_def.png differ
diff --git a/app/src/main/res/mipmap-xxhdpi/file_picker_delete.png b/app/src/main/res/mipmap-xxhdpi/file_picker_delete.png
new file mode 100644
index 00000000..04aab49a
Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/file_picker_delete.png differ
diff --git a/app/src/main/res/mipmap-xxhdpi/file_picker_excle.png b/app/src/main/res/mipmap-xxhdpi/file_picker_excle.png
new file mode 100644
index 00000000..927723f1
Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/file_picker_excle.png differ
diff --git a/app/src/main/res/mipmap-xxhdpi/file_picker_folder.png b/app/src/main/res/mipmap-xxhdpi/file_picker_folder.png
new file mode 100644
index 00000000..097d2a38
Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/file_picker_folder.png differ
diff --git a/app/src/main/res/mipmap-xxhdpi/file_picker_pdf.png b/app/src/main/res/mipmap-xxhdpi/file_picker_pdf.png
new file mode 100644
index 00000000..b5bd471e
Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/file_picker_pdf.png differ
diff --git a/app/src/main/res/mipmap-xxhdpi/file_picker_ppt.png b/app/src/main/res/mipmap-xxhdpi/file_picker_ppt.png
new file mode 100644
index 00000000..2333329f
Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/file_picker_ppt.png differ
diff --git a/app/src/main/res/mipmap-xxhdpi/file_picker_txt.png b/app/src/main/res/mipmap-xxhdpi/file_picker_txt.png
new file mode 100644
index 00000000..060f999b
Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/file_picker_txt.png differ
diff --git a/app/src/main/res/mipmap-xxhdpi/file_picker_word.png b/app/src/main/res/mipmap-xxhdpi/file_picker_word.png
new file mode 100644
index 00000000..a1d0a4cd
Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/file_picker_word.png differ
diff --git a/app/src/main/res/mipmap-xxhdpi/no_read.png b/app/src/main/res/mipmap-xxhdpi/no_read.png
new file mode 100644
index 00000000..dbae8bc4
Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/no_read.png differ
diff --git a/app/src/main/res/mipmap-xxhdpi/no_read_pressed.png b/app/src/main/res/mipmap-xxhdpi/no_read_pressed.png
new file mode 100644
index 00000000..d197bb01
Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/no_read_pressed.png differ
diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml
index 8b8fe938..522109f2 100644
--- a/app/src/main/res/values/colors.xml
+++ b/app/src/main/res/values/colors.xml
@@ -3,6 +3,13 @@
+ #3F51B5
+ #303F9F
+ #FF4081
+ #44B2FE
+ #4A4A4A
+ #86848B
+ #ECECEC
#00c2f4
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 297c08c3..82edfc5a 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -1,5 +1,14 @@
菠萝小炒
+ 常用文件
+ 全部文件
+ 没有数据
+ sd卡不可用
+ 已选择:%s
+ 确定%s
+ 最多选择%d个文件
+ 保存本地%s
+
Hello blank fragment
@@ -14,7 +23,7 @@
示例图片
- 网络管理
+ 资源管理
设备信息
系统设置
调料设置