From 1fecf9dbb4051bfd053d2c8a8aff6f2b458285d0 Mon Sep 17 00:00:00 2001 From: Andy2 Date: Tue, 19 Oct 2010 07:54:52 -0700 Subject: [PATCH] implement new check-relay menu, and use new task to check for messages if there are any connected games. --- .../org/eehouse/android/xw4/GamesList.java | 25 +++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/GamesList.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/GamesList.java index a2438590b..1192e3cca 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/GamesList.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/GamesList.java @@ -47,7 +47,8 @@ import junit.framework.Assert; import org.eehouse.android.xw4.jni.*; public class GamesList extends XWListActivity - implements DispatchNotify.HandleRelaysIface { + implements DispatchNotify.HandleRelaysIface, + RefreshMsgsTask.RefreshMsgsIface { private static final int WARN_NODICT = Utils.DIALOG_LAST + 1; private static final int CONFIRM_DELETE_ALL = Utils.DIALOG_LAST + 2; @@ -57,6 +58,8 @@ public class GamesList extends XWListActivity private String m_missingDict; private Handler m_handler; + private Object[] m_dlgObjects = null; + @Override protected Dialog onCreateDialog( int id ) { @@ -96,7 +99,7 @@ public class GamesList extends XWListActivity .create(); break; default: - dialog = Utils.onCreateDialog( this, id ); + dialog = Utils.onCreateDialog( this, id, m_dlgObjects ); } return dialog; } @@ -179,6 +182,12 @@ public class GamesList extends XWListActivity } ); } + // RefreshMsgsTask.RefreshMsgsIface interface + public void RefreshMsgsResults( String[] relayIDs ) + { + HandleRelaysIDs( relayIDs ); + } + // @Override // protected void onNewIntent( Intent intent ) // { @@ -251,12 +260,24 @@ public class GamesList extends XWListActivity startActivity( intent ); break; + case R.id.gamel_menu_checkmoves: + if ( null == DBUtils.getRelayIDNoMsgs( this ) ) { + m_dlgObjects = new Object[] { + new Integer(R.string.no_games_to_refresh) + }; + showDialog( Utils.DIALOG_OKONLY ); + } else { + new RefreshMsgsTask( this, this ).execute(); + } + break; + case R.id.gamel_menu_prefs: intent = new Intent( this, PrefsActivity.class ); startActivity( intent ); break; case R.id.gamel_menu_about: + m_dlgObjects = null; showDialog( Utils.DIALOG_ABOUT ); break;