* moved necessary resets to from reloadIITC() to loadURL()

* better url parameter add
* fixed wrong return value of shouldOverrideUrlLoading()
This commit is contained in:
Philipp Schaefer 2014-08-18 23:28:52 +02:00
parent a687ab82ea
commit 0a461ab753
2 changed files with 8 additions and 14 deletions

View File

@ -623,29 +623,24 @@ public class IITC_Mobile extends Activity
} }
public void reloadIITC() { public void reloadIITC() {
mNavigationHelper.reset();
mMapSettings.reset();
mUserLocation.reset();
mIitcWebView.getWebViewClient().reset();
mBackStack.clear();
// iitc starts on map after reload
mCurrentPane = Pane.MAP;
loadUrl(mIntelUrl); loadUrl(mIntelUrl);
mReloadNeeded = false; mReloadNeeded = false;
} }
// vp=f enables mDesktopMode mode...vp=m is the default mobile view // vp=f enables mDesktopMode mode...vp=m is the default mobile view
private String addUrlParam(final String url) { private String addUrlParam(final String url) {
if (mDesktopMode) { return url + (url.contains("?") ? '&' : '?') + "vp=" + (mDesktopMode ? 'f' : 'm');
return (url + "?vp=f");
} else {
return (url + "?vp=m");
}
} }
// inject the iitc-script and load the intel url // inject the iitc-script and load the intel url
// plugins are injected onPageFinished // plugins are injected onPageFinished
public void loadUrl(String url) { public void loadUrl(String url) {
mNavigationHelper.reset();
mMapSettings.reset();
mUserLocation.reset();
mIitcWebView.getWebViewClient().reset();
mBackStack.clear();
mCurrentPane = Pane.MAP;
setLoadingState(true); setLoadingState(true);
url = addUrlParam(url); url = addUrlParam(url);
mIitcWebView.loadUrl(url); mIitcWebView.loadUrl(url);

View File

@ -232,12 +232,11 @@ public class IITC_WebViewClient extends WebViewClient {
Log.d("should be an internal clicked position link...reload script for: " + url); Log.d("should be an internal clicked position link...reload script for: " + url);
mIitc.loadUrl(url); mIitc.loadUrl(url);
} }
return false;
} else { } else {
Log.d("no ingress intel link, start external app to load url: " + url); Log.d("no ingress intel link, start external app to load url: " + url);
final Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url)); final Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
mIitc.startActivity(intent); mIitc.startActivity(intent);
return true;
} }
return true;
} }
} }