mirror of
https://github.com/kiwix/kiwix-android.git
synced 2025-09-17 03:16:27 -04:00
set action bar title to article title if available
This commit is contained in:
parent
7d4abceacc
commit
aa93e08d20
@ -172,7 +172,7 @@ public class KiwixMobileActivity extends Activity {
|
||||
// (i.p. internal urls load in webview, external urls in browser)
|
||||
// as currently no custom setWebViewClient required it is commented
|
||||
webView.setWebViewClient(new WebViewClient() {
|
||||
|
||||
|
||||
@Override
|
||||
public boolean shouldOverrideUrlLoading(WebView view, String url) {
|
||||
if (url.startsWith(ZimContentProvider.CONTENT_URI.toString())) {
|
||||
@ -184,12 +184,21 @@ public class KiwixMobileActivity extends Activity {
|
||||
startActivity(intent);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) {
|
||||
String errorString = String.format(getResources().getString(R.string.error_articleurlnotfound), failingUrl);
|
||||
//TODO apparently screws up back/forward
|
||||
webView.loadDataWithBaseURL("file://error","<html><body>"+errorString+"</body></html>", "text/html", "utf-8", failingUrl);
|
||||
String title = getResources().getString(R.string.app_name);
|
||||
getActionBar().setTitle(title);
|
||||
}
|
||||
|
||||
public void onPageFinished(WebView view, String url) {
|
||||
String title = getResources().getString(R.string.app_name);
|
||||
if (webView.getTitle()!=null && !webView.getTitle().isEmpty())
|
||||
title = webView.getTitle();
|
||||
getActionBar().setTitle(title);
|
||||
}
|
||||
});
|
||||
|
||||
//Pinch to zoom
|
||||
|
Loading…
x
Reference in New Issue
Block a user