import android.app.Activity;
import android.app.AlertDialog;
import android.content.Intent;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.os.Bundle;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.os.Bundle;
import android.text.SpannableString;
import android.text.util.Linkify;
import android.view.Menu;
import android.text.SpannableString;
import android.text.util.Linkify;
import android.view.Menu;
- requestWindowFeature(Window.FEATURE_NO_TITLE);
- //getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
- // WindowManager.LayoutParams.FLAG_FULLSCREEN);
+ PreferenceManager.setDefaultValues(this, R.xml.preferences, false);
- view = ShisenSho.app().getView();
- ShisenSho.app().activity = this;
- setContentView(view);
- }
+ requestWindowFeature(Window.FEATURE_NO_TITLE);
+ //getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
+ // WindowManager.LayoutParams.FLAG_FULLSCREEN);
+
+ view = ShisenSho.app().getView();
+ ShisenSho.app().activity = this;
+ setContentView(view);
+ }
- MenuInflater inflater = getMenuInflater();
- inflater.inflate(R.menu.menu, menu);
- return true;
+ MenuInflater inflater = getMenuInflater();
+ inflater.inflate(R.menu.menu, menu);
+ return true;
- // Handle item selection
- switch (item.getItemId()) {
- case R.id.hint:
- case R.id.undo:
- case R.id.clean:
- return view.onOptionsItemSelected(item);
- case R.id.options:
- startActivityForResult(new Intent("de.cwde.shisensho.SETTINGS", null), 0);
- return true;
- case R.id.about:
- onAboutActivate();
- return true;
- default:
- return super.onOptionsItemSelected(item);
- }
+ // Handle item selection
+ switch (item.getItemId()) {
+ case R.id.hint:
+ case R.id.undo:
+ case R.id.clean:
+ return view.onOptionsItemSelected(item);
+ case R.id.options:
+ startActivityForResult(new Intent("de.cwde.shisensho.SETTINGS", null), 0);
+ return true;
+ case R.id.about:
+ onAboutActivate();
+ return true;
+ default:
+ return super.onOptionsItemSelected(item);
+ }
- String aboutTitle = String.format("About %s", getString(R.string.app_name));
- String versionString = String.format("Version: %s", pInfo.versionName);
- String aboutText = getString(R.string.aboutText);
+ String aboutTitle = String.format("About %s", getString(R.string.app_name));
+ String versionString = String.format("Version: %s", pInfo.versionName);
+ String aboutText = getString(R.string.aboutText);
- // Set up the TextView
- final TextView message = new TextView(this);
- // We'll use a spannablestring to be able to make links clickable
- final SpannableString s = new SpannableString(aboutText);
+ // Set up the TextView
+ final TextView message = new TextView(this);
+ // We'll use a spannablestring to be able to make links clickable
+ final SpannableString s = new SpannableString(aboutText);
- // Set some padding
- message.setPadding(5, 5, 5, 5);
- // Set up the final string
- message.setText(versionString + "\n" + s);
- // Now linkify the text
- Linkify.addLinks(message, Linkify.ALL);
+ // Set some padding
+ message.setPadding(5, 5, 5, 5);
+ // Set up the final string
+ message.setText(versionString + "\n" + s);
+ // Now linkify the text
+ Linkify.addLinks(message, Linkify.ALL);
- new AlertDialog.Builder(this)
- .setTitle(aboutTitle)
- .setCancelable(true)
- .setIcon(R.drawable.icon)
- .setPositiveButton(getString(android.R.string.ok), null)
- .setView(message).create()
- .show();
+ new AlertDialog.Builder(this)
+ .setTitle(aboutTitle)
+ .setCancelable(true)
+ .setIcon(R.drawable.icon)
+ .setPositiveButton(getString(android.R.string.ok), null)
+ .setView(message).create()
+ .show();