Example #1
0
 public OpenPath[] listFiles(String rootRelative) throws IOException {
   if (DEBUG) Logger.LogDebug("OpenLZMA.listFiles(" + rootRelative + ")");
   if (!mFamily.containsKey(rootRelative)) {
     Logger.LogWarning("No children found for [" + rootRelative + "]");
     return new OpenPath[0];
   }
   List<OpenPath> ret = mFamily.get(rootRelative);
   if (DEBUG) Logger.LogVerbose(ret.size() + " children found for [" + rootRelative + "]");
   return ret.toArray(new OpenPath[ret.size()]);
 }
Example #2
0
 private void addFamilyEntry(String path, OpenLZMAEntry entry) {
   List<OpenPath> list = mFamily.get(path);
   if (list == null) list = new ArrayList<OpenPath>();
   if (DEBUG) Logger.LogDebug("Adding [" + entry.getName() + "] into [" + path + "]");
   list.add(entry);
   mFamily.put(path, list);
 }
 public CarouselFragment(OpenPath mParent) {
   super();
   if (OpenExplorer.BEFORE_HONEYCOMB) {
     Logger.LogError("Who is making me?", new Exception("WTF!"));
   }
   mPath = mParent;
   // getExplorer().updateTitle(mParent.getPath());
   refreshData(getArguments(), false);
 }
Example #4
0
  @Override
  public OpenPath[] listFiles() throws IOException {
    if (DEBUG) Logger.LogVerbose("Listing OpenLZMA " + mFile);
    if (mLZMA == null) return mChildren;

    getAllEntries();

    mChildren = listFiles("");

    return mChildren;
  }
Example #5
0
 public OpenLZMA(OpenFile file) {
   mFile = file;
   try {
     mRAF = new MyRandomAccessFile(file.getPath(), "r");
     mLZMA = new Handler();
     mLZMA.Open(mRAF);
     // Logger.LogInfo("LZMA file " + LZMAFile + " has " + length() +
     // " entries");
   } catch (IOException e) {
     Logger.LogError("Couldn't open LZMA file (" + file + ")");
   }
 }
  @Override
  public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
    if (!isVisible() || isDetached()) return;
    super.onCreateOptionsMenu(menu, inflater);
    if (mPath == null || !mPath.isFile() || !IntentManager.isIntentAvailable(mPath, getExplorer()))
      MenuUtils.setMenuVisible(menu, false, R.id.menu_context_edit, R.id.menu_context_view);
    Logger.LogVerbose("ContentFragment.onCreateOptionsMenu");
    if (!menu.hasVisibleItems()) inflater.inflate(R.menu.content, menu);
    MenuUtils.setMenuVisible(menu, OpenExplorer.IS_DEBUG_BUILD, R.id.menu_debug);
    if (!OpenExplorer.BEFORE_HONEYCOMB && OpenExplorer.USE_ACTION_BAR) {
      MenuUtils.setMenuVisible(menu, false, R.id.menu_more);
      try {
        final SearchView mSearchView = (SearchView) menu.findItem(R.id.menu_search).getActionView();
        if (mSearchView != null)
          mSearchView.setOnQueryTextListener(
              new SearchView.OnQueryTextListener() {
                @TargetApi(11)
                public boolean onQueryTextSubmit(String query) {
                  mSearchView.clearFocus();
                  Intent intent = getExplorer().getIntent();
                  if (intent == null) intent = new Intent();
                  intent.setAction(Intent.ACTION_SEARCH);
                  Bundle appData = new Bundle();
                  appData.putString(
                      "path", getExplorer().getDirContentFragment(false).getPath().getPath());
                  intent.putExtra(SearchManager.APP_DATA, appData);
                  intent.putExtra(SearchManager.QUERY, query);
                  getExplorer().handleIntent(intent);
                  return true;
                }

                public boolean onQueryTextChange(String newText) {
                  return false;
                }
              });
      } catch (NullPointerException e) {
        Logger.LogError("Couldn't set up Search ActionView", e);
      }
    }
  }
Example #7
0
 /**
  * Compare two OpenPath files, with sorting taken into account
  *
  * @param fa First OpenPath
  * @param fb Second OpenPath
  * @return an int determined by comparing the two paths. Possible values are described in the
  *     Comparable interface.
  * @see Comparable
  */
 public static int compare(OpenPath fa, OpenPath fb) {
   try {
     if (fa == null && fb != null) return 1;
     if (fb == null && fa != null) return 0;
     if (fb == null || fa == null) return 0;
     if (Sorting.foldersFirst()) {
       if (fb.isDirectory() && !fa.isDirectory()) return 1;
       if (fa.isDirectory() && !fb.isDirectory()) return -1;
     }
     String a = fa.getName();
     String b = fb.getName();
     Long sa = fa.length();
     Long sb = fb.length();
     Long ma = fa.lastModified();
     Long mb = fb.lastModified();
     if (a == null && b != null) return 1;
     if (a == null || b == null) return 0;
     switch (Sorting.getType()) {
       case ALPHA_DESC:
         return b.toLowerCase().compareTo(a.toLowerCase());
       case ALPHA:
         return a.toLowerCase().compareTo(b.toLowerCase());
       case SIZE_DESC:
         if (sa == null && sb != null) return 1;
         if (sa == null || sb == null) return 0;
         return sa.compareTo(sb);
       case SIZE:
         if (sb == null && sa != null) return 1;
         if (sa == null || sb == null) return 0;
         return sb.compareTo(sa);
       case DATE_DESC:
         if (ma == null && mb != null) return 1;
         if (ma == null || mb == null) return 0;
         return ma.compareTo(mb);
       case DATE:
         if (mb == null && ma != null) return 1;
         if (ma == null || mb == null) return 0;
         return mb.compareTo(ma);
       case TYPE:
         String ea = a.substring(a.lastIndexOf(".") + 1, a.length()).toLowerCase();
         String eb = b.substring(b.lastIndexOf(".") + 1, b.length()).toLowerCase();
         return ea.compareTo(eb);
       case NONE:
         return 0;
       default:
         return a.toLowerCase().compareTo(b.toLowerCase());
     }
   } catch (Exception e) {
     Logger.LogError("Unable to sort.", e);
     return 0;
   }
 }
Example #8
0
 private void addFamilyPath(String path) {
   String parent = path;
   if (parent.endsWith("/")) parent = parent.substring(0, parent.length() - 1);
   parent = parent.substring(0, parent.lastIndexOf("/") + 1);
   if (!parent.equals("") && !parent.endsWith("/")) parent += "/";
   if (DEBUG) Logger.LogDebug("FamilyPath adding [" + path + "] to [" + parent + "]");
   List<OpenPath> kids = mFamily.get(parent);
   if (kids == null) kids = new ArrayList<OpenPath>();
   OpenPath vp = findVirtualPath(path);
   if (!kids.contains(vp)) kids.add(vp);
   mFamily.put(parent, kids);
   if (!parent.equals("")) addFamilyPath(parent);
 }
  @Override
  public void onViewCreated(View mParent, Bundle savedInstanceState) {
    super.onViewCreated(mParent, savedInstanceState);
    Logger.LogDebug("Carousel onViewCreated!");
    mView.getHolder().setFormat(PixelFormat.RGBA_8888);
    mPaint.setColor(0xffffffff);

    final Resources res = getResources();
    mHelper.setCarouselView(mView);
    mView.setSlotCount(CARD_SLOTS);
    mView.createCards(INCREMENTAL_ADD ? 1 : size());
    mView.setVisibleSlots(SLOTS_VISIBLE);
    mView.setStartAngle((float) -(2.0f * Math.PI * 5 / CARD_SLOTS));
    mBorder = BitmapFactory.decodeResource(res, R.drawable.border);
    mView.setDefaultBitmap(mBorder);
    mView.setLoadingBitmap(mBorder);
    // mView.setDetailTextureAlignment(CarouselView.DetailAlignment.CENTER_VERTICAL |
    // CarouselView.DetailAlignment.LEFT);
    mView.setBackgroundColor(0.25f, 0.25f, 0.5f, 0.25f);
    // Theme t = getActivity().getTheme();
    // mView.setBackgroundDrawable(getResources().getDrawable(android.R.drawable.screen_background_dark));
    mView.setRezInCardCount(3.0f);
    mView.setFadeInDuration(200);
    mView.setVisibleDetails(VISIBLE_DETAIL_COUNT);
    mView.setDragModel(CarouselView.DRAG_MODEL_PLANE);
    if (INCREMENTAL_ADD) {
      mView.postDelayed(mAddCardRunnable, 2000);
    }

    try {
      mGlossyOverlay = BitmapFactory.decodeResource(res, R.drawable.glossy_overlay);
    } catch (OutOfMemoryError e) {
      Logger.LogError("Out of memory!", e);
      mGlossyOverlay = null;
    }
  }
 // @Override
 public void onHiddenFilesChanged(boolean toShow) {
   Logger.LogInfo("onHiddenFilesChanged(" + toShow + ")");
   setShowHiddenFiles(toShow);
   // getManager().setShowHiddenFiles(state);
   refreshData(null, false);
 }