3030import android .webkit .WebChromeClient ;
3131import android .webkit .WebView ;
3232import android .webkit .WebViewClient ;
33+ import android .widget .FrameLayout ;
3334import android .widget .ImageButton ;
3435import android .widget .LinearLayout ;
3536import android .widget .ProgressBar ;
@@ -281,6 +282,7 @@ protected void getOptions() {
281282 protected TextView menuCopyLinkTv ;
282283 protected LinearLayout menuOpenWith ;
283284 protected TextView menuOpenWithTv ;
285+ protected FrameLayout webLayout ;
284286
285287 protected void bindViews () {
286288 coordinatorLayout = (CoordinatorLayout ) findViewById (R .id .coordinatorLayout );
@@ -298,7 +300,7 @@ protected void bindViews() {
298300 more = (ImageButton ) findViewById (R .id .more );
299301
300302 swipeRefreshLayout = (SwipeRefreshLayout ) findViewById (R .id .swipeRefreshLayout );
301- webView = ( WebView ) findViewById ( R . id . webView );
303+
302304
303305 gradient = findViewById (R .id .gradient );
304306 divider = findViewById (R .id .divider );
@@ -316,6 +318,9 @@ protected void bindViews() {
316318 menuCopyLinkTv = (TextView ) findViewById (R .id .menuCopyLinkTv );
317319 menuOpenWith = (LinearLayout ) findViewById (R .id .menuOpenWith );
318320 menuOpenWithTv = (TextView ) findViewById (R .id .menuOpenWithTv );
321+ webLayout =(FrameLayout )findViewById (R .id .webLayout );
322+ webView = new WebView (getApplicationContext ());
323+ webLayout .addView (webView );
319324 }
320325
321326 protected void layoutViews () {
@@ -882,7 +887,9 @@ public void onConfigurationChanged(Configuration newConfig) {
882887 @ Override
883888 protected void onDestroy () {
884889 super .onDestroy ();
885- if (webView != null )
890+ if (webLayout !=null ) {
891+ webLayout .removeAllViews ();
886892 webView .destroy ();
893+ }
887894 }
888- }
895+ }
0 commit comments