Skip to content

Commit 9730e42

Browse files
committed
Merge branch 'dev_1.3.2' into merge
# Conflicts: # .gitignore # VideoOS/LuaViewSDK/src/com/taobao/luaview/global/LuaViewManager.java # VideoOS/VenvyLibrary/src/main/java/cn/com/venvy/Config.java # VideoOS/VenvyLibrary/src/main/java/cn/com/venvy/common/utils/VenvyMD5Util.java # VideoOS/app/build.gradle # VideoOS/app_demo/build.gradle # VideoOS/gradle.properties # VideoOS/venvy_pub/src/main/java/cn/com/videopls/pub/LuaUpdateInfo.java
2 parents d49b647 + 64c14ee commit 9730e42

File tree

181 files changed

+7165
-605
lines changed

Some content is hidden

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

181 files changed

+7165
-605
lines changed

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

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package cn.com.venvy.lua.plugin;
22

33
import android.net.Uri;
4+
import android.os.Bundle;
45
import android.text.TextUtils;
56

67
import com.taobao.luaview.util.JsonUtil;
@@ -15,14 +16,22 @@
1516
import java.util.Set;
1617

1718
import cn.com.venvy.Platform;
19+
import cn.com.venvy.common.observer.ObservableManager;
20+
import cn.com.venvy.common.observer.VenvyObservableTarget;
1821
import cn.com.venvy.common.router.PostInfo;
1922
import cn.com.venvy.common.router.VenvyRouterManager;
2023
import cn.com.venvy.common.utils.VenvyBase64;
24+
import cn.com.venvy.common.utils.VenvyLog;
2125
import cn.com.venvy.lua.binder.VenvyLVLibBinder;
2226

2327
/**
2428
* lua路由插件
2529
* Created by Arthur on 2017/8/21.
30+
* <p>
31+
* * A类小程序 L uaView://defaultLuaView?template=xxx.lua&id=xxx
32+
* * 跳转B类小程序 LuaView://applets?appletId=xxxx&type=x(type: 1横屏,2竖屏)
33+
* *
34+
* * B类小程序容器内部跳转 LuaView://applets?appletId=xxxx&template=xxxx.lua&id=xxxx&(priority=x)
2635
*/
2736

2837
public class LVEventPlugin {
@@ -74,7 +83,30 @@ public Varargs invoke(Varargs args) {
7483
if (map.size() > 0) {
7584
info.withSerializable("data", map);
7685
}
77-
info.withTargetViewParent(mPlatform.getContentViewGroup()).withTargetPlatform("platform", mPlatform).navigation();
86+
String protocolHost = uri.getHost();
87+
if (protocolHost.equalsIgnoreCase("defaultLuaView")) {
88+
// A类容器内部跳转
89+
info.withTargetViewParent(mPlatform.getContentViewGroup()).withTargetPlatform("platform", mPlatform).navigation();
90+
} else if (protocolHost.equalsIgnoreCase("applets")) {
91+
String type = info.getBundle().getString("type");
92+
VenvyLog.d("type is "+type);
93+
if(TextUtils.isEmpty(type)){
94+
// B类小程序内部跳转
95+
info.withTargetViewParent(mPlatform.getContentViewGroup()).withTargetPlatform("platform", mPlatform).navigation();
96+
ObservableManager.getDefaultObserable().sendToTarget(VenvyObservableTarget.TAG_ADD_LUA_SCRIPT_TO_VISION_PROGRAM, null);
97+
}else{
98+
// 发起一个视联网小程序
99+
Bundle bundle = new Bundle();
100+
bundle.putString(VenvyObservableTarget.KEY_APPLETS_ID, info.getBundle().getString("appletId"));
101+
bundle.putString(VenvyObservableTarget.KEY_ORIENTATION_TYPE, type);
102+
if (table != null) {
103+
bundle.putString(VenvyObservableTarget.Constant.CONSTANT_DATA, JsonUtil.toString(table));
104+
}
105+
ObservableManager.getDefaultObserable().sendToTarget(VenvyObservableTarget.TAG_LAUNCH_VISION_PROGRAM, bundle);
106+
}
107+
108+
109+
}
78110
return LuaValue.TRUE;
79111
}
80112
return LuaValue.FALSE;

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

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
import android.text.TextUtils;
66
import android.view.View;
77
import android.view.ViewGroup;
8-
import android.widget.TextView;
98

9+
import com.taobao.luaview.util.AndroidUtil;
1010
import com.taobao.luaview.util.LuaUtil;
1111

1212
import org.luaj.vm2.LuaValue;
@@ -41,6 +41,10 @@ public Varargs invoke(Varargs args) {
4141
if (!TextUtils.isEmpty(text)) {
4242
Paint paint = new Paint();
4343
if (size != null) {
44+
float density = AndroidUtil.getDensity(App.getContext());
45+
if (density < 3) {
46+
size = size - 2;
47+
}
4448
paint.setTextSize(size);
4549
}
4650
float text_width = paint.measureText(String.valueOf(text));//得到总体长度
@@ -76,10 +80,10 @@ public Varargs invoke(Varargs args) {
7680
mathWidth = width;
7781
}
7882
int charNumInThisLine = paint.breakText(text, 0, text.length(), true, mathWidth, null);
79-
if(charNumInThisLine>=text.length()){
83+
if (charNumInThisLine >= text.length()) {
8084
mathHeight = (float) (hightMeasureSpec * (Math.ceil(text.length() / charNumInThisLine)));
81-
}else{
82-
mathHeight = (float) (hightMeasureSpec * (Math.ceil(text.length() / charNumInThisLine)+1));
85+
} else {
86+
mathHeight = (float) (hightMeasureSpec * (Math.ceil(text.length() / charNumInThisLine) + 1));
8387
}
8488
}
8589
LuaValue[] luaValue = new LuaValue[]{LuaValue.valueOf(mathWidth), LuaValue.valueOf(mathHeight)};
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package com.taobao.luaview.fun.binder.kit;
2+
3+
import com.taobao.luaview.fun.base.BaseFunctionBinder;
4+
import com.taobao.luaview.userdata.kit.UDApplet;
5+
6+
import org.luaj.vm2.LuaValue;
7+
import org.luaj.vm2.lib.LibFunction;
8+
9+
/**
10+
* Created by Lucas on 2019/8/2.
11+
*/
12+
public class AppletBinder extends BaseFunctionBinder {
13+
public AppletBinder() {
14+
super("Applet");
15+
}
16+
17+
@Override
18+
public Class<? extends LibFunction> getMapperClass() {
19+
return null;
20+
}
21+
22+
@Override
23+
public LuaValue createCreator(LuaValue env, LuaValue metaTable) {
24+
return new UDApplet(env.checkglobals(), metaTable);
25+
}
26+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
package com.taobao.luaview.fun.mapper.kit;
2+
3+
/**
4+
* Created by Lucas on 2019/8/2.
5+
*/
6+
public class AppletMethodMapper {
7+
}

VideoOS/LuaViewSDK/src/com/taobao/luaview/fun/mapper/ui/UITextViewMethodMapper.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@ public class UITextViewMethodMapper<U extends UDTextView> extends UIViewMethodMa
4646
"adjustTextSize",//13
4747
"adjustFontSize",//14
4848
"textShadow",//15
49-
"textBold"//16
49+
"textBold",//16
50+
"strikeLines"//17
5051
};
5152

5253
@Override
@@ -92,6 +93,8 @@ public Varargs invoke(int code, U target, Varargs varargs) {
9293
return textShadow(target, varargs);
9394
case 16:
9495
return setfontBold(target, varargs);
96+
case 17:
97+
return setTextDelLine(target, varargs);
9598
}
9699
return super.invoke(code, target, varargs);
97100
}
@@ -471,4 +474,8 @@ public LuaValue setTextShadow(U view, Varargs varargs) {
471474
final Integer radius = DimenUtil.dpiToPx(varargs.arg(3));
472475
return view.setShadowLayer(color, radius);
473476
}
477+
478+
public LuaValue setTextDelLine(U view, Varargs varargs) {
479+
return view.setDelLine();
480+
}
474481
}

VideoOS/LuaViewSDK/src/com/taobao/luaview/global/LuaViewManager.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import com.taobao.luaview.fun.binder.constants.ViewEffectBinder;
2525
import com.taobao.luaview.fun.binder.indicator.UICircleViewPagerIndicatorBinder;
2626
import com.taobao.luaview.fun.binder.kit.ActionBarBinder;
27+
import com.taobao.luaview.fun.binder.kit.AppletBinder;
2728
import com.taobao.luaview.fun.binder.kit.DataBinder;
2829
import com.taobao.luaview.fun.binder.kit.FileBinder;
2930
import com.taobao.luaview.fun.binder.kit.JsonBinder;
@@ -194,6 +195,7 @@ static void loadLuaViewLibs(final Globals globals) {
194195
globals.tryLazyLoad(new DataBinder());
195196
globals.tryLazyLoad(new JsonBinder());
196197
globals.tryLazyLoad(new FileBinder());
198+
globals.tryLazyLoad(new AppletBinder());
197199

198200
//常量
199201
globals.tryLazyLoad(new AlignBinder());
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
package com.taobao.luaview.userdata.kit;
2+
3+
import android.os.Bundle;
4+
5+
import com.taobao.luaview.fun.mapper.LuaViewLib;
6+
import com.taobao.luaview.userdata.base.BaseLuaTable;
7+
import com.taobao.luaview.util.AndroidUtil;
8+
import com.taobao.luaview.util.DimenUtil;
9+
10+
import org.luaj.vm2.Globals;
11+
import org.luaj.vm2.LuaValue;
12+
import org.luaj.vm2.Varargs;
13+
import org.luaj.vm2.lib.VarArgFunction;
14+
15+
import cn.com.venvy.common.observer.ObservableManager;
16+
import cn.com.venvy.common.observer.VenvyObservableTarget;
17+
import cn.com.venvy.common.utils.VenvyLog;
18+
import cn.com.venvy.lua.binder.VenvyLVLibBinder;
19+
import cn.com.videopls.pub.R;
20+
21+
import static cn.com.venvy.App.getContext;
22+
import static cn.com.venvy.common.observer.VenvyObservableTarget.Constant.CONSTANT_MSG;
23+
import static cn.com.venvy.common.observer.VenvyObservableTarget.Constant.CONSTANT_NEED_RETRY;
24+
import static cn.com.venvy.lua.binder.VenvyLVLibBinder.luaValueToString;
25+
26+
/**
27+
* Created by Lucas on 2019/8/2.
28+
*/
29+
@LuaViewLib(revisions = {"20190802已对标"})
30+
public class UDApplet extends BaseLuaTable {
31+
32+
33+
public UDApplet(Globals globals, LuaValue metatable) {
34+
super(globals, metatable);
35+
set("appletSize", new AppletSize());// 返回视联网小程序容器size
36+
set("showRetryPage", new RetryPage());// 显示重试页面
37+
set("showErrorPage", new ErrorPage());// 显示错误页面
38+
}
39+
40+
class AppletSize extends VarArgFunction {
41+
@Override
42+
public Varargs invoke(Varargs args) {
43+
float width = 222;
44+
float height = DimenUtil.pxToDpi(AndroidUtil.getScreenHeight(getContext()));
45+
LuaValue[] luaValue = new LuaValue[]{LuaValue.valueOf(width), LuaValue.valueOf(height)};
46+
return LuaValue.varargsOf(luaValue);
47+
}
48+
}
49+
50+
class RetryPage extends VarArgFunction {
51+
@Override
52+
public Varargs invoke(Varargs args) {
53+
int fixIndex = VenvyLVLibBinder.fixIndex(args);
54+
LuaValue target = args.arg(fixIndex + 2); //key
55+
String msg = luaValueToString(target);
56+
57+
Bundle bundle = new Bundle();
58+
bundle.putString(CONSTANT_MSG, msg);
59+
bundle.putBoolean(CONSTANT_NEED_RETRY, true);
60+
ObservableManager.getDefaultObserable().sendToTarget(VenvyObservableTarget.TAG_SHOW_VISION_ERROR_LOGIC, bundle);
61+
62+
63+
return LuaValue.valueOf(msg);
64+
}
65+
}
66+
67+
class ErrorPage extends VarArgFunction {
68+
@Override
69+
public Varargs invoke(Varargs args) {
70+
int fixIndex = VenvyLVLibBinder.fixIndex(args);
71+
LuaValue target = args.arg(fixIndex + 2); //key
72+
String msg = luaValueToString(target);
73+
Bundle bundle = new Bundle();
74+
bundle.putString(CONSTANT_MSG, msg);
75+
bundle.putBoolean(CONSTANT_NEED_RETRY, false);
76+
ObservableManager.getDefaultObserable().sendToTarget(VenvyObservableTarget.TAG_SHOW_VISION_ERROR_LOGIC, bundle);
77+
return LuaValue.valueOf(msg);
78+
}
79+
}
80+
81+
82+
}

VideoOS/LuaViewSDK/src/com/taobao/luaview/userdata/ui/UDTextView.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
package com.taobao.luaview.userdata.ui;
1010

1111
import android.annotation.TargetApi;
12+
import android.graphics.Paint;
1213
import android.os.Build;
1314
import android.text.TextPaint;
1415
import android.text.TextUtils;
@@ -331,6 +332,17 @@ public UDTextView setShadowLayer(int shadowColor, int shadowRadius) {
331332
return this;
332333
}
333334

335+
336+
/**
337+
* 给文字添加删除线
338+
* @return
339+
*/
340+
public UDTextView setDelLine(){
341+
T v = getView();
342+
v.setPaintFlags(v.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG);
343+
return this;
344+
}
345+
334346
/**
335347
* 修改文字的frame
336348
*

VideoOS/LuaViewSDK/src/com/taobao/luaview/userdata/ui/UDToast.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88

99
package com.taobao.luaview.userdata.ui;
1010

11+
import android.widget.Toast;
12+
1113
import com.taobao.luaview.userdata.base.BaseUserdata;
1214
import com.taobao.luaview.util.LuaUtil;
1315
import com.taobao.luaview.util.ToastUtil;
@@ -16,6 +18,8 @@
1618
import org.luaj.vm2.LuaValue;
1719
import org.luaj.vm2.Varargs;
1820

21+
import cn.com.venvy.App;
22+
1923
public class UDToast extends BaseUserdata {
2024

2125
public UDToast(Globals globals, LuaValue metaTable, Varargs varargs) {
@@ -31,7 +35,7 @@ public UDToast(Globals globals, LuaValue metaTable, Varargs varargs) {
3135
*/
3236
public UDToast show(CharSequence toastMessage) {
3337
if (toastMessage != null) {
34-
ToastUtil.showToast(getContext(), toastMessage);
38+
ToastUtil.showToast(App.getContext(), toastMessage);
3539
}
3640
return this;
3741
}
Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,35 @@
1-
{"creativeId":77,"data":{"isShowAds":true,"creativeName":"卡尔","creativeIdList":[201],"miniAppId":"1918","readonly":false,"imageUrl":"https://os-saas-share.oss-cn-beijing.aliyuncs.com/pro/app_info/166/82b3c2c4-d0e7-45f2-a876-5e070b622e0d.jpg","linkUrl":"https://videojj.com","interactionTypeId":"551","_imageUrl":{"creativeFileId":201,"width":320,"resCode":"00","fileUrl":"https://os-saas-share.oss-cn-beijing.aliyuncs.com/pro/app_info/166/82b3c2c4-d0e7-45f2-a876-5e070b622e0d.jpg","resMsg":"处理成功","height":200},"isShowClose":true,"errorSchema":{}},"duration":5000,"hotspotOrder":0,"id":"74bf84b8-09e5-4e66-96e4-e72629558b41","launchPlanId":225,"sumHotspot":1,"template":"os_cloud_game_hotspot.lua","videoEndTime":10000,"videoStartTime":5000}
1+
{
2+
"creativeId": 77,
3+
"data": {
4+
"isShowAds": true,
5+
"creativeName": "卡尔",
6+
"creativeIdList": [
7+
201
8+
],
9+
"miniAppId": "1918",
10+
"readonly": false,
11+
"imageUrl": "https://os-saas-share.oss-cn-beijing.aliyuncs.com/pro/app_info/166/82b3c2c4-d0e7-45f2-a876-5e070b622e0d.jpg",
12+
"linkUrl": "https://videojj.com",
13+
"interactionTypeId": "551",
14+
"_imageUrl": {
15+
"creativeFileId": 201,
16+
"resCode": "00",
17+
"fileUrl": "https://os-saas-share.oss-cn-beijing.aliyuncs.com/pro/app_info/166/82b3c2c4-d0e7-45f2-a876-5e070b622e0d.jpg",
18+
"resMsg": "处理成功",
19+
"width": 320,
20+
"height": 200
21+
},
22+
"isShowClose": true,
23+
"errorSchema": {},
24+
"width": 320,
25+
"height": 200
26+
},
27+
"duration": 5000,
28+
"hotspotOrder": 0,
29+
"id": "74bf84b8-09e5-4e66-96e4-e72629558b41",
30+
"launchPlanId": 225,
31+
"sumHotspot": 1,
32+
"template": "os_cloud_game_hotspot.lua",
33+
"videoEndTime": 10000,
34+
"videoStartTime": 5000
35+
}

0 commit comments

Comments
 (0)