2323
2424public 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