admin
2022-03-12 222df7b655c51992580b832f5e06c6772d27d9d6
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
package com.demo.library_flutter.nativeview;
 
 
import android.content.Context;
 
import java.util.Map;
 
import io.flutter.plugin.common.BinaryMessenger;
import io.flutter.plugin.common.MessageCodec;
import io.flutter.plugin.platform.PlatformView;
import io.flutter.plugin.platform.PlatformViewFactory;
 
public class GDTExpressNativeViewFactory extends PlatformViewFactory {
 
 
    private BinaryMessenger binaryMessenger;
 
    /**
     * @param createArgsCodec the codec used to decode the args parameter of {@link #create}.
     */
    public GDTExpressNativeViewFactory(BinaryMessenger binaryMessenger, MessageCodec<Object> createArgsCodec) {
        super(createArgsCodec);
        this.binaryMessenger = binaryMessenger;
    }
 
    @Override
    public PlatformView create(Context context, int viewId, Object args) {
        //参数
        Map params = (Map) args;
        GDTExpressNativeView view = new GDTExpressNativeView(viewId, params, binaryMessenger);
        return view;
    }
}