/*
- * Copyright © 2017-2018 Soren Stoutner <soren@stoutner.com>.
+ * Copyright © 2017-2019 Soren Stoutner <soren@stoutner.com>.
*
* This file is part of Privacy Browser <https://www.stoutner.com/privacy-browser>.
*
// Get the URL.
String url = urlEditText.getText().toString();
- // Get new source data for the URL if it begins with `http`/
+ // Get new source data for the URL if it begins with `http`.
if (url.startsWith("http")) {
new GetSource(this).execute(url);
} else {
@Override
public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
+ // Inflate the menu. This adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.view_source_options_menu, menu);
// Display the menu.
}
}
- // `String` declares the parameters. `Void` does not declare progress units. `String[]` contains the results.
+ // `String` declares the parameters. `Void` does not declare progress units. `SpannableStringBuilder[]` contains the results.
private static class GetSource extends AsyncTask<String, Void, SpannableStringBuilder[]> {
// Create a weak reference to the calling activity.
private WeakReference<Activity> activityWeakReference;
Activity viewSourceActivity = activityWeakReference.get();
// Abort if the activity is gone.
- if ((viewSourceActivity == null) || (viewSourceActivity.isFinishing())) {
+ if ((viewSourceActivity == null) || viewSourceActivity.isFinishing()) {
return;
}
Activity activity = activityWeakReference.get();
// Abort if the activity is gone.
- if ((activity == null) || (activity.isFinishing())) {
+ if ((activity == null) || activity.isFinishing()) {
return new SpannableStringBuilder[] {requestHeadersBuilder, responseMessageBuilder, responseHeadersBuilder, responseBodyBuilder};
}
// `onPostExecute()` operates on the UI thread.
@Override
protected void onPostExecute(SpannableStringBuilder[] viewSourceStringArray){
- // Get a handle the activity.
+ // Get a handle for the activity.
Activity activity = activityWeakReference.get();
// Abort if the activity is gone.
- if ((activity == null) || (activity.isFinishing())) {
+ if ((activity == null) || activity.isFinishing()) {
return;
}