1
1
package io .invertase .firebase .admob ;
2
2
3
- import android .support .annotation .Nullable ;
4
-
5
3
import com .facebook .react .bridge .Arguments ;
6
4
import com .facebook .react .bridge .ReadableMap ;
7
5
import com .facebook .react .bridge .WritableMap ;
21
19
22
20
import java .util .Map ;
23
21
22
+ import javax .annotation .Nullable ;
23
+
24
24
public class RNFirebaseAdMobNativeExpress extends SimpleViewManager <ReactViewGroup > {
25
25
26
- public static final String REACT_CLASS = "RNFirebaseAdMobNativeExpress" ;
27
- public static final String BANNER_EVENT = "onBannerEvent" ;
26
+ private static final String REACT_CLASS = "RNFirebaseAdMobNativeExpress" ;
27
+ private static final String BANNER_EVENT = "onBannerEvent" ;
28
28
private ThemedReactContext context ;
29
29
private ReactViewGroup viewGroup ;
30
30
private RCTEventEmitter emitter ;
@@ -59,7 +59,7 @@ public ReactViewGroup createViewInstance(ThemedReactContext themedReactContext)
59
59
return viewGroup ;
60
60
}
61
61
62
- NativeExpressAdView getAdView () {
62
+ private NativeExpressAdView getAdView () {
63
63
return (NativeExpressAdView ) viewGroup .getChildAt (0 );
64
64
}
65
65
@@ -157,7 +157,7 @@ public void setSize(ReactViewGroup view, String value) {
157
157
/**
158
158
* Loads a new ad into a viewGroup
159
159
*/
160
- void requestAd () {
160
+ private void requestAd () {
161
161
if (size == null || unitId == null || request == null || videoOptions == null ) {
162
162
return ;
163
163
}
@@ -179,7 +179,7 @@ void requestAd() {
179
179
/**
180
180
* Listen to Ad events
181
181
*/
182
- void setAdListener () {
182
+ private void setAdListener () {
183
183
final NativeExpressAdView adView = getAdView ();
184
184
185
185
adView .setAdListener (new AdListener () {
@@ -263,15 +263,14 @@ public void onAdLeftApplication() {
263
263
* @param type
264
264
* @param payload
265
265
*/
266
- void sendEvent (String type , final @ Nullable WritableMap payload ) {
266
+ private void sendEvent (String type , final @ Nullable WritableMap payload ) {
267
267
WritableMap event = Arguments .createMap ();
268
268
event .putString ("type" , type );
269
269
270
270
if (payload != null ) {
271
271
event .putMap ("payload" , payload );
272
272
}
273
273
274
- int id = viewGroup .getId ();
275
274
emitter .receiveEvent (viewGroup .getId (), BANNER_EVENT , event );
276
275
}
277
276
0 commit comments