コード例 #1
0
ファイル: VirtualItem.java プロジェクト: FCFM-ADI/quicklook
 /**
  * Gets an specific item from the virtual object and copies it to main memory.
  *
  * @param toRetrieve item inside this
  * @param context Current application context
  * @return Abstract item with object
  */
 public BaseItem retrieve(BaseItem toRetrieve, Context context) {
   String innerPath = getCachePath();
   File folder = new File(innerPath);
   if (!folder.exists()) folder.mkdirs();
   String path = retrieveItem(splitVirtualPath(toRetrieve.path)[1], innerPath, context);
   if (path != null) {
     String type = toRetrieve.getType();
     long size = toRetrieve.getSize();
     Bundle extra = toRetrieve.getExtra();
     return ItemFactory.getInstance().createItem(path, type, size, extra);
   } else {
     return null;
   }
 }
コード例 #2
0
ファイル: VirtualItem.java プロジェクト: FCFM-ADI/quicklook
 /**
  * Defines an action to do when a virtual item is clicked. The action could be enter to a folder,
  * or retrieve a item from the folder.
  *
  * @param mListener
  * @param item
  */
 public BaseItem onClick(
     QuicklookFragment.OnListFragmentInteractionListener mListener, BaseItem item) {
   VirtualItem parentItem = (VirtualItem) mListener.getItem();
   BaseItem newItem;
   if (item instanceof FolderItem) {
     String path = item.getPath();
     long size = item.getSize();
     String type = parentItem.getType();
     Bundle extra = item.getExtra();
     newItem = ItemFactory.getInstance().createItem(path, type, size, extra);
   } else {
     newItem = mListener.retrieveElement(item, parentItem);
   }
   return newItem;
 }