コード例 #1
0
 /**
  * 从表中删除一条数据
  *
  * @param get_id
  * @return
  */
 public int delItem(final FileEntity fileEntity) {
   FileData fileData = new FileData(activity);
   new Thread() {
     public void run() {
       boolean flag = new BcsService().deleteObject(fileEntity.getFileName());
       if (flag) {
         handler.sendEmptyMessage(DEL_SUCCESS);
       }
     }
   }.start();
   return fileData.delOneFile(fileEntity.get_id());
 }
コード例 #2
0
 /**
  * 修改文件名字
  *
  * @param _id
  * @param newName
  * @param oldName
  */
 public void reName(String _id, final String newName, final String oldName) {
   FileData fileData = new FileData(activity);
   fileData.updateName(_id, newName);
   handler.sendEmptyMessage(REFRESH);
   new Thread() {
     public void run() {
       String source = sharePath + "/" + oldName;
       String target = sharePath + "/" + newName;
       boolean flag = new BcsService().rename(source, target);
       Message msg = handler.obtainMessage();
       msg.what = RENAME;
       if (flag) {
         msg.obj = "命名成功";
       } else {
         msg.obj = "命名失败";
       }
       handler.sendMessage(msg);
     }
   }.start();
 }
コード例 #3
0
 /**
  * 得到共享的文件
  *
  * @param curPath 绝对路径
  * @return
  */
 public List<FileEntity> getShareFiles(String curPath) {
   FileData fileData = new FileData(activity);
   return fileData.queryFiles(
       "select * from file  where parDir in (?,?)  order by mtime desc",
       new String[] {curPath, curPath + "/"});
 }