Android Open Source - SELP2013 Venue Information Activity






From Project

Back to project page SELP2013.

License

The source code is released under:

License ======= This work is licensed under the BSD 2-clause license as follows. # BSD 2-clause license Copyright (c) 2013, Sky Welch All rights reserved. Redistribution and use in source and ...

If you think the Android project SELP2013 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 uk.co.skywelch.selp2013;
/*from   w w  w. ja  v  a  2s  . c  om*/
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.ActionBarActivity;
import android.text.Html;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.TextView;

public class VenueInformationActivity extends ActionBarActivity {
  public final static String TAG = "VenueInformationActivity";
  public final static String VENUE_CODE = "venue_code";

  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    // Set the appropriate content view
    setContentView(R.layout.activity_venue_information);
    
    // Enable the back button in the action bar
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);

    TextView venueTitle = (TextView) findViewById(R.id.venueInfoTitle);
    TextView venueInfo = (TextView) findViewById(R.id.venueInfoText);

    // Check the bundle passed to us for a venue code,
    //  if it's right, use it
    String venue_code = this.getIntent().getExtras().getString(VENUE_CODE);
    Venue venue = null;
    if (venue_code == null) {
      Log.e(TAG, "Venue information activity wasn't passed a venue code value!");

      return;
    } else {
      venue = TimetableActivity.venue_map.get(venue_code);
    }

    if (venue == null) {
      Log.e(TAG, "Venue information activity was passed a code that doesn't exist!");
      venueTitle.setText(venue_code);
      venueInfo.setText("No information available for this venue");

      return;
    }

    // Set the venue information
    
    venueTitle.setText(venue.getNameAndDescription());

    String info = "No information for this venue.";
    if (!venue.map.isEmpty()) {
      info = "<p><b>Map link</b>: " + venue.map + "</p>";
    }

    venueInfo.setText(Html.fromHtml(info));
  }

  @Override
  public boolean onCreateOptionsMenu(Menu menu) {
    getMenuInflater().inflate(R.menu.main, menu);

    return super.onCreateOptionsMenu(menu);
  }

  @Override
  public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
    case R.id.action_home: {
      Intent i = new Intent(this, TimetableActivity.class);
      startActivity(i);
      return true;
    }
    case android.R.id.home: {
      // If the back button is pressed, end the activity
      finish();
      return true;
    }
    default:
      return super.onOptionsItemSelected(item);
    }
  }
}




Java Source Code List

uk.co.skywelch.selp2013.AboutActivity.java
uk.co.skywelch.selp2013.CourseInformationActivity.java
uk.co.skywelch.selp2013.CourseListActivity.java
uk.co.skywelch.selp2013.CourseListAdapter.java
uk.co.skywelch.selp2013.Course.java
uk.co.skywelch.selp2013.CoursesParseTask.java
uk.co.skywelch.selp2013.CoursesXmlParser.java
uk.co.skywelch.selp2013.DrawerListAdapter.java
uk.co.skywelch.selp2013.FileDownloader.java
uk.co.skywelch.selp2013.HourMinute.java
uk.co.skywelch.selp2013.Lecture.java
uk.co.skywelch.selp2013.ListItem.java
uk.co.skywelch.selp2013.ListSection.java
uk.co.skywelch.selp2013.StringListItem.java
uk.co.skywelch.selp2013.TimetableActivity.java
uk.co.skywelch.selp2013.TimetableFragment.java
uk.co.skywelch.selp2013.TimetableListAdapter.java
uk.co.skywelch.selp2013.TimetableParseTask.java
uk.co.skywelch.selp2013.TimetableXmlParser.java
uk.co.skywelch.selp2013.VenueInformationActivity.java
uk.co.skywelch.selp2013.Venue.java
uk.co.skywelch.selp2013.VenuesParseTask.java
uk.co.skywelch.selp2013.VenuesXmlParser.java
uk.co.skywelch.selp2013.XMLUtilities.java