Search in sources :

Example 6 with TransferProgressController

use of com.owncloud.android.ui.controller.TransferProgressController in project android by owncloud.

the class PreviewVideoFragment method onActivityCreated.

/**
     * {@inheritDoc}
     */
@Override
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    Log_OC.v(TAG, "onActivityCreated");
    OCFile file;
    if (savedInstanceState == null) {
        Bundle args = getArguments();
        file = args.getParcelable(PreviewVideoFragment.EXTRA_FILE);
        setFile(file);
        mAccount = args.getParcelable(PreviewVideoFragment.EXTRA_ACCOUNT);
        mSavedPlaybackPosition = args.getInt(PreviewVideoFragment.EXTRA_PLAY_POSITION);
        mAutoplay = args.getBoolean(PreviewVideoFragment.EXTRA_PLAYING);
    } else {
        file = savedInstanceState.getParcelable(PreviewVideoFragment.EXTRA_FILE);
        setFile(file);
        mAccount = savedInstanceState.getParcelable(PreviewVideoFragment.EXTRA_ACCOUNT);
        mSavedPlaybackPosition = savedInstanceState.getInt(PreviewVideoFragment.EXTRA_PLAY_POSITION);
        mAutoplay = savedInstanceState.getBoolean(PreviewVideoFragment.EXTRA_PLAYING);
    }
    if (file == null) {
        throw new IllegalStateException("Instanced with a NULL OCFile");
    }
    if (mAccount == null) {
        throw new IllegalStateException("Instanced with a NULL ownCloud Account");
    }
    if (!file.isDown()) {
        throw new IllegalStateException("There is no local file to preview");
    }
    if (!file.isVideo()) {
        throw new IllegalStateException("Not a video file");
    }
    mProgressController = new TransferProgressController(mContainerActivity);
    mProgressController.setProgressBar(mProgressBar);
    prepareVideo();
}
Also used : OCFile(com.owncloud.android.datamodel.OCFile) TransferProgressController(com.owncloud.android.ui.controller.TransferProgressController) Bundle(android.os.Bundle)

Aggregations

TransferProgressController (com.owncloud.android.ui.controller.TransferProgressController)6 OCFile (com.owncloud.android.datamodel.OCFile)3 Bundle (android.os.Bundle)2 ProgressBar (android.widget.ProgressBar)1 ComponentsGetter (com.owncloud.android.ui.activity.ComponentsGetter)1