Fix build.

Change-Id: I8e950c585ee9d5c97657ac17b00296423b1a8faa
This commit is contained in:
Nick Pelly
2010-10-12 19:45:24 -07:00
parent 1d5707b5a8
commit a3dc45ac9f
5 changed files with 11 additions and 14 deletions

View File

@@ -161,8 +161,8 @@ public class NdefUtil {
* @return text payload. * @return text payload.
*/ */
public static String toText(NdefRecord record) { public static String toText(NdefRecord record) {
Preconditions.checkArgument(record.getTnf() == NdefRecord.TNF_WELL_KNOWN_TYPE); Preconditions.checkArgument(record.getTnf() == NdefRecord.TNF_WELL_KNOWN);
Preconditions.checkArgument(Arrays.equals(record.getType(), NdefRecord.TYPE_TEXT)); Preconditions.checkArgument(Arrays.equals(record.getType(), NdefRecord.RTD_TEXT));
try { try {
byte[] payload = record.getPayload(); byte[] payload = record.getPayload();

View File

@@ -16,9 +16,6 @@
package com.android.apps.tag; package com.android.apps.tag;
import com.trustedlogic.trustednfc.android.NdefMessage;
import com.trustedlogic.trustednfc.android.NfcManager;
import android.app.Activity; import android.app.Activity;
import android.app.AlertDialog; import android.app.AlertDialog;
import android.app.Dialog; import android.app.Dialog;

View File

@@ -18,9 +18,9 @@ package com.android.apps.tag;
import com.google.common.base.Preconditions; import com.google.common.base.Preconditions;
import com.google.common.collect.Iterables; import com.google.common.collect.Iterables;
import com.trustedlogic.trustednfc.android.NdefMessage; import android.nfc.NdefMessage;
import com.trustedlogic.trustednfc.android.NdefRecord; import android.nfc.NdefRecord;
import com.trustedlogic.trustednfc.android.NfcException; import android.nfc.FormatException;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import java.net.URI; import java.net.URI;
@@ -67,8 +67,8 @@ public class SmartPoster {
} }
public static SmartPoster from(NdefRecord record) { public static SmartPoster from(NdefRecord record) {
Preconditions.checkArgument(record.getTnf() == NdefRecord.TNF_WELL_KNOWN_TYPE); Preconditions.checkArgument(record.getTnf() == NdefRecord.TNF_WELL_KNOWN);
Preconditions.checkArgument(Arrays.equals(record.getType(), NdefRecord.TYPE_SMART_POSTER)); Preconditions.checkArgument(Arrays.equals(record.getType(), NdefRecord.RTD_SMART_POSTER));
try { try {
NdefMessage subRecords = new NdefMessage(record.getPayload()); NdefMessage subRecords = new NdefMessage(record.getPayload());
URI uri = Iterables.getOnlyElement(NdefUtil.getURIs(subRecords)); URI uri = Iterables.getOnlyElement(NdefUtil.getURIs(subRecords));
@@ -79,7 +79,7 @@ public class SmartPoster {
} }
return new SmartPoster(uri, title); return new SmartPoster(uri, title);
} catch (NfcException e) { } catch (FormatException e) {
throw new IllegalArgumentException(e); throw new IllegalArgumentException(e);
} }
} }

View File

@@ -18,7 +18,7 @@ package com.android.apps.tag;
import android.test.AndroidTestCase; import android.test.AndroidTestCase;
import com.google.common.primitives.Bytes; import com.google.common.primitives.Bytes;
import com.trustedlogic.trustednfc.android.NdefRecord; import android.nfc.NdefRecord;
import java.io.UnsupportedEncodingException; import java.io.UnsupportedEncodingException;
@@ -45,7 +45,7 @@ public class NdefUtilTest extends AndroidTestCase {
text text
); );
NdefRecord record = new NdefRecord(NdefRecord.TNF_WELL_KNOWN_TYPE, NdefRecord.TYPE_TEXT, new byte[0], data); NdefRecord record = new NdefRecord(NdefRecord.TNF_WELL_KNOWN, NdefRecord.RTD_TEXT, new byte[0], data);
assertEquals(word, NdefUtil.toText(record)); assertEquals(word, NdefUtil.toText(record));
} }
} }

View File

@@ -17,7 +17,7 @@
package com.android.apps.tag; package com.android.apps.tag;
import android.test.AndroidTestCase; import android.test.AndroidTestCase;
import com.trustedlogic.trustednfc.android.NdefMessage; import android.nfc.NdefMessage;
/** /**
* Tests for {@link SmartPoster}. * Tests for {@link SmartPoster}.