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
67c2a9e6
Commit
67c2a9e6
authored
Jul 09, 2021
by
王雪伟
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
解析数据
parent
d948296a
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
113 additions
and
21 deletions
+113
-21
MainActivity.java
app/src/main/java/com/ym/zxhcsdkaar/MainActivity.java
+3
-3
build.gradle
zxhcsdk/build.gradle
+0
-1
HcDownLoadUtils.java
zxhcsdk/src/main/java/com/ym/zxhcsdk/HcDownLoadUtils.java
+1
-1
PhoneUtils.java
zxhcsdk/src/main/java/com/ym/zxhcsdk/PhoneUtils.java
+109
-11
RewardvideoPortraitADActivity.java
...ava/com/ym/zxhcsdk/ads/RewardvideoPortraitADActivity.java
+0
-5
No files found.
app/src/main/java/com/ym/zxhcsdkaar/MainActivity.java
View file @
67c2a9e6
...
...
@@ -38,7 +38,7 @@ public class MainActivity extends Activity {
// 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
BaseUrl
=
"http://sspv2test.zhangxinhuichuan.com/ssp/v1/ads"
;
vp
=
findViewById
(
R
.
id
.
test_img_ad
);
//
vp = findViewById(R.id.test_img_ad);
new
OaidUtils
().
GetOaid
(
MainActivity
.
this
,
new
IOaidListener
()
{
@Override
...
...
@@ -83,10 +83,10 @@ public class MainActivity extends Activity {
findViewById
(
R
.
id
.
test_Feed
).
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
v
)
{
feedAD1
=
new
ZXHCFeedAD
(
MainActivity
.
this
,
"210015
4
"
,
1080
,
720
,
new
FeedAdListener
()
{
feedAD1
=
new
ZXHCFeedAD
(
MainActivity
.
this
,
"210015
5
"
,
1080
,
720
,
new
FeedAdListener
()
{
@Override
public
void
OnAdLoaded
()
{
//
vp = ZXHCAdViewManager.getInstance().newFrameLayout(MainActivity.this);
vp
=
ZXHCAdViewManager
.
getInstance
().
newFrameLayout
(
MainActivity
.
this
);
ZXHCAdViewManager
.
getInstance
().
showAdView
(
MainActivity
.
this
,
vp
,
true
);
feedAD1
.
showAd
(
vp
);
}
...
...
zxhcsdk/build.gradle
View file @
67c2a9e6
...
...
@@ -36,7 +36,6 @@ dependencies {
//api 'com.android.support:support-v4:28.0.0'
// implementation 'com.android.support:appcompat-v7:28.0.0'
// implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation
'com.github.badoo:android-weak-handler:1.2'
implementation
'androidx.core:core:1.3.2'
implementation
'androidx.appcompat:appcompat:1.0.2'
}
\ No newline at end of file
zxhcsdk/src/main/java/com/ym/zxhcsdk/HcDownLoadUtils.java
View file @
67c2a9e6
...
...
@@ -54,7 +54,7 @@ public class HcDownLoadUtils {
}
//创建下载任务
DownloadManager
.
Request
request
=
new
DownloadManager
.
Request
(
Uri
.
parse
(
adBean
.
getDown_url
()));
DownloadManager
.
Request
request
=
new
DownloadManager
.
Request
(
Uri
.
parse
(
adBean
.
getDown_url
()
.
trim
()
));
// DownloadManager.Request request = new DownloadManager.Request(Uri.parse("http://203.187.160.132:9011/qd.shouji.qihucdn.com/c3pr90ntc0td/nqapk/sjzs2_100000003_5f1aaeb8c462450478/201012/d1208503899d47cab3251dfaa06aaf95/appstore-300090091.apk"));
// DownloadManager.Request request = new DownloadManager.Request(Uri.parse("http://a.xzfile.com/apk/tuan800_downcc.apk"));
//移动网络情况下是否允许漫游
...
...
zxhcsdk/src/main/java/com/ym/zxhcsdk/PhoneUtils.java
View file @
67c2a9e6
...
...
@@ -23,10 +23,13 @@ import android.text.TextUtils;
import
android.util.DisplayMetrics
;
import
android.view.Display
;
import
android.webkit.WebSettings
;
import
androidx.core.app.ActivityCompat
;
import
org.json.JSONArray
;
import
org.json.JSONException
;
import
org.json.JSONObject
;
import
java.io.BufferedReader
;
import
java.io.FileReader
;
import
java.io.IOException
;
...
...
@@ -145,6 +148,7 @@ public class PhoneUtils {
public
int
getScreenDpi
(
Context
context
)
{
return
context
.
getResources
().
getDisplayMetrics
().
densityDpi
;
}
/**
* 获取屏幕尺寸
*
...
...
@@ -152,7 +156,7 @@ public class PhoneUtils {
* @return int
*/
public
double
getScreenSize
(
Activity
context
)
{
double
mInch
=
0
;
double
mInch
=
0
;
try
{
int
realWidth
=
0
,
realHeight
=
0
;
...
...
@@ -174,7 +178,7 @@ public class PhoneUtils {
realWidth
=
metrics
.
widthPixels
;
realHeight
=
metrics
.
heightPixels
;
}
mInch
=
formatDouble
(
Math
.
sqrt
((
realWidth
/
metrics
.
xdpi
)
*
(
realWidth
/
metrics
.
xdpi
)
+
(
realHeight
/
metrics
.
ydpi
)
*
(
realHeight
/
metrics
.
ydpi
)),
1
);
mInch
=
formatDouble
(
Math
.
sqrt
((
realWidth
/
metrics
.
xdpi
)
*
(
realWidth
/
metrics
.
xdpi
)
+
(
realHeight
/
metrics
.
ydpi
)
*
(
realHeight
/
metrics
.
ydpi
)),
1
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
...
...
@@ -186,7 +190,7 @@ public class PhoneUtils {
* Double类型保留指定位数的小数,返回double类型(四舍五入)
* newScale 为指定的位数
*/
private
static
double
formatDouble
(
double
d
,
int
newScale
)
{
private
static
double
formatDouble
(
double
d
,
int
newScale
)
{
BigDecimal
bd
=
new
BigDecimal
(
d
);
return
bd
.
setScale
(
newScale
,
BigDecimal
.
ROUND_HALF_UP
).
doubleValue
();
}
...
...
@@ -782,9 +786,9 @@ public class PhoneUtils {
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
if
(
result
!=
null
&&
result
.
size
()>
0
)
{
if
(
result
!=
null
&&
result
.
size
()
>
0
)
{
return
result
.
get
(
0
).
getLocality
();
}
else
{
}
else
{
return
""
;
}
}
...
...
@@ -794,16 +798,16 @@ public class PhoneUtils {
return
""
;
}
public
void
setOaid
(
String
oaid
){
ZXHCConstant
.
device_oaid
=
oaid
;
public
void
setOaid
(
String
oaid
)
{
ZXHCConstant
.
device_oaid
=
oaid
;
}
public
String
getoaid
(){
public
String
getoaid
()
{
return
ZXHCConstant
.
device_oaid
;
}
public
boolean
IsInstallApp
(
Context
context
,
String
pkgName
){
if
(
pkgName
==
null
||
pkgName
.
isEmpty
())
{
public
boolean
IsInstallApp
(
Context
context
,
String
pkgName
)
{
if
(
pkgName
==
null
||
pkgName
.
isEmpty
())
{
return
false
;
}
PackageInfo
packageInfo
;
...
...
@@ -813,7 +817,7 @@ public class PhoneUtils {
packageInfo
=
null
;
e
.
printStackTrace
();
}
if
(
packageInfo
==
null
)
{
if
(
packageInfo
==
null
)
{
return
false
;
}
else
{
return
true
;
//true为安装了,false为未安装
...
...
@@ -946,6 +950,100 @@ public class PhoneUtils {
}
adBean
.
setDpFailmonitorUrls
(
dpFailmonitorList
);
//Video
adBean
.
setVideo_duration
(
root
.
optInt
(
"video_duration"
));
adBean
.
setVideo_url
(
root
.
optString
(
"video_url"
));
adBean
.
setVideo_cover_image
(
root
.
optString
(
"video_cover_image"
));
adBean
.
setVideo_end_image
(
root
.
optString
(
"video_end_image"
));
adBean
.
setVideo_endpage_html
(
root
.
optString
(
"video_endpage_html"
));
adBean
.
setVideo_endbuttonurl
(
root
.
optString
(
"video_endbuttonurl"
));
adBean
.
setVideo_icon_url
(
root
.
optString
(
"video_icon_url"
));
adBean
.
setVideo_title
(
root
.
optString
(
"video_title"
));
adBean
.
setVideo_desc
(
root
.
optString
(
"video_desc"
));
adBean
.
setVideo_iconbuttontext
(
root
.
optString
(
"video_iconbuttontext"
));
JSONArray
video_start
=
root
.
optJSONArray
(
"video_start"
);
List
<
String
>
video_startList
=
new
ArrayList
<
String
>();
if
(
video_start
!=
null
)
{
for
(
int
i
=
0
;
i
<
video_start
.
length
();
i
++)
{
video_startList
.
add
(
video_start
.
optString
(
i
));
}
}
adBean
.
setVideo_start
(
video_startList
);
JSONArray
video_one_quarter
=
root
.
optJSONArray
(
"video_one_quarter"
);
List
<
String
>
video_one_quarterList
=
new
ArrayList
<
String
>();
if
(
video_one_quarter
!=
null
)
{
for
(
int
i
=
0
;
i
<
video_one_quarter
.
length
();
i
++)
{
video_one_quarterList
.
add
(
video_one_quarter
.
optString
(
i
));
}
}
adBean
.
setVideo_one_quarter
(
video_one_quarterList
);
JSONArray
video_one_half
=
root
.
optJSONArray
(
"video_one_half"
);
List
<
String
>
video_one_halfList
=
new
ArrayList
<
String
>();
if
(
video_one_half
!=
null
)
{
for
(
int
i
=
0
;
i
<
video_one_half
.
length
();
i
++)
{
video_one_quarterList
.
add
(
video_one_half
.
optString
(
i
));
}
}
adBean
.
setVideo_one_half
(
video_one_halfList
);
JSONArray
video_three_quarter
=
root
.
optJSONArray
(
"video_three_quarter"
);
List
<
String
>
video_three_quarterList
=
new
ArrayList
<
String
>();
if
(
video_three_quarter
!=
null
)
{
for
(
int
i
=
0
;
i
<
video_three_quarter
.
length
();
i
++)
{
video_three_quarterList
.
add
(
video_three_quarter
.
optString
(
i
));
}
}
adBean
.
setVideo_three_quarter
(
video_three_quarterList
);
JSONArray
video_complete
=
root
.
optJSONArray
(
"video_complete"
);
List
<
String
>
video_completeList
=
new
ArrayList
<
String
>();
if
(
video_complete
!=
null
)
{
for
(
int
i
=
0
;
i
<
video_complete
.
length
();
i
++)
{
video_completeList
.
add
(
video_complete
.
optString
(
i
));
}
}
adBean
.
setVideo_complete
(
video_completeList
);
JSONArray
video_pause
=
root
.
optJSONArray
(
"video_pause"
);
List
<
String
>
video_pauseList
=
new
ArrayList
<
String
>();
if
(
video_pause
!=
null
)
{
for
(
int
i
=
0
;
i
<
video_pause
.
length
();
i
++)
{
video_pauseList
.
add
(
video_pause
.
optString
(
i
));
}
}
adBean
.
setVideo_pause
(
video_pauseList
);
JSONArray
video_resume
=
root
.
optJSONArray
(
"video_resume"
);
List
<
String
>
video_resumeList
=
new
ArrayList
<
String
>();
if
(
video_resume
!=
null
)
{
for
(
int
i
=
0
;
i
<
video_resume
.
length
();
i
++)
{
video_resumeList
.
add
(
video_resume
.
optString
(
i
));
}
}
adBean
.
setVideo_resume
(
video_resumeList
);
JSONArray
video_skip
=
root
.
optJSONArray
(
"video_skip"
);
List
<
String
>
video_skipList
=
new
ArrayList
<
String
>();
if
(
video_skip
!=
null
)
{
for
(
int
i
=
0
;
i
<
video_skip
.
length
();
i
++)
{
video_skipList
.
add
(
video_skip
.
optString
(
i
));
}
}
adBean
.
setVideo_skip
(
video_skipList
);
JSONArray
video_close
=
root
.
optJSONArray
(
"video_close"
);
List
<
String
>
video_closeList
=
new
ArrayList
<
String
>();
if
(
video_close
!=
null
)
{
for
(
int
i
=
0
;
i
<
video_close
.
length
();
i
++)
{
video_closeList
.
add
(
video_close
.
optString
(
i
));
}
}
adBean
.
setVideo_close
(
video_closeList
);
}
catch
(
JSONException
e
)
{
e
.
printStackTrace
();
}
...
...
zxhcsdk/src/main/java/com/ym/zxhcsdk/ads/RewardvideoPortraitADActivity.java
View file @
67c2a9e6
...
...
@@ -13,12 +13,9 @@ import android.widget.FrameLayout;
import
android.widget.ImageView
;
import
android.widget.TextView
;
import
androidx.annotation.NonNull
;
import
com.badoo.mobile.util.WeakHandler
;
import
com.ym.zxhcsdk.R
;
import
com.ym.zxhcsdk.view.ZXHCRewardVideoAD
;
import
java.io.IOException
;
public
class
RewardvideoPortraitADActivity
extends
Activity
implements
SurfaceHolder
.
Callback
{
private
MediaPlayer
mPlayer
=
null
;
...
...
@@ -33,7 +30,6 @@ public class RewardvideoPortraitADActivity extends Activity implements SurfaceHo
private
TextView
TopTimeTv
;
private
ImageView
TopClose
;
private
WeakHandler
mHandler
;
public
ZXHCRewardVideoAD
mZxhcRewardVideoAD
;
@Override
...
...
@@ -46,7 +42,6 @@ public class RewardvideoPortraitADActivity extends Activity implements SurfaceHo
mPlayer
=
mZxhcRewardVideoAD
.
mMediaPlayer
;
}
mHandler
=
new
WeakHandler
();
bindViews
();
}
...
...
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