code: public void dim(int duration) {
          if (!mDimEnabled) {
              return;
          }
          if (mDimView == null) {
              mDimView = makeDimView();
          }
          if (!mDimView.isShown()) {
              mDimView.setVisibility(VISIBLE);
              mDimView.setBackgroundColor(mDimColor);
          }
          mDimView.animate().cancel();
          mDimView.animate().alpha(mDimAlpha)
              .setListener(null)
              .setDuration(duration)
              .start();
      }
docs: Start the dim animation.
  
  @param duration