-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
*.iml | ||
.gradle | ||
/local.properties | ||
/.idea/caches | ||
/.idea/libraries | ||
/.idea/modules.xml | ||
/.idea/workspace.xml | ||
/.idea/navEditor.xml | ||
/.idea/assetWizardSettings.xml | ||
.DS_Store | ||
/build | ||
/captures | ||
.externalNativeBuild | ||
.cxx | ||
local.properties |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/build |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
plugins { | ||
id 'com.android.application' | ||
id 'org.jetbrains.kotlin.android' | ||
id 'com.google.gms.google-services' | ||
} | ||
|
||
android { | ||
namespace 'com.example.admoballadsimplementation' | ||
compileSdk 34 | ||
|
||
defaultConfig { | ||
applicationId "com.example.admoballadsimplementation" | ||
minSdk 24 | ||
targetSdk 34 | ||
versionCode 1 | ||
versionName "1.0" | ||
|
||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" | ||
} | ||
|
||
buildTypes { | ||
release { | ||
minifyEnabled false | ||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' | ||
} | ||
} | ||
compileOptions { | ||
sourceCompatibility JavaVersion.VERSION_17 | ||
targetCompatibility JavaVersion.VERSION_17 | ||
} | ||
kotlinOptions { | ||
jvmTarget = '17' | ||
} | ||
buildFeatures { | ||
viewBinding = true | ||
} | ||
} | ||
|
||
dependencies { | ||
|
||
implementation 'androidx.core:core-ktx:1.12.0' | ||
implementation 'androidx.appcompat:appcompat:1.6.1' | ||
implementation 'com.google.android.material:material:1.10.0' | ||
implementation 'androidx.constraintlayout:constraintlayout:2.1.4' | ||
testImplementation 'junit:junit:4.13.2' | ||
androidTestImplementation 'androidx.test.ext:junit:1.1.5' | ||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1' | ||
|
||
//Navigation | ||
implementation ("androidx.navigation:navigation-fragment-ktx:2.7.4") | ||
implementation ("androidx.navigation:navigation-ui-ktx:2.7.4") | ||
|
||
//adMob Dependency | ||
implementation ("com.google.android.gms:play-services-ads:22.4.0") | ||
|
||
//SDP | ||
implementation ("com.intuit.sdp:sdp-android:1.1.0") | ||
|
||
//SSP | ||
implementation ("com.intuit.ssp:ssp-android:1.1.0") | ||
|
||
|
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
{ | ||
"project_info": { | ||
"project_number": "196483348977", | ||
"project_id": "dummy-1873e", | ||
"storage_bucket": "dummy-1873e.appspot.com" | ||
}, | ||
"client": [ | ||
{ | ||
"client_info": { | ||
"mobilesdk_app_id": "1:196483348977:android:161a1117afbd14e6f0ec50", | ||
"android_client_info": { | ||
"package_name": "com.example.admoballadsimplementation" | ||
} | ||
}, | ||
"oauth_client": [], | ||
"api_key": [ | ||
{ | ||
"current_key": "AIzaSyD8tooKbip5afJtKqAanJ58NMu_g6jEoT8" | ||
} | ||
], | ||
"services": { | ||
"appinvite_service": { | ||
"other_platform_oauth_client": [] | ||
} | ||
} | ||
} | ||
], | ||
"configuration_version": "1" | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Add project specific ProGuard rules here. | ||
# You can control the set of applied configuration files using the | ||
# proguardFiles setting in build.gradle. | ||
# | ||
# For more details, see | ||
# http://developer.android.com/guide/developing/tools/proguard.html | ||
|
||
# If your project uses WebView with JS, uncomment the following | ||
# and specify the fully qualified class name to the JavaScript interface | ||
# class: | ||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview { | ||
# public *; | ||
#} | ||
|
||
# Uncomment this to preserve the line number information for | ||
# debugging stack traces. | ||
#-keepattributes SourceFile,LineNumberTable | ||
|
||
# If you keep the line number information, uncomment this to | ||
# hide the original source file name. | ||
#-renamesourcefileattribute SourceFile |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:tools="http://schemas.android.com/tools"> | ||
|
||
<uses-permission android:name="android.permission.INTERNET"/> | ||
<uses-permission android:name="com.google.android.gms.permission.AD_ID" /> | ||
|
||
<application | ||
android:allowBackup="true" | ||
android:dataExtractionRules="@xml/data_extraction_rules" | ||
android:fullBackupContent="@xml/backup_rules" | ||
android:icon="@mipmap/ic_launcher" | ||
android:name=".application.AdsApplication" | ||
android:label="@string/app_name" | ||
android:roundIcon="@mipmap/ic_launcher_round" | ||
android:supportsRtl="true" | ||
android:theme="@style/Theme.AdMobAllAdsImplementation" | ||
tools:targetApi="31"> | ||
<activity | ||
android:name=".ui.activities.MainActivity" | ||
android:exported="true"> | ||
<intent-filter> | ||
<action android:name="android.intent.action.MAIN" /> | ||
|
||
<category android:name="android.intent.category.LAUNCHER" /> | ||
</intent-filter> | ||
</activity> | ||
|
||
<meta-data | ||
android:name="com.google.android.gms.ads.APPLICATION_ID" | ||
android:value="@string/app_id"/> | ||
</application> | ||
|
||
</manifest> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
package com.example.admoballadsimplementation.adapters | ||
|
||
import android.view.LayoutInflater | ||
import android.view.ViewGroup | ||
import androidx.recyclerview.widget.RecyclerView | ||
import com.example.admoballadsimplementation.databinding.RvAdmobBinding | ||
import com.example.admoballadsimplementation.models.AdModel | ||
|
||
class AdsAdapter : | ||
RecyclerView.Adapter<AdsAdapter.AdsViewHolder>() { | ||
private var listener: OnClickListener? = null | ||
private var mainList: List<AdModel> = ArrayList() | ||
override fun onCreateViewHolder(parent: ViewGroup , viewType: Int): AdsViewHolder { | ||
val binding = RvAdmobBinding.inflate(LayoutInflater.from(parent.context) , parent , false) | ||
return AdsViewHolder(binding) | ||
} | ||
|
||
override fun onBindViewHolder(holder: AdsViewHolder, position: Int) { | ||
holder.bind(mainList[position]) | ||
holder.cdMain.setOnClickListener { listener?.onItemClick(position) } | ||
} | ||
|
||
override fun getItemCount(): Int { | ||
return mainList.size | ||
} | ||
|
||
inner class AdsViewHolder(private val binding: RvAdmobBinding) : | ||
RecyclerView.ViewHolder(binding.root) { | ||
val cdMain = binding.cdMain | ||
|
||
|
||
fun bind(item: AdModel) { | ||
binding.adType.text = item.name | ||
} | ||
} | ||
|
||
interface OnClickListener { | ||
fun onItemClick(position: Int) | ||
} | ||
|
||
fun setOnClickListener(listener: OnClickListener) { | ||
this.listener = listener | ||
} | ||
|
||
fun submitList(list: List<AdModel>) | ||
{ | ||
this.mainList = list | ||
notifyDataSetChanged() | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package com.example.admoballadsimplementation.application | ||
|
||
import android.app.Application | ||
import com.google.android.gms.ads.MobileAds | ||
|
||
|
||
class AdsApplication: Application() { | ||
override fun onCreate() { | ||
super.onCreate() | ||
MobileAds.initialize( | ||
this | ||
) { } | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package com.example.admoballadsimplementation.data | ||
|
||
import androidx.lifecycle.MutableLiveData | ||
import androidx.lifecycle.ViewModel | ||
import com.example.admoballadsimplementation.models.AdModel | ||
|
||
|
||
open class AdsViewModel : ViewModel() { | ||
|
||
fun returnArrayList(): MutableLiveData<ArrayList<AdModel>?> { | ||
val list = ArrayList<AdModel>() | ||
list.add(AdModel("Rewarded")) | ||
list.add(AdModel("Small Native")) | ||
list.add(AdModel("Large Native")) | ||
list.add(AdModel("Banner")) | ||
list.add(AdModel("Interstitial")) | ||
|
||
val arrayList: MutableLiveData<ArrayList<AdModel>?> = MutableLiveData<ArrayList<AdModel>?>() | ||
arrayList.value = list | ||
return arrayList | ||
} | ||
|
||
|
||
|
||
|
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package com.example.admoballadsimplementation.listeners | ||
|
||
import android.app.Activity | ||
import android.widget.FrameLayout | ||
import com.google.android.gms.ads.AdSize | ||
import com.google.android.gms.ads.AdView | ||
import com.google.android.gms.ads.nativead.NativeAd | ||
import com.google.android.gms.ads.nativead.NativeAdView | ||
|
||
interface AllAdsInterface { | ||
fun setBannerAds(layout: FrameLayout , adView: AdView , context: Activity) | ||
fun getAdSize(activity: Activity): AdSize? | ||
fun loadBanner(activity: Activity , adView: AdView) | ||
fun loadRewardedAds(context: Activity) | ||
fun showRewardAds(activity: Activity) | ||
fun loadInterstitialAd(context: Activity) | ||
fun showInterstitialAd(context: Activity) | ||
fun populateNativeAdView(nativeAd: NativeAd , adView: NativeAdView) | ||
fun showSmallNativeAd(activity: Activity? , frameLayout: FrameLayout) | ||
fun showLargeNativeAd(activity: Activity? , frameLayout: FrameLayout) | ||
fun showSmallNativeAdDialog(activity: Activity) | ||
fun showLargeNativeAdDialog(activity: Activity) | ||
|
||
fun showToast(context: Activity, message: String) | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
package com.example.admoballadsimplementation.models | ||
|
||
data class AdModel(val name: String) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package com.example.admoballadsimplementation.ui.activities | ||
|
||
import androidx.appcompat.app.AppCompatActivity | ||
import android.os.Bundle | ||
import com.example.admoballadsimplementation.R | ||
|
||
class MainActivity : AppCompatActivity() { | ||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
setContentView(R.layout.activity_main) | ||
} | ||
} |