@@ -22,17 +22,23 @@ public class AceEditor extends WebView
22
22
Context context ;
23
23
private PopupWindow pw ;
24
24
private View popupView ;
25
+
25
26
private ResultReceivedListener received ;
27
+ private OnLoadedEditorListener onLoadedEditorListener ;
28
+
26
29
private LayoutInflater inflater ;
27
30
private float x ;
28
31
private float y ;
29
32
private boolean actAfterSelect ;
30
33
private int requestedValue ;
31
34
35
+ private boolean loadedUI ;
36
+
32
37
@ SuppressLint ("SetJavaScriptEnabled" )
33
38
public AceEditor (Context context )
34
39
{
35
40
super (context );
41
+ loadedUI = false ;
36
42
this .context = context ;
37
43
initialize ();
38
44
}
@@ -42,6 +48,7 @@ public AceEditor(Context context)
42
48
public AceEditor (Context context , AttributeSet attrs )
43
49
{
44
50
super (context , attrs );
51
+ loadedUI = false ;
45
52
this .context = context ;
46
53
initialize ();
47
54
}
@@ -60,6 +67,13 @@ public void onReceived(String text, int FLAG_VALUE) {
60
67
}
61
68
});
62
69
70
+ setOnLoadedEditorListener (new OnLoadedEditorListener () {
71
+ @ Override
72
+ public void onCreate () {
73
+
74
+ }
75
+ });
76
+
63
77
setWebChromeClient (new WebChromeClient () {
64
78
@ Override
65
79
public boolean onJsAlert (WebView view , String url , String message , JsResult result ) {
@@ -72,7 +86,11 @@ public boolean onJsAlert(WebView view, String url, String message, JsResult resu
72
86
setWebViewClient (new WebViewClient () {
73
87
@ Override
74
88
public void onPageFinished (WebView view , String url ) {
75
-
89
+ if (!loadedUI )
90
+ {
91
+ loadedUI = true ;
92
+ onLoadedEditorListener .onCreate ();
93
+ }
76
94
}
77
95
78
96
@ Override
@@ -231,6 +249,11 @@ public void setResultReceivedListener(ResultReceivedListener listener)
231
249
this .received = listener ;
232
250
}
233
251
252
+ public void setOnLoadedEditorListener (OnLoadedEditorListener listener )
253
+ {
254
+ this .onLoadedEditorListener = listener ;
255
+ }
256
+
234
257
public void requestText ()
235
258
{
236
259
requestedValue = Request .VALUE_TEXT ;
0 commit comments