|
|
@@ -11,6 +11,7 @@ import android.content.Intent; |
|
|
|
import android.graphics.Bitmap; |
|
|
|
import android.graphics.BitmapFactory; |
|
|
|
import android.os.Bundle; |
|
|
|
import android.os.Environment; |
|
|
|
import android.view.LayoutInflater; |
|
|
|
import android.view.View; |
|
|
|
import android.widget.Button; |
|
|
@@ -24,19 +25,23 @@ 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.OnDeleteListener; |
|
|
|
import com.bonait.bnframework.common.filepicker.adapter.OnFileItemClickListener; |
|
|
|
import com.bonait.bnframework.common.filepicker.model.FileEntity; |
|
|
|
import com.bonait.bnframework.common.filepicker.model.FileType; |
|
|
|
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.bonait.bnframework.modules.home.fragment.mode.image_sp; |
|
|
|
import com.orhanobut.logger.Logger; |
|
|
|
import com.qmuiteam.qmui.arch.QMUIFragment; |
|
|
|
|
|
|
|
import java.io.File; |
|
|
|
import java.io.FileInputStream; |
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
import butterknife.BindView; |
|
|
@@ -50,6 +55,8 @@ import pub.devrel.easypermissions.EasyPermissions; |
|
|
|
public class systeminternetfragment extends BaseFragment{ |
|
|
|
@BindView(R.id.rl_file) |
|
|
|
RecyclerView mRecyclerView; |
|
|
|
@BindView(R.id.rl_yx_file) |
|
|
|
RecyclerView rl_yx_file; |
|
|
|
@BindView(R.id.baocunbendi) |
|
|
|
Button baocunbendi; |
|
|
|
private Context context; |
|
|
@@ -65,6 +72,7 @@ public class systeminternetfragment extends BaseFragment{ |
|
|
|
super.onViewCreated(view, savedInstanceState); |
|
|
|
Logger.d("我的fragment创建"); |
|
|
|
context = getContext(); |
|
|
|
FlushedImage(); |
|
|
|
} |
|
|
|
|
|
|
|
@OnClick({R.id.xuanzhewenjian,R.id.baocunbendi}) |
|
|
@@ -90,6 +98,51 @@ public class systeminternetfragment extends BaseFragment{ |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
ArrayList<FileEntity> yx_files=new ArrayList<>(); |
|
|
|
private static final String CACHE_PATH= Environment.getExternalStorageDirectory().getAbsolutePath()+"/hblxiaochaodb/WebImage"; |
|
|
|
public void FlushedImage() |
|
|
|
{ |
|
|
|
File path = new File(CACHE_PATH);// 获得路径 |
|
|
|
File[] files = path.listFiles();// 读取文件 |
|
|
|
yx_files.clear(); |
|
|
|
for (File f : files) { |
|
|
|
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()) |
|
|
|
{ |
|
|
|
String[] imgs = {"png","jpg","jpeg","gif"}; |
|
|
|
e.setFileType(new FileType("IMG",imgs,0)); |
|
|
|
yx_files.add(e); |
|
|
|
} |
|
|
|
} |
|
|
|
rl_yx_file.setLayoutManager(new LinearLayoutManager(context)); |
|
|
|
FilePickerShowAdapter adapter = new FilePickerShowAdapter(context,yx_files); |
|
|
|
rl_yx_file.setAdapter(adapter); |
|
|
|
adapter.setOnDeleteListener(new OnDeleteListener() { |
|
|
|
@Override |
|
|
|
public void delete(int position) { |
|
|
|
File file= yx_files.get(position).getFile(); |
|
|
|
if (file.exists() && file.isFile()) |
|
|
|
{ |
|
|
|
file.delete(); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
private static boolean checkExits(String path) { |
|
|
|
for (FileEntity entity : PickerManager.getInstance().files) { |
|
|
|
if (entity.getPath().equals(path)) { |
|
|
|
return true; |
|
|
|
} |
|
|
|
} |
|
|
|
return false; |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void onActivityResult(int requestCode, int resultCode, Intent data) { |
|
|
|