Back to project page dropdroid.
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.
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; } }