summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--res/layout/my_tag_activity.xml26
-rw-r--r--src/com/android/apps/tag/MyTagActivity.java18
-rw-r--r--src/com/android/apps/tag/TagViewer.java4
3 files changed, 10 insertions, 38 deletions
diff --git a/res/layout/my_tag_activity.xml b/res/layout/my_tag_activity.xml
index 13bda73..cd8f7b3 100644
--- a/res/layout/my_tag_activity.xml
+++ b/res/layout/my_tag_activity.xml
@@ -65,29 +65,6 @@ limitations under the License.
<include layout="@layout/tag_divider" />
- <!-- Tag title -->
- <LinearLayout
- android:padding="8dip"
- android:orientation="vertical"
- android:layout_width="match_parent"
- android:layout_height="wrap_content" >
-
- <TextView
- android:text="@string/tag_title"
- style="@style/record_title"
- />
-
- <EditText
- android:id="@+id/input_tag_title"
- android:inputType="textMultiLine"
- android:lines="1"
- android:layout_width="match_parent"
- android:layout_height="wrap_content" />
-
- </LinearLayout>
-
- <include layout="@layout/tag_divider" />
-
<!-- Tag text -->
<LinearLayout
android:padding="8dip"
@@ -103,7 +80,8 @@ limitations under the License.
<EditText
android:id="@+id/input_tag_text"
android:inputType="textMultiLine"
- android:lines="2"
+ android:lines="3"
+ android:gravity="top"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
diff --git a/src/com/android/apps/tag/MyTagActivity.java b/src/com/android/apps/tag/MyTagActivity.java
index aae6c82..f25d165 100644
--- a/src/com/android/apps/tag/MyTagActivity.java
+++ b/src/com/android/apps/tag/MyTagActivity.java
@@ -51,7 +51,6 @@ public class MyTagActivity extends EditTagActivity implements OnClickListener {
private static final String LOG_TAG = "TagEditor";
- private EditText mTitleView;
private EditText mTextView;
private CheckBox mEnabled;
@@ -70,7 +69,6 @@ public class MyTagActivity extends EditTagActivity implements OnClickListener {
findViewById(R.id.toggle_enabled_target).setOnClickListener(this);
findViewById(R.id.add_content_target).setOnClickListener(this);
- mTitleView = (EditText) findViewById(R.id.input_tag_title);
mTextView = (EditText) findViewById(R.id.input_tag_text);
mEnabled = (CheckBox) findViewById(R.id.toggle_enabled_checkbox);
@@ -100,17 +98,16 @@ public class MyTagActivity extends EditTagActivity implements OnClickListener {
ParsedNdefMessage parsed = NdefMessageParser.parse(localMessage);
List<ParsedNdefRecord> records = parsed.getRecords();
- // There is always a "Title" and a "Text" record for My Tag.
- if (records.size() < 2) {
+ // There is always a "Text" record for a My Tag.
+ if (records.size() < 1) {
Log.w(LOG_TAG, "Local record not in expected format");
return;
}
mEnabled.setChecked(true);
- mTitleView.setText(((TextRecord) records.get(0)).getText());
- mTextView.setText(((TextRecord) records.get(1)).getText());
+ mTextView.setText(((TextRecord) records.get(0)).getText());
mRecords.clear();
- for (int i = 2, len = records.size(); i < len; i++) {
+ for (int i = 1, len = records.size(); i < len; i++) {
RecordEditInfo editInfo = records.get(i).getEditInfo(this);
if (editInfo != null) {
addRecord(editInfo);
@@ -130,10 +127,9 @@ public class MyTagActivity extends EditTagActivity implements OnClickListener {
if ("text/plain".equals(type)) {
String title = getIntent().getStringExtra(Intent.EXTRA_SUBJECT);
- mTitleView.setText((title == null) ? "" : title);
+ mTextView.setText((title == null) ? "" : title);
String text = getIntent().getStringExtra(Intent.EXTRA_TEXT);
-
try {
URL parsed = new URL(text);
@@ -159,18 +155,16 @@ public class MyTagActivity extends EditTagActivity implements OnClickListener {
* Persists content to store.
*/
private void onSave() {
- String title = mTitleView.getText().toString();
String text = mTextView.getText().toString();
NfcAdapter nfc = NfcAdapter.getDefaultAdapter();
- if ((title.isEmpty() && text.isEmpty()) || !mEnabled.isChecked()) {
+ if (!mEnabled.isChecked()) {
nfc.setLocalNdefMessage(null);
return;
}
Locale locale = getResources().getConfiguration().locale;
ArrayList<NdefRecord> values = Lists.newArrayList(
- TextRecord.newTextRecord(title, locale),
TextRecord.newTextRecord(text, locale)
);
diff --git a/src/com/android/apps/tag/TagViewer.java b/src/com/android/apps/tag/TagViewer.java
index 99e1645..7e68939 100644
--- a/src/com/android/apps/tag/TagViewer.java
+++ b/src/com/android/apps/tag/TagViewer.java
@@ -135,7 +135,7 @@ public class TagViewer extends Activity implements OnClickListener {
// Parse the intent
String action = intent.getAction();
if (NfcAdapter.ACTION_TAG_DISCOVERED.equals(action)) {
- // When a tag is discovered we send it to the service to be save. We
+ // When a tag is discovered we send it to the service to be saved. We
// include a PendingIntent for the service to call back onto. This
// will cause this activity to be restarted with onNewIntent(). At
// that time we read it from the database and view it.
@@ -183,11 +183,11 @@ public class TagViewer extends Activity implements OnClickListener {
// Setup the views
if (!intent.getBooleanExtra(EXTRA_KEEP_TITLE, false)) {
setTitle(R.string.title_existing_tag);
+ mDate.setVisibility(View.VISIBLE);
}
mStar.setVisibility(View.VISIBLE);
mStar.setEnabled(false); // it's reenabled when the async load completes
- mDate.setVisibility(View.VISIBLE);
// Read the tag from the database asynchronously
mTagUri = intent.getData();