Skip to content

Commit

Permalink
Merge pull request #1 from sifon4o/master
Browse files Browse the repository at this point in the history
Added formula options.
  • Loading branch information
TodorBalabanov committed Jul 31, 2015
2 parents 2cc7263 + 1d7cd5b commit 0e0186a
Show file tree
Hide file tree
Showing 9 changed files with 256 additions and 249 deletions.
16 changes: 9 additions & 7 deletions .classpath
@@ -1,7 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="gen"/>
<classpathentry kind="output" path="bin/classes"/>
</classpath>
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="gen"/>
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/>
<classpathentry kind="output" path="bin/classes"/>
</classpath>
102 changes: 53 additions & 49 deletions AndroidManifest.xml
@@ -1,50 +1,54 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="eu.veldsoft.fish.rings"
android:versionCode="2"
android:versionName="1.1" >

<uses-sdk
android:minSdkVersion="15"
android:targetSdkVersion="15" />

<uses-permission android:name="android.permission.INTERNET" />

<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=".GameActivity"
android:label="@string/title_activity_game"
android:screenOrientation="portrait" >
</activity>
<activity
android:name=".HelpActivity"
android:label="@string/title_activity_help" >
</activity>
<activity
android:name=".AboutActivity"
android:label="@string/title_activity_about" >
</activity>
<activity
android:name=".SplashActivity"
android:label="@string/title_activity_splash"
android:noHistory="true" >
<meta-data
android:name="timeout"
android:value="5000" />
<meta-data
android:name="redirect"
android:value="eu.veldsoft.fish.rings.GameActivity" />

<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="eu.veldsoft.fish.rings"
android:versionCode="3"
android:versionName="1.2" >

<uses-sdk
android:minSdkVersion="15"
android:targetSdkVersion="15" />

<uses-permission android:name="android.permission.INTERNET" />

<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=".GameActivity"
android:label="@string/title_activity_game"
android:screenOrientation="portrait" >
</activity>
<activity
android:name=".HelpActivity"
android:label="@string/title_activity_help" >
</activity>
<activity
android:name=".AboutActivity"
android:label="@string/title_activity_about" >
</activity>
<activity
android:name=".SplashActivity"
android:label="@string/title_activity_splash"
android:noHistory="true" >
<meta-data
android:name="timeout"
android:value="5000" />
<meta-data
android:name="redirect"
android:value="eu.veldsoft.fish.rings.GameActivity" />

<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".InstructionActivity"
android:label="@string/title_activity_instruction" >
</activity>
</application>

</manifest>
27 changes: 27 additions & 0 deletions res/layout/activity_instruction.xml
@@ -0,0 +1,27 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context="${relativePackage}.${activityClass}" >

<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/enter_formula_label" />

<EditText
android:id="@+id/formula"
android:layout_width="fill_parent"
android:layout_height="wrap_content" >

<requestFocus />
</EditText>

<Button
android:id="@+id/formula_entered"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/run_formula_button_label" />

</LinearLayout>
3 changes: 3 additions & 0 deletions res/menu/game_option_menu.xml
Expand Up @@ -7,6 +7,9 @@
<item
android:id="@+id/shuffle_game"
android:title="@string/shuffle_option"/>
<item
android:id="@+id/run_formula"
android:title="@string/run_formula_option"/>
<item
android:id="@+id/help_game"
android:title="@string/help_option"/>
Expand Down
41 changes: 23 additions & 18 deletions res/values/strings.xml
@@ -1,22 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>

<string name="you_win">You win!</string>
<string name="reset_option">Reset</string>
<string name="shuffle_option">Shuffle</string>
<string name="help_option">Help</string>
<string name="about_option">About</string>
<string name="ebinqo_url">http://ebinqo.com/</string>
<string name="app_name">Fish Rings for Android</string>
<string name="title_activity_game">Fish Rings</string>
<string name="title_activity_help">Help</string>
<string name="title_activity_about">About</string>
<string name="help_text">" It is a really simple game that has something similar with the Rubik’s Cube.\n First you need to shuffle the puzzle and after that the goal is to return it in the starting state, using two directional rotations of the rings. To do this you should click on the tokens.\n There are three rings, labeled as A (red), B (green), C (blue). The rings can be rotated in two directions (clockwise and counterclockwise). By this way six operations over the game can be constructed:\n +A Rotate ring A clockwise.\n -A Rotate ring A counterclockwise.\n +B Rotate ring B clockwise.\n -B Rotate ring B counterclockwise.\n +C Rotate ring C clockwise.\n -C Rotate ring C counterclockwise.\n These operations can be used for expressions construction:\n +A+B Rotate ring A clockwise, after that ring B clockwise.\n +A-A+B-B Nothing changed after the rotation.\n These expressions can be extended by inserting one digit between the sign and the letter:\n +9A+9B Rotate ring A clockwise nine times and after that the same with ring B.\n By proper formulas puzzle can be solved every time."</string>
<?xml version="1.0" encoding="utf-8"?>
<resources>

<string name="you_win">You win!</string>
<string name="reset_option">Reset</string>
<string name="shuffle_option">Shuffle</string>
<string name="help_option">Help</string>
<string name="about_option">About</string>
<string name="ebinqo_url">http://ebinqo.com/</string>
<string name="app_name">Fish Rings for Android</string>
<string name="title_activity_game">Fish Rings</string>
<string name="title_activity_help">Help</string>
<string name="title_activity_about">About</string>
<string name="help_text">" It is a really simple game that has something similar with the Rubik’s Cube.\n First you need to shuffle the puzzle and after that the goal is to return it in the starting state, using two directional rotations of the rings. To do this you should click on the tokens.\n There are three rings, labeled as A (red), B (green), C (blue). The rings can be rotated in two directions (clockwise and counterclockwise). By this way six operations over the game can be constructed:\n +A Rotate ring A clockwise.\n -A Rotate ring A counterclockwise.\n +B Rotate ring B clockwise.\n -B Rotate ring B counterclockwise.\n +C Rotate ring C clockwise.\n -C Rotate ring C counterclockwise.\n These operations can be used for expressions construction:\n +A+B Rotate ring A clockwise, after that ring B clockwise.\n +A-A+B-B Nothing changed after the rotation.\n These expressions can be extended by inserting one digit between the sign and the letter:\n +9A+9B Rotate ring A clockwise nine times and after that the same with ring B.\n By proper formulas puzzle can be solved every time."</string>
<string name="about_text">" Fish Rings for Android is published by Velbazhd Software LLC.
\n This puzzle consists of three intersecting rings made up of number of colored balls. The rings of balls intersect at few places, so they share some of the balls. Each ring of balls can be rotated, so the balls can be mixed.
\n Newer versions can be checked at:
\n http://github.com/TodorBalabanov/FishRingsForAndroid"</string>
<string name="title_activity_splash">Fish Rings</string>
<string name="redirect_activity_is_missing_message">Redirect activity is missing!</string>

\n http://github.com/TodorBalabanov/FishRingsForAndroid"</string>
<string name="title_activity_splash">Fish Rings</string>
<string name="redirect_activity_is_missing_message">Redirect activity is missing!</string>
<string name="title_activity_instruction">Puzzle Formula Entry</string>
<string name="enter_formula_label">Enter Formula:</string>
<string name="run_formula_button_label">Run Formula</string>
<string name="run_formula_option">Formula</string>
<string name="incorrect_formula_warning">The formula is incorrect!</string>

</resources>
Expand Down
132 changes: 57 additions & 75 deletions src/eu/veldsoft/fish/rings/GameActivity.java
Expand Up @@ -14,6 +14,8 @@
import android.widget.Toast;

public class GameActivity extends Activity {
private static int FORMULA_REQUEST_ID = 1;

private Rings rings = null;

private ImageView views[] = {};
Expand Down Expand Up @@ -129,93 +131,72 @@ protected void onCreate(Bundle savedInstanceState) {
cartoon007Player = MediaPlayer.create(this, R.raw.cartoon007);
cartoon012Player = MediaPlayer.create(this, R.raw.cartoon012);

ImageView views[] = { (ImageView) findViewById(R.id.imageView000),
(ImageView) findViewById(R.id.imageView001),
(ImageView) findViewById(R.id.imageView002),
(ImageView) findViewById(R.id.imageView003),
(ImageView) findViewById(R.id.imageView004),
(ImageView) findViewById(R.id.imageView005),
(ImageView) findViewById(R.id.imageView006),
(ImageView) findViewById(R.id.imageView007),
(ImageView) findViewById(R.id.imageView008),
(ImageView) findViewById(R.id.imageView009),
(ImageView) findViewById(R.id.imageView010),
(ImageView) findViewById(R.id.imageView011),
(ImageView) findViewById(R.id.imageView100),
(ImageView) findViewById(R.id.imageView101),
(ImageView) findViewById(R.id.imageView102),
(ImageView) findViewById(R.id.imageView103),
(ImageView) findViewById(R.id.imageView104),
(ImageView) findViewById(R.id.imageView105),
(ImageView) findViewById(R.id.imageView106),
(ImageView) findViewById(R.id.imageView107),
(ImageView) findViewById(R.id.imageView108),
(ImageView) findViewById(R.id.imageView109),
(ImageView) findViewById(R.id.imageView110),
(ImageView) findViewById(R.id.imageView111),
(ImageView) findViewById(R.id.imageView200),
(ImageView) findViewById(R.id.imageView201),
(ImageView) findViewById(R.id.imageView202),
(ImageView) findViewById(R.id.imageView203),
(ImageView) findViewById(R.id.imageView204),
(ImageView) findViewById(R.id.imageView205),
(ImageView) findViewById(R.id.imageView206),
(ImageView) findViewById(R.id.imageView207),
(ImageView) findViewById(R.id.imageView208),
(ImageView) findViewById(R.id.imageView209),
(ImageView) findViewById(R.id.imageView210),
(ImageView) findViewById(R.id.imageView211), };
ImageView views[] = { (ImageView) findViewById(R.id.imageView000), (ImageView) findViewById(R.id.imageView001),
(ImageView) findViewById(R.id.imageView002), (ImageView) findViewById(R.id.imageView003),
(ImageView) findViewById(R.id.imageView004), (ImageView) findViewById(R.id.imageView005),
(ImageView) findViewById(R.id.imageView006), (ImageView) findViewById(R.id.imageView007),
(ImageView) findViewById(R.id.imageView008), (ImageView) findViewById(R.id.imageView009),
(ImageView) findViewById(R.id.imageView010), (ImageView) findViewById(R.id.imageView011),
(ImageView) findViewById(R.id.imageView100), (ImageView) findViewById(R.id.imageView101),
(ImageView) findViewById(R.id.imageView102), (ImageView) findViewById(R.id.imageView103),
(ImageView) findViewById(R.id.imageView104), (ImageView) findViewById(R.id.imageView105),
(ImageView) findViewById(R.id.imageView106), (ImageView) findViewById(R.id.imageView107),
(ImageView) findViewById(R.id.imageView108), (ImageView) findViewById(R.id.imageView109),
(ImageView) findViewById(R.id.imageView110), (ImageView) findViewById(R.id.imageView111),
(ImageView) findViewById(R.id.imageView200), (ImageView) findViewById(R.id.imageView201),
(ImageView) findViewById(R.id.imageView202), (ImageView) findViewById(R.id.imageView203),
(ImageView) findViewById(R.id.imageView204), (ImageView) findViewById(R.id.imageView205),
(ImageView) findViewById(R.id.imageView206), (ImageView) findViewById(R.id.imageView207),
(ImageView) findViewById(R.id.imageView208), (ImageView) findViewById(R.id.imageView209),
(ImageView) findViewById(R.id.imageView210), (ImageView) findViewById(R.id.imageView211), };
this.views = views;

findViewById(R.id.arrow01).setOnClickListener(aRingClockwiseClick);
findViewById(R.id.arrow02).setOnClickListener(
aRingCounterClockwiseClick);
findViewById(R.id.arrow02).setOnClickListener(aRingCounterClockwiseClick);
findViewById(R.id.arrow03).setOnClickListener(bRingClockwiseClick);
findViewById(R.id.arrow04).setOnClickListener(
bRingCounterClockwiseClick);
findViewById(R.id.arrow04).setOnClickListener(bRingCounterClockwiseClick);
findViewById(R.id.arrow05).setOnClickListener(cRingClockwiseClick);
findViewById(R.id.arrow06).setOnClickListener(
cRingCounterClockwiseClick);
findViewById(R.id.arrow06).setOnClickListener(cRingCounterClockwiseClick);

findViewById(R.id.imageView004).setOnClickListener(aRingClockwiseClick);
findViewById(R.id.imageView005).setOnClickListener(aRingClockwiseClick);
findViewById(R.id.imageView006).setOnClickListener(
aRingCounterClockwiseClick);
findViewById(R.id.imageView007).setOnClickListener(
aRingCounterClockwiseClick);
findViewById(R.id.imageView006).setOnClickListener(aRingCounterClockwiseClick);
findViewById(R.id.imageView007).setOnClickListener(aRingCounterClockwiseClick);

findViewById(R.id.imageView108).setOnClickListener(bRingClockwiseClick);
findViewById(R.id.imageView109).setOnClickListener(bRingClockwiseClick);
findViewById(R.id.imageView110).setOnClickListener(bRingClockwiseClick);
findViewById(R.id.imageView105).setOnClickListener(
bRingCounterClockwiseClick);
findViewById(R.id.imageView106).setOnClickListener(
bRingCounterClockwiseClick);
findViewById(R.id.imageView107).setOnClickListener(
bRingCounterClockwiseClick);
findViewById(R.id.imageView105).setOnClickListener(bRingCounterClockwiseClick);
findViewById(R.id.imageView106).setOnClickListener(bRingCounterClockwiseClick);
findViewById(R.id.imageView107).setOnClickListener(bRingCounterClockwiseClick);

findViewById(R.id.imageView208).setOnClickListener(cRingClockwiseClick);
findViewById(R.id.imageView209).setOnClickListener(cRingClockwiseClick);
findViewById(R.id.imageView210).setOnClickListener(cRingClockwiseClick);
findViewById(R.id.imageView205).setOnClickListener(
cRingCounterClockwiseClick);
findViewById(R.id.imageView206).setOnClickListener(
cRingCounterClockwiseClick);
findViewById(R.id.imageView207).setOnClickListener(
cRingCounterClockwiseClick);

((ImageView) findViewById(R.id.ebinqoLogo))
.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
GameActivity.this.startActivity(new Intent(
Intent.ACTION_VIEW, Uri.parse(getResources()
.getString(R.string.ebinqo_url))));
}
});

rings = new Rings(this.getWindow().getDecorView().getWidth(), this
.getWindow().getDecorView().getHeight());
findViewById(R.id.imageView205).setOnClickListener(cRingCounterClockwiseClick);
findViewById(R.id.imageView206).setOnClickListener(cRingCounterClockwiseClick);
findViewById(R.id.imageView207).setOnClickListener(cRingCounterClockwiseClick);

((ImageView) findViewById(R.id.ebinqoLogo)).setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
GameActivity.this.startActivity(
new Intent(Intent.ACTION_VIEW, Uri.parse(getResources().getString(R.string.ebinqo_url))));
}
});

rings = new Rings(this.getWindow().getDecorView().getWidth(), this.getWindow().getDecorView().getHeight());
}

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);

if (resultCode == RESULT_OK && requestCode == FORMULA_REQUEST_ID) {
String formula = data.getCharSequenceExtra(InstructionActivity.EXTRA_RESULT_FORMULA_KEY).toString();
rings.eval(formula.toUpperCase());
GameActivity.this.updateInfo();
}
}

@Override
Expand All @@ -238,13 +219,14 @@ public boolean onOptionsItemSelected(MenuItem item) {
cartoon012Player.start();
GameActivity.this.repaint();
break;
case R.id.run_formula:
startActivityForResult(new Intent(GameActivity.this, InstructionActivity.class), FORMULA_REQUEST_ID);
break;
case R.id.help_game:
GameActivity.this.startActivity(new Intent(GameActivity.this,
HelpActivity.class));
GameActivity.this.startActivity(new Intent(GameActivity.this, HelpActivity.class));
break;
case R.id.about_game:
GameActivity.this.startActivity(new Intent(GameActivity.this,
AboutActivity.class));
GameActivity.this.startActivity(new Intent(GameActivity.this, AboutActivity.class));
break;
}
return true;
Expand Down

0 comments on commit 0e0186a

Please sign in to comment.