change about toast into about alert, in Utils so callable from two

locations.  Url and mailto ref may not work yet.  Needs contrast of
text with background fixed.
This commit is contained in:
eehouse 2010-03-09 06:29:04 +00:00
parent fd423f7704
commit dfb33c33b4
5 changed files with 95 additions and 10 deletions

View file

@ -0,0 +1,39 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<TextView android:id="@+id/version_string"
android:layout_marginLeft="5sp"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
/>
<TextView android:layout_marginLeft="5sp"
android:layout_marginTop="5sp"
android:layout_marginBottom="5sp"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/about_copyright"
/>
<TextView android:layout_marginLeft="5sp"
android:layout_marginTop="5sp"
android:layout_marginBottom="5sp"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/about_web"
android:autoLink="all"
/>
<TextView android:id="@+id/about_xlator"
android:layout_marginLeft="5sp"
android:layout_marginTop="5sp"
android:layout_marginBottom="5sp"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
/>
</LinearLayout>

View file

@ -238,6 +238,14 @@
<string name="vs">vs.</string>
<string name="dictionary">dictionary: </string>
<!-- about dialog stuff -->
<string name="about_versf">Crosswords for Android, Version 4.4 a1, rev %s.</string>
<string name="about_copyright">Copyright (C) 1998-2010 by Eric House. This software is released under the GNU Public License.</string>
<string name="about_web">For a manual or sourcecode see: http://xwords.sf.net. To report bugs, suggest features, offer to help, etc., please email: eehouse@eehouse.org.</string>
<!-- fill this in other than in English -->
<string name="xlator"></string>
<!-- These do not require localization -->
<string name="key_color_tiles">key_color_tiles</string>
<string name="key_show_arrow">key_show_arrow</string>

View file

@ -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:

View file

@ -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:

View file

@ -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 )