- Fixed links not opening in an external browser.

This commit is contained in:
SerpentSpirale
2021-01-12 17:34:28 +01:00
parent c8c8f53b0e
commit 85d98f8aec

View File

@@ -1,6 +1,8 @@
package net.kdt.pojavlaunch.fragments;
import android.content.Intent;
import android.graphics.Color;
import android.net.Uri;
import android.os.Bundle;
import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
@@ -44,6 +46,15 @@ public class LauncherFragment extends Fragment
}
}
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
if(!url.equals(Tools.URL_HOME + "/changelog.html")){
Intent i = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
startActivity(i);
return true;
}
return false;
}
@RequiresApi(23) //API 23+
@Override
@@ -54,7 +65,16 @@ public class LauncherFragment extends Fragment
}
}
@RequiresApi(23)
@Override
public boolean shouldOverrideUrlLoading(WebView view, WebResourceRequest request) {
if(!request.getUrl().toString().equals(Tools.URL_HOME + "/changelog.html")){
Intent i = new Intent(Intent.ACTION_VIEW, request.getUrl());
startActivity(i);
return true;
}
return false;
}
});
webNews.clearCache(true);
webNews.getSettings().setJavaScriptEnabled(true);