コード例 #1
0
  public int getPathOnlyItemPos(FileInfo info) {

    for (int i = 0; i < this.getCount(); i++) {
      if (info.getPath().equals(this.getSimpleFileItem(i).getPath())) {
        return i;
      }
    }
    return -1;
  }
コード例 #2
0
  public static void recursiveUpdateDel(FileInfo info, Context context) {
    String ext;
    String mime;
    String mimeprefix = null;
    Uri uri = null;
    ext = FileUtil.getRealExtension(info.getName());

    mime = MimeTypeMap.getSingleton().getMimeTypeFromExtension(ext.toLowerCase());
    if (mime == null) {
      return;
    }
    if (mime.startsWith(Constants.CateContants.CATE_IMAGES)) {
      uri = MediaStore.Images.Media.EXTERNAL_CONTENT_URI;
      mimeprefix = Constants.CateContants.CATE_IMAGES;
    } else if (mime.startsWith(Constants.CateContants.CATE_MUSIC)) {
      uri = MediaStore.Audio.Media.EXTERNAL_CONTENT_URI;
      mimeprefix = Constants.CateContants.CATE_MUSIC;
    } else if (mime.startsWith(Constants.CateContants.CATE_VIDEO)) {
      uri = MediaStore.Video.Media.EXTERNAL_CONTENT_URI;
      mimeprefix = Constants.CateContants.CATE_VIDEO;
    } else {
      if (info.getName().trim().toLowerCase().endsWith(Constants.LOWERCASE_APK)) {
        mimeprefix = Constants.CateContants.CATE_PACKAGE;
        uri = MediaArgs.otherUri;
      } else if (mime.startsWith(Constants.MIMEContants.MIME_APPLICATION)
          || mime.startsWith(Constants.MIMEContants.MIME_TEXT)) {
        mimeprefix = Constants.CateContants.CATE_DOCS;
        uri = MediaArgs.otherUri;
      } else if (info.name.trim().toLowerCase().endsWith(Constants.LOWERCASE_LWT)) {
        mimeprefix = Constants.CateContants.CATE_THEME;
        uri = MediaArgs.otherUri;
      }
    }
    if (uri != null) {
      context
          .getContentResolver()
          .delete(uri, MediaStore.Audio.Media.DATA + " like ?", new String[] {info.getPath()});
    }
  }