Skip to content

Commit 11987e6

Browse files
committed
资源文件引用于注释
1 parent 4712ea1 commit 11987e6

File tree

5 files changed

+83
-49
lines changed

5 files changed

+83
-49
lines changed

VideoOS/venvy_pub/src/main/java/cn/com/videopls/pub/VideoPlusController.java

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
import cn.com.venvy.common.router.VenvyRouterManager;
3636
import cn.com.venvy.common.utils.VenvyAPIUtil;
3737
import cn.com.venvy.common.utils.VenvyLog;
38+
import cn.com.venvy.common.utils.VenvyResourceUtil;
3839
import cn.com.venvy.common.utils.VenvySchemeUtil;
3940
import cn.com.venvy.common.utils.VenvyUIUtil;
4041
import cn.com.venvy.lua.LuaHelper;
@@ -43,6 +44,8 @@
4344
import cn.com.videopls.pub.track.ChainTrackModel;
4445
import cn.com.videopls.pub.view.VideoOSLuaView;
4546

47+
import cn.com.videopls.pub.R;
48+
4649
import static cn.com.venvy.common.observer.VenvyObservableTarget.Constant.CONSTANT_MSG;
4750
import static cn.com.venvy.common.observer.VenvyObservableTarget.Constant.CONSTANT_NEED_RETRY;
4851

@@ -600,9 +603,13 @@ public void downError(Throwable t) {
600603
//网络不通,请求不到小程序内容 | 网络请求错误,为底层通讯错误如,404,500等
601604
Bundle bundle = new Bundle();
602605
if (t instanceof DownloadException) {
603-
bundle.putString(CONSTANT_MSG, getContext().getString(R.string.loadMiniAppError));
606+
bundle.putString(CONSTANT_MSG,
607+
getContext().getString(
608+
VenvyResourceUtil.getStringId(getContext(), "loadMiniAppError")));
604609
} else {
605-
bundle.putString(CONSTANT_MSG, getContext().getString(R.string.networkBusy));
610+
bundle.putString(CONSTANT_MSG,
611+
getContext().getString(
612+
VenvyResourceUtil.getStringId(getContext(), "networkBusy")));
606613
}
607614

608615
bundle.putBoolean(CONSTANT_NEED_RETRY, true);

VideoOS/venvy_pub/src/main/java/cn/com/videopls/pub/VideoProgramToolBarView.java

Lines changed: 32 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import cn.com.venvy.common.router.IRouterCallback;
2626
import cn.com.venvy.common.utils.VenvyDeviceUtil;
2727
import cn.com.venvy.common.utils.VenvyLog;
28+
import cn.com.venvy.common.utils.VenvyResourceUtil;
2829

2930
/**
3031
* Created by Lucas on 2019/7/31.
@@ -91,8 +92,9 @@ protected void onDetachedFromWindow() {
9192

9293

9394
private void init() {
94-
inflate(getContext(), R.layout.video_program_tool, this);
95-
rlTitleBar = findViewById(R.id.rlTitleBar);
95+
inflate(getContext(), VenvyResourceUtil.getLayoutId(getContext(),
96+
"video_program_tool"), this);
97+
rlTitleBar = findViewById(VenvyResourceUtil.getId(getContext(), "rlTitleBar"));
9698
rlTitleBar.setAlpha(0.9f);
9799
// // TODO : for test
98100
// rlTitleBar.setOnClickListener(new OnClickListener() {
@@ -106,12 +108,16 @@ private void init() {
106108
// }
107109
// });
108110

109-
loadingContent = findViewById(R.id.loadingContent);
110-
retryContent = findViewById(R.id.disConnectWifiContent);
111-
errorContent = findViewById(R.id.errorContent);
111+
loadingContent = findViewById(
112+
VenvyResourceUtil.getId(getContext(), "loadingContent"));
113+
retryContent = findViewById(
114+
VenvyResourceUtil.getId(getContext(), "disConnectWifiContent"));
115+
errorContent = findViewById(
116+
VenvyResourceUtil.getId(getContext(), "errorContent"));
112117
retryContent.setClickable(true);
113118
errorContent.setClickable(true);
114-
tvRetry = (TextView) findViewById(R.id.tvRetry);
119+
tvRetry = (TextView) findViewById(
120+
VenvyResourceUtil.getId(getContext(), "tvRetry"));
115121
tvRetry.setOnClickListener(new OnClickListener() {
116122
@Override
117123
public void onClick(View view) {
@@ -122,14 +128,22 @@ public void onClick(View view) {
122128
}
123129
}
124130
});
125-
videoProgramView = (VideoProgramView) findViewById(R.id.programView);
126-
ivBack = (ImageView) findViewById(R.id.ivBack);
127-
tvTitle = (TextView) findViewById(R.id.tvTitle);
128-
ivClose = (ImageView) findViewById(R.id.ivClose);
129-
circle1 = (ImageView) findViewById(R.id.circle1);
130-
circle2 = (ImageView) findViewById(R.id.circle2);
131-
tvRetryMsg = (TextView) findViewById(R.id.tvRetryMsg);
132-
tvErrorMsg = (TextView) findViewById(R.id.tvErrorMsg);
131+
videoProgramView = (VideoProgramView) findViewById(
132+
VenvyResourceUtil.getId(getContext(), "programView"));
133+
ivBack = (ImageView) findViewById(
134+
VenvyResourceUtil.getId(getContext(), "ivBack"));
135+
tvTitle = (TextView) findViewById(
136+
VenvyResourceUtil.getId(getContext(), "tvTitle"));
137+
ivClose = (ImageView) findViewById(
138+
VenvyResourceUtil.getId(getContext(), "ivClose"));
139+
circle1 = (ImageView) findViewById(
140+
VenvyResourceUtil.getId(getContext(), "circle1"));
141+
circle2 = (ImageView) findViewById(
142+
VenvyResourceUtil.getId(getContext(), "circle2"));
143+
tvRetryMsg = (TextView) findViewById(
144+
VenvyResourceUtil.getId(getContext(), "tvRetryMsg"));
145+
tvErrorMsg = (TextView) findViewById(
146+
VenvyResourceUtil.getId(getContext(), "tvErrorMsg"));
133147
ivBack.setVisibility(INVISIBLE);
134148
ivBack.setOnClickListener(new OnClickListener() {
135149
@Override
@@ -233,10 +247,12 @@ public void lost() {
233247
// 需要判断是否是入口小程序失败,还是小程序之间内部跳转失败
234248
if (videoProgramView.getAllOfLuaView() > 0) {
235249
// 首次视联网小程序加载失败
236-
showExceptionLogic(getContext().getString(R.string.miniAppCrashedTryOtherTag), false);
250+
showExceptionLogic(getContext().getString(VenvyResourceUtil.getStringId(getContext(),
251+
"miniAppCrashedTryOtherTag")), false);
237252
} else {
238253
// 小程序内部跳转加载失败
239-
showExceptionLogic(getContext().getString(R.string.miniAppCrashed), false);
254+
showExceptionLogic(getContext().getString(VenvyResourceUtil.getStringId(getContext(),
255+
"miniAppCrashed")), false);
240256
}
241257
}
242258

VideoOS/venvy_pub/src/main/java/cn/com/videopls/pub/VideoProgramTypeBView.java

Lines changed: 33 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,23 @@
1717
import java.util.HashMap;
1818
import java.util.Map;
1919

20+
import cn.com.venvy.common.utils.VenvyResourceUtil;
2021
import cn.com.venvy.common.utils.VenvyUIUtil;
2122

2223
/**
2324
* Created by Lucas on 2019/7/31.
24-
* 视联网小程序容器
25-
* <p>
26-
* A类小程序 LuaView://defaultLuaView?template=xxx.lua&id=xxx
27-
* 跳转B类小程序 LuaView://applets?appletId=xxxx&type=x(type: 1横屏,2竖屏)
28-
* <p>
29-
* B类小程序容器内部跳转 LuaView://applets?appletId=xxxx&template=xxxx.lua&id=xxxx&(priority=x)
3025
*/
3126
public class VideoProgramTypeBView extends FrameLayout {
3227

28+
/**
29+
* 视联网小程序容器
30+
* <p>
31+
* A类小程序 LuaView://defaultLuaView?template=xxx.lua&id=xxx
32+
* 跳转B类小程序 LuaView://applets?appletId=xxxx&type=x(type: 1横屏,2竖屏)
33+
* <p>
34+
* B类小程序容器内部跳转 LuaView://applets?appletId=xxxx&template=xxxx.lua&id=xxxx&(priority=x)
35+
*/
36+
3337
/**
3438
* 会有多个B类小程序侧边栏覆盖的情况,所以需要一个Map统一管理
3539
*/
@@ -52,23 +56,26 @@ public VideoProgramTypeBView(@NonNull Context context, @Nullable AttributeSet at
5256
init();
5357
}
5458

55-
public VideoProgramTypeBView(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
59+
public VideoProgramTypeBView(@NonNull Context context, @Nullable AttributeSet attrs,
60+
int defStyleAttr) {
5661
super(context, attrs, defStyleAttr);
5762
init();
5863
}
5964

6065
@TargetApi(21)
61-
public VideoProgramTypeBView(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr, int defStyleRes) {
66+
public VideoProgramTypeBView(@NonNull Context context, @Nullable AttributeSet attrs,
67+
int defStyleAttr, int defStyleRes) {
6268
super(context, attrs, defStyleAttr, defStyleRes);
6369
init();
6470
}
6571

6672
private void init() {
67-
inflate(getContext(), R.layout.video_program_type_b, this);
73+
inflate(getContext(), VenvyResourceUtil.getLayoutId(getContext(), "video_program_type_b"), this);
6874
// for test
6975
// setBackgroundColor(ContextCompat.getColor(getContext(), android.R.color.holo_red_light));
7076
// setAlpha(0.5f);
71-
programContent = (FrameLayout) findViewById(R.id.programContent);
77+
programContent = (FrameLayout) findViewById(
78+
VenvyResourceUtil.getId(getContext(), "programContent"));
7279

7380
setOnClickListener(new OnClickListener() {
7481
@Override
@@ -89,7 +96,8 @@ public VideoProgramToolBarView createProgram(int orientationType) {
8996

9097
private VideoProgramToolBarView generateVideoProgram() {
9198
VideoProgramToolBarView programToolBarView = new VideoProgramToolBarView(getContext());
92-
programToolBarView.setLayoutParams(new LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
99+
programToolBarView.setLayoutParams(new LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
100+
ViewGroup.LayoutParams.MATCH_PARENT));
93101
return programToolBarView;
94102
}
95103

@@ -122,7 +130,7 @@ public void start(@NonNull String appletId, String data, int orientationType) {
122130
*
123131
* @param appletId
124132
*/
125-
public void close( String appletId) {
133+
public void close(String appletId) {
126134
if (!TextUtils.isEmpty(appletId)) {
127135
VideoProgramToolBarView programView = programMap.get(appletId);
128136
if (programView != null) {
@@ -147,26 +155,27 @@ public void closeAllProgram() {
147155

148156
/**
149157
* 删除所有指定方向的视联网小程序
158+
*
150159
* @param orientationType
151160
*/
152-
public void closeAllProgramByOrientation(int orientationType){
161+
public void closeAllProgramByOrientation(int orientationType) {
153162
for (Map.Entry<String, VideoProgramToolBarView> item : programMap.entrySet()) {
154-
if((int)item.getValue().getTag() == orientationType){
155-
programContent.removeView(item.getValue());
156-
programMap.remove(item.getKey());
157-
}
163+
if ((int) item.getValue().getTag() == orientationType) {
164+
programContent.removeView(item.getValue());
165+
programMap.remove(item.getKey());
166+
}
158167
}
159168
}
160169

161170

162171
public void showExceptionLogic(String msg, boolean needRetry) {
163172
if (currentProgram != null) {
164-
currentProgram.showExceptionLogic(msg,needRetry);
173+
currentProgram.showExceptionLogic(msg, needRetry);
165174
}
166175
}
167176

168177

169-
public void setCurrentProgramTitle(String title){
178+
public void setCurrentProgramTitle(String title) {
170179
if (currentProgram != null) {
171180
currentProgram.setTitle(title);
172181
}
@@ -179,13 +188,15 @@ private void checkVisionProgram() {
179188

180189

181190
private void doEntranceAnimation(View view) {
182-
ValueAnimator valueAnimator = ObjectAnimator.ofFloat(view, "translationX", VenvyUIUtil.dip2px(getContext(), 222), 0);
191+
ValueAnimator valueAnimator = ObjectAnimator.ofFloat(view, "translationX",
192+
VenvyUIUtil.dip2px(getContext(), 222), 0);
183193
valueAnimator.setDuration(300);
184194
valueAnimator.start();
185195
}
186196

187-
private void doExitAnimation(final View view){
188-
ValueAnimator valueAnimator = ObjectAnimator.ofFloat(view, "translationX", 0, VenvyUIUtil.dip2px(getContext(), 222));
197+
private void doExitAnimation(final View view) {
198+
ValueAnimator valueAnimator = ObjectAnimator.ofFloat(view, "translationX", 0,
199+
VenvyUIUtil.dip2px(getContext(), 222));
189200
valueAnimator.setDuration(300);
190201
valueAnimator.addListener(new AnimatorListenerAdapter() {
191202
@Override

VideoOS/venvy_pub/src/main/java/cn/com/videopls/pub/VisionProgramConfigModel.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
import cn.com.venvy.common.observer.VenvyObservableTarget;
2323
import cn.com.venvy.common.utils.VenvyAesUtil;
2424
import cn.com.venvy.common.utils.VenvyLog;
25+
import cn.com.venvy.common.utils.VenvyResourceUtil;
2526
import cn.com.venvy.lua.plugin.LVCommonParamPlugin;
2627
import cn.com.videopls.pub.exception.DownloadException;
2728

@@ -137,7 +138,8 @@ public void updateError(Throwable t) {
137138
} else if (resCode.equalsIgnoreCase("01")) {
138139
// 小程序下架不可用
139140
Bundle bundle = new Bundle();
140-
bundle.putString(CONSTANT_MSG, getContext().getString(R.string.errorDesc));
141+
bundle.putString(CONSTANT_MSG, getContext().getString(
142+
VenvyResourceUtil.getStringId(getContext(), "errorDesc")));
141143
bundle.putBoolean(CONSTANT_NEED_RETRY, false);
142144
ObservableManager.getDefaultObserable().sendToTarget(VenvyObservableTarget.TAG_SHOW_VISION_ERROR_LOGIC, bundle);
143145
} else {

VideoOS/venvy_pub/src/main/java/cn/com/videopls/pub/view/VideoOSLuaView.java

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,16 +36,14 @@
3636
/*
3737
* Created by yanjiangbo on 2018/1/18.
3838
*/
39-
40-
/**
41-
* A类小程序 L uaView://defaultLuaView?template=xxx.lua&id=xxx
42-
* 跳转B类小程序 LuaView://applets?appletId=xxxx&type=x(type: 1横屏,2竖屏)
43-
* <p>
44-
* B类小程序容器内部跳转 LuaView://applets?appletId=xxxx&template=xxxx.lua&id=xxxx&(priority=x)
45-
*/
46-
4739
@VenvyRouter(name = VenvySchemeUtil.SCHEME_LUA_VIEW, type = RouteType.TYPE_VIEW)
4840
public class VideoOSLuaView extends VideoOSBaseView {
41+
/**
42+
* A类小程序 LuaView://defaultLuaView?template=xxx.lua&id=xxx
43+
* 跳转B类小程序 LuaView://applets?appletId=xxxx&type=x(type: 1横屏,2竖屏)
44+
* <p>
45+
* B类小程序容器内部跳转 LuaView://applets?appletId=xxxx&template=xxxx.lua&id=xxxx&(priority=x)
46+
*/
4947

5048
private static final String INIT_SCRIPT = "Init_ScriptBundle";
5149
private static final String LOCAL_LUA_PATH = "lua/";

0 commit comments

Comments
 (0)