RTEditor/src/main/java/com/onegravity/rteditor/media/choose/MediaChooserActivity.java
@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        Bundle extras = getIntent().getExtras();
        if (extras != null) {
            String mediaAction = extras.getString(EXTRA_MEDIA_ACTION);
            mMediaAction = mediaAction == null ? null : MediaAction.valueOf(mediaAction);
            mMediaFactory = (RTMediaFactory<RTImage, RTAudio, RTVideo>) extras.getSerializable(EXTRA_MEDIA_FACTORY);
        }

        if (mMediaAction != null) {
            // retrieve parameters
            if (savedInstanceState != null) {
                mSelectedMedia = (RTMedia) savedInstanceState.getSerializable("mSelectedMedia");
            }

            switch (mMediaAction) {

                case PICK_PICTURE:
                case CAPTURE_PICTURE:
                    mMediaChooserMgr = new ImageChooserManager(this, mMediaAction, mMediaFactory, this, savedInstanceState);
                    break;

                case PICK_VIDEO:
                case CAPTURE_VIDEO:
                    mMediaChooserMgr = new VideoChooserManager(this, mMediaAction, mMediaFactory, this, savedInstanceState);
                    break;

                case PICK_AUDIO:
                case CAPTURE_AUDIO:
                    mMediaChooserMgr = new AudioChooserManager(this, mMediaAction, mMediaFactory, this, savedInstanceState);
                    break;
            }

            if (mMediaChooserMgr == null) {
                finish();
            } else if (!isWorkInProgress()) {
                setWorkInProgress(true);
                if (!mMediaChooserMgr.chooseMedia()) {
                    finish();
                }
            }
        } else {
            finish();
        }
    }
@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        Bundle extras = getIntent().getExtras();
        if (extras != null) {
            String mediaAction = extras.getString(EXTRA_MEDIA_ACTION);
            mMediaAction = mediaAction == null ? null : MediaAction.valueOf(mediaAction);
            mMediaFactory = (RTMediaFactory<RTImage, RTAudio, RTVideo>) extras.getSerializable(EXTRA_MEDIA_FACTORY);
        }

        if (mMediaAction != null) {
            // retrieve parameters
            if (savedInstanceState != null) {
                mSelectedMedia = (RTMedia) savedInstanceState.getSerializable("mSelectedMedia");
            }

            switch (mMediaAction) {

                case PICK_PICTURE:
                case CAPTURE_PICTURE:
                    mMediaChooserMgr = new ImageChooserManager(this, mMediaAction, mMediaFactory, this, savedInstanceState);
                    break;

                case PICK_VIDEO:
                case CAPTURE_VIDEO:
                    mMediaChooserMgr = new VideoChooserManager(this, mMediaAction, mMediaFactory, this, savedInstanceState);
                    break;

                case PICK_AUDIO:
                case CAPTURE_AUDIO:
                    mMediaChooserMgr = new AudioChooserManager(this, mMediaAction, mMediaFactory, this, savedInstanceState);
                    break;
            }

            if (mMediaChooserMgr == null) {
                finish();
            } else if (!isWorkInProgress()) {
                setWorkInProgress(true);
                if (!mMediaChooserMgr.chooseMedia()) {
                    finish();
                }
            }
        } else {
            finish();
        }
    }
@ Override protected void onCreate ( Bundle savedInstanceState ) { super . onCreate ( savedInstanceState ) ; Bundle extras = getIntent ( ) . getExtras ( ) ; if ( extras != null ) { String mediaAction = extras . getString ( EXTRA_MEDIA_ACTION ) ; mMediaAction = mediaAction == null ? null : MediaAction . valueOf ( mediaAction ) ; mMediaFactory = ( RTMediaFactory < RTImage , RTAudio , RTVideo > ) extras . getSerializable ( EXTRA_MEDIA_FACTORY ) ; } if ( mMediaAction != null ) { // retrieve parameters if ( savedInstanceState != null ) { mSelectedMedia = ( RTMedia ) savedInstanceState . getSerializable ( "mSelectedMedia" ) ; } switch ( mMediaAction ) { case PICK_PICTURE : case CAPTURE_PICTURE : mMediaChooserMgr = new ImageChooserManager ( this , mMediaAction , mMediaFactory , this , savedInstanceState ) ; break ; case PICK_VIDEO : case CAPTURE_VIDEO : mMediaChooserMgr = new VideoChooserManager ( this , mMediaAction , mMediaFactory , this , savedInstanceState ) ; break ; case PICK_AUDIO : case CAPTURE_AUDIO : mMediaChooserMgr = new AudioChooserManager ( this , mMediaAction , mMediaFactory , this , savedInstanceState ) ; break ; } if ( mMediaChooserMgr == null ) { finish ( ) ; } else if ( ! isWorkInProgress ( ) ) { setWorkInProgress ( true ) ; if ( ! mMediaChooserMgr . chooseMedia ( ) ) { finish ( ) ; } } } else { finish ( ) ; } }
****************************************** Lifecycle Methods *******************************************
****************************************** Lifecycle Methods *******************************************