-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[interactive_media_ads] Adds internal wrapper for Android native `Com…
…panionAdSlot` and `CompanionAdSlot.ClickListener` (#8131)
- Loading branch information
1 parent
35f9c6e
commit 0be7cbe
Showing
12 changed files
with
1,168 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
...kotlin/dev/flutter/packages/interactive_media_ads/CompanionAdSlotClickListenerProxyApi.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// Copyright 2013 The Flutter Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
package dev.flutter.packages.interactive_media_ads | ||
|
||
import com.google.ads.interactivemedia.v3.api.CompanionAdSlot.ClickListener | ||
|
||
/** | ||
* ProxyApi implementation for [ClickListener]. | ||
* | ||
* <p>This class may handle instantiating native object instances that are attached to a Dart | ||
* instance or handle method calls on the associated native class or an instance of that class. | ||
*/ | ||
class CompanionAdSlotClickListenerProxyApi(override val pigeonRegistrar: ProxyApiRegistrar) : | ||
PigeonApiCompanionAdSlotClickListener(pigeonRegistrar) { | ||
internal class ClickListenerImpl(val api: CompanionAdSlotClickListenerProxyApi) : ClickListener { | ||
override fun onCompanionAdClick() { | ||
api.pigeonRegistrar.runOnMainThread { api.onCompanionAdClick(this) {} } | ||
} | ||
} | ||
|
||
override fun pigeon_defaultConstructor(): ClickListener { | ||
return ClickListenerImpl(this) | ||
} | ||
} |
50 changes: 50 additions & 0 deletions
50
...oid/src/main/kotlin/dev/flutter/packages/interactive_media_ads/CompanionAdSlotProxyApi.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
// Copyright 2013 The Flutter Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
package dev.flutter.packages.interactive_media_ads | ||
|
||
import android.view.ViewGroup | ||
import com.google.ads.interactivemedia.v3.api.CompanionAdSlot | ||
import com.google.ads.interactivemedia.v3.api.CompanionAdSlot.ClickListener | ||
|
||
/** | ||
* ProxyApi implementation for [CompanionAdSlot]. | ||
* | ||
* <p>This class may handle instantiating native object instances that are attached to a Dart | ||
* instance or handle method calls on the associated native class or an instance of that class. | ||
*/ | ||
class CompanionAdSlotProxyApi(override val pigeonRegistrar: ProxyApiRegistrar) : | ||
PigeonApiCompanionAdSlot(pigeonRegistrar) { | ||
override fun addClickListener(pigeon_instance: CompanionAdSlot, clickListener: ClickListener) { | ||
return pigeon_instance.addClickListener(clickListener) | ||
} | ||
|
||
override fun getContainer(pigeon_instance: CompanionAdSlot): ViewGroup { | ||
return pigeon_instance.container | ||
} | ||
|
||
override fun getHeight(pigeon_instance: CompanionAdSlot): Long { | ||
return pigeon_instance.height.toLong() | ||
} | ||
|
||
override fun getWidth(pigeon_instance: CompanionAdSlot): Long { | ||
return pigeon_instance.width.toLong() | ||
} | ||
|
||
override fun isFilled(pigeon_instance: CompanionAdSlot): Boolean { | ||
return pigeon_instance.isFilled | ||
} | ||
|
||
override fun removeClickListener(pigeon_instance: CompanionAdSlot, clickListener: ClickListener) { | ||
pigeon_instance.removeClickListener(clickListener) | ||
} | ||
|
||
override fun setContainer(pigeon_instance: CompanionAdSlot, container: ViewGroup) { | ||
pigeon_instance.container = container | ||
} | ||
|
||
override fun setSize(pigeon_instance: CompanionAdSlot, width: Long, height: Long) { | ||
pigeon_instance.setSize(width.toInt(), height.toInt()) | ||
} | ||
} |
Oops, something went wrong.