am 14ca79d2: Merge "Minor JavaDoc additions and some long line fixes." into gingerbread
Merge commit '14ca79d2a9f305abadcf98d4b3e579a4b79d78ab' into gingerbread-plus-aosp * commit '14ca79d2a9f305abadcf98d4b3e579a4b79d78ab': Minor JavaDoc additions and some long line fixes.
This commit is contained in:
@@ -16,6 +16,9 @@
|
|||||||
|
|
||||||
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;
|
||||||
@@ -24,11 +27,9 @@ import android.os.Bundle;
|
|||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.WindowManager;
|
import android.view.WindowManager;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
import com.trustedlogic.trustednfc.android.NdefMessage;
|
|
||||||
import com.trustedlogic.trustednfc.android.NfcManager;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* An {@code Activity} which handles a broadcast of a new tag that the device just discovered.
|
||||||
* @author nnk@google.com (Nick Kralevich)
|
* @author nnk@google.com (Nick Kralevich)
|
||||||
*/
|
*/
|
||||||
public class SaveTag extends Activity implements DialogInterface.OnClickListener {
|
public class SaveTag extends Activity implements DialogInterface.OnClickListener {
|
||||||
@@ -78,7 +79,9 @@ public class SaveTag extends Activity implements DialogInterface.OnClickListener
|
|||||||
private static String toHexString(byte[] bytes) {
|
private static String toHexString(byte[] bytes) {
|
||||||
StringBuilder sb = new StringBuilder(3 * bytes.length);
|
StringBuilder sb = new StringBuilder(3 * bytes.length);
|
||||||
for (byte b : bytes) {
|
for (byte b : bytes) {
|
||||||
sb.append("(byte) 0x").append(hexDigits[(b >> 4) & 0xf]).append(hexDigits[b & 0xf]).append(", ");
|
sb.append("(byte) 0x")
|
||||||
|
.append(hexDigits[(b >> 4) & 0xf])
|
||||||
|
.append(hexDigits[b & 0xf]).append(", ");
|
||||||
}
|
}
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,12 +23,9 @@ import android.os.Bundle;
|
|||||||
import android.widget.TabHost;
|
import android.widget.TabHost;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A minimal "Hello, World!" application.
|
* A browsing {@code Activity} that displays the saved tags in categories under tabs.
|
||||||
*/
|
*/
|
||||||
public class Tags extends TabActivity {
|
public class TagBrowserActivity extends TabActivity {
|
||||||
/**
|
|
||||||
* Called with the activity is first created.
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
@@ -42,7 +39,8 @@ public class Tags extends TabActivity {
|
|||||||
TabHost tabHost = getTabHost();
|
TabHost tabHost = getTabHost();
|
||||||
Intent i = new Intent().setClass(this, TagList.class);
|
Intent i = new Intent().setClass(this, TagList.class);
|
||||||
|
|
||||||
Intent iSavedList = new Intent().setClass(this, TagList.class).putExtra(TagList.SHOW_SAVED_ONLY, true);
|
Intent iSavedList = new Intent().setClass(this, TagList.class)
|
||||||
|
.putExtra(TagList.SHOW_SAVED_ONLY, true);
|
||||||
Intent iRecentList = new Intent().setClass(this, TagList.class);
|
Intent iRecentList = new Intent().setClass(this, TagList.class);
|
||||||
|
|
||||||
|
|
||||||
@@ -29,10 +29,10 @@ import android.widget.ListView;
|
|||||||
import android.widget.SimpleCursorAdapter;
|
import android.widget.SimpleCursorAdapter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* An {@code Activity} that displays a flat list of tags that can be "opened".
|
||||||
* @author nnk@google.com (Nick Kralevich)
|
* @author nnk@google.com (Nick Kralevich)
|
||||||
*/
|
*/
|
||||||
public class TagList extends ListActivity implements DialogInterface.OnClickListener {
|
public class TagList extends ListActivity implements DialogInterface.OnClickListener {
|
||||||
|
|
||||||
private SQLiteDatabase db;
|
private SQLiteDatabase db;
|
||||||
private Cursor cursor;
|
private Cursor cursor;
|
||||||
static final String SHOW_SAVED_ONLY = "show_saved_only";
|
static final String SHOW_SAVED_ONLY = "show_saved_only";
|
||||||
@@ -44,7 +44,11 @@ public class TagList extends ListActivity implements DialogInterface.OnClickList
|
|||||||
boolean showSavedOnly = getIntent().getBooleanExtra(SHOW_SAVED_ONLY, false);
|
boolean showSavedOnly = getIntent().getBooleanExtra(SHOW_SAVED_ONLY, false);
|
||||||
db = new TagDBHelper(getBaseContext()).getReadableDatabase();
|
db = new TagDBHelper(getBaseContext()).getReadableDatabase();
|
||||||
String selection = showSavedOnly ? "saved=1" : null;
|
String selection = showSavedOnly ? "saved=1" : null;
|
||||||
cursor = db.query("NdefMessage", new String[] { "_id", "bytes", "date" }, selection, null, null, null, null);
|
cursor = db.query(
|
||||||
|
"NdefMessage",
|
||||||
|
new String[] { "_id", "bytes", "date" },
|
||||||
|
selection,
|
||||||
|
null, null, null, null);
|
||||||
SimpleCursorAdapter sca =
|
SimpleCursorAdapter sca =
|
||||||
new SimpleCursorAdapter(this,
|
new SimpleCursorAdapter(this,
|
||||||
android.R.layout.two_line_list_item,
|
android.R.layout.two_line_list_item,
|
||||||
@@ -92,6 +96,6 @@ public class TagList extends ListActivity implements DialogInterface.OnClickList
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onClick(DialogInterface dialog, int which) { }
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,13 +22,14 @@ import android.test.ActivityInstrumentationTestCase2;
|
|||||||
* Make sure that the main launcher activity opens up properly, which will be
|
* Make sure that the main launcher activity opens up properly, which will be
|
||||||
* verified by {@link #testActivityTestCaseSetUpProperly}.
|
* verified by {@link #testActivityTestCaseSetUpProperly}.
|
||||||
*/
|
*/
|
||||||
public class TagsTest extends ActivityInstrumentationTestCase2<Tags> {
|
public class TagsTest extends ActivityInstrumentationTestCase2<TagBrowserActivity> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates an {@link ActivityInstrumentationTestCase2} for the {@link Tags} activity.
|
* Creates an {@link ActivityInstrumentationTestCase2} for the
|
||||||
|
* {@link TagBrowserActivity} activity.
|
||||||
*/
|
*/
|
||||||
public TagsTest() {
|
public TagsTest() {
|
||||||
super(Tags.class);
|
super(TagBrowserActivity.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user