diff --git a/xwords4/android/XWords4/res/layout/about_dlg.xml b/xwords4/android/XWords4/res/layout/about_dlg.xml new file mode 100644 index 000000000..012f2e0cc --- /dev/null +++ b/xwords4/android/XWords4/res/layout/about_dlg.xml @@ -0,0 +1,39 @@ + + + + + + + + + + + + diff --git a/xwords4/android/XWords4/res/values/strings.xml b/xwords4/android/XWords4/res/values/strings.xml index 949cb9a68..40b61f8d7 100644 --- a/xwords4/android/XWords4/res/values/strings.xml +++ b/xwords4/android/XWords4/res/values/strings.xml @@ -238,6 +238,14 @@ vs. dictionary: + + Crosswords for Android, Version 4.4 a1, rev %s. + Copyright (C) 1998-2010 by Eric House. This software is released under the GNU Public License. + + For a manual or sourcecode see: http://xwords.sf.net. To report bugs, suggest features, offer to help, etc., please email: eehouse@eehouse.org. + + + key_color_tiles key_show_arrow diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardActivity.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardActivity.java index 5763a2821..1b786fae3 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardActivity.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardActivity.java @@ -28,11 +28,11 @@ import org.eehouse.android.xw4.jni.CurGameInfo.DeviceRole; public class BoardActivity extends Activity implements UtilCtxt { - private static final int DLG_OKONLY = 1; - private static final int DLG_BADWORDS = 2; - private static final int QUERY_REQUEST_BLK = 3; - private static final int PICK_TILE_REQUEST_BLK = 4; - private static final int QUERY_ENDGAME = 5; + private static final int DLG_OKONLY = Utils.DIALOG_LAST + 1; + private static final int DLG_BADWORDS = Utils.DIALOG_LAST + 2; + private static final int QUERY_REQUEST_BLK = Utils.DIALOG_LAST + 3; + private static final int PICK_TILE_REQUEST_BLK = Utils.DIALOG_LAST + 4; + private static final int QUERY_ENDGAME = Utils.DIALOG_LAST + 5; private BoardView m_view; private int m_jniGamePtr; @@ -152,6 +152,9 @@ public class BoardActivity extends Activity implements UtilCtxt { }) .create(); break; + default: + dialog = Utils.onCreateDialog( this, id ); + Assert.assertTrue( null != dialog ); } return dialog; } // onCreateDialog @@ -393,7 +396,7 @@ public class BoardActivity extends Activity implements UtilCtxt { startActivity( new Intent( this, PrefsActivity.class ) ); break; case R.id.board_menu_file_about: - Utils.about(this); + showDialog( Utils.DIALOG_ABOUT ); break; default: 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 5e3892b0a..638115976 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/GamesList.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/GamesList.java @@ -32,6 +32,8 @@ import android.widget.Button; import android.view.MenuInflater; import java.io.File; import android.preference.PreferenceManager; +import android.app.Dialog; +import junit.framework.Assert; import org.eehouse.android.xw4.jni.*; @@ -40,6 +42,13 @@ import org.eehouse.android.xw4.XWords4.Games; // for constants public class GamesList extends ListActivity implements View.OnClickListener { private GameListAdapter m_adapter; + @Override + protected Dialog onCreateDialog( int id ) + { + Assert.assertTrue( id == Utils.DIALOG_ABOUT ); + return Utils.onCreateDialog( this, id ); + } + @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); @@ -185,7 +194,7 @@ public class GamesList extends ListActivity implements View.OnClickListener { break; case R.id.gamel_menu_about: - Utils.about(this); + showDialog( Utils.DIALOG_ABOUT ); break; case R.id.gamel_menu_view_hidden: diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/Utils.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/Utils.java index 5362bdcde..79d443725 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/Utils.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/Utils.java @@ -16,13 +16,21 @@ import java.io.InputStream; import android.widget.CheckBox; import android.app.Activity; import android.app.Dialog; +import android.app.AlertDialog; import android.widget.EditText; import android.widget.TextView; +import android.view.View; import android.text.format.Time; import java.util.Formatter; +import android.view.LayoutInflater; +import junit.framework.Assert; public class Utils { static final String TAG = "EJAVA"; + + static final int DIALOG_ABOUT = 1; + static final int DIALOG_LAST = DIALOG_ABOUT; + // private static JNIThread s_jniThread = null; private static Time s_time = new Time(); @@ -46,10 +54,28 @@ public class Utils { Toast.makeText( context, text, Toast.LENGTH_SHORT).show(); } - public static void about( Context context ) + static Dialog onCreateDialog( Context context, int id ) { - CharSequence text = "Version: pre-alpha; svn rev: " + SvnVersion.VERS; - Toast.makeText( context, text, Toast.LENGTH_LONG ).show(); + Assert.assertTrue( DIALOG_ABOUT == id ); + LayoutInflater factory = LayoutInflater.from( context ); + final View view = factory.inflate( R.layout.about_dlg, null ); + TextView vers = (TextView)view.findViewById( R.id.version_string ); + vers.setText( String.format( context.getString(R.string.about_versf), + SvnVersion.VERS ) ); + + TextView xlator = (TextView)view.findViewById( R.id.about_xlator ); + String str = context.getString( R.string.xlator ); + if ( str.length() > 0 ) { + xlator.setText( str ); + } else { + xlator.setVisibility( View.GONE ); + } + + return new AlertDialog.Builder( context ) + .setIcon( R.drawable.icon48x48 ) + .setTitle( R.string.app_name ) + .setView( view ) + .create(); } public static byte[] savedGame( Context context, String path )