Format code

This commit is contained in:
Ming Ming 2023-08-04 01:25:47 +08:00
parent 88cda20582
commit 924a7c9105
2 changed files with 20 additions and 12 deletions

View file

@ -8,7 +8,7 @@
android:maxSdkVersion="29" android:maxSdkVersion="29"
tools:ignore="ScopedStorage" /> tools:ignore="ScopedStorage" />
<application <application
android:name=".App" android:name=".App"
android:label="@string/app_name" android:label="@string/app_name"
android:icon="@mipmap/ic_launcher" android:icon="@mipmap/ic_launcher"

View file

@ -6,7 +6,11 @@ import android.os.Bundle
import androidx.annotation.NonNull import androidx.annotation.NonNull
import com.google.android.gms.maps.MapsInitializer import com.google.android.gms.maps.MapsInitializer
import com.google.android.gms.maps.OnMapsSdkInitializedCallback import com.google.android.gms.maps.OnMapsSdkInitializedCallback
import com.nkming.nc_photos.plugin.* import com.nkming.nc_photos.plugin.NcPhotosPlugin
import com.nkming.nc_photos.plugin.UriUtil
import com.nkming.nc_photos.plugin.logD
import com.nkming.nc_photos.plugin.logE
import com.nkming.nc_photos.plugin.logI
import io.flutter.embedding.android.FlutterActivity import io.flutter.embedding.android.FlutterActivity
import io.flutter.embedding.engine.FlutterEngine import io.flutter.embedding.engine.FlutterEngine
import io.flutter.plugin.common.EventChannel import io.flutter.plugin.common.EventChannel
@ -61,12 +65,16 @@ class MainActivity : FlutterActivity(), MethodChannel.MethodCallHandler,
} }
override fun onNewIntent(intent: Intent) { override fun onNewIntent(intent: Intent) {
if (intent.action == NcPhotosPlugin.ACTION_SHOW_IMAGE_PROCESSOR_RESULT) { when (intent.action) {
val route = getRouteFromImageProcessorResult(intent) ?: return NcPhotosPlugin.ACTION_SHOW_IMAGE_PROCESSOR_RESULT -> {
logI(TAG, "Navigate to route: $route") val route = getRouteFromImageProcessorResult(intent) ?: return
flutterEngine?.navigationChannel?.pushRoute(route) logI(TAG, "Navigate to route: $route")
} else { flutterEngine?.navigationChannel?.pushRoute(route)
super.onNewIntent(intent) }
else -> {
super.onNewIntent(intent)
}
} }
} }
@ -91,6 +99,7 @@ class MainActivity : FlutterActivity(), MethodChannel.MethodCallHandler,
logD(TAG, "Using new map renderer") logD(TAG, "Using new map renderer")
true true
} }
MapsInitializer.Renderer.LEGACY -> { MapsInitializer.Renderer.LEGACY -> {
logD(TAG, "Using legacy map renderer") logD(TAG, "Using legacy map renderer")
false false
@ -99,10 +108,9 @@ class MainActivity : FlutterActivity(), MethodChannel.MethodCallHandler,
} }
private fun getRouteFromImageProcessorResult(intent: Intent): String? { private fun getRouteFromImageProcessorResult(intent: Intent): String? {
val resultUri = val resultUri = intent.getParcelableExtra<Uri>(
intent.getParcelableExtra<Uri>( NcPhotosPlugin.EXTRA_IMAGE_RESULT_URI
NcPhotosPlugin.EXTRA_IMAGE_RESULT_URI )
)
if (resultUri == null) { if (resultUri == null) {
logE(TAG, "Image result uri == null") logE(TAG, "Image result uri == null")
return null return null