@Override
 public void onPause() {
   super.onPause();
   if (mActionBar != null) {
     mActionBar.show();
   }
   mActivity.setLightsOutMode(false);
   if (mApplication.getEventBus().isRegistered(this)) {
     mApplication.getEventBus().unregister(this);
   }
   mSlideshowHandler.removeCallbacks(mSlideshowAction);
   mController.updateStatus(PlayStatus.STOPPED, null);
 }
 @Override
 public void onResume() {
   super.onResume();
   if (mActionBar != null) {
     mActionBar.hide();
   }
   mActivity.setLightsOutMode(true);
   if (!mApplication.getEventBus().isRegistered(this)) {
     mApplication.getEventBus().register(this);
   }
   mSlideshowHandler.postDelayed(mSlideshowAction, SLIDESHOW_INTERVAL_MS);
   mController.updateStatus(PlayStatus.PLAYING, mBucketId);
 }
 @Override
 public void onAttach(Activity activity) {
   super.onAttach(activity);
   if (mActivity == null) {
     mActivity = (PhotoFrameActivity) activity;
     mActionBar = mActivity.getSupportActionBar();
     mApplication = mActivity.getPhotoFrameApplication();
     mController = mApplication.getController();
   }
 }
 public void updateBucketId(String bucketId) {
   if (!mBucketId.equals(bucketId)) {
     mSlideshowHandler.removeCallbacks(mSlideshowAction);
     mBucketId = bucketId;
     mSlideShowPagerAdapter =
         new SlideshowPageAdapter(mActivity, mApplication.getImageLoader(), mBucketId);
     mViewPager.setAdapter(mSlideShowPagerAdapter);
     mSlideshowHandler.postDelayed(mSlideshowAction, SLIDESHOW_INTERVAL_MS);
     mController.updateStatus(PlayStatus.PLAYING, mBucketId);
   }
 }
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

    View rootView = inflater.inflate(R.layout.fragment_slideshow, container, false);
    mViewPager = (ViewPager) rootView.findViewById(R.id.pager);
    mSlideShowPagerAdapter =
        new SlideshowPageAdapter(mActivity, mApplication.getImageLoader(), mBucketId);
    mViewPager.setAdapter(mSlideShowPagerAdapter);
    return rootView;
  }