|
|
|
@ -5,6 +5,7 @@ import android.os.Build;
|
|
|
|
|
import android.os.Bundle;
|
|
|
|
|
import android.os.Handler;
|
|
|
|
|
import android.util.Log;
|
|
|
|
|
import android.view.KeyEvent;
|
|
|
|
|
import android.view.LayoutInflater;
|
|
|
|
|
import android.view.View;
|
|
|
|
|
import android.view.ViewGroup;
|
|
|
|
@ -62,6 +63,8 @@ public class UnzipDialogFragment extends DialogFragment {
|
|
|
|
|
private String srcFile,desPath,md5,passwd;
|
|
|
|
|
//解压是否成功
|
|
|
|
|
private boolean successful;
|
|
|
|
|
//当前dialog是否可视
|
|
|
|
|
private boolean isVisable;
|
|
|
|
|
|
|
|
|
|
public interface UnzipDialogListener{
|
|
|
|
|
public void onDialogUnzipClicked();
|
|
|
|
@ -112,6 +115,7 @@ public class UnzipDialogFragment extends DialogFragment {
|
|
|
|
|
|
|
|
|
|
fromSQL = false;
|
|
|
|
|
successful = false;
|
|
|
|
|
isVisable = true;
|
|
|
|
|
try {
|
|
|
|
|
if(!FileUtils.isEncrypted(srcFile)){
|
|
|
|
|
//当文件不是加密文件时
|
|
|
|
@ -189,6 +193,7 @@ public class UnzipDialogFragment extends DialogFragment {
|
|
|
|
|
alertDialog.setCanceledOnTouchOutside(false);
|
|
|
|
|
if (alertDialog != null){
|
|
|
|
|
Button pb = alertDialog.getButton(AlertDialog.BUTTON_POSITIVE);
|
|
|
|
|
Button nb = alertDialog.getButton(AlertDialog.BUTTON_NEGATIVE);
|
|
|
|
|
pb.setOnClickListener(new View.OnClickListener() {
|
|
|
|
|
@Override
|
|
|
|
|
public void onClick(View v) {
|
|
|
|
@ -199,13 +204,25 @@ public class UnzipDialogFragment extends DialogFragment {
|
|
|
|
|
Thread ft = new Thread(new FileThread(fHandler,srcFile,desPath,passwd,FileHandler.FUNCTION_DECOMPRESS));
|
|
|
|
|
ft.start();
|
|
|
|
|
progressBar.setVisibility(View.VISIBLE);
|
|
|
|
|
Button nb = alertDialog.getButton(AlertDialog.BUTTON_NEGATIVE);
|
|
|
|
|
nb.setClickable(false);
|
|
|
|
|
nb.setTextColor(getResources().getColor(R.color.grey_1));
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
nb.setOnClickListener(new View.OnClickListener() {
|
|
|
|
|
@Override
|
|
|
|
|
public void onClick(View v) {
|
|
|
|
|
dismiss();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void onStop() {
|
|
|
|
|
super.onStop();
|
|
|
|
|
dismiss();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void setFromSQL(boolean fromSQL){
|
|
|
|
|
this.fromSQL = fromSQL;
|
|
|
|
|
}
|
|
|
|
@ -265,4 +282,15 @@ public class UnzipDialogFragment extends DialogFragment {
|
|
|
|
|
public FileManageFragment getFMFragment(){
|
|
|
|
|
return fmFragment;
|
|
|
|
|
}
|
|
|
|
|
public void setVisable(boolean v){
|
|
|
|
|
this.isVisable = v;
|
|
|
|
|
}
|
|
|
|
|
public boolean getVisable(){
|
|
|
|
|
return isVisable;
|
|
|
|
|
}
|
|
|
|
|
public void dismiss(){
|
|
|
|
|
Toast.makeText(getActivity(),"重写dismiss",Toast.LENGTH_SHORT).show();
|
|
|
|
|
setVisable(false);
|
|
|
|
|
super.dismiss();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|