Browse Source

Fix code analytics warnings

Signed-off-by: alperozturk <alper_ozturk@proton.me>
alperozturk 1 năm trước cách đây
mục cha
commit
f8309d0791

+ 20 - 7
app/src/main/java/com/nextcloud/client/jobs/FilesExportWork.kt

@@ -29,9 +29,7 @@ import android.content.ContentResolver
 import android.content.Context
 import android.content.Intent
 import android.content.Intent.FLAG_ACTIVITY_NEW_TASK
-import android.graphics.BitmapFactory
 import androidx.core.app.NotificationCompat
-import androidx.core.content.ContextCompat
 import androidx.work.Worker
 import androidx.work.WorkerParameters
 import com.nextcloud.client.account.User
@@ -104,7 +102,13 @@ class FilesExportWork(
 
     @Throws(IllegalStateException::class)
     private fun exportFile(ocFile: OCFile) {
-        FileExportUtils().exportFile(ocFile.fileName, ocFile.mimeType, contentResolver, ocFile, null)
+        FileExportUtils().exportFile(
+            ocFile.fileName,
+            ocFile.mimeType,
+            contentResolver,
+            ocFile,
+            null
+        )
     }
 
     private fun downloadFile(ocFile: OCFile) {
@@ -121,7 +125,11 @@ class FilesExportWork(
         val message = if (successfulExports == 0) {
             appContext.resources.getQuantityString(R.plurals.export_failed, successfulExports, successfulExports)
         } else {
-            appContext.resources.getQuantityString(R.plurals.export_partially_failed, successfulExports, successfulExports)
+            appContext.resources.getQuantityString(
+                R.plurals.export_partially_failed,
+                successfulExports,
+                successfulExports
+            )
         }
         showNotification(message)
     }
@@ -139,7 +147,10 @@ class FilesExportWork(
     private fun showNotification(message: String) {
         val notificationId = SecureRandom().nextInt()
 
-        val notificationBuilder = NotificationCompat.Builder(appContext, NotificationUtils.NOTIFICATION_CHANNEL_DOWNLOAD)
+        val notificationBuilder = NotificationCompat.Builder(
+            appContext,
+            NotificationUtils.NOTIFICATION_CHANNEL_DOWNLOAD
+        )
             .setSmallIcon(R.drawable.notification_icon)
             .setContentTitle(message)
             .setAutoCancel(true)
@@ -153,7 +164,8 @@ class FilesExportWork(
             appContext,
             notificationId,
             actionIntent,
-            PendingIntent.FLAG_CANCEL_CURRENT or PendingIntent.FLAG_IMMUTABLE
+            PendingIntent.FLAG_CANCEL_CURRENT or
+                PendingIntent.FLAG_IMMUTABLE
         )
         notificationBuilder.addAction(
             NotificationCompat.Action(
@@ -163,7 +175,8 @@ class FilesExportWork(
             )
         )
 
-        val notificationManager = appContext.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
+        val notificationManager = appContext
+            .getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
         notificationManager.notify(notificationId, notificationBuilder.build())
     }