コード例 #1
0
  @Override
  public View getView(int position, View convertView, ViewGroup parent) {
    if (convertView == null) {
      LayoutInflater vi =
          (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
      convertView = vi.inflate(R.layout.episode_item, null);
    }

    Show show = getItem(position);
    if (show != null) {
      // Show title
      TextView title = (TextView) convertView.findViewById(R.id.show_title);
      if (title != null) {
        title.setText(show.getName());
      }

      // Last episode
      TextView last = (TextView) convertView.findViewById(R.id.last_ep);
      if (last != null) last.setText(Html.fromHtml("<b>Previous:</b> " + show.getLastEpisode()));

      // Next episode
      TextView next = (TextView) convertView.findViewById(R.id.next_ep);
      if (next != null) next.setText(Html.fromHtml("<b>Next:</b> " + show.getNextEpisode()));
    }
    return convertView;
  }
コード例 #2
0
ファイル: ShowView.java プロジェクト: sana-malik/TVTracker
  /** 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;
          }
        });
  }