Skip to content

Commit

Permalink
Merge pull request #7882 from andyque/addWebView
Browse files Browse the repository at this point in the history
add WebView
  • Loading branch information
minggo committed Aug 29, 2014
2 parents a125ed0 + 4c04633 commit 58dd2f4
Show file tree
Hide file tree
Showing 24 changed files with 2,040 additions and 3 deletions.
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -920,6 +920,7 @@ Developers:
Fix video scale issue in iOS
Fix iOS VideoPlayer memory leak
Added c++11 random library support
Added WebView widget which supports iOS and Android

billtt
Fixed a bug that Node::setScale(float) may not work properly
Expand Down
24 changes: 24 additions & 0 deletions build/cocos2d_libs.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1350,6 +1350,14 @@
1ABA68B11888D700007D1BB4 /* CCFontCharMap.h in Headers */ = {isa = PBXBuildFile; fileRef = 1ABA68AD1888D700007D1BB4 /* CCFontCharMap.h */; };
1AC0269C1914068200FA920D /* ConvertUTF.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AC026991914068200FA920D /* ConvertUTF.h */; };
1AC0269D1914068200FA920D /* ConvertUTF.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AC026991914068200FA920D /* ConvertUTF.h */; };
29394CF019B01DBA00D2DE1A /* UIWebView.h in Headers */ = {isa = PBXBuildFile; fileRef = 29394CEC19B01DBA00D2DE1A /* UIWebView.h */; };
29394CF119B01DBA00D2DE1A /* UIWebView.h in Headers */ = {isa = PBXBuildFile; fileRef = 29394CEC19B01DBA00D2DE1A /* UIWebView.h */; };
29394CF219B01DBA00D2DE1A /* UIWebView.mm in Sources */ = {isa = PBXBuildFile; fileRef = 29394CED19B01DBA00D2DE1A /* UIWebView.mm */; };
29394CF319B01DBA00D2DE1A /* UIWebView.mm in Sources */ = {isa = PBXBuildFile; fileRef = 29394CED19B01DBA00D2DE1A /* UIWebView.mm */; };
29394CF419B01DBA00D2DE1A /* UIWebViewImpl_iOS.h in Headers */ = {isa = PBXBuildFile; fileRef = 29394CEE19B01DBA00D2DE1A /* UIWebViewImpl_iOS.h */; };
29394CF519B01DBA00D2DE1A /* UIWebViewImpl_iOS.h in Headers */ = {isa = PBXBuildFile; fileRef = 29394CEE19B01DBA00D2DE1A /* UIWebViewImpl_iOS.h */; };
29394CF619B01DBA00D2DE1A /* UIWebViewImpl_iOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = 29394CEF19B01DBA00D2DE1A /* UIWebViewImpl_iOS.mm */; };
29394CF719B01DBA00D2DE1A /* UIWebViewImpl_iOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = 29394CEF19B01DBA00D2DE1A /* UIWebViewImpl_iOS.mm */; };
2986667F18B1B246000E39CA /* CCTweenFunction.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2986667818B1B079000E39CA /* CCTweenFunction.cpp */; };
299754F4193EC95400A54AC3 /* ObjectFactory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 299754F2193EC95400A54AC3 /* ObjectFactory.cpp */; };
299754F5193EC95400A54AC3 /* ObjectFactory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 299754F2193EC95400A54AC3 /* ObjectFactory.cpp */; };
Expand Down Expand Up @@ -2296,6 +2304,10 @@
2905FA1318CF08D100240AA3 /* UIWidget.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UIWidget.cpp; sourceTree = "<group>"; };
2905FA1418CF08D100240AA3 /* UIWidget.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIWidget.h; sourceTree = "<group>"; };
29080DEB191B82CE0066F8DF /* UIDeprecated.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = UIDeprecated.h; sourceTree = "<group>"; };
29394CEC19B01DBA00D2DE1A /* UIWebView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIWebView.h; sourceTree = "<group>"; };
29394CED19B01DBA00D2DE1A /* UIWebView.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = UIWebView.mm; sourceTree = "<group>"; };
29394CEE19B01DBA00D2DE1A /* UIWebViewImpl_iOS.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIWebViewImpl_iOS.h; sourceTree = "<group>"; };
29394CEF19B01DBA00D2DE1A /* UIWebViewImpl_iOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = UIWebViewImpl_iOS.mm; sourceTree = "<group>"; };
2958244919873D8E00F9746D /* UIScale9Sprite.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UIScale9Sprite.cpp; sourceTree = "<group>"; };
2958244A19873D8E00F9746D /* UIScale9Sprite.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIScale9Sprite.h; sourceTree = "<group>"; };
2986667818B1B079000E39CA /* CCTweenFunction.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCTweenFunction.cpp; sourceTree = "<group>"; };
Expand Down Expand Up @@ -4012,6 +4024,10 @@
29CB8F521929D65500C841D6 /* experimental */ = {
isa = PBXGroup;
children = (
29394CEC19B01DBA00D2DE1A /* UIWebView.h */,
29394CED19B01DBA00D2DE1A /* UIWebView.mm */,
29394CEE19B01DBA00D2DE1A /* UIWebViewImpl_iOS.h */,
29394CEF19B01DBA00D2DE1A /* UIWebViewImpl_iOS.mm */,
3EA0FB69191C841D00B170C8 /* UIVideoPlayer.h */,
3EA0FB6A191C841D00B170C8 /* UIVideoPlayerIOS.mm */,
);
Expand Down Expand Up @@ -5031,6 +5047,7 @@
1A570093180BC5A10088DEC7 /* CCActionTween.h in Headers */,
50ABBD4A1925AB0000A911A9 /* Mat4.h in Headers */,
15AE1A6919AAD40300C27E9E /* b2WorldCallbacks.h in Headers */,
29394CF419B01DBA00D2DE1A /* UIWebViewImpl_iOS.h in Headers */,
1A57009A180BC5C10088DEC7 /* CCAtlasNode.h in Headers */,
15AE190819AAD35000C27E9E /* CCDatas.h in Headers */,
1A5700A0180BC5D20088DEC7 /* CCNode.h in Headers */,
Expand Down Expand Up @@ -5228,6 +5245,7 @@
15AE191019AAD35000C27E9E /* CCInputDelegate.h in Headers */,
15AE184C19AAD30800C27E9E /* SimpleAudioEngine.h in Headers */,
50ABBDA11925AB4100A911A9 /* CCGroupCommand.h in Headers */,
29394CF019B01DBA00D2DE1A /* UIWebView.h in Headers */,
15AE186519AAD31D00C27E9E /* CDOpenALSupport.h in Headers */,
15AE1B5C19AADA9900C27E9E /* UITextAtlas.h in Headers */,
1A5702FC180BCE750088DEC7 /* CCTMXXMLParser.h in Headers */,
Expand Down Expand Up @@ -5558,6 +5576,7 @@
15AE1AB319AAD40300C27E9E /* b2CircleContact.h in Headers */,
5034CA2E191D591100CE6051 /* ccShader_PositionTextureA8Color.frag in Headers */,
15AE1A4F19AAD3D500C27E9E /* b2Shape.h in Headers */,
29394CF519B01DBA00D2DE1A /* UIWebViewImpl_iOS.h in Headers */,
50ABBD5B1925AB0000A911A9 /* Vec2.h in Headers */,
50ABBD411925AB0000A911A9 /* CCMath.h in Headers */,
1A5701A0180BCB590088DEC7 /* CCFont.h in Headers */,
Expand Down Expand Up @@ -5670,6 +5689,7 @@
15AE1BAC19AADFDF00C27E9E /* UILayout.h in Headers */,
1A570230180BCC1A0088DEC7 /* CCParticleSystemQuad.h in Headers */,
15AE1AF619AAD42500C27E9E /* chipmunk_ffi.h in Headers */,
29394CF119B01DBA00D2DE1A /* UIWebView.h in Headers */,
15AE18B419AAD33D00C27E9E /* CCBSelectorResolver.h in Headers */,
B24AA988195A675C007B4522 /* CCFastTMXLayer.h in Headers */,
15AE1AB919AAD40300C27E9E /* b2EdgeAndCircleContact.h in Headers */,
Expand Down Expand Up @@ -6122,6 +6142,7 @@
15AE187A19AAD33D00C27E9E /* CCBAnimationManager.cpp in Sources */,
15AE1B6D19AADA9900C27E9E /* UIHelper.cpp in Sources */,
15AE1A8A19AAD40300C27E9E /* b2PulleyJoint.cpp in Sources */,
29394CF219B01DBA00D2DE1A /* UIWebView.mm in Sources */,
15AE1BD419AAE01E00C27E9E /* CCControlSaturationBrightnessPicker.cpp in Sources */,
1A57019D180BCB590088DEC7 /* CCFont.cpp in Sources */,
1A5701A1180BCB590088DEC7 /* CCFontAtlas.cpp in Sources */,
Expand Down Expand Up @@ -6287,6 +6308,7 @@
15AE196E19AAD35700C27E9E /* CCActionTimelineCache.cpp in Sources */,
50ABBEB31925AB6F00A911A9 /* CCUserDefault.mm in Sources */,
50ABBEB51925AB6F00A911A9 /* CCUserDefaultAndroid.cpp in Sources */,
29394CF619B01DBA00D2DE1A /* UIWebViewImpl_iOS.mm in Sources */,
50ABBE831925AB6F00A911A9 /* ccFPSImages.c in Sources */,
15AE1B7019AADA9900C27E9E /* CocosGUI.cpp in Sources */,
15AE19D019AAD3A700C27E9E /* AttachmentLoader.cpp in Sources */,
Expand Down Expand Up @@ -6630,6 +6652,7 @@
50ABBD9C1925AB4100A911A9 /* ccGLStateCache.cpp in Sources */,
1A5701E7180BCB8C0088DEC7 /* CCTransition.cpp in Sources */,
15AE1AC019AAD40300C27E9E /* b2MotorJoint.cpp in Sources */,
29394CF319B01DBA00D2DE1A /* UIWebView.mm in Sources */,
15AE18BD19AAD33D00C27E9E /* CCLabelBMFontLoader.cpp in Sources */,
50ABC01E1926664800A911A9 /* CCThread.cpp in Sources */,
15AE1B3A19AAD43700C27E9E /* cpBB.c in Sources */,
Expand Down Expand Up @@ -6672,6 +6695,7 @@
15AE1BFD19AAE01E00C27E9E /* CCInvocation.cpp in Sources */,
B24AA98A195A675C007B4522 /* CCFastTMXTiledMap.cpp in Sources */,
15AE18CE19AAD33D00C27E9E /* CCNodeLoader.cpp in Sources */,
29394CF719B01DBA00D2DE1A /* UIWebViewImpl_iOS.mm in Sources */,
15AE1AC619AAD40300C27E9E /* b2GearJoint.cpp in Sources */,
B24AA986195A675C007B4522 /* CCFastTMXLayer.cpp in Sources */,
1A57022E180BCC1A0088DEC7 /* CCParticleSystemQuad.cpp in Sources */,
Expand Down
18 changes: 18 additions & 0 deletions build/cocos2d_tests.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -865,6 +865,8 @@
290E94B6196FC16900694919 /* CocostudioParserTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 290E94B3196FC16900694919 /* CocostudioParserTest.cpp */; };
295824591987415900F9746D /* UIScale9SpriteTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 295824571987415900F9746D /* UIScale9SpriteTest.cpp */; };
2958245A1987415900F9746D /* UIScale9SpriteTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 295824571987415900F9746D /* UIScale9SpriteTest.cpp */; };
298D7F6F19AC31F300FF096D /* UIWebViewTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 298D7F6D19AC31F300FF096D /* UIWebViewTest.cpp */; };
29AFEF6719ACCAA000F6B10A /* Test.html in Resources */ = {isa = PBXBuildFile; fileRef = 29AFEF6619ACCAA000F6B10A /* Test.html */; };
29FBBBFE196A9ECD00E65826 /* CocostudioParserJsonTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 29FBBBFC196A9ECD00E65826 /* CocostudioParserJsonTest.cpp */; };
29FBBBFF196A9ECD00E65826 /* CocostudioParserJsonTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 29FBBBFC196A9ECD00E65826 /* CocostudioParserJsonTest.cpp */; };
38FA2E73194AEBE100FF2BE4 /* ActionTimelineTestScene.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 38FA2E71194AEBE100FF2BE4 /* ActionTimelineTestScene.cpp */; };
Expand Down Expand Up @@ -2886,6 +2888,9 @@
290E94B4196FC16900694919 /* CocostudioParserTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CocostudioParserTest.h; path = ../CocostudioParserTest.h; sourceTree = "<group>"; };
295824571987415900F9746D /* UIScale9SpriteTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UIScale9SpriteTest.cpp; sourceTree = "<group>"; };
295824581987415900F9746D /* UIScale9SpriteTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIScale9SpriteTest.h; sourceTree = "<group>"; };
298D7F6D19AC31F300FF096D /* UIWebViewTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = UIWebViewTest.cpp; path = UIWebViewTest/UIWebViewTest.cpp; sourceTree = "<group>"; };
298D7F6E19AC31F300FF096D /* UIWebViewTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = UIWebViewTest.h; path = UIWebViewTest/UIWebViewTest.h; sourceTree = "<group>"; };
29AFEF6619ACCAA000F6B10A /* Test.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; name = Test.html; path = "../tests/cpp-tests/Resources/Test.html"; sourceTree = "<group>"; };
29FBBBFC196A9ECD00E65826 /* CocostudioParserJsonTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CocostudioParserJsonTest.cpp; sourceTree = "<group>"; };
29FBBBFD196A9ECD00E65826 /* CocostudioParserJsonTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CocostudioParserJsonTest.h; sourceTree = "<group>"; };
38FA2E71194AEBE100FF2BE4 /* ActionTimelineTestScene.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ActionTimelineTestScene.cpp; sourceTree = "<group>"; };
Expand Down Expand Up @@ -6495,6 +6500,7 @@
1AC35CB518CED84500F37B72 /* effect1.raw */,
1AC35CB618CED84500F37B72 /* effect1.wav */,
1AC35CC418CED84500F37B72 /* pew-pew-lei.wav */,
29AFEF6619ACCAA000F6B10A /* Test.html */,
);
name = Resources;
sourceTree = "<group>";
Expand Down Expand Up @@ -6907,6 +6913,15 @@
path = UIWidgetAddNodeTest;
sourceTree = "<group>";
};
298D7F6C19AC31C000FF096D /* UIWebViewTest */ = {
isa = PBXGroup;
children = (
298D7F6D19AC31F300FF096D /* UIWebViewTest.cpp */,
298D7F6E19AC31F300FF096D /* UIWebViewTest.h */,
);
name = UIWebViewTest;
sourceTree = "<group>";
};
29B97314FDCFA39411CA2CEA /* CustomTemplate */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -6988,6 +7003,7 @@
29FBBC00196A9F0D00E65826 /* UIAndEditorTests */ = {
isa = PBXGroup;
children = (
298D7F6C19AC31C000FF096D /* UIWebViewTest */,
295824571987415900F9746D /* UIScale9SpriteTest.cpp */,
295824581987415900F9746D /* UIScale9SpriteTest.h */,
29080D1F191B595E0066F8DF /* CocosGUIScene.cpp */,
Expand Down Expand Up @@ -7816,6 +7832,7 @@
1AC35D0918CED84500F37B72 /* TileMaps in Resources */,
1AC35CFF18CED84500F37B72 /* Particles in Resources */,
1AC35C8818CECF1400F37B72 /* [email protected] in Resources */,
29AFEF6719ACCAA000F6B10A /* Test.html in Resources */,
1AC35CD518CED84500F37B72 /* ccb in Resources */,
1AC35CE118CED84500F37B72 /* configs in Resources */,
1AC35CE918CED84500F37B72 /* extensions in Resources */,
Expand Down Expand Up @@ -8316,6 +8333,7 @@
1AC35B3E18CECF0C00F37B72 /* Bug-422.cpp in Sources */,
29080DAC191B595E0066F8DF /* UIFocusTest.cpp in Sources */,
1AC35BF618CECF0C00F37B72 /* HttpClientTest.cpp in Sources */,
298D7F6F19AC31F300FF096D /* UIWebViewTest.cpp in Sources */,
29080DA6191B595E0066F8DF /* UIButtonTest_Editor.cpp in Sources */,
1AC35B5018CECF0C00F37B72 /* ClickAndMoveTest.cpp in Sources */,
);
Expand Down
2 changes: 2 additions & 0 deletions cocos/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ list(REMOVE_ITEM cocos2d_source_files
"${CMAKE_CURRENT_SOURCE_DIR}/base/CCController-android.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/base/CCUserDefaultAndroid.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/ui/UIVideoPlayerAndroid.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/ui/UIWebView.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/ui/UIWebViewImpl_android.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/storage/local-storage/LocalStorageAndroid.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/base/CCEventController.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/base/CCEventListenerController.cpp"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,10 @@ of this software and associated documentation files (the "Software"), to deal
import android.os.Build;
import android.os.Bundle;
import android.os.Message;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.preference.PreferenceManager.OnActivityResultListener;
import android.util.Log;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import android.preference.PreferenceManager.OnActivityResultListener;

public abstract class Cocos2dxActivity extends Activity implements Cocos2dxHelperListener {
// ===========================================================
Expand All @@ -55,6 +54,7 @@ public abstract class Cocos2dxActivity extends Activity implements Cocos2dxHelpe
private Cocos2dxHandler mHandler;
private static Cocos2dxActivity sContext = null;
private Cocos2dxVideoHelper mVideoHelper = null;
private Cocos2dxWebViewHelper mWebViewHelper = null;

public static Context getContext() {
return sContext;
Expand Down Expand Up @@ -102,6 +102,10 @@ protected void onCreate(final Bundle savedInstanceState) {
if (mVideoHelper == null) {
mVideoHelper = new Cocos2dxVideoHelper(this, mFrameLayout);
}

if(mWebViewHelper == null){
mWebViewHelper = new Cocos2dxWebViewHelper(mFrameLayout);
}
}

//native method,call GLViewImpl::getGLContextAttrs() to get the OpenGL ES context attributions
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
package org.cocos2dx.lib;

import java.lang.reflect.Method;
import java.net.URI;

import android.annotation.SuppressLint;
import android.content.Context;
import android.util.Log;
import android.webkit.WebChromeClient;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.FrameLayout;

public class Cocos2dxWebView extends WebView {
private static final String TAG = Cocos2dxWebViewHelper.class.getSimpleName();

private int viewTag;
private String jsScheme;

public Cocos2dxWebView(Context context) {
this(context, -1);
}

@SuppressLint("SetJavaScriptEnabled")
public Cocos2dxWebView(Context context, int viewTag) {
super(context);
this.viewTag = viewTag;
this.jsScheme = "";

this.setFocusable(true);
this.setFocusableInTouchMode(true);

this.getSettings().setSupportZoom(false);

this.getSettings().setJavaScriptEnabled(true);

// `searchBoxJavaBridge_` has big security risk. http://jvn.jp/en/jp/JVN53768697
try {
Method method = this.getClass().getMethod("removeJavascriptInterface", new Class[]{String.class});
method.invoke(this, "searchBoxJavaBridge_");
} catch (Exception e) {
Log.d(TAG, "This API level do not support `removeJavascriptInterface`");
}

this.setWebViewClient(new Cocos2dxWebViewClient());
this.setWebChromeClient(new WebChromeClient());
}

public void setJavascriptInterfaceScheme(String scheme) {
this.jsScheme = scheme != null ? scheme : "";
}

public void setScalesPageToFit(boolean scalesPageToFit) {
this.getSettings().setSupportZoom(scalesPageToFit);
}

class Cocos2dxWebViewClient extends WebViewClient {
@Override
public boolean shouldOverrideUrlLoading(WebView view, String urlString) {
URI uri = URI.create(urlString);
if (uri != null && uri.getScheme().equals(jsScheme)) {
Cocos2dxWebViewHelper._onJsCallback(viewTag, urlString);
return true;
}
return Cocos2dxWebViewHelper._shouldStartLoading(viewTag, urlString);
}

@Override
public void onPageFinished(WebView view, String url) {
super.onPageFinished(view, url);
Cocos2dxWebViewHelper._didFinishLoading(viewTag, url);
}

@Override
public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) {
super.onReceivedError(view, errorCode, description, failingUrl);
Cocos2dxWebViewHelper._didFailLoading(viewTag, failingUrl);
}
}

public void setWebViewRect(int left, int top, int maxWidth, int maxHeight) {
fixSize(left, top, maxWidth, maxHeight);
}

private void fixSize(int left, int top, int width, int height) {
FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.WRAP_CONTENT,
FrameLayout.LayoutParams.WRAP_CONTENT);
layoutParams.leftMargin = left;
layoutParams.topMargin = top;
layoutParams.width = width;
layoutParams.height = height;
this.setLayoutParams(layoutParams);
}
}
Loading

0 comments on commit 58dd2f4

Please sign in to comment.