From d220ed3ac4a113eb7a7f79e79fa51c8441b29ea4 Mon Sep 17 00:00:00 2001 From: Philipp Schaefer Date: Sun, 16 Jun 2013 13:49:57 +0200 Subject: [PATCH] more code formatting --- .../iitc_mobile/IITC_DeviceAccountLogin.java | 23 +++++++++++-------- .../cradle/iitc_mobile/IITC_JSInterface.java | 9 +++++--- .../com/cradle/iitc_mobile/IITC_Mobile.java | 13 +++++++---- .../iitc_mobile/IITC_SettingsFragment.java | 3 ++- .../com/cradle/iitc_mobile/IITC_WebView.java | 6 +++-- 5 files changed, 33 insertions(+), 21 deletions(-) diff --git a/mobile/src/com/cradle/iitc_mobile/IITC_DeviceAccountLogin.java b/mobile/src/com/cradle/iitc_mobile/IITC_DeviceAccountLogin.java index e9a1f79e..a4ffe34d 100644 --- a/mobile/src/com/cradle/iitc_mobile/IITC_DeviceAccountLogin.java +++ b/mobile/src/com/cradle/iitc_mobile/IITC_DeviceAccountLogin.java @@ -63,10 +63,11 @@ public class IITC_DeviceAccountLogin implements AccountManagerCallback { private final WebView mWebView; /** - * This listener is invoked when an item in the account list is selected. (It is also used when the 'cancel' button - * is clicked, (in which case `index` is <0) + * This listener is invoked when an item in the account list is selected. + * (It is also used when the 'cancel' button is clicked, (in which case `index` is <0) */ - private final DialogInterface.OnClickListener onClickListener = new DialogInterface.OnClickListener() { + private final DialogInterface.OnClickListener onClickListener = + new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int index) { if (index >= 0 && index < mAccounts.length) { @@ -77,7 +78,8 @@ public class IITC_DeviceAccountLogin implements AccountManagerCallback { } }; - public IITC_DeviceAccountLogin(IITC_Mobile activity, WebView webView, WebViewClient webViewClient) { + public IITC_DeviceAccountLogin(IITC_Mobile activity, WebView webView, + WebViewClient webViewClient) { mActivity = activity; mWebView = webView; mAccountManager = AccountManager.get(activity); @@ -142,16 +144,17 @@ public class IITC_DeviceAccountLogin implements AccountManagerCallback { try { Intent launch = (Intent) value.getResult().get(AccountManager.KEY_INTENT); if (launch != null) { - // There is a reason we need to start the given activity if we want an authentication token. - // (Could be user confirmation or something else. Whatever, we have to start it) - // IITC_Mobile will call it using startActivityForResult + // There is a reason we need to start the given activity if we want an + // authentication token. (Could be user confirmation or something else. Whatever, + // we have to start it) IITC_Mobile will call it using startActivityForResult mActivity.startLoginActivity(launch); return; } String result = value.getResult().getString(AccountManager.KEY_AUTHTOKEN); if (result != null) { - // authentication succeded, we can load the given url, which will redirect back to the intel map + // authentication succeded, we can load the given url, which will redirect + // back to the intel map mWebView.loadUrl(result); mActivity.loginSucceeded(); } else { @@ -165,8 +168,8 @@ public class IITC_DeviceAccountLogin implements AccountManagerCallback { /** * start authentication *

- * if we already have a username (e.g. because the existing login has timed out), we can directly start - * authentication if an account with that username is found. + * if we already have a username (e.g. because the existing login has timed out), + * we can directly start authentication if an account with that username is found. */ public void startLogin(String realm, String accountName, String args) { mAccounts = mAccountManager.getAccountsByType(realm); diff --git a/mobile/src/com/cradle/iitc_mobile/IITC_JSInterface.java b/mobile/src/com/cradle/iitc_mobile/IITC_JSInterface.java index 0cf57fc4..8c1527af 100644 --- a/mobile/src/com/cradle/iitc_mobile/IITC_JSInterface.java +++ b/mobile/src/com/cradle/iitc_mobile/IITC_JSInterface.java @@ -120,7 +120,8 @@ public class IITC_JSInterface { /* * the layer strings have a form like: - * [{"layerId":27,"name":"MapQuest OSM","active":true},{"layerId":28,"name":"Default Ingress Map","active":false}] + * [{"layerId":27,"name":"MapQuest OSM","active":true}, + * {"layerId":28,"name":"Default Ingress Map","active":false}] * Put it in a JSONArray and parse it */ JSONArray base_layersJSON = null; @@ -215,7 +216,8 @@ public class IITC_JSInterface { @Override public void onClick(DialogInterface dialog, int which, boolean isChecked) { // activate clicked layer - ((IITC_Mobile) context).getWebView().loadUrl("javascript: window.layerChooser.showLayer(" + ((IITC_Mobile) context).getWebView().loadUrl("javascript: " + + "window.layerChooser.showLayer(" + layer_ids.get(overlay_layers[which]) + "," + overlay_is_active[which] + ");"); } @@ -246,7 +248,8 @@ public class IITC_JSInterface { @Override public void onClick(DialogInterface dialog, int which) { // activate clicked layer - ((IITC_Mobile) context).getWebView().loadUrl("javascript: window.layerChooser.showLayer(" + ((IITC_Mobile) context).getWebView().loadUrl("javascript: " + + "window.layerChooser.showLayer(" + layer_ids.get(base_layers[which]) + "," + true + ");"); active_base_layer = which; diff --git a/mobile/src/com/cradle/iitc_mobile/IITC_Mobile.java b/mobile/src/com/cradle/iitc_mobile/IITC_Mobile.java index b93dcb5e..908dd98c 100644 --- a/mobile/src/com/cradle/iitc_mobile/IITC_Mobile.java +++ b/mobile/src/com/cradle/iitc_mobile/IITC_Mobile.java @@ -223,7 +223,8 @@ public class IITC_Mobile extends Activity { @Override protected void onStop() { - ConnectivityManager conMan = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE); + ConnectivityManager conMan = + (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo mobile = conMan .getNetworkInfo(ConnectivityManager.TYPE_MOBILE); @@ -284,7 +285,8 @@ public class IITC_Mobile extends Activity { "selector.remove();"); return; } - // exit fullscreen mode if it is enabled and action bar is disabled or the back stack is empty + // exit fullscreen mode if it is enabled and action bar is disabled + // or the back stack is empty if (fullscreen_mode && (backStack.isEmpty() || fullscreen_actionbar)) { this.toggleFullscreen(); } else if (!backStack.isEmpty()) { @@ -405,7 +407,8 @@ public class IITC_Mobile extends Activity { iitc_view.loadUrl("javascript: window.show('map');"); // get location from network by default if (!is_loc_enabled) { - iitc_view.loadUrl("javascript: window.map.locate({setView : true, maxZoom: 15});"); + iitc_view.loadUrl("javascript: " + + "window.map.locate({setView : true, maxZoom: 15});"); // if gps location is displayed we can use a better location without any costs } else { if (last_location != null) @@ -508,8 +511,8 @@ public class IITC_Mobile extends Activity { } /** - * It can occur that in order to authenticate, an external activity has to be launched. (This could for example be a - * confirmation dialog.) + * It can occur that in order to authenticate, an external activity has to be launched. + * (This could for example be a confirmation dialog.) */ public void startLoginActivity(Intent launch) { startActivityForResult(launch, REQUEST_LOGIN); // REQUEST_LOGIN is to recognize the result diff --git a/mobile/src/com/cradle/iitc_mobile/IITC_SettingsFragment.java b/mobile/src/com/cradle/iitc_mobile/IITC_SettingsFragment.java index e72172ad..f5fab725 100644 --- a/mobile/src/com/cradle/iitc_mobile/IITC_SettingsFragment.java +++ b/mobile/src/com/cradle/iitc_mobile/IITC_SettingsFragment.java @@ -128,7 +128,8 @@ public class IITC_SettingsFragment extends PreferenceFragment { } } - void addPluginPreference(PreferenceScreen root, String src, String plugin_key, boolean additional) { + void addPluginPreference(PreferenceScreen root, String src, String plugin_key, + boolean additional) { // now parse plugin name, description and category String header = src.substring(src.indexOf("==UserScript=="), diff --git a/mobile/src/com/cradle/iitc_mobile/IITC_WebView.java b/mobile/src/com/cradle/iitc_mobile/IITC_WebView.java index e1da083a..7da1058a 100644 --- a/mobile/src/com/cradle/iitc_mobile/IITC_WebView.java +++ b/mobile/src/com/cradle/iitc_mobile/IITC_WebView.java @@ -95,7 +95,8 @@ public class IITC_WebView extends WebView { public void loadUrl(String url) { // if in edit text mode, don't load javascript otherwise the keyboard closes. HitTestResult testResult = this.getHitTestResult(); - if (url.startsWith("javascript:") && testResult != null && testResult.getType() == HitTestResult.EDIT_TEXT_TYPE) { + if (url.startsWith("javascript:") && testResult != null && + testResult.getType() == HitTestResult.EDIT_TEXT_TYPE) { // let window.show(...) interupt input // window.show(...) is called if one of the action bar buttons // is clicked @@ -151,7 +152,8 @@ public class IITC_WebView extends WebView { // is ticked as mobile hotspot or not. // --> IITC_WebView.isConnectedToWifi should return 'false' if connected to mobile hotspot if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { - return ((wifi.getState() == NetworkInfo.State.CONNECTED) && !conMan.isActiveNetworkMetered()); + return ((wifi.getState() == NetworkInfo.State.CONNECTED) && + !conMan.isActiveNetworkMetered()); } return (wifi.getState() == NetworkInfo.State.CONNECTED); }