// Path: packages/google_mobile_ads/android/src/main/java/io/flutter/plugins/googlemobileads/FlutterAd.java
// abstract static class FlutterOverlayAd extends FlutterAd {
//   abstract void show();
// 
//   abstract void setImmersiveMode(boolean immersiveModeEnabled);
// 
//   FlutterOverlayAd(int adId) {
//     super(adId);
//   }
// }


import android.content.Context;
import android.util.Log;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.VisibleForTesting;
import com.google.android.gms.ads.AdSize;
import com.google.android.gms.ads.MobileAds;
import com.google.android.gms.ads.RequestConfiguration;
import com.google.android.gms.ads.initialization.InitializationStatus;
import com.google.android.gms.ads.initialization.OnInitializationCompleteListener;
import com.google.android.gms.ads.nativead.NativeAd;
import com.google.android.gms.ads.nativead.NativeAdView;
import io.flutter.embedding.engine.FlutterEngine;
import io.flutter.embedding.engine.plugins.FlutterPlugin;
import io.flutter.embedding.engine.plugins.activity.ActivityAware;
import io.flutter.embedding.engine.plugins.activity.ActivityPluginBinding;
import io.flutter.plugin.common.MethodCall;
import io.flutter.plugin.common.MethodChannel;
import io.flutter.plugin.common.MethodChannel.MethodCallHandler;
import io.flutter.plugin.common.MethodChannel.Result;
import io.flutter.plugin.common.StandardMethodCodec;
import io.flutter.plugins.googlemobileads.FlutterAd.FlutterOverlayAd;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
      case "showAdWithoutView":
        final boolean adShown = instanceManager.showAdWithId(call.<Integer>argument("adId"));
        if (!adShown) {
          result.error("AdShowError", "Ad failed to show.", null);
          break;
        }
        result.success(null);
        break;
      case "AdSize#getAnchoredAdaptiveBannerAdSize":
        final FlutterAdSize.AnchoredAdaptiveBannerAdSize size =
            new FlutterAdSize.AnchoredAdaptiveBannerAdSize(
                context,
                new FlutterAdSize.AdSizeFactory(),
                call.<String>argument("orientation"),
                call.<Integer>argument("width"));
        if (AdSize.INVALID.equals(size.size)) {
          result.success(null);
        } else {
          result.success(size.height);
        }
        break;
      case "MobileAds#setAppMuted":
        flutterMobileAds.setAppMuted(call.<Boolean>argument("muted"));
        result.success(null);
        break;
      case "MobileAds#setAppVolume":
        flutterMobileAds.setAppVolume(call.<Double>argument("volume"));
        result.success(null);
        break;
      case "setImmersiveMode":
// Path: packages/google_mobile_ads/android/src/main/java/io/flutter/plugins/googlemobileads/FlutterAd.java
// abstract static class FlutterOverlayAd extends FlutterAd {
//   abstract void show();
// 
//   abstract void setImmersiveMode(boolean immersiveModeEnabled);
// 
//   FlutterOverlayAd(int adId) {
//     super(adId);
//   }
// }


// Path: packages/google_mobile_ads/android/src/main/java/io/flutter/plugins/googlemobileads/GoogleMobileAdsPlugin.java
import android.content.Context;
import android.util.Log;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.VisibleForTesting;
import com.google.android.gms.ads.AdSize;
import com.google.android.gms.ads.MobileAds;
import com.google.android.gms.ads.RequestConfiguration;
import com.google.android.gms.ads.initialization.InitializationStatus;
import com.google.android.gms.ads.initialization.OnInitializationCompleteListener;
import com.google.android.gms.ads.nativead.NativeAd;
import com.google.android.gms.ads.nativead.NativeAdView;
import io.flutter.embedding.engine.FlutterEngine;
import io.flutter.embedding.engine.plugins.FlutterPlugin;
import io.flutter.embedding.engine.plugins.activity.ActivityAware;
import io.flutter.embedding.engine.plugins.activity.ActivityPluginBinding;
import io.flutter.plugin.common.MethodCall;
import io.flutter.plugin.common.MethodChannel;
import io.flutter.plugin.common.MethodChannel.MethodCallHandler;
import io.flutter.plugin.common.MethodChannel.Result;
import io.flutter.plugin.common.StandardMethodCodec;
import io.flutter.plugins.googlemobileads.FlutterAd.FlutterOverlayAd;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

      case "showAdWithoutView":
        final boolean adShown = instanceManager.showAdWithId(call.<Integer>argument("adId"));
        if (!adShown) {
          result.error("AdShowError", "Ad failed to show.", null);
          break;
        }
        result.success(null);
        break;
      case "AdSize#getAnchoredAdaptiveBannerAdSize":
        final FlutterAdSize.AnchoredAdaptiveBannerAdSize size =
            new FlutterAdSize.AnchoredAdaptiveBannerAdSize(
                context,
                new FlutterAdSize.AdSizeFactory(),
                call.<String>argument("orientation"),
                call.<Integer>argument("width"));
        if (AdSize.INVALID.equals(size.size)) {
          result.success(null);
        } else {
          result.success(size.height);
        }
        break;
      case "MobileAds#setAppMuted":
        flutterMobileAds.setAppMuted(call.<Boolean>argument("muted"));
        result.success(null);
        break;
      case "MobileAds#setAppVolume":
        flutterMobileAds.setAppVolume(call.<Double>argument("volume"));
        result.success(null);
        break;
      case "setImmersiveMode":
        ((FlutterOverlayAd) instanceManager.adForId(call.<Integer>argument("adId")))