@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.episode); // this.getExternalFilesDir(null) this.database = new EpisodeDatabase(this); mFetcher = new EpisodeFetcher(this.database); mProgressBar = (SeekBar) findViewById(R.id.SeekBar); mProgressBar.setOnSeekBarChangeListener(weightSeekBarListener); mTitle = (TextView) findViewById(R.id.title); mDescription = (TextView) findViewById(R.id.textarea); mScrollView = (ScrollView) findViewById(R.id.scrollview); // mStreamTxt = (TextView) findViewById(R.id.streamtxt); TableRow mButton1 = (TableRow) findViewById(R.id.row1); TableRow mButton2 = (TableRow) findViewById(R.id.row2); TableRow mButton3 = (TableRow) findViewById(R.id.row3); mButtons.add(mButton1); mButtons.add(mButton2); mButtons.add(mButton3); // Bundle bun = getIntent().getExtras(); mTitle.setText(bun.getString("title")); // is this needed? Spanned desc = Html.fromHtml(bun.getString("description")); mDescription.setText(desc); mPlayButton = (Button) findViewById(R.id.play); mPlayButton.setOnClickListener(playButtonListener); int episodeNumber = bun.getInt("episode"); Episode episode = database.getEpisode(episodeNumber); if (episode != null) { mEpisode = episode; mDescription.setText(mEpisode.getDescription()); } episodeLoader = new LoadEpisode(); episodeLoader.execute(episodeNumber); }
public void buttonClickHandler(View v) { final int id = v.getId(); for (TableRow tr : mButtons) { if (id == tr.getId()) activateButton(tr); else resetButton(tr); } if (id == R.id.row1) { mDescription.setText(mEpisode.getDescription()); } else if (id == R.id.row2) { String t = mEpisode.getTransscript(); // System.out.print(t); mDescription.setText(t.toString()); } else if (id == R.id.row3) { mDescription.setText(mShowNotes); } }
@Test public void itReturnsEmptyDescriptionWhenItIsNull() { Episode episode = new Episode(); assertThat(episode.getDescription(), is("")); }