|
@@ -23,6 +23,7 @@ import com.hc.model.YNYD.YNYDService;
|
|
|
import com.hc.request.Config;
|
|
|
import com.hc.request.core.DefaultCallback;
|
|
|
import com.hc.webapp.BuildConfig;
|
|
|
+import com.hc.webapp.GetSXHeZiParam;
|
|
|
import com.jewel.lib.java.StringUtil;
|
|
|
import com.orhanobut.logger.Logger;
|
|
|
|
|
@@ -41,9 +42,13 @@ public class AndroidToJS {
|
|
|
private static final String JS_EVENT_AUTH_RESULT = "javascript:onAuthResult(%s, %s)";
|
|
|
public static final String JS_EVENT_PLAY_NEXT = "javascript:onPlayNextEvent()";
|
|
|
|
|
|
+ static String backFuc = "function(){if(document.onkeydown){document.onkeydown({keyCode:8});}}";
|
|
|
+ public static final String JS_BACK_EVENT = "javascript:(" + backFuc + ")()";
|
|
|
+
|
|
|
private static final String HAD_FLOAT_VIDEO = "1"; // 当前H5页面存在小窗视频
|
|
|
private static final String NEED_MUTE = "0";
|
|
|
|
|
|
+
|
|
|
String TAG ="AndroidToJS";
|
|
|
|
|
|
// private String testVideo = "http://hnh5pic.oss-cn-shenzhen.aliyuncs.com/3.mp4";
|
|
@@ -51,6 +56,7 @@ public class AndroidToJS {
|
|
|
private String testVideo = "http://192.168.2.112/000079/000079.m3u8";
|
|
|
|
|
|
private int platformType = BuildConfig.platformType; //1:百事通,2:银河,3:未来
|
|
|
+ private int deviceType = BuildConfig.devicesType;
|
|
|
|
|
|
/**
|
|
|
* JS调用类型
|
|
@@ -131,11 +137,11 @@ public class AndroidToJS {
|
|
|
|
|
|
private void playFull(String url, String sourceId, String title, long time, boolean hadFloat, boolean isNextVideo, boolean showCompleteDialog, int seekTime) {
|
|
|
if (isNextVideo) { // 播放下一条视频时,直接在当前全屏窗口开启新视频的播放
|
|
|
- playVideoListener.playFullVideo(url, title, getUserName(), sourceId, time, hadFloat, showCompleteDialog, seekTime);
|
|
|
+ playVideoListener.playFullVideo(url, title, GetSXHeZiParam.getInstance(context).getUserName(), sourceId, time, hadFloat, showCompleteDialog, seekTime);
|
|
|
} else if (hadFloat) { // 有小窗时,直接切换成全屏
|
|
|
- playVideoListener.playFullVideo(url, title, getUserName(), sourceId, time, true, showCompleteDialog, 0);
|
|
|
+ playVideoListener.playFullVideo(url, title, GetSXHeZiParam.getInstance(context).getUserName(), sourceId, time, true, showCompleteDialog, 0);
|
|
|
} else { // 开启新的全屏播放窗口
|
|
|
- playVideoListener.playFullVideo(url, title, getUserName(), sourceId, time, false, showCompleteDialog, seekTime);
|
|
|
+ playVideoListener.playFullVideo(url, title, GetSXHeZiParam.getInstance(context).getUserName(), sourceId, time, false, showCompleteDialog, seekTime);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -167,7 +173,7 @@ public class AndroidToJS {
|
|
|
private void playFloat(String url, String sourceId, String title, final int x, final int y, final int width, final int height, boolean needMute) {
|
|
|
playVideoListener.playFloatVideo(url,
|
|
|
x, y, width, height,
|
|
|
- getUserName(), sourceId, title, needMute);
|
|
|
+ GetSXHeZiParam.getInstance(context).getUserName(), sourceId, title, needMute);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -209,7 +215,7 @@ public class AndroidToJS {
|
|
|
|
|
|
@JavascriptInterface
|
|
|
public String getUserId() {
|
|
|
- return getUserName();
|
|
|
+ return GetSXHeZiParam.getInstance(context).getUserName();
|
|
|
}
|
|
|
|
|
|
@JavascriptInterface
|
|
@@ -219,7 +225,7 @@ public class AndroidToJS {
|
|
|
|
|
|
@JavascriptInterface
|
|
|
public String getEpgServer() {
|
|
|
- return getUserEpgServer();
|
|
|
+ return GetSXHeZiParam.getInstance(context).getUserEpgServer();
|
|
|
}
|
|
|
|
|
|
@JavascriptInterface
|
|
@@ -229,7 +235,7 @@ public class AndroidToJS {
|
|
|
|
|
|
@JavascriptInterface
|
|
|
public String getToken() {
|
|
|
- return getUserToken();
|
|
|
+ return GetSXHeZiParam.getInstance(context).getUserToken();
|
|
|
}
|
|
|
|
|
|
@JavascriptInterface
|
|
@@ -254,10 +260,17 @@ public class AndroidToJS {
|
|
|
|
|
|
@JavascriptInterface
|
|
|
public int getPlatformType() {
|
|
|
+ Log.d(TAG,"platformType:" + platformType );
|
|
|
return platformType;
|
|
|
}
|
|
|
|
|
|
@JavascriptInterface
|
|
|
+ public int getDeviceType() {
|
|
|
+ Log.d(TAG,"deviceType:" + deviceType);
|
|
|
+ return deviceType;
|
|
|
+ }
|
|
|
+
|
|
|
+ @JavascriptInterface
|
|
|
public void pay() {
|
|
|
}
|
|
|
|
|
@@ -374,13 +387,14 @@ public class AndroidToJS {
|
|
|
return pattern.matcher(str).matches();
|
|
|
}
|
|
|
|
|
|
- private String getUserName(){
|
|
|
+ /*private String getUserName(){
|
|
|
try{
|
|
|
Uri queryUri = Uri.parse("content://stbauthinfo/authentication/");
|
|
|
Cursor cursor = context.getContentResolver().query(queryUri,new String[]{"value"},"name='username'",null,null);
|
|
|
cursor.moveToFirst();
|
|
|
String userName = cursor.getString(cursor.getColumnIndexOrThrow("value"));
|
|
|
Log.d(TAG,"userName:" + userName);
|
|
|
+ cursor.close();
|
|
|
return userName;
|
|
|
}catch (Exception e){
|
|
|
e.printStackTrace();
|
|
@@ -388,6 +402,8 @@ public class AndroidToJS {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+
|
|
|
private String getUserToken(){
|
|
|
try{
|
|
|
Uri queryUri = Uri.parse("content://stbauthinfo/authentication/");
|
|
@@ -418,7 +434,7 @@ public class AndroidToJS {
|
|
|
e.printStackTrace();
|
|
|
return "";
|
|
|
}
|
|
|
- }
|
|
|
+ }*/
|
|
|
|
|
|
|
|
|
public interface PlayVideoListener {
|