Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 14 additions & 5 deletions src/itkach/aard2/ArticleWebView.java
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ public void onPageStarted(WebView view, String url, Bitmap favicon) {
List<Long> tsList = new ArrayList<Long>();
tsList.add(System.currentTimeMillis());
times.put(url, tsList);
view.loadUrl("javascript:" + styleSwitcherJs);
view.evaluateJavascript(styleSwitcherJs, null);
try {
timer.schedule(applyStylePref, 250, 200);
} catch (IllegalStateException ex) {
Expand Down Expand Up @@ -192,8 +192,8 @@ public void onPageFinished(WebView view, String url) {
else {
Log.w(TAG, "onPageFinished: Unexpected page finished event for " + url);
}
view.loadUrl("javascript:" + styleSwitcherJs +
";$SLOB.setStyleTitles($styleSwitcher.getTitles())");
view.evaluateJavascript(styleSwitcherJs +
";$SLOB.setStyleTitles($styleSwitcher.getTitles())", null);
applyStylePref();
}

Expand Down Expand Up @@ -232,7 +232,11 @@ public boolean shouldOverrideUrlLoading(WebView view,

if (isExternal(uri)) {
Intent browserIntent = new Intent(Intent.ACTION_VIEW, uri);
getContext().startActivity(browserIntent);
try {
getContext().startActivity(browserIntent);
} catch (android.content.ActivityNotFoundException e) {
Log.w(TAG, "No app to handle " + uri, e);
}
return true;
}

Expand All @@ -252,7 +256,12 @@ public boolean shouldOverrideUrlLoading(WebView view,
if (scheme.equals("http") && host.equals(LOCALHOST) && uri.getQueryParameter("blob") == null) {
Intent intent = new Intent(getContext(), ArticleCollectionActivity.class);
intent.setData(uri);
getContext().startActivity(intent);
try {
getContext().startActivity(intent);
} catch (android.content.ActivityNotFoundException e) {
Log.w(TAG, "Failed to open ArticleCollectionActivity for " + uri, e);
return false;
}
Log.d(TAG, "Overriding loading of " + url);
return true;
}
Expand Down