diff --git a/app/src/main/kotlin/jackall/moncalc/service/MainService.kt b/app/src/main/kotlin/jackall/moncalc/service/MainService.kt index 0044248..5665904 100644 --- a/app/src/main/kotlin/jackall/moncalc/service/MainService.kt +++ b/app/src/main/kotlin/jackall/moncalc/service/MainService.kt @@ -11,10 +11,6 @@ import android.os.IBinder import android.support.v4.app.NotificationCompat import android.view.* -import com.google.android.gms.ads.AdRequest -import com.google.android.gms.ads.AdSize -import com.google.android.gms.ads.AdView -import com.google.android.gms.ads.MobileAds import jackall.moncalc.Const import jackall.moncalc.R import jackall.moncalc.activity.MainActivity @@ -24,12 +20,12 @@ import jackall.moncalc.contract.MainServiceContract import jackall.moncalc.databinding.RegistOverlayBinding import jackall.moncalc.db.MonstDataRealmHelper +import jackall.moncalc.utils.AdUtil import jackall.moncalc.utils.MySharedPref import jackall.moncalc.viewmodel.OverlayRegistViewModel import jackall.moncalc.viewmodel.OverlayViewModel import jackall.moncalc.vo.Temple import kotlinx.android.synthetic.main.move_overlay.view.* -import kotlinx.android.synthetic.main.regist_overlay.view.* /** @@ -134,16 +130,6 @@ registBinding.templeSpinner.adapter = templeSpinnerAdapter } - fun showOverlayBannerAd() { - MobileAds.initialize(this) - val adBannerView = AdView(this) - adBannerView.adSize = AdSize.BANNER - adBannerView.adUnitId = Const.overlayBannerUnitId - registBinding.root.overlayBannerLayout.addView(adBannerView) - val adBannerRequest = AdRequest.Builder().build() - adBannerView.loadAd(adBannerRequest) - } - override fun showMoveView() { moveViewParams?.x = mySharedPref.getValue(PreferenceKeys.VIEWX, Int::class.java, 0) as Int moveViewParams?.y = mySharedPref.getValue(PreferenceKeys.VIEWY, Int::class.java, 0) as Int @@ -156,7 +142,7 @@ } override fun showRegistView() { - showOverlayBannerAd() + AdUtil.startBannerAd(this, registBinding.overlayBannerLayout, Const.overlayBannerUnitId) if (moveOverlayView.isShown) { windowManager.removeView(moveOverlayView) }