Skip to content

Commit 64f3eda

Browse files
authored
Merge pull request #17 from VideoOS/merge
dev_1.3.1
2 parents 77b5faf + 6f4bbb7 commit 64f3eda

File tree

5 files changed

+352
-198
lines changed

5 files changed

+352
-198
lines changed

VideoOS/VenvyLibrary/src/main/java/cn/com/venvy/Config.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*/
77

88
public class Config {
9-
public static String SDK_VERSION = "1.3.0";
9+
public static String SDK_VERSION = "1.3.1";
1010
public static String HOST_VIDEO_OS="https://os-saas.videojj.com/os-api-saas";
1111
public static boolean REPORT_ABLE = true;
1212
public static int DEBUG_STATUS = 0;

VideoOS/VenvyLibrary/src/main/java/cn/com/venvy/common/media/HttpProxyCacheServer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ public boolean isCached(String url) {
168168
if (info == null) {
169169
return false;
170170
}
171-
return info.status == DownloadDbHelper.DownloadStatus.DOWNLOAD_SUCCESS;
171+
return info.status == DownloadDbHelper.DownloadStatus.DOWNLOAD_SUCCESS&&getCacheFile(url).exists();
172172
// return getCacheFile(url).exists();
173173
}
174174

VideoOS/VenvyLibrary/src/main/java/cn/com/venvy/common/utils/VenvyMD5Util.java

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
import android.text.TextUtils;
44

5+
import java.io.File;
6+
import java.io.FileInputStream;
7+
import java.math.BigInteger;
58
import java.nio.charset.Charset;
69
import java.security.MessageDigest;
710
import java.security.NoSuchAlgorithmException;
@@ -93,4 +96,27 @@ private static String SHA(final String strText, final String strType) {
9396

9497
return strResult;
9598
}
99+
100+
public static String EncoderByMd5(File file) {
101+
if (!file.isFile()) {
102+
return null;
103+
}
104+
String encodeMd5String;
105+
try {
106+
MessageDigest digest = MessageDigest.getInstance("MD5");
107+
FileInputStream in = new FileInputStream(file);
108+
byte buffer[] = new byte[1024];
109+
int len;
110+
while ((len = in.read(buffer, 0, 1024)) != -1) {
111+
digest.update(buffer, 0, len);
112+
}
113+
in.close();
114+
BigInteger bigInt = new BigInteger(1, digest.digest());
115+
encodeMd5String = bigInt.toString(16);
116+
} catch (Exception e) {
117+
e.printStackTrace();
118+
encodeMd5String = null;
119+
}
120+
return encodeMd5String;
121+
}
96122
}
Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
package cn.com.videopls.pub;
2+
3+
import android.os.Parcel;
4+
import android.os.Parcelable;
5+
import android.text.TextUtils;
6+
7+
/**
8+
* Created by yanjiangbo on 2017/5/16.
9+
*/
10+
11+
public class LuaUpdateInfo implements Parcelable {
12+
13+
private final String mVersion;
14+
private final String mDownloadUrl;
15+
private final String mManifestJson;
16+
17+
private LuaUpdateInfo(Builder builder) {
18+
this.mVersion = builder.mVersion;
19+
this.mDownloadUrl = builder.mDownloadUrl;
20+
this.mManifestJson = builder.mManifestJson;
21+
}
22+
23+
public String getDownloadUrl() {
24+
return mDownloadUrl;
25+
}
26+
27+
public String getVersion() {
28+
return mVersion;
29+
}
30+
31+
public String getManifestJson() {
32+
return mManifestJson;
33+
}
34+
35+
public static class Builder {
36+
private String mVersion;
37+
private String mDownloadUrl;
38+
private String mManifestJson;
39+
40+
public Builder setVersion(String version) {
41+
if (!TextUtils.isEmpty(version)) {
42+
this.mVersion = version;
43+
}
44+
return this;
45+
}
46+
47+
public Builder setDownloadUrl(String downloadUrl) {
48+
if (!TextUtils.isEmpty(downloadUrl)) {
49+
this.mDownloadUrl = downloadUrl;
50+
}
51+
return this;
52+
}
53+
54+
public Builder setManifestJson(String manifestJson) {
55+
if (!TextUtils.isEmpty(manifestJson)) {
56+
this.mManifestJson = manifestJson;
57+
}
58+
return this;
59+
}
60+
61+
public LuaUpdateInfo build() {
62+
return new LuaUpdateInfo(this);
63+
}
64+
65+
}
66+
67+
@Override
68+
public int describeContents() {
69+
return 0;
70+
}
71+
72+
@Override
73+
public void writeToParcel(Parcel dest, int flags) {
74+
dest.writeString(this.mVersion);
75+
dest.writeString(this.mDownloadUrl);
76+
dest.writeString(this.mManifestJson);
77+
}
78+
79+
protected LuaUpdateInfo(Parcel in) {
80+
this.mVersion = in.readString();
81+
this.mDownloadUrl = in.readString();
82+
this.mManifestJson = in.readString();
83+
}
84+
85+
public static final Parcelable.Creator<LuaUpdateInfo> CREATOR = new Parcelable.Creator<LuaUpdateInfo>() {
86+
@Override
87+
public LuaUpdateInfo createFromParcel(Parcel source) {
88+
return new LuaUpdateInfo(source);
89+
}
90+
91+
@Override
92+
public LuaUpdateInfo[] newArray(int size) {
93+
return new LuaUpdateInfo[size];
94+
}
95+
};
96+
97+
@Override
98+
public int hashCode() {
99+
return TextUtils.isEmpty(mVersion) ? super.hashCode() : mVersion.hashCode();
100+
}
101+
102+
@Override
103+
public boolean equals(Object obj) {
104+
if (obj == null) {
105+
return super.equals(obj);
106+
}
107+
if (!(obj instanceof LuaUpdateInfo)) {
108+
return super.equals(obj);
109+
}
110+
LuaUpdateInfo luaUpdateInfo = (LuaUpdateInfo) obj;
111+
return TextUtils.equals(mVersion, luaUpdateInfo.getVersion());
112+
}
113+
}

0 commit comments

Comments
 (0)