Beispiel #1
0
 /**
  * Gets elements inside a VirtualItem Folder.
  *
  * @return An arraylist with the virtual elements of folder.
  */
 @Override
 public ArrayList<BaseItem> getElements() {
   if (itemList == null) {
     itemList = getItemList();
   }
   ArrayList<BaseItem> approvedElements = new ArrayList<>();
   for (BaseItem elem : itemList) {
     if (!isBannedWord(elem.getName())) {
       approvedElements.add(createForList(elem));
     }
   }
   return approvedElements;
 }
Beispiel #2
0
 /**
  * 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;
   }
 }
Beispiel #3
0
 /**
  * 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;
 }
Beispiel #4
0
 @Override
 public void prepareFragment() {
   super.prepareFragment();
   Bundle b = fragment.getArguments();
   String innerRoute = this.getVirtualPath().equals("") ? "" : SEP + this.getVirtualPath();
   b.putString(ITEM_PATH, this.getPath() + innerRoute);
   fragment.setArguments(b);
 }