Android Open Source - dropdroid Epub Name Comparator






From Project

Back to project page dropdroid.

License

The source code is released under:

GNU General Public License

If you think the Android project dropdroid listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.fjaviermo.comparator;
/*  w ww .j  av a 2  s . c o m*/
import java.util.Comparator;

import com.dropbox.sync.android.DbxFileInfo;
import com.fjaviermo.Utils.Util;

public class EpubNameComparator implements Comparator<DbxFileInfo> {
  private final boolean isAscending;

  public EpubNameComparator(boolean ascending) {
    isAscending = ascending;
  }

  @Override
  public int compare(DbxFileInfo lhs, DbxFileInfo rhs) {
    int rawCmp = rawCompare(lhs, rhs);
    return isAscending ? rawCmp : -rawCmp;
  }

  /**
   * Comparamos los archivos segn su nombre, fecha y tamao.
   */
  int rawCompare(DbxFileInfo lhs, DbxFileInfo rhs) {

    int cmp = Util.compareNames(lhs.path.getName(), rhs.path.getName());
    if (0 != cmp) {
      return cmp;
    }
    cmp = Util.compareDates(lhs.modifiedTime, rhs.modifiedTime);
    if (0 != cmp) {
      return cmp;
    }

    // Use size as final qualifier, though names should be unique in a real
    // folder listing.
    long longcmp = Util.compareSizes(lhs.size, rhs.size);
    if (0 != longcmp) {
      return longcmp < 0 ? -1 : 1;
    }

    return 0;
  }
}




Java Source Code List

com.fjaviermo.Utils.DropDroidConfig.java
com.fjaviermo.Utils.Util.java
com.fjaviermo.adapter.EpubAdapter.java
com.fjaviermo.comparator.EpubDateComparator.java
com.fjaviermo.comparator.EpubNameComparator.java
com.fjaviermo.dropdroid.CoverImageDialogFragment.java
com.fjaviermo.dropdroid.EpubListFragment.java
com.fjaviermo.dropdroid.EpubLoader.java
com.fjaviermo.dropdroid.MainActivity.java