Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.example.bronx.englishforfun;
- import android.content.Intent;
- import android.media.MediaPlayer;
- import android.support.v7.app.ActionBarActivity;
- import android.os.Bundle;
- import android.view.Menu;
- import android.view.MenuItem;
- import android.view.View;
- import android.widget.ArrayAdapter;
- import android.widget.Button;
- import android.widget.ListView;
- import android.widget.SeekBar;
- import android.widget.TextView;
- import java.util.ArrayList;
- import java.util.Arrays;
- public class podcastPlayer extends ActionBarActivity {
- // public class podcastPlayer extends ActionBarActivity implements View.OnClickListener {
- private MediaPlayer mp1;
- int item;
- SeekBar sb1;
- Button playbtn;
- Thread updateSeekBar1;
- ListView lvpodcast;
- ArrayAdapter<String> adapter ;
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_podcast_player);
- playbtn = (Button) findViewById(R.id.playpBtn);
- sb1 = (SeekBar) findViewById(R.id.seekBar2);
- lvpodcast = (ListView) findViewById(R.id.lvpod);
- updateSeekBar1 = new Thread() {
- public void run() {
- int totalDuration = mp1.getDuration();
- int currentPosition = 0;
- while (currentPosition < totalDuration) {
- try {
- sleep(500);
- currentPosition = mp1.getCurrentPosition();
- sb1.setProgress(currentPosition);
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
- }
- };
- Intent u = getIntent();
- Bundle t = u.getExtras();
- item = t.getInt("podcast1");
- if (item == 0) {
- String podcast1[] = {"Gloria: Did you hear that Manuel is quitting? He took a job with another company.",
- "Sam: I'm not surprised. He came up against the glass ceiling and he decided to jump ship.",
- "Gloria: Really? I didn't know he was bucking for promotion.",
- "Sam: He's been trying to become a manager for three years, but other people have been promoted over him or they've hired from outside the company.",
- "Gloria: I didn't know that. I was aware of the wage disparities within the company and the gender pay gap within each department, but this is news to me.",
- "Sam: Haven't you noticed that people who take extended leave to have children or try for some type of work-life balance are passed over for plum assignments, raises, and promotions? There are definite limits to advancement.",
- "Gloria: I thought it was just favoritism on the part of the bosses. Their friends got promoted and other people didn't.",
- "Sam: That's certainly true, but that's only part of the story.",
- "Gloria: Why are we still working for a company with such unfair policies?",
- "Sam: Speak for yourself. I'm giving notice today."};
- ArrayList<String> podL = new ArrayList<String>();
- podL.addAll( Arrays.asList(podcast1) );
- adapter = new ArrayAdapter<String>(this, R.layout.row, podL);
- lvpodcast.setAdapter(adapter);
- if(mp1!=null){
- mp1.stop();
- mp1.release();
- }
- mp1 = MediaPlayer.create(podcastPlayer.this, R.raw.limits);
- mp1.start();
- sb1.setMax(mp1.getDuration());
- updateSeekBar1.start();
- playbtn.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- if (mp1.isPlaying()) {
- playbtn.setText("ODTWARZAJ");
- mp1.pause();
- } else {
- playbtn.setText("ZATRZYMAJ");
- mp1.start();
- }
- }
- });
- sb1.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
- public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
- }
- public void onStartTrackingTouch(SeekBar seekBar) {
- }
- public void onStopTrackingTouch(SeekBar seekBar) {
- mp1.seekTo(seekBar.getProgress());
- }
- });
- }
- Intent j = getIntent();
- Bundle g = j.getExtras();
- item = g.getInt("podcast2");
- if (item == 1) {
- String podcast1[] = {"Nico: I’ve moving to Atlanta. I want a fresh start.\n" +
- "\n" +
- "Celia: This is a surprise. I thought you were going to stick it out here and try to put the past behind you.\n" +
- "\n" +
- "Nico: There are too many reminders here. I want a clean slate. What’s done is done and I’m tired of blame and recriminations.\n" +
- "\n" +
- "Celia: I’m glad to hear you’ve stopped beating yourself up over what’s happened, but are you sure moving away will help you move on?\n" +
- "\n" +
- "Nico: The world is my oyster now, isn’t it? I can live anywhere I want to and do anything I want to.\n" +
- "\n" +
- "Celia: I guess so, but are you sure you want to uproot and leave town?\n" +
- "\n" +
- "Nico: I’m not trying to reinvent myself, but if I’m going to start over, I might as well do it in a new town.\n" +
- "\n" +
- "Celia: I guess a new town is a good place to start a new life and maybe you’ll find a new love. Many people bounce back from a difficult divorce.\n" +
- "\n" +
- "Nico: I’ve sworn off women. The only female I want in my life right now is my dog Fifi!"};
- ArrayList<String> podL = new ArrayList<String>();
- podL.addAll( Arrays.asList(podcast1));
- adapter = new ArrayAdapter<String>(this, R.layout.row, podL);
- lvpodcast.setAdapter(adapter);
- if(mp1!=null){
- mp1.stop();
- mp1.release();
- }
- mp1 = MediaPlayer.create(podcastPlayer.this, R.raw.getting);
- mp1.start();
- sb1.setMax(mp1.getDuration());
- updateSeekBar1.start();
- playbtn.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- if (mp1.isPlaying()) {
- playbtn.setText("ODTWARZAJ");
- mp1.pause();
- } else {
- playbtn.setText("ZATRZYMAJ");
- mp1.start();
- }
- }
- });
- }
- Intent k = getIntent();
- Bundle f = k.getExtras();
- item = f.getInt("podcast3");
- if (item == 2) {
- String podcast1[] = {"Amelia: I wish we had hired a professional videographer to film it instead of asking your friend Lenny to do it.\n" +
- "\n" +
- "Victor: This video isn’t so bad. The production quality isn’t the best, but he did a pretty good job.\n" +
- "\n" +
- "Amelia: It’s not bad if you like your video out-of-focus. There are no transitions between scenes and the lighting is terrible. At best, it looks like a rough cut.\n" +
- "\n" +
- "Victor: It is a little rough, I admit.\n" +
- "\n" +
- "Amelia: There are problems with the audio, too. There are sections of dead air when the audio cuts out. And when there is audio, the volume isn’t uniform.\n" +
- "\n" +
- "Victor: That’s true, too, I guess…\n" +
- "\n" +
- "Amelia: And the handheld camera footage is so shaky that I feel ill watching it.\n" +
- "\n" +
- "Victor: Lenny was just having a good time, getting into the spirit of it.\n" +
- "\n" +
- "Amelia: Is that why he got close-up shots of all of the pretty women and none of the other guests?\n" +
- "\n" +
- "Victor: Well, you know Lenny. He’ll do better next time.\n" +
- "\n" +
- "Amelia: Next time?! How many times do you plan to get married? "};
- ArrayList<String> podL = new ArrayList<String>();
- podL.addAll( Arrays.asList(podcast1));
- adapter = new ArrayAdapter<String>(this, R.layout.row, podL);
- lvpodcast.setAdapter(adapter);
- if(mp1!=null){
- mp1.stop();
- mp1.release();
- }
- mp1 = MediaPlayer.create(podcastPlayer.this, R.raw.describing);
- mp1.start();
- sb1.setMax(mp1.getDuration());
- updateSeekBar1.start();
- playbtn.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- if (mp1.isPlaying()) {
- playbtn.setText("ODTWARZAJ");
- mp1.pause();
- } else {
- playbtn.setText("ZATRZYMAJ");
- mp1.start();
- }
- }
- });
- }
- }
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.menu_podcast_player, menu);
- return true;
- }
- @Override
- public boolean onOptionsItemSelected(MenuItem item) {
- // Handle action bar item clicks here. The action bar will
- // automatically handle clicks on the Home/Up button, so long
- // as you specify a parent activity in AndroidManifest.xml.
- int id = item.getItemId();
- //noinspection SimplifiableIfStatement
- if (id == R.id.action_settings) {
- return true;
- }
- return super.onOptionsItemSelected(item);
- }
- public void onBackPressed(){
- mp1.stop();
- finish();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement