Skip to content

Commit 06fbc92

Browse files
authored
Merge pull request #20 from VideoOS/merge
Merge 2.0.1
2 parents f79bef8 + 45bbc76 commit 06fbc92

File tree

131 files changed

+164
-7521
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

131 files changed

+164
-7521
lines changed

VideoOS/LuaViewSDK/src/cn/com/venvy/lua/plugin/LVCallbackPlugin.java

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
11
package cn.com.venvy.lua.plugin;
22

3+
import android.text.TextUtils;
4+
35
import com.taobao.luaview.util.LuaUtil;
46

7+
import org.luaj.vm2.LuaTable;
58
import org.luaj.vm2.LuaValue;
69
import org.luaj.vm2.Varargs;
710
import org.luaj.vm2.lib.VarArgFunction;
811

12+
import java.util.Map;
13+
914
import cn.com.venvy.Platform;
1015
import cn.com.venvy.common.bean.WidgetInfo;
1116
import cn.com.venvy.lua.binder.VenvyLVLibBinder;
@@ -20,6 +25,7 @@ public class LVCallbackPlugin {
2025

2126
public static void install(VenvyLVLibBinder venvyLVLibBinder, Platform platform) {
2227
venvyLVLibBinder.set("widgetEvent", new WidgetDelegate(platform));
28+
venvyLVLibBinder.set("widgetNotify", new WidgetTableDelegate(platform));
2329
}
2430

2531
private static class WidgetDelegate extends VarArgFunction {
@@ -88,4 +94,80 @@ public LuaValue invoke(Varargs args) {
8894
return LuaValue.NIL;
8995
}
9096
}
97+
98+
private static class WidgetTableDelegate extends VarArgFunction {
99+
private Platform mPlatform;
100+
101+
WidgetTableDelegate(Platform platform) {
102+
super();
103+
this.mPlatform = platform;
104+
}
105+
106+
@Override
107+
public LuaValue invoke(Varargs args) {
108+
int fixIndex = VenvyLVLibBinder.fixIndex(args);
109+
LuaTable table = LuaUtil.getTable(args, fixIndex + 1);
110+
Map<String, String> map = LuaUtil.toMap(table);
111+
if (map == null || map.size() <= 0) {
112+
return LuaValue.NIL;
113+
}
114+
String eventType = map.get("eventType");
115+
String adID = map.get("adID");
116+
String adName = map.get("adName");
117+
String actionType = map.get("actionType");
118+
String actionString = map.get("actionString");
119+
String linkUrl = map.get("linkUrl");
120+
String deepLink = map.get("deepLink");
121+
String selfLink = map.get("selfLink");
122+
WidgetInfo.WidgetActionType widgetActionType = WidgetInfo.WidgetActionType.findTypeById(!TextUtils.isEmpty(actionType) ? Integer.valueOf(actionType) : 0);
123+
if (TextUtils.isEmpty(eventType)) {
124+
return LuaValue.NIL;
125+
}
126+
if (mPlatform == null) {
127+
return LuaValue.NIL;
128+
}
129+
130+
WidgetInfo widgetInfo = new WidgetInfo.Builder()
131+
.setAdId(adID)
132+
.setWidgetActionType(widgetActionType)
133+
.setUrl(actionString)
134+
.setWidgetName(adName)
135+
.setDeepLink(deepLink)
136+
.setLinkUrl(linkUrl)
137+
.setSelfLink(selfLink)
138+
.build();
139+
switch (Integer.valueOf(eventType)) {
140+
case 1:
141+
if (mPlatform.getPrepareShowListener() != null && adID != null) {
142+
mPlatform.getPrepareShowListener().prepareShow(widgetInfo);
143+
}
144+
break;
145+
146+
case 2:
147+
if (mPlatform.getWidgetShowListener() != null && adID != null) {
148+
mPlatform.getWidgetShowListener().onShow(widgetInfo);
149+
}
150+
151+
break;
152+
153+
case 3:
154+
if (mPlatform.getWidgetClickListener() != null && adID != null) {
155+
mPlatform.getWidgetClickListener().onClick(widgetInfo);
156+
}
157+
break;
158+
159+
case 4:
160+
if (mPlatform.getWidgetCloseListener() != null && adID != null) {
161+
mPlatform.getWidgetCloseListener().onClose(widgetInfo);
162+
}
163+
break;
164+
case 5:
165+
if (mPlatform.getWedgeListener() != null && adID != null) {
166+
mPlatform.getWedgeListener().goBack();
167+
}
168+
break;
169+
}
170+
return LuaValue.NIL;
171+
}
172+
}
91173
}

VideoOS/LuaViewSDK/src/com/taobao/luaview/userdata/kit/UDApplet.java

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,16 @@ public UDApplet(Globals globals, LuaValue metatable) {
4040
class AppletSize extends VarArgFunction {
4141
@Override
4242
public Varargs invoke(Varargs args) {
43-
float width = 222;
44-
float height = DimenUtil.pxToDpi(AndroidUtil.getScreenHeight(getContext()));
43+
int screenHeight = AndroidUtil.getScreenHeight(getContext());
44+
int screenWidth = AndroidUtil.getScreenWidth(getContext());
45+
46+
47+
// float width = Math.max(screenWidth,screenHeight) * 0.332f;
48+
49+
50+
float height = DimenUtil.pxToDpi(Math.min(screenWidth,screenHeight));
51+
float width = height / 375.0f * 222;
52+
4553
LuaValue[] luaValue = new LuaValue[]{LuaValue.valueOf(width), LuaValue.valueOf(height)};
4654
return LuaValue.varargsOf(luaValue);
4755
}

VideoOS/VenvyLibrary/src/main/java/cn/com/venvy/common/bean/WidgetInfo.java

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ public class WidgetInfo {
1414
private String mWidgetType;
1515
private String mWidgetName;
1616
private String mUrl;
17+
private String mLinkUrl;
18+
private String mDeepLink;
19+
private String mSelfLink;
1720
private WidgetActionType mWidgetActionType;
1821
//是否需要获取焦点
1922
private boolean mNeedFocus;
@@ -25,9 +28,23 @@ private WidgetInfo(Builder builder) {
2528
mWidgetName = builder.mWidgetName;
2629
mWidgetActionType = builder.mWidgetActionType;
2730
mUrl = builder.mUrl;
31+
mLinkUrl = builder.mLinkUrl;
32+
mDeepLink = builder.mDeepLink;
33+
mSelfLink = builder.mSelfLink;
2834
mNeedFocus = builder.mNeedFocus;
2935
}
3036

37+
public String getLinkUrl() {
38+
return mLinkUrl;
39+
}
40+
41+
public String getDeepLink() {
42+
return mDeepLink;
43+
}
44+
45+
public String getSelfLink() {
46+
return mSelfLink;
47+
}
3148

3249
public String getAdId() {
3350
return mAdId;
@@ -63,6 +80,9 @@ public static final class Builder {
6380
private String mWidgetName;
6481
private WidgetActionType mWidgetActionType;
6582
private String mUrl;
83+
private String mLinkUrl;
84+
private String mDeepLink;
85+
private String mSelfLink;
6686
private String mResourceId;
6787
private boolean mNeedFocus;
6888

@@ -71,6 +91,21 @@ public Builder setAdId(String adId) {
7191
return this;
7292
}
7393

94+
public Builder setLinkUrl(String linkUrl) {
95+
this.mLinkUrl = linkUrl;
96+
return this;
97+
}
98+
99+
public Builder setDeepLink(String deepLink) {
100+
this.mDeepLink = deepLink;
101+
return this;
102+
}
103+
104+
public Builder setSelfLink(String selfLink) {
105+
this.mSelfLink = selfLink;
106+
return this;
107+
}
108+
74109
@Deprecated
75110
public Builder setResourceId(String resourceId) {
76111
this.mResourceId = resourceId;

VideoOS/venvy_pub/src/main/res/drawable/bg_disconnect_wifi.xml renamed to VideoOS/VenvyLibrary/src/main/res/drawable/bg_disconnect_wifi.xml

File renamed without changes.

VideoOS/venvy_pub/src/main/res/drawable/shape_loading_circle.xml renamed to VideoOS/VenvyLibrary/src/main/res/drawable/shape_loading_circle.xml

File renamed without changes.

VideoOS/venvy_pub/src/main/res/layout/video_program_tool.xml renamed to VideoOS/VenvyLibrary/src/main/res/layout/video_program_tool.xml

File renamed without changes.

VideoOS/venvy_pub/src/main/res/mipmap-xhdpi/ic_back.png renamed to VideoOS/VenvyLibrary/src/main/res/mipmap-xhdpi/ic_back.png

File renamed without changes.

VideoOS/venvy_pub/src/main/res/mipmap-xhdpi/ic_close.png renamed to VideoOS/VenvyLibrary/src/main/res/mipmap-xhdpi/ic_close.png

File renamed without changes.

VideoOS/venvy_pub/src/main/res/mipmap-xhdpi/pic_disconnect.png renamed to VideoOS/VenvyLibrary/src/main/res/mipmap-xhdpi/pic_disconnect.png

File renamed without changes.

VideoOS/venvy_pub/src/main/res/mipmap-xhdpi/pic_error.png renamed to VideoOS/VenvyLibrary/src/main/res/mipmap-xhdpi/pic_error.png

File renamed without changes.

0 commit comments

Comments
 (0)