Commit e02b0c9b authored by Matyáš Latner's avatar Matyáš Latner

#238 Oprava memory leaku v encyklopedii

parent 89172b6f
......@@ -16,9 +16,9 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<WebView xmlns:android="http://schemas.android.com/apk/res/android"
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/webView_content"
android:id="@+id/webView_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white" />
......@@ -73,10 +73,10 @@ public abstract class AbstractMenuFragment extends Fragment {
private class FragmentDataPreloader extends AsyncTask<Integer, Void, View> {
View layoutView = null;
@Override
protected View doInBackground(final Integer... params) {
View layoutView = null;
// INTRO SOUND
if (introSoundPath != null) {
......@@ -133,6 +133,7 @@ public abstract class AbstractMenuFragment extends Fragment {
});
onFragmentResume();
}
loaderTask = null;
}
protected void fragmentContentVisible() {
......
......@@ -19,6 +19,7 @@
package cz.nic.tablexia.menu.mainmenu.screen.encyclopedia;
import android.view.View;
import android.view.ViewGroup;
import android.webkit.WebView;
import cz.nic.tablexia.R;
import cz.nic.tablexia.menu.mainmenu.screen.AbstractMenuFragment;
......@@ -40,9 +41,11 @@ public abstract class WebViewFragment extends AbstractMenuFragment {
@Override
protected void syncFragmentDataLoad(View layoutView) {
View webView = layoutView.findViewById(R.id.webView_content);
if (webView != null) {
mWebView = (WebView) webView;
View containerView = layoutView.findViewById(R.id.webView_container);
if (containerView != null) {
ViewGroup container = (ViewGroup) containerView;
mWebView = new WebView(getTablexiaContext());
container.addView(mWebView);
mWebView.loadUrl(getUrl());
mWebView.getSettings().setJavaScriptEnabled(true);
mWebView.getSettings().setSaveFormData(true);
......@@ -50,6 +53,12 @@ public abstract class WebViewFragment extends AbstractMenuFragment {
mWebView.setWebViewClient(new OpenBrowserWebViewClient(getActivity()));
}
}
@Override
public void onDestroyView() {
super.onDestroyView();
mWebView = null;
}
@Override
public void onFragmentResume() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment