/*
 * Copyright 2014 A.C.R. Development
 */
package acr.browser.lightning;

import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.LinearLayout;

/*
 *NOTE: This activity must not be removed in order to comply with the Mozilla Public License v. 2.0 
 *under which this code is licensed. Unless you plan on providing other attribution in the app to 
 *the original source in another visible way, it is advised against the removal of this Activity.
 */
public class LicenseActivity extends Activity {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.license_activity);
		getActionBar().setHomeButtonEnabled(true);
		getActionBar().setDisplayHomeAsUpEnabled(true);
		LinearLayout thunder = (LinearLayout) findViewById(R.id.browserLicense);
		LinearLayout aosp = (LinearLayout) findViewById(R.id.licenseAOSP);
		LinearLayout hosts = (LinearLayout) findViewById(R.id.licenseHosts);
		thunder.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {
				startActivity(new Intent(Intent.ACTION_VIEW, Uri
						.parse("http://www.mozilla.org/MPL/2.0/")));
				finish();
			}

		});
		aosp.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {
				startActivity(new Intent(Intent.ACTION_VIEW, Uri
						.parse("http://www.apache.org/licenses/LICENSE-2.0")));
				finish();
			}

		});
		
		hosts.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {
				startActivity(new Intent(Intent.ACTION_VIEW, Uri
						.parse("http://hosts-file.net/")));
				finish();
			}

		});

	}

	@Override
	public boolean onOptionsItemSelected(MenuItem item) {
		finish();
		return super.onOptionsItemSelected(item);
	}

}

@@ -238,86 +238,8 @@
 iew;
-%0Aimport android.view.View.OnClickListener;%0Aimport android.widget.LinearLayout;
 %0A%0A/*
@@ -587,16 +587,48 @@
 ctivity 
+implements View.OnClickListener 
 %7B%0A%0A%09@Ove
@@ -871,188 +871,129 @@
 ;%0A%09%09
-LinearLayout thunder = (LinearLayout) findViewById(R.id.browserLicense);%0A%09%09LinearLayout aosp = (LinearLayout) findViewById(R.id.licenseAOSP);%0A%09%09LinearLayout hosts = (LinearLayout) 
+findViewById(R.id.browserLicense).setOnClickListener(this);%0A%09%09findViewById(R.id.licenseAOSP).setOnClickListener(this);%0A%09%09
 find
@@ -1023,19 +1023,8 @@
 sts)
-;%0A%09%09thunder
 .set
@@ -1043,35 +1043,20 @@
 ner(
-new OnClickListener() %7B%0A%0A%09%09
+this);%0A%09%7D%0A%09%0A
 %09@Ov
@@ -1054,35 +1054,36 @@
 %09%7D%0A%09%0A%09@Override%0A
-%09%09%09
+    
 public void onCl
@@ -1101,480 +1101,449 @@
  %7B%0A%09
-%09%09%09startActivity(new Intent(Intent.ACTION_VIEW, Uri%0A%09%09%09%09%09%09.parse(%22http://www.mozilla.org/MPL/2.0/%22)));%0A%09%09%09%09finish();%0A%09%09%09%7D%0A%0A%09%09%7D);%0A%09%09aosp.setOnClickListener(new OnClickListener() %7B%0A%0A%09%09%09@Override%0A%09%09%09public void onClick(View v) %7B%0A%09%09%09%09startActivity(new Intent(Intent.ACTION_VIEW, Uri%0A%09%09%09%09%09%09.parse(%22http://www.apache.org/licenses/LICENSE-2.0%22)));%0A%09%09%09%09finish();%0A%09%09%09%7D%0A%0A%09%09%7D);%0A%09%09%0A%09%09hosts.setOnClickListener(new OnClickListener() %7B%0A%0A%09%09%09@Override%0A%09%09%09public void onClick(View v
+    switch (v.getId()) %7B%0A%09        case R.id.browserLicense:%0A                actionView(%22http://www.mozilla.org/MPL/2.0/%22);%0A                break;%0A%09        case R.id.licenseAOSP:%0A%09            actionView(%22http://www.apache.org/licenses/LICENSE-2.0%22);%0A                break;%0A%09        case R.id.licenseHosts:%0A%09            actionView(%22http://hosts-file.net/%22);%0A                break;%0A        %7D%0A    %7D%0A%09%0A%09private void actionView(String url
 ) %7B%0A%09
-%09%09%09
+    
 star
@@ -1590,77 +1590,40 @@
  Uri
-%0A%09%09%09%09%09%09.parse(%22http://hosts-file.net/%22)));%0A%09%09%09%09finish();%0A%09%09%09%7D%0A%0A%09%09%7D);%0A
+.parse(url)));%0A        finish();
 %0A%09%7D%0A

Optimize LicenseActivity