99public class Listener {
1010 @ WebViewExposed
1111 public static void sendReadyEvent (final String placementId , WebViewCallback callback ) {
12- if ( UnityAds . getListener () != null ) {
13- Utilities . runOnUiThread ( new Runnable () {
14- @ Override
15- public void run ( ) {
12+ Utilities . runOnUiThread ( new Runnable ( ) {
13+ @ Override
14+ public void run () {
15+ if ( UnityAds . getListener () != null ) {
1616 UnityAds .getListener ().onUnityAdsReady (placementId );
1717 }
18- });
19- }
18+ }
19+ });
20+
2021 callback .invoke ();
2122 }
2223
2324 @ WebViewExposed
2425 public static void sendStartEvent (final String placementId , WebViewCallback callback ) {
25- if ( UnityAds . getListener () != null ) {
26- Utilities . runOnUiThread ( new Runnable () {
27- @ Override
28- public void run ( ) {
26+ Utilities . runOnUiThread ( new Runnable ( ) {
27+ @ Override
28+ public void run () {
29+ if ( UnityAds . getListener () != null ) {
2930 UnityAds .getListener ().onUnityAdsStart (placementId );
3031 }
31- });
32- }
32+ }
33+ });
34+
3335 callback .invoke ();
3436 }
3537
3638 @ WebViewExposed
3739 public static void sendFinishEvent (final String placementId , final String result , WebViewCallback callback ) {
38- if ( UnityAds . getListener () != null ) {
39- Utilities . runOnUiThread ( new Runnable () {
40- @ Override
41- public void run ( ) {
40+ Utilities . runOnUiThread ( new Runnable ( ) {
41+ @ Override
42+ public void run () {
43+ if ( UnityAds . getListener () != null ) {
4244 UnityAds .getListener ().onUnityAdsFinish (placementId , UnityAds .FinishState .valueOf (result ));
4345 }
44- });
45- }
46+ }
47+ });
48+
4649 callback .invoke ();
4750 }
4851
4952 @ WebViewExposed
5053 public static void sendClickEvent (final String placementId , WebViewCallback callback ) {
51- if ( UnityAds . getListener () != null && UnityAds . getListener () instanceof IUnityAdsExtendedListener ) {
52- Utilities . runOnUiThread ( new Runnable () {
53- @ Override
54- public void run ( ) {
54+ Utilities . runOnUiThread ( new Runnable ( ) {
55+ @ Override
56+ public void run () {
57+ if ( UnityAds . getListener () != null && UnityAds . getListener () instanceof IUnityAdsExtendedListener ) {
5558 ((IUnityAdsExtendedListener )UnityAds .getListener ()).onUnityAdsClick (placementId );
5659 }
57- });
58- }
60+ }
61+ });
62+
5963 callback .invoke ();
6064 }
6165
6266 @ WebViewExposed
6367 public static void sendErrorEvent (final String error , final String message , WebViewCallback callback ) {
64- if ( UnityAds . getListener () != null ) {
65- Utilities . runOnUiThread ( new Runnable () {
66- @ Override
67- public void run ( ) {
68+ Utilities . runOnUiThread ( new Runnable ( ) {
69+ @ Override
70+ public void run () {
71+ if ( UnityAds . getListener () != null ) {
6872 UnityAds .getListener ().onUnityAdsError (UnityAds .UnityAdsError .valueOf (error ), message );
6973 }
70- });
71- }
74+ }
75+ });
76+
7277 callback .invoke ();
7378 }
7479}
0 commit comments