@@ -73,7 +73,7 @@ public class CopyService extends Service {
7373 private ArrayList <DataPackage > dataPackages = new ArrayList <>();
7474 private NotificationManager mNotifyManager ;
7575 private NotificationCompat .Builder mBuilder ;
76- private Context c ;
76+ private Context ctx ;
7777
7878 private ProgressListener progressListener ;
7979 private final IBinder mBinder = new LocalBinder ();
@@ -87,7 +87,7 @@ public class CopyService extends Service {
8787 @ Override
8888 public void onCreate () {
8989 super .onCreate ();
90- c = getApplicationContext ();
90+ ctx = getApplicationContext ();
9191 registerReceiver (receiver3 , new IntentFilter (TAG_BROADCAST_COPY_CANCEL ));
9292 }
9393
@@ -108,7 +108,7 @@ public int onStartCommand(Intent intent, int flags, final int startId) {
108108 notificationIntent .putExtra ("from" , "CopyService" );
109109 Log .i ("CopyService" , "notificationIntent " + notificationIntent + ", " + targetPath + ", " + notificationIntent .getExtras ());
110110 PendingIntent pendingIntent = PendingIntent .getActivity (this , new Random ().nextInt (), notificationIntent , PendingIntent .FLAG_UPDATE_CURRENT );
111- mBuilder = new NotificationCompat .Builder (c );
111+ mBuilder = new NotificationCompat .Builder (ctx );
112112 mBuilder .setContentIntent (pendingIntent );
113113 mBuilder .setContentTitle (getResources ().getString (R .string .copying ))
114114 .setSmallIcon (R .drawable .ic_content_copy_white_36dp );
@@ -148,7 +148,7 @@ protected Integer doInBackground(Bundle... p1) {
148148 }
149149 // setting up service watchers and initial data packages
150150 // finding total size on background thread (this is necessary condition for SMB!)
151- totalSize = Futils .getTotalBytes (sourceFiles , c );
151+ totalSize = Futils .getTotalBytes (sourceFiles , ctx );
152152 totalSourceFiles = sourceFiles .size ();
153153 progressHandler = new ProgressHandler (totalSourceFiles , totalSize );
154154
@@ -275,7 +275,7 @@ public void execute(final ArrayList<BaseFile> sourceFiles, final String targetPa
275275 // initial start of copy, initiate the watcher
276276 watcherUtil .watch ();
277277
278- if (FileUtil .checkFolder ((targetPath ), c ) == 1 ) {
278+ if (FileUtil .checkFolder ((targetPath ), ctx ) == 1 ) {
279279 for (int i = 0 ; i < sourceFiles .size (); i ++) {
280280 sourceProgress = i ;
281281 BaseFile f1 = (sourceFiles .get (i ));
@@ -352,21 +352,23 @@ public void execute(final ArrayList<BaseFile> sourceFiles, final String targetPa
352352 if (!failedFOps .contains (a ))
353353 toDelete .add (a );
354354 }
355- new DeleteTask (c , null ).execute ((toDelete ));//getContentResolver(),
355+ new DeleteTask (ctx , null ).execute ((toDelete ));//getContentResolver(),
356356 }
357357 }
358358
359359 void copyRoot (BaseFile sourceFile , HFile targetFile , boolean move ) {
360360
361361 try {
362- if (!move ) RootUtils .copy (sourceFile .getPath (), targetFile .getPath ());
363- else if (move ) RootUtils .move (sourceFile .getPath (), targetFile .getPath ());
362+ if (!move )
363+ RootUtils .copy (sourceFile .getPath (), targetFile .getPath ());
364+ else if (move )
365+ RootUtils .move (sourceFile .getPath (), targetFile .getPath ());
364366 ServiceWatcherUtil .POSITION += sourceFile .size ;
365367 } catch (RootNotPermittedException e ) {
366368 failedFOps .add (sourceFile );
367369 e .printStackTrace ();
368370 }
369- Futils .scanFile (targetFile .getPath (), c );
371+ Futils .scanFile (targetFile .getPath (), ctx );
370372 }
371373
372374 private void copyFiles (final BaseFile sourceFile , final HFile targetFile ,
@@ -375,7 +377,7 @@ private void copyFiles(final BaseFile sourceFile, final HFile targetFile,
375377 if (sourceFile .isDirectory ()) {
376378 if (progressHandler .getCancelled ()) return ;
377379
378- if (!targetFile .exists ()) targetFile .mkdir (c );
380+ if (!targetFile .exists ()) targetFile .mkdir (ctx );
379381
380382 // various checks
381383 // 1. source file and target file doesn't end up in loop
@@ -388,7 +390,7 @@ private void copyFiles(final BaseFile sourceFile, final HFile targetFile,
388390 targetFile .setLastModified (sourceFile .lastModified ());
389391
390392 if (progressHandler .getCancelled ()) return ;
391- ArrayList <BaseFile > filePaths = sourceFile .listFiles (c , false );
393+ ArrayList <BaseFile > filePaths = sourceFile .listFiles (ctx , false );
392394 for (BaseFile file : filePaths ) {
393395 HFile destFile = new HFile (targetFile .getMode (), targetFile .getPath (),
394396 file .getName (), file .isDirectory ());
@@ -401,7 +403,7 @@ private void copyFiles(final BaseFile sourceFile, final HFile targetFile,
401403 return ;
402404 }
403405
404- GenericCopyUtil copyUtil = new GenericCopyUtil (c );
406+ GenericCopyUtil copyUtil = new GenericCopyUtil (ctx );
405407
406408 progressHandler .setFileName (sourceFile .getName ());
407409 copyUtil .copy (sourceFile , targetFile , progressHandler );
@@ -424,10 +426,10 @@ void generateNotification(ArrayList<HFile> failedOps, boolean move) {
424426 if (failedOps .size ()==0 ) return ;
425427 Log .e ("CopyService.generateNotification" , failedOps + ", " + move );
426428
427- NotificationCompat .Builder mBuilder = new NotificationCompat .Builder (c );
428- mBuilder .setContentTitle (c .getString (R .string .operationunsuccesful ));
429- mBuilder .setContentText (c .getString (R .string .copy_error ).replace ("%s" ,
430- move ? c .getString (R .string .moved ) : c .getString (R .string .copied )));
429+ NotificationCompat .Builder mBuilder = new NotificationCompat .Builder (ctx );
430+ mBuilder .setContentTitle (ctx .getString (R .string .operationunsuccesful ));
431+ mBuilder .setContentText (ctx .getString (R .string .copy_error ).replace ("%s" ,
432+ move ? ctx .getString (R .string .moved ) : ctx .getString (R .string .copied )));
431433 mBuilder .setAutoCancel (true );
432434
433435 progressHandler .setCancelled (true );
@@ -475,9 +477,9 @@ private void publishResults(int id, String fileName, int sourceFiles, int source
475477 mBuilder .setOngoing (true );
476478 int title = R .string .copying ;
477479 if (move ) title = R .string .moving ;
478- mBuilder .setContentTitle (c .getResources ().getString (title ));
479- mBuilder .setContentText (fileName + " " + Formatter .formatFileSize (c , writtenSize ) + "/" +
480- Formatter .formatFileSize (c , totalSize ));
480+ mBuilder .setContentTitle (ctx .getResources ().getString (title ));
481+ mBuilder .setContentText (fileName + " " + Formatter .formatFileSize (ctx , writtenSize ) + "/" +
482+ Formatter .formatFileSize (ctx , totalSize ));
481483 int id1 = Integer .parseInt ("456" + id );
482484 mNotifyManager .notify (id1 , mBuilder .build ());
483485 if (writtenSize == totalSize || totalSize == 0 ) {
0 commit comments