]> git.zerfleddert.de Git - FreeShisen/commitdiff
fix indentation
authorgitknilch <gitknilch@cwde.de>
Thu, 28 Feb 2013 10:09:11 +0000 (11:09 +0100)
committergitknilch <gitknilch@cwde.de>
Thu, 28 Feb 2013 10:11:59 +0000 (11:11 +0100)
Signed-off-by: gitknilch <gitknilch@cwde.de>
src/de/cwde/shisensho/Line.java
src/de/cwde/shisensho/SettingsActivity.java
src/de/cwde/shisensho/ShisenSho.java
src/de/cwde/shisensho/ShisenShoActivity.java
src/de/cwde/shisensho/ShisenShoView.java

index 0e1a915da98348e3754f769cc44ff587d50cbcf7..a1a7681319d8293e34aa1efba3f67421496d758b 100644 (file)
@@ -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) {
index 275638e846f4f28698d7b71bb35ce31ad5db1b83..5b75b70235982d98bade86d793151e6c7c702555 100644 (file)
@@ -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);
index 00f959e84b89e6da517638cab0c0289fbeab11fb..fc23d4795d1042602cac8336c13051aef3552c1c 100644 (file)
@@ -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();
index 8ba59afe142a858ebf80fd43d469f323f14e29ed..43753652ac467cce68bedcb815a1fa35aa218908 100644 (file)
@@ -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();
                }
index 9872c6644654d91fa868035e15c5d04dc7d7b913..4ff8306aca1868e4dee8e05826545d67ff6084d6 100644 (file)
@@ -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<tilesetRows; i++) {
                        for (int j=0; j<tilesetCols; j++) {
@@ -123,18 +123,18 @@ class ShisenShoView extends SurfaceView implements SurfaceHolder.Callback {
                        }
                };
                timer=new Timer();
-       timer.scheduleAtFixedRate(new TimerTask() {
-               public void run() {
-                       timerHandler.sendEmptyMessage(Activity.RESULT_OK);
-               }
-       }, 0, 1000);
+               timer.scheduleAtFixedRate(new TimerTask() {
+                       public void run() {
+                               timerHandler.sendEmptyMessage(Activity.RESULT_OK);
+                       }
+               }, 0, 1000);
                timerRegistered=true;
        }
 
        private void unregisterTimer() {
                if (timer==null) return; // Already unregistered
                timer.cancel();
-       timer = null;
+               timer = null;
                timerHandler = null;
                timerRegistered=false;
        }
@@ -176,24 +176,24 @@ class ShisenShoView extends SurfaceView implements SurfaceHolder.Callback {
        }
 
        public boolean onOptionsItemSelected(MenuItem item) {
-           // Handle item selection
-           switch (item.getItemId()) {
-           case R.id.hint:
-               this.postDelayed(new Runnable() { public void run() { onHintActivate(); } }, 100);
-               return true;
-           case R.id.undo:
-               this.postDelayed(new Runnable() { public void run() { onUndoActivate(); } }, 100);
-               return true;
-           case R.id.clean:
-               this.postDelayed(new Runnable() { public void run() { reset(); } }, 100);
-               return true;
-           case R.id.options:
-               return true;
-           case R.id.about:
-               return true;
-           default:
-               return false;
-           }
+               // Handle item selection
+               switch (item.getItemId()) {
+               case R.id.hint:
+                       this.postDelayed(new Runnable() { public void run() { onHintActivate(); } }, 100);
+                       return true;
+               case R.id.undo:
+                       this.postDelayed(new Runnable() { public void run() { onUndoActivate(); } }, 100);
+                       return true;
+               case R.id.clean:
+                       this.postDelayed(new Runnable() { public void run() { reset(); } }, 100);
+                       return true;
+               case R.id.options:
+                       return true;
+               case R.id.about:
+                       return true;
+               default:
+                       return false;
+               }
        }
 
        public void reset() {
@@ -235,9 +235,9 @@ class ShisenShoView extends SurfaceView implements SurfaceHolder.Callback {
 
        private void onUpdateTime() {
                paint(pstate);
-           if (!(app.timeCounter && cstate!=StatePlay.GAMEOVER)) {
-               unregisterTimer();
-           }
+               if (!(app.timeCounter && cstate!=StatePlay.GAMEOVER)) {
+                       unregisterTimer();
+               }
        }
 
        @SuppressWarnings("deprecation")
@@ -483,7 +483,7 @@ class ShisenShoView extends SurfaceView implements SurfaceHolder.Callback {
                                        l+=30;
                                }
                        }
-                       */
+                        */
 
                        // Double buffer dumping
                        // canvas.drawBitmap(buffer, 0, 0, null);
@@ -510,9 +510,9 @@ class ShisenShoView extends SurfaceView implements SurfaceHolder.Callback {
                        switch (cstate) {
                        case IDLE:
                                if (i>=0 &&
-                                               i<app.board.boardSize[0] &&
-                                               j>=0 && j<app.board.boardSize[1] &&
-                                               app.board.board[i][j]!=0) {
+                               i<app.board.boardSize[0] &&
+                               j>=0 && j<app.board.boardSize[1] &&
+                               app.board.board[i][j]!=0) {
                                        selection1[0]=i;
                                        selection1[1]=j;
                                        paint(StatePaint.SELECTED1);
@@ -521,8 +521,8 @@ class ShisenShoView extends SurfaceView implements SurfaceHolder.Callback {
                                break;
                        case SELECTED1:
                                if (i>=0 && i<app.board.boardSize[0] &&
-                                               j>=0 && j<app.board.boardSize[1] &&
-                                               app.board.board[i][j]!=0) {
+                               j>=0 && j<app.board.boardSize[1] &&
+                               app.board.board[i][j]!=0) {
                                        if (i==selection1[0] && j==selection1[1]) {
                                                paint(StatePaint.BOARD);
                                                control(StatePlay.IDLE);
@@ -670,5 +670,5 @@ class ShisenShoView extends SurfaceView implements SurfaceHolder.Callback {
                paint.setColor(Color.parseColor("#006666"));
                paint.setFlags(Paint.ANTI_ALIAS_FLAG);
        }
-*/
+        */
 }
Impressum, Datenschutz