Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
H
haiwaisdk
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
王志伟
haiwaisdk
Commits
6ee673d6
Commit
6ee673d6
authored
Mar 27, 2025
by
王志伟
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
海外sdkbug修改
parent
0e7249b9
Changes
73
Hide whitespace changes
Inline
Side-by-side
Showing
73 changed files
with
778 additions
and
463 deletions
+778
-463
build.gradle
app/build.gradle
+18
-20
google-services.json
app/google-services.json
+47
-0
halomobi_juhe_sdk_v1.0.0.aar
app/libs/halomobi_juhe_sdk_v1.0.0.aar
+0
-0
halomobi_juhe_sdk_v1.1.1.aar
app/libs/halomobi_juhe_sdk_v1.1.1.aar
+0
-0
halomobi_juhe_sdk_v1.1.2.aar
app/libs/halomobi_juhe_sdk_v1.1.2.aar
+0
-0
halomobi_sdk_v1.0.0.aar
app/libs/halomobi_sdk_v1.0.0.aar
+0
-0
halomobi_sdk_v1.1.0.aar
app/libs/halomobi_sdk_v1.1.0.aar
+0
-0
proguard-rules.pro
app/proguard-rules.pro
+3
-1
AndroidManifest.xml
app/src/main/AndroidManifest.xml
+11
-2
BannerActivity.kt
app/src/main/java/com/halo/halomobisdk/BannerActivity.kt
+47
-0
InsertActivity.kt
app/src/main/java/com/halo/halomobisdk/InsertActivity.kt
+4
-3
MainActivity.kt
app/src/main/java/com/halo/halomobisdk/MainActivity.kt
+8
-4
NativeActivity.kt
app/src/main/java/com/halo/halomobisdk/NativeActivity.kt
+12
-3
NativeUnifiedActivity.kt
...c/main/java/com/halo/halomobisdk/NativeUnifiedActivity.kt
+43
-32
RewardActivity.kt
app/src/main/java/com/halo/halomobisdk/RewardActivity.kt
+12
-3
SplashActivity.kt
app/src/main/java/com/halo/halomobisdk/SplashActivity.kt
+6
-3
activity_banner.xml
app/src/main/res/layout/activity_banner.xml
+10
-4
activity_main.xml
app/src/main/res/layout/activity_main.xml
+11
-2
activity_native.xml
app/src/main/res/layout/activity_native.xml
+2
-2
activity_reward.xml
app/src/main/res/layout/activity_reward.xml
+4
-4
activity_splash.xml
app/src/main/res/layout/activity_splash.xml
+2
-2
activity_untified_native.xml
app/src/main/res/layout/activity_untified_native.xml
+30
-0
item_unified_normal_layout.xml
app/src/main/res/layout/item_unified_normal_layout.xml
+39
-0
build.gradle
build.gradle
+7
-10
gradle-wrapper.properties
gradle/wrapper/gradle-wrapper.properties
+1
-1
build.gradle
haloJuheSdk/build.gradle
+13
-8
halomobi_sdk_v1.1.0.aar
haloJuheSdk/libs/halomobi_sdk_v1.1.0.aar
+0
-0
proguard-rules.pro
haloJuheSdk/proguard-rules.pro
+2
-2
INativeProxyListener.java
...m/halo/halojuhesdk/core/channel/INativeProxyListener.java
+1
-1
AppLovinBanner.java
...alo/halojuhesdk/core/channel/applovin/AppLovinBanner.java
+14
-19
AppLovinInsert.java
...alo/halojuhesdk/core/channel/applovin/AppLovinInsert.java
+19
-19
AppLovinNative.java
...alo/halojuhesdk/core/channel/applovin/AppLovinNative.java
+10
-5
AppLovinReward.java
...alo/halojuhesdk/core/channel/applovin/AppLovinReward.java
+11
-16
AppLovinSplash.java
...alo/halojuhesdk/core/channel/applovin/AppLovinSplash.java
+4
-5
AppLovinUnifiedNative.java
...ojuhesdk/core/channel/applovin/AppLovinUnifiedNative.java
+3
-20
HlApiBannerAd.java
...om/halo/halojuhesdk/core/channel/hlapi/HlApiBannerAd.java
+9
-5
HlApiInsertAd.java
...om/halo/halojuhesdk/core/channel/hlapi/HlApiInsertAd.java
+6
-10
HlApiNativeAd.java
...om/halo/halojuhesdk/core/channel/hlapi/HlApiNativeAd.java
+9
-32
HlApiRewardVideo.java
...halo/halojuhesdk/core/channel/hlapi/HlApiRewardVideo.java
+18
-4
HlApiUnifiedNativeAd.java
.../halojuhesdk/core/channel/hlapi/HlApiUnifiedNativeAd.java
+8
-20
HttpUrlSettings.java
...m/halo/halojuhesdk/core/common/utils/HttpUrlSettings.java
+1
-1
InitDataProcessor.java
.../com/halo/halojuhesdk/core/request/InitDataProcessor.java
+13
-32
InitDataTask.java
.../java/com/halo/halojuhesdk/core/request/InitDataTask.java
+1
-1
StatProcessor.java
...java/com/halo/halojuhesdk/core/request/StatProcessor.java
+0
-32
StatTask.java
...main/java/com/halo/halojuhesdk/core/request/StatTask.java
+2
-2
StatisProcessor.java
...va/com/halo/halojuhesdk/core/request/StatisProcessor.java
+0
-27
StatisTask.java
...in/java/com/halo/halojuhesdk/core/request/StatisTask.java
+1
-1
HlBannerAd.java
...dk/src/main/java/com/halo/halojuhesdk/sdk/HlBannerAd.java
+10
-2
HlInsertAd.java
...dk/src/main/java/com/halo/halojuhesdk/sdk/HlInsertAd.java
+11
-2
HlNativeAd.java
...dk/src/main/java/com/halo/halojuhesdk/sdk/HlNativeAd.java
+14
-7
HlNativeUnifiedAd.java
...main/java/com/halo/halojuhesdk/sdk/HlNativeUnifiedAd.java
+13
-9
HlSplashAd.java
...dk/src/main/java/com/halo/halojuhesdk/sdk/HlSplashAd.java
+5
-1
HlVideoAd.java
...Sdk/src/main/java/com/halo/halojuhesdk/sdk/HlVideoAd.java
+5
-1
HlNativeAdListener.java
...com/halo/halojuhesdk/sdk/listener/HlNativeAdListener.java
+1
-1
build.gradle
haloMobiSdk/build.gradle
+1
-3
proguard-rules.pro
haloMobiSdk/proguard-rules.pro
+1
-1
RequestAdProcessor.java
...a/com/halomobi/network/request/ad/RequestAdProcessor.java
+2
-0
AdRequest.java
.../java/com/halomobi/network/request/ad/bean/AdRequest.java
+28
-8
HMBannerAd.java
haloMobiSdk/src/main/java/com/halomobi/sdk/HMBannerAd.java
+39
-9
HMInsertAd.java
haloMobiSdk/src/main/java/com/halomobi/sdk/HMInsertAd.java
+58
-15
HMNativeAd.java
haloMobiSdk/src/main/java/com/halomobi/sdk/HMNativeAd.java
+28
-3
HMUnifiedNativeAd.java
...Sdk/src/main/java/com/halomobi/sdk/HMUnifiedNativeAd.java
+48
-14
HMVideoAd.java
haloMobiSdk/src/main/java/com/halomobi/sdk/HMVideoAd.java
+2
-0
HlAdParameter.java
...MobiSdk/src/main/java/com/halomobi/sdk/HlAdParameter.java
+12
-0
HlCustomView.java
haloMobiSdk/src/main/java/com/halomobi/sdk/HlCustomView.java
+4
-1
NativeResponseImpl.java
...dk/src/main/java/com/halomobi/sdk/NativeResponseImpl.java
+18
-0
RewardVideoActivity.java
...k/src/main/java/com/halomobi/sdk/RewardVideoActivity.java
+0
-5
WebViewActivity.java
...biSdk/src/main/java/com/halomobi/sdk/WebViewActivity.java
+0
-9
NativeResponse.java
...c/main/java/com/halomobi/sdk/listener/NativeResponse.java
+4
-0
RewardVideoListener.java
...n/java/com/halomobi/sdk/listener/RewardVideoListener.java
+4
-0
VASTModel.java
...iSdk/src/main/java/com/halomobi/vast/model/VASTModel.java
+2
-1
hl_dialog_banner.xml
haloMobiSdk/src/main/res/layout/hl_dialog_banner.xml
+1
-1
native_item_imag_single.xml
haloMobiSdk/src/main/res/layout/native_item_imag_single.xml
+5
-12
No files found.
app/build.gradle
View file @
6ee673d6
...
...
@@ -2,6 +2,7 @@ apply plugin: 'com.android.application'
apply
plugin:
'kotlin-android'
apply
plugin:
'kotlin-kapt'
apply
plugin:
'kotlin-parcelize'
apply
plugin:
'com.google.gms.google-services'
android
{
signingConfigs
{
...
...
@@ -15,15 +16,14 @@ android {
storeFile
file
(
"C:\\Users\\EDZ\\android\\debug.keystore"
)
}
}
compileSdkVersion
33
buildToolsVersion
"33.0.2"
compileSdkVersion
34
defaultConfig
{
applicationId
"com.
jjmillion.summer.game
"
applicationId
"com.
legame.bubbleshooter
"
minSdkVersion
21
targetSdkVersion
3
3
versionCode
516
versionName
"
5.1.6
"
targetSdkVersion
3
2
versionCode
100
versionName
"
1.0.0
"
multiDexEnabled
true
flavorDimensions
"versionCode"
ndk
{
...
...
@@ -51,15 +51,6 @@ android {
}
}
android
.
applicationVariants
.
all
{
variant
->
variant
.
outputs
.
all
{
//这里修改apk文件名
outputFileName
=
"fkkq-v${variant.versionName}.apk"
// outputFileName = "${variant.productFlavors[0].name}_v${variant.versionName}.apk"
}
}
packagingOptions
{
exclude
'META-INF.**'
exclude
"**.module-info.class"
...
...
@@ -89,14 +80,21 @@ repositories {
dependencies
{
// implementation fileTree(include: ['*.jar', '*.aar'], dir: 'libs')
implementation
'androidx.media:media:1.4.0'
implementation
'androidx.core:core-ktx:1.9.0'
implementation
'androidx.appcompat:appcompat:1.
4
.1'
implementation
'androidx.constraintlayout:constraintlayout:2.
1
.4'
implementation
'androidx.appcompat:appcompat:1.
6
.1'
implementation
'androidx.constraintlayout:constraintlayout:2.
0
.4'
implementation
'com.google.android.material:material:1.6.0'
implementation
(
"com.guolindev.permissionx:permissionx:1.7.1"
)
implementation
'com.google.android.gms:play-services-ads-identifier:18.0.1'
implementation
'com.applovin:applovin-sdk:12.0.0'
implementation
'com.sensorsdata.analytics.android:SensorsAnalyticsSDK:6.6.7'
// implementation (name:'halomobi_juhe_sdk_v1.0.0',ext:'aar')
implementation
(
"com.google.android.gms:play-services-ads:20.6.0"
)
implementation
'com.google.android.gms:play-services-base:18.0.1'
implementation
(
"com.applovin:applovin-sdk:13.0.1"
)
implementation
'com.applovin.mediation:google-adapter:23.5.0.0'
implementation
'com.applovin.mediation:mintegral-adapter:16.8.71.0'
implementation
(
"com.applovin.mediation:bytedance-adapter:6.3.0.4.0"
)
implementation
'com.applovin.mediation:unityads-adapter:4.12.4.0'
// implementation (name:'halomobi_juhe_sdk_v1.1.2',ext:'aar')
// implementation (name:'halomobi_sdk_v1.1.0',ext:'aar')
implementation
project
(
':haloJuheSdk'
)
}
app/google-services.json
0 → 100644
View file @
6ee673d6
{
"project_info"
:
{
"project_number"
:
"443220660668"
,
"project_id"
:
"scores-387808"
,
"storage_bucket"
:
"scores-387808.appspot.com"
},
"client"
:
[
{
"client_info"
:
{
"mobilesdk_app_id"
:
"1:443220660668:android:6709001bb41c513c8a5bb9"
,
"android_client_info"
:
{
"package_name"
:
"com.legame.bubbleshooter"
}
},
"oauth_client"
:
[
{
"client_id"
:
"443220660668-3pa7svoi1j82h842gpvv9d9j53h418b9.apps.googleusercontent.com"
,
"client_type"
:
3
}
],
"api_key"
:
[
{
"current_key"
:
"AIzaSyBuaAF_fQMcDSakzz-BD8sOHmQ95OSthVY"
}
],
"services"
:
{
"appinvite_service"
:
{
"other_platform_oauth_client"
:
[
{
"client_id"
:
"443220660668-3pa7svoi1j82h842gpvv9d9j53h418b9.apps.googleusercontent.com"
,
"client_type"
:
3
},
{
"client_id"
:
"443220660668-gvvsmajs7fafd7qejv1pihcgej7d2098.apps.googleusercontent.com"
,
"client_type"
:
2
,
"ios_info"
:
{
"bundle_id"
:
"com.legame.bubbleshooter"
,
"app_store_id"
:
"6449077229"
}
}
]
}
}
}
],
"configuration_version"
:
"1"
}
\ No newline at end of file
app/libs/halomobi_juhe_sdk_v1.0.0.aar
deleted
100644 → 0
View file @
0e7249b9
File deleted
app/libs/halomobi_juhe_sdk_v1.1.1.aar
0 → 100644
View file @
6ee673d6
File added
app/libs/halomobi_juhe_sdk_v1.1.2.aar
0 → 100644
View file @
6ee673d6
File added
app/libs/halomobi_sdk_v1.0.0.aar
deleted
100644 → 0
View file @
0e7249b9
File deleted
app/libs/halomobi_sdk_v1.1.0.aar
0 → 100644
View file @
6ee673d6
File added
app/proguard-rules.pro
View file @
6ee673d6
...
...
@@ -18,4 +18,6 @@
#
If
you
keep
the
line
number
information
,
uncomment
this
to
#
hide
the
original
source
file
name
.
#-
renamesourcefileattribute
SourceFile
\ No newline at end of file
#-
renamesourcefileattribute
SourceFile
-
keep
public
class
com
.
halo
.
halojuhesdk
.
sdk
.
**
{
*
;}
-
keep
public
class
com
.
halomobi
.
**
{
*
;}
\ No newline at end of file
app/src/main/AndroidManifest.xml
View file @
6ee673d6
...
...
@@ -9,6 +9,9 @@
<uses-permission
android:name=
"android.permission.SCHEDULE_EXACT_ALARM"
/>
<uses-permission
android:name=
"android.permission.READ_PHONE_STATE"
/>
<uses-permission
android:name=
"android.permission.BLUETOOTH"
/>
<uses-permission
android:name=
"android.permission.BLUETOOTH_ADMIN"
/>
<application
android:allowBackup=
"true"
android:fullBackupContent=
"@xml/backup_rules"
...
...
@@ -21,8 +24,12 @@
android:theme=
"@style/Theme.HaloMobiSdk"
>
<meta-data
android:name=
"applovin.sdk.key"
android:value=
"TAVI1U8OIXyhL9egaWLlPirxWNem6hJ82OivKgwNQcvKoUT_XkgPvx3qUGk42s1tXmHQvd6OTLoRl5QaxLdIyU"
/>
android:name=
"com.google.android.gms.ads.AD_MANAGER_APP"
android:value=
"true"
/>
<meta-data
android:name=
"com.google.android.gms.ads.APPLICATION_ID"
android:value=
"ca-app-pub-3940256099942544~3347511713"
/>
<uses-library
android:name=
"org.apache.http.legacy"
...
...
@@ -44,10 +51,12 @@
<activity
android:name=
"com.halo.halomobisdk.BannerActivity"
/>
<activity
android:name=
"com.halo.halomobisdk.InsertActivity"
/>
<activity
android:name=
"com.halo.halomobisdk.NativeActivity"
/>
<activity
android:name=
"com.halo.halomobisdk.NativeUnifiedActivity"
/>
<activity
android:name=
"com.halo.halomobisdk.RewardActivity"
/>
<activity
android:name=
"com.halomobi.sdk.RewardVideoActivity"
android:configChanges=
"orientation|screenSize|keyboardHidden"
/>
</application>
</manifest>
\ No newline at end of file
app/src/main/java/com/halo/halomobisdk/BannerActivity.kt
View file @
6ee673d6
package
com.halo.halomobisdk
import
android.content.Context
import
android.graphics.Point
import
android.os.Bundle
import
android.util.Log
import
android.view.View
import
android.view.WindowManager
import
android.widget.Button
import
android.widget.RelativeLayout
import
android.widget.Toast
import
androidx.appcompat.app.AppCompatActivity
import
com.applovin.impl.wm
import
com.halo.halojuhesdk.sdk.HlBannerAd
import
com.halo.halojuhesdk.sdk.listener.HlBannerListener
import
com.halomobi.halomobisdk.R
class
BannerActivity
:
AppCompatActivity
()
{
private
val
TAG
:
String
=
"BannerActivity"
private
var
bannerContainer
:
RelativeLayout
?
=
null
private
var
hlBannerAd
:
HlBannerAd
?
=
null
override
fun
onCreate
(
savedInstanceState
:
Bundle
?)
{
super
.
onCreate
(
savedInstanceState
)
setContentView
(
R
.
layout
.
activity_banner
)
bannerContainer
=
findViewById
(
R
.
id
.
bannerContainer
)
findViewById
<
Button
>(
R
.
id
.
load
).
setOnClickListener
{
loadBannerAd
()
}
findViewById
<
Button
>(
R
.
id
.
show
).
visibility
=
View
.
GONE
}
private
fun
loadBannerAd
()
{
hlBannerAd
=
HlBannerAd
(
this
,
"2931001"
,
300
,
250
,
object
:
HlBannerListener
{
override
fun
onDisplayAd
(
adType
:
String
?)
{
}
override
fun
onClickAd
(
adType
:
String
?)
{
}
override
fun
onCloseAd
()
{
}
override
fun
onAdReady
(
adType
:
String
?)
{
hlBannerAd
?.
showView
(
bannerContainer
)
}
override
fun
onAdError
(
msg
:
String
,
code
:
Int
)
{
Log
.
e
(
TAG
,
"onAdError$msg$code"
)
Toast
.
makeText
(
this
@BannerActivity
,
msg
,
Toast
.
LENGTH_SHORT
).
show
()
}
})
hlBannerAd
?.
loadAd
()
}
override
fun
onDestroy
()
{
super
.
onDestroy
()
hlBannerAd
?.
release
()
}
}
\ No newline at end of file
app/src/main/java/com/halo/halomobisdk/InsertActivity.kt
View file @
6ee673d6
package
com.halo.halomobisdk
import
android.os.Bundle
import
android.widget.Button
import
android.widget.TextView
import
android.widget.Toast
import
androidx.appcompat.app.AppCompatActivity
...
...
@@ -16,17 +17,17 @@ class InsertActivity : AppCompatActivity(){
override
fun
onCreate
(
savedInstanceState
:
Bundle
?)
{
super
.
onCreate
(
savedInstanceState
)
setContentView
(
R
.
layout
.
activity_banner
)
findViewById
<
TextView
>(
R
.
id
.
load
).
setOnClickListener
{
findViewById
<
Button
>(
R
.
id
.
load
).
setOnClickListener
{
loadInsertAd
()
}
findViewById
<
TextView
>(
R
.
id
.
show
).
setOnClickListener
{
findViewById
<
Button
>(
R
.
id
.
show
).
setOnClickListener
{
hlInsertAd
?.
show
()
}
}
private
fun
loadInsertAd
()
{
hlInsertAd
=
HlInsertAd
(
this
,
"2
720709"
,
object
:
hlInsertAd
=
HlInsertAd
(
this
,
"2
931701"
,
480
,
320
,
object
:
HlInsertAdListener
{
override
fun
onDisplayAd
()
{
}
...
...
app/src/main/java/com/halo/halomobisdk/MainActivity.kt
View file @
6ee673d6
package
com.halo.halomobisdk
import
android.bluetooth.BluetoothDevice
import
android.content.Intent
import
android.content.IntentFilter
import
android.os.Bundle
import
android.util.Log
import
android.view.View
...
...
@@ -21,7 +23,6 @@ class MainActivity : AppCompatActivity(), OnClickListener {
super
.
onCreate
(
savedInstanceState
)
setContentView
(
R
.
layout
.
activity_main
)
// Initialize the AppLovin SDK
Thread
{
val
ifa
:
String
?
=
getIfa
()
Log
.
e
(
"11111"
,
"===ifa===$ifa"
)
val
jsonObject
=
JSONObject
()
...
...
@@ -32,8 +33,7 @@ class MainActivity : AppCompatActivity(), OnClickListener {
}
catch
(
e
:
JSONException
)
{
e
.
printStackTrace
()
}
HlAdClient
.
init
(
this
,
"27207"
,
jsonObject
.
toString
(),
false
,
true
)
}.
start
()
HlAdClient
.
init
(
this
,
"29317"
,
jsonObject
.
toString
(),
false
,
true
)
val
mTvSplash
=
findViewById
<
TextView
>(
R
.
id
.
tv_splash
)
mTvSplash
.
setOnClickListener
(
this
)
val
mTvBanner
=
findViewById
<
TextView
>(
R
.
id
.
tv_banner
)
...
...
@@ -42,11 +42,12 @@ class MainActivity : AppCompatActivity(), OnClickListener {
mTvInsert
.
setOnClickListener
(
this
)
val
mTvNative
=
findViewById
<
TextView
>(
R
.
id
.
tv_native
)
mTvNative
.
setOnClickListener
(
this
)
val
mTvUnifiedNative
=
findViewById
<
TextView
>(
R
.
id
.
tv_unified_native
)
mTvUnifiedNative
.
setOnClickListener
(
this
)
val
mTvVideo
=
findViewById
<
TextView
>(
R
.
id
.
tv_video
)
mTvVideo
.
setOnClickListener
(
this
)
val
mTvSelect
=
findViewById
<
TextView
>(
R
.
id
.
tv_select
)
mTvSelect
.
setOnClickListener
(
this
)
}
override
fun
onClick
(
v
:
View
)
{
...
...
@@ -63,6 +64,9 @@ class MainActivity : AppCompatActivity(), OnClickListener {
R
.
id
.
tv_native
->
{
startActivity
(
Intent
(
this
,
NativeActivity
::
class
.
java
))
}
R
.
id
.
tv_unified_native
->
{
startActivity
(
Intent
(
this
,
NativeUnifiedActivity
::
class
.
java
))
}
R
.
id
.
tv_video
->
{
startActivity
(
Intent
(
this
,
RewardActivity
::
class
.
java
))
}
...
...
app/src/main/java/com/halo/halomobisdk/NativeActivity.kt
View file @
6ee673d6
...
...
@@ -2,6 +2,7 @@ package com.halo.halomobisdk
import
android.os.Bundle
import
android.view.View
import
android.widget.Button
import
android.widget.TextView
import
android.widget.Toast
import
androidx.appcompat.app.AppCompatActivity
...
...
@@ -18,7 +19,7 @@ class NativeActivity : AppCompatActivity() {
override
fun
onCreate
(
savedInstanceState
:
Bundle
?)
{
super
.
onCreate
(
savedInstanceState
)
setContentView
(
R
.
layout
.
activity_native
)
findViewById
<
TextView
>(
R
.
id
.
load
).
setOnClickListener
{
findViewById
<
Button
>(
R
.
id
.
load
).
setOnClickListener
{
loadNativeAd
()
}
mConstraintLayout
=
findViewById
(
R
.
id
.
constraint
)
...
...
@@ -26,8 +27,8 @@ class NativeActivity : AppCompatActivity() {
}
private
fun
loadNativeAd
()
{
hlNativeAd
=
HlNativeAd
(
this
,
"2
686404"
,
object
:
HlNativeAdListener
{
override
fun
onADLoadView
(
view
:
View
?,
adTypeStr
:
String
,
ratio
:
Float
)
{
hlNativeAd
=
HlNativeAd
(
this
,
"2
909703"
,
500
,
500
,
1
,
object
:
HlNativeAdListener
{
override
fun
onADLoadView
(
view
:
View
?,
adTypeStr
:
String
)
{
mConstraintLayout
?.
removeAllViews
()
mConstraintLayout
?.
addView
(
view
)
val
ecpmMap
=
hlNativeAd
?.
ecpmMap
...
...
@@ -54,4 +55,12 @@ class NativeActivity : AppCompatActivity() {
})
hlNativeAd
?.
loadData
()
}
override
fun
onDestroy
()
{
super
.
onDestroy
()
if
(
hlNativeAd
!=
null
)
{
hlNativeAd
?.
release
()
hlNativeAd
=
null
}
}
}
\ No newline at end of file
app/src/main/java/com/halo/halomobisdk/NativeUnifiedActivity.kt
View file @
6ee673d6
...
...
@@ -2,48 +2,59 @@ package com.halo.halomobisdk
import
android.os.Bundle
import
android.view.View
import
android.widget.Button
import
android.widget.RelativeLayout
import
android.widget.TextView
import
android.widget.Toast
import
androidx.appcompat.app.AppCompatActivity
import
androidx.constraintlayout.widget.ConstraintLayout
import
com.applovin.mediation.nativeAds.MaxNativeAdView
import
com.halo.halojuhesdk.sdk.HlNativeUnifiedAd
import
com.halo.halojuhesdk.sdk.HlUnifiedAdParameter
import
com.halo.halojuhesdk.sdk.listener.HlNativeAdListener
import
com.halo.halojuhesdk.sdk.listener.HlNativeResponse
import
com.halo.halojuhesdk.sdk.listener.HlUnifiedNativeAdListener
import
com.halomobi.halomobisdk.R
class
NativeUnifiedActivity
:
AppCompatActivity
()
{
private
var
mConstraintLayout
:
RelativeLayout
?
=
null
private
var
hlUnifiedNativeAd
:
HlNativeUnifiedAd
?
=
null
override
fun
onCreate
(
savedInstanceState
:
Bundle
?)
{
super
.
onCreate
(
savedInstanceState
)
setContentView
(
R
.
layout
.
activity_native
)
val
mConstraintLayout
=
findViewById
<
ConstraintLayout
>(
R
.
id
.
constraint
)
// val hlNativeAd = HlNativeUnifiedAd(this, "2864604", object : HlUnifiedNativeAdListener {
// override fun onAdLoadSuccess(response: HlNativeResponse?) {
// if (response != null) {
// val selfView =
// View.inflate(this@NativeUnifiedActivity, R.layout.item_unified_native, null)
//// val adView: MaxNativeAdView = createNativeAdView()
//
// // Check if ad is expired before rendering
//
// // Check if ad is expired before rendering
//// if (nativeAd.getNativeAd() != null && nativeAd.getNativeAd().isExpired()) {
//// // Destroy expired ad and load a new one
//// nativeAdLoader.destroy(nativeAd)
//// nativeAdLoader.loadAd()
//// showAdButton.setEnabled(false)
//// return
//// }
////
//// // Render the ad separately
////
//// // Render the ad separately
//// nativeAdLoader.render(adView, nativeAd)
//// nativeAdLayout.addView(adView)
// }
// }
// override fun onAdLoadFail(msg: String?, cod: Int) {
// }
// })
// hlNativeAd.loadData()
setContentView
(
R
.
layout
.
activity_untified_native
)
mConstraintLayout
=
findViewById
(
R
.
id
.
constraint
)
findViewById
<
Button
>(
R
.
id
.
load
).
setOnClickListener
{
loadNativeAd
()
}
}
private
fun
loadNativeAd
()
{
val
builder
=
HlUnifiedAdParameter
.
Builder
()
builder
.
setAdLayoutId
(
R
.
layout
.
item_unified_normal_layout
)
.
setAdContentId
(
R
.
id
.
media_view_container
).
setAdTitleId
(
R
.
id
.
tv_title
).
setAdBodyTitleId
(
R
.
id
.
tv_sub_title
)
.
setAdOptionsId
(
R
.
id
.
options_view
)
hlUnifiedNativeAd
=
HlNativeUnifiedAd
(
this
,
"2909703"
,
builder
.
build
(),
300
,
300
,
object
:
HlNativeAdListener
{
override
fun
onADLoadView
(
view
:
View
,
adTypeStr
:
String
)
{
mConstraintLayout
?.
addView
(
view
)
}
override
fun
onADClick
(
view
:
View
?,
adTypeStr
:
String
)
{
}
override
fun
onADShow
(
view
:
View
?,
adTypeStr
:
String
)
{
}
override
fun
onADClose
(
view
:
View
?)
{
mConstraintLayout
?.
removeView
(
view
)
}
override
fun
onADError
(
errorMsg
:
String
?,
errorCode
:
Int
)
{
Toast
.
makeText
(
this
@NativeUnifiedActivity
,
errorMsg
,
Toast
.
LENGTH_SHORT
).
show
()
}
})
hlUnifiedNativeAd
?.
loadData
()
}
}
\ No newline at end of file
app/src/main/java/com/halo/halomobisdk/RewardActivity.kt
View file @
6ee673d6
package
com.halo.halomobisdk
import
android.os.Bundle
import
android.util.Log
import
android.widget.Button
import
android.widget.TextView
import
android.widget.Toast
import
androidx.appcompat.app.AppCompatActivity
...
...
@@ -16,16 +18,16 @@ class RewardActivity : AppCompatActivity() {
super
.
onCreate
(
savedInstanceState
)
setContentView
(
R
.
layout
.
activity_reward
)
findViewById
<
TextView
>(
R
.
id
.
load
).
setOnClickListener
{
findViewById
<
Button
>(
R
.
id
.
load
).
setOnClickListener
{
loadRewardAd
()
}
findViewById
<
TextView
>(
R
.
id
.
show
).
setOnClickListener
{
findViewById
<
Button
>(
R
.
id
.
show
).
setOnClickListener
{
hlVideoAd
?.
show
()
}
}
private
fun
loadRewardAd
()
{
hlVideoAd
=
HlVideoAd
(
this
,
"2
686403
"
,
object
:
HlVideoListener
{
hlVideoAd
=
HlVideoAd
(
this
,
"2
946704
"
,
object
:
HlVideoListener
{
override
fun
onSuccess
()
{
Toast
.
makeText
(
this
@RewardActivity
,
"==onSuccess===${hlVideoAd?.ecpm}"
,
Toast
.
LENGTH_SHORT
).
show
()
val
ecpmMap
=
hlVideoAd
?.
ecpmMap
...
...
@@ -41,21 +43,28 @@ class RewardActivity : AppCompatActivity() {
}
override
fun
onAdShow
()
{
Log
.
e
(
"11111"
,
"====onAdShow==="
)
}
override
fun
onAdClose
()
{
Log
.
e
(
"11111"
,
"====onAdClose==="
)
}
override
fun
onAdClick
()
{
}
override
fun
onPlayEnd
()
{
Log
.
e
(
"11111"
,
"====onPlayEnd==="
)
Toast
.
makeText
(
this
@RewardActivity
,
"==onPlayEnd==="
,
Toast
.
LENGTH_SHORT
).
show
()
}
override
fun
onSkipped
()
{
Log
.
e
(
"11111"
,
"====onSkipped==="
)
}
override
fun
onRewardArrived
()
{
Log
.
e
(
"11111"
,
"====onRewardArrived==="
)
Toast
.
makeText
(
this
@RewardActivity
,
"==onRewardArrived==="
,
Toast
.
LENGTH_SHORT
).
show
()
}
})
hlVideoAd
?.
loadAd
()
...
...
app/src/main/java/com/halo/halomobisdk/SplashActivity.kt
View file @
6ee673d6
package
com.halo.halomobisdk
import
android.os.Bundle
import
android.widget.Button
import
android.widget.TextView
import
android.widget.Toast
import
androidx.appcompat.app.AppCompatActivity
import
com.halo.halojuhesdk.sdk.HlSplashAd
import
com.halo.halojuhesdk.sdk.listener.HlSplashAdListener
...
...
@@ -15,17 +17,17 @@ class SplashActivity : AppCompatActivity(){
override
fun
onCreate
(
savedInstanceState
:
Bundle
?)
{
super
.
onCreate
(
savedInstanceState
)
setContentView
(
R
.
layout
.
activity_splash
)
findViewById
<
TextView
>(
R
.
id
.
load
).
setOnClickListener
{
findViewById
<
Button
>(
R
.
id
.
load
).
setOnClickListener
{
loadInsertAd
()
}
findViewById
<
TextView
>(
R
.
id
.
show
).
setOnClickListener
{
findViewById
<
Button
>(
R
.
id
.
show
).
setOnClickListener
{
hlSplashAd
?.
showAd
()
}
}
private
fun
loadInsertAd
()
{
hlSplashAd
=
HlSplashAd
(
this
,
"2
6864
01"
,
findViewById
(
R
.
id
.
constraint
),
object
:
HlSplashAdListener
{
hlSplashAd
=
HlSplashAd
(
this
,
"2
7207
01"
,
findViewById
(
R
.
id
.
constraint
),
object
:
HlSplashAdListener
{
override
fun
onReadyAd
(
adTypeStr
:
String
)
{
val
ecpmMap
=
hlSplashAd
?.
ecpmMap
val
jsonObject
=
JSONObject
()
...
...
@@ -45,6 +47,7 @@ class SplashActivity : AppCompatActivity(){
}
override
fun
onAdError
(
msg
:
String
?,
code
:
Int
)
{
Toast
.
makeText
(
this
@SplashActivity
,
msg
,
Toast
.
LENGTH_SHORT
).
show
()
}
override
fun
onAdSkip
()
{
...
...
app/src/main/res/layout/activity_banner.xml
View file @
6ee673d6
...
...
@@ -4,19 +4,19 @@
android:layout_height=
"match_parent"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
>
<
TextView
<
Button
android:id=
"@+id/load"
android:layout_width=
"match_parent"
android:layout_height=
"
4
0dp"
android:layout_height=
"
6
0dp"
android:text=
"加载"
android:textSize=
"20dp"
android:gravity=
"center"
app:layout_constraintTop_toTopOf=
"parent"
/>
<
TextView
<
Button
android:id=
"@+id/show"
android:layout_width=
"match_parent"
android:layout_height=
"
4
0dp"
android:layout_height=
"
6
0dp"
android:text=
"展示"
android:textSize=
"20dp"
android:layout_marginTop=
"20dp"
...
...
@@ -30,4 +30,10 @@
android:layout_marginTop=
"20dp"
android:textSize=
"20dp"
app:layout_constraintTop_toBottomOf=
"@id/show"
/>
<RelativeLayout
android:id=
"@+id/bannerContainer"
android:layout_width=
"match_parent"
android:layout_height=
"50dp"
app:layout_constraintBottom_toBottomOf=
"parent"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
app/src/main/res/layout/activity_main.xml
View file @
6ee673d6
...
...
@@ -20,7 +20,6 @@
android:layout_height=
"60dp"
android:text=
"横幅"
android:gravity=
"center"
android:visibility=
"gone"
android:textSize=
"20sp"
android:textColor=
"@color/black"
app:layout_constraintTop_toBottomOf=
"@id/tv_splash"
/>
...
...
@@ -45,6 +44,16 @@
android:textColor=
"@color/black"
app:layout_constraintTop_toBottomOf=
"@id/tv_insert"
/>
<TextView
android:id=
"@+id/tv_unified_native"
android:layout_width=
"match_parent"
android:layout_height=
"60dp"
android:text=
"自渲染信息流"
android:gravity=
"center"
android:textSize=
"20sp"
android:textColor=
"@color/black"
app:layout_constraintTop_toBottomOf=
"@id/tv_native"
/>
<TextView
android:id=
"@+id/tv_video"
android:layout_width=
"match_parent"
...
...
@@ -53,7 +62,7 @@
android:gravity=
"center"
android:textSize=
"20sp"
android:textColor=
"@color/black"
app:layout_constraintTop_toBottomOf=
"@id/tv_native"
/>
app:layout_constraintTop_toBottomOf=
"@id/tv_
unified_
native"
/>
<TextView
android:id=
"@+id/tv_select"
...
...
app/src/main/res/layout/activity_native.xml
View file @
6ee673d6
...
...
@@ -4,10 +4,10 @@
android:layout_height=
"match_parent"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
>
<
TextView
<
Button
android:id=
"@+id/load"
android:layout_width=
"match_parent"
android:layout_height=
"
4
0dp"
android:layout_height=
"
6
0dp"
android:text=
"加载"
android:textSize=
"20dp"
android:gravity=
"center"
...
...
app/src/main/res/layout/activity_reward.xml
View file @
6ee673d6
...
...
@@ -4,19 +4,19 @@
android:layout_height=
"match_parent"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
>
<
TextView
<
Button
android:id=
"@+id/load"
android:layout_width=
"match_parent"
android:layout_height=
"
4
0dp"
android:layout_height=
"
6
0dp"
android:text=
"加载"
android:textSize=
"20dp"
android:gravity=
"center"
app:layout_constraintTop_toTopOf=
"parent"
/>
<
TextView
<
Button
android:id=
"@+id/show"
android:layout_width=
"match_parent"
android:layout_height=
"
4
0dp"
android:layout_height=
"
6
0dp"
android:text=
"展示"
android:textSize=
"20dp"
android:layout_marginTop=
"20dp"
...
...
app/src/main/res/layout/activity_splash.xml
View file @
6ee673d6
...
...
@@ -4,7 +4,7 @@
android:layout_height=
"match_parent"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
>
<
TextView
<
Button
android:id=
"@+id/load"
android:layout_width=
"match_parent"
android:layout_height=
"40dp"
...
...
@@ -13,7 +13,7 @@
android:gravity=
"center"
app:layout_constraintTop_toTopOf=
"parent"
/>
<
TextView
<
Button
android:id=
"@+id/show"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
...
...
app/src/main/res/layout/activity_untified_native.xml
0 → 100644
View file @
6ee673d6
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
>
<Button
android:id=
"@+id/load"
android:layout_width=
"match_parent"
android:layout_height=
"60dp"
android:text=
"加载"
android:textSize=
"20dp"
android:gravity=
"center"
app:layout_constraintTop_toTopOf=
"parent"
/>
<TextView
android:id=
"@+id/price_show"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"20dp"
android:textSize=
"20dp"
app:layout_constraintTop_toBottomOf=
"@id/load"
/>
<RelativeLayout
android:id=
"@+id/constraint"
android:layout_width=
"match_parent"
android:layout_height=
"300dp"
android:layout_marginTop=
"20dp"
app:layout_constraintTop_toBottomOf=
"@id/price_show"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
app/src/main/res/layout/item_unified_normal_layout.xml
0 → 100644
View file @
6ee673d6
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
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"
android:orientation=
"vertical"
android:background=
"@color/white"
>
<FrameLayout
android:id=
"@+id/media_view_container"
android:layout_width=
"match_parent"
android:layout_height=
"200dp"
app:layout_constraintTop_toTopOf=
"parent"
/>
<TextView
android:id=
"@+id/tv_title"
android:layout_width=
"match_parent"
android:layout_height=
"30dp"
app:layout_constraintTop_toBottomOf=
"@id/media_view_container"
/>
<TextView
android:id=
"@+id/tv_sub_title"
android:layout_width=
"match_parent"
android:layout_height=
"30dp"
app:layout_constraintTop_toBottomOf=
"@id/tv_title"
/>
<FrameLayout
android:id=
"@+id/options_view"
android:layout_width=
"15dp"
android:layout_height=
"15dp"
android:layout_marginStart=
"6dp"
android:layout_marginTop=
"6dp"
android:visibility=
"gone"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
/>
</LinearLayout>
build.gradle
View file @
6ee673d6
...
...
@@ -6,32 +6,29 @@ buildscript {
jcenter
()
mavenCentral
()
maven
{
url
"https://jitpack.io"
}
maven
{
url
'https://maven.google.com'
}
maven
{
url
"https://maven.aliyun.com/repository/public"
}
maven
{
url
'https://repo1.maven.org/maven2/'
}
maven
{
url
'https://artifact.bytedance.com/repository/pangle'
}
maven
{
url
"https://dl-maven-android.mintegral.com/repository/mbridge_android_sdk_oversea"
}
maven
{
url
"https://artifact.bytedance.com/repository/pangle"
}
}
dependencies
{
classpath
"com.android.tools.build:gradle:
4
.2.2"
classpath
"com.android.tools.build:gradle:
7
.2.2"
classpath
"org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath
'com.google.gms:google-services:4.3.15'
}
}
//plugins {
// id "com.hi.dhl.plugin" apply false
//}
allprojects
{
repositories
{
google
()
jcenter
()
mavenCentral
()
maven
{
url
"https://jitpack.io"
}
maven
{
url
'https://maven.google.com'
}
maven
{
url
"https://maven.aliyun.com/repository/public"
}
maven
{
url
'https://repo1.maven.org/maven2/'
}
maven
{
url
'https://artifact.bytedance.com/repository/pangle'
}
maven
{
url
"https://dl-maven-android.mintegral.com/repository/mbridge_android_sdk_oversea"
}
maven
{
url
"https://artifact.bytedance.com/repository/pangle"
}
}
}
...
...
gradle/wrapper/gradle-wrapper.properties
View file @
6ee673d6
distributionBase
=
GRADLE_USER_HOME
distributionPath
=
wrapper/dists
distributionUrl
=
https
\:
//services.gradle.org/distributions/gradle-7.
2
-bin.zip
distributionUrl
=
https
\:
//services.gradle.org/distributions/gradle-7.
5
-bin.zip
zipStoreBase
=
GRADLE_USER_HOME
zipStorePath
=
wrapper/dists
haloJuheSdk/build.gradle
View file @
6ee673d6
...
...
@@ -5,12 +5,10 @@ android {
defaultConfig
{
minSdkVersion
21
targetSdkVersion
33
versionCode
1000
versionName
"1.0.0.0"
}
def
SDK_CHANNEL
=
"halomobi_juhe_sdk"
def
SDK_VERSION
=
"1.
0.0
"
def
SDK_VERSION
=
"1.
1.2
"
def
SDK_BASENAME
=
SDK_CHANNEL
+
"_v"
+
SDK_VERSION
repositories
{
...
...
@@ -41,10 +39,17 @@ android {
}
dependencies
{
implementation
(
"androidx.appcompat:appcompat:1.
4
.1"
)
implementation
(
"androidx.appcompat:appcompat:1.
6
.1"
)
implementation
(
"com.google.android.material:material:1.6.0"
)
implementation
(
"com.applovin:applovin-sdk:12.0.0"
)
implementation
'com.sensorsdata.analytics.android:SensorsAnalyticsSDK:6.6.7'
// implementation (name:'halomobi_sdk_v1.0.0',ext:'aar')
implementation
project
(
':haloMobiSdk'
)
implementation
'com.github.bumptech.glide:glide:4.16.0'
implementation
(
"com.applovin:applovin-sdk:13.0.1"
)
implementation
'com.google.android.gms:play-services-ads-identifier:18.1.0'
implementation
'com.google.android.gms:play-services-base:18.5.0'
implementation
(
"com.google.android.gms:play-services-ads:23.3.0"
)
implementation
'com.applovin.mediation:google-adapter:23.5.0.0'
implementation
'com.applovin.mediation:mintegral-adapter:16.8.71.0'
implementation
(
"com.applovin.mediation:bytedance-adapter:6.3.0.4.0"
)
implementation
'com.applovin.mediation:unityads-adapter:4.12.4.0'
implementation
(
name:
'halomobi_sdk_v1.1.0'
,
ext:
'aar'
)
// implementation project(':haloMobiSdk')
}
haloJuheSdk/libs/halomobi_sdk_v1.1.0.aar
0 → 100644
View file @
6ee673d6
File added
haloJuheSdk/proguard-rules.pro
View file @
6ee673d6
...
...
@@ -20,5 +20,5 @@
#
hide
the
original
source
file
name
.
#-
renamesourcefileattribute
SourceFile
-
keep
public
class
com
.
halomobi
.
sdk
.
**
{
*
;}
-
keep
public
class
com
.
halo
.
halojuhesdk
.
sdk
.
**
{
*
;}
\ No newline at end of file
-
keep
public
class
com
.
halo
.
halojuhesdk
.
sdk
.
**
{
*
;}
-
keep
public
class
com
.
halomobi
.
**
{
*
;}
\ No newline at end of file
haloJuheSdk/src/main/java/com/halo/halojuhesdk/core/channel/INativeProxyListener.java
View file @
6ee673d6
...
...
@@ -14,7 +14,7 @@ public interface INativeProxyListener {
/**
* 广告被展示(主线程回调)
*/
void
onADLoadView
(
View
view
,
String
adType
,
SlotBean
slotBean
,
double
ecpm
,
String
adSubType
,
float
ratio
);
void
onADLoadView
(
View
view
,
String
adType
,
SlotBean
slotBean
,
double
ecpm
,
String
adSubType
);
/**
* 广告被点击(主线程回调)
...
...
haloJuheSdk/src/main/java/com/halo/halojuhesdk/core/channel/applovin/AppLovinBanner.java
View file @
6ee673d6
...
...
@@ -32,7 +32,7 @@ public class AppLovinBanner implements IBannerAd, MaxAdViewAdListener {
private
boolean
isShow
=
true
;
private
boolean
isClick
=
false
;
private
MaxAd
mMaxAd
;
private
boolean
isA
ppLovinA
d
;
private
boolean
isA
dLoa
d
;
public
AppLovinBanner
(
Activity
activity
,
SlotBean
bean
,
IBannerProxyListener
listener
)
{
mActivity
=
activity
;
...
...
@@ -41,7 +41,7 @@ public class AppLovinBanner implements IBannerAd, MaxAdViewAdListener {
Boolean
isInitSuccess
=
HlAdClient
.
initSuccessMap
.
get
(
"max"
);
if
(
isInitSuccess
==
null
||
!
isInitSuccess
)
{
try
{
InitDataProcessor
.
initAppLovin
(
activity
);
InitDataProcessor
.
initAppLovin
(
activity
,
bean
.
extendStr
);
HlAdClient
.
initSuccessMap
.
put
(
"max"
,
true
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
...
...
@@ -60,9 +60,12 @@ public class AppLovinBanner implements IBannerAd, MaxAdViewAdListener {
@Override
public
void
loadAd
()
{
isShow
=
true
;
isClick
=
false
;
adBannerView
.
loadAd
();
if
(
adBannerView
!=
null
)
{
isShow
=
true
;
isClick
=
false
;
isAdLoad
=
false
;
adBannerView
.
loadAd
();
}
}
@Override
...
...
@@ -70,9 +73,8 @@ public class AppLovinBanner implements IBannerAd, MaxAdViewAdListener {
LogUtils
.
e
(
"====bannerShowAd==="
);
if
(
adBannerView
!=
null
&&
viewGroup
!=
null
)
{
viewGroup
.
addView
(
adBannerView
);
if
(
isShow
&&
mBannerListener
!=
null
&&
mMaxAd
!=
null
&&
isAppLovinAd
)
{
if
(
isShow
&&
mBannerListener
!=
null
&&
mMaxAd
!=
null
)
{
isShow
=
false
;
LogUtils
.
e
(
"====bannerShow11111==="
);
mBannerListener
.
onDisplayAd
(
mLovinBean
,
mMaxAd
.
getNetworkName
());
}
}
...
...
@@ -82,29 +84,23 @@ public class AppLovinBanner implements IBannerAd, MaxAdViewAdListener {
public
void
onAdLoaded
(
MaxAd
maxAd
)
{
mMaxAd
=
maxAd
;
double
ecpm
=
maxAd
.
getRevenue
()*
1000
;
Log
.
e
(
"11111"
,
"====bannerAdLoaded===="
+
ecpm
+
"====netWork==="
+
maxAd
.
getNetworkName
());
mLovinBean
.
setEp
(
ecpm
);
EcpmCompareBean
bean
=
CompareEcpmUtils
.
compareEcpm
(
mLovinBean
,
ecpm
);
mLovinBean
.
setOp
(
bean
.
getEcpm
());
if
(
bean
.
getResult
())
{
isAdLoad
=
true
;
mBannerListener
.
onAdReady
(
mLovinBean
,
InitDataProcessor
.
SDK_MAX
,
bean
.
getEcpm
(),
maxAd
.
getNetworkName
());
}
else
{
isAdLoad
=
false
;
mBannerListener
.
onAdError
(
"applovin: 竞价失败"
,
102
,
InitDataProcessor
.
SDK_MAX
,
mLovinBean
);
}
}
@Override
public
void
onAdDisplayed
(
MaxAd
maxAd
)
{
String
networkName
=
maxAd
.
getNetworkName
();
if
(
"AppLovin"
.
equals
(
networkName
)
||
"APPLOVIN_EXCHANGE"
.
equals
(
networkName
))
{
isAppLovinAd
=
true
;
}
else
{
isAppLovinAd
=
false
;
if
(
isShow
&&
mBannerListener
!=
null
)
{
isShow
=
false
;
LogUtils
.
e
(
"====bannerShow11111==="
);
mBannerListener
.
onDisplayAd
(
mLovinBean
,
mMaxAd
.
getNetworkName
());
}
if
(
isShow
&&
mBannerListener
!=
null
&&
isAdLoad
)
{
isShow
=
false
;
mBannerListener
.
onDisplayAd
(
mLovinBean
,
mMaxAd
.
getNetworkName
());
}
}
...
...
@@ -125,7 +121,6 @@ public class AppLovinBanner implements IBannerAd, MaxAdViewAdListener {
@Override
public
void
onAdLoadFailed
(
String
s
,
MaxError
maxError
)
{
Log
.
e
(
"11111"
,
"====onAdLoadFailed===="
+
maxError
.
getMessage
());
if
(
mBannerListener
!=
null
)
{
mBannerListener
.
onAdError
(
"lovin:error==="
+
maxError
.
getMessage
(),
maxError
.
getCode
(),
InitDataProcessor
.
SDK_MAX
,
mLovinBean
);
}
...
...
haloJuheSdk/src/main/java/com/halo/halojuhesdk/core/channel/applovin/AppLovinInsert.java
View file @
6ee673d6
...
...
@@ -16,18 +16,20 @@ import com.halo.halojuhesdk.core.request.SlotBean;
import
com.halo.halojuhesdk.sdk.HlAdClient
;
public
class
AppLovinInsert
implements
IInsertAd
,
MaxAdListener
{
private
Activity
mContext
;
private
MaxInterstitialAd
interstitialAd
;
private
SlotBean
mLovinBean
;
private
IInsertProxyListener
mInsertListener
;
private
boolean
isShow
=
true
;
private
boolean
isClick
=
false
;
public
AppLovinInsert
(
Activity
activity
,
SlotBean
bean
,
IInsertProxyListener
listener
)
{
this
.
mInsertListener
=
listener
;
this
.
mLovinBean
=
bean
;
mContext
=
activity
;
mInsertListener
=
listener
;
mLovinBean
=
bean
;
Boolean
isInitSuccess
=
HlAdClient
.
initSuccessMap
.
get
(
"max"
);
if
(
isInitSuccess
==
null
||
!
isInitSuccess
)
{
try
{
InitDataProcessor
.
initAppLovin
(
activity
);
InitDataProcessor
.
initAppLovin
(
activity
,
bean
.
extendStr
);
HlAdClient
.
initSuccessMap
.
put
(
"max"
,
true
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
...
...
@@ -40,14 +42,18 @@ public class AppLovinInsert implements IInsertAd, MaxAdListener {
@Override
public
void
loadAd
()
{
isShow
=
true
;
isClick
=
false
;
interstitialAd
.
loadAd
();
if
(
interstitialAd
!=
null
)
{
isShow
=
true
;
isClick
=
false
;
interstitialAd
.
loadAd
();
}
}
@Override
public
void
showAd
()
{
interstitialAd
.
showAd
();
if
(
interstitialAd
!=
null
)
{
interstitialAd
.
showAd
();
}
}
@Override
...
...
@@ -58,19 +64,13 @@ public class AppLovinInsert implements IInsertAd, MaxAdListener {
@Override
public
void
onAdLoaded
(
MaxAd
maxAd
)
{
double
ecpm
=
maxAd
.
getRevenue
()*
1000
;
Log
.
e
(
"11111"
,
"====onInsertAdLoaded===="
+
ecpm
+
"===="
+
maxAd
.
getNetworkName
());
String
networkName
=
maxAd
.
getNetworkName
();
if
(
"AppLovin"
.
equals
(
networkName
)
||
"APPLOVIN_EXCHANGE"
.
equals
(
networkName
))
{
mInsertListener
.
onAdError
(
"applovin: 竞价失败"
,
102
,
InitDataProcessor
.
SDK_MAX
,
mLovinBean
);
mLovinBean
.
setEp
(
ecpm
);
EcpmCompareBean
bean
=
CompareEcpmUtils
.
compareEcpm
(
mLovinBean
,
ecpm
);
mLovinBean
.
setOp
(
bean
.
getEcpm
());
if
(
bean
.
getResult
())
{
mInsertListener
.
onAdReady
(
mLovinBean
,
InitDataProcessor
.
SDK_MAX
,
bean
.
getEcpm
());
}
else
{
mLovinBean
.
setEp
(
ecpm
);
EcpmCompareBean
bean
=
CompareEcpmUtils
.
compareEcpm
(
mLovinBean
,
ecpm
);
mLovinBean
.
setOp
(
bean
.
getEcpm
());
if
(
bean
.
getResult
())
{
mInsertListener
.
onAdReady
(
mLovinBean
,
InitDataProcessor
.
SDK_MAX
,
bean
.
getEcpm
());
}
else
{
mInsertListener
.
onAdError
(
"applovin: 竞价失败"
,
102
,
InitDataProcessor
.
SDK_MAX
,
mLovinBean
);
}
mInsertListener
.
onAdError
(
"applovin: 竞价失败"
,
102
,
InitDataProcessor
.
SDK_MAX
,
mLovinBean
);
}
}
...
...
haloJuheSdk/src/main/java/com/halo/halojuhesdk/core/channel/applovin/AppLovinNative.java
View file @
6ee673d6
...
...
@@ -31,7 +31,7 @@ public class AppLovinNative extends MaxNativeAdListener implements INativeAd, Ma
public
AppLovinNative
(
Activity
activity
,
SlotBean
bean
,
final
INativeProxyListener
listener
)
{
this
.
mNativeListener
=
listener
;
this
.
mLovinBean
=
bean
;
InitDataProcessor
.
initAppLovin
(
activity
);
InitDataProcessor
.
initAppLovin
(
activity
,
bean
.
extendStr
);
mLovinBean
.
setStartTime
(
System
.
currentTimeMillis
());
nativeAdLoader
=
new
MaxNativeAdLoader
(
bean
.
adSlotId
,
activity
);
nativeAdLoader
.
setNativeAdListener
(
this
);
...
...
@@ -41,26 +41,31 @@ public class AppLovinNative extends MaxNativeAdListener implements INativeAd, Ma
@Override
public
void
loadAd
()
{
nativeAdLoader
.
loadAd
();
if
(
nativeAdLoader
!=
null
)
{
nativeAdLoader
.
loadAd
();
}
}
@Override
public
void
onNativeAdLoaded
(
@Nullable
final
MaxNativeAdView
nativeAdView
,
final
MaxAd
ad
)
{
mLovinBean
.
setEndTime
(
System
.
currentTimeMillis
());
if
(
ad
!=
null
)
{
if
(
ad
!=
null
&&
nativeAdView
!=
null
)
{
double
ecpm
=
ad
.
getRevenue
()*
1000
;
Log
.
e
(
"11111"
,
"====onNativeAdLoaded===="
+
ecpm
+
"===type==="
+
ad
.
getNetworkName
());
mLovinBean
.
setEp
(
ecpm
);
mNativeView
=
nativeAdView
;
EcpmCompareBean
bean
=
CompareEcpmUtils
.
compareEcpm
(
mLovinBean
,
ecpm
);
mLovinBean
.
setOp
(
bean
.
getEcpm
());
if
(
bean
.
getResult
())
{
mNativeListener
.
onADLoadView
(
nativeAdView
,
InitDataProcessor
.
SDK_MAX
,
mLovinBean
,
bean
.
getEcpm
(),
ad
.
getNetworkName
()
,
0
f
);
mNativeListener
.
onADLoadView
(
nativeAdView
,
InitDataProcessor
.
SDK_MAX
,
mLovinBean
,
bean
.
getEcpm
(),
ad
.
getNetworkName
());
}
else
{
if
(
mNativeListener
!=
null
)
{
mNativeListener
.
onADError
(
"max:竞价失败"
,
102
,
InitDataProcessor
.
SDK_MAX
,
mLovinBean
);
}
}
}
else
{
if
(
mNativeListener
!=
null
)
{
mNativeListener
.
onADError
(
"数据空值"
,
102
,
InitDataProcessor
.
SDK_MAX
,
mLovinBean
);
}
}
}
...
...
haloJuheSdk/src/main/java/com/halo/halojuhesdk/core/channel/applovin/AppLovinReward.java
View file @
6ee673d6
...
...
@@ -10,6 +10,7 @@ import com.applovin.mediation.MaxReward;
import
com.applovin.mediation.MaxRewardedAdListener
;
import
com.applovin.mediation.ads.MaxRewardedAd
;
import
com.halo.halojuhesdk.core.base.utils.CompareEcpmUtils
;
import
com.halo.halojuhesdk.core.base.utils.LogUtils
;
import
com.halo.halojuhesdk.core.channel.IVideoProxyListener
;
import
com.halo.halojuhesdk.core.channel.IVideoAd
;
import
com.halo.halojuhesdk.core.request.EcpmCompareBean
;
...
...
@@ -31,7 +32,7 @@ public class AppLovinReward implements IVideoAd, MaxRewardedAdListener {
Boolean
isInitSuccess
=
HlAdClient
.
initSuccessMap
.
get
(
"max"
);
if
(
isInitSuccess
==
null
||
!
isInitSuccess
)
{
try
{
InitDataProcessor
.
initAppLovin
(
activity
);
InitDataProcessor
.
initAppLovin
(
activity
,
bean
.
extendStr
);
HlAdClient
.
initSuccessMap
.
put
(
"max"
,
true
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
...
...
@@ -44,14 +45,18 @@ public class AppLovinReward implements IVideoAd, MaxRewardedAdListener {
@Override
public
void
loadAd
()
{
isShow
=
true
;
isClick
=
false
;
rewardedAd
.
loadAd
();
if
(
rewardedAd
!=
null
)
{
isShow
=
true
;
isClick
=
false
;
rewardedAd
.
loadAd
();
}
}
@Override
public
void
showAd
()
{
rewardedAd
.
showAd
();
if
(
rewardedAd
!=
null
)
{
rewardedAd
.
showAd
();
}
}
@Override
...
...
@@ -61,20 +66,9 @@ public class AppLovinReward implements IVideoAd, MaxRewardedAdListener {
}
}
@Override
public
void
onRewardedVideoStarted
(
MaxAd
maxAd
)
{
HlStatisManager
.
getInstance
().
reportStatic
(
mLovinBean
,
HlStatisManager
.
STEPNAME_REPORT
,
HlStatisManager
.
STEPNAME_REPORT_VIDEO_START
,
mLovinBean
.
getReqId
());
}
@Override
public
void
onRewardedVideoCompleted
(
MaxAd
maxAd
)
{
HlStatisManager
.
getInstance
().
reportStatic
(
mLovinBean
,
HlStatisManager
.
STEPNAME_REPORT
,
HlStatisManager
.
STEPNAME_REPORT_VIDEO_END
,
mLovinBean
.
getReqId
());
}
@Override
public
void
onAdLoaded
(
MaxAd
maxAd
)
{
double
ecpm
=
maxAd
.
getRevenue
()*
1000
;
Log
.
e
(
"11111"
,
"====videoEcpm==="
+
ecpm
+
"====type==="
+
maxAd
.
getNetworkName
());
mLovinBean
.
setEp
(
ecpm
);
EcpmCompareBean
bean
=
CompareEcpmUtils
.
compareEcpm
(
mLovinBean
,
ecpm
);
mLovinBean
.
setOp
(
bean
.
getEcpm
());
...
...
@@ -114,6 +108,7 @@ public class AppLovinReward implements IVideoAd, MaxRewardedAdListener {
@Override
public
void
onAdLoadFailed
(
String
s
,
MaxError
maxError
)
{
LogUtils
.
e
(
"====onAdLoadFailed==="
+
maxError
.
getMessage
());
if
(
mVideoListener
!=
null
)
{
mVideoListener
.
onAdFailed
(
"lovin:error==="
+
maxError
.
getMessage
(),
maxError
.
getCode
(),
InitDataProcessor
.
SDK_MAX
,
mLovinBean
);
}
...
...
haloJuheSdk/src/main/java/com/halo/halojuhesdk/core/channel/applovin/AppLovinSplash.java
View file @
6ee673d6
...
...
@@ -30,8 +30,7 @@ public class AppLovinSplash implements ISplashAd, MaxAdListener {
this
.
mLovinBean
=
bean
;
isShow
=
true
;
isClick
=
false
;
LogUtils
.
e
(
"====AppLovinSplash==="
);
InitDataProcessor
.
initAppLovin
(
activity
);
InitDataProcessor
.
initAppLovin
(
activity
,
bean
.
extendStr
);
mLovinBean
.
setStartTime
(
System
.
currentTimeMillis
());
appOpenAd
=
new
MaxAppOpenAd
(
bean
.
adSlotId
,
activity
);
appOpenAd
.
setListener
(
this
);
...
...
@@ -40,14 +39,15 @@ public class AppLovinSplash implements ISplashAd, MaxAdListener {
@Override
public
void
LoadAndShowAd
()
{
appOpenAd
.
showAd
();
if
(
appOpenAd
!=
null
)
{
appOpenAd
.
showAd
();
}
}
@Override
public
void
onAdLoaded
(
MaxAd
maxAd
)
{
mLovinBean
.
setEndTime
(
System
.
currentTimeMillis
());
double
ecpm
=
maxAd
.
getRevenue
()*
1000
;
Log
.
e
(
"11111"
,
"====onSplashAdLoaded===="
+
ecpm
);
mLovinBean
.
setEp
(
ecpm
);
EcpmCompareBean
bean
=
CompareEcpmUtils
.
compareEcpm
(
mLovinBean
,
ecpm
);
mLovinBean
.
setOp
(
bean
.
getEcpm
());
...
...
@@ -88,7 +88,6 @@ public class AppLovinSplash implements ISplashAd, MaxAdListener {
@Override
public
void
onAdLoadFailed
(
String
s
,
MaxError
maxError
)
{
mLovinBean
.
setEndTime
(
System
.
currentTimeMillis
());
Log
.
e
(
"11111"
,
"====onSplashAdLoadFailed===="
+
maxError
.
getMessage
());
if
(
mListener
!=
null
)
{
mListener
.
onAdError
(
"lovin:error==="
+
maxError
.
getMessage
(),
maxError
.
getCode
(),
InitDataProcessor
.
SDK_MAX
,
mLovinBean
);
}
...
...
haloJuheSdk/src/main/java/com/halo/halojuhesdk/core/channel/applovin/AppLovinUnifiedNative.java
View file @
6ee673d6
...
...
@@ -50,7 +50,7 @@ public class AppLovinUnifiedNative extends MaxNativeAdListener implements INativ
Boolean
isInitSuccess
=
HlAdClient
.
initSuccessMap
.
get
(
"max"
);
if
(
isInitSuccess
==
null
||
!
isInitSuccess
)
{
try
{
InitDataProcessor
.
initAppLovin
(
activity
);
InitDataProcessor
.
initAppLovin
(
activity
,
bean
.
extendStr
);
HlAdClient
.
initSuccessMap
.
put
(
"max"
,
true
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
...
...
@@ -78,7 +78,7 @@ public class AppLovinUnifiedNative extends MaxNativeAdListener implements INativ
@Override
public
void
loadAd
()
{
if
(
nativeAdView
!=
null
)
{
if
(
nativeAdView
!=
null
&&
nativeAdLoader
!=
null
)
{
nativeAdLoader
.
loadAd
(
nativeAdView
);
}
}
...
...
@@ -89,28 +89,11 @@ public class AppLovinUnifiedNative extends MaxNativeAdListener implements INativ
mMaxAd
=
maxAd
;
mLovinBean
.
setEndTime
(
System
.
currentTimeMillis
());
double
ecpm
=
maxAd
.
getRevenue
()*
1000
;
Log
.
e
(
"11111"
,
"====onUnifiedLoaded===="
+
maxAd
.
getNetworkName
()
+
"===ecpm==="
+
ecpm
);
float
ratio
=
0.0f
;
// if(nativeAdView!=null&&maxAd.getNativeAd()!=null){
// try{
// ratio=maxAd.getNativeAd().getMediaContentAspectRatio();
//// if(ratio>0){
//// Log.e("11111", "====ratio==== " +ratio+"---"+ (int) (PxUtil.getDeviceWidthInPixel(mActivity) /ratio));
//// Log.e("11111", "====ratio==== " + PxUtil.getDeviceWidthInPixel(mActivity));
//// ViewGroup.LayoutParams layoutParams=nativeAdView.getLayoutParams();
//// layoutParams.height= 200;
//// nativeAdView.setLayoutParams(layoutParams);
//// }
// }catch (Exception e){
// e.printStackTrace();
// }
// }
mLovinBean
.
setEp
(
ecpm
);
EcpmCompareBean
bean
=
CompareEcpmUtils
.
compareEcpm
(
mLovinBean
,
ecpm
);
Log
.
e
(
"11111"
,
"===ecp1111m==="
+
bean
.
getEcpm
());
mLovinBean
.
setOp
(
bean
.
getEcpm
());
if
(
bean
.
getResult
())
{
mNativeListener
.
onADLoadView
(
nativeAdView
,
InitDataProcessor
.
SDK_MAX
,
mLovinBean
,
bean
.
getEcpm
(),
maxAd
.
getNetworkName
()
,
ratio
);
mNativeListener
.
onADLoadView
(
nativeAdView
,
InitDataProcessor
.
SDK_MAX
,
mLovinBean
,
bean
.
getEcpm
(),
maxAd
.
getNetworkName
());
}
else
{
if
(
mNativeListener
!=
null
)
{
mNativeListener
.
onADError
(
"max:竞价失败"
,
102
,
InitDataProcessor
.
SDK_MAX
,
mLovinBean
);
...
...
haloJuheSdk/src/main/java/com/halo/halojuhesdk/core/channel/hlapi/HlApiBannerAd.java
View file @
6ee673d6
...
...
@@ -27,7 +27,7 @@ public class HlApiBannerAd implements IBannerAd, BannerListener {
private
boolean
isFirstShow
=
true
;
private
boolean
isFirstClick
=
false
;
public
HlApiBannerAd
(
Activity
context
,
SlotBean
hlApiBean
,
IBannerProxyListener
listener
)
{
public
HlApiBannerAd
(
Activity
context
,
SlotBean
hlApiBean
,
int
width
,
int
height
,
IBannerProxyListener
listener
)
{
mContext
=
context
;
Boolean
isInitSuccess
=
HlAdClient
.
initSuccessMap
.
get
(
Config
.
mAppId
);
if
(
isInitSuccess
==
null
||
!
isInitSuccess
)
{
...
...
@@ -43,8 +43,8 @@ public class HlApiBannerAd implements IBannerAd, BannerListener {
mApiBean
.
setStartTime
(
System
.
currentTimeMillis
());
HlAdParameter
adParameter
=
new
HlAdParameter
.
Builder
()
.
setSlotAdId
(
hlApiBean
.
slotId
)
.
setAdWidth
(
PxUtil
.
getDeviceWidthInPixel
(
context
)
)
.
setAdHeight
(
PxUtil
.
dpToPx
(
context
,
50
)
)
.
setAdWidth
(
width
)
.
setAdHeight
(
height
)
.
build
();
hmBannerAd
=
new
HMBannerAd
(
mContext
,
adParameter
,
this
);
HlAdClient
.
containApiMap
.
put
(
mApiBean
.
slotId
,
true
);
...
...
@@ -52,12 +52,16 @@ public class HlApiBannerAd implements IBannerAd, BannerListener {
@Override
public
void
loadAd
()
{
hmBannerAd
.
loadAd
();
if
(
hmBannerAd
!=
null
)
{
hmBannerAd
.
loadAd
();
}
}
@Override
public
void
showAd
(
ViewGroup
viewGroup
)
{
hmBannerAd
.
showView
(
viewGroup
);
if
(
hmBannerAd
!=
null
&&
viewGroup
!=
null
)
{
hmBannerAd
.
showView
(
viewGroup
);
}
}
@Override
...
...
haloJuheSdk/src/main/java/com/halo/halojuhesdk/core/channel/hlapi/HlApiInsertAd.java
View file @
6ee673d6
...
...
@@ -5,20 +5,20 @@ import android.app.Activity;
import
com.halo.halojuhesdk.core.channel.IInsertAd
;
import
com.halo.halojuhesdk.core.channel.IInsertProxyListener
;
import
com.halo.halojuhesdk.core.common.utils.Config
;
import
com.halo.halojuhesdk.core.common.utils.PxUtil
;
import
com.halo.halojuhesdk.core.request.InitDataProcessor
;
import
com.halo.halojuhesdk.core.request.SlotBean
;
import
com.halo.halojuhesdk.sdk.HlAdClient
;
import
com.halomobi.sdk.HMInsertAd
;
import
com.halomobi.sdk.HlAdParameter
;
import
com.halomobi.sdk.listener.InsertListener
;
import
com.halomobi.utils.PxUtil
;
public
class
HlApiInsertAd
implements
IInsertAd
,
InsertListener
{
private
final
SlotBean
mApiBean
;
private
final
IInsertProxyListener
mListener
;
private
HMInsertAd
insertAd
;
public
HlApiInsertAd
(
Activity
context
,
SlotBean
apiBean
,
IInsertProxyListener
listener
)
{
public
HlApiInsertAd
(
Activity
context
,
SlotBean
apiBean
,
int
width
,
int
height
,
IInsertProxyListener
listener
)
{
Boolean
isInitSuccess
=
HlAdClient
.
initSuccessMap
.
get
(
Config
.
mAppId
);
if
(
isInitSuccess
==
null
||
!
isInitSuccess
)
{
try
{
...
...
@@ -33,8 +33,8 @@ public class HlApiInsertAd implements IInsertAd, InsertListener {
mApiBean
.
setStartTime
(
System
.
currentTimeMillis
());
HlAdParameter
adParameter
=
new
HlAdParameter
.
Builder
()
.
setSlotAdId
(
apiBean
.
slotId
)
// .setAdWidth(PxUtil.dpToPx(context, 260)
)
// .setAdHeight(PxUtil.dpToPx(context, 400)
)
.
setAdWidth
(
width
)
.
setAdHeight
(
height
)
.
build
();
insertAd
=
new
HMInsertAd
(
context
,
adParameter
,
this
);
HlAdClient
.
containApiMap
.
put
(
apiBean
.
slotId
,
true
);
...
...
@@ -42,19 +42,15 @@ public class HlApiInsertAd implements IInsertAd, InsertListener {
@Override
public
void
loadAd
()
{
try
{
if
(
insertAd
!=
null
)
{
insertAd
.
loadAd
();
}
catch
(
Exception
e
)
{
e
.
getStackTrace
();
}
}
@Override
public
void
showAd
()
{
try
{
if
(
insertAd
!=
null
)
{
insertAd
.
showAd
();
}
catch
(
Exception
e
)
{
e
.
getStackTrace
();
}
}
...
...
haloJuheSdk/src/main/java/com/halo/halojuhesdk/core/channel/hlapi/HlApiNativeAd.java
View file @
6ee673d6
...
...
@@ -6,6 +6,7 @@ import android.view.ViewGroup;
import
android.widget.ImageView
;
import
android.widget.TextView
;
import
com.bumptech.glide.Glide
;
import
com.halo.halojuhesdk.core.base.utils.LogUtils
;
import
com.halo.halojuhesdk.core.channel.INativeAd
;
import
com.halo.halojuhesdk.core.channel.INativeProxyListener
;
...
...
@@ -18,7 +19,6 @@ import com.halomobi.sdk.HMNativeAd;
import
com.halomobi.sdk.HlAdParameter
;
import
com.halomobi.sdk.listener.NativeAdListener
;
import
com.halomobi.sdk.listener.NativeResponse
;
import
com.halomobi.view.imageloader.ImageLoader
;
import
java.util.List
;
...
...
@@ -33,7 +33,7 @@ public class HlApiNativeAd implements INativeAd, NativeAdListener {
private
boolean
isShow
=
true
;
private
boolean
isClick
=
false
;
public
HlApiNativeAd
(
Activity
mActivity
,
SlotBean
apiBean
,
HlUnifiedAdParameter
parameter
,
INativeProxyListener
listener
)
{
public
HlApiNativeAd
(
Activity
mActivity
,
SlotBean
apiBean
,
HlUnifiedAdParameter
parameter
,
int
width
,
int
height
,
int
type
,
INativeProxyListener
listener
)
{
mContext
=
mActivity
;
Boolean
isInitSuccess
=
HlAdClient
.
initSuccessMap
.
get
(
Config
.
mAppId
);
if
(
isInitSuccess
==
null
||
!
isInitSuccess
)
{
...
...
@@ -50,13 +50,18 @@ public class HlApiNativeAd implements INativeAd, NativeAdListener {
mApiBean
.
setStartTime
(
System
.
currentTimeMillis
());
HlAdParameter
adParameter
=
new
HlAdParameter
.
Builder
()
.
setSlotAdId
(
apiBean
.
slotId
)
.
setAdWidth
(
width
)
.
setAdHeight
(
height
)
.
setAdType
(
type
)
.
build
();
nativeAd
=
new
HMNativeAd
(
mActivity
,
adParameter
,
this
);
HlAdClient
.
containApiMap
.
put
(
apiBean
.
slotId
,
true
);
}
public
void
loadAd
()
{
nativeAd
.
loadAd
();
if
(
nativeAd
!=
null
)
{
nativeAd
.
loadAd
();
}
}
@Override
...
...
@@ -64,15 +69,13 @@ public class HlApiNativeAd implements INativeAd, NativeAdListener {
mNativeView
=
view
;
mApiBean
.
setEndTime
(
System
.
currentTimeMillis
());
if
(
response
!=
null
&&
view
!=
null
)
{
View
insertView
=
insertView
(
response
);
double
ecpm
=
response
.
getPrice
();
LogUtils
.
e
(
"===apiPrice==="
+
ecpm
);
mApiBean
.
setOp
(
ecpm
);
mApiBean
.
setEp
(
ecpm
);
if
(
ecpm
<
mApiBean
.
minPrice
&&
ecpm
>
0
)
{
mListener
.
onADError
(
"apiSplash:价格低"
,
102
,
InitDataProcessor
.
SDK_API
,
mApiBean
);
}
else
{
mListener
.
onADLoadView
(
insertView
,
InitDataProcessor
.
SDK_API
,
mApiBean
,
ecpm
,
"api"
,
0
f
);
mListener
.
onADLoadView
(
mNativeView
,
InitDataProcessor
.
SDK_API
,
mApiBean
,
ecpm
,
"api"
);
}
}
}
...
...
@@ -107,30 +110,4 @@ public class HlApiNativeAd implements INativeAd, NativeAdListener {
@Override
public
void
release
()
{
}
private
View
insertView
(
NativeResponse
response
)
{
int
adTitleId
=
mParameter
.
getAdTitleId
();
int
adSubTitleId
=
mParameter
.
getAdBodyTitleId
();
int
adContentId
=
mParameter
.
getAdContentId
();
View
inflate
=
View
.
inflate
(
mContext
,
mParameter
.
getAdLayoutId
(),
null
);
if
(
adTitleId
>
0
)
{
TextView
mTitleAd
=
inflate
.
findViewById
(
adTitleId
);
mTitleAd
.
setText
(
response
.
getTitle
());
}
if
(
adSubTitleId
>
0
)
{
TextView
mSubTitle
=
inflate
.
findViewById
(
adSubTitleId
);
mSubTitle
.
setText
(
response
.
getAdDescription
());
}
ImageView
imageView
=
new
ImageView
(
mContext
);
imageView
.
setScaleType
(
ImageView
.
ScaleType
.
FIT_CENTER
);
List
<
String
>
imgList
=
response
.
getImgList
();
if
(
imgList
!=
null
&&
!
imgList
.
isEmpty
())
{
ImageLoader
.
load
(
imageView
,
imgList
.
get
(
0
));
}
if
(
adContentId
>
0
)
{
ViewGroup
mAdContentId
=
inflate
.
findViewById
(
adContentId
);
mAdContentId
.
addView
(
imageView
);
}
return
inflate
;
}
}
haloJuheSdk/src/main/java/com/halo/halojuhesdk/core/channel/hlapi/HlApiRewardVideo.java
View file @
6ee673d6
...
...
@@ -44,14 +44,16 @@ public class HlApiRewardVideo implements IVideoAd, RewardVideoListener {
public
void
loadAd
()
{
isClick
=
false
;
isShow
=
true
;
mHmRewardVideoAd
.
loadAd
();
if
(
mHmRewardVideoAd
!=
null
)
{
mHmRewardVideoAd
.
loadAd
();
}
}
@Override
public
void
showAd
()
{
// if (mHmRewardVideoAd.isReady()
) {
if
(
mHmRewardVideoAd
!=
null
)
{
mHmRewardVideoAd
.
showAd
();
//
}
}
}
@Override
...
...
@@ -77,7 +79,7 @@ public class HlApiRewardVideo implements IVideoAd, RewardVideoListener {
public
void
onAdShow
()
{
if
(
isShow
)
{
isShow
=
false
;
//
mListener.onAdShow(mApiBean);
mListener
.
onAdShow
(
mApiBean
);
}
}
...
...
@@ -86,6 +88,11 @@ public class HlApiRewardVideo implements IVideoAd, RewardVideoListener {
mListener
.
onAdClose
();
}
@Override
public
void
onAdSkip
()
{
mListener
.
onSkipped
();
}
@Override
public
void
onAdClick
()
{
if
(!
isClick
)
{
...
...
@@ -94,11 +101,18 @@ public class HlApiRewardVideo implements IVideoAd, RewardVideoListener {
}
}
@Override
public
void
onPlayEnd
()
{
mListener
.
onPlayEnd
();
}
@Override
public
void
onRewardArrived
()
{
mListener
.
onRewardArrived
();
}
public
void
onDestroy
()
{
if
(
mHmRewardVideoAd
!=
null
)
{
mHmRewardVideoAd
=
null
;
...
...
haloJuheSdk/src/main/java/com/halo/halojuhesdk/core/channel/hlapi/HlApiUnifiedNativeAd.java
View file @
6ee673d6
package
com
.
halo
.
halojuhesdk
.
core
.
channel
.
hlapi
;
import
android.app.Activity
;
import
android.content.Context
;
import
android.view.View
;
import
android.view.ViewGroup
;
import
android.widget.FrameLayout
;
import
android.widget.ImageView
;
import
android.widget.TextView
;
import
androidx.annotation.NonNull
;
import
com.halo.halojuhesdk.core.base.utils.LogUtils
;
import
com.halo.halojuhesdk.core.channel.INativeAd
;
import
com.halo.halojuhesdk.core.channel.INativeProxyListener
;
import
com.halo.halojuhesdk.core.channel.IUnifiedNativeAd
;
import
com.halo.halojuhesdk.core.channel.IUnifiedNativeProxyListener
;
import
com.halo.halojuhesdk.core.common.utils.Config
;
import
com.halo.halojuhesdk.core.request.InitDataProcessor
;
import
com.halo.halojuhesdk.core.request.SlotBean
;
import
com.halo.halojuhesdk.sdk.HlAdClient
;
import
com.halo.halojuhesdk.sdk.HlUnifiedAdParameter
;
import
com.halo.halojuhesdk.sdk.listener.HlNativeAdCallBackListener
;
import
com.halo.halojuhesdk.sdk.listener.HlNativeResponseImpl
;
import
com.halomobi.sdk.HMUnifiedNativeAd
;
import
com.halomobi.sdk.HlAdParameter
;
import
com.halomobi.sdk.listener.NativeAdListener
;
import
com.halomobi.sdk.listener.NativeResponse
;
import
com.halomobi.sdk.listener.NativeUnifiedBackAdListener
;
import
com.halomobi.sdk.listener.NativeUnifiedListener
;
import
com.halomobi.view.imageloader.ImageLoader
;
import
java.util.List
;
public
class
HlApiUnifiedNativeAd
implements
INativeAd
,
NativeAdListener
{
private
boolean
isShow
=
true
;
...
...
@@ -42,7 +26,7 @@ public class HlApiUnifiedNativeAd implements INativeAd, NativeAdListener {
private
final
HlUnifiedAdParameter
mParameter
;
private
View
mNativeView
;
public
HlApiUnifiedNativeAd
(
Activity
mActivity
,
SlotBean
apiBean
,
HlUnifiedAdParameter
parameter
,
INativeProxyListener
listener
)
{
public
HlApiUnifiedNativeAd
(
Activity
mActivity
,
SlotBean
apiBean
,
HlUnifiedAdParameter
parameter
,
int
width
,
int
height
,
INativeProxyListener
listener
)
{
Boolean
isInitSuccess
=
HlAdClient
.
initSuccessMap
.
get
(
Config
.
mAppId
);
if
(
isInitSuccess
==
null
||
!
isInitSuccess
)
{
try
{
...
...
@@ -59,13 +43,17 @@ public class HlApiUnifiedNativeAd implements INativeAd, NativeAdListener {
mApiBean
.
setStartTime
(
System
.
currentTimeMillis
());
HlAdParameter
adParameter
=
new
HlAdParameter
.
Builder
()
.
setSlotAdId
(
apiBean
.
slotId
)
.
setAdWidth
(
width
)
.
setAdHeight
(
height
)
.
build
();
nativeAd
=
new
HMUnifiedNativeAd
(
mActivity
,
adParameter
,
this
);
HlAdClient
.
containApiMap
.
put
(
apiBean
.
slotId
,
true
);
}
public
void
loadAd
(){
nativeAd
.
loadAd
();
if
(
nativeAd
!=
null
)
{
nativeAd
.
loadAd
();
}
}
@Override
...
...
@@ -79,8 +67,8 @@ public class HlApiUnifiedNativeAd implements INativeAd, NativeAdListener {
if
(
ecpm
<
mApiBean
.
minPrice
&&
ecpm
>
0
)
{
mListener
.
onADError
(
"apiSplash:价格低"
,
102
,
InitDataProcessor
.
SDK_API
,
mApiBean
);
}
else
{
mNativeView
=
nativeAd
.
showViewById
(
mParameter
.
getAdLayoutId
(),
mParameter
.
getAdContentId
(),
mParameter
.
getAdTitleId
(),
mParameter
.
getAdBodyTitleId
());
mListener
.
onADLoadView
(
mNativeView
,
InitDataProcessor
.
SDK_API
,
mApiBean
,
ecpm
,
"api"
,
0
f
);
mNativeView
=
nativeAd
.
showViewById
(
mParameter
.
getAdLayoutId
(),
mParameter
.
getAdContentId
(),
mParameter
.
getAdTitleId
(),
mParameter
.
getAdBodyTitleId
()
,
mParameter
.
getAdOptionsId
()
);
mListener
.
onADLoadView
(
mNativeView
,
InitDataProcessor
.
SDK_API
,
mApiBean
,
ecpm
,
"api"
);
}
}
}
...
...
haloJuheSdk/src/main/java/com/halo/halojuhesdk/core/common/utils/HttpUrlSettings.java
View file @
6ee673d6
...
...
@@ -45,7 +45,7 @@ public class HttpUrlSettings {
* @return
*/
public
static
String
getReportApiStartUrl
(
String
reqId
)
{
String
str
=
getHost
()
+
"ssp/sdkReportStat?req=0&sdk=1
47
"
+
"&adid="
+
HlStatisManager
.
getInstance
().
getConfigReqId
()
+
"&reqId="
+
reqId
;
String
str
=
getHost
()
+
"ssp/sdkReportStat?req=0&sdk=1
00
"
+
"&adid="
+
HlStatisManager
.
getInstance
().
getConfigReqId
()
+
"&reqId="
+
reqId
;
// LogUtils.e("====getReportApiStartUrl====" + str);
return
str
;
}
...
...
haloJuheSdk/src/main/java/com/halo/halojuhesdk/core/request/InitDataProcessor.java
View file @
6ee673d6
...
...
@@ -9,6 +9,7 @@ import androidx.annotation.Nullable;
import
com.applovin.sdk.AppLovinMediationProvider
;
import
com.applovin.sdk.AppLovinSdk
;
import
com.applovin.sdk.AppLovinSdkInitializationConfiguration
;
import
com.applovin.sdk.AppLovinSdkSettings
;
import
com.halo.halojuhesdk.core.base.net.AbstractNetProcessor
;
import
com.halo.halojuhesdk.core.base.net.AbstractNetTask
;
...
...
@@ -20,7 +21,6 @@ import com.halo.halojuhesdk.core.common.utils.Config;
import
com.halo.halojuhesdk.core.common.utils.MyUtils
;
import
com.halo.halojuhesdk.sdk.HlAdClient
;
import
com.halomobi.sdk.HaloAdSdk
;
import
com.sensorsdata.analytics.android.sdk.SensorsDataAPI
;
import
org.json.JSONArray
;
import
org.json.JSONException
;
...
...
@@ -28,8 +28,6 @@ import org.json.JSONObject;
import
java.util.ArrayList
;
import
java.util.Iterator
;
import
java.util.List
;
import
java.util.logging.Logger
;
import
javax.net.ssl.HttpsURLConnection
;
/**
...
...
@@ -46,6 +44,7 @@ public class InitDataProcessor extends AbstractNetProcessor {
private
static
boolean
mMaxInit
;
private
static
Context
mContext
;
private
static
double
bidfloor
;
private
static
String
mMaxKey
;
public
InitDataProcessor
(
Context
context
,
String
appId
)
{
HlStatisManager
.
getInstance
().
cConfigRequestid
();
...
...
@@ -62,14 +61,12 @@ public class InitDataProcessor extends AbstractNetProcessor {
public
void
finish
(
int
code
,
String
content
)
{
if
(
code
==
HttpsURLConnection
.
HTTP_OK
)
{
try
{
LogUtils
.
e
(
"====finish==="
+
content
);
//
LogUtils.e("====finish===" + content);
judgeCode
(
content
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
reportSensorsData
(
0
,
code
,
content
);
}
else
{
reportSensorsData
(
1
,
code
,
content
);
addFailSp
();
}
}
...
...
@@ -102,7 +99,6 @@ public class InitDataProcessor extends AbstractNetProcessor {
if
(
code
!=
-
1
)
{
addFailSp
();
}
reportSensorsData
(
1
,
code
,
content
);
}
//失败增加到sp中.
...
...
@@ -232,7 +228,7 @@ public class InitDataProcessor extends AbstractNetProcessor {
private
static
void
initSlot
()
{
if
(
mMaxInit
)
{
initAppLovin
(
mContext
);
initAppLovin
(
mContext
,
mMaxKey
);
}
}
...
...
@@ -259,6 +255,7 @@ public class InitDataProcessor extends AbstractNetProcessor {
if
(!
adFrom
.
contains
(
"sdk"
))
{
mApiAppId
=
Config
.
mAppId
;
}
else
if
(
adFrom
.
contains
(
SDK_MAX
))
{
mMaxKey
=
extendStr
;
mMaxInit
=
true
;
}
slotBean
.
setSlotId
(
slotId
);
...
...
@@ -285,40 +282,24 @@ public class InitDataProcessor extends AbstractNetProcessor {
}
public
static
void
initAppLovin
(
Context
context
)
{
public
static
void
initAppLovin
(
Context
context
,
String
appKey
)
{
if
(
TextUtils
.
isEmpty
(
appKey
))
{
appKey
=
"IMXfnKH7kVTokP4lhli1GS0pDHgZVouBSVkbRiUqHuDbbV1Ioh6xB3EW9GOGQOnbN2P4FPAtOpNqpPNO_nK8yF"
;
}
Boolean
isInitSuccess
=
HlAdClient
.
initSuccessMap
.
get
(
"max"
);
if
(
isInitSuccess
==
null
||
!
isInitSuccess
)
{
AppLovinSdkSettings
sdkSettings
=
new
AppLovinSdkSettings
(
context
);
sdkSettings
.
setLocationCollectionEnabled
(
false
);
AppLovinSdk
instance
=
AppLovinSdk
.
getInstance
(
context
);
instance
.
getSettings
().
setMuted
(
true
);
instance
.
setMediationProvider
(
AppLovinMediationProvider
.
MAX
);
instance
.
initializeSdk
(
config
->
{
AppLovinSdkInitializationConfiguration
.
Builder
initConfigBuilder
=
AppLovinSdkInitializationConfiguration
.
builder
(
appKey
,
context
);
initConfigBuilder
.
setMediationProvider
(
AppLovinMediationProvider
.
MAX
);
AppLovinSdk
.
getInstance
(
context
).
initialize
(
initConfigBuilder
.
build
(),
appLovinSdkConfiguration
->
{
Log
.
e
(
"11111"
,
"====initializeSdk===="
);
HlAdClient
.
initSuccessMap
.
put
(
"max"
,
true
);
}
);
});
}
}
public
static
void
initApi
(
Context
context
)
{
HaloAdSdk
.
init
(
context
,
Config
.
mAppId
,
HlAdClient
.
mConfigInfo
);
}
private
void
reportSensorsData
(
int
type
,
int
code
,
String
content
)
{
JSONObject
jsonObject
=
new
JSONObject
();
try
{
jsonObject
.
put
(
"errorCode"
,
code
);
jsonObject
.
put
(
"msgContent"
,
content
);
String
eventIdStr
=
""
;
if
(
type
==
0
)
{
eventIdStr
=
"sdk_juhe_config_success"
;
}
else
if
(
type
==
1
){
eventIdStr
=
"sdk_juhe_config_error"
;
}
LogUtils
.
e
(
"===reportConfigSensor==="
+
jsonObject
);
SensorsDataAPI
.
sharedInstance
().
track
(
eventIdStr
,
jsonObject
);
}
catch
(
JSONException
e
)
{
throw
new
RuntimeException
(
e
);
}
}
}
haloJuheSdk/src/main/java/com/halo/halojuhesdk/core/request/InitDataTask.java
View file @
6ee673d6
...
...
@@ -36,7 +36,7 @@ public class InitDataTask extends AbstractNetTask {
+
mAppId
+
"&sdk="
+
SDK_VERSION
+
"&versionCode="
+
SystemUtils
.
getAppVer
()
+
"&adid="
+
HlStatisManager
.
getInstance
().
getConfigReqId
();
LogUtils
.
e
(
"===1111===="
+
urlStr
);
//
LogUtils.e("===1111====" + urlStr);
return
urlStr
;
}
...
...
haloJuheSdk/src/main/java/com/halo/halojuhesdk/core/request/StatProcessor.java
View file @
6ee673d6
...
...
@@ -6,12 +6,6 @@ import android.util.Log;
import
com.halo.halojuhesdk.core.base.net.AbstractNetProcessor
;
import
com.halo.halojuhesdk.core.base.net.AbstractNetTask
;
import
com.halo.halojuhesdk.core.base.utils.LogUtils
;
import
com.sensorsdata.analytics.android.sdk.SensorsDataAPI
;
import
org.json.JSONArray
;
import
org.json.JSONException
;
import
org.json.JSONObject
;
import
javax.net.ssl.HttpsURLConnection
;
/**
...
...
@@ -38,7 +32,6 @@ public class StatProcessor extends AbstractNetProcessor {
public
void
finish
(
int
code
,
String
content
)
{
if
(
code
==
HttpsURLConnection
.
HTTP_OK
)
{
LogUtils
.
e
(
"==StatProcessor==="
+
mPostjson
);
reportSensorsData
(
0
,
code
,
content
);
}
}
...
...
@@ -46,30 +39,5 @@ public class StatProcessor extends AbstractNetProcessor {
public
void
onError
(
int
code
,
String
content
)
{
//根据code 判断是否需要增加失败次数
Log
.
e
(
"==StatProcessorError==="
,
"code: "
+
code
+
" content: "
+
content
);
reportSensorsData
(
1
,
code
,
content
);
}
private
void
reportSensorsData
(
int
type
,
int
code
,
String
content
)
{
JSONObject
jsonObject
=
new
JSONObject
();
try
{
JSONArray
jsonArray
=
new
JSONArray
(
mPostjson
);
if
(
jsonArray
.
length
()
>
0
)
{
String
slotId
=
jsonArray
.
getJSONObject
(
0
).
optString
(
"slotId"
);
jsonObject
.
put
(
"slotId"
,
slotId
);
}
jsonObject
.
put
(
"errorCode"
,
code
);
jsonObject
.
put
(
"msgContent"
,
content
);
jsonObject
.
put
(
"postJson"
,
mPostjson
);
String
eventIdStr
=
""
;
if
(
type
==
0
)
{
eventIdStr
=
"sdk_juhe_request_success"
;
}
else
if
(
type
==
1
){
eventIdStr
=
"sdk_juhe_request_error"
;
}
LogUtils
.
e
(
"===reportSensor==="
+
jsonObject
);
SensorsDataAPI
.
sharedInstance
().
track
(
eventIdStr
,
jsonObject
);
}
catch
(
JSONException
e
)
{
throw
new
RuntimeException
(
e
);
}
}
}
haloJuheSdk/src/main/java/com/halo/halojuhesdk/core/request/StatTask.java
View file @
6ee673d6
...
...
@@ -34,10 +34,10 @@ public class StatTask extends AbstractNetTask {
@Override
public
String
getURL
()
{
if
(
isContainApiAd
())
{
Log
.
e
(
"11111"
,
"====getReportApiStartUrl===="
+
HttpUrlSettings
.
getReportApiStartUrl
(
mReqId
));
//
Log.e("11111","====getReportApiStartUrl====" + HttpUrlSettings.getReportApiStartUrl(mReqId));
return
HttpUrlSettings
.
getReportApiStartUrl
(
mReqId
);
}
Log
.
e
(
"11111"
,
"====getReportStartUrl===="
+
mReqId
);
//
Log.e("11111","====getReportStartUrl====" + mReqId);
return
HttpUrlSettings
.
getReportStartUrl
(
mReqId
);
}
...
...
haloJuheSdk/src/main/java/com/halo/halojuhesdk/core/request/StatisProcessor.java
View file @
6ee673d6
...
...
@@ -4,11 +4,6 @@ package com.halo.halojuhesdk.core.request;
import
com.halo.halojuhesdk.core.base.net.AbstractNetProcessor
;
import
com.halo.halojuhesdk.core.base.net.AbstractNetTask
;
import
com.halo.halojuhesdk.core.base.utils.LogUtils
;
import
com.sensorsdata.analytics.android.sdk.SensorsDataAPI
;
import
org.json.JSONArray
;
import
org.json.JSONException
;
import
org.json.JSONObject
;
import
javax.net.ssl.HttpsURLConnection
;
...
...
@@ -47,7 +42,6 @@ public class StatisProcessor extends AbstractNetProcessor {
}
}
LogUtils
.
e
(
"===reportStatis=="
+
mReqId
+
"===soltId==="
+
mBean
.
slotId
);
reportSensorsData
(
0
,
code
,
content
);
}
...
...
@@ -56,31 +50,10 @@ public class StatisProcessor extends AbstractNetProcessor {
if
(
mCallBack
!=
null
)
{
mCallBack
.
onError
();
}
reportSensorsData
(
1
,
code
,
content
);
}
public
void
callBack
(
RequestCallBack
requestCallBack
)
{
mCallBack
=
requestCallBack
;
}
private
void
reportSensorsData
(
int
type
,
int
code
,
String
content
)
{
JSONObject
jsonObject
=
new
JSONObject
();
try
{
jsonObject
.
put
(
"errorCode"
,
code
);
jsonObject
.
put
(
"msgContent"
,
content
);
jsonObject
.
put
(
"slotId"
,
mBean
.
slotId
);
jsonObject
.
put
(
"action"
,
mAction
);
jsonObject
.
put
(
"stepName"
,
mStepName
);
String
eventIdStr
=
""
;
if
(
type
==
0
)
{
eventIdStr
=
"sdk_juhe_report_success"
;
}
else
if
(
type
==
1
){
eventIdStr
=
"sdk_juhe_report_error"
;
}
LogUtils
.
e
(
"===reportActionSensor==="
+
jsonObject
);
SensorsDataAPI
.
sharedInstance
().
track
(
eventIdStr
,
jsonObject
);
}
catch
(
JSONException
e
)
{
throw
new
RuntimeException
(
e
);
}
}
}
haloJuheSdk/src/main/java/com/halo/halojuhesdk/core/request/StatisTask.java
View file @
6ee673d6
...
...
@@ -83,7 +83,7 @@ public class StatisTask extends AbstractNetTask {
jsonObject
.
put
(
"msg"
,
mErrorMsg
);
}
jsonObject
.
put
(
"cur"
,
"USD"
);
LogUtils
.
e
(
"====action==="
+
mAction
+
"===jsonObject==="
+
jsonObject
);
//
LogUtils.e("====action===" + mAction +"===jsonObject===" + jsonObject);
outputStream
.
write
(
jsonObject
.
toString
().
getBytes
());
}
}
catch
(
Exception
e
)
{
...
...
haloJuheSdk/src/main/java/com/halo/halojuhesdk/sdk/HlBannerAd.java
View file @
6ee673d6
...
...
@@ -37,6 +37,8 @@ import java.util.TimerTask;
import
java.util.UUID
;
public
class
HlBannerAd
{
private
int
mWidth
;
private
int
mHeight
;
private
String
mSlotId
;
private
Activity
mActivity
;
private
HlBannerListener
mAdListener
;
...
...
@@ -54,8 +56,14 @@ public class HlBannerAd {
private
String
mBannerReqId
;
private
String
showAdSlotId
;
public
HlBannerAd
(
Activity
context
,
String
slotId
,
HlBannerListener
listener
)
{
public
HlBannerAd
(
Activity
context
,
String
slotId
,
int
width
,
int
height
,
HlBannerListener
listener
)
{
if
(
context
==
null
)
{
mAdListener
.
onAdError
(
"横幅广告context不能为空"
,
InitStatus
.
INIT_FAIL_CODE
);
return
;
}
MyUtils
.
init
(
context
);
mWidth
=
width
;
mHeight
=
height
;
loadBanner
(
context
,
slotId
,
listener
);
}
...
...
@@ -122,7 +130,7 @@ public class HlBannerAd {
bannerMap
.
put
(
bean
.
adSlotId
,
appLovinInsert
);
}
else
if
(
adFrom
.
equals
(
InitDataProcessor
.
SDK_API
)
&&
HlAdClient
.
mTypeList
.
contains
(
Config
.
JuHeAdType
.
API
))
{
HlApiBannerAd
apiBanner
=
new
HlApiBannerAd
(
context
,
bean
,
proxyListener
);
HlApiBannerAd
apiBanner
=
new
HlApiBannerAd
(
context
,
bean
,
mWidth
,
mHeight
,
proxyListener
);
currentList
.
add
(
bean
);
bannerMap
.
put
(
bean
.
adSlotId
,
apiBanner
);
}
...
...
haloJuheSdk/src/main/java/com/halo/halojuhesdk/sdk/HlInsertAd.java
View file @
6ee673d6
...
...
@@ -39,6 +39,8 @@ import java.util.UUID;
* @description
*/
public
class
HlInsertAd
{
private
int
mWidth
;
private
int
mHeight
;
private
String
mSlotId
;
private
Activity
mActivity
;
private
HlInsertAdListener
mAdListener
;
...
...
@@ -53,8 +55,15 @@ public class HlInsertAd {
private
String
mShowAdSlotId
;
double
currentPrice
=
0
;
private
String
mInsertReqId
=
UUID
.
randomUUID
().
toString
();
public
HlInsertAd
(
Activity
context
,
String
slotId
,
HlInsertAdListener
adListener
)
{
public
HlInsertAd
(
Activity
context
,
String
slotId
,
int
width
,
int
height
,
HlInsertAdListener
adListener
)
{
if
(
context
==
null
)
{
mAdListener
.
onAdError
(
"插屏广告context不能为空"
,
InitStatus
.
INIT_FAIL_CODE
);
return
;
}
MyUtils
.
init
(
context
);
mWidth
=
width
;
mHeight
=
height
;
mSlotId
=
slotId
;
mPostJson
=
new
JSONArray
();
insertAdMap
=
new
HashMap
<>();
...
...
@@ -94,7 +103,7 @@ public class HlInsertAd {
currentList
.
add
(
bean
);
insertViewMap
.
put
(
bean
.
adSlotId
,
appLovinInsert
);
}
else
if
(
adFrom
.
equals
(
InitDataProcessor
.
SDK_API
)
&&
HlAdClient
.
mTypeList
.
contains
(
Config
.
JuHeAdType
.
API
))
{
HlApiInsertAd
apiInsert
=
new
HlApiInsertAd
(
context
,
bean
,
proxyListener
);
HlApiInsertAd
apiInsert
=
new
HlApiInsertAd
(
context
,
bean
,
mWidth
,
mHeight
,
proxyListener
);
currentList
.
add
(
bean
);
insertViewMap
.
put
(
bean
.
adSlotId
,
apiInsert
);
}
...
...
haloJuheSdk/src/main/java/com/halo/halojuhesdk/sdk/HlNativeAd.java
View file @
6ee673d6
...
...
@@ -39,9 +39,10 @@ import java.util.TimerTask;
import
java.util.UUID
;
public
class
HlNativeAd
{
private
int
mWidth
;
private
int
mHeight
;
private
int
mType
=
1
;
private
String
mSlotId
;
private
int
mDirectionType
;
private
Activity
mActivity
;
private
HlNativeAdListener
mHlNativeAdListener
;
private
HlNativeVideoListener
mVideoListener
;
...
...
@@ -58,14 +59,20 @@ public class HlNativeAd {
private
JSONArray
mPostJson
;
double
currentPrice
=
0
;
private
String
mNativeReqId
=
UUID
.
randomUUID
().
toString
();
public
HlNativeAd
(
Activity
context
,
String
slotId
,
HlNativeAdListener
nativeAdListener
)
{
public
HlNativeAd
(
Activity
context
,
String
slotId
,
int
width
,
int
height
,
int
type
,
HlNativeAdListener
nativeAdListener
)
{
if
(
context
==
null
)
{
mHlNativeAdListener
.
onADError
(
"模板渲染广告context不能为空"
,
InitStatus
.
INIT_FAIL_CODE
);
return
;
}
MyUtils
.
init
(
context
);
mWidth
=
width
;
mHeight
=
height
;
mType
=
type
;
nativeViewAdMap
=
new
HashMap
<>();
mPostJson
=
new
JSONArray
();
maxTime
=
Config
.
AD_TIME_OUT
;
isLoadAd
=
false
;
isAdClose
=
false
;
mDirectionType
=
3
;
mSlotId
=
slotId
;
nativeSelectMap
=
new
HashMap
<>();
nativeAdMap
=
new
HashMap
<>();
...
...
@@ -100,7 +107,7 @@ public class HlNativeAd {
currentList
.
add
(
bean
);
nativeAdMap
.
put
(
bean
.
adSlotId
,
appLovinNative
);
}
else
if
(
adFrom
.
equals
(
InitDataProcessor
.
SDK_API
)
&&
HlAdClient
.
mTypeList
.
contains
(
Config
.
JuHeAdType
.
API
))
{
HlApiNativeAd
apiNative
=
new
HlApiNativeAd
(
context
,
bean
,
null
,
proxyListener
);
HlApiNativeAd
apiNative
=
new
HlApiNativeAd
(
context
,
bean
,
null
,
mWidth
,
mHeight
,
mType
,
proxyListener
);
currentList
.
add
(
bean
);
nativeAdMap
.
put
(
bean
.
adSlotId
,
apiNative
);
}
...
...
@@ -175,7 +182,7 @@ public class HlNativeAd {
LogUtils
.
e
(
"hlsdk====mNativeShowFrom===="
+
mAdFrom
+
"===adSlotId==="
+
adSlotId
);
View
view
=
nativeViewAdMap
.
get
(
adSlotId
);
String
adType
=
adSubTypeMap
.
get
(
adSlotId
);
mHlNativeAdListener
.
onADLoadView
(
view
,
adType
,
0
f
);
mHlNativeAdListener
.
onADLoadView
(
view
,
adType
);
});
analyseBeanObj
(
bean
,
true
,
true
,
ecpmNum
);
}
else
{
...
...
@@ -225,7 +232,7 @@ public class HlNativeAd {
private
INativeProxyListener
proxyListener
=
new
INativeProxyListener
()
{
@Override
public
void
onADLoadView
(
View
view
,
String
adType
,
SlotBean
slotBean
,
double
ecpm
,
String
adSubType
,
float
ratio
)
{
public
void
onADLoadView
(
View
view
,
String
adType
,
SlotBean
slotBean
,
double
ecpm
,
String
adSubType
)
{
LogUtils
.
e
(
"====onADLoadView==="
+
adType
+
"====slotBean==="
+
slotBean
.
adSlotId
+
"==ecpm=="
+
ecpm
);
nativeSelectMap
.
put
(
slotBean
.
adSlotId
,
true
);
nativeViewAdMap
.
put
(
slotBean
.
adSlotId
,
view
);
...
...
haloJuheSdk/src/main/java/com/halo/halojuhesdk/sdk/HlNativeUnifiedAd.java
View file @
6ee673d6
...
...
@@ -39,7 +39,9 @@ import java.util.TimerTask;
import
java.util.UUID
;
public
class
HlNativeUnifiedAd
{
private
final
HlUnifiedAdParameter
mParameter
;
private
int
mWidth
;
private
int
mHeight
;
private
HlUnifiedAdParameter
mParameter
;
private
String
mSlotId
;
private
Activity
mActivity
;
private
HlNativeAdListener
mHlNativeAdListener
;
...
...
@@ -49,7 +51,6 @@ public class HlNativeUnifiedAd {
private
Map
<
String
,
SlotBean
>
nativePriceAdMap
;
private
HashMap
<
String
,
Double
>
ecpmAdMap
;
private
Map
<
String
,
String
>
adSubTypeMap
;
private
Map
<
String
,
Float
>
adRatioMap
;
private
int
maxTime
;
private
boolean
isLoadAd
;
private
String
mAdFrom
;
...
...
@@ -58,8 +59,14 @@ public class HlNativeUnifiedAd {
private
boolean
isAdClose
;
private
String
mNativeUnifiedReqId
=
UUID
.
randomUUID
().
toString
();
public
HlNativeUnifiedAd
(
Activity
context
,
String
slotId
,
HlUnifiedAdParameter
parameter
,
HlNativeAdListener
nativeAdListener
)
{
public
HlNativeUnifiedAd
(
Activity
context
,
String
slotId
,
HlUnifiedAdParameter
parameter
,
int
width
,
int
height
,
HlNativeAdListener
nativeAdListener
)
{
if
(
context
==
null
)
{
mHlNativeAdListener
.
onADError
(
"自渲染广告context不能为空"
,
InitStatus
.
INIT_FAIL_CODE
);
return
;
}
MyUtils
.
init
(
context
);
mWidth
=
width
;
mHeight
=
height
;
mParameter
=
parameter
;
nativeViewAdMap
=
new
HashMap
<>();
mPostJson
=
new
JSONArray
();
...
...
@@ -71,7 +78,6 @@ public class HlNativeUnifiedAd {
nativePriceAdMap
=
new
HashMap
<>();
ecpmAdMap
=
new
HashMap
<>();
adSubTypeMap
=
new
HashMap
<>();
adRatioMap
=
new
HashMap
<>();
mHlNativeAdListener
=
nativeAdListener
;
mActivity
=
context
;
List
<
SlotBean
>
slotBeanList
=
RequestAdManager
.
requestChannel
(
slotId
);
...
...
@@ -102,7 +108,7 @@ public class HlNativeUnifiedAd {
nativeAdMap
.
put
(
bean
.
adSlotId
,
appLovinNative
);
}
else
if
(
adFrom
.
equals
(
InitDataProcessor
.
SDK_API
)
&&
HlAdClient
.
mTypeList
.
contains
(
Config
.
JuHeAdType
.
API
))
{
HlApiUnifiedNativeAd
apiNative
=
new
HlApiUnifiedNativeAd
(
mActivity
,
bean
,
mParameter
,
proxyListener
);
HlApiUnifiedNativeAd
apiNative
=
new
HlApiUnifiedNativeAd
(
mActivity
,
bean
,
mParameter
,
mWidth
,
mHeight
,
proxyListener
);
currentList
.
add
(
bean
);
nativeAdMap
.
put
(
bean
.
adSlotId
,
apiNative
);
}
...
...
@@ -177,8 +183,7 @@ public class HlNativeUnifiedAd {
LogUtils
.
e
(
"hlsdk====mNativeShowFrom===="
+
mAdFrom
+
"===adSlotId==="
+
adSlotId
);
View
view
=
nativeViewAdMap
.
get
(
adSlotId
);
String
adType
=
adSubTypeMap
.
get
(
adSlotId
);
Float
ratio
=
adRatioMap
.
get
(
adSlotId
);
mHlNativeAdListener
.
onADLoadView
(
view
,
adType
,
ratio
);
mHlNativeAdListener
.
onADLoadView
(
view
,
adType
);
});
analyseBeanObj
(
bean
,
true
,
true
,
ecpmNum
);
}
else
{
...
...
@@ -232,13 +237,12 @@ public class HlNativeUnifiedAd {
private
INativeProxyListener
proxyListener
=
new
INativeProxyListener
()
{
@Override
public
void
onADLoadView
(
View
view
,
String
adType
,
SlotBean
slotBean
,
double
ecpm
,
String
adSubType
,
float
ratio
)
{
public
void
onADLoadView
(
View
view
,
String
adType
,
SlotBean
slotBean
,
double
ecpm
,
String
adSubType
)
{
LogUtils
.
e
(
"====onADLoadView==="
+
adType
+
"====adSlotId==="
+
slotBean
.
adSlotId
);
nativeSelectMap
.
put
(
slotBean
.
adSlotId
,
true
);
nativeViewAdMap
.
put
(
slotBean
.
adSlotId
,
view
);
ecpmAdMap
.
put
(
slotBean
.
adSlotId
,
ecpm
);
adSubTypeMap
.
put
(
slotBean
.
adSlotId
,
adSubType
);
adRatioMap
.
put
(
slotBean
.
adSlotId
,
ratio
);
}
@Override
...
...
haloJuheSdk/src/main/java/com/halo/halojuhesdk/sdk/HlSplashAd.java
View file @
6ee673d6
...
...
@@ -33,7 +33,7 @@ import java.util.TimerTask;
import
java.util.UUID
;
public
class
HlSplashAd
{
private
final
Activity
mContext
;
private
Activity
mContext
;
private
HlSplashAdListener
mListener
;
private
Activity
mActivity
;
private
ViewGroup
mAdContainer
;
...
...
@@ -61,6 +61,10 @@ public class HlSplashAd {
private
TimerTask
timerLooperTask
;
public
HlSplashAd
(
Activity
context
,
String
slotId
,
ViewGroup
adContainer
,
HlSplashAdListener
listener
)
{
if
(
context
==
null
)
{
mListener
.
onAdError
(
"开屏广告context不能为空"
,
InitStatus
.
INIT_FAIL_CODE
);
return
;
}
MyUtils
.
init
(
context
);
mContext
=
context
;
maxTime
=
Config
.
AD_TIME_OUT
;
...
...
haloJuheSdk/src/main/java/com/halo/halojuhesdk/sdk/HlVideoAd.java
View file @
6ee673d6
...
...
@@ -34,7 +34,7 @@ import java.util.TimerTask;
import
java.util.UUID
;
public
class
HlVideoAd
{
private
final
HashMap
<
String
,
SlotBean
>
videoPriceMap
;
private
HashMap
<
String
,
SlotBean
>
videoPriceMap
;
private
String
mSlotId
;
private
Map
<
String
,
Double
>
ecpmAdMap
;
private
HlVideoListener
mVideoListener
;
...
...
@@ -49,6 +49,10 @@ public class HlVideoAd {
double
currentPrice
=
0
;
private
String
mVideoReqId
=
UUID
.
randomUUID
().
toString
();
public
HlVideoAd
(
Activity
context
,
String
slotId
,
HlVideoListener
mVideoListener
)
{
if
(
context
==
null
)
{
mVideoListener
.
onAdFailed
(
"视频广告context不能为空"
,
InitStatus
.
INIT_FAIL_CODE
);
return
;
}
MyUtils
.
init
(
context
);
mPostJson
=
new
JSONArray
();
videoSelectMap
=
new
HashMap
<>();
...
...
haloJuheSdk/src/main/java/com/halo/halojuhesdk/sdk/listener/HlNativeAdListener.java
View file @
6ee673d6
...
...
@@ -4,7 +4,7 @@ package com.halo.halojuhesdk.sdk.listener;
import
android.view.View
;
public
interface
HlNativeAdListener
{
void
onADLoadView
(
View
view
,
String
adTypeStr
,
float
ratio
);
void
onADLoadView
(
View
view
,
String
adTypeStr
);
void
onADClick
(
View
view
,
String
adTypeStr
);
void
onADShow
(
View
view
,
String
adTypeStr
);
void
onADClose
(
View
view
);
...
...
haloMobiSdk/build.gradle
View file @
6ee673d6
apply
plugin:
'com.android.library'
def
SDK_CHANNEL
=
"halomobi"
def
SDK_VERSION
=
"1.
0
.0"
def
SDK_VERSION
=
"1.
1
.0"
def
SDK_BASENAME
=
SDK_CHANNEL
+
"_sdk_v"
+
SDK_VERSION
def
sdkDestinationPath
=
"build/outputs/jar/"
...
...
@@ -31,8 +31,6 @@ android {
defaultConfig
{
minSdkVersion
21
targetSdkVersion
33
versionCode
1
versionName
"1.0"
}
buildTypes
{
release
{
...
...
haloMobiSdk/proguard-rules.pro
View file @
6ee673d6
...
...
@@ -45,4 +45,4 @@ public void *(android.view.View);
-
keep
public
class
*
extends
android
.
app
.
Activity
-
keep
public
class
*
extends
android
.
content
.
BroadcastReceiver
{
*
;}
-
keep
public
class
com
.
halomobi
.
sdk
.
**
{
*
;}
\ No newline at end of file
-
keep
public
class
com
.
halomobi
.
**
{
*
;}
\ No newline at end of file
haloMobiSdk/src/main/java/com/halomobi/network/request/ad/RequestAdProcessor.java
View file @
6ee673d6
...
...
@@ -176,6 +176,8 @@ public class RequestAdProcessor extends AbsNetProcessor {
ad
.
nurl
=
jsonAd
.
optString
(
"nurl"
);
ad
.
burl
=
jsonAd
.
optString
(
"burl"
);
ad
.
adm
=
jsonAd
.
optString
(
"adm"
);
ad
.
w
=
jsonAd
.
optInt
(
"w"
);
ad
.
h
=
jsonAd
.
optInt
(
"h"
);
ad
.
crid
=
jsonAd
.
optString
(
"crid"
);
ad
.
landing_url
=
jsonAd
.
optString
(
"lurl"
);
// ad.imp_tracks = add2List(jsonAd, "imp_tracks");
...
...
haloMobiSdk/src/main/java/com/halomobi/network/request/ad/bean/AdRequest.java
View file @
6ee673d6
...
...
@@ -47,10 +47,10 @@ public class AdRequest {
public
static
byte
[]
getParams
(
AdParameter
parameter
)
{
AdRequest
jParam
=
new
AdRequest
(
parameter
);
return
serializeJson
(
jParam
);
return
serializeJson
(
jParam
,
parameter
);
}
private
static
byte
[]
serializeJson
(
AdRequest
parameter
)
{
private
static
byte
[]
serializeJson
(
AdRequest
parameter
,
AdParameter
currentParameter
)
{
JSONObject
jsonObject
=
new
JSONObject
();
try
{
jsonObject
.
put
(
"id"
,
Config
.
getUUID
());
...
...
@@ -81,11 +81,23 @@ public class AdRequest {
int
slotType
=
adSlot
.
slot_type
;
if
(
slotType
==
ConstantPool
.
AdType
.
BANNER
.
getType
())
{
if
(
currentParameter
.
adViewSize
.
length
==
2
)
{
adObject
.
put
(
"w"
,
currentParameter
.
adViewSize
[
0
]);
adObject
.
put
(
"h"
,
currentParameter
.
adViewSize
[
1
]);
}
impObject
.
put
(
"banner"
,
adObject
);
}
else
if
(
slotType
==
ConstantPool
.
AdType
.
INSERT
.
getType
())
{
if
(
currentParameter
.
adViewSize
.
length
==
2
)
{
adObject
.
put
(
"w"
,
currentParameter
.
adViewSize
[
0
]);
adObject
.
put
(
"h"
,
currentParameter
.
adViewSize
[
1
]);
}
impObject
.
put
(
"banner"
,
adObject
);
impObject
.
put
(
"instl"
,
1
);
}
else
if
(
slotType
==
ConstantPool
.
AdType
.
REWARDVIDEO
.
getType
())
{
if
(
currentParameter
.
adViewSize
.
length
==
2
)
{
adObject
.
put
(
"w"
,
currentParameter
.
adViewSize
[
0
]);
adObject
.
put
(
"h"
,
currentParameter
.
adViewSize
[
1
]);
}
impObject
.
put
(
"video"
,
adObject
);
}
else
if
(
slotType
==
ConstantPool
.
AdType
.
NATIVE
.
getType
())
{
JSONObject
requestObj
=
new
JSONObject
();
...
...
@@ -95,8 +107,14 @@ public class AdRequest {
assetsSubObj
.
put
(
"required"
,
1
);
JSONObject
assetsImgObj
=
new
JSONObject
();
assetsImgObj
.
put
(
"type"
,
3
);
assetsImgObj
.
put
(
"w"
,
Utils
.
getScreenSize
(
Utils
.
getContext
(),
true
)[
0
]);
assetsImgObj
.
put
(
"h"
,
450
);
if
(
currentParameter
.
adViewSize
.
length
==
2
)
{
assetsImgObj
.
put
(
"w"
,
currentParameter
.
adViewSize
[
0
]);
assetsImgObj
.
put
(
"h"
,
currentParameter
.
adViewSize
[
1
]);
assetsImgObj
.
put
(
"wmin"
,
currentParameter
.
adViewSize
[
0
]);
assetsImgObj
.
put
(
"hmin"
,
currentParameter
.
adViewSize
[
1
]);
}
// assetsImgObj.put("w", Utils.getScreenSize(Utils.getContext(),true)[0]);
// assetsImgObj.put("h", 450);
// JSONArray mimesImgArr = new JSONArray();
List
<
String
>
imgList
=
new
ArrayList
<>();
imgList
.
add
(
"image/jpg"
);
...
...
@@ -107,10 +125,12 @@ public class AdRequest {
assetsImgObj
.
put
(
"mimes"
,
mimesImgArr
);
assetsSubObj
.
put
(
"img"
,
assetsImgObj
);
assetsArr
.
put
(
assetsSubObj
);
requestObj
.
put
(
"assets"
,
assetsArr
);
requestObj
.
put
(
"ver"
,
"1.0"
);
String
requestStr
=
"{\"assets\":[{\"id\":1,\"required\":1,\"img\":{\"type\":3,\"w\":720,\"h\":1280,\"mimes\":[\"image/jpg\",\"image/png\"]}}],\"ver\":\"1.0\"}"
;
adObject
.
put
(
"request"
,
requestObj
.
toString
());
requestObj
.
put
(
"assets"
,
assetsArr
);
JSONObject
subNativeObj
=
new
JSONObject
();
subNativeObj
.
put
(
"native"
,
requestObj
);
// String requestStr = "{\"assets\":[{\"id\":1,\"required\":1,\"img\":{\"type\":3,\"w\":720,\"h\":1280,\"mimes\":[\"image/jpg\",\"image/png\"]}}],\"ver\":\"1.0\"}";
adObject
.
put
(
"request"
,
subNativeObj
.
toString
());
impObject
.
put
(
"native"
,
adObject
);
}
impArray
.
put
(
impObject
);
...
...
@@ -169,7 +189,7 @@ public class AdRequest {
if
(
BuildConfig
.
DEBUG
)
{
jsonObject
.
put
(
"test"
,
1
);
}
Log
.
e
(
"11111"
,
"===js==="
+
jsonObject
);
//
Log.e("11111","===js===" + jsonObject);
}
catch
(
JSONException
e
)
{
throw
new
RuntimeException
(
e
);
}
...
...
haloMobiSdk/src/main/java/com/halomobi/sdk/HMBannerAd.java
View file @
6ee673d6
package
com
.
halomobi
.
sdk
;
import
static
com
.
halomobi
.
common
.
ConstantPool
.
TrackerType
.
CLICK
;
import
static
com
.
halomobi
.
common
.
ConstantPool
.
TrackerType
.
DEEP_LINK_OPEN
;
import
android.app.Activity
;
import
android.app.AlertDialog
;
import
android.content.ActivityNotFoundException
;
import
android.content.ComponentName
;
import
android.content.DialogInterface
;
import
android.content.Intent
;
import
android.content.pm.PackageManager
;
import
android.content.pm.ResolveInfo
;
import
android.graphics.Bitmap
;
import
android.net.Uri
;
import
android.util.Log
;
import
android.view.LayoutInflater
;
import
android.view.View
;
...
...
@@ -17,6 +24,7 @@ import android.widget.ImageView;
import
com.halomobi.common.ConstantPool
;
import
com.halomobi.network.listeners.AdStateChangListener
;
import
com.halomobi.network.listeners.ClickAdStateChangListener
;
import
com.halomobi.network.request.ad.bean.Ad
;
import
com.halomobi.network.request.ad.bean.AdParameter
;
import
com.halomobi.sdk.listener.BannerListener
;
...
...
@@ -25,6 +33,7 @@ import com.halomobi.utils.LogUtils;
import
com.halomobi.utils.PxUtil
;
import
com.halomobi.utils.WebViewUtils
;
import
java.net.URISyntaxException
;
import
java.util.List
;
public
class
HMBannerAd
{
...
...
@@ -88,6 +97,12 @@ public class HMBannerAd {
String
adm
=
adInfo
.
adm
.
replace
(
"${AUCTION_BID_ID}"
,
adid
);
View
inflate
=
LayoutInflater
.
from
(
activity
).
inflate
(
R
.
layout
.
hl_dialog_banner
,
null
,
false
);
final
WebView
mWebView
=
inflate
.
findViewById
(
R
.
id
.
webView
);
ViewGroup
.
LayoutParams
layoutParams
=
mWebView
.
getLayoutParams
();
if
(
mHlParameter
.
getAdWidth
()
>
0
&&
mHlParameter
.
getAdHeight
()
>
0
)
{
layoutParams
.
width
=
mHlParameter
.
getAdWidth
();
layoutParams
.
height
=
mHlParameter
.
getAdHeight
();
mWebView
.
setLayoutParams
(
layoutParams
);
}
WebViewUtils
utils
=
new
WebViewUtils
();
utils
.
initWebView
(
activity
,
mWebView
,
adInfo
);
mWebView
.
loadData
(
adm
,
"text/html"
,
"UTF-8"
);
...
...
@@ -96,15 +111,12 @@ public class HMBannerAd {
@Override
public
boolean
shouldOverrideUrlLoading
(
WebView
view
,
WebResourceRequest
request
)
{
Log
.
e
(
"11111"
,
"===shouldOverrideUrlLoading==="
+
request
.
getUrl
());
if
(
request
.
getUrl
().
toString
().
contains
(
"halomobi.com/api/cpi/click"
))
{
final
Intent
intent
=
new
Intent
();
intent
.
setAction
(
Intent
.
ACTION_VIEW
);
intent
.
setData
(
request
.
getUrl
());
// 注意此处的判断intent.resolveActivity()可以返回显示该Intent的Activity对应的组件名
// 官方解释 : Name of the component implementing an activity that can display the intent
if
(
intent
.
resolveActivity
(
mActivity
.
getPackageManager
())
!=
null
)
{
mActivity
.
startActivity
(
Intent
.
createChooser
(
intent
,
"请选择浏览器"
));
}
String
url
=
request
.
getUrl
().
toString
();
boolean
isGoToApp
=
gotoQuickApp
(
url
);
if
(!
isGoToApp
)
{
Intent
intent
=
new
Intent
(
mActivity
,
WebViewActivity
.
class
);
intent
.
putExtra
(
"urlStr"
,
url
);
mActivity
.
startActivity
(
intent
);
}
return
true
;
}
...
...
@@ -128,6 +140,24 @@ public class HMBannerAd {
});
}
private
boolean
gotoQuickApp
(
String
deepLink
)
{
try
{
Intent
deepLinkIntent
=
Intent
.
parseUri
(
deepLink
,
Intent
.
URI_INTENT_SCHEME
);
deepLinkIntent
.
setFlags
(
Intent
.
FLAG_ACTIVITY_NEW_TASK
);
ResolveInfo
resolveInfo
=
mActivity
.
getPackageManager
().
resolveActivity
(
deepLinkIntent
,
PackageManager
.
MATCH_DEFAULT_ONLY
);
if
(
resolveInfo
!=
null
)
{
mActivity
.
startActivity
(
deepLinkIntent
);
return
true
;
}
}
catch
(
ActivityNotFoundException
e
)
{
LogUtils
.
w
(
"DeepLink NotFound : "
+
deepLink
);
}
catch
(
URISyntaxException
e
)
{
e
.
printStackTrace
();
LogUtils
.
w
(
"DeepLink NotFound : "
+
deepLink
);
}
return
false
;
}
public
double
getEcpm
()
{
return
currentPrice
;
}
...
...
haloMobiSdk/src/main/java/com/halomobi/sdk/HMInsertAd.java
View file @
6ee673d6
...
...
@@ -2,8 +2,11 @@ package com.halomobi.sdk;
import
android.app.Activity
;
import
android.app.AlertDialog
;
import
android.content.ActivityNotFoundException
;
import
android.content.DialogInterface
;
import
android.content.Intent
;
import
android.content.pm.PackageManager
;
import
android.content.pm.ResolveInfo
;
import
android.graphics.Bitmap
;
import
android.util.Log
;
import
android.view.Gravity
;
...
...
@@ -26,6 +29,15 @@ import com.halomobi.utils.LogUtils;
import
com.halomobi.utils.PxUtil
;
import
com.halomobi.utils.WebViewUtils
;
import
org.json.JSONArray
;
import
org.json.JSONObject
;
import
java.io.BufferedReader
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.io.InputStreamReader
;
import
java.net.URISyntaxException
;
import
java.util.ArrayList
;
import
java.util.List
;
public
class
HMInsertAd
{
...
...
@@ -68,6 +80,7 @@ public class HMInsertAd{
@Override
public
void
onAdReach
(
Ad
adInfo
)
{
currentAd
=
adInfo
;
currentPrice
=
adInfo
.
price
;
mListener
.
onAdReady
();
}
...
...
@@ -83,20 +96,29 @@ public class HMInsertAd{
}
private
void
showInsertAd
(
Activity
activity
,
Ad
adInfo
,
HlAdParameter
hlParameter
)
{
LogUtils
.
e
(
"===adInfo==="
+
adInfo
.
adm
);
LogUtils
.
e
(
"===adInfo==="
+
adInfo
.
adm
+
"====w==="
+
adInfo
.
w
);
activity
.
runOnUiThread
(()
->
{
currentPrice
=
adInfo
.
price
;
String
adid
=
adInfo
.
adid
;
String
adm
=
adInfo
.
adm
.
replace
(
"${AUCTION_BID_ID}"
,
adid
);
adDialog
.
show
();
// Window window = adDialog.getWindow();
// if (window != null) {
// WindowManager.LayoutParams lp = window.getAttributes();
// lp.width = hlParameter.getAdWidth();
// lp.height = hlParameter.getAdHeight();
// lp.gravity = Gravity.CENTER;
// adDialog.getWindow().setAttributes(lp);
// }
Window
window
=
adDialog
.
getWindow
();
if
(
adInfo
.
w
>
10
&&
adInfo
.
h
>
10
)
{
if
(
window
!=
null
)
{
WindowManager
.
LayoutParams
lp
=
window
.
getAttributes
();
lp
.
width
=
adInfo
.
w
;
lp
.
height
=
adInfo
.
h
;
lp
.
gravity
=
Gravity
.
CENTER
;
adDialog
.
getWindow
().
setAttributes
(
lp
);
}
}
else
{
if
(
window
!=
null
)
{
WindowManager
.
LayoutParams
lp
=
window
.
getAttributes
();
lp
.
width
=
hlParameter
.
getAdWidth
();
lp
.
height
=
hlParameter
.
getAdHeight
();
lp
.
gravity
=
Gravity
.
CENTER
;
adDialog
.
getWindow
().
setAttributes
(
lp
);
}
}
View
inflate
=
LayoutInflater
.
from
(
activity
).
inflate
(
R
.
layout
.
hl_dialog_insert
,
null
,
false
);
ImageView
mImageClose
=
inflate
.
findViewById
(
R
.
id
.
image_close
);
final
WebView
mWebView
=
inflate
.
findViewById
(
R
.
id
.
webView
);
...
...
@@ -115,11 +137,13 @@ public class HMInsertAd{
@Override
public
boolean
shouldOverrideUrlLoading
(
WebView
view
,
WebResourceRequest
request
)
{
Log
.
e
(
"11111"
,
"===shouldOverrideUrlLoading==="
+
request
.
getUrl
());
Intent
intent
=
new
Intent
();
intent
.
setAction
(
Intent
.
ACTION_VIEW
);
intent
.
setData
(
request
.
getUrl
());
if
(
intent
.
resolveActivity
(
mActivity
.
getPackageManager
())
!=
null
)
{
mActivity
.
startActivity
(
Intent
.
createChooser
(
intent
,
"请选择浏览器"
));
String
url
=
request
.
getUrl
().
toString
();
boolean
isGoToApp
=
gotoQuickApp
(
url
);
if
(!
isGoToApp
)
{
adDialog
.
dismiss
();
Intent
intent
=
new
Intent
(
mActivity
,
WebViewActivity
.
class
);
intent
.
putExtra
(
"urlStr"
,
url
);
mActivity
.
startActivity
(
intent
);
}
return
false
;
}
...
...
@@ -147,6 +171,25 @@ public class HMInsertAd{
});
}
private
boolean
gotoQuickApp
(
String
deepLink
)
{
try
{
Intent
deepLinkIntent
=
Intent
.
parseUri
(
deepLink
,
Intent
.
URI_INTENT_SCHEME
);
deepLinkIntent
.
setFlags
(
Intent
.
FLAG_ACTIVITY_NEW_TASK
);
ResolveInfo
resolveInfo
=
mActivity
.
getPackageManager
().
resolveActivity
(
deepLinkIntent
,
PackageManager
.
MATCH_DEFAULT_ONLY
);
if
(
resolveInfo
!=
null
)
{
mActivity
.
startActivity
(
deepLinkIntent
);
adDialog
.
dismiss
();
return
true
;
}
}
catch
(
ActivityNotFoundException
e
)
{
LogUtils
.
w
(
"DeepLink NotFound : "
+
deepLink
);
}
catch
(
URISyntaxException
e
)
{
e
.
printStackTrace
();
LogUtils
.
w
(
"DeepLink NotFound : "
+
deepLink
);
}
return
false
;
}
public
double
getEcpm
()
{
return
currentPrice
;
}
...
...
haloMobiSdk/src/main/java/com/halomobi/sdk/HMNativeAd.java
View file @
6ee673d6
...
...
@@ -6,6 +6,7 @@ import android.text.TextUtils;
import
android.util.SparseArray
;
import
android.view.LayoutInflater
;
import
android.view.View
;
import
android.view.ViewGroup
;
import
android.view.ViewTreeObserver
;
import
android.widget.ImageView
;
import
android.widget.RelativeLayout
;
...
...
@@ -25,6 +26,10 @@ import com.halomobi.view.imageloader.ImageLoader;
import
org.json.JSONArray
;
import
org.json.JSONObject
;
import
java.io.BufferedReader
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.io.InputStreamReader
;
import
java.util.ArrayList
;
import
java.util.List
;
...
...
@@ -40,7 +45,7 @@ public class HMNativeAd {
mActivity
=
activity
;
mParameter
=
parameter
;
mNativeListener
=
listener
;
mDirectionType
=
3
;
mDirectionType
=
parameter
.
getType
()
;
adController
=
new
AdController
(
activity
);
}
...
...
@@ -101,6 +106,14 @@ public class HMNativeAd {
String
imgUrl
=
imgObject
.
optString
(
"url"
);
int
type
=
imgObject
.
optInt
(
"type"
);
if
(
type
==
3
)
{
int
w
=
imgObject
.
optInt
(
"w"
);
if
(
w
>
0
)
{
hlNativeResponse
.
setImageWidth
(
w
);
}
int
h
=
imgObject
.
optInt
(
"h"
);
if
(
h
>
0
)
{
hlNativeResponse
.
setImageHeight
(
h
);
}
imgList
.
add
(
imgUrl
);
}
if
(
type
==
1
)
{
...
...
@@ -187,6 +200,12 @@ public class HMNativeAd {
TextView
title
=
inflate
.
findViewById
(
R
.
id
.
tv_item_title
);
TextView
subTitle
=
inflate
.
findViewById
(
R
.
id
.
tv_item_details
);
ImageView
mImageSource
=
inflate
.
findViewById
(
R
.
id
.
image_item_source
);
if
(
hlResponse
.
getImageWidth
()
>
0
&&
hlResponse
.
getImageHeight
()
>
0
)
{
ViewGroup
.
LayoutParams
layoutParams
=
imageView
.
getLayoutParams
();
layoutParams
.
width
=
hlResponse
.
getImageWidth
();
layoutParams
.
height
=
hlResponse
.
getImageHeight
();
imageView
.
setLayoutParams
(
layoutParams
);
}
String
logoUrl
=
hlResponse
.
getLogoUrl
();
if
(!
TextUtils
.
isEmpty
(
logoUrl
))
{
mImageSource
.
setVisibility
(
View
.
VISIBLE
);
...
...
@@ -198,8 +217,14 @@ public class HMNativeAd {
if
(
imgList
!=
null
&&
!
imgList
.
isEmpty
())
{
ImageLoader
.
load
(
imageView
,
imgList
.
get
(
0
));
}
title
.
setText
(
hlResponse
.
getTitle
());
subTitle
.
setText
(
hlResponse
.
getAdDescription
());
if
(!
TextUtils
.
isEmpty
(
hlResponse
.
getTitle
()))
{
title
.
setVisibility
(
View
.
VISIBLE
);
title
.
setText
(
hlResponse
.
getTitle
());
}
if
(!
TextUtils
.
isEmpty
(
hlResponse
.
getAdDescription
()))
{
subTitle
.
setVisibility
(
View
.
VISIBLE
);
subTitle
.
setText
(
hlResponse
.
getAdDescription
());
}
inflate
.
setOnClickListener
(
v
->
{
hlResponse
.
handleClick
(
v
,
!
isClick
);
if
(!
isClick
)
{
...
...
haloMobiSdk/src/main/java/com/halomobi/sdk/HMUnifiedNativeAd.java
View file @
6ee673d6
package
com
.
halomobi
.
sdk
;
import
android.app.Activity
;
import
android.graphics.Color
;
import
android.text.TextUtils
;
import
android.util.Log
;
import
android.util.SparseArray
;
import
android.view.View
;
import
android.view.ViewGroup
;
import
android.view.ViewTreeObserver
;
import
android.widget.ImageView
;
import
android.widget.LinearLayout
;
import
android.widget.RelativeLayout
;
import
android.widget.TextView
;
...
...
@@ -16,12 +19,17 @@ import com.halomobi.sdk.listener.NativeUnifiedListener;
import
com.halomobi.network.listeners.AdStateChangListener
;
import
com.halomobi.network.request.ad.bean.Ad
;
import
com.halomobi.network.request.ad.bean.AdParameter
;
import
com.halomobi.utils.PxUtil
;
import
com.halomobi.utils.Utils
;
import
com.halomobi.view.imageloader.ImageLoader
;
import
org.json.JSONArray
;
import
org.json.JSONObject
;
import
java.io.BufferedReader
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.io.InputStreamReader
;
import
java.util.ArrayList
;
import
java.util.List
;
...
...
@@ -153,25 +161,51 @@ public class HMUnifiedNativeAd {
return
null
;
}
public
View
showViewById
(
int
adLayoutId
,
int
adContentId
,
int
adTitleId
,
int
adSubTitleId
)
{
public
View
showViewById
(
int
adLayoutId
,
int
adContentId
,
int
adTitleId
,
int
adSubTitleId
,
int
adOptionsId
)
{
View
inflate
=
View
.
inflate
(
mActivity
,
adLayoutId
,
null
);
if
(
adTitleId
>
0
)
{
TextView
mTitleAd
=
inflate
.
findViewById
(
adTitleId
);
mTitleAd
.
setText
(
nativeResponse
.
getTitle
());
}
if
(
adSubTitleId
>
0
)
{
TextView
mSubTitle
=
inflate
.
findViewById
(
adSubTitleId
);
mSubTitle
.
setText
(
nativeResponse
.
getAdDescription
());
}
RelativeLayout
relativeLayout
=
new
RelativeLayout
(
mActivity
);
ImageView
imageView
=
new
ImageView
(
mActivity
);
imageView
.
setScaleType
(
ImageView
.
ScaleType
.
FIT_
CENTER
);
List
<
String
>
imgList
=
nativeResponse
.
getImgList
(
);
if
(
imgList
!=
null
&&
!
imgList
.
isEmpty
()
)
{
ImageLoader
.
load
(
imageView
,
imgList
.
get
(
0
)
);
imageView
.
setScaleType
(
ImageView
.
ScaleType
.
FIT_
XY
);
View
mAdOptionsId
=
inflate
.
findViewById
(
adOptionsId
);
if
(
mAdOptionsId
!=
null
)
{
mAdOptionsId
.
setVisibility
(
View
.
GONE
);
}
if
(
adContentId
>
0
)
{
ViewGroup
mAdContentId
=
inflate
.
findViewById
(
adContentId
);
mAdContentId
.
addView
(
imageView
);
if
(
mAdContentId
!=
null
)
{
mAdContentId
.
post
(()
->
{
RelativeLayout
.
LayoutParams
layoutParams
=
new
RelativeLayout
.
LayoutParams
(
ViewGroup
.
LayoutParams
.
MATCH_PARENT
,
ViewGroup
.
LayoutParams
.
MATCH_PARENT
);
if
(
mAdContentId
.
getWidth
()
>
0
)
{
layoutParams
.
width
=
mAdContentId
.
getWidth
();
}
else
{
layoutParams
.
width
=
PxUtil
.
getDeviceWidthInPixel
(
mActivity
);
}
layoutParams
.
height
=
mAdContentId
.
getHeight
();
relativeLayout
.
setLayoutParams
(
layoutParams
);
imageView
.
setLayoutParams
(
new
ViewGroup
.
LayoutParams
(
ViewGroup
.
LayoutParams
.
MATCH_PARENT
,
ViewGroup
.
LayoutParams
.
MATCH_PARENT
));
mActivity
.
runOnUiThread
(()
->
{
List
<
String
>
imgList
=
nativeResponse
.
getImgList
();
if
(
imgList
!=
null
&&
!
imgList
.
isEmpty
())
{
ImageLoader
.
load
(
imageView
,
imgList
.
get
(
0
));
}
relativeLayout
.
addView
(
imageView
);
mAdContentId
.
addView
(
relativeLayout
);
if
(
adTitleId
>
0
)
{
TextView
mTitleAd
=
inflate
.
findViewById
(
adTitleId
);
if
(
mTitleAd
!=
null
)
{
mTitleAd
.
setText
(
nativeResponse
.
getTitle
());
}
}
if
(
adSubTitleId
>
0
)
{
TextView
mSubTitle
=
inflate
.
findViewById
(
adSubTitleId
);
if
(
mSubTitle
!=
null
)
{
mSubTitle
.
setText
(
nativeResponse
.
getAdDescription
());
}
}
});
});
}
}
inflate
.
setOnClickListener
(
v
->
{
...
...
haloMobiSdk/src/main/java/com/halomobi/sdk/HMVideoAd.java
View file @
6ee673d6
...
...
@@ -36,6 +36,7 @@ import java.util.Date;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Locale
;
import
java.util.logging.Logger
;
public
class
HMVideoAd
{
private
RewardVideoListener
mListener
;
...
...
@@ -67,6 +68,7 @@ public class HMVideoAd {
@Override
public
void
onAdReach
(
Ad
adInfo
)
{
String
adm
=
adInfo
.
adm
;
LogUtils
.
e
(
"===adInfo==="
+
adInfo
.
adm
);
currentPrice
=
adInfo
.
price
;
adInfo
.
adm
=
adm
.
replace
(
"${AUCTION_BID_ID}"
,
adInfo
.
adid
);
adInfo
.
reward_video
=
new
Ad
.
RewardVideoAds
();
...
...
haloMobiSdk/src/main/java/com/halomobi/sdk/HlAdParameter.java
View file @
6ee673d6
...
...
@@ -4,10 +4,12 @@ public class HlAdParameter {
private
int
mWidth
;
private
int
mHeight
;
private
String
mSlotAdId
;
private
int
mType
;
private
HlAdParameter
(
Builder
builder
)
{
this
.
mWidth
=
builder
.
width
;
this
.
mHeight
=
builder
.
height
;
this
.
mType
=
builder
.
type
;
this
.
mSlotAdId
=
builder
.
slotAdId
;
}
...
...
@@ -23,10 +25,15 @@ public class HlAdParameter {
return
mSlotAdId
;
}
public
int
getType
()
{
return
mType
;
}
public
static
class
Builder
{
private
int
width
;
private
int
height
;
private
String
slotAdId
;
private
int
type
;
public
Builder
()
{
...
...
@@ -47,6 +54,11 @@ public class HlAdParameter {
return
this
;
}
public
Builder
setAdType
(
int
type
)
{
this
.
type
=
type
;
return
this
;
}
public
HlAdParameter
build
()
{
return
new
HlAdParameter
(
this
);
}
...
...
haloMobiSdk/src/main/java/com/halomobi/sdk/HlCustomView.java
View file @
6ee673d6
...
...
@@ -139,7 +139,7 @@ public class HlCustomView extends Jzvd {
tipsDialog
.
setonDialogClickListener
(
new
HlTipsDialog
.
OnDialogClickListener
()
{
@Override
public
void
onCancelClick
()
{
mRewardVideoListener
.
onAd
Close
();
mRewardVideoListener
.
onAd
Skip
();
reportTracker
(
ConstantPool
.
TrackerType
.
CLOSE
);
mContext
.
finish
();
}
...
...
@@ -208,6 +208,7 @@ public class HlCustomView extends Jzvd {
isCallOnAdShow
=
true
;
}
reportTracker
(
ConstantPool
.
TrackerType
.
DISPLAY
);
LogUtils
.
e
(
"===reportTracker===DISPLAY"
);
reportTracker
(
ConstantPool
.
TrackerType
.
VIDEO_PLAYING_0_TRACKER
);
mProgressBar
.
setVisibility
(
GONE
);
}
...
...
@@ -317,6 +318,8 @@ public class HlCustomView extends Jzvd {
}
// onDestroy();
if
(
mRewardVideoListener
!=
null
)
{
LogUtils
.
e
(
"fza"
+
"onPlayEnd"
);
mRewardVideoListener
.
onRewardArrived
();
mRewardVideoListener
.
onPlayEnd
();
}
super
.
onAutoCompletion
();
...
...
haloMobiSdk/src/main/java/com/halomobi/sdk/NativeResponseImpl.java
View file @
6ee673d6
...
...
@@ -18,6 +18,8 @@ public class NativeResponseImpl implements NativeResponse {
private
String
adTitle
;
private
String
adSubTitle
;
private
String
logoUrl
;
private
int
imageWidth
;
private
int
imageHeight
;
private
double
price
;
private
boolean
isShow
=
true
;
private
boolean
isClick
;
...
...
@@ -40,6 +42,22 @@ public class NativeResponseImpl implements NativeResponse {
logoUrl
=
logoUrlStr
;
}
public
void
setImageWidth
(
int
width
)
{
imageWidth
=
width
;
}
public
void
setImageHeight
(
int
height
)
{
imageHeight
=
height
;
}
public
int
getImageWidth
()
{
return
imageWidth
;
}
public
int
getImageHeight
()
{
return
imageHeight
;
}
public
void
setImgUrlList
(
List
<
String
>
imgList
)
{
mImageList
=
imgList
;
}
...
...
haloMobiSdk/src/main/java/com/halomobi/sdk/RewardVideoActivity.java
View file @
6ee673d6
...
...
@@ -50,7 +50,6 @@ public class RewardVideoActivity extends Activity {
@Override
public
void
videoClose
()
{
videoClose
=
true
;
mRewardVideoListener
.
onPlayEnd
();
}
});
}
...
...
@@ -95,13 +94,9 @@ public class RewardVideoActivity extends Activity {
protected
void
onDestroy
()
{
super
.
onDestroy
();
HlRewardVideoManager
.
getInstance
().
onDestroy
();
if
(
mRewardVideoListener
!=
null
)
{
mRewardVideoListener
.
onAdClose
();
}
Utils
.
showNavKey
(
this
);
mAd
=
null
;
HlCustomView
.
releaseAllVideos
();
Log
.
e
(
"11111"
,
"===onDestroy==="
);
}
}
haloMobiSdk/src/main/java/com/halomobi/sdk/WebViewActivity.java
View file @
6ee673d6
...
...
@@ -85,15 +85,6 @@ public class WebViewActivity extends Activity {
@Override
public
boolean
shouldOverrideUrlLoading
(
WebView
view
,
String
url
)
{
if
(
url
.
startsWith
(
"tel:"
))
{
Intent
tel
=
new
Intent
(
Intent
.
ACTION_DIAL
,
Uri
.
parse
(
url
));
startActivity
(
tel
);
return
true
;
}
else
if
(
url
.
startsWith
(
"smsto:"
)
||
url
.
startsWith
(
"sms:"
))
{
Intent
sms
=
new
Intent
(
Intent
.
ACTION_VIEW
,
Uri
.
parse
(
url
));
startActivity
(
sms
);
return
true
;
}
if
(
url
.
startsWith
(
"http://"
)
||
url
.
startsWith
(
"https://"
))
{
try
{
WebView
.
HitTestResult
hit
=
view
.
getHitTestResult
();
...
...
haloMobiSdk/src/main/java/com/halomobi/sdk/listener/NativeResponse.java
View file @
6ee673d6
...
...
@@ -17,6 +17,10 @@ public interface NativeResponse {
public
String
getLogoUrl
();
public
int
getImageWidth
();
public
int
getImageHeight
();
public
void
handleShow
();
public
void
handleClick
(
View
view
,
boolean
click
);
...
...
haloMobiSdk/src/main/java/com/halomobi/sdk/listener/RewardVideoListener.java
View file @
6ee673d6
...
...
@@ -9,7 +9,11 @@ public interface RewardVideoListener {
void
onAdClose
();
void
onAdSkip
();
void
onAdClick
();
void
onPlayEnd
();
void
onRewardArrived
();
}
haloMobiSdk/src/main/java/com/halomobi/vast/model/VASTModel.java
View file @
6ee673d6
...
...
@@ -39,6 +39,7 @@ public class VASTModel implements Serializable {
// Tracking xpath expressions
private
static
final
String
inlineLinearTrackingXPATH
=
"/VAST/Ad/InLine/Creatives/Creative/Linear/TrackingEvents/Tracking"
;
private
static
final
String
inlineLinearMEDIAFILESXPATH
=
"/VAST/Ad/InLine/Creatives/Creative/Linear/MediaFiles"
;
private
static
final
String
inlineNonLinearTrackingXPATH
=
"/VAST/Ad/InLine/Creatives/Creative/NonLinearAds/TrackingEvents/Tracking"
;
private
static
final
String
wrapperLinearTrackingXPATH
=
"/VAST/Ad/Wrapper/Creatives/Creative/Linear/TrackingEvents/Tracking"
;
private
static
final
String
wrapperNonLinearTrackingXPATH
=
"/VAST/Ad/Wrapper/Creatives/Creative/NonLinearAds/TrackingEvents/Tracking"
;
...
...
@@ -178,7 +179,7 @@ public class VASTModel implements Serializable {
mediaFile
=
new
VASTMediaFile
();
node
=
childNodes
.
item
(
i
);
NamedNodeMap
attributes
=
node
.
getAttributes
();
if
(
attributes
==
null
)
continue
;
attributeNode
=
attributes
.
getNamedItem
(
"apiFramework"
);
mediaFile
.
setApiFramework
((
attributeNode
==
null
)
?
""
:
attributeNode
.
getNodeValue
());
...
...
haloMobiSdk/src/main/res/layout/hl_dialog_banner.xml
View file @
6ee673d6
...
...
@@ -7,6 +7,6 @@
<WebView
android:id=
"@+id/webView"
android:layout_width=
"match_parent"
android:layout_height=
"
50dp
"
/>
android:layout_height=
"
wrap_content
"
/>
</RelativeLayout>
\ No newline at end of file
haloMobiSdk/src/main/res/layout/native_item_imag_single.xml
View file @
6ee673d6
...
...
@@ -25,15 +25,11 @@
android:id=
"@+id/tv_item_title"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_alignTop=
"@+id/iv_cion1"
android:layout_marginStart=
"10dp"
android:layout_marginLeft=
"10dp"
android:layout_toStartOf=
"@id/iv_close"
android:layout_toLeftOf=
"@id/iv_close"
android:layout_toEndOf=
"@+id/iv_cion1"
android:layout_toRightOf=
"@+id/iv_cion1"
android:layout_below=
"@id/iv_cion1"
android:layout_marginTop=
"10dp"
android:includeFontPadding=
"false"
android:singleLine=
"true"
android:ellipsize=
"end"
android:textColor=
"#333333"
android:visibility=
"gone"
android:textSize=
"16sp"
...
...
@@ -44,16 +40,13 @@
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_below=
"@+id/tv_item_title"
android:layout_alignStart=
"@id/tv_item_title"
android:layout_alignLeft=
"@id/tv_item_title"
android:layout_marginTop=
"5dp"
android:layout_toStartOf=
"@id/iv_close"
android:layout_toLeftOf=
"@id/iv_close"
android:includeFontPadding=
"false"
android:singleLine=
"true"
android:ellipsize=
"end"
android:textColor=
"#555555"
android:textSize=
"14sp"
android:visibility=
"gone"
android:textSize=
"14sp"
android:text=
"111111111111"
/>
<LinearLayout
...
...
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