Luke Plant avatar Luke Plant committed 91e3ac5

Corrected some comments/code formatting

Comments (0)

Files changed (1)

src/net/learnscripture/webviewapp/Dashboard.java

 import android.webkit.WebViewClient;
 import android.widget.ProgressBar;
 
-/**
- * An example full-screen activity that shows and hides the system UI (i.e.
- * status bar and navigation/system bar) with user interaction.
- *
- * @see SystemUiHider
- */
 public class Dashboard extends Activity {
 
 	public String BASE_URL = "http://learnscripture.net/";
 	public String CONTACT_URL = BASE_URL + "contact/";
 
 	private JavascriptInterface jsInterface;
-	
-	@SuppressLint("SetJavaScriptEnabled") @Override
+
+	@SuppressLint("SetJavaScriptEnabled")
+	@Override
 	protected void onCreate(Bundle savedInstanceState) {
 		super.onCreate(savedInstanceState);
 		setContentView(R.layout.activity_dashboard);
 
 		// Progress bar.
 		// With full screen app, window progress bar (FEATURE_PROGRESS) doesn't seem to show,
-		// so we add an explicit one.
+		// so we use an explicitly created one.
 		final ProgressBar progressBar = (ProgressBar) findViewById(R.id.progressbar);
 
 		engine.setWebChromeClient(new WebChromeClient() {
 		engine.getSettings().setJavaScriptEnabled(true);
 		jsInterface = new JavascriptInterface();
 		try {
-		    ComponentName comp = new ComponentName(this, Dashboard.class);
-		    PackageInfo pinfo = getPackageManager().getPackageInfo(comp.getPackageName(), 0);
+			ComponentName comp = new ComponentName(this, Dashboard.class);
+			PackageInfo pinfo = getPackageManager().getPackageInfo(comp.getPackageName(), 0);
 			jsInterface.versionCode = pinfo.versionCode;
 		} catch(android.content.pm.PackageManager.NameNotFoundException e) {
 		}
-		
+
 		engine.addJavascriptInterface(jsInterface, "androidlearnscripture");
 		engine.loadUrl(BASE_URL);
 	}
 		@Override
 		public boolean shouldOverrideUrlLoading(WebView view, String url) {
 			if (url.startsWith(BASE_URL) || url.startsWith("javascript:")) {
+				// handle by the WebView
 				return false;
 			} else if (url.startsWith("mailto:")) {
 				MailTo mt = MailTo.parse(url);
 				view.reload();
 				return true;
 			} else {
-				// We want to give user the choice of which browser, if appropriate
+				// Use external browser for anything not on this site
 				Intent i = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
 				view.getContext().startActivity(i);
 				return true;
 		}
 	}
 
-	// The method of IJavascriptHandler are called from javascript
+	// The methods of JavascriptInterface are called from javascript
 	final class JavascriptInterface {
 		public boolean enablePreferencesMenu = false;
 		public boolean modalIsVisible = false;
 		public int versionCode = 0;
-		
+
 		public void setEnablePreferencesMenu() {
 			enablePreferencesMenu = true;
 		}
 		public void setModalIsVisible(boolean visible) {
 			modalIsVisible = visible;
 		}
-		
+
+		// This is useful for allowing the web site to be able to detect
+		// old app versions and prompt the user to upgrade.
 		public int getVersionCode() {
 			return versionCode;
 		}
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.