Ejemplo n.º 1
0
  /** Called when the activity is first created. */
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    // Retrieve course object and associated semester.
    s = (Show) getIntent().getExtras().getSerializable("show");
    setContentView(R.layout.show);

    // Show details
    TextView showName = (TextView) findViewById(R.id.show_name);
    showName.setText(s.getName());

    TableLayout details = (TableLayout) findViewById(R.id.info_table);
    TextView classification = (TextView) details.findViewById(R.id.classi);
    classification.setText(s.getClassification());

    TextView genres = (TextView) details.findViewById(R.id.genres);
    genres.setText(s.getGenreString());

    TextView airs = (TextView) details.findViewById(R.id.airs);
    airs.setText(s.getAirInfo());

    TextView runtime = (TextView) details.findViewById(R.id.runtime);
    runtime.setText(s.getRuntime() + " min");

    // Episodes
    TableLayout eps = (TableLayout) findViewById(R.id.ep_table);
    TextView last = (TextView) eps.findViewById(R.id.lastEp);
    last.setText(s.getLastEpisode());

    TextView next = (TextView) eps.findViewById(R.id.nextEp);
    next.setText(s.getNextEpisode());

    ExpandableListView seas = (ExpandableListView) findViewById(R.id.season_list);
    mAdapter = new SeasonListAdapter();
    seas.setAdapter(mAdapter);
    seas.setOnChildClickListener(
        new OnChildClickListener() {
          public boolean onChildClick(ExpandableListView parent, View v, int s, int e, long id) {
            Intent browse =
                new Intent(
                    Intent.ACTION_VIEW,
                    Uri.parse(((SeasonListAdapter) mAdapter).getChild(s, e).getLink()));
            startActivity(browse);
            return true;
          }
        });
  }