Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Sign in / Register
Toggle navigation
L
location share white
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wanglei
location share white
Commits
07a8a13e
Commit
07a8a13e
authored
Dec 03, 2024
by
wanglei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
...
parent
257ed5db
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
174 additions
and
79 deletions
+174
-79
AdsMgr.kt
app/src/main/java/com/base/locationsharewhite/ads/AdsMgr.kt
+91
-36
AdInsertMgr.kt
...java/com/base/locationsharewhite/ads/admob/AdInsertMgr.kt
+4
-3
AdOpenMgr.kt
...n/java/com/base/locationsharewhite/ads/admob/AdOpenMgr.kt
+4
-3
AdmobEvent.kt
.../java/com/base/locationsharewhite/ads/admob/AdmobEvent.kt
+8
-0
AdMaxEvent.kt
...va/com/base/locationsharewhite/ads/applovin/AdMaxEvent.kt
+8
-0
MaxInsertMgr.kt
.../com/base/locationsharewhite/ads/applovin/MaxInsertMgr.kt
+6
-5
MaxOpenMgr.kt
...va/com/base/locationsharewhite/ads/applovin/MaxOpenMgr.kt
+2
-3
PopupConstObject.kt
.../java/com/base/locationsharewhite/fcm/PopupConstObject.kt
+0
-1
InstallHelper.kt
.../java/com/base/locationsharewhite/helper/InstallHelper.kt
+2
-9
MyApplication.kt
.../java/com/base/locationsharewhite/helper/MyApplication.kt
+30
-7
NewComUtils.kt
...in/java/com/base/locationsharewhite/helper/NewComUtils.kt
+2
-5
MainActivity.kt
.../java/com/base/locationsharewhite/ui/main/MainActivity.kt
+9
-1
SplashActivity.kt
...a/com/base/locationsharewhite/ui/splash/SplashActivity.kt
+1
-1
SplashPresenter.kt
.../com/base/locationsharewhite/ui/splash/SplashPresenter.kt
+3
-4
ToastUtils.kt
...main/java/com/base/locationsharewhite/utils/ToastUtils.kt
+4
-1
No files found.
app/src/main/java/com/base/locationsharewhite/ads/AdsMgr.kt
View file @
07a8a13e
...
...
@@ -7,6 +7,7 @@ import androidx.annotation.LayoutRes
import
com.applovin.sdk.AppLovinMediationProvider
import
com.applovin.sdk.AppLovinSdk
import
com.applovin.sdk.AppLovinSdkInitializationConfiguration
import
com.base.locationsharewhite.BuildConfig
import
com.base.locationsharewhite.ads.admob.AdBannerMgr
import
com.base.locationsharewhite.ads.admob.AdInsertMgr
import
com.base.locationsharewhite.ads.admob.AdNativeMgr
...
...
@@ -18,8 +19,14 @@ import com.base.locationsharewhite.ads.applovin.MaxOpenMgr
import
com.base.locationsharewhite.config.AdConfigBean
import
com.base.locationsharewhite.config.ConfigBean.Companion.configBean
import
com.base.locationsharewhite.helper.EventUtils
import
com.base.locationsharewhite.utils.AppPreferences
import
com.base.locationsharewhite.utils.LogEx
import
com.base.locationsharewhite.utils.ToastUtils.toast
import
com.google.android.gms.ads.MobileAds
import
com.google.android.gms.ads.identifier.AdvertisingIdClient
import
com.google.android.gms.ads.initialization.AdapterStatus
import
java.util.Collections
import
java.util.concurrent.Executors
/**
* 广告管理类
...
...
@@ -55,7 +62,13 @@ object AdsMgr {
/**
* 是否初始化
*/
var
isInit
=
false
var
isAdmobInit
=
false
private
set
/**
* 是否初始化
*/
var
isMaxInit
=
false
private
set
/**
...
...
@@ -75,34 +88,64 @@ object AdsMgr {
EventUtils
.
event
(
"isInBlackList"
,
configBean
.
isInBlackList
.
toString
())
return
}
initAdmob
(
context
)
initMax
(
context
)
if
(
adsConfigBean
.
adSwitch
)
{
MobileAds
.
initialize
(
context
)
{
val
readyAdapter
=
it
.
adapterStatusMap
.
entries
.
find
{
entry
->
entry
.
value
.
initializationState
==
AdapterStatus
.
State
.
READY
}
isInit
=
readyAdapter
!=
null
EventUtils
.
event
(
"AdmobInit"
,
"AdmobInit"
)
//if (isInit) {
//成功初始化就提前预加载开屏广告和插页广告
// }
}
private
fun
initAdmob
(
context
:
Context
)
{
MobileAds
.
initialize
(
context
)
{
val
readyAdapter
=
it
.
adapterStatusMap
.
entries
.
find
{
entry
->
entry
.
value
.
initializationState
==
AdapterStatus
.
State
.
READY
}
//据说可以初始化之前就预加载广告
adOpenMgr
.
loadAd
(
context
)
adInsertMgr
.
loadAd
(
context
)
}
else
{
val
initConfig
=
AppLovinSdkInitializationConfiguration
.
builder
(
ConstConfig
.
MAX_SDK_KEY
,
context
).
setMediationProvider
(
AppLovinMediationProvider
.
MAX
).
build
()
isAdmobInit
=
readyAdapter
!=
null
EventUtils
.
event
(
"AdmobInit"
,
"AdmobInit"
)
//if (isInit) {
//成功初始化就提前预加载开屏广告和插页广告
// }
context
.
toast
(
"admob init"
)
admobInitCallBack
?.
invoke
()
admobInitCallBack
=
null
}
//据说可以初始化之前就预加载广告
adOpenMgr
.
loadAd
(
context
)
adInsertMgr
.
loadAd
(
context
)
}
private
fun
initMax
(
context
:
Context
)
{
val
executor
=
Executors
.
newSingleThreadExecutor
()
executor
.
execute
{
val
currentGaid
=
AdvertisingIdClient
.
getAdvertisingIdInfo
(
context
).
id
AppPreferences
.
getInstance
().
getString
(
"gid"
,
currentGaid
)
val
build
=
AppLovinSdkInitializationConfiguration
.
builder
(
ConstConfig
.
MAX_SDK_KEY
,
context
)
build
.
setMediationProvider
(
AppLovinMediationProvider
.
MAX
)
if
(
BuildConfig
.
DEBUG
)
{
build
.
testDeviceAdvertisingIds
=
Collections
.
singletonList
(
currentGaid
)
}
val
initConfig
=
build
.
build
()
AppLovinSdk
.
getInstance
(
context
).
initialize
(
initConfig
)
{
isInit
=
true
maxOpenMgr
.
loadAd
(
context
)
is
Max
Init
=
true
//
maxOpenMgr.loadAd(context)
maxInsertMgr
.
loadAd
(
context
)
context
.
toast
(
"max init"
)
maxInitCallBack
?.
invoke
()
maxInitCallBack
=
null
}
}
}
private
var
admobInitCallBack
:
(()
->
Unit
)?
=
null
private
var
maxInitCallBack
:
(()
->
Unit
)?
=
null
/**
* 展示开屏广告
*
...
...
@@ -115,16 +158,29 @@ object AdsMgr {
showCallBack
:
AdsShowCallBack
?
=
null
,
)
{
if
(
configBean
.
isInBlackList
)
{
activity
.
toast
(
"isInBlackList"
)
EventUtils
.
event
(
"isInBlackList"
,
"isInBlackList=${configBean.isInBlackList}"
)
return
}
if
((!
adsConfigBean
.
adSwitch
&&
!
isInit
))
{
showCallBack
?.
failed
()
return
}
if
(
adsConfigBean
.
adSwitch
)
{
adOpenMgr
.
show
(
activity
,
isUnLimit
,
showCallBack
)
if
(
isAdmobInit
)
{
adOpenMgr
.
show
(
activity
,
isUnLimit
,
showCallBack
)
}
else
{
admobInitCallBack
=
{
LogEx
.
logDebug
(
"showOpen"
,
"admobInitCallBack"
)
adOpenMgr
.
show
(
activity
,
isUnLimit
,
showCallBack
)
}
}
}
else
{
maxOpenMgr
.
show
(
activity
,
isUnLimit
,
showCallBack
)
if
(
isMaxInit
)
{
maxOpenMgr
.
show
(
activity
,
isUnLimit
,
showCallBack
)
}
else
{
maxInitCallBack
=
{
LogEx
.
logDebug
(
"showOpen"
,
"maxInitCallBack"
)
maxOpenMgr
.
show
(
activity
,
isUnLimit
,
showCallBack
)
}
}
}
}
...
...
@@ -138,20 +194,19 @@ object AdsMgr {
*/
fun
showInsert
(
activity
:
Activity
,
isUnLimit
:
Boolean
=
false
,
showCallBack
:
AdsShowCallBack
?
=
null
,
isUnLimit
:
Boolean
=
false
)
{
if
(
configBean
.
isInBlackList
)
{
EventUtils
.
event
(
"isInBlackList"
,
configBean
.
isInBlackList
.
toString
())
return
}
if
((!
adsConfigBean
.
adSwitch
&&
!
isInit
))
{
showCallBack
?.
failed
()
return
LogEx
.
logDebug
(
"showInsert"
,
"adSwitch=${adsConfigBean.adSwitch}"
)
if
(
adsConfigBean
.
adSwitch
)
{
adInsertMgr
.
show
(
activity
,
isUnLimit
,
showCallBack
)
}
else
{
maxInsertMgr
.
show
(
activity
,
isUnLimit
,
showCallBack
)
}
if
(
adsConfigBean
.
adSwitch
)
adInsertMgr
.
show
(
activity
,
isUnLimit
,
showCallBack
)
else
maxInsertMgr
.
show
(
activity
,
isUnLimit
,
showCallBack
)
}
/**
...
...
@@ -170,7 +225,7 @@ object AdsMgr {
return
}
if
(!
isInit
)
return
if
(!
is
Admob
Init
)
return
if
(
adsConfigBean
.
adSwitch
)
{
adNativeMgr
.
show
(
nativeView
,
layout
,
nativeCallBack
)
...
...
@@ -179,7 +234,7 @@ object AdsMgr {
}
}
fun
isNativeShow
()
=
(
isInit
&&
!
configBean
.
isInBlackList
)
&&
LimitUtils
.
isAdShow
(
AdsType
.
NATIVE
)
fun
isNativeShow
()
=
(
is
Admob
Init
&&
!
configBean
.
isInBlackList
)
&&
LimitUtils
.
isAdShow
(
AdsType
.
NATIVE
)
/**
* 展示banner广告
...
...
@@ -191,7 +246,7 @@ object AdsMgr {
EventUtils
.
event
(
"isInBlackList"
,
configBean
.
isInBlackList
.
toString
())
return
}
if
(!
isInit
)
{
if
(!
is
Admob
Init
)
{
adBannerMgr
.
show
(
parent
)
}
}
...
...
app/src/main/java/com/base/locationsharewhite/ads/admob/AdInsertMgr.kt
View file @
07a8a13e
...
...
@@ -7,6 +7,7 @@ import com.base.locationsharewhite.ads.AdsShowCallBack
import
com.base.locationsharewhite.ads.AdsType
import
com.base.locationsharewhite.ads.BaseAdMgr
import
com.base.locationsharewhite.ads.ConstConfig.ADMOB_INSERT_UNIT_ID
import
com.base.locationsharewhite.ads.admob.AdmobEvent.adPrepareShow
import
com.base.locationsharewhite.helper.EventUtils
import
com.google.android.gms.ads.AdError
import
com.google.android.gms.ads.AdRequest
...
...
@@ -81,6 +82,9 @@ class AdInsertMgr : BaseAdMgr<InterstitialAd>() {
showCallBack
?.
failed
()
return
}
adPrepareShow
(
"interAd"
)
if
(!
isUnLimit
)
{
if
(!
LimitUtils
.
isAdShow
(
AdsType
.
INSERT
))
{
showCallBack
?.
failed
()
...
...
@@ -129,9 +133,6 @@ class AdInsertMgr : BaseAdMgr<InterstitialAd>() {
return
}
val
dialog
=
activity
.
showAdPreparingDialog
()
val
obj1
=
JSONObject
()
obj1
.
put
(
"ad_unit"
,
"interAd"
)
EventUtils
.
event
(
"ad_prepare_show"
,
ext
=
obj1
)
currentAd
?.
run
{
fullScreenContentCallback
=
object
:
FullScreenContentCallback
()
{
override
fun
onAdShowedFullScreenContent
()
{
...
...
app/src/main/java/com/base/locationsharewhite/ads/admob/AdOpenMgr.kt
View file @
07a8a13e
...
...
@@ -6,6 +6,7 @@ import com.base.locationsharewhite.ads.AdsShowCallBack
import
com.base.locationsharewhite.ads.AdsType
import
com.base.locationsharewhite.ads.BaseAdMgr
import
com.base.locationsharewhite.ads.ConstConfig
import
com.base.locationsharewhite.ads.admob.AdmobEvent.adPrepareShow
import
com.base.locationsharewhite.helper.EventUtils
import
com.google.android.gms.ads.AdError
import
com.google.android.gms.ads.AdRequest
...
...
@@ -81,6 +82,9 @@ class AdOpenMgr : BaseAdMgr<AppOpenAd>() {
return
}
adPrepareShow
(
"openAd"
)
if
(!
LimitUtils
.
isAdShow
(
AdsType
.
OPEN
))
{
showCallBack
?.
failed
()
return
...
...
@@ -127,9 +131,6 @@ class AdOpenMgr : BaseAdMgr<AppOpenAd>() {
}
return
}
val
obj1
=
JSONObject
()
obj1
.
put
(
"ad_unit"
,
"openAd"
)
EventUtils
.
event
(
"ad_prepare_show"
,
ext
=
obj1
)
currentAd
?.
run
{
fullScreenContentCallback
=
object
:
FullScreenContentCallback
()
{
override
fun
onAdShowedFullScreenContent
()
{
...
...
app/src/main/java/com/base/locationsharewhite/ads/admob/AdmobEvent.kt
View file @
07a8a13e
...
...
@@ -22,6 +22,14 @@ import org.json.JSONObject
object
AdmobEvent
{
private
val
TAG
=
"AdmobEvent"
fun
adPrepareShow
(
adUnit
:
String
)
{
val
obj1
=
JSONObject
()
obj1
.
put
(
"ad_unit"
,
adUnit
)
EventUtils
.
event
(
"ad_prepare_show"
,
ext
=
obj1
)
}
fun
pullAd
(
responseInfo
:
ResponseInfo
?,
adUnit
:
String
,
...
...
app/src/main/java/com/base/locationsharewhite/ads/applovin/AdMaxEvent.kt
View file @
07a8a13e
...
...
@@ -15,6 +15,14 @@ import org.json.JSONObject
object
AdMaxEvent
{
fun
adPrepareShow
(
adUnit
:
String
)
{
val
obj1
=
JSONObject
()
obj1
.
put
(
"ad_unit"
,
adUnit
)
EventUtils
.
event
(
"ad_prepare_show"
,
ext
=
obj1
)
}
fun
pullAd
(
ad
:
MaxAd
?,
adUnit
:
String
,
...
...
app/src/main/java/com/base/locationsharewhite/ads/applovin/MaxInsertMgr.kt
View file @
07a8a13e
...
...
@@ -6,6 +6,7 @@ import com.applovin.mediation.MaxAd
import
com.applovin.mediation.MaxAdListener
import
com.applovin.mediation.MaxError
import
com.applovin.mediation.ads.MaxInterstitialAd
import
com.base.locationsharewhite.ads.AdDialog.showAdPreparingDialog
import
com.base.locationsharewhite.ads.AdsShowCallBack
import
com.base.locationsharewhite.ads.AdsType
import
com.base.locationsharewhite.ads.BaseAdMgr
...
...
@@ -82,6 +83,7 @@ class MaxInsertMgr : BaseAdMgr<MaxInterstitialAd>() {
showCallBack
?.
failed
()
return
}
AdMaxEvent
.
adPrepareShow
(
"interAd"
)
if
(!
isUnLimit
)
{
if
(!
LimitUtils
.
isAdShow
(
AdsType
.
INSERT
))
{
...
...
@@ -97,8 +99,7 @@ class MaxInsertMgr : BaseAdMgr<MaxInterstitialAd>() {
// 开屏广告正在展示
return
}
if
(
showCallBack
!=
null
&&
this
.
showCallBack
!=
showCallBack
)
this
.
showCallBack
=
showCallBack
if
(
showCallBack
!=
null
&&
this
.
showCallBack
!=
showCallBack
)
this
.
showCallBack
=
showCallBack
if
((
currentAd
?.
isReady
!=
true
).
also
{
if
(
it
)
{
val
obj
=
JSONObject
()
...
...
@@ -130,15 +131,14 @@ class MaxInsertMgr : BaseAdMgr<MaxInterstitialAd>() {
}
return
}
val
obj1
=
JSONObject
()
obj1
.
put
(
"ad_unit"
,
"interAd"
)
EventUtils
.
event
(
"ad_prepare_show"
,
ext
=
obj1
)
val
dialog
=
activity
.
showAdPreparingDialog
()
currentAd
?.
run
{
setListener
(
object
:
MaxAdListener
{
override
fun
onAdLoaded
(
p0
:
MaxAd
)
{
}
override
fun
onAdDisplayed
(
ad
:
MaxAd
)
{
dialog
.
cancel
()
lastOpenDate
=
System
.
currentTimeMillis
()
// 广告展示
currentAd
=
null
...
...
@@ -169,6 +169,7 @@ class MaxInsertMgr : BaseAdMgr<MaxInterstitialAd>() {
}
override
fun
onAdDisplayFailed
(
p0
:
MaxAd
,
p1
:
MaxError
)
{
dialog
.
cancel
()
// 广告展示失败,清空缓存数据,重新加载
showingAd
=
false
currentAd
=
null
...
...
app/src/main/java/com/base/locationsharewhite/ads/applovin/MaxOpenMgr.kt
View file @
07a8a13e
...
...
@@ -80,6 +80,7 @@ class MaxOpenMgr : BaseAdMgr<MaxAppOpenAd>() {
showCallBack
?.
failed
()
return
}
AdMaxEvent
.
adPrepareShow
(
"openAd"
)
if
(!
isUnLimit
)
{
if
(!
LimitUtils
.
isAdShow
(
AdsType
.
OPEN
))
{
...
...
@@ -129,9 +130,7 @@ class MaxOpenMgr : BaseAdMgr<MaxAppOpenAd>() {
}
return
}
val
obj1
=
JSONObject
()
obj1
.
put
(
"ad_unit"
,
"openAd"
)
EventUtils
.
event
(
"ad_prepare_show"
,
ext
=
obj1
)
currentAd
?.
run
{
setListener
(
object
:
MaxAdListener
{
override
fun
onAdLoaded
(
p0
:
MaxAd
)
{
...
...
app/src/main/java/com/base/locationsharewhite/fcm/PopupConstObject.kt
View file @
07a8a13e
package
com.base.locationsharewhite.fcm
import
com.base.locationsharewhite.config.PopupConfigBean
import
org.json.JSONObject
object
PopupConstObject
{
...
...
app/src/main/java/com/base/locationsharewhite/helper/InstallHelper.kt
View file @
07a8a13e
...
...
@@ -15,7 +15,7 @@ object InstallHelps {
private
val
TAG
=
"InstallHelps"
fun
init
()
{
fun
init
(
requestCfg
:
()
->
Unit
)
{
val
referrerClient
=
InstallReferrerClient
.
newBuilder
(
MyApplication
.
appContext
).
build
()
referrerClient
.
startConnection
(
object
:
InstallReferrerStateListener
{
...
...
@@ -32,7 +32,7 @@ object InstallHelps {
obj
.
put
(
"instantExperienceLaunched"
,
installInfo
.
toString
())
EventUtils
.
event
(
"install_referrer"
,
ext
=
obj
,
isSingleEvent
=
true
)
LogEx
.
logDebug
(
TAG
,
"referrerUrl=${response.installReferrer}"
)
AppPreferences
.
getInstance
().
put
(
"
referrerUrl
"
,
response
.
installReferrer
)
AppPreferences
.
getInstance
().
put
(
"
install_referrer
"
,
response
.
installReferrer
)
if
(
listOf
(
"gclid"
,
"facebook"
,
...
...
@@ -68,11 +68,4 @@ object InstallHelps {
}
})
}
private
fun
requestCfg
()
{
NewComUtils
.
requestCfg
{
TimerManager
.
changeTimer
()
}
}
}
\ No newline at end of file
app/src/main/java/com/base/locationsharewhite/helper/MyApplication.kt
View file @
07a8a13e
...
...
@@ -14,6 +14,7 @@ import com.base.locationsharewhite.bean.ConstObject.appLanguageCountrySp
import
com.base.locationsharewhite.bean.ConstObject.appLanguageSp
import
com.base.locationsharewhite.fcm.BatteryStatusReceiver
import
com.base.locationsharewhite.fcm.PackageStatusReceiver
import
com.base.locationsharewhite.fcm.PopupConstObject
import
com.base.locationsharewhite.fcm.ScreenStatusReceiver
import
com.base.locationsharewhite.fcm.alarm.AlarmUtils.startAlarm
import
com.base.locationsharewhite.helper.config.AppConfig
...
...
@@ -90,8 +91,15 @@ class MyApplication : Application() {
LogEx
.
logDebug
(
TAG
,
"topic=${topic} token=$token"
)
FCMManager
.
initFirebase
(
this
)
FCMManager
.
subscribeToTopic
(
topic
)
InstallHelps
.
init
()
initAdSdk
()
//初始化广告相关业务
AdsMgr
.
init
(
appContext
)
initConfig
()
InstallHelps
.
init
{
initRemoteConfig
()
}
initLifeListener
()
ScreenStatusReceiver
.
registerScreenStatusReceiver
(
this
)
...
...
@@ -171,22 +179,37 @@ class MyApplication : Application() {
})
}
private
fun
initAdSdk
()
{
private
fun
initRemoteConfig
()
{
NewComUtils
.
requestCfg
{
config
->
Log
.
e
(
"requestCfg"
,
"config=$config"
)
LogEx
.
logDebug
(
"requestCfg"
,
"config=$config"
)
AppPreferences
.
getInstance
().
put
(
"config"
,
config
)
initConfig
(
config
)
}
}
private
fun
initConfig
(
config
:
String
?
=
AppPreferences
.
getInstance
().
getString
(
"config"
,
""
))
{
kotlin
.
runCatching
{
val
configBean
=
Gson
().
fromJson
(
config
,
ConfigBean
::
class
.
java
)
Log
.
e
(
"requestCfg"
,
"configBean=$configBean"
)
val
jsonObject
=
JSONObject
()
jsonObject
.
put
(
"ut"
,
configBean
.
ut
)
EventUtils
.
event
(
"user_type"
,
ext
=
jsonObject
)
//配置
ConfigBean
.
configBean
=
configBean
//广告
AdsMgr
.
adsConfigBean
=
configBean
.
adConfigBean
//
初始化广告相关业务
AdsMgr
.
init
(
appContext
)
//
通知
PopupConstObject
.
popupConfigBean
=
configBean
.
popupConfigBean
}
}
...
...
app/src/main/java/com/base/locationsharewhite/helper/NewComUtils.kt
View file @
07a8a13e
...
...
@@ -5,13 +5,10 @@ import com.base.locationsharewhite.BuildConfig
import
com.base.locationsharewhite.helper.config.AppConfig
import
com.base.locationsharewhite.utils.AppPreferences
import
com.base.locationsharewhite.utils.LogEx
import
com.google.gson.Gson
import
com.google.gson.reflect.TypeToken
import
kotlinx.coroutines.CoroutineScope
import
kotlinx.coroutines.Dispatchers
import
kotlinx.coroutines.launch
import
kotlinx.coroutines.withContext
import
org.json.JSONObject
import
java.io.BufferedReader
import
java.io.InputStreamReader
import
java.net.HttpURLConnection
...
...
@@ -29,13 +26,13 @@ object NewComUtils {
val
appCode
=
packageName
.
substringAfter
(
PACKAGE_NAME_PREFIX
).
take
(
5
).
toLowerCase
(
Locale
.
getDefault
())
val
bRefer
=
android
.
util
.
Base64
.
encodeToString
(
AppPreferences
.
getInstance
().
getString
(
"
referrerUrl
"
,
""
).
toByteArray
(),
AppPreferences
.
getInstance
().
getString
(
"
install_referrer
"
,
""
).
toByteArray
(),
android
.
util
.
Base64
.
DEFAULT
)
"$API_URL/${appCode}spk?pkg=$packageName&referrer=${bRefer}&vn=${BuildConfig.VERSION_NAME}&vc=${BuildConfig.VERSION_CODE}&device=${
AppPreferences
.
getInstance
().
getString
(
"gid"
,
""
)
}&
aid
=
$
{
AppPreferences
.
getInstance
().
getString
(
"uuid"
,
""
)}
"
}&
aid
=
$
{
AppPreferences
.
getInstance
().
getString
(
"uuid"
,
""
)}
&
mode
=
4
"
// mode =3 google mode=2 facebook mode=1 自然,mode=4 测试
// &mode=3
...
...
app/src/main/java/com/base/locationsharewhite/ui/main/MainActivity.kt
View file @
07a8a13e
...
...
@@ -11,9 +11,11 @@ import androidx.core.view.updatePadding
import
androidx.lifecycle.lifecycleScope
import
com.base.locationsharewhite.BuildConfig
import
com.base.locationsharewhite.R
import
com.base.locationsharewhite.ads.AdsMgr
import
com.base.locationsharewhite.ads.AdsShowCallBack
import
com.base.locationsharewhite.ads.admob.AdBannerMgr
import
com.base.locationsharewhite.ads.admob.AdInsertMgr
import
com.base.locationsharewhite.config.ConfigBean
import
com.base.locationsharewhite.databinding.ActivityMainBinding
import
com.base.locationsharewhite.fcm.NotificationUiUtil.sendAllAllowedNotification
import
com.base.locationsharewhite.helper.BaseActivity
...
...
@@ -38,6 +40,8 @@ import com.google.android.gms.maps.OnMapReadyCallback
import
com.google.android.gms.maps.SupportMapFragment
import
com.google.android.gms.maps.model.LatLng
import
com.google.android.gms.maps.model.Marker
import
com.google.gson.Gson
import
org.json.JSONObject
import
java.util.concurrent.atomic.AtomicBoolean
/**
...
...
@@ -107,6 +111,10 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnMapReadyCallback {
showAllowAllTimeDialog
()
// changeLanguage(this)
val
c
=
ConfigBean
()
val
json
=
Gson
().
toJson
(
c
)
LogEx
.
logDebug
(
TAG
,
"json=$json"
)
}
private
fun
showNotificationDialog
()
{
...
...
@@ -200,7 +208,7 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnMapReadyCallback {
}
private
fun
showAdJump
(
jumpAction
:
()
->
Unit
)
{
Ad
InsertMgr
().
show
(
this
,
false
,
object
:
AdsShowCallBack
()
{
Ad
sMgr
.
showInsert
(
this
,
false
,
object
:
AdsShowCallBack
()
{
override
fun
close
()
{
jumpAction
.
invoke
()
}
...
...
app/src/main/java/com/base/locationsharewhite/ui/splash/SplashActivity.kt
View file @
07a8a13e
...
...
@@ -63,7 +63,7 @@ class SplashActivity : BaseActivity<ActivitySplashBinding>(), SplashView {
}
override
fun
agreePrivacy
()
{
AdsMgr
.
showOpen
(
this
,
fals
e
,
object
:
AdsShowCallBack
()
{
AdsMgr
.
showOpen
(
this
,
tru
e
,
object
:
AdsShowCallBack
()
{
override
fun
show
()
{
LogEx
.
logDebug
(
TAG
,
"AdsShowCallBack show"
)
splashPresenter
.
cancelJumpJob
()
...
...
app/src/main/java/com/base/locationsharewhite/ui/splash/SplashPresenter.kt
View file @
07a8a13e
package
com.base.locationsharewhite.ui.splash
import
androidx.lifecycle.LifecycleCoroutineScope
import
com.base.locationsharewhite.ads.AdsMgr.adsConfigBean
import
com.base.locationsharewhite.bean.ConstObject
import
com.base.locationsharewhite.helper.config.AdConstConfig.open_ad_loading
import
com.base.locationsharewhite.utils.AppPreferences
import
com.base.locationsharewhite.utils.LogEx
import
kotlinx.coroutines.Job
import
kotlinx.coroutines.delay
...
...
@@ -17,7 +16,7 @@ class SplashPresenter(
private
var
jumpJob
:
Job
?
=
null
var
loadingTime
=
AppPreferences
.
getInstance
().
getString
(
open_ad_loading
,
"15"
).
toInt
()
var
loadingTime
=
adsConfigBean
.
openAdLoading
var
startJumpJob
:
Boolean
=
false
...
...
@@ -29,7 +28,7 @@ class SplashPresenter(
if
(
jumpJob
==
null
)
{
val
startTime
=
System
.
currentTimeMillis
()
jumpJob
=
lifecycleCoroutineScope
.
launch
{
LogEx
.
logDebug
(
TAG
,
"
open_ad_loading
=$loadingTime"
)
LogEx
.
logDebug
(
TAG
,
"
loadingTime
=$loadingTime"
)
delay
(
loadingTime
*
1000L
)
val
endTime
=
System
.
currentTimeMillis
()
LogEx
.
logDebug
(
TAG
,
"超时跳转 time=${endTime - startTime}"
)
...
...
app/src/main/java/com/base/locationsharewhite/utils/ToastUtils.kt
View file @
07a8a13e
...
...
@@ -2,9 +2,12 @@ package com.base.locationsharewhite.utils
import
android.content.Context
import
android.widget.Toast
import
com.base.locationsharewhite.BuildConfig
object
ToastUtils
{
fun
Context
.
toast
(
content
:
String
)
{
Toast
.
makeText
(
this
,
content
,
Toast
.
LENGTH_SHORT
).
show
()
if
(
BuildConfig
.
DEBUG
)
{
Toast
.
makeText
(
this
,
content
,
Toast
.
LENGTH_SHORT
).
show
()
}
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment