use of org.fourthline.cling.support.model.DIDLObject in project BeyondUPnP by kevinshine.
the class ContentContainerActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.listview);
mObjectId = getIntent().getStringExtra(OBJECT_ID_TAG);
mIdentifierString = getIntent().getStringExtra(IDENTIFIER_STRING_TAG);
String title = getIntent().getStringExtra(CONTENT_CONTAINER_TITLE);
//Display container title.
if (title != null) {
setTitle(title);
} else {
setTitle("");
}
mDidlObjectAdapter = new DIDLObjectAdapter(ContentContainerActivity.this);
ListView listView = (ListView) findViewById(android.R.id.list);
listView.setAdapter(mDidlObjectAdapter);
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
DIDLObject didlObject = mDidlObjectAdapter.getItem(position);
if (didlObject instanceof Container) {
Intent intent = new Intent(ContentContainerActivity.this, ContentContainerActivity.class);
intent.putExtra(ContentContainerActivity.OBJECT_ID_TAG, didlObject.getId());
intent.putExtra(ContentContainerActivity.IDENTIFIER_STRING_TAG, mIdentifierString);
intent.putExtra(ContentContainerActivity.CONTENT_CONTAINER_TITLE, didlObject.getTitle());
startActivity(intent);
} else if (didlObject instanceof Item) {
Item item = (Item) didlObject;
playItem(item);
}
}
});
loadContent();
}
Aggregations