package com.google.sample.castcompanionlibrary.cast.activities;

import com.google.sample.castcompanionlibrary.R;
import com.google.sample.castcompanionlibrary.cast.activities.VideoCastActivity;
import com.google.sample.castcompanionlibrary.widgets.IMiniController;

/**
 * This class takes care of automatically handling the lifecycle events of a MiniController view in
 * the layout.
 * 
 * @author Christophe Beyls
 * 
 */
public class MiniControllerActivity extends VideoCastActivity {

	private IMiniController mMiniController;

	@Override
	protected void onStart() {
		super.onStart();
		if (mMiniController == null) {
			mMiniController = (IMiniController) findViewById(getMiniControllerId());
		}
		mCastManager.addMiniController(mMiniController);
	}

	@Override
	protected void onStop() {
		if (mMiniController != null) {
			mCastManager.removeMiniController(mMiniController);
		}
		super.onStop();
	}

	/**
	 * Override this method to return the MiniController id, if different from R.id.mini_controller
	 */
	protected int getMiniControllerId() {
		return R.id.mini_controller;
	}
}

@@ -363,19 +363,16 @@
  view in
-%0A *
  the lay
@@ -522,16 +522,59 @@
 troller;
+%0A%09private boolean mMiniControllerRetrieved;
 %0A%0A%09@Over
@@ -627,24 +627,25 @@
 rt();%0A%09%09if (
+!
 mMiniControl
@@ -651,16 +651,17 @@
 ller
- == null
+Retrieved
 ) %7B%0A
@@ -738,18 +738,88 @@
 d());%0A%09%09
-%7D%0A
+%09mMiniControllerRetrieved = true;%0A%09%09%7D%0A%09%09if (mMiniController != null) %7B%0A%09
 %09%09mCastM
@@ -861,16 +861,20 @@
 oller);%0A
+%09%09%7D%0A
 %09%7D%0A%0A%09@Ov

Make MiniController optional in MiniControllerActivity