类org.apache.cordova.CordovaPreferences源码实例Demo

下面列出了怎么用org.apache.cordova.CordovaPreferences的API类实例代码及写法,或者点击链接到github查看源代码。

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");
        // Selects between a TextureView (obeys framework transforms applied to view) or a SurfaceView (better performance).
        XWalkPreferences.setValue(XWalkPreferences.ANIMATABLE_XWALK_VIEW, prefAnimatable || manifestAnimatable);
        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;
}
 
源代码2 项目: keemob   文件: StandardActivityTest.java
@Test
public void checkBackgroundIntentCheck() {
    StandardActivity activity = (StandardActivity) mActivityRule.getActivity();
    final SystemWebView webView = (SystemWebView) activity.getWindow().getCurrentFocus();
    CordovaWebView webInterface = webView.getCordovaWebView();
    CordovaPreferences prefs = webInterface.getPreferences();
    assertFalse(prefs.getInteger("backgroundcolor", Color.BLACK) == Color.GREEN);
}
 
源代码3 项目: OsmGo   文件: Bridge.java
/**
 * Create the Bridge with a reference to the main {@link Activity} for the
 * app, and a reference to the {@link WebView} our app will use.
 * @param context
 * @param webView
 */
public Bridge(Activity context, WebView webView, List<Class<? extends Plugin>> initialPlugins, CordovaInterfaceImpl cordovaInterface, PluginManager pluginManager, CordovaPreferences preferences) {
  this.context = context;
  this.webView = webView;
  this.initialPlugins = initialPlugins;
  this.cordovaInterface = cordovaInterface;
  this.preferences = preferences;

  // Start our plugin execution threads and handlers
  handlerThread.start();
  taskHandler = new Handler(handlerThread.getLooper());

  Config.load(getActivity());

  // Initialize web view and message handler for it
  this.initWebView();
  this.msgHandler = new MessageHandler(this, webView, pluginManager);

  // Grab any intent info that our app was launched with
  Intent intent = context.getIntent();
  Uri intentData = intent.getData();
  this.intentUri = intentData;

  // Register our core plugins
  this.registerAllPlugins();

  this.loadWebView();
}
 
源代码4 项目: OsmGo   文件: MockCordovaWebViewImpl.java
@Override
public void init(CordovaInterface cordova, List<PluginEntry> pluginEntries, CordovaPreferences preferences) {
  this.cordova = cordova;
  this.preferences = preferences;
  this.pluginManager = new PluginManager(this, this.cordova, pluginEntries);
  this.resourceApi = new CordovaResourceApi(this.context, this.pluginManager);
  this.pluginManager.init();
}
 
源代码5 项目: OsmGo   文件: MockCordovaWebViewImpl.java
public void init(CordovaInterface cordova, List<PluginEntry> pluginEntries, CordovaPreferences preferences, WebView webView) {
  this.cordova = cordova;
  this.webView = webView;
  this.preferences = preferences;
  this.pluginManager = new PluginManager(this, this.cordova, pluginEntries);
  this.resourceApi = new CordovaResourceApi(this.context, this.pluginManager);
  nativeToJsMessageQueue = new NativeToJsMessageQueue();
  nativeToJsMessageQueue.addBridgeMode(new CapacitorEvalBridgeMode(webView, this.cordova));
  nativeToJsMessageQueue.setBridgeMode(0);
  this.cookieManager = new CapacitorCordovaCookieManager(webView);
  this.pluginManager.init();
}
 
/** Used when created via reflection. */
public InjectWebViewEngine(Context context, CordovaPreferences preferences) {
    this(new InjectWebView(context));
    //super(context, preferences);
    Log.w("inject", "InjectWebViewEngine");

}
 
/** Used when created via reflection. */
public CordovaGeckoViewEngine(Context context, CordovaPreferences preferences) {
    mCtx = context;
    webView = new CordovaGeckoView(this);
    //testView = new SystemWebView(context);
    prefs = preferences;
}
 
源代码8 项目: WebSocket-for-Android   文件: WebSocket.java
private static int getLogLevel(CordovaPreferences preferences) {
   String logLevel = preferences.getString("LogLevel", "ERROR");

   if ("VERBOSE".equals(logLevel)) {
       return android.util.Log.VERBOSE;
   } else if ("DEBUG".equals(logLevel)) {
       return android.util.Log.DEBUG;
   } else if ("INFO".equals(logLevel)) {
       return android.util.Log.INFO;
   } else if ("WARN".equals(logLevel)) {
       return android.util.Log.WARN;
   } else {
       return android.util.Log.ERROR;
   }
}
 
源代码9 项目: BigDataPlatform   文件: SystemWebViewEngine.java
/** Used when created via reflection. */
public SystemWebViewEngine(Context context, CordovaPreferences preferences) {
    this(new SystemWebView(context), preferences);
}
 
源代码10 项目: BigDataPlatform   文件: SystemWebViewEngine.java
public SystemWebViewEngine(SystemWebView webView, CordovaPreferences preferences) {
    this.preferences = preferences;
    this.webView = webView;
    cookieManager = new SystemCookieManager(webView);
}
 
源代码11 项目: xmall   文件: SystemWebViewEngine.java
/** Used when created via reflection. */
public SystemWebViewEngine(Context context, CordovaPreferences preferences) {
    this(new SystemWebView(context), preferences);
}
 
源代码12 项目: xmall   文件: SystemWebViewEngine.java
public SystemWebViewEngine(SystemWebView webView, CordovaPreferences preferences) {
    this.preferences = preferences;
    this.webView = webView;
    cookieManager = new SystemCookieManager(webView);
}
 
/** Used when created via reflection. */
public SystemWebViewEngine(Context context, CordovaPreferences preferences) {
    this(new SystemWebView(context), preferences);
}
 
public SystemWebViewEngine(SystemWebView webView, CordovaPreferences preferences) {
    this.preferences = preferences;
    this.webView = webView;
    cookieManager = new SystemCookieManager(webView);
}
 
源代码15 项目: x5webview-cordova-plugin   文件: X5WebViewEngine.java
/** Used when created via reflection. */
public X5WebViewEngine(Context context, CordovaPreferences preferences) {
    this(new X5WebView(context), preferences);
}
 
源代码16 项目: x5webview-cordova-plugin   文件: X5WebViewEngine.java
public X5WebViewEngine(X5WebView webView, CordovaPreferences preferences) {
    this.preferences = preferences;
    this.webView = webView;
    cookieManager = new X5CookieManager(webView);
}
 
/** Used when created via reflection. */
public X5WebViewEngine(Context context, CordovaPreferences preferences) {
    this(new X5WebView(context), preferences);
}
 
public X5WebViewEngine(X5WebView webView, CordovaPreferences preferences) {
    this.preferences = preferences;
    this.webView = webView;
    cookieManager = new X5CookieManager(webView);
}
 
源代码19 项目: keemob   文件: SystemWebViewEngine.java
/** Used when created via reflection. */
public SystemWebViewEngine(Context context, CordovaPreferences preferences) {
    this(new SystemWebView(context), preferences);
}
 
源代码20 项目: keemob   文件: SystemWebViewEngine.java
public SystemWebViewEngine(SystemWebView webView, CordovaPreferences preferences) {
    this.preferences = preferences;
    this.webView = webView;
    cookieManager = new SystemCookieManager(webView);
}
 
源代码21 项目: keemob   文件: SystemWebViewEngine.java
/** Used when created via reflection. */
public SystemWebViewEngine(Context context, CordovaPreferences preferences) {
    this(new SystemWebView(context), preferences);
}
 
源代码22 项目: keemob   文件: SystemWebViewEngine.java
public SystemWebViewEngine(SystemWebView webView, CordovaPreferences preferences) {
    this.preferences = preferences;
    this.webView = webView;
    cookieManager = new SystemCookieManager(webView);
}
 
源代码23 项目: cordova-plugin-x5-tbs   文件: X5WebViewEngine.java
/**
 * Used when created via reflection.
 */
public X5WebViewEngine(Context context, CordovaPreferences preferences) {
  this(new X5WebView(context), preferences);
}
 
源代码24 项目: cordova-plugin-x5-tbs   文件: X5WebViewEngine.java
public X5WebViewEngine(X5WebView webView, CordovaPreferences preferences) {
  this.preferences = preferences;
  this.webView = webView;
  cookieManager = new X5CookieManager(webView);
}
 
源代码25 项目: OsmGo   文件: MockCordovaWebViewImpl.java
@Override
public CordovaPreferences getPreferences() {
  return this.preferences;
}
 
源代码26 项目: app-icon   文件: SystemWebViewEngine.java
/** Used when created via reflection. */
public SystemWebViewEngine(Context context, CordovaPreferences preferences) {
    this(new SystemWebView(context), preferences);
}
 
源代码27 项目: app-icon   文件: SystemWebViewEngine.java
public SystemWebViewEngine(SystemWebView webView, CordovaPreferences preferences) {
    this.preferences = preferences;
    this.webView = webView;
    cookieManager = new SystemCookieManager(webView);
}
 
/** Used when created via reflection. */
public X5WebViewEngine(Context context, CordovaPreferences preferences) {
    this(new X5WebView(context), preferences);
}
 
public X5WebViewEngine(X5WebView webView, CordovaPreferences preferences) {
    this.preferences = preferences;
    this.webView = webView;
    cookieManager = new X5CookieManager(webView);
}
 
/** Used when created via reflection. */
public SystemWebViewEngine(Context context, CordovaPreferences preferences) {
    this(new SystemWebView(context), preferences);
}