public void backParentFolder() {
    DIR_LAYER--;

    mainFiles = gsi.getMainFiles();

    FilesAdapter filesAdapter = new FilesAdapter(FileManageActivity.this, mainFiles);
    list_files_layout_gridview.setAdapter(filesAdapter);

    setPathtext(gsi.getCurrentPath());
  }
  /**
   * 进入文件夹
   *
   * @param position
   */
  public void enterNextFolder(int position) {
    DIR_LAYER++; // 进入文件夹添加一层

    File[] childFiles = gsi.getChildFiles(position);

    FilesAdapter filesAdapter = new FilesAdapter(FileManageActivity.this, childFiles);
    list_files_layout_gridview.setAdapter(filesAdapter);
    mainFiles = childFiles;

    setPathtext(gsi.getCurrentPath());
  }
  public void getFolderOrFilesAttribute(int position) {
    String allInfo = "";

    String fileName = mainFiles[position].getName();
    allInfo += "文件名:" + fileName + "\n";

    if (!mainFiles[position].isDirectory()) {
      String fileType = GetStorageFiles.getFileType(fileName);
      String MINEType = MimeTypeMap.getSingleton().getMimeTypeFromExtension(fileType);
      String fileSize = switchSpaceSize(mainFiles[position].length());
      allInfo += ("类型:" + fileType + "\n" + "MINE:" + MINEType + "\n" + "大小:" + fileSize + "\n");
    } else {
      String fileSize = switchSpaceSize(getFolderSize(mainFiles[position]));
      allInfo += "大小:" + fileSize + "\n";
    }

    String filePath = mainFiles[position].getParentFile().getPath();

    allInfo += "路径:" + filePath + "\n";

    new AlertDialog.Builder(FileManageActivity.this)
        .setTitle("文件属性")
        .setMessage(allInfo)
        .setNegativeButton("确定", null)
        .show();
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_layout_filemanage);

    setupView();

    gsi = new GetStorageFiles(FileManageActivity.this);
    mainFiles = gsi.getMainFiles();

    FilesAdapter filesAdapter = new FilesAdapter(FileManageActivity.this, mainFiles);

    list_files_layout_gridview.setAdapter(filesAdapter);
    list_files_layout_gridview.setOnItemClickListener(this);
    this.registerForContextMenu(list_files_layout_gridview);

    setPathtext(gsi.getCurrentPath());
  }
  /**
   * 打开文件
   *
   * @param position
   */
  public void openFile(int position) {
    String fileName = mainFiles[position].getName();
    String type = GetStorageFiles.getFileType(fileName);

    if (type.equals("mp4")) {
      Intent videoIntent = new Intent(FileManageActivity.this, VideoPlayActivity.class);
      videoIntent.putExtra("videoPath", mainFiles[position].getAbsolutePath());
      startActivity(videoIntent);
    } else if (type.equals("jpg") || type.equals("png") || type.equals("jpeg")) {
      Intent imageIntent = new Intent(FileManageActivity.this, SeePictureActivity.class);
      imageIntent.putExtra("picturePath", mainFiles[position].getAbsolutePath());
      startActivity(imageIntent);
    } else {
      return;
    }
  }
  public void updateFilesView(int position) {
    mainFiles = gsi.updateFiles(position);

    FilesAdapter filesAdapter = new FilesAdapter(FileManageActivity.this, mainFiles);
    list_files_layout_gridview.setAdapter(filesAdapter);
  }