Fix build.
Change-Id: I8e950c585ee9d5c97657ac17b00296423b1a8faa
This commit is contained in:
@@ -161,8 +161,8 @@ public class NdefUtil {
|
||||
* @return text payload.
|
||||
*/
|
||||
public static String toText(NdefRecord record) {
|
||||
Preconditions.checkArgument(record.getTnf() == NdefRecord.TNF_WELL_KNOWN_TYPE);
|
||||
Preconditions.checkArgument(Arrays.equals(record.getType(), NdefRecord.TYPE_TEXT));
|
||||
Preconditions.checkArgument(record.getTnf() == NdefRecord.TNF_WELL_KNOWN);
|
||||
Preconditions.checkArgument(Arrays.equals(record.getType(), NdefRecord.RTD_TEXT));
|
||||
try {
|
||||
|
||||
byte[] payload = record.getPayload();
|
||||
|
||||
@@ -16,9 +16,6 @@
|
||||
|
||||
package com.android.apps.tag;
|
||||
|
||||
import com.trustedlogic.trustednfc.android.NdefMessage;
|
||||
import com.trustedlogic.trustednfc.android.NfcManager;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
import android.app.Dialog;
|
||||
|
||||
@@ -18,9 +18,9 @@ package com.android.apps.tag;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.google.common.collect.Iterables;
|
||||
import com.trustedlogic.trustednfc.android.NdefMessage;
|
||||
import com.trustedlogic.trustednfc.android.NdefRecord;
|
||||
import com.trustedlogic.trustednfc.android.NfcException;
|
||||
import android.nfc.NdefMessage;
|
||||
import android.nfc.NdefRecord;
|
||||
import android.nfc.FormatException;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.net.URI;
|
||||
@@ -67,8 +67,8 @@ public class SmartPoster {
|
||||
}
|
||||
|
||||
public static SmartPoster from(NdefRecord record) {
|
||||
Preconditions.checkArgument(record.getTnf() == NdefRecord.TNF_WELL_KNOWN_TYPE);
|
||||
Preconditions.checkArgument(Arrays.equals(record.getType(), NdefRecord.TYPE_SMART_POSTER));
|
||||
Preconditions.checkArgument(record.getTnf() == NdefRecord.TNF_WELL_KNOWN);
|
||||
Preconditions.checkArgument(Arrays.equals(record.getType(), NdefRecord.RTD_SMART_POSTER));
|
||||
try {
|
||||
NdefMessage subRecords = new NdefMessage(record.getPayload());
|
||||
URI uri = Iterables.getOnlyElement(NdefUtil.getURIs(subRecords));
|
||||
@@ -79,7 +79,7 @@ public class SmartPoster {
|
||||
}
|
||||
|
||||
return new SmartPoster(uri, title);
|
||||
} catch (NfcException e) {
|
||||
} catch (FormatException e) {
|
||||
throw new IllegalArgumentException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ package com.android.apps.tag;
|
||||
|
||||
import android.test.AndroidTestCase;
|
||||
import com.google.common.primitives.Bytes;
|
||||
import com.trustedlogic.trustednfc.android.NdefRecord;
|
||||
import android.nfc.NdefRecord;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
|
||||
@@ -45,7 +45,7 @@ public class NdefUtilTest extends AndroidTestCase {
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
package com.android.apps.tag;
|
||||
|
||||
import android.test.AndroidTestCase;
|
||||
import com.trustedlogic.trustednfc.android.NdefMessage;
|
||||
import android.nfc.NdefMessage;
|
||||
|
||||
/**
|
||||
* Tests for {@link SmartPoster}.
|
||||
|
||||
Reference in New Issue
Block a user