mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-27 07:58:49 +01:00
Merge branch 'android_branch' into android_invite
Conflicts: xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardActivity.java
This commit is contained in:
commit
a6a668881f
9 changed files with 27 additions and 43 deletions
|
@ -35,7 +35,6 @@ import android.content.Intent;
|
|||
import java.util.concurrent.Semaphore;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import android.net.Uri;
|
||||
import android.app.Dialog;
|
||||
import android.app.AlertDialog;
|
||||
import android.app.ProgressDialog;
|
||||
|
@ -56,6 +55,9 @@ import org.eehouse.android.xw4.jni.CurGameInfo.DeviceRole;
|
|||
public class BoardActivity extends XWActivity
|
||||
implements TransportProcs.TPMsgHandler {
|
||||
|
||||
public static final String INTENT_KEY_NAME = "name";
|
||||
public static final String INTENT_KEY_CHAT = "chat";
|
||||
|
||||
private static final int DLG_OKONLY = DlgDelegate.DIALOG_LAST + 1;
|
||||
private static final int DLG_BADWORDS = DLG_OKONLY + 1;
|
||||
private static final int QUERY_REQUEST_BLK = DLG_OKONLY + 2;
|
||||
|
@ -76,8 +78,7 @@ public class BoardActivity extends XWActivity
|
|||
CommsTransport m_xport;
|
||||
private Handler m_handler;
|
||||
private TimerRunnable[] m_timers;
|
||||
private String m_path;
|
||||
private Uri m_uri;
|
||||
private String m_name;
|
||||
private Toolbar m_toolbar;
|
||||
private ArrayList<String> m_pendingChats = new ArrayList<String>();
|
||||
|
||||
|
@ -164,7 +165,7 @@ public class BoardActivity extends XWActivity
|
|||
|
||||
waitCloseGame( false );
|
||||
GameUtils.deleteGame( BoardActivity.this,
|
||||
m_path, false );
|
||||
m_name, false );
|
||||
// Intent intent = new Intent();
|
||||
// intent.putExtra( "delete", true );
|
||||
// intent.putExtra( "path", m_path );
|
||||
|
@ -323,12 +324,8 @@ public class BoardActivity extends XWActivity
|
|||
m_view = (BoardView)findViewById( R.id.board_view );
|
||||
m_volKeysZoom = CommonPrefs.getVolKeysZoom( this );
|
||||
|
||||
Intent intent = getIntent();
|
||||
m_uri = intent.getData();
|
||||
m_path = m_uri.getPath();
|
||||
if ( m_path.charAt(0) == '/' ) {
|
||||
m_path = m_path.substring( 1 );
|
||||
}
|
||||
m_name = getIntent().getStringExtra( INTENT_KEY_NAME );
|
||||
|
||||
setBackgroundColor();
|
||||
} // onCreate
|
||||
|
||||
|
@ -351,7 +348,7 @@ public class BoardActivity extends XWActivity
|
|||
{
|
||||
if ( Activity.RESULT_CANCELED != resultCode ) {
|
||||
if ( CHAT_REQUEST == requestCode ) {
|
||||
String msg = data.getStringExtra( "chat" );
|
||||
String msg = data.getStringExtra( INTENT_KEY_CHAT );
|
||||
if ( null != msg && msg.length() > 0 ) {
|
||||
m_pendingChats.add( msg );
|
||||
trySendChats();
|
||||
|
@ -1023,7 +1020,7 @@ public class BoardActivity extends XWActivity
|
|||
m_handler.post( new Runnable() {
|
||||
public void run() {
|
||||
DBUtils.appendChatHistory( BoardActivity.this,
|
||||
m_path, msg, false );
|
||||
m_name, msg, false );
|
||||
startChatActivity();
|
||||
}
|
||||
} );
|
||||
|
@ -1034,7 +1031,7 @@ public class BoardActivity extends XWActivity
|
|||
{
|
||||
if ( 0 == m_jniGamePtr ) {
|
||||
Assert.assertNull( m_gameLock );
|
||||
m_gameLock = new GameUtils.GameLock( m_path, true ).lock();
|
||||
m_gameLock = new GameUtils.GameLock( m_name, true ).lock();
|
||||
|
||||
byte[] stream = GameUtils.savedGame( this, m_gameLock );
|
||||
XwJNI.gi_from_stream( m_gi, stream );
|
||||
|
@ -1097,13 +1094,13 @@ public class BoardActivity extends XWActivity
|
|||
m_jniThread.handle( JNICmd.CMD_START );
|
||||
|
||||
if ( !CommonPrefs.getHideTitleBar( this ) ) {
|
||||
setTitle( GameUtils.gameName( this, m_path ) );
|
||||
setTitle( GameUtils.gameName( this, m_name ) );
|
||||
}
|
||||
m_toolbar = new Toolbar( this );
|
||||
|
||||
populateToolbar();
|
||||
|
||||
int flags = DBUtils.getMsgFlags( m_path );
|
||||
int flags = DBUtils.getMsgFlags( m_name );
|
||||
if ( 0 != (GameSummary.MSG_FLAGS_CHAT & flags) ) {
|
||||
startChatActivity();
|
||||
}
|
||||
|
@ -1111,7 +1108,7 @@ public class BoardActivity extends XWActivity
|
|||
m_jniThread.handle( JNIThread.JNICmd.CMD_POST_OVER );
|
||||
}
|
||||
if ( 0 != flags ) {
|
||||
DBUtils.setMsgFlags( m_path, GameSummary.MSG_FLAGS_NONE );
|
||||
DBUtils.setMsgFlags( m_name, GameSummary.MSG_FLAGS_NONE );
|
||||
}
|
||||
|
||||
trySendChats();
|
||||
|
@ -1265,8 +1262,9 @@ public class BoardActivity extends XWActivity
|
|||
|
||||
private void startChatActivity()
|
||||
{
|
||||
Intent intent = new Intent( Intent.ACTION_EDIT,
|
||||
m_uri, this, ChatActivity.class );
|
||||
Intent intent = new Intent( this, ChatActivity.class );
|
||||
intent.setAction( Intent.ACTION_EDIT );
|
||||
intent.putExtra( BoardActivity.INTENT_KEY_NAME, m_name );
|
||||
startActivityForResult( intent, CHAT_REQUEST );
|
||||
}
|
||||
|
||||
|
|
|
@ -106,7 +106,7 @@ public class ChatActivity extends XWActivity implements View.OnClickListener {
|
|||
DBUtils.appendChatHistory( this, m_path, text, true );
|
||||
|
||||
Intent result = new Intent();
|
||||
result.putExtra( "chat", text );
|
||||
result.putExtra( BoardActivity.INTENT_KEY_CHAT, text );
|
||||
setResult( Activity.RESULT_OK, result );
|
||||
}
|
||||
finish();
|
||||
|
|
|
@ -528,7 +528,8 @@ public class DictsActivity extends ExpandableListActivity
|
|||
return intent;
|
||||
}
|
||||
|
||||
public static void launchAndDownload( Activity activity, int lang, String name )
|
||||
public static void launchAndDownload( Activity activity, int lang,
|
||||
String name )
|
||||
{
|
||||
Intent intent = new Intent( activity, DictsActivity.class );
|
||||
intent.putExtra( DICT_DOLAUNCH, true );
|
||||
|
|
|
@ -25,7 +25,6 @@ import android.app.Dialog;
|
|||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.view.LayoutInflater;
|
||||
import android.net.Uri;
|
||||
import junit.framework.Assert;
|
||||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
|
|
|
@ -22,7 +22,6 @@ package org.eehouse.android.xw4;
|
|||
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
|
@ -373,15 +372,10 @@ public class GameConfig extends XWActivity
|
|||
m_cp = CommonPrefs.get( this );
|
||||
|
||||
Intent intent = getIntent();
|
||||
Uri uri = intent.getData();
|
||||
m_path = uri.getPath();
|
||||
if ( m_path.charAt(0) == '/' ) {
|
||||
m_path = m_path.substring( 1 );
|
||||
}
|
||||
m_path = intent.getStringExtra( BoardActivity.INTENT_KEY_NAME );
|
||||
|
||||
setContentView(R.layout.game_config);
|
||||
|
||||
|
||||
m_connectSet = findViewById(R.id.connect_set);
|
||||
m_addPlayerButton = (Button)findViewById(R.id.add_player);
|
||||
m_addPlayerButton.setOnClickListener( this );
|
||||
|
|
|
@ -29,7 +29,6 @@ import java.io.FileInputStream;
|
|||
import java.io.FileOutputStream;
|
||||
import java.io.InputStream;
|
||||
import java.nio.channels.FileChannel;
|
||||
import android.net.Uri;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import android.content.res.AssetManager;
|
||||
|
@ -727,10 +726,9 @@ public class GameUtils {
|
|||
|
||||
public static void launchGame( Activity activity, String path )
|
||||
{
|
||||
File file = new File( path );
|
||||
Uri uri = Uri.fromFile( file );
|
||||
Intent intent = new Intent( Intent.ACTION_EDIT, uri,
|
||||
activity, BoardActivity.class );
|
||||
Intent intent = new Intent( activity, BoardActivity.class );
|
||||
intent.setAction( Intent.ACTION_EDIT );
|
||||
intent.putExtra( BoardActivity.INTENT_KEY_NAME, path );
|
||||
activity.startActivity( intent );
|
||||
}
|
||||
|
||||
|
@ -892,8 +890,9 @@ public class GameUtils {
|
|||
|
||||
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 );
|
||||
Intent intent = new Intent( activity, clazz );
|
||||
intent.setAction( Intent.ACTION_EDIT );
|
||||
intent.putExtra( BoardActivity.INTENT_KEY_NAME, path );
|
||||
activity.startActivity( intent );
|
||||
}
|
||||
|
||||
|
|
|
@ -28,7 +28,6 @@ import android.app.PendingIntent;
|
|||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.DialogInterface;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.view.ContextMenu;
|
||||
|
|
|
@ -28,7 +28,6 @@ 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;
|
||||
|
@ -54,11 +53,7 @@ public class RelayGameActivity extends XWActivity
|
|||
|
||||
setContentView( R.layout.relay_game_config );
|
||||
|
||||
Uri uri = getIntent().getData();
|
||||
m_path = uri.getPath();
|
||||
if ( m_path.charAt(0) == '/' ) {
|
||||
m_path = m_path.substring( 1 );
|
||||
}
|
||||
m_path = getIntent().getStringExtra( BoardActivity.INTENT_KEY_NAME );
|
||||
|
||||
m_playButton = (Button)findViewById( R.id.play_button );
|
||||
m_playButton.setOnClickListener( this );
|
||||
|
|
|
@ -25,7 +25,6 @@ import android.app.Dialog;
|
|||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.view.LayoutInflater;
|
||||
import android.net.Uri;
|
||||
import junit.framework.Assert;
|
||||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
|
|
Loading…
Add table
Reference in a new issue