V1.1(2) IronSource
This commit is contained in:
parent
941c7103eb
commit
7ed0f72aab
@ -7,6 +7,8 @@ plugins {
|
|||||||
id("org.jetbrains.kotlin.android")
|
id("org.jetbrains.kotlin.android")
|
||||||
kotlin("kapt")
|
kotlin("kapt")
|
||||||
id ("kotlin-android")
|
id ("kotlin-android")
|
||||||
|
id("com.google.gms.google-services")
|
||||||
|
id("com.google.firebase.crashlytics")
|
||||||
}
|
}
|
||||||
|
|
||||||
val timestamp = SimpleDateFormat("MM_dd_HH_mm").format(Date())
|
val timestamp = SimpleDateFormat("MM_dd_HH_mm").format(Date())
|
||||||
@ -17,8 +19,8 @@ android {
|
|||||||
applicationId = "com.flowing.light.board"
|
applicationId = "com.flowing.light.board"
|
||||||
minSdk = 24
|
minSdk = 24
|
||||||
targetSdk = 36
|
targetSdk = 36
|
||||||
versionCode = 1
|
versionCode = 2
|
||||||
versionName = "1.0"
|
versionName = "1.1"
|
||||||
setProperty(
|
setProperty(
|
||||||
"archivesBaseName",
|
"archivesBaseName",
|
||||||
"FlowingLightBoard_V" + versionName + "(${versionCode})_$timestamp"
|
"FlowingLightBoard_V" + versionName + "(${versionCode})_$timestamp"
|
||||||
@ -82,5 +84,45 @@ dependencies {
|
|||||||
implementation("com.google.code.gson:gson:2.10.1")
|
implementation("com.google.code.gson:gson:2.10.1")
|
||||||
|
|
||||||
|
|
||||||
|
implementation(files("libs/UpLoadLibrary_12_03_15_13-release.aar"))
|
||||||
|
implementation("com.squareup.okhttp3:logging-interceptor:4.12.0")
|
||||||
|
|
||||||
|
implementation(platform("com.google.firebase:firebase-bom:34.6.0"))
|
||||||
|
implementation("com.google.firebase:firebase-crashlytics")
|
||||||
|
implementation("com.google.firebase:firebase-analytics")
|
||||||
|
implementation("com.google.firebase:firebase-config")
|
||||||
|
|
||||||
|
|
||||||
|
//---------------------------
|
||||||
|
implementation("com.unity3d.ads-mediation:mediation-sdk:9.2.0")
|
||||||
|
// Add BIGO Ads Network
|
||||||
|
implementation("com.unity3d.ads-mediation:bigo-adapter:5.2.0")
|
||||||
|
implementation("com.bigossp:bigo-ads:5.6.2")
|
||||||
|
// Add Chartboost Network
|
||||||
|
implementation("com.unity3d.ads-mediation:chartboost-adapter:5.2.0")
|
||||||
|
// implementation("com.chartboost:chartboost-sdk:9.10.2")
|
||||||
|
|
||||||
|
implementation("com.chartboost:chartboost-sdk:9.8.3")
|
||||||
|
// Add DT Exchange Network
|
||||||
|
implementation("com.unity3d.ads-mediation:fyber-adapter:5.2.0")
|
||||||
|
implementation("com.fyber:marketplace-sdk:8.4.1")
|
||||||
|
// Add InMobi Network
|
||||||
|
implementation("com.unity3d.ads-mediation:inmobi-adapter:5.3.0")
|
||||||
|
implementation("com.inmobi.monetization:inmobi-ads-kotlin:11.1.0")
|
||||||
|
// Add Liftoff Monetize Network
|
||||||
|
implementation("com.unity3d.ads-mediation:vungle-adapter:5.2.0")
|
||||||
|
implementation("com.vungle:vungle-ads:7.6.1")
|
||||||
|
// Add Mintegral Network
|
||||||
|
implementation("com.unity3d.ads-mediation:mintegral-adapter:5.3.0")
|
||||||
|
implementation("com.mbridge.msdk.oversea:mbridge_android_sdk:17.0.31")
|
||||||
|
// Add Moloco Network
|
||||||
|
implementation("com.unity3d.ads-mediation:moloco-adapter:5.5.0")
|
||||||
|
implementation("com.moloco.sdk:moloco-sdk:4.3.1")
|
||||||
|
// Add Pangle Network
|
||||||
|
implementation("com.unity3d.ads-mediation:pangle-adapter:5.4.0")
|
||||||
|
implementation("com.pangle.global:pag-sdk:7.8.0.7")
|
||||||
|
// Add Unity Ads Network
|
||||||
|
implementation("com.unity3d.ads-mediation:unityads-adapter:5.3.0")
|
||||||
|
implementation("com.unity3d.ads:unity-ads:4.16.4")
|
||||||
|
|
||||||
}
|
}
|
||||||
29
app/google-services.json
Normal file
29
app/google-services.json
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
{
|
||||||
|
"project_info": {
|
||||||
|
"project_number": "136251464858",
|
||||||
|
"project_id": "flowinglightboard",
|
||||||
|
"storage_bucket": "flowinglightboard.firebasestorage.app"
|
||||||
|
},
|
||||||
|
"client": [
|
||||||
|
{
|
||||||
|
"client_info": {
|
||||||
|
"mobilesdk_app_id": "1:136251464858:android:e76767744c83d903559323",
|
||||||
|
"android_client_info": {
|
||||||
|
"package_name": "com.flowing.light.board"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"oauth_client": [],
|
||||||
|
"api_key": [
|
||||||
|
{
|
||||||
|
"current_key": "AIzaSyAcAWxvs0KLAzkVyFBMh6JMDs0zTf6Ah3o"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"services": {
|
||||||
|
"appinvite_service": {
|
||||||
|
"other_platform_oauth_client": []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"configuration_version": "1"
|
||||||
|
}
|
||||||
BIN
app/libs/UpLoadLibrary_12_03_15_13-release.aar
Normal file
BIN
app/libs/UpLoadLibrary_12_03_15_13-release.aar
Normal file
Binary file not shown.
15
app/proguard-rules.pro
vendored
15
app/proguard-rules.pro
vendored
@ -54,3 +54,18 @@
|
|||||||
-keep class com.flowing.light.board.tools.KeyboardData$Detail { *; }
|
-keep class com.flowing.light.board.tools.KeyboardData$Detail { *; }
|
||||||
-keep class com.flowing.light.board.tools.KeyboardData$ThemeContent { *; }
|
-keep class com.flowing.light.board.tools.KeyboardData$ThemeContent { *; }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
-keepclassmembers class com.ironsource.sdk.controller.IronSourceWebView$JSInterface {
|
||||||
|
public *;
|
||||||
|
}
|
||||||
|
-keepclassmembers class * implements android.os.Parcelable {
|
||||||
|
public static final android.os.Parcelable$Creator *;
|
||||||
|
}
|
||||||
|
-keep public class com.google.android.gms.ads.** {
|
||||||
|
public *;
|
||||||
|
}
|
||||||
|
-keep class com.ironsource.adapters.** { *;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -1,9 +1,10 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:tools="http://schemas.android.com/tools">
|
xmlns:tools="http://schemas.android.com/tools">
|
||||||
|
<uses-permission android:name="com.google.android.gms.permission.AD_ID"/>
|
||||||
<uses-permission android:name="android.permission.INTERNET" />
|
<uses-permission android:name="android.permission.INTERNET" />
|
||||||
|
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||||
|
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
|
||||||
<application
|
<application
|
||||||
android:name=".FlowingLightBoard"
|
android:name=".FlowingLightBoard"
|
||||||
android:allowBackup="true"
|
android:allowBackup="true"
|
||||||
@ -11,11 +12,10 @@
|
|||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
android:roundIcon="@mipmap/logo"
|
android:roundIcon="@mipmap/logo"
|
||||||
android:supportsRtl="true"
|
android:supportsRtl="true"
|
||||||
|
android:networkSecurityConfig="@xml/net"
|
||||||
android:theme="@style/MyKeyBoard"
|
android:theme="@style/MyKeyBoard"
|
||||||
tools:targetApi="31">
|
tools:targetApi="31">
|
||||||
<!-- <activity-->
|
|
||||||
<!-- android:name=".activity.CategoryListActivity"-->
|
|
||||||
<!-- android:exported="false" />-->
|
|
||||||
<activity
|
<activity
|
||||||
android:name=".activity.StartActivity"
|
android:name=".activity.StartActivity"
|
||||||
android:exported="true"
|
android:exported="true"
|
||||||
@ -52,6 +52,24 @@
|
|||||||
android:name="android.view.im"
|
android:name="android.view.im"
|
||||||
android:resource="@xml/keyborad_xml" />
|
android:resource="@xml/keyborad_xml" />
|
||||||
</service>
|
</service>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- <meta-data android:name="com.google.android.gms.version"-->
|
||||||
|
<!-- android:value="@integer/google_play_services_version" />-->
|
||||||
|
<!-- <activity-->
|
||||||
|
<!-- android:name="com.ironsource.sdk.controller.ControllerActivity"-->
|
||||||
|
<!-- android:configChanges="orientation|screenSize"-->
|
||||||
|
<!-- android:hardwareAccelerated="true" />-->
|
||||||
|
<!-- <activity-->
|
||||||
|
<!-- android:name="com.ironsource.sdk.controller.InterstitialActivity"-->
|
||||||
|
<!-- android:configChanges="orientation|screenSize"-->
|
||||||
|
<!-- android:hardwareAccelerated="true"-->
|
||||||
|
<!-- android:theme="@android:style/Theme.Translucent" />-->
|
||||||
|
<!-- <activity-->
|
||||||
|
<!-- android:name="com.ironsource.sdk.controller.OpenUrlActivity"-->
|
||||||
|
<!-- android:configChanges="orientation|screenSize"-->
|
||||||
|
<!-- android:hardwareAccelerated="true"-->
|
||||||
|
<!-- android:theme="@android:style/Theme.Translucent" />-->
|
||||||
</application>
|
</application>
|
||||||
|
|
||||||
</manifest>
|
</manifest>
|
||||||
@ -2,9 +2,11 @@ package com.flowing.light.board
|
|||||||
|
|
||||||
import android.app.Application
|
import android.app.Application
|
||||||
import android.graphics.Typeface
|
import android.graphics.Typeface
|
||||||
|
import android.util.Log
|
||||||
import com.flowing.light.board.bean.BeanDetails
|
import com.flowing.light.board.bean.BeanDetails
|
||||||
import com.flowing.light.board.bean.BeanWrapper
|
import com.flowing.light.board.bean.BeanWrapper
|
||||||
//import com.pretty.keyboard.theme.keyboard.helper.ObjectBox
|
import com.flowing.light.board.ironad.AdManager
|
||||||
|
import com.up.uploadlibrary.UpLoadManager
|
||||||
import org.json.JSONArray
|
import org.json.JSONArray
|
||||||
import java.io.BufferedReader
|
import java.io.BufferedReader
|
||||||
import java.io.IOException
|
import java.io.IOException
|
||||||
@ -18,17 +20,30 @@ class FlowingLightBoard : Application() {
|
|||||||
|
|
||||||
lateinit var list: MutableList<BeanWrapper>
|
lateinit var list: MutableList<BeanWrapper>
|
||||||
|
|
||||||
const val TAG = "-----------------"
|
const val TAG = "-----FlowingLightBoard------------"
|
||||||
var defaultFont: Typeface? = null
|
var defaultFont: Typeface? = null
|
||||||
const val DB_VERSION = 2
|
const val DB_VERSION = 2
|
||||||
const val DB_NAME = "db_name"
|
const val DB_NAME = "db_name"
|
||||||
|
lateinit var context: Application
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
override fun onCreate() {
|
override fun onCreate() {
|
||||||
super.onCreate()
|
super.onCreate()
|
||||||
|
context = this
|
||||||
flowingLightBoardInstance = this
|
flowingLightBoardInstance = this
|
||||||
defaultFont = Typeface.createFromAsset(assets, "my_font.ttf")
|
defaultFont = Typeface.createFromAsset(assets, "my_font.ttf")
|
||||||
dealFile()
|
dealFile()
|
||||||
|
|
||||||
|
AdManager.init(TAG, this,"24c994f7d","5vrcaivtsn22m6b8","tj4l2n2v9bio3atd","orzmjt542r4s4dqv",false,{
|
||||||
|
Log.d(TAG,"----SDK --success")
|
||||||
|
}){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
UpLoadManager.init(this, TAG, { s: String?, s2: String? -> null })
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
private fun dealFile() {
|
private fun dealFile() {
|
||||||
val openFile = flowingLightBoardInstance.assets.open("res.json")
|
val openFile = flowingLightBoardInstance.assets.open("res.json")
|
||||||
@ -37,8 +52,6 @@ class FlowingLightBoard : Application() {
|
|||||||
resolveJsonString(jsonString)
|
resolveJsonString(jsonString)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private fun resolveJsonString(string: String) {
|
private fun resolveJsonString(string: String) {
|
||||||
val jsonData = JSONArray(string)
|
val jsonData = JSONArray(string)
|
||||||
var dataList: MutableList<BeanWrapper> = mutableListOf()
|
var dataList: MutableList<BeanWrapper> = mutableListOf()
|
||||||
|
|||||||
@ -21,23 +21,24 @@ import androidx.core.view.isVisible
|
|||||||
import androidx.lifecycle.lifecycleScope
|
import androidx.lifecycle.lifecycleScope
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
import androidx.recyclerview.widget.RecyclerView
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
import com.flowing.light.board.FlowingLightBoard
|
|
||||||
import com.flowing.light.board.R
|
|
||||||
import com.flowing.light.board.bean.BeanDetails
|
|
||||||
import com.flowing.light.board.callback.OnItemClickCallback
|
|
||||||
import com.flowing.light.board.callback.SetKeyboardCallback
|
|
||||||
import com.flowing.light.board.db.DatabaseManager
|
|
||||||
import com.flowing.light.board.adapter.SetAdapter
|
|
||||||
import com.flowing.light.board.fragment.DialogEnableSelect
|
|
||||||
import com.flowing.light.board.tools.Common
|
|
||||||
import com.flowing.light.board.tools.DealZipFile
|
|
||||||
import com.flowing.light.board.tools.SaveCurrentTheme
|
|
||||||
import com.bumptech.glide.Glide
|
import com.bumptech.glide.Glide
|
||||||
import com.bumptech.glide.integration.webp.decoder.WebpDrawable
|
import com.bumptech.glide.integration.webp.decoder.WebpDrawable
|
||||||
import com.bumptech.glide.load.DataSource
|
import com.bumptech.glide.load.DataSource
|
||||||
import com.bumptech.glide.load.engine.GlideException
|
import com.bumptech.glide.load.engine.GlideException
|
||||||
import com.bumptech.glide.request.RequestListener
|
import com.bumptech.glide.request.RequestListener
|
||||||
import com.bumptech.glide.request.target.Target
|
import com.bumptech.glide.request.target.Target
|
||||||
|
import com.flowing.light.board.FlowingLightBoard
|
||||||
|
import com.flowing.light.board.R
|
||||||
|
import com.flowing.light.board.adapter.SetAdapter
|
||||||
|
import com.flowing.light.board.bean.BeanDetails
|
||||||
|
import com.flowing.light.board.callback.OnItemClickCallback
|
||||||
|
import com.flowing.light.board.callback.SetKeyboardCallback
|
||||||
|
import com.flowing.light.board.db.DatabaseManager
|
||||||
|
import com.flowing.light.board.fragment.DialogEnableSelect
|
||||||
|
import com.flowing.light.board.ironad.AdManager
|
||||||
|
import com.flowing.light.board.tools.Common
|
||||||
|
import com.flowing.light.board.tools.DealZipFile
|
||||||
|
import com.flowing.light.board.tools.SaveCurrentTheme
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
|
||||||
@ -101,12 +102,13 @@ class SetActivity : AppCompatActivity() {
|
|||||||
v!!.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom)
|
v!!.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom)
|
||||||
insets
|
insets
|
||||||
})
|
})
|
||||||
|
AdManager.loadAllAd()
|
||||||
findViewId()
|
findViewId()
|
||||||
getExtraData()
|
getExtraData()
|
||||||
displayData()
|
displayData()
|
||||||
setApply()
|
setApply()
|
||||||
onClick()
|
onClick()
|
||||||
|
AdManager.showIsAd(this) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -168,9 +170,12 @@ class SetActivity : AppCompatActivity() {
|
|||||||
|
|
||||||
private fun onClick() {
|
private fun onClick() {
|
||||||
imgBack.setOnClickListener {
|
imgBack.setOnClickListener {
|
||||||
|
AdManager.showIsAd(this@SetActivity) {
|
||||||
finish()
|
finish()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
imgLike.setOnClickListener {
|
imgLike.setOnClickListener {
|
||||||
imgLike.isSelected = !imgLike.isSelected
|
imgLike.isSelected = !imgLike.isSelected
|
||||||
|
|
||||||
@ -203,8 +208,10 @@ class SetActivity : AppCompatActivity() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 横向布局管理器
|
// 横向布局管理器
|
||||||
layoutManager = LinearLayoutManager(this@SetActivity,
|
layoutManager = LinearLayoutManager(
|
||||||
LinearLayoutManager.HORIZONTAL, false)
|
this@SetActivity,
|
||||||
|
LinearLayoutManager.HORIZONTAL, false
|
||||||
|
)
|
||||||
// 正确设置横向间距
|
// 正确设置横向间距
|
||||||
addItemDecoration(object : RecyclerView.ItemDecoration() {
|
addItemDecoration(object : RecyclerView.ItemDecoration() {
|
||||||
override fun getItemOffsets(
|
override fun getItemOffsets(
|
||||||
@ -227,6 +234,7 @@ class SetActivity : AppCompatActivity() {
|
|||||||
private fun Int.dpToPx(): Int {
|
private fun Int.dpToPx(): Int {
|
||||||
return (this * resources.displayMetrics.density).toInt()
|
return (this * resources.displayMetrics.density).toInt()
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressLint("CheckResult")
|
@SuppressLint("CheckResult")
|
||||||
private fun loadImgGif() {
|
private fun loadImgGif() {
|
||||||
Glide.with(this)
|
Glide.with(this)
|
||||||
@ -262,19 +270,22 @@ class SetActivity : AppCompatActivity() {
|
|||||||
|
|
||||||
private fun setApply() {
|
private fun setApply() {
|
||||||
applyBtn.setOnClickListener {
|
applyBtn.setOnClickListener {
|
||||||
|
AdManager.showIsAd(this@SetActivity) {
|
||||||
val checkEnable = Common.checkEnable(this)
|
val checkEnable = Common.checkEnable(this)
|
||||||
val checkSetDefault = Common.checkSetDefault(this)
|
val checkSetDefault = Common.checkSetDefault(this)
|
||||||
if (!checkEnable || !checkSetDefault) {
|
if (!checkEnable || !checkSetDefault) {
|
||||||
showDialog()
|
showDialog()
|
||||||
return@setOnClickListener
|
return@showIsAd
|
||||||
}
|
}
|
||||||
startDown()
|
startDown()
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun showDialog() {
|
private fun showDialog() {
|
||||||
dialog = dialog ?: DialogEnableSelect.newInstance() .apply{
|
dialog = dialog ?: DialogEnableSelect.newInstance().apply {
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -356,6 +367,4 @@ class SetActivity : AppCompatActivity() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -4,9 +4,15 @@ import android.app.Activity
|
|||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.os.CountDownTimer
|
import android.os.CountDownTimer
|
||||||
|
import android.util.Log
|
||||||
import android.widget.ProgressBar
|
import android.widget.ProgressBar
|
||||||
|
import com.flowing.light.board.BuildConfig
|
||||||
|
import com.flowing.light.board.FlowingLightBoard
|
||||||
|
import com.flowing.light.board.FlowingLightBoard.Companion.TAG
|
||||||
import com.flowing.light.board.R
|
import com.flowing.light.board.R
|
||||||
|
import com.flowing.light.board.ironad.AdManager
|
||||||
import com.flowing.light.board.tools.Common
|
import com.flowing.light.board.tools.Common
|
||||||
|
import com.unity3d.mediation.LevelPlay
|
||||||
import kotlin.math.roundToInt
|
import kotlin.math.roundToInt
|
||||||
|
|
||||||
|
|
||||||
@ -16,7 +22,7 @@ import kotlin.math.roundToInt
|
|||||||
class StartActivity : Activity() {
|
class StartActivity : Activity() {
|
||||||
|
|
||||||
private lateinit var progressBar: ProgressBar
|
private lateinit var progressBar: ProgressBar
|
||||||
private var countTime = 1500L
|
private var countTime = 15000L
|
||||||
private lateinit var timer: CountDownTimer
|
private lateinit var timer: CountDownTimer
|
||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
@ -30,19 +36,18 @@ class StartActivity : Activity() {
|
|||||||
|
|
||||||
private fun init() {
|
private fun init() {
|
||||||
|
|
||||||
timer = object : CountDownTimer(countTime, 100) {
|
if (BuildConfig.DEBUG) {
|
||||||
override fun onTick(millisUntilFinished: Long) {
|
LevelPlay.validateIntegration(this)
|
||||||
|
}
|
||||||
|
timer = AdManager.showWelcomeAd(this,countTime,{ millisUntilFinished->
|
||||||
val percentage: Float = 100 - millisUntilFinished.toFloat() / countTime * 100
|
val percentage: Float = 100 - millisUntilFinished.toFloat() / countTime * 100
|
||||||
val round = percentage.roundToInt()
|
val round = percentage.roundToInt()
|
||||||
progressBar.progress = round
|
progressBar.progress = round
|
||||||
}
|
}){
|
||||||
|
|
||||||
override fun onFinish() {
|
|
||||||
progressBar.progress = 100
|
progressBar.progress = 100
|
||||||
toHome()
|
toHome()
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
timer.start()
|
timer.start()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -22,6 +22,8 @@ import androidx.core.view.WindowInsetsCompat;
|
|||||||
|
|
||||||
import com.flowing.light.board.R;
|
import com.flowing.light.board.R;
|
||||||
import com.flowing.light.board.databinding.ActivitySuccessPreBinding;
|
import com.flowing.light.board.databinding.ActivitySuccessPreBinding;
|
||||||
|
import com.flowing.light.board.ironad.AdManager;
|
||||||
|
import com.flowing.light.board.ironad.onActionListener;
|
||||||
import com.flowing.light.board.tools.KeyNames;
|
import com.flowing.light.board.tools.KeyNames;
|
||||||
import com.flowing.light.board.tools.Common;
|
import com.flowing.light.board.tools.Common;
|
||||||
import com.flowing.light.board.tools.SaveCurrentTheme;
|
import com.flowing.light.board.tools.SaveCurrentTheme;
|
||||||
@ -51,13 +53,11 @@ public class SuccessPreActivity extends AppCompatActivity {
|
|||||||
v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom);
|
v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom);
|
||||||
return insets;
|
return insets;
|
||||||
});
|
});
|
||||||
|
AdManager.loadAllAd();
|
||||||
onInit();
|
onInit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public void onInit() {
|
public void onInit() {
|
||||||
|
|
||||||
String stringExtra = getIntent().getStringExtra(key_name);
|
String stringExtra = getIntent().getStringExtra(key_name);
|
||||||
@ -68,14 +68,19 @@ public class SuccessPreActivity extends AppCompatActivity {
|
|||||||
vb.idBack.setOnClickListener(new View.OnClickListener() {
|
vb.idBack.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
|
AdManager.showIsAd(SuccessPreActivity.this, new onActionListener() {
|
||||||
|
@Override
|
||||||
|
public void onAction() {
|
||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
if (curPath == null) {
|
if (curPath == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
String bgPath = curPath+"res/drawable-xxhdpi-v4/"+ KeyNames.previewBg;
|
String bgPath = curPath + "res/drawable-xxhdpi-v4/" + KeyNames.previewBg;
|
||||||
|
|
||||||
Drawable bgDraw = Common.INSTANCE.getBgDrawable(this, bgPath);
|
Drawable bgDraw = Common.INSTANCE.getBgDrawable(this, bgPath);
|
||||||
if (bgDraw != null) {
|
if (bgDraw != null) {
|
||||||
|
|||||||
346
app/src/main/java/com/flowing/light/board/ironad/AdManager.kt
Normal file
346
app/src/main/java/com/flowing/light/board/ironad/AdManager.kt
Normal file
@ -0,0 +1,346 @@
|
|||||||
|
package com.flowing.light.board.ironad
|
||||||
|
|
||||||
|
import android.app.Activity
|
||||||
|
import android.app.Application
|
||||||
|
import android.os.CountDownTimer
|
||||||
|
import android.os.Handler
|
||||||
|
import android.util.Log
|
||||||
|
|
||||||
|
import com.unity3d.mediation.LevelPlay
|
||||||
|
import com.unity3d.mediation.LevelPlayAdError
|
||||||
|
import com.unity3d.mediation.LevelPlayAdInfo
|
||||||
|
import com.unity3d.mediation.LevelPlayConfiguration
|
||||||
|
import com.unity3d.mediation.LevelPlayInitError
|
||||||
|
import com.unity3d.mediation.LevelPlayInitListener
|
||||||
|
import com.unity3d.mediation.LevelPlayInitRequest
|
||||||
|
import com.unity3d.mediation.interstitial.LevelPlayInterstitialAd
|
||||||
|
import com.unity3d.mediation.interstitial.LevelPlayInterstitialAdListener
|
||||||
|
import com.unity3d.services.UnityAdsSDK
|
||||||
|
|
||||||
|
|
||||||
|
object AdManager {
|
||||||
|
|
||||||
|
//上次广告展示时刻
|
||||||
|
var LAST_AD_SHOW = 0L
|
||||||
|
|
||||||
|
const val type_no_cache = 0
|
||||||
|
const val type_has_cache = 1
|
||||||
|
const val type_show_success = 2
|
||||||
|
const val type_show_close = 3
|
||||||
|
const val type_show_fail = 4
|
||||||
|
|
||||||
|
|
||||||
|
var place1Id = ""
|
||||||
|
var place2Id = ""
|
||||||
|
var place3Id = ""
|
||||||
|
|
||||||
|
|
||||||
|
var place1LoadFail = false
|
||||||
|
var place2LoadFail = false
|
||||||
|
var place3LoadFail = false
|
||||||
|
|
||||||
|
val list = mutableListOf<LevelPlayInterstitialAd>()
|
||||||
|
var mContext: Application? = null
|
||||||
|
var mTAG = "-----------IronSource-----------"
|
||||||
|
|
||||||
|
|
||||||
|
fun init(
|
||||||
|
tag: String,
|
||||||
|
context: Application,
|
||||||
|
appKey: String,
|
||||||
|
id1: String,
|
||||||
|
id2: String,
|
||||||
|
id3: String,
|
||||||
|
showDebugUI: Boolean,
|
||||||
|
onInitSuccess: (p0: LevelPlayConfiguration) -> Unit,
|
||||||
|
onInitFail: (p0: LevelPlayInitError) -> Unit
|
||||||
|
) {
|
||||||
|
mTAG = tag
|
||||||
|
mContext = context
|
||||||
|
place1Id = id1
|
||||||
|
place2Id = id2
|
||||||
|
place3Id = id3
|
||||||
|
|
||||||
|
if(showDebugUI){
|
||||||
|
LevelPlay.setMetaData("is_test_suite", "enable")
|
||||||
|
}
|
||||||
|
val initRequest = LevelPlayInitRequest.Builder(appKey)
|
||||||
|
.build()
|
||||||
|
LevelPlay.init(context, initRequest, object : LevelPlayInitListener {
|
||||||
|
override fun onInitSuccess(p0: LevelPlayConfiguration) {
|
||||||
|
onInitSuccess(p0)
|
||||||
|
//测试工具
|
||||||
|
if (showDebugUI) {
|
||||||
|
mContext?.let {
|
||||||
|
LevelPlay.launchTestSuite(it)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
loadAllAd()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onInitFailed(p0: LevelPlayInitError) {
|
||||||
|
onInitFail(p0)
|
||||||
|
}
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@JvmStatic
|
||||||
|
fun loadAllAd() {
|
||||||
|
if (list.size <= 0) {
|
||||||
|
place1LoadFail = false
|
||||||
|
place2LoadFail = false
|
||||||
|
place3LoadFail = false
|
||||||
|
val iSAd1 = LevelPlayInterstitialAd(place1Id)
|
||||||
|
val iSAd2 = LevelPlayInterstitialAd(place2Id)
|
||||||
|
val iSAd3 = LevelPlayInterstitialAd(place3Id)
|
||||||
|
list.add(iSAd1)
|
||||||
|
list.add(iSAd2)
|
||||||
|
list.add(iSAd3)
|
||||||
|
}
|
||||||
|
for (ad in list) {
|
||||||
|
if (!ad.isAdReady) {
|
||||||
|
setCallBack(ad, object : IronListener {
|
||||||
|
override fun onLoaded() {
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onLoadFail() {
|
||||||
|
Log.d(mTAG, "-loadFail------placeId------${ad.adId}")
|
||||||
|
if (ad.adId == place1Id) {
|
||||||
|
place1LoadFail = true
|
||||||
|
}
|
||||||
|
if (ad.adId == place2Id) {
|
||||||
|
place2LoadFail = true
|
||||||
|
}
|
||||||
|
if (ad.adId == place3Id) {
|
||||||
|
place3LoadFail = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onClose() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onShowFail() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onShowSuccess() {
|
||||||
|
|
||||||
|
}
|
||||||
|
})
|
||||||
|
ad.loadAd()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@JvmStatic
|
||||||
|
fun getReadyAd(): LevelPlayInterstitialAd? {
|
||||||
|
list.shuffle()
|
||||||
|
for (ad in list) {
|
||||||
|
if (ad.isAdReady) {
|
||||||
|
Log.d(mTAG, "-cache------------")
|
||||||
|
return ad
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Log.d(mTAG, "-no cache------------")
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@JvmStatic
|
||||||
|
fun showWelcomeAd(
|
||||||
|
activity: Activity,
|
||||||
|
totalTim: Long,
|
||||||
|
countAction: (millisUntilFinished: Long) -> Unit,
|
||||||
|
goMain: () -> Unit
|
||||||
|
): CountDownTimer {
|
||||||
|
var alreadyShow = false
|
||||||
|
var timer: CountDownTimer? = null
|
||||||
|
timer = object : CountDownTimer(totalTim, 100) {
|
||||||
|
override fun onTick(millisUntilFinished: Long) {
|
||||||
|
countAction(millisUntilFinished)
|
||||||
|
Log.d(mTAG, "onTick ${Thread.currentThread().name} timer=${timer}")
|
||||||
|
if (!alreadyShow) {
|
||||||
|
showAD(activity) {
|
||||||
|
if (it == type_has_cache) {
|
||||||
|
alreadyShow = true
|
||||||
|
}
|
||||||
|
if (it == type_show_close || it == type_show_fail) {
|
||||||
|
Log.d(
|
||||||
|
mTAG,
|
||||||
|
"goMain 111 ${Thread.currentThread().name} "
|
||||||
|
)
|
||||||
|
goMain()
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onFinish() {
|
||||||
|
Log.d(mTAG, "onFinish() ${Thread.currentThread().name} ")
|
||||||
|
if (!alreadyShow) {
|
||||||
|
showAD(activity) {
|
||||||
|
if (it == type_show_close || it == type_show_fail || it == type_no_cache) {
|
||||||
|
Log.d(
|
||||||
|
mTAG,
|
||||||
|
"goMain 222 ${Thread.currentThread().name} "
|
||||||
|
)
|
||||||
|
goMain()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return timer
|
||||||
|
}
|
||||||
|
|
||||||
|
@JvmStatic
|
||||||
|
fun showWelComeAd(
|
||||||
|
activity: Activity,
|
||||||
|
handler: Handler,
|
||||||
|
totalTime: Long,
|
||||||
|
listener: WelcomeListener
|
||||||
|
): Runnable {
|
||||||
|
var remainingTime = totalTime
|
||||||
|
var interval = 100L
|
||||||
|
var alreadyShow = false
|
||||||
|
|
||||||
|
//继续更新进度
|
||||||
|
var isContinue = true
|
||||||
|
return object : Runnable {
|
||||||
|
override fun run() {
|
||||||
|
remainingTime -= interval
|
||||||
|
if (remainingTime <= 0) {
|
||||||
|
if (!alreadyShow) {
|
||||||
|
showAD(activity) {
|
||||||
|
if (it == type_show_close || it == type_show_fail || it == type_no_cache) {
|
||||||
|
Log.d(
|
||||||
|
mTAG,
|
||||||
|
"goMain 222 ${Thread.currentThread().name} "
|
||||||
|
)
|
||||||
|
listener.goMain()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
val progress = (100 - remainingTime * 100 / totalTime).toInt()
|
||||||
|
listener.onTime(progress)
|
||||||
|
if (!alreadyShow) {
|
||||||
|
if (place1LoadFail
|
||||||
|
&& place2LoadFail
|
||||||
|
&& place3LoadFail
|
||||||
|
) {
|
||||||
|
isContinue = false
|
||||||
|
listener.goMain()
|
||||||
|
Log.d(
|
||||||
|
mTAG,
|
||||||
|
"goMain 000 三个id都加载失败 ${Thread.currentThread().name} "
|
||||||
|
)
|
||||||
|
|
||||||
|
}
|
||||||
|
showAD(activity) {
|
||||||
|
if (it == type_has_cache) {
|
||||||
|
alreadyShow = true
|
||||||
|
}
|
||||||
|
if (it == type_show_close || it == type_show_fail) {
|
||||||
|
Log.d(
|
||||||
|
mTAG,
|
||||||
|
"goMain 111 ${Thread.currentThread().name} "
|
||||||
|
)
|
||||||
|
isContinue = false
|
||||||
|
listener.goMain()
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (isContinue)
|
||||||
|
handler.postDelayed(this, interval)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private fun setCallBack(ad: LevelPlayInterstitialAd, listener: IronListener) {
|
||||||
|
ad.setListener(object : LevelPlayInterstitialAdListener {
|
||||||
|
override fun onAdLoaded(p0: LevelPlayAdInfo) {
|
||||||
|
listener.onLoaded()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onAdLoadFailed(p0: LevelPlayAdError) {
|
||||||
|
listener.onLoadFail()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onAdDisplayed(p0: LevelPlayAdInfo) {
|
||||||
|
listener.onShowSuccess()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onAdClosed(p0: LevelPlayAdInfo) {
|
||||||
|
super.onAdClosed(p0)
|
||||||
|
listener.onClose()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onAdClicked(p0: LevelPlayAdInfo) {
|
||||||
|
super.onAdClicked(p0)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onAdDisplayFailed(p0: LevelPlayAdError, p1: LevelPlayAdInfo) {
|
||||||
|
super.onAdDisplayFailed(p0, p1)
|
||||||
|
listener.onShowFail()
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@JvmStatic
|
||||||
|
private fun showAD(activity: Activity, action: (type: Int) -> Unit) {
|
||||||
|
val readyAd = getReadyAd()
|
||||||
|
if (readyAd != null) {
|
||||||
|
Log.d(mTAG, "readyAd ${readyAd.adId} ")
|
||||||
|
action(type_has_cache)
|
||||||
|
setCallBack(readyAd, object : IronListener {
|
||||||
|
override fun onLoaded() {
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onLoadFail() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onClose() {
|
||||||
|
action(type_show_close)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onShowFail() {
|
||||||
|
action(type_show_fail)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onShowSuccess() {
|
||||||
|
action(type_show_success)
|
||||||
|
LAST_AD_SHOW = System.currentTimeMillis()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
readyAd.showAd(activity)
|
||||||
|
} else {
|
||||||
|
action(type_no_cache)
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@JvmStatic
|
||||||
|
fun showIsAd(activity: Activity, listener: onActionListener) {
|
||||||
|
showAD(activity) { type ->
|
||||||
|
if (type == type_no_cache || type == type_show_close || type == type_show_fail) {
|
||||||
|
listener.onAction()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,12 @@
|
|||||||
|
package com.flowing.light.board.ironad
|
||||||
|
|
||||||
|
interface IronListener {
|
||||||
|
fun onLoaded()
|
||||||
|
fun onLoadFail()
|
||||||
|
|
||||||
|
fun onClose()
|
||||||
|
|
||||||
|
fun onShowFail()
|
||||||
|
|
||||||
|
fun onShowSuccess()
|
||||||
|
}
|
||||||
@ -0,0 +1,6 @@
|
|||||||
|
package com.flowing.light.board.ironad
|
||||||
|
|
||||||
|
interface WelcomeListener {
|
||||||
|
fun onTime(progressInt:Int)
|
||||||
|
fun goMain()
|
||||||
|
}
|
||||||
@ -0,0 +1,6 @@
|
|||||||
|
package com.flowing.light.board.ironad;
|
||||||
|
|
||||||
|
public interface onActionListener {
|
||||||
|
|
||||||
|
void onAction();
|
||||||
|
}
|
||||||
6
app/src/main/res/xml/net.xml
Normal file
6
app/src/main/res/xml/net.xml
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<network-security-config xmlns:tools="http://schemas.android.com/tools">
|
||||||
|
<domain-config cleartextTrafficPermitted="true">
|
||||||
|
<domain tools:ignore="NetworkSecurityConfig">mobile-server.lux-ad.com</domain>
|
||||||
|
</domain-config>
|
||||||
|
</network-security-config>
|
||||||
@ -3,4 +3,6 @@ plugins {
|
|||||||
id("com.android.application") version "8.9.2" apply false
|
id("com.android.application") version "8.9.2" apply false
|
||||||
id("org.jetbrains.kotlin.android") version "2.2.21" apply false
|
id("org.jetbrains.kotlin.android") version "2.2.21" apply false
|
||||||
kotlin("kapt") version "2.0.0"
|
kotlin("kapt") version "2.0.0"
|
||||||
|
id("com.google.gms.google-services") version "4.4.2" apply false
|
||||||
|
id ("com.google.firebase.crashlytics") version "3.0.2" apply false
|
||||||
}
|
}
|
||||||
|
|||||||
@ -13,6 +13,26 @@ dependencyResolutionManagement {
|
|||||||
mavenCentral()
|
mavenCentral()
|
||||||
maven("https://jitpack.io")
|
maven("https://jitpack.io")
|
||||||
|
|
||||||
|
|
||||||
|
maven {
|
||||||
|
url = uri("https://android-sdk.is.com/")
|
||||||
|
}
|
||||||
|
maven {
|
||||||
|
url = uri("https://dl.bintray.com/ironsource-mobile/android-sdk")
|
||||||
|
}
|
||||||
|
maven {
|
||||||
|
url = uri("https://dl.bintray.com/ironsource-mobile/android-adapters")
|
||||||
|
}
|
||||||
|
maven {
|
||||||
|
url = uri("https://cboost.jfrog.io/artifactory/chartboost-ads/")
|
||||||
|
}
|
||||||
|
maven {
|
||||||
|
url = uri("https://dl-maven-android.mintegral.com/repository/mbridge_android_sdk_oversea")
|
||||||
|
}
|
||||||
|
maven {
|
||||||
|
url = uri("https://artifact.bytedance.com/repository/pangle")
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user