You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
88 lines
2.5 KiB
88 lines
2.5 KiB
10 years ago
|
/*
|
||
|
* Copyright 2014 A.C.R. Development
|
||
|
*/
|
||
|
package acr.browser.lightning;
|
||
|
|
||
|
import android.content.Intent;
|
||
|
import android.content.pm.PackageInfo;
|
||
|
import android.content.pm.PackageManager.NameNotFoundException;
|
||
|
import android.net.Uri;
|
||
|
import android.os.Bundle;
|
||
9 years ago
|
import android.support.v7.widget.Toolbar;
|
||
10 years ago
|
import android.view.MenuItem;
|
||
|
import android.view.View;
|
||
|
import android.view.View.OnClickListener;
|
||
|
import android.widget.RelativeLayout;
|
||
|
import android.widget.TextView;
|
||
|
|
||
9 years ago
|
public class AboutSettingsActivity extends ThemableSettingsActivity implements OnClickListener {
|
||
10 years ago
|
|
||
|
private int mEasterEggCounter;
|
||
|
|
||
|
@Override
|
||
|
protected void onCreate(Bundle savedInstanceState) {
|
||
|
super.onCreate(savedInstanceState);
|
||
|
setContentView(R.layout.about_settings);
|
||
|
|
||
9 years ago
|
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
|
||
|
setSupportActionBar(toolbar);
|
||
|
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||
9 years ago
|
|
||
10 years ago
|
initialize();
|
||
|
}
|
||
|
|
||
|
private void initialize() {
|
||
9 years ago
|
String code = "1.0";
|
||
10 years ago
|
try {
|
||
|
PackageInfo p = getPackageManager().getPackageInfo(getPackageName(), 0);
|
||
|
code = p.versionName;
|
||
|
} catch (NameNotFoundException e) {
|
||
|
e.printStackTrace();
|
||
|
}
|
||
|
|
||
9 years ago
|
TextView versionCode = (TextView) findViewById(R.id.versionCode);
|
||
|
versionCode.setText(code);
|
||
10 years ago
|
|
||
9 years ago
|
RelativeLayout licenses = (RelativeLayout) findViewById(R.id.layoutLicense);
|
||
10 years ago
|
RelativeLayout source = (RelativeLayout) findViewById(R.id.layoutSource);
|
||
9 years ago
|
RelativeLayout version = (RelativeLayout) findViewById(R.id.layoutVersion);
|
||
|
licenses.setOnClickListener(this);
|
||
|
source.setOnClickListener(this);
|
||
|
version.setOnClickListener(this);
|
||
10 years ago
|
}
|
||
|
|
||
9 years ago
|
@Override
|
||
|
public void onClick(View view) {
|
||
|
switch (view.getId()) {
|
||
|
case R.id.layoutLicense:
|
||
|
// NOTE: In order to comply legally with open source licenses,
|
||
|
// it is advised that you leave this code so that the License
|
||
|
// Activity may be viewed by the user.
|
||
|
startActivity(new Intent(this, LicenseActivity.class));
|
||
|
break;
|
||
|
case R.id.layoutSource:
|
||
|
startActivity(new Intent(Intent.ACTION_VIEW,
|
||
|
Uri.parse("http://twitter.com/RestainoAnthony"), this, MainActivity.class));
|
||
|
finish();
|
||
|
break;
|
||
|
case R.id.layoutVersion:
|
||
10 years ago
|
mEasterEggCounter++;
|
||
|
if (mEasterEggCounter == 10) {
|
||
9 years ago
|
startActivity(new Intent(Intent.ACTION_VIEW,
|
||
|
Uri.parse("http://imgs.xkcd.com/comics/compiling.png"), this,
|
||
10 years ago
|
MainActivity.class));
|
||
|
finish();
|
||
|
mEasterEggCounter = 0;
|
||
|
}
|
||
9 years ago
|
break;
|
||
|
}
|
||
10 years ago
|
}
|
||
|
|
||
9 years ago
|
@Override
|
||
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||
|
finish();
|
||
|
return true;
|
||
10 years ago
|
}
|
||
|
|
||
|
}
|