toro-core/src/main/java/im/ene/toro/widget/Container.java
@CallSuper @Override protected void onWindowVisibilityChanged(int visibility) {
    super.onWindowVisibilityChanged(visibility);
    if (visibility == View.GONE) {
      List<ToroPlayer> players = playerManager.getPlayers();
      // if onSaveInstanceState is called before, source will contain no item, just fine.
      for (ToroPlayer player : players) {
        if (player.isPlaying()) {
          this.savePlaybackInfo(player.getPlayerOrder(), player.getCurrentPlaybackInfo());
          playerManager.pause(player);
        }
      }
    } else if (visibility == View.VISIBLE) {
      if (tmpStates != null && tmpStates.size() > 0) {
        for (int i = 0; i < tmpStates.size(); i++) {
          int order = tmpStates.keyAt(i);
          PlaybackInfo playbackInfo = tmpStates.get(order);
          this.savePlaybackInfo(order, playbackInfo);
        }
      }
      tmpStates = null;
      this.onScrollStateChanged(SCROLL_STATE_IDLE);
    }

    dispatchWindowVisibilityMayChange();
  }
/**
   * {@inheritDoc}
   *
   * In case user press "App Stack" button, this View's window will have visibility change from
   * {@link #VISIBLE} to {@link #INVISIBLE} to {@link #GONE}. When user is back from that state,
   * the visibility changes from {@link #GONE} to {@link #INVISIBLE} to {@link #VISIBLE}. A proper
   * playback needs to handle this case too.
   */
In case user press "App Stack" button, this View's window will have visibility change from
#VISIBLE to  #INVISIBLE to  #GONE. When user is back from that state,
the visibility changes from  #GONE to  #INVISIBLE to  #VISIBLE. A proper
playback needs to handle this case too.
In case user press " App Stack " button this View ' s window will have visibility change from #VISIBLE to #INVISIBLE to #GONE . When user is back from that state the visibility changes from #GONE to #INVISIBLE to #VISIBLE . A proper playback needs to handle this case too .
@CallSuper @Override protected void onWindowVisibilityChanged(int visibility) {
    super.onWindowVisibilityChanged(visibility);
    if (visibility == View.GONE) {
      List<ToroPlayer> players = playerManager.getPlayers();
      for (ToroPlayer player : players) {
        if (player.isPlaying()) {
          this.savePlaybackInfo(player.getPlayerOrder(), player.getCurrentPlaybackInfo());
          playerManager.pause(player);
        }
      }
    } else if (visibility == View.VISIBLE) {
      if (tmpStates != null && tmpStates.size() > 0) {
        for (int i = 0; i < tmpStates.size(); i++) {
          int order = tmpStates.keyAt(i);
          PlaybackInfo playbackInfo = tmpStates.get(order);
          this.savePlaybackInfo(order, playbackInfo);
        }
      }
      tmpStates = null;
      this.onScrollStateChanged(SCROLL_STATE_IDLE);
    }
    dispatchWindowVisibilityMayChange();
  }
@ CallSuper @ Override protected void onWindowVisibilityChanged ( int visibility ) { super . onWindowVisibilityChanged ( visibility ) ; if ( visibility == View . GONE ) { List < ToroPlayer > players = playerManager . getPlayers ( ) ; for ( ToroPlayer player : players ) { if ( player . isPlaying ( ) ) { this . savePlaybackInfo ( player . getPlayerOrder ( ) , player . getCurrentPlaybackInfo ( ) ) ; playerManager . pause ( player ) ; } } } else if ( visibility == View . VISIBLE ) { if ( tmpStates != null && tmpStates . size ( ) > 0 ) { for ( int i = 0 ; i < tmpStates . size ( ) ; i ++ ) { int order = tmpStates . keyAt ( i ) ; PlaybackInfo playbackInfo = tmpStates . get ( order ) ; this . savePlaybackInfo ( order , playbackInfo ) ; } } tmpStates = null ; this . onScrollStateChanged ( SCROLL_STATE_IDLE ) ; } dispatchWindowVisibilityMayChange ( ) ; }
{@inheritDoc}
 In case user press "App Stack" button, this View's window will have visibility change from
 {@link #VISIBLE} to {@link #INVISIBLE} to {@link #GONE}.
{ @inheritDoc } In case user press " App Stack " button this View ' s window will have visibility change from { @link #VISIBLE } to { @link #INVISIBLE } to { @link #GONE } .
// if onSaveInstanceState is called before, source will contain no item, just fine.