diff --git a/apps/Tag/src/com/android/apps/tag/SaveTag.java b/apps/Tag/src/com/android/apps/tag/SaveTag.java index ac0ebb5de..6e5ad3f86 100644 --- a/apps/Tag/src/com/android/apps/tag/SaveTag.java +++ b/apps/Tag/src/com/android/apps/tag/SaveTag.java @@ -16,6 +16,9 @@ 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; @@ -24,11 +27,9 @@ import android.os.Bundle; import android.util.Log; import android.view.WindowManager; 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) */ 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) { StringBuilder sb = new StringBuilder(3 * bytes.length); 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(); } diff --git a/apps/Tag/src/com/android/apps/tag/Tags.java b/apps/Tag/src/com/android/apps/tag/TagBrowserActivity.java similarity index 89% rename from apps/Tag/src/com/android/apps/tag/Tags.java rename to apps/Tag/src/com/android/apps/tag/TagBrowserActivity.java index 21069e9e4..68233b06e 100644 --- a/apps/Tag/src/com/android/apps/tag/Tags.java +++ b/apps/Tag/src/com/android/apps/tag/TagBrowserActivity.java @@ -23,12 +23,9 @@ import android.os.Bundle; 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 { - /** - * Called with the activity is first created. - */ +public class TagBrowserActivity extends TabActivity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); @@ -42,7 +39,8 @@ public class Tags extends TabActivity { TabHost tabHost = getTabHost(); 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); diff --git a/apps/Tag/src/com/android/apps/tag/TagList.java b/apps/Tag/src/com/android/apps/tag/TagList.java index 1f8c66a00..0a467fa12 100644 --- a/apps/Tag/src/com/android/apps/tag/TagList.java +++ b/apps/Tag/src/com/android/apps/tag/TagList.java @@ -29,10 +29,10 @@ import android.widget.ListView; import android.widget.SimpleCursorAdapter; /** + * An {@code Activity} that displays a flat list of tags that can be "opened". * @author nnk@google.com (Nick Kralevich) */ public class TagList extends ListActivity implements DialogInterface.OnClickListener { - private SQLiteDatabase db; private Cursor cursor; 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); db = new TagDBHelper(getBaseContext()).getReadableDatabase(); 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 = new SimpleCursorAdapter(this, android.R.layout.two_line_list_item, @@ -92,6 +96,6 @@ public class TagList extends ListActivity implements DialogInterface.OnClickList } @Override - public void onClick(DialogInterface dialog, int which) { } - + public void onClick(DialogInterface dialog, int which) { + } } diff --git a/apps/Tag/tests/src/com/android/apps/tag/TagsTest.java b/apps/Tag/tests/src/com/android/apps/tag/TagsTest.java index a0bc2247c..368df9195 100644 --- a/apps/Tag/tests/src/com/android/apps/tag/TagsTest.java +++ b/apps/Tag/tests/src/com/android/apps/tag/TagsTest.java @@ -22,13 +22,14 @@ import android.test.ActivityInstrumentationTestCase2; * Make sure that the main launcher activity opens up properly, which will be * verified by {@link #testActivityTestCaseSetUpProperly}. */ -public class TagsTest extends ActivityInstrumentationTestCase2 { +public class TagsTest extends ActivityInstrumentationTestCase2 { /** - * Creates an {@link ActivityInstrumentationTestCase2} for the {@link Tags} activity. + * Creates an {@link ActivityInstrumentationTestCase2} for the + * {@link TagBrowserActivity} activity. */ public TagsTest() { - super(Tags.class); + super(TagBrowserActivity.class); } /**