@Override
 public void setControlVisible(boolean visible) {
   final FragmentActivity activity = getActivity();
   if (activity instanceof IControlBarActivity) {
     ((IControlBarActivity) activity).setControlBarVisibleAnimate(visible);
   }
 }
 @Override
 public void onAttach(Activity activity) {
   super.onAttach(activity);
   if (activity instanceof IControlBarActivity) {
     ((IControlBarActivity) activity).registerControlBarOffsetListener(this);
   }
 }
 @Override
 public void onDetach() {
   final FragmentActivity activity = getActivity();
   if (activity instanceof IControlBarActivity) {
     ((IControlBarActivity) activity).unregisterControlBarOffsetListener(this);
   }
   super.onDetach();
 }
 protected void updateRefreshProgressOffset() {
   final FragmentActivity activity = getActivity();
   if (!(activity instanceof IControlBarActivity)
       || mSystemWindowsInsets.top == 0
       || mSwipeRefreshLayout == null
       || isRefreshing()) {
     return;
   }
   final float density = getResources().getDisplayMetrics().density;
   final int progressCircleDiameter = mSwipeRefreshLayout.getProgressCircleDiameter();
   final IControlBarActivity control = (IControlBarActivity) activity;
   final int controlBarOffsetPixels =
       Math.round(control.getControlBarHeight() * (1 - control.getControlBarOffset()));
   final int swipeStart =
       (mSystemWindowsInsets.top - controlBarOffsetPixels) - progressCircleDiameter;
   // 64: SwipeRefreshLayout.DEFAULT_CIRCLE_TARGET
   final int swipeDistance = Math.round(64 * density);
   mSwipeRefreshLayout.setProgressViewOffset(false, swipeStart, swipeStart + swipeDistance);
 }