Android Open Source - mobile-android Presentation 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;
//from   w  w w  .java 2 s.com
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.text.method.ScrollingMovementMethod;
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 android.widget.TextView;

import java.text.DateFormat;
import java.util.LinkedHashMap;

public class PresentationActivity extends Activity implements AdapterView.OnItemClickListener {

    private ConferenceModel conference;
    private PresentationModel presentation;
    private int conferenceListID;
    private int presentationListIndex;
    private TextView titleTextView;
    private TextView descriptionTextView;
    private TextView timeTextView;
    private ListView speakerListView;

    private DateFormat dateFormat = DateFormat.getTimeInstance();

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

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

        // Set up user interface
        setContentView(R.layout.activity_presentation);
        titleTextView = (TextView) findViewById(R.id.title);
        descriptionTextView = (TextView) findViewById(R.id.description);
        descriptionTextView.setMovementMethod(new ScrollingMovementMethod());
        timeTextView  = (TextView) findViewById(R.id.startendtime);
        speakerListView = (ListView) findViewById(R.id.speaker_listview);

        // Fill user interface
        titleTextView.setText(presentation.title);
        descriptionTextView.setText(presentation.description);

        String startendtime = "";
        if(presentation.starttime != null && presentation.endtime != null) {
            startendtime += "From " + dateFormat.format(presentation.starttime) + " to " + dateFormat.format(presentation.endtime);
        } else if(presentation.starttime != null && presentation.endtime == null) {
            startendtime += "Starts at " + dateFormat.format(presentation.starttime);
        }
        timeTextView.setText(startendtime);

        // Fill list view
        if(presentation.speakers.size() != 0) {
            // Create an ArrayAdapter for the ListView
            ArrayAdapter arrayAdapter = new ThemedArrayAdapter(this,
                    android.R.layout.simple_list_item_1,
                    presentation.speakers);

            // Connect list view to adapter and listener
            speakerListView.setAdapter(arrayAdapter);
            arrayAdapter.notifyDataSetChanged();
            speakerListView.setOnItemClickListener(this);
        }

        this.setTheme();
    }

    private void setTheme() {
        titleTextView.setTypeface(Theme.current().boldFont);
        descriptionTextView.setTypeface(Theme.current().regularFont);
        timeTextView.setTypeface(Theme.current().regularFont);
    }

    @Override
    public void onItemClick(AdapterView parent, View view, int position, long id) {
        Log.d("manyconf.pres", "clicked");
        Intent intent = new Intent(this, SpeakerActivity.class);
        SpeakerModel speaker = presentation.speakers.get(position);
        intent.putExtra("speaker", speaker);
        startActivity(intent);
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        Log.d("manyconf.pres", "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.pres", "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