add and implement reset menuitem

This commit is contained in:
eehouse 2010-02-27 18:04:11 +00:00
parent 4b48c1a0e6
commit a18470e4a2
3 changed files with 17 additions and 6 deletions

View file

@ -10,6 +10,9 @@
<item android:id="@+id/list_item_copy"
android:title="@string/list_item_copy"
/>
<item android:id="@+id/list_item_reset"
android:title="@string/list_item_reset"
/>
<item android:id="@+id/list_item_new_from"
android:title="@string/list_item_new_from"
/>

View file

@ -25,6 +25,8 @@
<string name="list_item_hide">Hide</string>
<string name="list_item_delete">Delete</string>
<string name="list_item_copy">Copy</string>
<string name="list_item_reset">Reset</string>
<string name="list_item_new_from">New from</string>
<string name="list_item_move_up">Move up</string>
<string name="list_item_move_down">Move down</string>

View file

@ -108,7 +108,8 @@ public class GamesList extends ListActivity implements View.OnClickListener {
String path = fileList()[info.position];
switch (item.getItemId()) {
int id = item.getItemId();
switch ( id ) {
// case R.id.list_item_open:
// doOpen( info.position );
// handled = true;
@ -122,16 +123,21 @@ public class GamesList extends ListActivity implements View.OnClickListener {
}
break;
case R.id.list_item_copy:
stream = Utils.savedGame( this, path );
Utils.saveGame( this, stream );
break;
case R.id.list_item_reset:
case R.id.list_item_new_from:
stream = Utils.savedGame( this, path );
CurGameInfo gi = new CurGameInfo( this );
XwJNI.gi_from_stream( gi, stream );
stream = XwJNI.gi_to_stream( gi );
if ( R.id.list_item_reset == id ) {
Utils.saveGame( this, stream, path );
} else {
Utils.saveGame( this, stream );
}
break;
case R.id.list_item_copy:
stream = Utils.savedGame( this, path );
Utils.saveGame( this, stream );
break;