Sony SmartEyeglass overlapping layout

118 views Asked by At

I am trying to implement card text change on Sony SmartEyeglass, but I am having trouble with the layouts. I adopted the advanced layout sample from the SDK and modified it.

I have a default xml layout that displays a title and a body text. I put 'Title' and 'Body' as default strings in the xml file, and tried to update the title and body as 'Updated' and 'Updated body text'. However, the result shows me the default layout (with 'Title' and 'Body') and the text 'Updated body text' overlapping on top of them.

Why is the title not edited, and how come the body text is on top of the xml TextView?

Here is the relevant code:

@Override
public void onResume() {
    showingDetail = false;

    ControlListItem item = createControlListItem(namePosition);
    showLayout(item.dataXmlLayout, null);
    sendListCount(item.layoutReference, quotedPeople.size());
    sendListPosition(item.layoutReference, namePosition);
    //utils.sendTextViewLayoutId(R.id.names_body);
    sendListItem(item);
}

private ControlListItem createControlListItem(final int position) {
    Log.d(Constants.LOG_TAG, "position = " + position);

    ControlListItem item = new ControlListItem();
    item.layoutReference = R.id.names_gallery;
    item.dataXmlLayout = R.layout.smarteyeglass_quotes_names_gallery;
    item.listItemId = position;
    item.listItemPosition = position;

    List<Bundle> list = new ArrayList<Bundle>();

    // Header data
    Bundle headerBundle = new Bundle();
    headerBundle.putInt(Control.Intents.EXTRA_LAYOUT_REFERENCE, R.id.names_title);
    headerBundle.putString(Control.Intents.EXTRA_TEXT, "Updated");
    list.add(headerBundle);

    // Body data
    Bundle bodyBundle = new Bundle();
    bodyBundle.putInt(Control.Intents.EXTRA_LAYOUT_REFERENCE, R.id.names_body);
    bodyBundle.putString(Control.Intents.EXTRA_TEXT, "Updated body title");
    list.add(bodyBundle);

    item.layoutData = list.toArray(new Bundle[list.size()]);
    return item;
}

Here is the xml layout file:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="@dimen/smarteyeglass_control_width"
    android:layout_height="@dimen/smarteyeglass_control_height"
    tools:ignore="PxUsage,UselessParent,HardcodedText" >

    <TextView
        android:id="@+id/names_title"
        android:layout_width="400px"
        android:layout_height="30px"
        android:layout_alignParentTop="true"
        android:layout_alignParentLeft="true"
        android:layout_centerVertical="true"
        android:layout_marginTop="5px"
        android:paddingLeft="6px"
        android:background="@android:color/black"
        android:text="Title"
        android:textColor="@android:color/white"
        android:textSize="@dimen/smarteyeglass_text_size_normal" />

    <View
        android:id="@+id/names_divider"
        android:layout_width="400px"
        android:layout_height="2px"
        android:layout_alignParentLeft="true"
        android:layout_below="@+id/names_title"
        android:background="@android:color/white" />

    <TextView
        android:id="@+id/names_body"
        android:layout_width="400px"
        android:layout_height="78px"
        android:layout_marginTop="5px"
        android:layout_marginLeft="10px"
        android:layout_alignParentLeft="true"
        android:layout_below="@+id/names_divider"
        android:textColor="@android:color/white"
        android:textSize="@dimen/smarteyeglass_text_size_small"
        android:text="Body" />

    <Gallery
        android:id="@+id/names_gallery"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent" >
    </Gallery>

</RelativeLayout>
1

There are 1 answers

2
peter.bartos On

we just tested your example and the text is changing fine. It looks like you might have picked the wrong XML for the gallery item. You started with smarteyeglass_layout_test_gallery instead using smarteyeglass_item_gallery.