mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-16 15:41:16 +01:00
add and implement reset menuitem
This commit is contained in:
parent
4b48c1a0e6
commit
a18470e4a2
3 changed files with 17 additions and 6 deletions
|
@ -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"
|
||||
/>
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
Loading…
Reference in a new issue