mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-30 08:34:16 +01:00
fix assertion on newer devices by letting the compiler do its job
This commit is contained in:
parent
fb3b6ff96d
commit
fe64f89788
2 changed files with 5 additions and 7 deletions
|
@ -545,7 +545,7 @@ public class BoardDelegate extends DelegateBase
|
||||||
m_haveInvited = intent.getBooleanExtra( GameUtils.INVITED, false );
|
m_haveInvited = intent.getBooleanExtra( GameUtils.INVITED, false );
|
||||||
m_overNotShown = true;
|
m_overNotShown = true;
|
||||||
|
|
||||||
NFCUtils.register( m_activity ); // Don't seem to need to unregister...
|
NFCUtils.register( m_activity, this ); // Don't seem to need to unregister...
|
||||||
|
|
||||||
setBackgroundColor();
|
setBackgroundColor();
|
||||||
setKeepScreenOn();
|
setKeepScreenOn();
|
||||||
|
|
|
@ -53,19 +53,17 @@ public class NFCUtils {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static interface SafeNFC {
|
private static interface SafeNFC {
|
||||||
public void register( Activity activity );
|
public void register( Activity activity, NFCActor actor );
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class SafeNFCImpl implements SafeNFC {
|
private static class SafeNFCImpl implements SafeNFC {
|
||||||
public void register( final Activity activity )
|
public void register( final Activity activity, final NFCActor actor )
|
||||||
{
|
{
|
||||||
Assert.assertTrue( activity instanceof NFCActor );
|
|
||||||
NfcManager manager =
|
NfcManager manager =
|
||||||
(NfcManager)activity.getSystemService( Context.NFC_SERVICE );
|
(NfcManager)activity.getSystemService( Context.NFC_SERVICE );
|
||||||
if ( null != manager ) {
|
if ( null != manager ) {
|
||||||
NfcAdapter adapter = manager.getDefaultAdapter();
|
NfcAdapter adapter = manager.getDefaultAdapter();
|
||||||
if ( null != adapter ) {
|
if ( null != adapter ) {
|
||||||
final NFCActor actor = (NFCActor)activity;
|
|
||||||
NfcAdapter.CreateNdefMessageCallback cb =
|
NfcAdapter.CreateNdefMessageCallback cb =
|
||||||
new NfcAdapter.CreateNdefMessageCallback() {
|
new NfcAdapter.CreateNdefMessageCallback() {
|
||||||
public NdefMessage createNdefMessage( NfcEvent evt )
|
public NdefMessage createNdefMessage( NfcEvent evt )
|
||||||
|
@ -117,10 +115,10 @@ public class NFCUtils {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void register( Activity activity )
|
public static void register( Activity activity, NFCActor actor )
|
||||||
{
|
{
|
||||||
if ( null != s_safeNFC ) {
|
if ( null != s_safeNFC ) {
|
||||||
s_safeNFC.register( activity );
|
s_safeNFC.register( activity, actor );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue