remove hint menu. Add sync-with-server item to board and factor code

implementing same in GamesList up into DlgDelegate where it can be
called from both.  Also, make syncing fire off the service just as the
timer does so that results generate Notifications.  Makes it better
for testing if nothing else.
This commit is contained in:
Andy2 2011-02-27 22:43:09 -08:00
parent d2e663fa99
commit fe9932b57d
10 changed files with 27 additions and 39 deletions

View file

@ -49,17 +49,9 @@
</menu>
</item>
<item android:title="@string/board_submenu_hint">
<menu>
<item android:id="@+id/board_menu_hint"
android:title="@string/board_menu_hint"
/>
<item android:id="@+id/board_menu_hint_next"
android:title="@string/board_menu_hint_next"
android:alphabeticShortcut="H"
/>
</menu>
</item>
<item android:id="@+id/gamel_menu_checkmoves"
android:title="@string/gamel_menu_checkmoves"
/>
<item android:id="@+id/board_menu_file_prefs"
android:title="@string/menu_prefs"

View file

@ -81,9 +81,6 @@
<string name="board_submenu_undo">Desfés</string>
<string name="board_menu_undo_current">Desfés l\'actual</string>
<string name="board_menu_undo_last">Desfés l\'últim</string>
<string name="board_submenu_hint">Pista</string>
<string name="board_menu_hint_next">Pista següent</string>
<string name="board_menu_hint">Pista</string>
<string name="board_menu_values">Mostra els valors</string>
<string name="board_submenu_game">Partida</string>
<string name="board_menu_game_counts">Quantitat i valors</string>

View file

@ -79,9 +79,6 @@
<string name="board_submenu_undo">Zpět</string>
<string name="board_menu_undo_current">Zpět současný</string>
<string name="board_menu_undo_last">Zpět minulý</string>
<string name="board_submenu_hint">Rada</string>
<string name="board_menu_hint_next">Další rada</string>
<string name="board_menu_hint">Rada</string>
<string name="board_menu_values">Ukaž hodnoty</string>
<string name="board_submenu_game">Hra</string>
<string name="board_menu_game_counts">Počty a hodnoty</string>

View file

@ -78,10 +78,7 @@
<string name="board_submenu_undo">Späť</string>
<string name="board_menu_undo_current">Späť súčasný</string>
<string name="board_menu_undo_last">Späť minulý</string>
<string name="board_submenu_hint">Pomôcka</string>
<string name="board_menu_hint_next">Ďalšia pomôcka</string>
<string name="board_menu_hint">Pomôcka</string>
<string name="board_menu_values">Ukáž hodnoty</string>
<string name="board_menu_values">Ukáž hodnoty</string>
<string name="board_submenu_game">Hra</string>
<string name="board_menu_game_counts">Počty a hodnoty</string>
<string name="board_menu_game_left">Zostávajúce kamene</string>

View file

@ -84,9 +84,6 @@
<string name="board_submenu_undo">Undo</string>
<string name="board_menu_undo_current">Undo current</string>
<string name="board_menu_undo_last">Undo last</string>
<string name="board_submenu_hint">Hint</string>
<string name="board_menu_hint_next">Next hint</string>
<string name="board_menu_hint">First hint</string>
<string name="board_menu_values">Show values</string>
<string name="board_submenu_game">Game</string>
<string name="board_menu_game_counts">Counts and values</string>

View file

@ -465,12 +465,6 @@ public class BoardActivity extends XWActivity
}
} );
break;
case R.id.board_menu_hint:
cmd = JNIThread.JNICmd.CMD_HINT;
break;
case R.id.board_menu_hint_next:
cmd = JNIThread.JNICmd.CMD_NEXT_HINT;
break;
case R.id.board_menu_values:
cmd = JNIThread.JNICmd.CMD_VALUES;
break;
@ -497,6 +491,10 @@ public class BoardActivity extends XWActivity
m_jniThread.handle( JNIThread.JNICmd.CMD_RESEND );
break;
case R.id.gamel_menu_checkmoves:
doSyncMenuitem();
break;
case R.id.board_menu_file_prefs:
m_firingPrefs = true;
startActivity( new Intent( this, PrefsActivity.class ) );

View file

@ -133,6 +133,15 @@ public class DlgDelegate {
m_activity.showDialog( CONFIRM_THEN );
}
public void doSyncMenuitem()
{
if ( null == DBUtils.getRelayIDs( m_activity, false ) ) {
showOKOnlyDialog( R.string.no_games_to_refresh );
} else {
RelayReceiver.RestartTimer( m_activity );
}
}
private Dialog createAboutDialog()
{
LayoutInflater factory = LayoutInflater.from( m_activity );

View file

@ -303,15 +303,6 @@ public class GamesList extends XWListActivity
return true;
}
private void doSyncMenuitem()
{
if ( null == DBUtils.getRelayIDs( this, false ) ) {
showOKOnlyDialog( R.string.no_games_to_refresh );
} else {
new RefreshMsgsTask( this, this ).execute();
}
}
public boolean onOptionsItemSelected( MenuItem item )
{
boolean handled = true;

View file

@ -115,4 +115,9 @@ public class XWActivity extends Activity {
{
m_delegate.showConfirmThen( getString(msgID), action );
}
protected void doSyncMenuitem()
{
m_delegate.doSyncMenuitem();
}
}

View file

@ -123,4 +123,9 @@ public class XWListActivity extends ListActivity {
showConfirmThen( getString(msgID), action );
}
protected void doSyncMenuitem()
{
m_delegate.doSyncMenuitem();
}
}