Browse Source

Optimize LicenseActivity

master
Victor 11 years ago committed by DF1E
parent
commit
d68ab94bbb
  1. 60
      src/acr/browser/lightning/LicenseActivity.java

60
src/acr/browser/lightning/LicenseActivity.java

@ -9,15 +9,13 @@ import android.net.Uri; @@ -9,15 +9,13 @@ 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 {
public class LicenseActivity extends Activity implements View.OnClickListener {
@Override
protected void onCreate(Bundle savedInstanceState) {
@ -25,41 +23,29 @@ public class LicenseActivity extends Activity { @@ -25,41 +23,29 @@ public class LicenseActivity extends Activity {
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();
}
});
findViewById(R.id.browserLicense).setOnClickListener(this);
findViewById(R.id.licenseAOSP).setOnClickListener(this);
findViewById(R.id.licenseHosts).setOnClickListener(this);
}
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.browserLicense:
actionView("http://www.mozilla.org/MPL/2.0/");
break;
case R.id.licenseAOSP:
actionView("http://www.apache.org/licenses/LICENSE-2.0");
break;
case R.id.licenseHosts:
actionView("http://hosts-file.net/");
break;
}
}
private void actionView(String url) {
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url)));
finish();
}
@Override

Loading…
Cancel
Save