Skip to content

Instantly share code, notes, and snippets.

View hoanghiephui's full-sized avatar
🤗

Hoang Hiep hoanghiephui

🤗
View GitHub Profile
@hoanghiephui
hoanghiephui / native_banner_ad_fan.xml
Created March 31, 2021 12:52
native_banner_ad_fan
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/linearLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?android:windowBackground">
<RelativeLayout
@hoanghiephui
hoanghiephui / native_ad_fan_list_item.xml
Created March 31, 2021 12:51
native_ad_fan_list_item
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/native_outer_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?android:windowBackground"
android:padding="10dp"
android:textDirection="locale">
@hoanghiephui
hoanghiephui / native_banner_ad_mopub.xml
Created March 31, 2021 12:51
native_banner_ad_mopub
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/native_icon_image"
android:layout_width="80dp"
@hoanghiephui
hoanghiephui / native_ad_mopub_list_item.xml
Created March 31, 2021 12:50
native_ad_mopub_list_item
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/native_outer_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?android:windowBackground"
android:padding="10dp"
android:textDirection="locale">
@hoanghiephui
hoanghiephui / AdFullLoader.kt
Created March 31, 2021 08:10
Mediation Mopub Interstitial
class AdFullLoader : MoPubInterstitial.InterstitialAdListener, InterstitialAdListener {
private var interstitialAd: InterstitialAd? = null
private var interstitialAdMoPub: MoPubInterstitial? = null
fun loadAds(
activity: Activity,
adUnitId: String,
isUseMediation: Boolean
) {
if (isUseMediation) {
if (interstitialAdMoPub == null) {
@hoanghiephui
hoanghiephui / AdLoader.kt
Last active March 31, 2021 12:53
Mediation Mopub Native
class AdLoader {
/**
* Call this method to load Native ad
* @param context : Activity Context
* @param customAdListener : Custom Ad Listener to get - ad loaded, clicked, impression, failed callback
* @param adType : Custom Class for different type of Ad Formats - Banner, Native, Interstitial
* @param adapterHelper : AdapterHelper from MoPub
* @param moPubNativeEventListener : MoPub specific class to track impression & click
*/