mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-28 07:58:08 +01:00
use new game type icons
This commit is contained in:
parent
d1d6a2669b
commit
641d83ab48
5 changed files with 36 additions and 38 deletions
|
@ -53,16 +53,16 @@ public final class R {
|
|||
public static final int icon48x48=0x7f020011;
|
||||
public static final int in_arrow=0x7f020012;
|
||||
public static final int in_arrow_active=0x7f020013;
|
||||
public static final int new_group__gen=0x7f020014;
|
||||
public static final int next_hint=0x7f020015;
|
||||
public static final int origin=0x7f020016;
|
||||
public static final int out_arrow=0x7f020017;
|
||||
public static final int out_arrow_active=0x7f020018;
|
||||
public static final int prefs__gen=0x7f020019;
|
||||
public static final int prev_hint=0x7f02001a;
|
||||
public static final int refresh=0x7f02001b;
|
||||
public static final int relabel__gen=0x7f02001c;
|
||||
public static final int relaygame=0x7f02001d;
|
||||
public static final int multigame__gen=0x7f020014;
|
||||
public static final int new_group__gen=0x7f020015;
|
||||
public static final int next_hint=0x7f020016;
|
||||
public static final int origin=0x7f020017;
|
||||
public static final int out_arrow=0x7f020018;
|
||||
public static final int out_arrow_active=0x7f020019;
|
||||
public static final int prefs__gen=0x7f02001a;
|
||||
public static final int prev_hint=0x7f02001b;
|
||||
public static final int refresh=0x7f02001c;
|
||||
public static final int relabel__gen=0x7f02001d;
|
||||
public static final int reset__gen=0x7f02001e;
|
||||
public static final int rightarrow=0x7f02001f;
|
||||
public static final int save__gen=0x7f020020;
|
||||
|
@ -70,7 +70,7 @@ public final class R {
|
|||
public static final int select_all__gen=0x7f020022;
|
||||
public static final int send__gen=0x7f020023;
|
||||
public static final int shuffle=0x7f020024;
|
||||
public static final int sologame=0x7f020025;
|
||||
public static final int sologame__gen=0x7f020025;
|
||||
public static final int stat_notify_chat=0x7f020026;
|
||||
public static final int stat_notify_sync=0x7f020027;
|
||||
public static final int undo=0x7f020028;
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 1.2 KiB |
Binary file not shown.
Before Width: | Height: | Size: 1.6 KiB |
|
@ -37,6 +37,7 @@ import java.io.ByteArrayOutputStream;
|
|||
import java.io.ObjectInputStream;
|
||||
import java.io.ObjectOutputStream;
|
||||
import java.util.HashMap;
|
||||
|
||||
import junit.framework.Assert;
|
||||
|
||||
import org.eehouse.android.xw4.jni.CommsAddrRec.CommsConnType;
|
||||
|
@ -56,6 +57,7 @@ public class ConnStatusHandler {
|
|||
// private static final int RED = 0x7FFF0000;
|
||||
private static final int GREEN = 0xFF00FF00;
|
||||
private static final int RED = 0xFFFF0000;
|
||||
private static final int BLACK = 0xFF000000;
|
||||
private static final int SUCCESS_IN = 0;
|
||||
private static final int SUCCESS_OUT = 1;
|
||||
private static final int SHOW_SUCCESS_INTERVAL = 1000;
|
||||
|
@ -294,28 +296,24 @@ public class ConnStatusHandler {
|
|||
boolean isSolo = null == connTypes || 0 == connTypes.size();
|
||||
synchronized( s_lockObj ) {
|
||||
if ( null != s_rect ) {
|
||||
int iconID = R.drawable.sologame;
|
||||
int iconID;
|
||||
CommsConnType connType = null;
|
||||
if ( !isSolo ) {
|
||||
if ( isSolo ) {
|
||||
iconID = R.drawable.sologame__gen;
|
||||
} else {
|
||||
connType = connTypes.iterator().next();
|
||||
switch( connType ) {
|
||||
case COMMS_CONN_RELAY:
|
||||
iconID = R.drawable.relaygame;
|
||||
break;
|
||||
case COMMS_CONN_SMS:
|
||||
iconID = android.R.drawable.sym_action_chat;
|
||||
break;
|
||||
case COMMS_CONN_BT:
|
||||
iconID = android.R.drawable.stat_sys_data_bluetooth;
|
||||
break;
|
||||
}
|
||||
iconID = R.drawable.multigame__gen;
|
||||
}
|
||||
|
||||
Rect rect = new Rect( s_rect );
|
||||
int quarterHeight = rect.height() / 4;
|
||||
rect.offset( offsetX, offsetY );
|
||||
|
||||
if ( ! isSolo ) {
|
||||
if ( isSolo ) {
|
||||
// paint a black background for the icon
|
||||
s_fillPaint.setColor( BLACK );
|
||||
canvas.drawRect( rect, s_fillPaint );
|
||||
} else {
|
||||
int saveTop = rect.top;
|
||||
SuccessRecord record;
|
||||
boolean enabled = connTypeEnabled( context, connType );
|
||||
|
@ -349,8 +347,16 @@ public class ConnStatusHandler {
|
|||
rect.top = saveTop;
|
||||
}
|
||||
|
||||
// Center the icon in the remaining (vertically middle) rect
|
||||
rect.top += quarterHeight;
|
||||
rect.bottom = rect.top + (2 * quarterHeight);
|
||||
int halfMin = Math.min( rect.width(), rect.height() ) / 2;
|
||||
int center = rect.centerX();
|
||||
rect.left = center - halfMin;
|
||||
rect.right = center + halfMin;
|
||||
center = rect.centerY();
|
||||
rect.top = center - halfMin;
|
||||
rect.bottom = center + halfMin;
|
||||
drawIn( canvas, res, iconID, rect );
|
||||
}
|
||||
}
|
||||
|
@ -447,6 +453,7 @@ public class ConnStatusHandler {
|
|||
private static void drawIn( Canvas canvas, Resources res, int id, Rect rect )
|
||||
{
|
||||
Drawable icon = res.getDrawable( id );
|
||||
Assert.assertTrue( icon.getBounds().width() == icon.getBounds().height() );
|
||||
icon.setBounds( rect );
|
||||
icon.draw( canvas );
|
||||
}
|
||||
|
|
|
@ -301,21 +301,12 @@ public class GameListItem extends LinearLayout
|
|||
DateFormat.SHORT );
|
||||
m_modTime.setText( df.format( new Date( lastMoveTime ) ) );
|
||||
|
||||
int iconID = R.drawable.sologame;
|
||||
int iconID;
|
||||
if ( null != summary.conTypes && 0 < summary.conTypes.size() ) {
|
||||
switch( summary.conTypes.iterator().next() ) {
|
||||
case COMMS_CONN_RELAY:
|
||||
iconID = R.drawable.relaygame;
|
||||
break;
|
||||
case COMMS_CONN_BT:
|
||||
iconID = android.R.drawable.stat_sys_data_bluetooth;
|
||||
break;
|
||||
case COMMS_CONN_SMS:
|
||||
iconID = android.R.drawable.sym_action_chat;
|
||||
break;
|
||||
}
|
||||
iconID = R.drawable.multigame__gen;
|
||||
} else {
|
||||
iconID = R.drawable.sologame__gen;
|
||||
}
|
||||
|
||||
m_marker.setImageResource( iconID );
|
||||
m_marker.setOnClickListener( new View.OnClickListener() {
|
||||
@Override
|
||||
|
|
Loading…
Add table
Reference in a new issue