// Path: android/AdMob/app/src/main/java/com/pozirk/ads/admob/manager/AdTypesSupportedEnum.java
// public enum AdTypesSupportedEnum {
//     BANNER("BANNER"),
//     INTERSTITIAL("INTERSTITIAL"),
//     REWARDED("REWARDED");
// 
//     private String type;
// 
//     AdTypesSupportedEnum(String type) {
//         this.type = type;
//     }
// 
//     public String getType() {
//         return type;
//     }
// }
// 
// Path: android/AdMob/app/src/main/java/com/pozirk/ads/admob/context/ExtensionContext.java
// public class ExtensionContext extends FREContext
// {
// 	private static AdMobManager _adMobMan;
// 
// 	public void dispose()
// 	{
// 		_adMobMan.dispose();
// 		_adMobMan = null;
// 	}
// 
// 	public Map<String, FREFunction> getFunctions()
// 	{
// 		Map<String, FREFunction> functionMap = new HashMap<String, FREFunction>();
// 
// 		functionMap.put("init", new InitFunction());
// 		functionMap.put("show", new ShowFunction());
// 		functionMap.put("hide", new HideFunction());
// 		functionMap.put("cacheInterstitial", new CacheInterstitialFunction());
// 		functionMap.put("showInterstitial", new ShowInterstitialFunction());
// 		functionMap.put("cacheRewarded", new CacheRewardedFunction());
// 		functionMap.put("showRewarded", new ShowRewardedFunction());
// 
// 		functionMap.put("dispose", new DisposeFunction());
// 		functionMap.put("setVolume", new SetVolumeFunction());
// 
// 		return functionMap;
// 	}
// 
// 	public AdMobManager getAdMobMan() {
// 		if(_adMobMan==null) {
// 			_adMobMan = new AdMobManager(this);
// 		}
// 		return _adMobMan;
// 	}
// }


import com.google.android.gms.ads.AdListener;
import com.google.android.gms.ads.AdRequest;
import com.pozirk.ads.admob.manager.AdTypesSupportedEnum;
import com.pozirk.ads.admob.context.ExtensionContext;
/* Copyright (c) 2014 Pozirk Games
 * http://www.pozirk.com
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.pozirk.ads.admob.listener;


public class AdMobListener extends AdListener
{
	protected ExtensionContext _ctx ;
	protected AdTypesSupportedEnum _who;
	
	public AdMobListener(ExtensionContext ctx, AdTypesSupportedEnum type)
	{
		_ctx = ctx;
		_who = type;
	}
	
    @Override
    public void onAdLoaded()
    {
        if(_who == AdTypesSupportedEnum.BANNER)
        {
            _ctx.getAdMobMan().bannerOnTop();
            _ctx.dispatchStatusEventAsync(_who.getType()+"_SHOW_OK", "");
        }
        else {
            _ctx.dispatchStatusEventAsync(_who.getType()+"_CACHE_OK", "");
        }

    }

   @Override
// Path: android/AdMob/app/src/main/java/com/pozirk/ads/admob/manager/AdTypesSupportedEnum.java
// public enum AdTypesSupportedEnum {
//     BANNER("BANNER"),
//     INTERSTITIAL("INTERSTITIAL"),
//     REWARDED("REWARDED");
// 
//     private String type;
// 
//     AdTypesSupportedEnum(String type) {
//         this.type = type;
//     }
// 
//     public String getType() {
//         return type;
//     }
// }
// 
// Path: android/AdMob/app/src/main/java/com/pozirk/ads/admob/context/ExtensionContext.java
// public class ExtensionContext extends FREContext
// {
// 	private static AdMobManager _adMobMan;
// 
// 	public void dispose()
// 	{
// 		_adMobMan.dispose();
// 		_adMobMan = null;
// 	}
// 
// 	public Map<String, FREFunction> getFunctions()
// 	{
// 		Map<String, FREFunction> functionMap = new HashMap<String, FREFunction>();
// 
// 		functionMap.put("init", new InitFunction());
// 		functionMap.put("show", new ShowFunction());
// 		functionMap.put("hide", new HideFunction());
// 		functionMap.put("cacheInterstitial", new CacheInterstitialFunction());
// 		functionMap.put("showInterstitial", new ShowInterstitialFunction());
// 		functionMap.put("cacheRewarded", new CacheRewardedFunction());
// 		functionMap.put("showRewarded", new ShowRewardedFunction());
// 
// 		functionMap.put("dispose", new DisposeFunction());
// 		functionMap.put("setVolume", new SetVolumeFunction());
// 
// 		return functionMap;
// 	}
// 
// 	public AdMobManager getAdMobMan() {
// 		if(_adMobMan==null) {
// 			_adMobMan = new AdMobManager(this);
// 		}
// 		return _adMobMan;
// 	}
// }


// Path: android/AdMob/app/src/main/java/com/pozirk/ads/admob/listener/AdMobListener.java
import com.google.android.gms.ads.AdListener;
import com.google.android.gms.ads.AdRequest;
import com.pozirk.ads.admob.manager.AdTypesSupportedEnum;
import com.pozirk.ads.admob.context.ExtensionContext;

/* Copyright (c) 2014 Pozirk Games
 * http://www.pozirk.com
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.pozirk.ads.admob.listener;


public class AdMobListener extends AdListener
{
	protected ExtensionContext _ctx ;
	protected AdTypesSupportedEnum _who;
	
	public AdMobListener(ExtensionContext ctx, AdTypesSupportedEnum type)
	{
		_ctx = ctx;
		_who = type;
	}
	
    @Override
    public void onAdLoaded()
    {
        if(_who == AdTypesSupportedEnum.BANNER)
        {
            _ctx.getAdMobMan().bannerOnTop();
            _ctx.dispatchStatusEventAsync(_who.getType()+"_SHOW_OK", "");
        }
        else {
            _ctx.dispatchStatusEventAsync(_who.getType()+"_CACHE_OK", "");
        }

    }

   @Override
   public void onAdFailedToLoad(int errorCode)