add button leading to the main config dialog plus an explanation of

what it's for.
This commit is contained in:
Andy2 2010-11-04 20:37:59 -07:00
parent 23924ff74e
commit 2f38ce3d92
5 changed files with 52 additions and 15 deletions

View file

@ -34,6 +34,21 @@
android:text="@string/play"
/>
<TextView style="@style/config_separator"
android:text="@string/relay_config_label"
/>
<TextView android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/relay_config_explain"
/>
<Button android:id="@+id/config_button"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/list_item_config"
/>
</LinearLayout>
</ScrollView>

View file

@ -478,4 +478,13 @@
field below. Do that and press the Play game button and you\'ll
connect.</string>
<string name="relay_config_explain">To make more advanced changes
to your game, e.g. to change the dictionary and language it uses,
the number of players in the game or on this device, to enter or
create a public room, etc., tap the configure button below. You
can reach the configure screen at any time via the long-press menu
in the main Game list screen.</string>
<string name="relay_config_label">Advanced settings</string>
</resources>

View file

@ -413,6 +413,13 @@ public class GameUtils {
XwJNI.game_dispose( gamePtr );
}
public static void doConfig( Activity activity, String path, Class clazz )
{
Uri uri = Uri.fromFile( new File(path) );
Intent intent = new Intent( Intent.ACTION_EDIT, uri, activity, clazz );
activity.startActivity( intent );
}
private static String removeExtn( String str )
{
if ( str.endsWith( XWConstants.DICT_EXTN ) ) {

View file

@ -89,7 +89,8 @@ public class GamesList extends XWListActivity
showNotAgainDlgThen( R.string.not_again_newgamenet,
R.string.key_notagain_newgamenet, null );
doConfig( path, RelayGameActivity.class );
GameUtils.doConfig( GamesList.this, path,
RelayGameActivity.class );
}
});
@ -311,13 +312,13 @@ public class GamesList extends XWListActivity
} else {
switch ( menuID ) {
case R.id.list_item_config:
doConfig( path, GameConfig.class );
GameUtils.doConfig( this, path, GameConfig.class );
m_invalPath = path;
break;
// For development only; don't ship!!!
case R.id.list_item_netconfig:
doConfig( path, RelayGameActivity.class );
GameUtils.doConfig( this, path, RelayGameActivity.class );
m_invalPath = path;
break;
@ -363,13 +364,6 @@ public class GamesList extends XWListActivity
return handled;
} // handleMenuItem
private void doConfig( String path, Class clazz )
{
Uri uri = Uri.fromFile( new File(path) );
Intent intent = new Intent( Intent.ACTION_EDIT, uri, this, clazz );
startActivity( intent );
}
private String saveNew( CurGameInfo gi )
{
String path = null;

View file

@ -26,11 +26,13 @@
package org.eehouse.android.xw4;
import android.app.Activity;
import java.io.File;
import android.os.Bundle;
import android.net.Uri;
import android.widget.Button;
import android.widget.TextView;
import android.view.View;
import android.content.Intent;
import junit.framework.Assert;
import org.eehouse.android.xw4.jni.*;
@ -41,6 +43,8 @@ public class RelayGameActivity extends XWActivity
private String m_path;
private CurGameInfo m_gi;
private CommsAddrRec m_car;
private Button m_playButton;
private Button m_configButton;
@Override
public void onCreate( Bundle savedInstanceState )
@ -74,16 +78,24 @@ public class RelayGameActivity extends XWActivity
TextView text = (TextView)findViewById( R.id.explain );
text.setText( String.format( fmt, lang ) );
Button play_button = (Button)findViewById( R.id.play_button );
play_button.setOnClickListener( this );
m_playButton = (Button)findViewById( R.id.play_button );
m_playButton.setOnClickListener( this );
m_configButton = (Button)findViewById( R.id.config_button );
m_configButton.setOnClickListener( this );
} // onCreate
@Override
public void onClick( View view )
{
m_car.ip_relay_invite = Utils.getText( this, R.id.room_edit ).trim();
GameUtils.applyChanges( this, m_gi, m_car, m_path, false );
GameUtils.launchGame( this, m_path );
if ( view == m_playButton ) {
m_car.ip_relay_invite = Utils.getText( this, R.id.room_edit ).trim();
GameUtils.applyChanges( this, m_gi, m_car, m_path, false );
GameUtils.launchGame( this, m_path );
} else if ( view == m_configButton ) {
GameUtils.doConfig( this, m_path, GameConfig.class );
finish();
}
}
} // class RelayGameActivity