From: gitknilch Date: Thu, 28 Feb 2013 10:09:11 +0000 (+0100) Subject: fix indentation X-Git-Url: https://git.zerfleddert.de/cgi-bin/gitweb.cgi/FreeShisen/commitdiff_plain/655c3517046d22b1b630ed350ed18f8082383929 fix indentation Signed-off-by: gitknilch --- diff --git a/src/de/cwde/shisensho/Line.java b/src/de/cwde/shisensho/Line.java index 0e1a915..a1a7681 100644 --- a/src/de/cwde/shisensho/Line.java +++ b/src/de/cwde/shisensho/Line.java @@ -2,25 +2,25 @@ package de.cwde.shisensho; public class Line { public Line(Point a, Point b) { - this.a=a; - this.b=b; - } + this.a=a; + this.b=b; + } - public boolean equals(Line l) { + public boolean equals(Line l) { return (a.equals(l.a) && b.equals(l.b)); - } + } - public boolean isHorizontal() { - return (a.i==b.i); - } + public boolean isHorizontal() { + return (a.i==b.i); + } - public boolean isVertical() { - return (a.j==b.j); - } + public boolean isVertical() { + return (a.j==b.j); + } public boolean contains(Point p) { return (p.i==a.i && p.i==b.i && p.j>=getMin().j && p.j<=getMax().j) - || (p.j==a.j && p.j==b.j && p.i>=getMin().i && p.i<=getMax().i); + || (p.j==a.j && p.j==b.j && p.i>=getMin().i && p.i<=getMax().i); } public Point cuts(Line l) { diff --git a/src/de/cwde/shisensho/SettingsActivity.java b/src/de/cwde/shisensho/SettingsActivity.java index 275638e..5b75b70 100644 --- a/src/de/cwde/shisensho/SettingsActivity.java +++ b/src/de/cwde/shisensho/SettingsActivity.java @@ -7,15 +7,15 @@ import android.os.Bundle; import android.preference.*; public class SettingsActivity extends PreferenceActivity - implements OnSharedPreferenceChangeListener { - +implements OnSharedPreferenceChangeListener { + private ShisenSho app; - + private static final String KEY_PREF_DIFF = "pref_diff"; private static final String KEY_PREF_SIZE = "pref_size"; //private static final String KEY_PREF_GRAV = "pref_grav"; //private static final String KEY_PREF_TIME = "pref_time"; - + @SuppressWarnings("deprecation") @Override public void onCreate(Bundle savedInstanceState) { @@ -23,7 +23,7 @@ public class SettingsActivity extends PreferenceActivity app = ShisenSho.app(); addPreferencesFromResource(R.xml.preferences); SharedPreferences sharedPreferences = getPreferenceScreen().getSharedPreferences(); - + sharedPreferences.registerOnSharedPreferenceChangeListener(this); updateSummary(sharedPreferences, KEY_PREF_DIFF, KEY_PREF_DIFF, R.array.difficulties); updateSummary(sharedPreferences, KEY_PREF_SIZE, KEY_PREF_SIZE, R.array.sizes); @@ -40,7 +40,7 @@ public class SettingsActivity extends PreferenceActivity protected void onResume() { super.onResume(); getPreferenceScreen().getSharedPreferences() - .registerOnSharedPreferenceChangeListener(this); + .registerOnSharedPreferenceChangeListener(this); } @SuppressWarnings("deprecation") @@ -48,10 +48,10 @@ public class SettingsActivity extends PreferenceActivity protected void onPause() { super.onPause(); getPreferenceScreen().getSharedPreferences() - .unregisterOnSharedPreferenceChangeListener(this); + .unregisterOnSharedPreferenceChangeListener(this); } - - + + public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) { updateSummary(sharedPreferences, key, KEY_PREF_DIFF, R.array.difficulties); updateSummary(sharedPreferences, key, KEY_PREF_SIZE, R.array.sizes); diff --git a/src/de/cwde/shisensho/ShisenSho.java b/src/de/cwde/shisensho/ShisenSho.java index 00f959e..fc23d47 100644 --- a/src/de/cwde/shisensho/ShisenSho.java +++ b/src/de/cwde/shisensho/ShisenSho.java @@ -9,7 +9,7 @@ public class ShisenSho extends Application { private static ShisenSho instance = null; private ShisenShoView view = null; public ShisenShoActivity activity = null; - + public Board board; public int[] boardSize=new int[2]; public int difficulty=1; // 1=Easy, 2=Hard @@ -57,16 +57,16 @@ public class ShisenSho extends Application { instance = this; setSize(size); } - + public static synchronized ShisenSho app() { return instance; } - + public ShisenShoView getView() { if (view == null) view = new ShisenShoView(this); return view; } - + /** Called when the activity is first created. */ @Override public void onCreate() { @@ -77,19 +77,19 @@ public class ShisenSho extends Application { public void setOptions() { SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(this); - + int size = sharedPref.getInt("size", 1); int difficulty = sharedPref.getInt("difficulty", 1); boolean gravity = sharedPref.getBoolean("gravity", true); boolean timeCounter = sharedPref.getBoolean("timeCounter", true); boolean needsReset = false; - + if (size != this.size) { setSize(size); needsReset = true; } - + if (difficulty != this.difficulty) { this.difficulty = difficulty; needsReset = true; @@ -99,7 +99,7 @@ public class ShisenSho extends Application { this.gravity = gravity; needsReset = true; } - + if (timeCounter != this.timeCounter) { this.timeCounter = timeCounter; view.onTimeCounterActivate(); diff --git a/src/de/cwde/shisensho/ShisenShoActivity.java b/src/de/cwde/shisensho/ShisenShoActivity.java index 8ba59af..4375365 100644 --- a/src/de/cwde/shisensho/ShisenShoActivity.java +++ b/src/de/cwde/shisensho/ShisenShoActivity.java @@ -21,26 +21,26 @@ public class ShisenShoActivity extends Activity { private ShisenShoView view; /** Called when the activity is first created. */ - @Override - public void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - - PreferenceManager.setDefaultValues(this, R.xml.preferences, false); + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + PreferenceManager.setDefaultValues(this, R.xml.preferences, false); - requestWindowFeature(Window.FEATURE_NO_TITLE); - //getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, - // WindowManager.LayoutParams.FLAG_FULLSCREEN); + 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); - } + view = ShisenSho.app().getView(); + ShisenSho.app().activity = this; + setContentView(view); + } @Override protected void onDestroy() { ViewGroup vg = (ViewGroup)(view.getParent()); vg.removeView(view); - ShisenSho.app().activity = null; + ShisenSho.app().activity = null; super.onDestroy(); } @@ -62,58 +62,58 @@ public class ShisenShoActivity extends Activity { @Override public boolean onCreateOptionsMenu(Menu menu) { - MenuInflater inflater = getMenuInflater(); - inflater.inflate(R.menu.menu, menu); - return true; + MenuInflater inflater = getMenuInflater(); + inflater.inflate(R.menu.menu, menu); + return true; } @Override public boolean onOptionsItemSelected(MenuItem 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); - } + // 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); + } } private void onAboutActivate() { - // Try to load the a package matching the name of our own package - PackageInfo pInfo; + // Try to load the a package matching the name of our own package + PackageInfo pInfo; try { pInfo = getPackageManager().getPackageInfo(getPackageName(), PackageManager.GET_META_DATA); - 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(); } catch (NameNotFoundException e) { e.printStackTrace(); } diff --git a/src/de/cwde/shisensho/ShisenShoView.java b/src/de/cwde/shisensho/ShisenShoView.java index 9872c66..4ff8306 100644 --- a/src/de/cwde/shisensho/ShisenShoView.java +++ b/src/de/cwde/shisensho/ShisenShoView.java @@ -89,13 +89,13 @@ class ShisenShoView extends SurfaceView implements SurfaceHolder.Callback { tileWidth = tileset.getWidth()/tilesetCols; tileHeight = tileset.getHeight()/tilesetRows; tile = new Bitmap[tilesetRows*tilesetCols]; - + // align to screen Matrix matrix = new Matrix(); matrix.setScale(1.0f, 1.0f); // FIXME! - + // TODO: go on. - + int k=0; for (int i=0; i=0 && - i=0 && j=0 && j=0 && i=0 && j=0 && j