Merge pull request #3168 from ByteHamster/about-open-browser

About screen: Open web links in browser
This commit is contained in:
Martin Fietz 2019-05-19 11:34:17 +02:00 committed by GitHub
commit 751670a659
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 2 deletions

View File

@ -1,7 +1,9 @@
package de.danoeh.antennapod.activity; package de.danoeh.antennapod.activity;
import android.content.Intent;
import android.content.res.TypedArray; import android.content.res.TypedArray;
import android.graphics.Color; import android.graphics.Color;
import android.net.Uri;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.support.v7.app.AppCompatActivity; import android.support.v7.app.AppCompatActivity;
@ -54,12 +56,15 @@ public class AboutActivity extends AppCompatActivity {
@Override @Override
public boolean shouldOverrideUrlLoading(WebView view, String url) { public boolean shouldOverrideUrlLoading(WebView view, String url) {
if (!url.startsWith("http")) { if (url.startsWith("http")) {
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
startActivity(browserIntent);
return true;
} else {
url = url.replace("file:///android_asset/", ""); url = url.replace("file:///android_asset/", "");
loadAsset(url); loadAsset(url);
return true; return true;
} }
return false;
} }
}); });