예제 #1
0
 protected void killWebViewLowMemory(WebView mWebView) {
   // http://stackoverflow.com/questions/3815090/webview-and-html5-video
   if (mWebView == null) {
     if (block.getVisibility() != View.GONE && block != null) {
       block.setVisibility(View.GONE);
       block.loadUrl("about:blank");
       block.destroy();
     }
   } else if (mWebView.getVisibility() != View.GONE) {
     mWebView.setVisibility(View.GONE);
     mWebView.loadUrl("about:blank");
     mWebView.destroy();
   }
 }
예제 #2
0
 @Override
 public void destroy() {
   if (client != null) {
     client.getBinding().destroy();
   }
   super.destroy();
 }
  public void setToNormal() {
    if (mPreview != null) {
      mPreview.stopPreview();
    }

    FrameLayout layout = (FrameLayout) findViewById(R.id.linear);
    layout.removeView(mWebView);
    layout.setLayoutParams(
        new FrameLayout.LayoutParams(
            FrameLayout.LayoutParams.FILL_PARENT, FrameLayout.LayoutParams.WRAP_CONTENT));
    mWebView.setWebViewClient(null);
    mWebView.destroy();
    mWebView = null;

    FrameLayout frame = (FrameLayout) findViewById(R.id.camera_parent);
    frame.setLayoutParams(
        new FrameLayout.LayoutParams(
            FrameLayout.LayoutParams.FILL_PARENT, FrameLayout.LayoutParams.WRAP_CONTENT));

    displayNormalMode();
    mMaskFlag = false;
    // setTitle(R.string.app_name);
    setTitle("");

    if (mPreview != null) {
      mPreview.startPreview();
    }
  }
 @Override
 protected void onStop() {
   super.onStop();
   mFacadeManager.getReceiver(EventFacade.class).removeEventObserver(mObserver);
   mWebView.destroy();
   finish();
 }
 @Override
 public void onDestroy() {
   mWebView.getSettings().setBuiltInZoomControls(false);
   super.onDestroy();
   mWebView.setVisibility(View.GONE);
   mWebView.destroy();
 }
  /** Called to instantiate the view. Creates and returns the WebView. */
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

    if (mWebView != null) {
      mWebView.destroy();
    }
    mWebView = new WebView(getActivity());
    View myFragmentView = inflater.inflate(R.layout.news_feed_fragment, container, false);
    progress = ProgressDialog.show(getActivity(), "Loading", "Please wait...", true);

    mWebView.setWebViewClient(
        new InnerWebViewClient() {
          public void onPageFinished(WebView view, String url) {
            if (progress != null) {
              progress.dismiss();
            }
            super.onPageFinished(view, url);
          }
        }); // forces it to open in app
    mWebView.loadUrl(mUrl);
    mIsWebViewAvailable = true;
    WebSettings settings = mWebView.getSettings();
    settings.setJavaScriptEnabled(true);

    return mWebView;
  }
예제 #7
0
 @Override
 public boolean onMenuItemClick(MenuItem item) {
   switch (item.getItemId()) {
     case R.id.menu_reset_webview:
       if (mWebView != null) {
         ViewGroup container = getContainer();
         container.removeView(mWebView);
         mWebView.destroy();
         mWebView = null;
       }
       createAndInitializeWebView();
       return true;
     case R.id.menu_clear_cache:
       if (mWebView != null) {
         mWebView.clearCache(true);
       }
       return true;
     case R.id.menu_about:
       about();
       hideKeyboard(mUrlBar);
       return true;
     default:
       return false;
   }
 }
예제 #8
0
 @Override
 public void onDestroy() {
   // TODO Auto-generated method stub
   super.onDestroy();
   if (mWebView != null) {
     mWebView.destroy();
   }
 }
 @Override
 public void onDestroyView() {
   if (mWebView != null) {
     mWebView.destroy();
   }
   ButterKnife.reset(this);
   super.onDestroyView();
 }
예제 #10
0
 @Override
 public void onDestroy() {
   if (mWebView != null) {
     mWebView.destroy();
     mWebView = null;
   }
   super.onDestroy();
 }
예제 #11
0
 @Override
 protected void onDestroy() {
   super.onDestroy();
   if (mWebView != null) {
     mWebView.removeAllViews();
     mWebView.destroy();
   }
   ButterKnife.unbind(this);
 }
예제 #12
0
 @Override
 public void destroy() {
   super.destroy();
   try {
     if (sConfigCallback != null) sConfigCallback.set(null, null);
   } catch (Exception e) {
     throw new RuntimeException(e);
   }
 }
 @Override
 protected void onDestroy() {
   webView.loadUrl("about:blank");
   webView.destroy();
   webView = null;
   if (listener != null) listener.onPageClose();
   listener = null;
   super.onDestroy();
 }
예제 #14
0
 @Override
 public synchronized void destroy() {
   stopLoading();
   onPause();
   clearHistory();
   setVisibility(GONE);
   removeAllViews();
   destroyDrawingCache();
   super.destroy();
 }
예제 #15
0
 @Override
 protected void onDestroy() {
   super.onDestroy();
   if (wvIt != null) {
     ((ViewGroup) wvIt.getParent()).removeView(wvIt);
     wvIt.destroy();
     wvIt = null;
   }
   mIItHomeArticlePresenter.unsubcrible();
 }
예제 #16
0
 /** Called to instantiate the view. Creates and returns the WebView. */
 @Override
 public View onCreateView(
     LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
   if (mWebView != null) {
     mWebView.destroy();
   }
   mWebView = new WebView(getActivity());
   mIsWebViewAvailable = true;
   return mWebView;
 }
 @Override
 public void onDestroy() {
   super.onDestroy();
   if (mWebView != null) {
     removeViewInLayout(mWebView);
     mWebView.destroyDrawingCache();
     mWebView.destroy();
     mWebView = null;
   }
   ((CycleControllerActivity) getContext()).getCycleController().unregister(this, false);
 }
예제 #18
0
  @Override
  protected void onDestroy() {
    super.onDestroy();

    mWebView.stopLoading();
    ViewGroup webParent = (ViewGroup) mWebView.getParent();
    if (webParent != null) {
      webParent.removeView(mWebView);
    }
    mWebView.destroy();
  }
예제 #19
0
 @Override
 protected void onDestroy() {
   super.onDestroy();
   if (mWebView != null) {
     mWebView.stopLoading();
     mWebView.setWebChromeClient(null);
     mWebView.setWebViewClient(null);
     mWebView.destroy();
     mWebView = null;
   }
 }
예제 #20
0
  //    Added to fix the memory leak caused due to bug in android which stops activities with
  // webview to be GCed.
  //    Refer to this link for more details - http://code.google.com/p/android/issues/detail?id=9375
  @Override
  protected void onDestroy() {
    super.onDestroy();

    if (webView != null) {
      webView.destroy();
      webView = null;
    }

    if (updateController != null) updateController.destroy();
  }
예제 #21
0
  @Override
  protected void onDestroy() {
    super.onDestroy();

    if (webViewer != null) {
      webViewer.setVisibility(View.GONE);
      webViewer.clearCache(true);
      webViewer.clearHistory();
      webViewer.destroy();
    }
  }
예제 #22
0
  @Override
  protected void onDestroy() {
    super.onDestroy();

    try {
      MetaioCloudUtils.unbindDrawables(findViewById(android.R.id.content));

      mWebView.destroy();

    } catch (Exception e) {

    }
  }
예제 #23
0
 /*
  * (non-Javadoc)
  *
  * @see com.mckuai.imc.activity.BaseActivity#finish()
  */
 @Override
 public void finish() {
   // TODO Auto-generated method stub
   if (null != webView) {
     ViewGroup parent = (ViewGroup) webView.getParent();
     if (null != parent) {
       parent.removeAllViews();
     }
     webView.removeAllViews();
     webView.destroy();
   }
   super.finish();
 }
예제 #24
0
 /** 退出系统 * */
 private void exit() {
   contentWebView.loadUrl("about:blank");
   // Activity专用的推退出
   // webView.clearCache(true);
   contentWebView.clearView();
   // webView.clearHistory();
   contentWebView.destroy();
   toolbarWebView.clearHistory();
   finish();
   // 通过结束进程
   android.os.Process.killProcess(android.os.Process.myPid());
   // 通过Activity自带的ActivityService来结束应用程序 系统会将,该包下的
   // ,所有进程,服务,全部杀掉,就可以杀干净了
   ActivityManager am = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE);
   am.restartPackage(getPackageName());
   // 系统级别的退出 其中传递的状态码 表示退出的级别
   System.exit(-1);
 }
 @Override
 protected void onStop() {
   if (Config.LOGD) Log.i(LOGTAG, "onStop");
   if (mService != null && !pinSent) {
     // let the service know that login has been aborted
     if (Config.LOGD) Log.i(LOGTAG, "onStop mService.twitterLogin(null) ...");
     mService.twitterLogin(null);
   }
   if (serviceConnection != null) {
     if (Config.LOGD) Log.i(LOGTAG, "onStop unbindService() ...");
     unbindService(serviceConnection);
     // our service will continue to run, it was running before this activity was started
     serviceConnection = null;
   }
   if (myWebView != null) {
     if (Config.LOGD) Log.i(LOGTAG, "onStop myWebView.destroy() ...");
     myWebView.destroy();
     myWebView = null;
   }
   mService = null;
   super.onStop();
 }
 public void onDestroy() {
   if (mQuotedTextWebView != null) {
     mQuotedTextWebView.destroy();
   }
 }
예제 #27
0
 public void destroy() {
   view.destroy();
 }
예제 #28
0
 @Test
 public void shouldRecordDestroy() {
   assertThat(shadowWebView.wasDestroyCalled()).isFalse();
   webView.destroy();
   assertThat(shadowWebView.wasDestroyCalled()).isTrue();
 }
예제 #29
0
 @Override
 protected void onDestroy() {
   super.onDestroy();
   if (mWebView != null) mWebView.destroy();
   ButterKnife.unbind(this);
 }
예제 #30
0
 @Override
 public void onDestroy() {
   super.onDestroy();
   mWebView.destroy();
 }