code: public int setPageCount(final int num) {
          int diff = num - getCheckableCount();
          if (diff > 0) {
              addIndicatorChildren(diff);
          } else if (diff < 0) {
              removeIndicatorChildren(-diff);
          }
          if (mCurrentPage >=num ) {
              mCurrentPage = 0;
          }
          setCurrentPage(mCurrentPage);
          return diff;
      }
docs: Sets number of pages. If the index of currently selected page is bigger than the total number
  of pages, first page will be selected instead.
  @return difference between the previous number of pages and new one. Negative value is
  returned if new number of pages is less then it was before.