diff options
| author | Arjun Roychowdhury <pliablepixels@gmail.com> | 2015-09-23 15:45:30 -0400 |
|---|---|---|
| committer | Arjun Roychowdhury <pliablepixels@gmail.com> | 2015-09-23 15:45:30 -0400 |
| commit | 1d1c2168ff30ac9452b0929db4ae1f5baa83657a (patch) | |
| tree | 1967e3ca3898bf2f33938e89bd1e6add6e49a570 /plugins/cordova-plugin-crosswalk-webview/src/android/XWalkCordovaView.java | |
| parent | 26821696678cf84ee19f4eb803807e41a7b56780 (diff) | |
updates
Diffstat (limited to 'plugins/cordova-plugin-crosswalk-webview/src/android/XWalkCordovaView.java')
| -rw-r--r-- | plugins/cordova-plugin-crosswalk-webview/src/android/XWalkCordovaView.java | 108 |
1 files changed, 0 insertions, 108 deletions
diff --git a/plugins/cordova-plugin-crosswalk-webview/src/android/XWalkCordovaView.java b/plugins/cordova-plugin-crosswalk-webview/src/android/XWalkCordovaView.java deleted file mode 100644 index 0be2e998..00000000 --- a/plugins/cordova-plugin-crosswalk-webview/src/android/XWalkCordovaView.java +++ /dev/null @@ -1,108 +0,0 @@ -package org.crosswalk.engine; - -import org.apache.cordova.CordovaPreferences; -import org.xwalk.core.XWalkPreferences; -import org.xwalk.core.XWalkResourceClient; -import org.xwalk.core.XWalkUIClient; -import org.xwalk.core.XWalkView; - -import android.content.Context; -import android.content.pm.ApplicationInfo; -import android.content.pm.PackageManager; -import android.util.AttributeSet; -import android.view.KeyEvent; - -import org.apache.cordova.CordovaWebView; -import org.apache.cordova.CordovaWebViewEngine; - -public class XWalkCordovaView extends XWalkView implements CordovaWebViewEngine.EngineView { - protected XWalkCordovaResourceClient resourceClient; - protected XWalkCordovaUiClient uiClient; - protected XWalkWebViewEngine parentEngine; - - private static boolean hasSetStaticPref; - // This needs to run before the super's constructor. - private static Context setGlobalPrefs(Context context, CordovaPreferences preferences) { - if (!hasSetStaticPref) { - hasSetStaticPref = true; - ApplicationInfo ai = null; - try { - ai = context.getPackageManager().getApplicationInfo(context.getApplicationContext().getPackageName(), PackageManager.GET_META_DATA); - } catch (PackageManager.NameNotFoundException e) { - throw new RuntimeException(e); - } - boolean prefAnimatable = preferences == null ? false : preferences.getBoolean("CrosswalkAnimatable", false); - boolean manifestAnimatable = ai.metaData == null ? false : ai.metaData.getBoolean("CrosswalkAnimatable"); - if (prefAnimatable || manifestAnimatable) { - // Slows it down a bit, but allows for it to be animated by Android View properties. - XWalkPreferences.setValue(XWalkPreferences.ANIMATABLE_XWALK_VIEW, true); - } - if ((ai.flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0) { - XWalkPreferences.setValue(XWalkPreferences.REMOTE_DEBUGGING, true); - } - XWalkPreferences.setValue(XWalkPreferences.JAVASCRIPT_CAN_OPEN_WINDOW, true); - XWalkPreferences.setValue(XWalkPreferences.ALLOW_UNIVERSAL_ACCESS_FROM_FILE, true); - } - return context; - } - - public XWalkCordovaView(Context context, CordovaPreferences preferences) { - super(setGlobalPrefs(context, preferences), (AttributeSet)null); - } - - public XWalkCordovaView(Context context, AttributeSet attrs) { - super(setGlobalPrefs(context, null), attrs); - } - - void init(XWalkWebViewEngine parentEngine) { - this.parentEngine = parentEngine; - if (resourceClient == null) { - setResourceClient(new XWalkCordovaResourceClient(parentEngine)); - } - if (uiClient == null) { - setUIClient(new XWalkCordovaUiClient(parentEngine)); - } - } - - @Override - public void setResourceClient(XWalkResourceClient client) { - // XWalk calls this method from its constructor. - if (client instanceof XWalkCordovaResourceClient) { - this.resourceClient = (XWalkCordovaResourceClient)client; - } - super.setResourceClient(client); - } - - @Override - public void setUIClient(XWalkUIClient client) { - // XWalk calls this method from its constructor. - if (client instanceof XWalkCordovaUiClient) { - this.uiClient = (XWalkCordovaUiClient)client; - } - super.setUIClient(client); - } - - @Override - public boolean dispatchKeyEvent(KeyEvent event) { - Boolean ret = parentEngine.client.onDispatchKeyEvent(event); - if (ret != null) { - return ret.booleanValue(); - } - return super.dispatchKeyEvent(event); - } - - @Override - public void pauseTimers() { - // This is called by XWalkViewInternal.onActivityStateChange(). - // We don't want them paused by default though. - } - - public void pauseTimersForReal() { - super.pauseTimers(); - } - - @Override - public CordovaWebView getCordovaWebView() { - return parentEngine == null ? null : parentEngine.getCordovaWebView(); - } -} |
