コード例 #1
0
ファイル: MoPubView.java プロジェクト: bobbyzhu/Cocos-Helper
  public MoPubView(Context context, AttributeSet attrs) {
    super(context, attrs);

    ManifestUtils.checkWebViewActivitiesDeclared(context);

    mContext = context;
    mScreenVisibility = getVisibility();

    setHorizontalScrollBarEnabled(false);
    setVerticalScrollBarEnabled(false);

    // There is a rare bug in Froyo/2.2 where creation of a WebView causes a
    // NullPointerException. (http://code.google.com/p/android/issues/detail?id=10789)
    // It happens when the WebView can't access the local file store to make a cache file.
    // Here, we'll work around it by trying to create a file store and then just go inert
    // if it's not accessible.
    if (WebViewDatabase.getInstance(context) == null) {
      MoPubLog.e(
          "Disabling MoPub. Local cache file is inaccessible so MoPub will "
              + "fail if we try to create a WebView. Details of this Android bug found at:"
              + "http://code.google.com/p/android/issues/detail?id=10789");
      return;
    }

    mAdViewController = AdViewControllerFactory.create(context, this);
    registerScreenStateBroadcastReceiver();
  }
コード例 #2
0
  /**
   * Create a new BrowserFrame to be used in an application.
   *
   * @param context An application context to use when retrieving assets.
   * @param w A WebViewCore used as the view for this frame.
   * @param proxy A CallbackProxy for posting messages to the UI thread and querying a client for
   *     information.
   * @param settings A WebSettings object that holds all settings. XXX: Called by WebCore thread.
   */
  public BrowserFrame(Context context, WebViewCore w, CallbackProxy proxy, WebSettings settings) {
    // Create a global JWebCoreJavaBridge to handle timers and
    // cookies in the WebCore thread.
    if (sJavaBridge == null) {
      sJavaBridge = new JWebCoreJavaBridge();
      // set WebCore native cache size
      sJavaBridge.setCacheSize(4 * 1024 * 1024);
      // initialize CacheManager
      CacheManager.init(context);
      // create CookieSyncManager with current Context
      CookieSyncManager.createInstance(context);
    }
    AssetManager am = context.getAssets();
    nativeCreateFrame(w, am, proxy.getBackForwardList());

    mSettings = settings;
    mContext = context;
    mCallbackProxy = proxy;
    mDatabase = WebViewDatabase.getInstance(context);
    mWebViewCore = w;

    if (WebView.LOGV_ENABLED) {
      Log.v(LOGTAG, "BrowserFrame constructor: this=" + this);
    }
  }
コード例 #3
0
ファイル: MoPubView.java プロジェクト: LambergaR/mopub-client
  public MoPubView(Context context, AttributeSet attrs) {
    super(context, attrs);

    mContext = context;
    mIsInForeground = (getVisibility() == VISIBLE);
    mLocationAwareness = LocationAwareness.LOCATION_AWARENESS_NORMAL;
    mLocationPrecision = DEFAULT_LOCATION_PRECISION;

    setHorizontalScrollBarEnabled(false);
    setVerticalScrollBarEnabled(false);

    // There is a rare bug in Froyo/2.2 where creation of a WebView causes a
    // NullPointerException. (http://code.google.com/p/android/issues/detail?id=10789)
    // It happens when the WebView can't access the local file store to make a cache file.
    // Here, we'll work around it by trying to create a file store and then just go inert
    // if it's not accessible.
    if (WebViewDatabase.getInstance(context) == null) {
      Log.e(
          "MoPub",
          "Disabling MoPub. Local cache file is inaccessible so MoPub will "
              + "fail if we try to create a WebView. Details of this Android bug found at:"
              + "http://code.google.com/p/android/issues/detail?id=10789");
      return;
    }

    initVersionDependentAdView(context);
    registerScreenStateBroadcastReceiver();
  }
コード例 #4
0
  /**
   * Create a new BrowserFrame to be used in an application.
   *
   * @param context An application context to use when retrieving assets.
   * @param w A WebViewCore used as the view for this frame.
   * @param proxy A CallbackProxy for posting messages to the UI thread and querying a client for
   *     information.
   * @param settings A WebSettings object that holds all settings. XXX: Called by WebCore thread.
   */
  public BrowserFrame(
      Context context,
      WebViewCore w,
      CallbackProxy proxy,
      WebSettings settings,
      Map<String, Object> javascriptInterfaces) {

    Context appContext = context.getApplicationContext();

    // Create a global JWebCoreJavaBridge to handle timers and
    // cookies in the WebCore thread.
    if (sJavaBridge == null) {
      sJavaBridge = new JWebCoreJavaBridge();
      // set WebCore native cache size
      ActivityManager am = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
      if (am.getMemoryClass() > 16) {
        sJavaBridge.setCacheSize(8 * 1024 * 1024);
      } else {
        sJavaBridge.setCacheSize(4 * 1024 * 1024);
      }
      // initialize CacheManager
      CacheManager.init(appContext);
      // create CookieSyncManager with current Context
      CookieSyncManager.createInstance(appContext);
      // create PluginManager with current Context
      PluginManager.getInstance(appContext);
    }

    if (sConfigCallback == null) {
      sConfigCallback =
          new ConfigCallback((WindowManager) appContext.getSystemService(Context.WINDOW_SERVICE));
      ViewRootImpl.addConfigCallback(sConfigCallback);
    }
    sConfigCallback.addHandler(this);

    mJavaScriptObjects = javascriptInterfaces;
    if (mJavaScriptObjects == null) {
      mJavaScriptObjects = new HashMap<String, Object>();
    }
    mRemovedJavaScriptObjects = new HashSet<Object>();

    mSettings = settings;
    mContext = context;
    mCallbackProxy = proxy;
    mDatabase = WebViewDatabase.getInstance(appContext);
    mWebViewCore = w;

    mSearchBox = new SearchBoxImpl(mWebViewCore, mCallbackProxy);
    mJavaScriptObjects.put(SearchBoxImpl.JS_INTERFACE_NAME, mSearchBox);

    AssetManager am = context.getAssets();
    nativeCreateFrame(w, am, proxy.getBackForwardList());

    if (DebugFlags.BROWSER_FRAME) {
      Log.v(LOGTAG, "BrowserFrame constructor: this=" + this);
    }
  }
コード例 #5
0
ファイル: MoPubView.java プロジェクト: navisingh/ad-networks
  public MoPubView(Context context, AttributeSet attrs) {
    super(context, attrs);

    // There is a rare bug in Froyo/2.2 where creation of a WebView causes a
    // NullPointerException. (http://code.google.com/p/android/issues/detail?id=10789)
    // It happens when the WebView can't access the local file store to make a cache file.
    // Here, we'll work around it by trying to create a file store and then just go inert
    // if it's not accessible.
    if (WebViewDatabase.getInstance(context) == null) {
      Log.e(
          "MoPub",
          "Disabling MoPub. Local cache file is inaccessbile so MoPub will "
              + "fail if we try to create a WebView. Details of this Android bug found at:"
              + "http://code.google.com/p/android/issues/detail?id=10789");
      return;
    }

    // The AdView doesn't need to be in the view hierarchy until an ad is loaded
    mAdView = new AdView(context, this);
  }
コード例 #6
0
  protected static void clearTraces() {
    CustomWebView WV = (CustomWebView) webLayout.findViewById(R.id.browser_page);
    if (WV != null) {
      WV.clearHistory();
      WV.clearCache(true);
    }

    WebViewDatabase wDB = WebViewDatabase.getInstance(activity);
    wDB.clearFormData();

    CookieSyncManager.createInstance(activity);
    CookieManager cookieManager = CookieManager.getInstance();
    cookieManager.removeAllCookie();
    // Usefull for future commits:
    //			cookieManager.setAcceptCookie(false)
    //
    //			WebView webview = new WebView(this);
    //			WebSettings ws = webview.getSettings();
    //			ws.setSaveFormData(false);
    //			ws.setSavePassword(false); // Not needed for API level 18 or greater (deprecat
  }
コード例 #7
0
ファイル: e.java プロジェクト: pankajk87/CompSecurity
 public final boolean b() {
   dw dw1 = a;
   Context context = dw.a(dw1.a);
   return dw1.b.b(context) && WebViewDatabase.getInstance(context) != null;
 }