amap_search_fluttify

This commit is contained in:
2024-11-17 15:59:37 +08:00
commit 731cf46ce1
435 changed files with 218481 additions and 0 deletions

70
android/build.gradle Normal file
View File

@ -0,0 +1,70 @@
group 'me.yohom.amap_search_fluttify'
version '1.0-SNAPSHOT'
buildscript {
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.1.2'
}
}
rootProject.allprojects {
repositories {
google()
mavenCentral()
}
}
apply plugin: 'com.android.library'
android {
if (project.android.hasProperty("namespace")) {
namespace = "me.yohom.amap_search_fluttify"
}
compileSdkVersion 31
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
main.jniLibs.srcDir 'libs'
}
defaultConfig {
minSdkVersion 16
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
lintOptions {
disable 'InvalidPackage'
}
compileOptions {
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility JavaVersion.VERSION_1_8
}
packagingOptions {
merge 'res/values/values.xml'
merge 'AndroidManifest.xml'
merge 'R.txt'
merge 'classes.jar'
merge 'proguard.txt'
}
buildTypes {
release {
consumerProguardFiles "proguard-rules.pro"
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar', '*.aar'])
implementation 'androidx.annotation:annotation:1.1.0'
implementation 'androidx.appcompat:appcompat:1.1.0'
compileOnly rootProject.findProject(":foundation_fluttify")
// flutter plugin dependency
// sdk dependency
api 'com.amap.api:search:9.2.0'
}

24
android/proguard-rules.pro vendored Normal file
View File

@ -0,0 +1,24 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
# 高德地图混淆规则
-keep class com.amap.api.services.**{*;}

1
android/settings.gradle Normal file
View File

@ -0,0 +1 @@
rootProject.name = 'amap_search_fluttify'

View File

@ -0,0 +1,3 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="me.yohom.amap_search_fluttify">
</manifest>

View File

@ -0,0 +1,180 @@
//////////////////////////////////////////////////////////
// GENERATED BY FLUTTIFY. DO NOT EDIT IT.
//////////////////////////////////////////////////////////
package me.yohom.amap_search_fluttify;
import android.os.Bundle;
import android.util.Log;
import android.app.Activity;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import androidx.annotation.NonNull;
import io.flutter.embedding.engine.plugins.FlutterPlugin;
import io.flutter.embedding.engine.plugins.activity.ActivityAware;
import io.flutter.embedding.engine.plugins.activity.ActivityPluginBinding;
import io.flutter.plugin.common.BinaryMessenger;
import io.flutter.plugin.common.MethodCall;
import io.flutter.plugin.common.MethodChannel;
import io.flutter.plugin.common.PluginRegistry.Registrar;
import io.flutter.plugin.common.StandardMethodCodec;
import io.flutter.plugin.platform.PlatformViewRegistry;
import me.yohom.amap_search_fluttify.sub_handler.*;
import me.yohom.amap_search_fluttify.sub_handler.custom.SubHandlerCustom;
import me.yohom.foundation_fluttify.core.FluttifyMessageCodec;
import static me.yohom.foundation_fluttify.FoundationFluttifyPluginKt.getEnableLog;
import static me.yohom.foundation_fluttify.FoundationFluttifyPluginKt.getHEAP;
@SuppressWarnings("ALL")
public class AmapSearchFluttifyPlugin implements FlutterPlugin, MethodChannel.MethodCallHandler, ActivityAware {
private static List<Map<String, Handler>> handlerMapList;
// v1 android embedding for compatible
public static void registerWith(Registrar registrar) {
final MethodChannel channel = new MethodChannel(registrar.messenger(), "me.yohom/amap_search_fluttify", new StandardMethodCodec(new FluttifyMessageCodec()));
AmapSearchFluttifyPlugin plugin = new AmapSearchFluttifyPlugin();
BinaryMessenger messenger = registrar.messenger();
PlatformViewRegistry platformViewRegistry = registrar.platformViewRegistry();
Activity activity = registrar.activity();
plugin.messenger = messenger;
plugin.platformViewRegistry = platformViewRegistry;
handlerMapList = new ArrayList<>();
handlerMapList.add(SubHandler0.getSubHandler(messenger));
handlerMapList.add(SubHandler1.getSubHandler(messenger));
handlerMapList.add(SubHandler2.getSubHandler(messenger));
handlerMapList.add(SubHandler3.getSubHandler(messenger));
handlerMapList.add(SubHandler4.getSubHandler(messenger));
handlerMapList.add(SubHandler5.getSubHandler(messenger));
handlerMapList.add(SubHandler6.getSubHandler(messenger));
handlerMapList.add(SubHandler7.getSubHandler(messenger));
handlerMapList.add(SubHandler8.getSubHandler(messenger));
handlerMapList.add(SubHandler9.getSubHandler(messenger));
handlerMapList.add(SubHandler10.getSubHandler(messenger));
handlerMapList.add(SubHandler11.getSubHandler(messenger));
handlerMapList.add(SubHandler12.getSubHandler(messenger));
handlerMapList.add(SubHandler13.getSubHandler(messenger));
handlerMapList.add(SubHandler14.getSubHandler(messenger));
handlerMapList.add(SubHandler15.getSubHandler(messenger));
handlerMapList.add(SubHandlerCustom.instance.getSubHandler(messenger, registrar.activity()));
channel.setMethodCallHandler(plugin);
// register platform view
}
private BinaryMessenger messenger;
private PlatformViewRegistry platformViewRegistry;
// v2 android embedding
@Override
public void onAttachedToEngine(FlutterPluginBinding binding) {
if (getEnableLog()) {
Log.d("fluttify-java", "AmapSearchFluttifyPlugin::onAttachedToEngine@" + binding);
}
final MethodChannel channel = new MethodChannel(binding.getBinaryMessenger(), "me.yohom/amap_search_fluttify", new StandardMethodCodec(new FluttifyMessageCodec()));
messenger = binding.getBinaryMessenger();
platformViewRegistry = binding.getPlatformViewRegistry();
handlerMapList = new ArrayList<>();
handlerMapList.add(SubHandler0.getSubHandler(messenger));
handlerMapList.add(SubHandler1.getSubHandler(messenger));
handlerMapList.add(SubHandler2.getSubHandler(messenger));
handlerMapList.add(SubHandler3.getSubHandler(messenger));
handlerMapList.add(SubHandler4.getSubHandler(messenger));
handlerMapList.add(SubHandler5.getSubHandler(messenger));
handlerMapList.add(SubHandler6.getSubHandler(messenger));
handlerMapList.add(SubHandler7.getSubHandler(messenger));
handlerMapList.add(SubHandler8.getSubHandler(messenger));
handlerMapList.add(SubHandler9.getSubHandler(messenger));
handlerMapList.add(SubHandler10.getSubHandler(messenger));
handlerMapList.add(SubHandler11.getSubHandler(messenger));
handlerMapList.add(SubHandler12.getSubHandler(messenger));
handlerMapList.add(SubHandler13.getSubHandler(messenger));
handlerMapList.add(SubHandler14.getSubHandler(messenger));
handlerMapList.add(SubHandler15.getSubHandler(messenger));
channel.setMethodCallHandler(this);
}
@Override
public void onDetachedFromEngine(FlutterPluginBinding binding) {
if (getEnableLog()) {
Log.d("fluttify-java", "AmapSearchFluttifyPlugin::onDetachedFromEngine@" + binding);
}
}
@Override
public void onAttachedToActivity(ActivityPluginBinding binding) {
if (getEnableLog()) {
Log.d("fluttify-java", "AmapSearchFluttifyPlugin::onAttachedToActivity@" + binding);
}
Activity activity = binding.getActivity();
handlerMapList.add(SubHandlerCustom.instance.getSubHandler(messenger, activity));
// register platform view
}
@Override
public void onDetachedFromActivity() {
if (getEnableLog()) {
Log.d("fluttify-java", "AmapSearchFluttifyPlugin::onDetachedFromActivity");
}
}
@Override
public void onReattachedToActivityForConfigChanges(ActivityPluginBinding binding) {
if (getEnableLog()) {
Log.d("fluttify-java", "AmapSearchFluttifyPlugin::onReattachedToActivityForConfigChanges@" + binding);
}
}
@Override
public void onDetachedFromActivityForConfigChanges() {
if (getEnableLog()) {
Log.d("fluttify-java", "AmapSearchFluttifyPlugin::onDetachedFromActivityForConfigChanges");
}
}
@Override
public void onMethodCall(@NonNull MethodCall methodCall, @NonNull MethodChannel.Result methodResult) {
Handler handler = null;
for (Map<String, Handler> handlerMap : handlerMapList) {
if (handlerMap.containsKey(methodCall.method)) {
handler = handlerMap.get(methodCall.method);
break;
}
}
if (handler != null) {
try {
handler.call(methodCall.arguments, methodResult);
} catch (Exception e) {
e.printStackTrace();
methodResult.error(e.getMessage(), null, null);
}
} else {
methodResult.notImplemented();
}
}
@FunctionalInterface
public static interface Handler {
void call(Object args, MethodChannel.Result methodResult) throws Exception;
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,62 @@
//////////////////////////////////////////////////////////
// GENERATED BY FLUTTIFY. DO NOT EDIT IT.
//////////////////////////////////////////////////////////
package me.yohom.amap_search_fluttify.sub_handler.custom;
import android.os.Bundle;
import android.util.Log;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import androidx.annotation.NonNull;
import io.flutter.embedding.engine.plugins.FlutterPlugin;
import io.flutter.plugin.common.BinaryMessenger;
import io.flutter.plugin.common.MethodCall;
import io.flutter.plugin.common.MethodChannel;
import io.flutter.plugin.common.PluginRegistry.Registrar;
import io.flutter.plugin.platform.PlatformViewRegistry;
import me.yohom.amap_search_fluttify.AmapSearchFluttifyPlugin.Handler;
import static me.yohom.foundation_fluttify.FoundationFluttifyPluginKt.getEnableLog;
import static me.yohom.foundation_fluttify.FoundationFluttifyPluginKt.getHEAP;
@SuppressWarnings("ALL")
public class SubHandlerCustom {
public static final SubHandlerCustom instance = new SubHandlerCustom();
private SubHandlerCustom() { }
public Map<String, Handler> getSubHandler(BinaryMessenger messenger, android.app.Activity activity) {
return new HashMap<String, Handler>() {{
put("", (args, methodResult) -> {
// args
// ref
// invoke native method
try {
} catch (Throwable throwable) {
throwable.printStackTrace();
if (getEnableLog()) {
Log.d("Current HEAP: ", getHEAP().toString());
}
methodResult.error(throwable.getMessage(), null, null);
return;
}
// convert result to jsonable result
String jsonableResult = "success";
methodResult.success(jsonableResult);
});
}};
}
}