实现解压后刷新布局

master
ThankVinci 4 years ago
parent 2c9e99500f
commit a9e24a836c

@ -91,7 +91,7 @@ public class FileAdapter extends RecyclerView.Adapter<FileAdapter.ViewHolder> {
unzipDialog.setArguments(data);
unzipDialog.show(((MainActivity)v.getContext()).getSupportFragmentManager(),"unzip");
//Toast.makeText(v.getContext(),""+unzipDialog.getPosiBtn(),Toast.LENGTH_SHORT).show();
unzipDialog.setFmFragment((FileManageFragment) fragment);
}else{
Toast.makeText(v.getContext(),"压缩包已损坏或者格式不合法",Toast.LENGTH_SHORT).show();
}

@ -44,6 +44,8 @@ public class UnzipDialogFragment extends DialogFragment {
Button posi_btn; //点击解压的按钮
//用一个fragment来存当前这个fragment对象
Fragment fragment;
//
FileManageFragment fmFragment;
//点击压缩文件弹出来的Dialog
private UnzipDialogListener listener;
//源文件绝对路径,目标文件夹绝对路径,md5码和密码
@ -94,10 +96,12 @@ public class UnzipDialogFragment extends DialogFragment {
srcFile_edit = view.findViewById(R.id.src_edit);
srcFile_edit.setText(srcFile);
srcFile_edit.setSelection(srcFile.length());
srcFile_edit.setTextColor(getResources().getColor(R.color.grey_1));
desPath_edit = view.findViewById(R.id.des_edit);
desPath_edit.setText(desPath);
desPath_edit.setSelection(desPath.length());
desPath_edit.setTextColor(getResources().getColor(R.color.grey_1));
md5_edit = view.findViewById(R.id.md5_edit);
passwd_edit = view.findViewById(R.id.pwd_edit);
@ -112,7 +116,7 @@ public class UnzipDialogFragment extends DialogFragment {
if(!FileUtils.isEncrypted(srcFile)){
//当文件不是加密文件时
TextView text = view.findViewById(R.id.pwd_text);
text.setTextColor(getResources().getColor(R.color.grey));
text.setTextColor(getResources().getColor(R.color.grey_1));
setNoPWD();
}
} catch (ZipException e) {
@ -225,6 +229,7 @@ public class UnzipDialogFragment extends DialogFragment {
md5_edit.setText(md5);
this.md5 = md5_edit.getText().toString();
md5_edit.setSelection(md5.length());
md5_edit.setTextColor(getResources().getColor(R.color.grey_1));
}
public void setSuccessful(boolean successful){
this.successful = successful;
@ -252,12 +257,19 @@ public class UnzipDialogFragment extends DialogFragment {
}
public void setNoPWD(){
getPWD.setClickable(false);
getPWD.setTextColor(getResources().getColor(R.color.grey));
getPWD.setTextColor(getResources().getColor(R.color.grey_1));
passwd_edit.setFocusable(false);
passwd_edit.setHint("非加密文件");
passwd_edit.setHintTextColor(getResources().getColor(R.color.grey_1));
acceptPWD2SQL.setChecked(false);
}
public Button getPosiBtn(){
return posi_btn;
}
public void setFmFragment(FileManageFragment fmFragment){
this.fmFragment = fmFragment;
}
public FileManageFragment getFMFragment(){
return fmFragment;
}
}

@ -10,11 +10,13 @@ import android.widget.Toast;
import androidx.annotation.RequiresApi;
import androidx.fragment.app.Fragment;
import androidx.navigation.Navigation;
import com.thankvinci.CloudKey.Fragment.UnzipDialogFragment;
import com.thankvinci.CloudKey.NetUtils.NetCheck;
import com.thankvinci.CloudKey.NetUtils.NetHandler;
import com.thankvinci.CloudKey.NetUtils.NetThread;
import com.thankvinci.CloudKey.R;
public class FileHandler extends Handler {
//定义功能选择的常量 获取MD5和解压
@ -48,6 +50,7 @@ public class FileHandler extends Handler {
((UnzipDialogFragment)fragment).setProgressBar(View.INVISIBLE);
((UnzipDialogFragment)fragment).dismiss();
Toast.makeText(activity,"解压完成",Toast.LENGTH_SHORT).show();
((UnzipDialogFragment)fragment).getFMFragment().loadDirectory();
//当dialog的checkbox为选中时并且密码来源不是数据库时再并且解压成功时再并且密码输入框不为空时,即用户同意输入解压密码解压成功后把密码上传到数据库
if("无网络".equals(NetCheck.getNetStatus(activity))){
Toast.makeText(activity,"上传密码失败,当前网络不畅通"+NetCheck.getNetStatus((Context)activity),Toast.LENGTH_SHORT).show();

@ -7,6 +7,7 @@
<color name="teal_700">#FF018786</color>
<color name="black">#FF000000</color>
<color name="grey">#FF343434</color>
<color name="grey_1">#FFDCDCDC</color>
<color name="white">#FFFFFFFF</color>
<color name="red">#FFff0000</color>
<color name="blue">#FF0000ff</color>

@ -323,4 +323,6 @@ FileHandler负责将获取到的md5码发到NetThread,然后将得到的密码
**2021/6/13**
改了一下原先的文件名排序,之前的文件名排序的返回值有问题
改了一下原先的文件名排序,之前的文件名排序的返回值有问题导致文件排序一直是乱的
实现解压后刷新布局
Loading…
Cancel
Save