|
|
@@ -6,6 +6,7 @@ import android.content.Intent;
|
|
|
import android.graphics.Bitmap;
|
|
|
import android.net.Uri;
|
|
|
import android.os.Build;
|
|
|
+import android.os.Bundle;
|
|
|
import android.os.Environment;
|
|
|
import android.provider.MediaStore;
|
|
|
import android.support.v7.app.ActionBar;
|
|
|
@@ -17,6 +18,7 @@ import android.view.View;
|
|
|
import android.view.ViewGroup;
|
|
|
import android.view.animation.Animation;
|
|
|
import android.view.animation.AnimationUtils;
|
|
|
+import android.widget.FrameLayout;
|
|
|
import android.widget.ImageView;
|
|
|
import android.widget.ProgressBar;
|
|
|
|
|
|
@@ -77,7 +79,8 @@ import static android.app.Activity.RESULT_OK;
|
|
|
*/
|
|
|
public class FgtWebX5 extends BaseFgtWebX5 {
|
|
|
|
|
|
- @BindView(R.id.webview)
|
|
|
+ @BindView(R.id.web_container)
|
|
|
+ FrameLayout webContainer;
|
|
|
WebView mWebView;
|
|
|
@BindView(R.id.act_web_loading_pb)
|
|
|
ProgressBar act_web_loading_pb;
|
|
|
@@ -99,6 +102,8 @@ public class FgtWebX5 extends BaseFgtWebX5 {
|
|
|
}
|
|
|
|
|
|
public void initView() {
|
|
|
+ mWebView = new WebView(SheepApp.getInstance());
|
|
|
+ webContainer.addView(mWebView, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
|
|
|
ViewUtil.setImage(act_web_loading_iv, R.drawable.gif_sheep_loading);
|
|
|
|
|
|
if (webParams == null) {
|
|
|
@@ -200,15 +205,26 @@ public class FgtWebX5 extends BaseFgtWebX5 {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
}
|
|
|
+ super.onDestroy();
|
|
|
+ }
|
|
|
+
|
|
|
+ public void onDetach() {
|
|
|
if (mWebView != null) {
|
|
|
- if (mWebView.getParent() != null) {
|
|
|
- ((ViewGroup) mWebView.getParent()).removeView(mWebView);
|
|
|
+ try {
|
|
|
+ if (mWebView.getParent() != null) {
|
|
|
+ ((ViewGroup) mWebView.getParent()).removeView(mWebView);
|
|
|
+ }
|
|
|
+ mWebView.setVisibility(View.GONE);
|
|
|
+ mWebView.removeAllViews();
|
|
|
+ mWebView.loadUrl("about:blank");
|
|
|
+ mWebView.freeMemory();
|
|
|
+ mWebView.destroy();
|
|
|
+ } catch (IllegalArgumentException e) {
|
|
|
+ LogUtil.logI(e.getMessage());
|
|
|
}
|
|
|
- mWebView.setVisibility(View.GONE);
|
|
|
- mWebView.removeAllViews();
|
|
|
- mWebView.destroy();
|
|
|
+ mWebView = null;
|
|
|
}
|
|
|
- super.onDestroy();
|
|
|
+ super.onDetach();
|
|
|
}
|
|
|
|
|
|
/**
|