Skip to content

Commit 649672d

Browse files
committed
refresh adapter after extraction end even if there were errors (show possibly created files from a partial extraction)
1 parent 679634c commit 649672d

3 files changed

Lines changed: 11 additions & 13 deletions

File tree

app/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ android {
88
minSdkVersion 19
99
targetSdkVersion 28
1010
multiDexEnabled true
11-
versionCode 175201227
11+
versionCode 175201229
1212
versionName "1.7.5"
1313
externalNativeBuild {
1414
cmake {

app/src/main/java/it/pgp/xfiles/service/CompressTask.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,6 @@
1919

2020
public class CompressTask extends RootHelperClientTask {
2121

22-
// public static final SocketNames compressSocketName = SocketNames.thecompressor;
23-
// public static final SocketNames compressSocketName = SocketNames.theroothelper;
24-
2522
// direct input to compressArchive
2623
public CompressParams params;
2724

app/src/main/java/it/pgp/xfiles/service/ExtractTask.java

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,6 @@
2323

2424
public class ExtractTask extends RootHelperClientTask {
2525

26-
// public static final SocketNames extractSocketName = SocketNames.theextractor;
27-
// public static final SocketNames extractSocketName = SocketNames.theroothelper;
28-
2926
// direct input to extractArchive
3027
private List<BasePathContent> srcArchives; // subDir taken from here
3128
private BasePathContent destDirectory;
@@ -100,17 +97,14 @@ protected void onPostExecute(Object o) {
10097
super.onPostExecute(o);
10198
MainActivity activity = MainActivity.mainActivity;
10299
if (allOk) {
103-
if (activity == null) return; // activity closed while service active, nothing to refresh
104-
BasePathContent cd = activity.getCurrentDirCommander().getCurrentDirectoryPathname();
105-
if (cd.equals(currentDir) && !(params instanceof TestParams))
106-
activity.browserPagerAdapter.showDirContent(activity.getCurrentDirCommander().refresh(),activity.browserPager.getCurrentItem(),null);
107100
Toast.makeText(service.getApplicationContext(), prefix+" completed", Toast.LENGTH_LONG).show();
108101
}
109102
else if (results.size()==1) {
110103
if (result == FileOpsErrorCodes.NULL_OR_WRONG_PASSWORD) {
111104
Toast.makeText(service.getApplicationContext(),"Empty or wrong password",Toast.LENGTH_LONG).show();
112-
if (activity == null) return; // activity closed while service active, nothing to refresh
113-
new AskPasswordDialogOnExtract(MainActivity.mainActivity,(ExtractParams)params).show();
105+
if (activity != null)
106+
new AskPasswordDialogOnExtract(activity,(ExtractParams)params).show();
107+
return;
114108
}
115109
else if (result == FileOpsErrorCodes.CRC_FAILED) {
116110
Toast.makeText(service.getApplicationContext(),"CRC failed in data, damaged archive?",Toast.LENGTH_LONG).show();
@@ -126,5 +120,12 @@ else if (result == FileOpsErrorCodes.CRC_FAILED) {
126120
if(activity != null) new ExtractResultsDialog(activity, srcArchives, results, params instanceof TestParams).show();
127121
else Toast.makeText(activity, "There were extraction/test errors, unable to display them without an active activity", Toast.LENGTH_SHORT).show();
128122
}
123+
124+
// anyway, if we are not testing archives, refresh adapter if we are in the same folder
125+
if(activity != null && !(params instanceof TestParams)) {
126+
BasePathContent cd = activity.getCurrentDirCommander().getCurrentDirectoryPathname();
127+
if (cd.equals(currentDir))
128+
activity.browserPagerAdapter.showDirContent(activity.getCurrentDirCommander().refresh(),activity.browserPager.getCurrentItem(),null);
129+
}
129130
}
130131
}

0 commit comments

Comments
 (0)