Fixed URL handling in ItemFragment

Open external activity instead of loading it inside the app
This commit is contained in:
daniel oeh 2015-01-08 13:57:37 +01:00
parent b89b92e6ca
commit f467d3eccc
1 changed files with 15 additions and 1 deletions

View File

@ -1,6 +1,7 @@
package de.danoeh.antennapod.fragment;
import android.annotation.TargetApi;
import android.content.ActivityNotFoundException;
import android.content.Intent;
import android.content.res.TypedArray;
import android.net.Uri;
@ -181,7 +182,20 @@ public class ItemFragment extends Fragment implements LoaderManager.LoaderCallba
webvDescription.getSettings().setLayoutAlgorithm(
WebSettings.LayoutAlgorithm.NARROW_COLUMNS);
webvDescription.getSettings().setLoadWithOverviewMode(true);
webvDescription.setWebViewClient(new WebViewClient());
webvDescription.setWebViewClient(new WebViewClient() {
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
try {
startActivity(intent);
} catch (ActivityNotFoundException e) {
e.printStackTrace();
return true;
}
return true;
}
});
imgvCover = (ImageView) header.findViewById(R.id.imgvCover);
progbarDownload = (ProgressBar) header.findViewById(R.id.progbarDownload);