Program: 11144
Project: 11144
Buggy source:
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  mContext=this;
  setContentView(R.layout.material_file_picker_activity_layout);
  recyclerView=(RecyclerView)findViewById(R.id.file_picker_recycler_view);
  toolbar=(Toolbar)findViewById(R.id.file_picker_base_toolbar);
  fab=(FloatingActionButton)findViewById(R.id.file_picker_floating_action_button);
  fab.setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View view){
      NameFileDialog nfd=NameFileDialog.newInstance();
      nfd.show(getFragmentManager(),"String_Node_Str");
    }
  }
);
  isFabShowing=true;
  areButtonsShowing=false;
  Object rawMimeTypeParameter=getIntent().getExtras().get(MIME_TYPE);
  if (rawMimeTypeParameter instanceof String) {
    mimeType=(String)rawMimeTypeParameter;
  }
 else   if (rawMimeTypeParameter instanceof FileType) {
    mimeType=((FileType)rawMimeTypeParameter).getMimeType();
  }
 else {
    mimeType=null;
  }
  setUpAnimations();
  Intent givenIntent=getIntent();
  scopeType=(Scope)givenIntent.getSerializableExtra(SCOPE_TYPE);
  if (scopeType == null) {
    scopeType=Scope.ALL;
  }
  requestCode=(Request)givenIntent.getSerializableExtra(REQUEST_CODE);
  colorId=givenIntent.getIntExtra(INTENT_EXTRA_COLOR_ID,android.R.color.holo_blue_light);
  drawableId=givenIntent.getIntExtra(INTENT_EXTRA_DRAWABLE_ID,-1);
  fabColorId=givenIntent.getIntExtra(INTENT_EXTRA_FAB_COLOR_ID,-1);
  mLinearLayoutManager=new LinearLayoutManager(this);
  recyclerView.setItemAnimator(new DefaultItemAnimator());
  recyclerView.setLayoutManager(mLinearLayoutManager);
  recyclerView.setHasFixedSize(true);
  adapter=new FileRecyclerViewAdapter(this,new File[0],scopeType,callback);
  recyclerView.setAdapter(adapter);
  recyclerView.addOnScrollListener(new RecyclerView.OnScrollListener(){
    @Override public void onScrollStateChanged(    RecyclerView recyclerView,    int newState){
      super.onScrollStateChanged(recyclerView,newState);
    }
    @Override public void onScrolled(    RecyclerView recyclerView,    int dx,    int dy){
      int firstVisibleItem=mLinearLayoutManager.findFirstVisibleItemPosition();
      if (Math.abs(dy) >= 5) {
        if (dy > 0) {
          toggleButton(false);
        }
 else         if (dy < 0) {
          toggleButton(true);
        }
        if (areButtonsShowing) {
          hideButtons();
          adapter.setSelectedPosition(-1);
          mLastFirstVisibleItem=firstVisibleItem;
        }
 else         if (firstVisibleItem > adapter.getSelectedPosition()) {
          hideButtons();
          adapter.setSelectedPosition(-1);
        }
      }
 else {
        mLastFirstVisibleItem=firstVisibleItem;
      }
      super.onScrolled(recyclerView,dx,dy);
    }
  }
);
  initializeViews();
  setHeaderBackground(colorId,drawableId);
  if (Build.VERSION.SDK_INT == Build.VERSION_CODES.M) {
    int permissionCheck=ContextCompat.checkSelfPermission(this,Manifest.permission.READ_EXTERNAL_STORAGE);
    if (permissionCheck != PackageManager.PERMISSION_GRANTED) {
      if (ActivityCompat.shouldShowRequestPermissionRationale(this,Manifest.permission.READ_EXTERNAL_STORAGE)) {
        new MaterialDialog.Builder(this).title(R.string.file_picker_permission_rationale_dialog_title).content(R.string.file_picker_permission_rationale_dialog_content).positiveText(R.string.file_picker_ok).negativeText(R.string.file_picker_cancel).callback(new MaterialDialog.ButtonCallback(){
          @Override public void onPositive(          MaterialDialog dialog){
            ActivityCompat.requestPermissions(FilePicker.this,new String[]{Manifest.permission.READ_EXTERNAL_STORAGE,Manifest.permission.WRITE_EXTERNAL_STORAGE},REQUEST_FOR_READ_EXTERNAL_STORAGE);
          }
          @Override public void onNegative(          MaterialDialog dialog){
            setResult(RESULT_CANCELED);
            finish();
          }
        }
).show();
      }
 else {
        ActivityCompat.requestPermissions(this,new String[]{Manifest.permission.READ_EXTERNAL_STORAGE,Manifest.permission.WRITE_EXTERNAL_STORAGE},REQUEST_FOR_READ_EXTERNAL_STORAGE);
      }
    }
  }
 else {
    init();
  }
}

Fixed version (ground truth):
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  mContext=this;
  setContentView(R.layout.material_file_picker_activity_layout);
  recyclerView=(RecyclerView)findViewById(R.id.file_picker_recycler_view);
  toolbar=(Toolbar)findViewById(R.id.file_picker_base_toolbar);
  fab=(FloatingActionButton)findViewById(R.id.file_picker_floating_action_button);
  fab.setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View view){
      NameFileDialog nfd=NameFileDialog.newInstance();
      nfd.show(getFragmentManager(),"String_Node_Str");
    }
  }
);
  isFabShowing=true;
  areButtonsShowing=false;
  Object rawMimeTypeParameter=getIntent().getExtras().get(MIME_TYPE);
  if (rawMimeTypeParameter instanceof String) {
    mimeType=(String)rawMimeTypeParameter;
  }
 else   if (rawMimeTypeParameter instanceof MimeType) {
    mimeType=((MimeType)rawMimeTypeParameter).getMimeType();
  }
 else {
    mimeType=null;
  }
  setUpAnimations();
  Intent givenIntent=getIntent();
  scopeType=(Scope)givenIntent.getSerializableExtra(SCOPE);
  if (scopeType == null) {
    scopeType=Scope.ALL;
  }
  requestCode=(Request)givenIntent.getSerializableExtra(REQUEST);
  colorId=givenIntent.getIntExtra(INTENT_EXTRA_COLOR_ID,android.R.color.holo_blue_light);
  drawableId=givenIntent.getIntExtra(INTENT_EXTRA_DRAWABLE_ID,-1);
  fabColorId=givenIntent.getIntExtra(INTENT_EXTRA_FAB_COLOR_ID,-1);
  mLinearLayoutManager=new LinearLayoutManager(this);
  recyclerView.setItemAnimator(new DefaultItemAnimator());
  recyclerView.setLayoutManager(mLinearLayoutManager);
  recyclerView.setHasFixedSize(true);
  adapter=new FileRecyclerViewAdapter(this,new File[0],scopeType,callback);
  recyclerView.setAdapter(adapter);
  recyclerView.addOnScrollListener(new RecyclerView.OnScrollListener(){
    @Override public void onScrollStateChanged(    RecyclerView recyclerView,    int newState){
      super.onScrollStateChanged(recyclerView,newState);
    }
    @Override public void onScrolled(    RecyclerView recyclerView,    int dx,    int dy){
      int firstVisibleItem=mLinearLayoutManager.findFirstVisibleItemPosition();
      if (Math.abs(dy) >= 5) {
        if (dy > 0) {
          toggleButton(false);
        }
 else         if (dy < 0) {
          toggleButton(true);
        }
        if (areButtonsShowing) {
          hideButtons();
          adapter.setSelectedPosition(-1);
          mLastFirstVisibleItem=firstVisibleItem;
        }
 else         if (firstVisibleItem > adapter.getSelectedPosition()) {
          hideButtons();
          adapter.setSelectedPosition(-1);
        }
      }
 else {
        mLastFirstVisibleItem=firstVisibleItem;
      }
      super.onScrolled(recyclerView,dx,dy);
    }
  }
);
  initializeViews();
  setHeaderBackground(colorId,drawableId);
  if (Build.VERSION.SDK_INT == Build.VERSION_CODES.M) {
    int permissionCheck=ContextCompat.checkSelfPermission(this,Manifest.permission.READ_EXTERNAL_STORAGE);
    if (permissionCheck != PackageManager.PERMISSION_GRANTED) {
      if (ActivityCompat.shouldShowRequestPermissionRationale(this,Manifest.permission.READ_EXTERNAL_STORAGE)) {
        new MaterialDialog.Builder(this).title(R.string.file_picker_permission_rationale_dialog_title).content(R.string.file_picker_permission_rationale_dialog_content).positiveText(R.string.file_picker_ok).negativeText(R.string.file_picker_cancel).callback(new MaterialDialog.ButtonCallback(){
          @Override public void onPositive(          MaterialDialog dialog){
            ActivityCompat.requestPermissions(FilePicker.this,new String[]{Manifest.permission.READ_EXTERNAL_STORAGE,Manifest.permission.WRITE_EXTERNAL_STORAGE},REQUEST_FOR_READ_EXTERNAL_STORAGE);
          }
          @Override public void onNegative(          MaterialDialog dialog){
            setResult(RESULT_CANCELED);
            finish();
          }
        }
).show();
      }
 else {
        ActivityCompat.requestPermissions(this,new String[]{Manifest.permission.READ_EXTERNAL_STORAGE,Manifest.permission.WRITE_EXTERNAL_STORAGE},REQUEST_FOR_READ_EXTERNAL_STORAGE);
      }
    }
  }
 else {
    init();
  }
}