mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-22 07:28:16 +01:00
reformat to use GameWrapper; just reformat
This commit is contained in:
parent
7c75bd0da8
commit
f6af82e227
4 changed files with 34 additions and 37 deletions
|
@ -1539,10 +1539,10 @@ public class BoardDelegate extends DelegateBase
|
|||
@Override
|
||||
public void onStatusClicked()
|
||||
{
|
||||
if ( BuildConfig.NON_RELEASE || XWPrefs.getDebugEnabled( m_activity ) ) {
|
||||
if ( BuildConfig.NON_RELEASE || XWPrefs.getDebugEnabled(m_activity)) {
|
||||
View view = findViewById( R.id.netstatus_view );
|
||||
PopupMenu popup = new PopupMenu( m_activity, view );
|
||||
popup.getMenuInflater().inflate( R.menu.netstat, popup.getMenu() );
|
||||
popup.getMenuInflater().inflate(R.menu.netstat, popup.getMenu());
|
||||
|
||||
if ( ! m_connTypes.contains(CommsConnType.COMMS_CONN_MQTT) ) {
|
||||
popup.getMenu().removeItem( R.id.netstat_menu_traffic );
|
||||
|
@ -1562,7 +1562,8 @@ public class BoardDelegate extends DelegateBase
|
|||
onStatusClicked( m_jniGamePtr );
|
||||
break;
|
||||
case R.id.netstat_menu_traffic:
|
||||
NetUtils.copyAndLaunchGamePage( m_activity, m_gi.gameID );
|
||||
NetUtils.copyAndLaunchGamePage( m_activity,
|
||||
m_gi.gameID );
|
||||
break;
|
||||
case R.id.netstat_copyurl:
|
||||
NetUtils.gameURLToClip( m_activity, m_gi.gameID );
|
||||
|
@ -3016,17 +3017,14 @@ public class BoardDelegate extends DelegateBase
|
|||
setupRematchFor( activity, gamePtr, summary, gi );
|
||||
}
|
||||
} else {
|
||||
try ( GameLock lock = GameLock.tryLockRO( rowID ) ) {
|
||||
if ( null != lock ) {
|
||||
summary = DBUtils.getSummary( activity, lock );
|
||||
gi = new CurGameInfo( activity );
|
||||
try ( GamePtr gamePtr = GameUtils
|
||||
.loadMakeGame( activity, gi, lock ) ) {
|
||||
setupRematchFor( activity, gamePtr, summary, gi );
|
||||
}
|
||||
} else {
|
||||
try ( GameUtils.GameWrapper gw = GameUtils
|
||||
.GameWrapper.make( activity, rowID ) ) {
|
||||
if ( null == gw ) {
|
||||
DbgUtils.toastNoLock( TAG, activity, rowID,
|
||||
"setupRematchFor(%d)", rowID );
|
||||
} else {
|
||||
summary = DBUtils.getSummary( activity, gw.getLock() );
|
||||
setupRematchFor( activity, gw.gamePtr(), summary, gw.gi() );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -43,7 +43,9 @@ import android.widget.TextView;
|
|||
import org.eehouse.android.xw4.DlgDelegate.Action;
|
||||
import org.eehouse.android.xw4.DlgDelegate.Builder;
|
||||
import org.eehouse.android.xw4.DlgDelegate.DlgClickNotify;
|
||||
import org.eehouse.android.xw4.GameUtils.GameWrapper;
|
||||
import org.eehouse.android.xw4.MultiService.MultiEvent;
|
||||
import org.eehouse.android.xw4.Utils.ISOCode;
|
||||
import org.eehouse.android.xw4.jni.CommsAddrRec.CommsConnType;
|
||||
import org.eehouse.android.xw4.jni.CommsAddrRec.CommsConnTypeSet;
|
||||
import org.eehouse.android.xw4.jni.CommsAddrRec;
|
||||
|
@ -51,7 +53,6 @@ import org.eehouse.android.xw4.jni.GameSummary;
|
|||
import org.eehouse.android.xw4.jni.XwJNI.GamePtr;
|
||||
import org.eehouse.android.xw4.jni.XwJNI;
|
||||
import org.eehouse.android.xw4.loc.LocUtils;
|
||||
import org.eehouse.android.xw4.Utils.ISOCode;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.ArrayList;
|
||||
|
@ -661,7 +662,8 @@ public abstract class DelegateBase implements DlgClickNotify,
|
|||
{
|
||||
Context context = getActivity();
|
||||
CommsAddrRec[] addrs = XwJNI.comms_getAddrs( gamePtr );
|
||||
CommsAddrRec addr = null != addrs && 0 < addrs.length ? addrs[0] : null;
|
||||
CommsAddrRec addr = null != addrs && 0 < addrs.length
|
||||
? addrs[0] : null;
|
||||
final GameSummary summary = GameUtils
|
||||
.getSummary( context, gamePtr.getRowid(), 1 );
|
||||
if ( null != summary ) {
|
||||
|
@ -675,7 +677,8 @@ public abstract class DelegateBase implements DlgClickNotify,
|
|||
if ( null == msg ) {
|
||||
askNoAddrsDelete();
|
||||
} else {
|
||||
showDialogFragment( DlgID.DLG_CONNSTAT, summary, msg );
|
||||
showDialogFragment( DlgID.DLG_CONNSTAT, summary,
|
||||
msg );
|
||||
}
|
||||
}
|
||||
} );
|
||||
|
@ -685,14 +688,10 @@ public abstract class DelegateBase implements DlgClickNotify,
|
|||
public void onStatusClicked( long rowid )
|
||||
{
|
||||
Log.d( TAG, "onStatusClicked(%d)", rowid );
|
||||
try ( GameLock lock = GameLock.tryLockRO( rowid ) ) {
|
||||
if ( null != lock ) {
|
||||
try ( GamePtr gamePtr = GameUtils
|
||||
.loadMakeGame( getActivity(), lock ) ) {
|
||||
if ( null != gamePtr ) {
|
||||
onStatusClicked( gamePtr );
|
||||
}
|
||||
}
|
||||
|
||||
try ( GameWrapper gw = GameWrapper.make(m_activity, rowid)) {
|
||||
if ( null != gw ) {
|
||||
onStatusClicked( gw.gamePtr() );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -446,10 +446,10 @@ public class GameUtils {
|
|||
public static Bitmap loadMakeBitmap( Context context, long rowid )
|
||||
{
|
||||
Bitmap thumb = null;
|
||||
try ( GameWrapper gw = makeGameWrapper( context, rowid ) ) {
|
||||
try ( GameWrapper gw = GameWrapper.make( context, rowid ) ) {
|
||||
if ( null != gw ) {
|
||||
thumb = takeSnapshot( context, gw.gamePtr(), gw.gi() );
|
||||
DBUtils.saveThumbnail( context, gw.lock(), thumb );
|
||||
DBUtils.saveThumbnail( context, gw.getLock(), thumb );
|
||||
}
|
||||
}
|
||||
return thumb;
|
||||
|
@ -575,7 +575,7 @@ public class GameUtils {
|
|||
private GamePtr mGamePtr;
|
||||
private CurGameInfo mGi;
|
||||
|
||||
GameWrapper( Context context, long rowid )
|
||||
private GameWrapper( Context context, long rowid )
|
||||
{
|
||||
mContext = context;
|
||||
mLock = GameLock.tryLockRO( rowid );
|
||||
|
@ -586,7 +586,7 @@ public class GameUtils {
|
|||
}
|
||||
|
||||
public GamePtr gamePtr() { return mGamePtr; }
|
||||
public GameLock lock() { return mLock; }
|
||||
public GameLock getLock() { return mLock; }
|
||||
public CurGameInfo gi() { return mGi; }
|
||||
public boolean hasGame() { return null != mGamePtr; }
|
||||
|
||||
|
@ -608,16 +608,16 @@ public class GameUtils {
|
|||
{
|
||||
close();
|
||||
}
|
||||
}
|
||||
|
||||
public static GameWrapper makeGameWrapper( Context context, long rowid )
|
||||
{
|
||||
GameWrapper result = new GameWrapper( context, rowid );
|
||||
if ( !result.hasGame() ) {
|
||||
result.close();
|
||||
result = null;
|
||||
public static GameWrapper make( Context context, long rowid )
|
||||
{
|
||||
GameWrapper result = new GameWrapper( context, rowid );
|
||||
if ( !result.hasGame() ) {
|
||||
result.close();
|
||||
result = null;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public static long makeRematch( Context context, long srcRowid,
|
||||
|
@ -625,7 +625,7 @@ public class GameUtils {
|
|||
int[] newOrder )
|
||||
{
|
||||
long rowid = DBUtils.ROWID_NOTFOUND;
|
||||
try ( GameWrapper gw = makeGameWrapper( context, srcRowid ) ) {
|
||||
try ( GameWrapper gw = GameWrapper.make( context, srcRowid ) ) {
|
||||
if ( null != gw ) {
|
||||
UtilCtxt util = new UtilCtxtImpl( context );
|
||||
CommonPrefs cp = CommonPrefs.get( context );
|
||||
|
|
|
@ -64,7 +64,7 @@ public class RematchConfigView extends LinearLayout
|
|||
public void configure( long rowid, DlgDelegate.HasDlgDelegate dlgDlgt )
|
||||
{
|
||||
mDlgDlgt = dlgDlgt;
|
||||
mWrapper = GameUtils.makeGameWrapper( mContext, rowid );
|
||||
mWrapper = GameUtils.GameWrapper.make( mContext, rowid );
|
||||
trySetup();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue