FileDocCategorySizeDatePackage
OnePlayerActivity.javaAPI DocAndroid 5.1 API8517Thu Mar 12 22:22:44 GMT 2015com.android.onemedia

OnePlayerActivity

public class OnePlayerActivity extends android.app.Activity

Fields Summary
private static final String
TAG
private static final int
READ_REQUEST_CODE
protected PlayerController
mPlayer
private android.widget.Button
mStartButton
private android.widget.Button
mPlayButton
private android.widget.Button
mRouteButton
private android.widget.TextView
mStatusView
private android.widget.EditText
mContentText
private android.widget.EditText
mNextContentText
private android.widget.CheckBox
mHasVideo
private android.widget.ImageView
mArtView
private android.media.session.PlaybackState
mPlaybackState
private android.graphics.Bitmap
mAlbumArtBitmap
private View.OnClickListener
mButtonListener
private PlayerController.Listener
mListener
Constructors Summary
Methods Summary
public voidonActivityResult(int requestCode, int resultCode, android.content.Intent resultData)

        if (requestCode == READ_REQUEST_CODE && resultCode == Activity.RESULT_OK) {
            Uri uri = null;
            if (resultData != null) {
                uri = resultData.getData();
                Log.i(TAG, "Uri: " + uri.toString());
                mAlbumArtBitmap = null;
                try {
                    mAlbumArtBitmap = MediaStore.Images.Media.getBitmap(this.getContentResolver(), uri);
                } catch (IOException e) {
                    Log.v(TAG, "Couldn't load album art", e);
                }
                mArtView.setImageBitmap(mAlbumArtBitmap);
                if (mAlbumArtBitmap != null) {
                    mArtView.setVisibility(View.VISIBLE);
                } else {
                    mArtView.setVisibility(View.GONE);
                }
                mPlayer.setArt(mAlbumArtBitmap);
            }
        }
    
protected voidonCreate(android.os.Bundle savedInstanceState)


    
        
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_one_player);
        mPlayer = new PlayerController(this, OnePlayerService.getServiceIntent(this));


        mStartButton = (Button) findViewById(R.id.start_button);
        mPlayButton = (Button) findViewById(R.id.play_button);
        mRouteButton = (Button) findViewById(R.id.route_button);
        mStatusView = (TextView) findViewById(R.id.status);
        mContentText = (EditText) findViewById(R.id.content);
        mNextContentText = (EditText) findViewById(R.id.next_content);
        mHasVideo = (CheckBox) findViewById(R.id.has_video);
        mArtView = (ImageView) findViewById(R.id.art);

        final Button artPicker = (Button) findViewById(R.id.art_picker);
        artPicker.setOnClickListener(mButtonListener);

        mStartButton.setOnClickListener(mButtonListener);
        mPlayButton.setOnClickListener(mButtonListener);
        mRouteButton.setOnClickListener(mButtonListener);

    
public booleanonCreateOptionsMenu(android.view.Menu menu)

        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.main, menu);
        return true;
    
public voidonPause()

        mPlayer.setListener(null);
        mPlayer.onPause();
        super.onPause();
    
public voidonResume()

        super.onResume();
        mPlayer.onResume();
        mPlayer.setListener(mListener);
    
private voidsetControlsEnabled(boolean enabled)

        mStartButton.setEnabled(enabled);
        mPlayButton.setEnabled(enabled);