Android Open Source - mobile-android Speaker List Activity






From Project

Back to project page mobile-android.

License

The source code is released under:

MIT License

If you think the Android project mobile-android listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.manyconf.conference;
/*ww w  .j a v a2 s.  com*/
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.MenuItem;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ListView;

import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;

public class SpeakerListActivity extends Activity implements AdapterView.OnItemClickListener  {

    private ConferenceModel conference;
    private int conferenceListID;

    ListView speakerListView;
    ArrayList<SpeakerModel> speakerList = new ArrayList<SpeakerModel>();

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        Log.d("manyconf.slist", "onCreate()");
        super.onCreate(savedInstanceState);

        // Retrieve conference that we should display
        LinkedHashMap<Integer, ConferenceModel> conferenceList = ((ConferenceApplication)getApplication()).getConferenceList();
         conferenceListID = this.getIntent().getExtras().getInt("conferenceListID");
        conference = conferenceList.get( conferenceListID);

        setContentView(R.layout.activity_speaker_list);

        // Set up listener for taps
        speakerListView = (ListView) findViewById(R.id.speaker_listview);
        speakerListView.setOnItemClickListener(this);

        // Copy the tree set to an array. Yeah I know.
        Log.d("manyconf.slist", String.format("Found %d speakers", conference.speakers.size()));
        for(SpeakerModel sm : conference.speakers) {
            speakerList.add(sm);
        }

        // Hook up data model with list view
        ArrayAdapter arrayAdapter = new ThemedArrayAdapter(this,
                android.R.layout.simple_list_item_1,
                speakerList);
        speakerListView.setAdapter(arrayAdapter);
        arrayAdapter.notifyDataSetChanged();

    }

    @Override
    public void onItemClick(AdapterView parent, View view, int position, long id) {
        Log.d("manyconf.slist", "clicked");

        Intent intent = new Intent(this, SpeakerActivity.class);
        SpeakerModel speaker = speakerList.get(position);
        intent.putExtra("speaker", speaker);
        startActivity(intent);
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        Log.d("manyconf.slist", "onOptionsItemSelected()");
        switch (item.getItemId()) {
            case android.R.id.home:
                // If user taps the Up button in the navbar, just finish()
                Log.d("manyconf.pres", "finish");
                finish();
                return true;
        }
        Log.d("manyconf.sched", "call super");
        return super.onOptionsItemSelected(item);
    }
}




Java Source Code List

com.manyconf.conference.ConferenceApplication.java
com.manyconf.conference.ConferenceBuilderDelegate.java
com.manyconf.conference.ConferenceBuilder.java
com.manyconf.conference.ConferenceDetailActivity.java
com.manyconf.conference.ConferenceListActivity.java
com.manyconf.conference.ConferenceModel.java
com.manyconf.conference.Const.java
com.manyconf.conference.IsoDateParser.java
com.manyconf.conference.MainActivity.java
com.manyconf.conference.PresentationActivity.java
com.manyconf.conference.PresentationModel.java
com.manyconf.conference.PrivateConst.java
com.manyconf.conference.ReadFile.java
com.manyconf.conference.ScheduleActivity.java
com.manyconf.conference.ServiceHandler.java
com.manyconf.conference.SpeakerActivity.java
com.manyconf.conference.SpeakerListActivity.java
com.manyconf.conference.SpeakerModel.java
com.manyconf.conference.Theme.java
com.manyconf.conference.ThemedArrayAdapter.java
com.manyconf.conference.TrackModel.java