private void selectItem(int position) {
   if (position < 0) position = 1;
   mCurrentSelectedPosition = position;
   if (mRecyclerView != null) {
     mAdapter.setCheckedPos(position);
   }
   if (mDrawerLayout != null) {
     mDrawerLayout.closeDrawer(mFragmentContainerView);
   }
   DrawerActivity act = (DrawerActivity) getActivity();
   Pins.Item item = mAdapter.getItem(position);
   act.switchDirectory(item);
   mTitle = item.getDisplay(getActivity());
   mDrawerLayout.closeDrawers();
 }
 public void reload(boolean open) {
   Activity act = getActivity();
   if (act != null) {
     mAdapter.reload(act);
     if (open) mDrawerLayout.openDrawer(Gravity.START);
   }
 }
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    mRecyclerView = (RecyclerView) inflater.inflate(R.layout.fragment_drawer, container, false);
    mRecyclerView.setClipToPadding(false);
    mAdapter =
        new NavigationDrawerAdapter(
            getActivity(),
            new NavigationDrawerAdapter.ClickListener() {
              @Override
              public void onClick(int index) {
                selectItem(index);
              }

              @Override
              public boolean onLongClick(final int index) {
                Pins.Item item = mAdapter.getItem(index);
                Utils.showConfirmDialog(
                    getActivity(),
                    R.string.remove_shortcut,
                    R.string.confirm_remove_shortcut,
                    item.getDisplay(getActivity()),
                    new Utils.ClickListener() {
                      @Override
                      public void onPositive(int which, View view) {
                        Pins.remove(getActivity(), index);
                        mAdapter.reload(getActivity());
                      }
                    });
                return false;
              }
            });
    mRecyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
    mRecyclerView.setAdapter(mAdapter);
    mAdapter.setCheckedPos(mCurrentSelectedPosition);
    return mRecyclerView;
  }
 public void selectFile(File file) {
   mCurrentSelectedPosition = mAdapter.setCheckedFile(file);
 }