Search in sources :

Example 1 with DIDLObject

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();
}
Also used : Intent(android.content.Intent) ImageView(android.widget.ImageView) View(android.view.View) AdapterView(android.widget.AdapterView) TextView(android.widget.TextView) ListView(android.widget.ListView) MenuItem(android.view.MenuItem) PlaylistItem(com.kevinshen.beyondupnp.database.BeyondUpnpContract.PlaylistItem) Item(org.fourthline.cling.support.model.item.Item) Container(org.fourthline.cling.support.model.container.Container) ListView(android.widget.ListView) DIDLObject(org.fourthline.cling.support.model.DIDLObject) AdapterView(android.widget.AdapterView)

Aggregations

Intent (android.content.Intent)1 MenuItem (android.view.MenuItem)1 View (android.view.View)1 AdapterView (android.widget.AdapterView)1 ImageView (android.widget.ImageView)1 ListView (android.widget.ListView)1 TextView (android.widget.TextView)1 PlaylistItem (com.kevinshen.beyondupnp.database.BeyondUpnpContract.PlaylistItem)1 DIDLObject (org.fourthline.cling.support.model.DIDLObject)1 Container (org.fourthline.cling.support.model.container.Container)1 Item (org.fourthline.cling.support.model.item.Item)1