1
0
Fork 0
mirror of https://github.com/gsantner/dandelion synced 2024-11-22 12:22:08 +01:00

Possible fix for webview crashes

This commit is contained in:
vanitasvitae 2016-11-06 17:33:22 +01:00
parent 825d9be1e0
commit b07a1eba1e
Signed by: vanitasvitae
GPG key ID: DCCFB3302C9E4615
2 changed files with 9 additions and 2 deletions

View file

@ -21,6 +21,7 @@ package com.github.dfa.diaspora_android.web;
import android.Manifest; import android.Manifest;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.content.Intent; import android.content.Intent;
import android.content.MutableContextWrapper;
import android.content.pm.PackageManager; import android.content.pm.PackageManager;
import android.graphics.Bitmap; import android.graphics.Bitmap;
import android.net.Uri; import android.net.Uri;
@ -76,7 +77,11 @@ public class BrowserFragment extends ThemedFragment {
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
AppLog.d(this, "onCreateView()"); AppLog.d(this, "onCreateView()");
if (rootLayout == null) { if (rootLayout == null) {
rootLayout = inflater.inflate(R.layout.browser__fragment, container, false); LayoutInflater inflater1 = inflater.cloneInContext(new MutableContextWrapper(getContext()));
rootLayout = inflater1.inflate(R.layout.browser__fragment, container, false);
} else {
MutableContextWrapper context = (MutableContextWrapper) rootLayout.getContext();
context.setBaseContext(getContext());
} }
return rootLayout; return rootLayout;
} }

View file

@ -1,7 +1,9 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent"
xmlns:tools="http://schemas.android.com/tools"
tools:context=".activity.MainActivity">
<com.github.dfa.diaspora_android.web.ContextMenuWebView <com.github.dfa.diaspora_android.web.ContextMenuWebView
android:id="@+id/webView" android:id="@+id/webView"