玖星尚缘 v1.2.7版本的 MD5 值为:a5d3a854f0a33133433102e91a1193e3
以下内容为反编译后的 NativeBitmapMgr.java 源代码,内容仅作参考
package io.dcloud.feature.nativeObj;
import android.graphics.Color;
import android.text.TextUtils;
import android.view.ViewGroup;
import com.taobao.weex.ui.component.WXBasicComponentType;
import io.dcloud.base.R;
import io.dcloud.common.DHInterface.IApp;
import io.dcloud.common.DHInterface.ICallBack;
import io.dcloud.common.DHInterface.IFrameView;
import io.dcloud.common.DHInterface.IMgr;
import io.dcloud.common.DHInterface.INativeBitmap;
import io.dcloud.common.DHInterface.INativeView;
import io.dcloud.common.DHInterface.IWebview;
import io.dcloud.common.adapter.ui.AdaFrameView;
import io.dcloud.common.adapter.ui.DHImageView;
import io.dcloud.common.adapter.ui.FrameSwitchView;
import io.dcloud.common.adapter.util.Logger;
import io.dcloud.common.constant.AbsoluteConst;
import io.dcloud.common.util.Deprecated_JSUtil;
import io.dcloud.common.util.JSUtil;
import io.dcloud.common.util.PdrUtil;
import io.dcloud.common.util.StringUtil;
import io.dcloud.common.util.TitleNViewUtil;
import io.dcloud.feature.internal.splash.ISplash;
import io.dcloud.feature.nativeObj.richtext.RichTextLayout;
import io.dcloud.feature.uniapp.adapter.AbsURIAdapter;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.Map;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
public class NativeBitmapMgr {
private HashMap<String, INativeBitmap> mSnaps = new HashMap<>();
private HashMap<String, String> mIds = new HashMap<>();
protected LinkedHashMap<String, NativeView> mNativeViews = new LinkedHashMap<>();
public final String SUCCESS_INFO = "{path:'file://%s', w:%d, h:%d, size:%d}";
static class AnonymousClass7 {
static final int[] $SwitchMap$io$dcloud$feature$nativeObj$NativeBitmapMgr$Action;
static {
int[] iArr = new int[Action.values().length];
$SwitchMap$io$dcloud$feature$nativeObj$NativeBitmapMgr$Action = iArr;
try {
iArr[Action.View.ordinal()] = 1;
} catch (NoSuchFieldError unused) {
}
try {
$SwitchMap$io$dcloud$feature$nativeObj$NativeBitmapMgr$Action[Action.setStyle.ordinal()] = 2;
} catch (NoSuchFieldError unused2) {
}
try {
$SwitchMap$io$dcloud$feature$nativeObj$NativeBitmapMgr$Action[Action.addEventListener.ordinal()] = 3;
} catch (NoSuchFieldError unused3) {
}
try {
$SwitchMap$io$dcloud$feature$nativeObj$NativeBitmapMgr$Action[Action.interceptTouchEvent.ordinal()] = 4;
} catch (NoSuchFieldError unused4) {
}
try {
$SwitchMap$io$dcloud$feature$nativeObj$NativeBitmapMgr$Action[Action.setTouchEventRect.ordinal()] = 5;
} catch (NoSuchFieldError unused5) {
}
try {
$SwitchMap$io$dcloud$feature$nativeObj$NativeBitmapMgr$Action[Action.getViewById.ordinal()] = 6;
} catch (NoSuchFieldError unused6) {
}
try {
$SwitchMap$io$dcloud$feature$nativeObj$NativeBitmapMgr$Action[Action.evalWeexJS.ordinal()] = 7;
} catch (NoSuchFieldError unused7) {
}
try {
$SwitchMap$io$dcloud$feature$nativeObj$NativeBitmapMgr$Action[Action.drawRichText.ordinal()] = 8;
} catch (NoSuchFieldError unused8) {
}
try {
$SwitchMap$io$dcloud$feature$nativeObj$NativeBitmapMgr$Action[Action.drawBitmap.ordinal()] = 9;
} catch (NoSuchFieldError unused9) {
}
try {
$SwitchMap$io$dcloud$feature$nativeObj$NativeBitmapMgr$Action[Action.drawText.ordinal()] = 10;
} catch (NoSuchFieldError unused10) {
}
try {
$SwitchMap$io$dcloud$feature$nativeObj$NativeBitmapMgr$Action[Action.drawInput.ordinal()] = 11;
} catch (NoSuchFieldError unused11) {
}
try {
$SwitchMap$io$dcloud$feature$nativeObj$NativeBitmapMgr$Action[Action.getInputValueById.ordinal()] = 12;
} catch (NoSuchFieldError unused12) {
}
try {
$SwitchMap$io$dcloud$feature$nativeObj$NativeBitmapMgr$Action[Action.getInputFocusById.ordinal()] = 13;
} catch (NoSuchFieldError unused13) {
}
try {
$SwitchMap$io$dcloud$feature$nativeObj$NativeBitmapMgr$Action[Action.setInputFocusById.ordinal()] = 14;
} catch (NoSuchFieldError unused14) {
}
try {
$SwitchMap$io$dcloud$feature$nativeObj$NativeBitmapMgr$Action[Action.show.ordinal()] = 15;
} catch (NoSuchFieldError unused15) {
}
try {
$SwitchMap$io$dcloud$feature$nativeObj$NativeBitmapMgr$Action[Action.hide.ordinal()] = 16;
} catch (NoSuchFieldError unused16) {
}
try {
$SwitchMap$io$dcloud$feature$nativeObj$NativeBitmapMgr$Action[Action.view_close.ordinal()] = 17;
} catch (NoSuchFieldError unused17) {
}
try {
$SwitchMap$io$dcloud$feature$nativeObj$NativeBitmapMgr$Action[Action.view_animate.ordinal()] = 18;
} catch (NoSuchFieldError unused18) {
}
try {
$SwitchMap$io$dcloud$feature$nativeObj$NativeBitmapMgr$Action[Action.view_reset.ordinal()] = 19;
} catch (NoSuchFieldError unused19) {
}
try {
$SwitchMap$io$dcloud$feature$nativeObj$NativeBitmapMgr$Action[Action.view_restore.ordinal()] = 20;
} catch (NoSuchFieldError unused20) {
}
try {
$SwitchMap$io$dcloud$feature$nativeObj$NativeBitmapMgr$Action[Action.view_drawRect.ordinal()] = 21;
} catch (NoSuchFieldError unused21) {
}
try {
$SwitchMap$io$dcloud$feature$nativeObj$NativeBitmapMgr$Action[Action.isVisible.ordinal()] = 22;
} catch (NoSuchFieldError unused22) {
}
try {
$SwitchMap$io$dcloud$feature$nativeObj$NativeBitmapMgr$Action[Action.Bitmap.ordinal()] = 23;
} catch (NoSuchFieldError unused23) {
}
try {
$SwitchMap$io$dcloud$feature$nativeObj$NativeBitmapMgr$Action[Action.getItems.ordinal()] = 24;
} catch (NoSuchFieldError unused24) {
}
try {
$SwitchMap$io$dcloud$feature$nativeObj$NativeBitmapMgr$Action[Action.getBitmapById.ordinal()] = 25;
} catch (NoSuchFieldError unused25) {
}
try {
$SwitchMap$io$dcloud$feature$nativeObj$NativeBitmapMgr$Action[Action.clear.ordinal()] = 26;
} catch (NoSuchFieldError unused26) {
}
try {
$SwitchMap$io$dcloud$feature$nativeObj$NativeBitmapMgr$Action[Action.bitmapRecycle.ordinal()] = 27;
} catch (NoSuchFieldError unused27) {
}
try {
$SwitchMap$io$dcloud$feature$nativeObj$NativeBitmapMgr$Action[Action.load.ordinal()] = 28;
} catch (NoSuchFieldError unused28) {
}
try {
$SwitchMap$io$dcloud$feature$nativeObj$NativeBitmapMgr$Action[Action.loadBase64Data.ordinal()] = 29;
} catch (NoSuchFieldError unused29) {
}
try {
$SwitchMap$io$dcloud$feature$nativeObj$NativeBitmapMgr$Action[Action.save.ordinal()] = 30;
} catch (NoSuchFieldError unused30) {
}
try {
$SwitchMap$io$dcloud$feature$nativeObj$NativeBitmapMgr$Action[Action.toBase64Data.ordinal()] = 31;
} catch (NoSuchFieldError unused31) {
}
try {
$SwitchMap$io$dcloud$feature$nativeObj$NativeBitmapMgr$Action[Action.startAnimation.ordinal()] = 32;
} catch (NoSuchFieldError unused32) {
}
try {
$SwitchMap$io$dcloud$feature$nativeObj$NativeBitmapMgr$Action[Action.clearAnimation.ordinal()] = 33;
} catch (NoSuchFieldError unused33) {
}
try {
$SwitchMap$io$dcloud$feature$nativeObj$NativeBitmapMgr$Action[Action.view_clearRect.ordinal()] = 34;
} catch (NoSuchFieldError unused34) {
}
try {
$SwitchMap$io$dcloud$feature$nativeObj$NativeBitmapMgr$Action[Action.view_draw.ordinal()] = 35;
} catch (NoSuchFieldError unused35) {
}
try {
$SwitchMap$io$dcloud$feature$nativeObj$NativeBitmapMgr$Action[Action.setImages.ordinal()] = 36;
} catch (NoSuchFieldError unused36) {
}
try {
$SwitchMap$io$dcloud$feature$nativeObj$NativeBitmapMgr$Action[Action.addImages.ordinal()] = 37;
} catch (NoSuchFieldError unused37) {
}
try {
$SwitchMap$io$dcloud$feature$nativeObj$NativeBitmapMgr$Action[Action.currentImageIndex.ordinal()] = 38;
} catch (NoSuchFieldError unused38) {
}
}
}
protected enum Action {
Bitmap,
getItems,
getBitmapById,
clear,
load,
loadBase64Data,
save,
toBase64Data,
View,
startAnimation,
clearAnimation,
getViewById,
drawBitmap,
drawText,
evalWeexJS,
drawRichText,
show,
hide,
setImages,
addImages,
view_animate,
view_reset,
view_restore,
view_drawRect,
isVisible,
addEventListener,
interceptTouchEvent,
setTouchEventRect,
bitmapRecycle,
setStyle,
view_clearRect,
view_draw,
view_close,
currentImageIndex,
drawInput,
getInputValueById,
getInputFocusById,
setInputFocusById
}
private void createBitmap(IApp iApp, String str, String str2, String str3) {
if (TextUtils.isEmpty(str2)) {
str2 = "" + System.currentTimeMillis();
}
if (this.mSnaps.containsKey(str)) {
return;
}
this.mSnaps.put(str, new NativeBitmap(iApp, str2, str, str3));
this.mIds.put(str2, str);
}
private NativeView getNativeView(String str, String str2) {
NativeView nativeView = this.mNativeViews.get(str2);
if (nativeView != null || TextUtils.isEmpty(str)) {
return nativeView;
}
for (NativeView nativeView2 : this.mNativeViews.values()) {
if (TextUtils.equals(nativeView2.mID, str)) {
return nativeView2;
}
}
return nativeView;
}
private void load(final IWebview iWebview, NativeBitmap nativeBitmap, String str, final String str2) {
nativeBitmap.load(iWebview, iWebview.obtainFrameView().obtainMainView().getContext(), str, TextUtils.isEmpty(str2) ? null : new ICallBack() {
@Override
public Object onCallBack(int i, Object obj) {
Deprecated_JSUtil.execCallback(iWebview, str2, null, JSUtil.OK, false, false);
return null;
}
}, TextUtils.isEmpty(str2) ? null : new ICallBack() {
@Override
public Object onCallBack(int i, Object obj) {
String string = obj == null ? iWebview.getContext().getString(R.string.dcloud_native_obj_load_failed) : obj.toString();
IWebview iWebview2 = iWebview;
String str3 = str2;
Deprecated_JSUtil.execCallback(iWebview2, str3, "{\"code\":-100,\"message\":\"" + string + "\"}", JSUtil.ERROR, true, false);
return null;
}
});
}
private void loadBase64Data(final IWebview iWebview, NativeBitmap nativeBitmap, String str, final String str2) {
nativeBitmap.loadBase64Data(str, TextUtils.isEmpty(str2) ? null : new ICallBack() {
@Override
public Object onCallBack(int i, Object obj) {
Deprecated_JSUtil.execCallback(iWebview, str2, null, JSUtil.OK, false, false);
return null;
}
}, TextUtils.isEmpty(str2) ? null : new ICallBack() {
@Override
public Object onCallBack(int i, Object obj) {
IWebview iWebview2 = iWebview;
String str3 = str2;
Deprecated_JSUtil.execCallback(iWebview2, str3, "{\"code\":-100,\"message\":\"" + iWebview.getContext().getString(R.string.dcloud_native_obj_load_failed) + "\"}", JSUtil.ERROR, true, false);
return null;
}
});
}
private void save(final IWebview iWebview, NativeBitmap nativeBitmap, String str, JSONObject jSONObject, final String str2) {
nativeBitmap.save(iWebview.obtainFrameView().obtainApp(), str, new NativeBitmapSaveOptions(jSONObject.toString()), iWebview.getScale(), TextUtils.isEmpty(str2) ? null : new ICallBack() {
@Override
public Object onCallBack(int i, Object obj) {
String str3;
if (obj == null || !(obj instanceof NativeBitmapSaveOptions)) {
str3 = null;
} else {
NativeBitmapSaveOptions nativeBitmapSaveOptions = (NativeBitmapSaveOptions) obj;
str3 = StringUtil.format("{path:'file://%s', w:%d, h:%d, size:%d}", nativeBitmapSaveOptions.path, Integer.valueOf(nativeBitmapSaveOptions.width), Integer.valueOf(nativeBitmapSaveOptions.height), Long.valueOf(nativeBitmapSaveOptions.size));
}
Deprecated_JSUtil.execCallback(iWebview, str2, str3, JSUtil.OK, true, false);
return null;
}
}, TextUtils.isEmpty(str2) ? null : new ICallBack() {
@Override
public Object onCallBack(int i, Object obj) {
Deprecated_JSUtil.execCallback(iWebview, str2, "{\"code\":-100,\"message\":\"\"+webview.getContext().getString(R.string.dcloud_native_obj_load_failed)+\"\"}", JSUtil.ERROR, true, false);
return null;
}
});
}
public void destroy() {
try {
for (INativeBitmap iNativeBitmap : this.mSnaps.values()) {
try {
iNativeBitmap.clear();
} catch (Exception e) {
e.printStackTrace();
}
}
this.mIds.clear();
this.mSnaps.clear();
for (NativeView nativeView : this.mNativeViews.values()) {
if (nativeView != null) {
nativeView.clearNativeViewData();
}
}
this.mNativeViews.clear();
NativeTypefaceFactory.clearCache();
System.gc();
} catch (Exception e2) {
e2.printStackTrace();
}
}
public void destroyNativeView(NativeView nativeView) {
NativeView nativeView2 = this.mNativeViews.get(nativeView.mUUID);
nativeView.clearNativeViewData();
if (nativeView2 == nativeView) {
this.mNativeViews.remove(nativeView.mUUID);
} else {
this.mNativeViews.remove(nativeView.mID);
}
}
public Object doForFeature(String str, Object obj) {
NativeView nativeView;
NativeView nativeView2;
NativeView nativeView3 = null;
if ("addNativeView".equals(str)) {
Object[] objArr = (Object[]) obj;
IFrameView iFrameView = (IFrameView) objArr[0];
String str2 = (String) objArr[1];
NativeView nativeView4 = getNativeView(str2, str2);
Logger.d("adadad", "addNativeView outter" + nativeView4);
if (nativeView4 != null) {
Logger.d("adadad", "addNativeView inner" + iFrameView);
nativeView4.attachToViewGroup(iFrameView);
}
} else if ("removeNativeView".equals(str)) {
String str3 = (String) ((Object[]) obj)[1];
NativeView nativeView5 = getNativeView(str3, str3);
if (nativeView5 != null) {
nativeView5.removeFromViewGroup();
}
} else if ("getNativeView".equals(str)) {
try {
Object[] objArr2 = (Object[]) obj;
IFrameView iFrameView2 = (IFrameView) objArr2[0];
String str4 = (String) objArr2[1];
nativeView3 = getNativeView(str4, str4);
} catch (Exception e) {
e.printStackTrace();
}
} else if ("makeRichText".equals(str)) {
return RichTextLayout.makeRichText((Object[]) obj);
} else {
if ("View".equals(str)) {
try {
Object[] objArr3 = (Object[]) obj;
IFrameView iFrameView3 = (IFrameView) objArr3[0];
IWebview iWebview = (IWebview) objArr3[1];
String str5 = (String) objArr3[2];
String str6 = (String) objArr3[3];
JSONObject jSONObject = (JSONObject) objArr3[4];
if (jSONObject == null) {
jSONObject = new JSONObject();
}
JSONObject jSONObject2 = jSONObject;
JSONArray jSONArray = objArr3.length > 5 ? (JSONArray) objArr3[5] : null;
String str7 = objArr3.length > 6 ? (String) objArr3[6] : AbsoluteConst.NATIVE_NVIEW;
if (!this.mNativeViews.containsKey(str6)) {
if (str7.equals(AbsoluteConst.NATIVE_IMAGESLIDER)) {
nativeView = new NativeImageSlider(iWebview.getContext(), iWebview, str6, str5, jSONObject2);
} else if (AbsoluteConst.NATIVE_TITLE_N_VIEW.equals(str7)) {
nativeView = new TitleNView(iWebview.getContext(), iWebview, str6, str5, jSONObject2);
} else {
nativeView = new NativeView(iWebview.getContext(), iWebview, str6, str5, jSONObject2);
}
this.mNativeViews.put(nativeView.mUUID, nativeView);
initViewDrawItme(iWebview, nativeView, jSONArray);
return nativeView;
}
} catch (Exception e2) {
e2.printStackTrace();
}
} else if ("updateSubNViews".equals(str)) {
Object[] objArr4 = (Object[]) obj;
IWebview iWebview2 = (IWebview) objArr4[1];
JSONArray jSONArray2 = (JSONArray) objArr4[2];
AdaFrameView adaFrameView = (AdaFrameView) iWebview2.obtainFrameView();
for (int i = 0; i < jSONArray2.length(); i++) {
try {
JSONObject jSONObject3 = jSONArray2.getJSONObject(i);
String optString = jSONObject3.optString("id");
if (!PdrUtil.isEmpty(optString)) {
Iterator<INativeView> it = adaFrameView.mChildNativeViewList.iterator();
while (true) {
if (!it.hasNext()) {
nativeView2 = null;
break;
}
INativeView next = it.next();
if (optString.equals(next.getViewId())) {
nativeView2 = (NativeView) next;
break;
}
}
if (nativeView2 != null) {
JSONArray optJSONArray = jSONObject3.optJSONArray("tags");
nativeView2.setStyle(jSONObject3.optJSONObject("styles"), optJSONArray == null);
initViewDrawItme(iWebview2, nativeView2, optJSONArray);
}
}
} catch (JSONException e3) {
e3.printStackTrace();
}
}
}
}
return nativeView3;
}
public String execute(IWebview iWebview, String str, String[] strArr) {
Action action;
String str2;
JSONObject jSONObject;
JSONArray jSONArray;
NativeView nativeView;
JSONObject jSONObject2;
String wrapJsVar;
JSONObject jSONObject3;
JSONObject jSONObject4;
NativeBitmap srcNativeBitmap;
JSONObject jSONObject5;
JSONObject jSONObject6;
JSONObject jSONObject7;
JSONObject jSONObject8;
JSONObject jSONObject9;
JSONObject jSONObject10;
String str3;
JSONObject jSONObject11;
String str4;
int stringToColor;
String str5;
String optString;
Object bitmapByUuid;
NativeView nativeView2;
String str6;
try {
IApp obtainApp = iWebview.obtainFrameView().obtainApp();
if (obtainApp == null) {
return null;
}
obtainApp.obtainAppId();
try {
action = Action.valueOf(str);
} catch (Exception unused) {
action = null;
}
boolean z = true;
int i = 0;
try {
try {
try {
try {
} catch (Exception e) {
e = e;
r6 = str2;
Logger.e("NativeBitmapMgr", e.toString());
e.printStackTrace();
return r6;
}
} catch (JSONException | Exception unused2) {
}
} catch (Exception e2) {
e = e2;
}
} catch (Exception unused3) {
}
switch (AnonymousClass7.$SwitchMap$io$dcloud$feature$nativeObj$NativeBitmapMgr$Action[action.ordinal()]) {
case 1:
str2 = null;
String str7 = strArr[0];
String str8 = strArr[1];
String str9 = strArr.length > 4 ? strArr[4] : AbsoluteConst.NATIVE_NVIEW;
try {
jSONObject = new JSONObject(strArr[2]);
} catch (JSONException unused4) {
jSONObject = new JSONObject();
}
JSONObject jSONObject12 = jSONObject;
if (strArr.length > 3) {
try {
jSONArray = new JSONArray(strArr[3]);
} catch (JSONException unused5) {
}
if (!this.mNativeViews.containsKey(str8)) {
if (str9.equals(AbsoluteConst.NATIVE_IMAGESLIDER)) {
nativeView = new NativeImageSlider(iWebview.getContext(), iWebview, str8, str7, jSONObject12);
} else {
nativeView = new NativeView(iWebview.getContext(), iWebview, str8, str7, jSONObject12);
}
initViewDrawItme(iWebview, nativeView, jSONArray);
this.mNativeViews.put(nativeView.mUUID, nativeView);
}
return str2;
}
jSONArray = null;
if (!this.mNativeViews.containsKey(str8)) {
}
return str2;
case 2:
str2 = null;
String str10 = strArr[0];
String str11 = strArr[1];
try {
jSONObject2 = new JSONObject(strArr[2]);
} catch (JSONException unused6) {
jSONObject2 = new JSONObject();
}
NativeView nativeView3 = getNativeView(str10, str11);
if (nativeView3 != null) {
nativeView3.setStyle(jSONObject2, true);
}
return str2;
case 3:
str2 = null;
NativeView nativeView4 = getNativeView(strArr[0], strArr[1]);
if (nativeView4 != null) {
nativeView4.addEventListener(strArr[2], iWebview, strArr[3]);
}
return str2;
case 4:
str2 = null;
NativeView nativeView5 = getNativeView(strArr[0], strArr[1]);
if (nativeView5 != null) {
nativeView5.interceptTouchEvent(PdrUtil.parseBoolean(strArr[2], true, false));
}
return str2;
case 5:
str2 = null;
NativeView nativeView6 = getNativeView(strArr[0], strArr[1]);
if (nativeView6 != null) {
String str12 = strArr[2];
if (!TextUtils.isEmpty(str12) && !str12.equals("null")) {
nativeView6.setTouchEventRect(str12);
}
}
return str2;
case 6:
str2 = null;
NativeView nativeView7 = getNativeView(strArr[0], strArr.length > 1 ? strArr[1] : null);
if (nativeView7 != null) {
wrapJsVar = JSUtil.wrapJsVar(nativeView7.toJSON());
return wrapJsVar;
}
return str2;
case 7:
str2 = null;
String str13 = strArr[0];
String str14 = strArr[1];
iWebview.obtainFrameView().obtainWindowMgr().processEvent(IMgr.MgrType.FeatureMgr, 10, new Object[]{iWebview.obtainApp(), "weex,io.dcloud.feature.weex.WeexFeature", "evalWeexJS", new Object[]{iWebview, strArr[2], strArr[3], strArr[4]}});
return str2;
case 8:
str2 = null;
NativeView nativeView8 = getNativeView(strArr[0], strArr[1]);
String str15 = strArr[2];
if (nativeView8 != null && !TextUtils.isEmpty(str15)) {
try {
jSONObject3 = new JSONObject(strArr[3]);
} catch (JSONException unused7) {
jSONObject3 = new JSONObject();
}
JSONObject jSONObject13 = jSONObject3;
try {
jSONObject4 = new JSONObject(strArr[4]);
} catch (JSONException unused8) {
jSONObject4 = new JSONObject();
}
nativeView8.makeRichText(iWebview, str15, jSONObject13, jSONObject4, strArr[5]);
}
return str2;
case 9:
str2 = null;
NativeView nativeView9 = getNativeView(strArr[0], strArr[1]);
if (nativeView9 != null && (srcNativeBitmap = getSrcNativeBitmap(iWebview, obtainApp, strArr[2])) != null && srcNativeBitmap.getBitmap() != null) {
try {
jSONObject5 = new JSONObject(strArr[3]);
} catch (JSONException unused9) {
jSONObject5 = new JSONObject();
}
JSONObject jSONObject14 = jSONObject5;
try {
jSONObject6 = new JSONObject(strArr[4]);
} catch (JSONException unused10) {
jSONObject6 = new JSONObject();
}
nativeView9.makeOverlay(iWebview, srcNativeBitmap, null, -1, jSONObject14, jSONObject6, null, strArr[5], WXBasicComponentType.IMG, true);
}
return str2;
case 10:
str2 = null;
NativeView nativeView10 = getNativeView(strArr[0], strArr[1]);
String str16 = strArr[2];
if (nativeView10 != null && str16 != null) {
try {
jSONObject7 = new JSONObject(strArr[3]);
} catch (JSONException unused11) {
jSONObject7 = new JSONObject();
}
JSONObject jSONObject15 = jSONObject7;
try {
jSONObject8 = new JSONObject(strArr[4]);
} catch (JSONException unused12) {
jSONObject8 = new JSONObject();
}
nativeView10.makeOverlay(iWebview, null, str16, -1, null, jSONObject15, jSONObject8, strArr[5], AbsURIAdapter.FONT, !AbsoluteConst.FALSE.equals(strArr[6]));
}
return str2;
case 11:
str2 = null;
NativeView nativeView11 = getNativeView(strArr[0], strArr[1]);
if (nativeView11 != null) {
try {
jSONObject9 = new JSONObject(strArr[2]);
} catch (JSONException unused13) {
jSONObject9 = new JSONObject();
}
JSONObject jSONObject16 = jSONObject9;
try {
jSONObject10 = new JSONObject(strArr[3]);
} catch (JSONException unused14) {
jSONObject10 = new JSONObject();
}
JSONObject jSONObject17 = jSONObject10;
try {
str3 = strArr[4];
} catch (Exception unused15) {
str3 = null;
}
nativeView11.makeOverlay(iWebview, null, null, -1, null, jSONObject16, jSONObject17, str3, "input", true);
}
return str2;
case 12:
str2 = null;
NativeView nativeView12 = getNativeView(strArr[0], strArr[1]);
String str17 = strArr[2];
if (nativeView12 != null) {
wrapJsVar = Deprecated_JSUtil.wrapJsVar(nativeView12.getInputValueById(str17), true);
return wrapJsVar;
}
return str2;
case 13:
str2 = null;
NativeView nativeView13 = getNativeView(strArr[0], strArr[1]);
String str18 = strArr[2];
if (nativeView13 != null) {
wrapJsVar = Deprecated_JSUtil.wrapJsVar(String.valueOf(nativeView13.getInputFocusById(str18)), false);
return wrapJsVar;
}
return str2;
case 14:
str2 = null;
NativeView nativeView14 = getNativeView(strArr[0], strArr[1]);
String str19 = strArr[2];
boolean booleanValue = 4 <= strArr.length ? Boolean.valueOf(strArr[3]).booleanValue() : false;
if (nativeView14 != null) {
nativeView14.setInputFocusById(str19, booleanValue);
}
return str2;
case 15:
str2 = null;
NativeView nativeView15 = getNativeView(strArr[0], strArr[1]);
if (nativeView15 != null) {
nativeView15.setVisibility(0);
ViewGroup viewGroup = (ViewGroup) iWebview.obtainApp().obtainWebAppRootView().obtainMainView().getParent();
if (nativeView15.getParent() == null) {
nativeView15.mShow = true;
int childCount = viewGroup.getChildCount();
while (true) {
if (i < childCount) {
if (viewGroup.getChildAt(i) instanceof ISplash) {
childCount = i;
} else {
i++;
}
}
}
viewGroup.addView(nativeView15, childCount);
}
}
return str2;
case 16:
str2 = null;
NativeView nativeView16 = getNativeView(strArr[0], strArr[1]);
if (nativeView16 != null) {
nativeView16.setVisibility(4);
ViewGroup viewGroup2 = (ViewGroup) nativeView16.getParent();
if (viewGroup2 != null && (viewGroup2 instanceof DHImageView)) {
DHImageView dHImageView = (DHImageView) viewGroup2;
dHImageView.clear();
dHImageView.setVisibility(4);
}
}
return str2;
case 17:
str2 = null;
String str20 = strArr[0];
String str21 = strArr[1];
NativeView nativeView17 = getNativeView(str20, str21);
if (nativeView17 != null) {
this.mNativeViews.remove(str21);
nativeView17.removeFromViewGroup();
}
return str2;
case 18:
str2 = null;
NativeView nativeView18 = getNativeView(strArr[0], strArr[1]);
if (nativeView18 != null) {
nativeView18.StartAnimate(iWebview, strArr[2], strArr[3]);
}
return str2;
case 19:
str2 = null;
NativeView nativeView19 = getNativeView(strArr[0], strArr[1]);
if (nativeView19 != null) {
nativeView19.resetNativeView();
}
return str2;
case 20:
str2 = null;
NativeView nativeView20 = getNativeView(strArr[0], strArr[1]);
if (nativeView20 != null) {
nativeView20.clearAnimate();
}
return str2;
case 21:
str2 = null;
NativeView nativeView21 = getNativeView(strArr[0], strArr[1]);
if (nativeView21 != null) {
boolean isEmpty = PdrUtil.isEmpty(strArr[2]);
String str22 = TitleNViewUtil.TRANSPARENT_BUTTON_TEXT_COLOR;
if (isEmpty) {
jSONObject11 = null;
} else {
try {
jSONObject11 = new JSONObject(strArr[2]);
try {
} catch (JSONException e3) {
e = e3;
e.printStackTrace();
str4 = strArr[2];
str22 = str4;
String str23 = strArr[3];
if (TextUtils.isEmpty(str23)) {
}
String str24 = strArr[4];
stringToColor = Color.parseColor(str22);
nativeView21.makeOverlay(iWebview, null, null, stringToColor, null, r14, jSONObject11, str24, "rect", !AbsoluteConst.FALSE.equals(strArr[5]));
return str2;
}
} catch (JSONException e4) {
e = e4;
jSONObject11 = null;
}
if (jSONObject11.has("color")) {
str4 = jSONObject11.optString("color");
str22 = str4;
}
}
String str232 = strArr[3];
JSONObject jSONObject18 = (!TextUtils.isEmpty(str232) || str232.equals("null")) ? null : new JSONObject(str232);
String str242 = strArr[4];
try {
stringToColor = Color.parseColor(str22);
} catch (Exception unused16) {
stringToColor = PdrUtil.stringToColor(str22);
}
nativeView21.makeOverlay(iWebview, null, null, stringToColor, null, jSONObject18, jSONObject11, str242, "rect", !AbsoluteConst.FALSE.equals(strArr[5]));
}
return str2;
case 22:
NativeView nativeView22 = getNativeView(strArr[0], strArr[1]);
if (nativeView22 != null && nativeView22.getParent() != null) {
if (nativeView22.getVisibility() != 0) {
z = false;
}
wrapJsVar = Deprecated_JSUtil.wrapJsVar(String.valueOf(z), false);
} else {
wrapJsVar = Deprecated_JSUtil.wrapJsVar(String.valueOf(false), false);
}
return wrapJsVar;
case 23:
str2 = null;
if (strArr.length > 2) {
str5 = strArr[2];
if (!PdrUtil.isNetPath(str5)) {
if (!TextUtils.isEmpty(str5) && !str5.equals("null")) {
str5 = obtainApp.convert2AbsFullPath(iWebview.obtainFullUrl(), str5);
}
}
createBitmap(obtainApp, strArr[0], strArr[1], str5);
return str2;
}
str5 = null;
createBitmap(obtainApp, strArr[0], strArr[1], str5);
return str2;
case 24:
String jSONArray2 = getItems().toString();
try {
wrapJsVar = Deprecated_JSUtil.wrapJsVar(jSONArray2, false);
return wrapJsVar;
} catch (Exception e5) {
e = e5;
r6 = jSONArray2;
Logger.e("NativeBitmapMgr", e.toString());
e.printStackTrace();
return r6;
}
case 25:
NativeBitmap nativeBitmap = (NativeBitmap) getBitmapById(strArr[0]);
wrapJsVar = Deprecated_JSUtil.wrapJsVar(nativeBitmap != null ? nativeBitmap.toJsString() : null, false);
return wrapJsVar;
case 26:
str2 = null;
NativeBitmap nativeBitmap2 = (NativeBitmap) getBitmapByUuid(strArr[0]);
this.mSnaps.remove(this.mIds.get(nativeBitmap2.getId()));
this.mIds.remove(nativeBitmap2.getId());
nativeBitmap2.clear();
return str2;
case 27:
str2 = null;
NativeBitmap nativeBitmap3 = (NativeBitmap) getBitmapByUuid(strArr[0]);
if (nativeBitmap3 != null) {
nativeBitmap3.recycle();
}
return str2;
case 28:
str2 = null;
NativeBitmap nativeBitmap4 = (NativeBitmap) getBitmapByUuid(strArr[0]);
String str25 = strArr[1];
String str26 = strArr[2];
if (nativeBitmap4 != null) {
load(iWebview, nativeBitmap4, str25, str26);
}
return str2;
case 29:
str2 = null;
NativeBitmap nativeBitmap5 = (NativeBitmap) getBitmapByUuid(strArr[0]);
String str27 = strArr[1];
String str28 = strArr[2];
if (nativeBitmap5 != null) {
loadBase64Data(iWebview, nativeBitmap5, str27, str28);
}
return str2;
case 30:
NativeBitmap nativeBitmap6 = (NativeBitmap) getBitmapByUuid(strArr[0]);
String str29 = strArr[1];
JSONObject jSONObject19 = new JSONObject(strArr[2]);
String str30 = strArr[3];
String convert2AbsFullPath = obtainApp.convert2AbsFullPath(iWebview.obtainFullUrl(), str29);
if (nativeBitmap6 != null) {
str2 = null;
save(iWebview, nativeBitmap6, convert2AbsFullPath, jSONObject19, str30);
return str2;
}
str2 = null;
return str2;
case 31:
NativeBitmap nativeBitmap7 = (NativeBitmap) getBitmapByUuid(strArr[0]);
wrapJsVar = Deprecated_JSUtil.wrapJsVar(nativeBitmap7 != null ? nativeBitmap7.toBase64Data() : null, true);
return wrapJsVar;
case 32:
String str31 = strArr[0];
String str32 = strArr[1];
String str33 = strArr.length > 2 ? strArr[2] : null;
String str34 = strArr.length > 3 ? strArr[3] : null;
JSONObject jSONObject20 = new JSONObject(str32);
String optString2 = jSONObject20.optString("viewId", null);
if (!TextUtils.isEmpty(optString2)) {
if (this.mNativeViews.containsKey(optString2)) {
bitmapByUuid = this.mNativeViews.get(optString2);
this.mNativeViews.get(optString2).mShow = true;
optString = null;
} else {
optString = null;
bitmapByUuid = null;
}
} else {
optString = jSONObject20.optString("texts", null);
bitmapByUuid = getBitmapByUuid(jSONObject20.optString("uuid", null));
}
if (TextUtils.isEmpty(str33) || str33.equals("null")) {
nativeView2 = null;
str6 = null;
} else {
JSONObject jSONObject21 = new JSONObject(str33);
String optString3 = jSONObject21.optString("viewId", null);
if (!TextUtils.isEmpty(optString3)) {
NativeView nativeView23 = this.mNativeViews.get(optString3);
this.mNativeViews.get(optString3).mShow = true;
nativeView2 = nativeView23;
str6 = null;
} else {
str6 = jSONObject21.optString("texts", null);
nativeView2 = getBitmapByUuid(jSONObject21.optString("uuid", null));
}
}
FrameSwitchView frameSwitchView = FrameSwitchView.getInstance(obtainApp.getActivity());
if (!frameSwitchView.isInit()) {
frameSwitchView.initView();
}
frameSwitchView.startAnimation(iWebview, str31, bitmapByUuid, optString, nativeView2, str6, str34);
str2 = null;
return str2;
case 33:
FrameSwitchView frameSwitchView2 = FrameSwitchView.getInstance(obtainApp.getActivity());
if (!frameSwitchView2.isInit()) {
frameSwitchView2.initView();
}
frameSwitchView2.clearSwitchAnimation(strArr[0]);
str2 = null;
return str2;
case 34:
NativeView nativeView24 = getNativeView(strArr[0], strArr[1]);
if (nativeView24 != null) {
String str35 = strArr[2];
nativeView24.makeOverlay(iWebview, null, null, -1, null, (TextUtils.isEmpty(str35) || str35.equals("null")) ? null : new JSONObject(str35), null, strArr[3], "clear", false, true);
}
str2 = null;
return str2;
case 35:
NativeView nativeView25 = getNativeView(strArr[0], strArr[1]);
if (nativeView25 != null) {
initViewDrawItme(iWebview, nativeView25, new JSONArray(strArr[2]));
}
str2 = null;
return str2;
case 36:
String str36 = strArr[0];
String str37 = strArr[1];
String str38 = strArr[2];
NativeView nativeView26 = getNativeView(str36, str37);
if (!PdrUtil.isEmpty(str38) && nativeView26 != null && nativeView26.getViewType().equals(AbsoluteConst.NATIVE_IMAGESLIDER)) {
((NativeImageSlider) nativeView26).setImages(iWebview, new JSONArray(str38));
}
str2 = null;
return str2;
case 37:
String str39 = strArr[0];
String str40 = strArr[1];
String str41 = strArr[2];
NativeView nativeView27 = getNativeView(str39, str40);
if (!PdrUtil.isEmpty(str41) && nativeView27 != null && nativeView27.getViewType().equals(AbsoluteConst.NATIVE_IMAGESLIDER)) {
((NativeImageSlider) nativeView27).addImages(iWebview, new JSONArray(str41));
}
str2 = null;
return str2;
case 38:
NativeView nativeView28 = getNativeView(strArr[0], strArr[1]);
if (nativeView28 != null && nativeView28.getViewType().equals(AbsoluteConst.NATIVE_IMAGESLIDER)) {
wrapJsVar = String.valueOf(((NativeImageSlider) nativeView28).getCurrentImageIndex());
return wrapJsVar;
}
str2 = null;
return str2;
default:
str2 = null;
return str2;
}
} catch (Exception e6) {
e = e6;
}
}
public INativeBitmap getBitmapById(String str) {
return getBitmapByUuid(this.mIds.get(str));
}
public INativeBitmap getBitmapByUuid(String str) {
return this.mSnaps.get(str);
}
public JSONArray getItems() {
JSONArray jSONArray = new JSONArray();
for (Map.Entry<String, INativeBitmap> entry : this.mSnaps.entrySet()) {
try {
jSONArray.put(new JSONObject(((NativeBitmap) entry.getValue()).toJsString()));
} catch (Exception unused) {
}
}
return jSONArray;
}
public NativeBitmap getSrcNativeBitmap(IWebview iWebview, IApp iApp, String str) {
JSONObject jSONObject;
try {
jSONObject = new JSONObject(str);
} catch (JSONException unused) {
jSONObject = null;
}
if (jSONObject != null) {
return (NativeBitmap) getBitmapById(jSONObject.optString("id"));
}
if (!PdrUtil.isNetPath(str)) {
str = (TextUtils.isEmpty(str) || str.equals("null")) ? null : iApp.convert2AbsFullPath(iWebview.obtainFullUrl(), str);
}
if (PdrUtil.isEmpty(str)) {
return null;
}
String str2 = iApp.obtainAppId() + str.hashCode();
return new NativeBitmap(iApp, str2, str2, str);
}
protected void initViewDrawItme(IWebview iWebview, NativeView nativeView, JSONArray jSONArray) {
JSONObject jSONObject;
String optString;
String optString2;
int i;
String str;
String str2;
String str3;
String str4;
JSONObject jSONObject2;
JSONObject jSONObject3;
JSONObject jSONObject4;
int stringToColor;
JSONObject jSONObject5;
JSONObject jSONObject6;
JSONObject jSONObject7;
JSONObject jSONObject8;
JSONArray jSONArray2 = jSONArray;
String str5 = "rectStyles";
String str6 = "id";
String str7 = "color";
if (jSONArray2 == null || nativeView == null) {
return;
}
int i2 = 0;
while (i2 < jSONArray.length()) {
try {
jSONObject = jSONArray2.getJSONObject(i2);
optString = jSONObject.has(str6) ? jSONObject.optString(str6) : null;
optString2 = jSONObject.optString("tag");
} catch (Exception e) {
e.printStackTrace();
return;
}
if (optString2.equals(WXBasicComponentType.IMG)) {
NativeBitmap srcNativeBitmap = getSrcNativeBitmap(iWebview, iWebview.obtainApp(), jSONObject.optString("src"));
try {
jSONObject7 = new JSONObject(jSONObject.optString("sprite"));
} catch (JSONException unused) {
jSONObject7 = new JSONObject();
}
JSONObject jSONObject9 = jSONObject7;
try {
jSONObject8 = new JSONObject(jSONObject.optString("position"));
} catch (JSONException unused2) {
jSONObject8 = new JSONObject();
}
i = i2;
str = str7;
str2 = str6;
str3 = str5;
nativeView.makeOverlay(iWebview, srcNativeBitmap, null, -1, jSONObject9, jSONObject8, null, optString, WXBasicComponentType.IMG, false, true);
str4 = str;
} else {
String str8 = optString;
i = i2;
str = str7;
str2 = str6;
str3 = str5;
if (optString2.equals(AbsURIAdapter.FONT)) {
String optString3 = jSONObject.optString("text");
if (optString3 != null) {
try {
jSONObject5 = new JSONObject(jSONObject.optString("position"));
} catch (JSONException unused3) {
jSONObject5 = new JSONObject();
}
JSONObject jSONObject10 = jSONObject5;
try {
jSONObject6 = new JSONObject(jSONObject.optString("textStyles"));
} catch (JSONException unused4) {
jSONObject6 = new JSONObject();
}
nativeView.makeOverlay(iWebview, null, optString3, -1, null, jSONObject10, jSONObject6, str8, AbsURIAdapter.FONT, false, true);
}
str4 = str;
} else if (optString2.equals("rect")) {
String optString4 = jSONObject.has(str) ? jSONObject.optString(str) : TitleNViewUtil.TRANSPARENT_BUTTON_TEXT_COLOR;
String optString5 = jSONObject.optString("position");
JSONObject jSONObject11 = (TextUtils.isEmpty(optString5) || optString5.equals("null")) ? null : new JSONObject(optString5);
if (jSONObject.has(str3)) {
JSONObject optJSONObject = jSONObject.optJSONObject(str3);
if (optJSONObject.has(str)) {
optString4 = optJSONObject.optString(str);
}
jSONObject4 = optJSONObject;
} else {
jSONObject4 = null;
}
try {
stringToColor = Color.parseColor(optString4);
} catch (Exception unused5) {
stringToColor = PdrUtil.stringToColor(optString4);
}
str4 = str;
nativeView.makeOverlay(iWebview, null, null, stringToColor, null, jSONObject11, jSONObject4, str8, "rect", false, true);
} else {
str4 = str;
if (optString2.equals(WXBasicComponentType.RICHTEXT)) {
String optString6 = jSONObject.optString("text");
String optString7 = jSONObject.optString("position");
nativeView.makeRichText(iWebview, optString6, (TextUtils.isEmpty(optString7) || optString7.equals("null")) ? null : new JSONObject(optString7), jSONObject.has("richTextStyles") ? jSONObject.optJSONObject("richTextStyles") : null, str8);
} else if (optString2.equals("input")) {
try {
jSONObject2 = new JSONObject(jSONObject.optString("position"));
} catch (JSONException unused6) {
jSONObject2 = new JSONObject();
}
JSONObject jSONObject12 = jSONObject2;
try {
jSONObject3 = new JSONObject(jSONObject.optString("inputStyles"));
} catch (JSONException unused7) {
jSONObject3 = new JSONObject();
}
nativeView.makeOverlay(iWebview, null, null, -1, null, jSONObject12, jSONObject3, str8, "input", false, true);
} else if (optString2.equals("weex")) {
nativeView.makeWeexView(iWebview, jSONObject, str8);
}
}
e.printStackTrace();
return;
}
i2 = i + 1;
str5 = str3;
str6 = str2;
str7 = str4;
jSONArray2 = jSONArray;
}
nativeView.nativeInvalidate(true);
}
}