Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Sign in / Register
Toggle navigation
Z
zxhc
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
王雪伟
zxhc
Commits
13f41672
Commit
13f41672
authored
Jul 13, 2021
by
zxhljwl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改
parent
67c2a9e6
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
98 additions
and
13 deletions
+98
-13
MainActivity.java
app/src/main/java/com/ym/zxhcsdkaar/MainActivity.java
+32
-1
RewardVideoMediaPlayer.java
.../main/java/com/ym/zxhcsdk/ads/RewardVideoMediaPlayer.java
+45
-0
RewardVideoTemp.java
...sdk/src/main/java/com/ym/zxhcsdk/ads/RewardVideoTemp.java
+0
-4
RewardvideoPortraitADActivity.java
...ava/com/ym/zxhcsdk/ads/RewardvideoPortraitADActivity.java
+2
-2
ZXHCRewardVideoAD.java
.../src/main/java/com/ym/zxhcsdk/view/ZXHCRewardVideoAD.java
+19
-6
No files found.
app/src/main/java/com/ym/zxhcsdkaar/MainActivity.java
View file @
13f41672
...
@@ -3,6 +3,7 @@ package com.ym.zxhcsdkaar;
...
@@ -3,6 +3,7 @@ package com.ym.zxhcsdkaar;
import
android.app.Activity
;
import
android.app.Activity
;
import
android.content.Intent
;
import
android.content.Intent
;
import
android.os.Bundle
;
import
android.os.Bundle
;
import
android.os.CountDownTimer
;
import
android.util.Log
;
import
android.util.Log
;
import
android.view.View
;
import
android.view.View
;
import
android.view.ViewGroup
;
import
android.view.ViewGroup
;
...
@@ -33,7 +34,7 @@ public class MainActivity extends Activity {
...
@@ -33,7 +34,7 @@ public class MainActivity extends Activity {
super
.
onCreate
(
savedInstanceState
);
super
.
onCreate
(
savedInstanceState
);
setContentView
(
R
.
layout
.
activity_main
);
setContentView
(
R
.
layout
.
activity_main
);
ZXHCADManager
.
getInstance
().
InitAd
(
this
,
"1000127"
,
tru
e
);
ZXHCADManager
.
getInstance
().
InitAd
(
this
,
"1000127"
,
fals
e
);
//Splash();
//Splash();
// ZXHCADManager.getInstance().InitAd(this, "1000298", true);
// ZXHCADManager.getInstance().InitAd(this, "1000298", true);
String
url
=
"http://sspv2test.zhangxinhuichuan.com/ssp/v1/ads?pid=2100154&type=api&ad_type=3&ad_w=480&ad_h=720&app_package=com.popcap.pvz2cthd&app_id=1000127&app_name=com.popcap.pvz2cthd&app_versionid=1005&device_geo_lat=&device_geo_lon=&device_imei=X6GNU17524105082&device_adid=d0cf1c3d5280f16b&device_mac=F0:C8:50:A1:4E:8E&device_width=1920&device_height=1132&device_imsi=460000501365163&device_carrier=&device_network=1&device_os=Android&device_os_version=24&device_density=2.0&device_ppi=2.0&device_ip=183.211.87.156&device_ua=Dalvik%2F2.1.0+%28Linux%3B+U%3B+Android+9%3B+Redmi+Note+8+Pro+MIUI%2FV10.4.9.0.PGGCNXM%29&device_type=0&is_mobile=1&device_model=FLA-AL10&device_brand=HUAWEI"
;
String
url
=
"http://sspv2test.zhangxinhuichuan.com/ssp/v1/ads?pid=2100154&type=api&ad_type=3&ad_w=480&ad_h=720&app_package=com.popcap.pvz2cthd&app_id=1000127&app_name=com.popcap.pvz2cthd&app_versionid=1005&device_geo_lat=&device_geo_lon=&device_imei=X6GNU17524105082&device_adid=d0cf1c3d5280f16b&device_mac=F0:C8:50:A1:4E:8E&device_width=1920&device_height=1132&device_imsi=460000501365163&device_carrier=&device_network=1&device_os=Android&device_os_version=24&device_density=2.0&device_ppi=2.0&device_ip=183.211.87.156&device_ua=Dalvik%2F2.1.0+%28Linux%3B+U%3B+Android+9%3B+Redmi+Note+8+Pro+MIUI%2FV10.4.9.0.PGGCNXM%29&device_type=0&is_mobile=1&device_model=FLA-AL10&device_brand=HUAWEI"
;
...
@@ -125,6 +126,14 @@ public class MainActivity extends Activity {
...
@@ -125,6 +126,14 @@ public class MainActivity extends Activity {
@Override
@Override
public
void
onClick
(
View
v
)
{
public
void
onClick
(
View
v
)
{
RewardAd
();
RewardAd
();
//调用 CountDownTimer 对象的 start() 方法开始倒计时,也不涉及到线程处理
// if (b) {
// timer.start();
// } else {
// timer.cancel();
// }
// b = !b;
}
}
});
});
findViewById
(
R
.
id
.
RewardAd_show
).
setOnClickListener
(
new
View
.
OnClickListener
()
{
findViewById
(
R
.
id
.
RewardAd_show
).
setOnClickListener
(
new
View
.
OnClickListener
()
{
...
@@ -136,6 +145,9 @@ public class MainActivity extends Activity {
...
@@ -136,6 +145,9 @@ public class MainActivity extends Activity {
}
}
public
boolean
b
=
true
;
public
long
time
=
30000
;
private
void
Splash
(){
private
void
Splash
(){
//2100154 落地页
//2100154 落地页
//2100155 下载
//2100155 下载
...
@@ -187,4 +199,23 @@ public class MainActivity extends Activity {
...
@@ -187,4 +199,23 @@ public class MainActivity extends Activity {
}
}
});
});
}
}
/**
* CountDownTimer timer = new CountDownTimer(3000, 1000)中,
* 第一个参数表示总时间,第二个参数表示间隔时间。
* 意思就是每隔一秒会回调一次方法onTick,然后1秒之后会回调onFinish方法。
*/
CountDownTimer
timer
=
new
CountDownTimer
(
time
,
1000
)
{
public
void
onTick
(
long
millisUntilFinished
)
{
Log
.
d
(
"wxw"
,
"倒计时"
+
millisUntilFinished
/
1000
+
"秒"
);
time
=
millisUntilFinished
;
//txt.setText("倒计时" + millisUntilFinished / 1000 + "秒");
}
public
void
onFinish
()
{
// Intent intent = new Intent(MainActivity.this, Main2Activity.class);
// startActivity(intent);
}
};
}
}
\ No newline at end of file
zxhcsdk/src/main/java/com/ym/zxhcsdk/ads/RewardVideoMediaPlayer.java
0 → 100644
View file @
13f41672
package
com
.
ym
.
zxhcsdk
.
ads
;
import
android.content.Intent
;
import
android.media.MediaPlayer
;
import
android.os.CountDownTimer
;
/**
* 激励视频播放器
*/
public
class
RewardVideoMediaPlayer
{
private
static
volatile
RewardVideoMediaPlayer
mRewardVideoMediaPlayer
=
null
;
private
static
MediaPlayer
mMediaPlayer
=
null
;
private
RewardVideoMediaPlayer
()
{}
/**
* 类单例
* @return
*/
public
static
MediaPlayer
getInstance
()
{
synchronized
(
RewardVideoMediaPlayer
.
class
)
{
if
(
null
==
mRewardVideoMediaPlayer
)
{
mRewardVideoMediaPlayer
=
new
RewardVideoMediaPlayer
();
}
}
return
mRewardVideoMediaPlayer
.
getMediaPlayer
();
}
public
MediaPlayer
getMediaPlayer
()
{
if
(
null
==
mMediaPlayer
)
{
mMediaPlayer
=
new
MediaPlayer
();
}
return
mMediaPlayer
;
}
}
zxhcsdk/src/main/java/com/ym/zxhcsdk/ads/RewardVideoTemp.java
deleted
100644 → 0
View file @
67c2a9e6
package
com
.
ym
.
zxhcsdk
.
ads
;
public
class
RewardVideoTemp
{
}
zxhcsdk/src/main/java/com/ym/zxhcsdk/ads/RewardvideoPortraitADActivity.java
View file @
13f41672
...
@@ -39,7 +39,7 @@ public class RewardvideoPortraitADActivity extends Activity implements SurfaceHo
...
@@ -39,7 +39,7 @@ public class RewardvideoPortraitADActivity extends Activity implements SurfaceHo
mZxhcRewardVideoAD
=
RewardVideoPlayerUtils
.
getInstance
().
getVideo
();
mZxhcRewardVideoAD
=
RewardVideoPlayerUtils
.
getInstance
().
getVideo
();
if
(
null
!=
mZxhcRewardVideoAD
)
{
if
(
null
!=
mZxhcRewardVideoAD
)
{
mPlayer
=
mZxhcRewardVideoAD
.
mMediaPlayer
;
mPlayer
=
RewardVideoMediaPlayer
.
getInstance
()
;
}
}
bindViews
();
bindViews
();
...
@@ -63,7 +63,7 @@ public class RewardvideoPortraitADActivity extends Activity implements SurfaceHo
...
@@ -63,7 +63,7 @@ public class RewardvideoPortraitADActivity extends Activity implements SurfaceHo
// mPlayer = new MediaPlayer();
// mPlayer = new MediaPlayer();
// mPlayer.setDataSource("https://zx-cdn.zhangxinhulian.com/file/2020/5/8447fa5488ee19a54d2adbe8d127693045540211.mp4");
// mPlayer.setDataSource("https://zx-cdn.zhangxinhulian.com/file/2020/5/8447fa5488ee19a54d2adbe8d127693045540211.mp4");
//
// mPlayer.setDisplay(surfaceHolder);
// mPlayer.setDisplay(surfaceHolder);
// mPlayer.prepareAsync();
// mPlayer.prepareAsync();
TopClose
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
TopClose
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
...
...
zxhcsdk/src/main/java/com/ym/zxhcsdk/view/ZXHCRewardVideoAD.java
View file @
13f41672
package
com
.
ym
.
zxhcsdk
.
view
;
package
com
.
ym
.
zxhcsdk
.
view
;
import
android.app.Activity
;
import
android.app.Activity
;
import
android.content.Intent
;
import
android.media.MediaPlayer
;
import
android.media.MediaPlayer
;
import
android.util.Log
;
import
android.util.Log
;
import
com.ym.zxhcsdk.HcAdBean
;
import
com.ym.zxhcsdk.HcAdBean
;
import
com.ym.zxhcsdk.HttpClientUtils
;
import
com.ym.zxhcsdk.HttpClientUtils
;
import
com.ym.zxhcsdk.PhoneUtils
;
import
com.ym.zxhcsdk.PhoneUtils
;
import
com.ym.zxhcsdk.ZXHCConstant
;
import
com.ym.zxhcsdk.ZXHCConstant
;
import
com.ym.zxhcsdk.ads.RewardVideoMediaPlayer
;
import
com.ym.zxhcsdk.listener.RewardVideoAdLoadListener
;
import
com.ym.zxhcsdk.listener.RewardVideoAdLoadListener
;
import
com.ym.zxhcsdk.listener.RewardVideoAdShowListener
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.io.Serializable
;
import
java.io.Serializable
;
import
java.util.HashMap
;
import
java.util.HashMap
;
...
@@ -17,15 +21,18 @@ public class ZXHCRewardVideoAD implements Serializable {
...
@@ -17,15 +21,18 @@ public class ZXHCRewardVideoAD implements Serializable {
private
Activity
context
;
private
Activity
context
;
private
String
codeId
;
private
String
codeId
;
public
MediaPlayer
mMediaPlayer
;
public
boolean
isLoadFinish
;
public
boolean
isLoadFinish
;
private
HcAdBean
adBean
;
public
ZXHCRewardVideoAD
(
Activity
context
,
String
codeId
)
{
public
ZXHCRewardVideoAD
(
Activity
context
,
String
codeId
)
{
this
.
context
=
context
;
this
.
context
=
context
;
this
.
codeId
=
codeId
;
this
.
codeId
=
codeId
;
}
}
private
HcAdBean
adBean
;
/**
* 缓存激励视频
* @param mlistener
*/
public
void
loadRewardAD
(
RewardVideoAdLoadListener
mlistener
)
{
public
void
loadRewardAD
(
RewardVideoAdLoadListener
mlistener
)
{
Map
<
String
,
String
>
map
=
new
HashMap
<>();
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"pid"
,
codeId
);
map
.
put
(
"pid"
,
codeId
);
...
@@ -56,12 +63,11 @@ public class ZXHCRewardVideoAD implements Serializable {
...
@@ -56,12 +63,11 @@ public class ZXHCRewardVideoAD implements Serializable {
try
{
try
{
isLoadFinish
=
false
;
isLoadFinish
=
false
;
mMediaPlayer
=
new
MediaPlayer
();
RewardVideoMediaPlayer
.
getInstance
().
setDataSource
(
"https://zx-cdn.zhangxinhulian.com/file/2020/5/8447fa5488ee19a54d2adbe8d127693045540211.mp4"
);
mMediaPlayer
.
setDataSource
(
"https://zx-cdn.zhangxinhulian.com/file/2020/5/8447fa5488ee19a54d2adbe8d127693045540211.mp4"
);
// mPlayer.setDisplay(surfaceHolder);
// mPlayer.setDisplay(surfaceHolder);
mMediaPlayer
.
prepareAsync
();
RewardVideoMediaPlayer
.
getInstance
()
.
prepareAsync
();
//网络流媒体的缓冲监听
//网络流媒体的缓冲监听
mMediaPlayer
.
setOnBufferingUpdateListener
(
new
MediaPlayer
.
OnBufferingUpdateListener
()
{
RewardVideoMediaPlayer
.
getInstance
()
.
setOnBufferingUpdateListener
(
new
MediaPlayer
.
OnBufferingUpdateListener
()
{
@Override
@Override
public
void
onBufferingUpdate
(
MediaPlayer
mp
,
int
percent
)
{
public
void
onBufferingUpdate
(
MediaPlayer
mp
,
int
percent
)
{
Log
.
d
(
"wxw"
,
"percent"
+
percent
);
Log
.
d
(
"wxw"
,
"percent"
+
percent
);
...
@@ -91,4 +97,11 @@ public class ZXHCRewardVideoAD implements Serializable {
...
@@ -91,4 +97,11 @@ public class ZXHCRewardVideoAD implements Serializable {
}
}
});
});
}
}
/**
* 播放激励视频
*/
public
void
showRewardAD
(
Activity
context
,
RewardVideoAdShowListener
listener
)
{
}
}
}
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