From 7f0a75eae202f505ae801b0dd417b038bfbcbfb5 Mon Sep 17 00:00:00 2001 From: Varun Patil Date: Sat, 13 May 2023 17:50:40 -0700 Subject: [PATCH] refactor --- app/src/main/java/gallery/memories/NativeX.kt | 3 --- .../main/java/gallery/memories/{service => mapper}/Fields.kt | 2 +- .../gallery/memories/service/DownloadBroadcastReceiver.kt | 2 +- app/src/main/java/gallery/memories/service/TimelineQuery.kt | 4 +++- 4 files changed, 5 insertions(+), 6 deletions(-) rename app/src/main/java/gallery/memories/{service => mapper}/Fields.kt (95%) diff --git a/app/src/main/java/gallery/memories/NativeX.kt b/app/src/main/java/gallery/memories/NativeX.kt index 91ce7d70..bc44ef1c 100644 --- a/app/src/main/java/gallery/memories/NativeX.kt +++ b/app/src/main/java/gallery/memories/NativeX.kt @@ -42,9 +42,6 @@ class NativeX(private val mActivity: AppCompatActivity) { companion object { lateinit var mDlService: DownloadService - fun getDlService(): DownloadService { - return mDlService; - } } fun handleRequest(request: WebResourceRequest): WebResourceResponse { diff --git a/app/src/main/java/gallery/memories/service/Fields.kt b/app/src/main/java/gallery/memories/mapper/Fields.kt similarity index 95% rename from app/src/main/java/gallery/memories/service/Fields.kt rename to app/src/main/java/gallery/memories/mapper/Fields.kt index 834f8c51..083e1855 100644 --- a/app/src/main/java/gallery/memories/service/Fields.kt +++ b/app/src/main/java/gallery/memories/mapper/Fields.kt @@ -1,4 +1,4 @@ -package gallery.memories.service +package gallery.memories.mapper class Fields { object Day { diff --git a/app/src/main/java/gallery/memories/service/DownloadBroadcastReceiver.kt b/app/src/main/java/gallery/memories/service/DownloadBroadcastReceiver.kt index c918ac71..ceab44a4 100644 --- a/app/src/main/java/gallery/memories/service/DownloadBroadcastReceiver.kt +++ b/app/src/main/java/gallery/memories/service/DownloadBroadcastReceiver.kt @@ -7,6 +7,6 @@ import gallery.memories.NativeX class DownloadBroadcastReceiver : BroadcastReceiver() { override fun onReceive(context: Context, intent: Intent) { - NativeX.getDlService().runDownloadCallback(intent) + NativeX.mDlService.runDownloadCallback(intent) } } \ No newline at end of file diff --git a/app/src/main/java/gallery/memories/service/TimelineQuery.kt b/app/src/main/java/gallery/memories/service/TimelineQuery.kt index fe6198b8..641806b2 100644 --- a/app/src/main/java/gallery/memories/service/TimelineQuery.kt +++ b/app/src/main/java/gallery/memories/service/TimelineQuery.kt @@ -16,6 +16,7 @@ import androidx.activity.result.contract.ActivityResultContracts import androidx.appcompat.app.AppCompatActivity import androidx.collection.ArraySet import androidx.exifinterface.media.ExifInterface +import gallery.memories.mapper.Fields import gallery.memories.mapper.SystemImage import org.json.JSONArray import org.json.JSONException @@ -142,7 +143,8 @@ class TimelineQuery(private val mCtx: AppCompatActivity) { try { val exif = ExifInterface(image.dataPath) - obj.put(Fields.Photo.EXIF, JSONObject() + obj.put( + Fields.Photo.EXIF, JSONObject() .put("Aperture", exif.getAttribute(ExifInterface.TAG_APERTURE_VALUE)) .put("FocalLength", exif.getAttribute(ExifInterface.TAG_FOCAL_LENGTH)) .put("FNumber", exif.getAttribute(ExifInterface.TAG_F_NUMBER))