diff --git a/AndroidManifest.xml b/AndroidManifest.xml index 27bfdf1..407de3f 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -1,19 +1,49 @@ + package="eu.veldsoft.kechi" + android:versionCode="2" + android:versionName="1.1" > - + - - - - + - - - - + + + + + + + + + + + + + + + + + + diff --git a/assets/banner.html b/assets/banner.html new file mode 100644 index 0000000..2cbe255 --- /dev/null +++ b/assets/banner.html @@ -0,0 +1,23 @@ + + +
+ + + +
+ + \ No newline at end of file diff --git a/res/layout/activity_about.xml b/res/layout/activity_about.xml new file mode 100644 index 0000000..5f5af40 --- /dev/null +++ b/res/layout/activity_about.xml @@ -0,0 +1,18 @@ + + + + + \ No newline at end of file diff --git a/res/layout/activity_help.xml b/res/layout/activity_help.xml new file mode 100644 index 0000000..ca09149 --- /dev/null +++ b/res/layout/activity_help.xml @@ -0,0 +1,18 @@ + + + + + \ No newline at end of file diff --git a/res/layout/activity_splash.xml b/res/layout/activity_splash.xml new file mode 100644 index 0000000..aef6279 --- /dev/null +++ b/res/layout/activity_splash.xml @@ -0,0 +1,12 @@ + + + + + \ No newline at end of file diff --git a/res/values/strings.xml b/res/values/strings.xml index 6ee9a18..77489e2 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -2,11 +2,17 @@ + Redirect activity is missing! Kechi Kechi No moves left! New Game Help About - + Kechi + Help + About + This game is played on the following board with the following setup: \n \nMOVE - On each turn, each player moves his stones a total of exactly six cells. \n \nThis means that if he has exactly one stone left, it must move exactly six cells (the stones are able to jump the intermediate cells). \n \nThe stone must finish its move on an available empty cell or a cell occupied by an enemy stone (which is captured and removed from the board). \n \nWhen a stone moves and leaves a cell, that cell cannot be used to finish any subsequent moves for either players (it should be marked somehow). \n \nGOAL - A player who is unable to make a valid move, looses. + KECHI \n \nCopyright (c) 1999 Michael Marcus \n \nAndroid version was implemented as user interface tutorial at Soft Intellect academy in Java classes. \nSofia, Bulgaria, 2016 \n \nCopyright (c) 2016 Velbazhd Software LLC + \ No newline at end of file diff --git a/src/eu/veldsoft/kechi/AboutActivity.java b/src/eu/veldsoft/kechi/AboutActivity.java new file mode 100644 index 0000000..fde8044 --- /dev/null +++ b/src/eu/veldsoft/kechi/AboutActivity.java @@ -0,0 +1,15 @@ +package eu.veldsoft.kechi; + +import android.app.Activity; +import android.os.Bundle; +import android.view.Menu; +import android.view.MenuItem; + +public class AboutActivity extends Activity { + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_about); + } +} diff --git a/src/eu/veldsoft/kechi/GameActivity.java b/src/eu/veldsoft/kechi/GameActivity.java index b11b9b2..0d136f9 100644 --- a/src/eu/veldsoft/kechi/GameActivity.java +++ b/src/eu/veldsoft/kechi/GameActivity.java @@ -1,7 +1,10 @@ package eu.veldsoft.kechi; import android.app.Activity; +import android.content.Intent; import android.os.Bundle; +import android.view.Menu; +import android.view.MenuInflater; import android.view.MenuItem; import android.view.View; import android.widget.ImageView; @@ -286,6 +289,16 @@ protected void onCreate(Bundle savedInstanceState) { updateViews(); } + /** + * {@inheritDoc} + */ + @Override + public boolean onCreateOptionsMenu(Menu menu) { + MenuInflater inflater = getMenuInflater(); + inflater.inflate(R.menu.game_option_menu, menu); + return super.onCreateOptionsMenu(menu); + } + /** * {@inheritDoc} */ @@ -298,11 +311,10 @@ public boolean onOptionsItemSelected(MenuItem item) { updateViews(); break; case R.id.help: - // startActivity(new Intent(GameActivity.this, HelpActivity.class)); + startActivity(new Intent(GameActivity.this, HelpActivity.class)); break; case R.id.about: - // startActivity(new Intent(GameActivity.this, - // AboutActivity.class)); + startActivity(new Intent(GameActivity.this, AboutActivity.class)); break; } return true; diff --git a/src/eu/veldsoft/kechi/HelpActivity.java b/src/eu/veldsoft/kechi/HelpActivity.java new file mode 100644 index 0000000..6c273aa --- /dev/null +++ b/src/eu/veldsoft/kechi/HelpActivity.java @@ -0,0 +1,15 @@ +package eu.veldsoft.kechi; + +import android.app.Activity; +import android.os.Bundle; +import android.view.Menu; +import android.view.MenuItem; + +public class HelpActivity extends Activity { + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_help); + } +} diff --git a/src/eu/veldsoft/kechi/SplashActivity.java b/src/eu/veldsoft/kechi/SplashActivity.java new file mode 100644 index 0000000..982491b --- /dev/null +++ b/src/eu/veldsoft/kechi/SplashActivity.java @@ -0,0 +1,70 @@ +package eu.veldsoft.kechi; + +import java.util.Timer; +import java.util.TimerTask; + +import android.app.Activity; +import android.content.Intent; +import android.content.pm.PackageManager; +import android.os.Bundle; +import android.webkit.WebView; +import android.widget.Toast; + +public class SplashActivity extends Activity { + + private long timeout = 0L; + + private String redirect = ""; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_splash); + + /* + * Activate JavaScript. + */ + ((WebView) findViewById(R.id.ads)).getSettings().setJavaScriptEnabled(true); + + /* + * Load local web page as banner holder. + */ + ((WebView) findViewById(R.id.ads)).loadUrl("file:///android_asset/banner.html"); + + /* + * Get splash screen timeout. + */ + try { + timeout = getPackageManager().getActivityInfo(this.getComponentName(), + PackageManager.GET_ACTIVITIES | PackageManager.GET_META_DATA).metaData.getInt("timeout", 0); + } catch (Exception e) { + timeout = 0; + } + + /* + * Get redirect activity class name. + */ + try { + redirect = getPackageManager().getActivityInfo(this.getComponentName(), + PackageManager.GET_ACTIVITIES | PackageManager.GET_META_DATA).metaData.getString("redirect"); + } catch (Exception e) { + redirect = this.getClass().toString(); + Toast.makeText(this, getResources().getString(R.string.redirect_activity_is_missing_message), + Toast.LENGTH_LONG).show(); + } + } + + @Override + protected void onResume() { + super.onResume(); + + new Timer().schedule(new TimerTask() { + public void run() { + try { + startActivity(new Intent(SplashActivity.this, Class.forName(redirect))); + } catch (Exception e) { + } + } + }, timeout); + } +}