@Test public void testCompareFiles() throws Exception { assertEquals(0, fragment.compareFiles(new File("/A/A"), new File("/A/A"))); assertEquals(-1, fragment.compareFiles(new File("/A/A"), new File("/A/B"))); assertEquals(1, fragment.compareFiles(new File("/A/B"), new File("/A/A"))); assertEquals(1, fragment.compareFiles(new File("/A/B"), new File("/B/A"))); assertEquals(-1, fragment.compareFiles(new File("/B/A"), new File("/A/B"))); assertEquals(0, fragment.compareFiles(new File("/A/B"), new File("/B/B"))); }
protected int compareFiles(@NonNull File lhs, @NonNull File rhs) { if (lhs.isDirectory() && !rhs.isDirectory()) { return -1; } else if (rhs.isDirectory() && !lhs.isDirectory()) { return 1; } else { return lhs.getName().compareToIgnoreCase(rhs.getName()); } }
FilePickerFragment extends AbstractFilePickerFragment<File> { protected int compareFiles(@NonNull File lhs, @NonNull File rhs) { if (lhs.isDirectory() && !rhs.isDirectory()) { return -1; } else if (rhs.isDirectory() && !lhs.isDirectory()) { return 1; } else { return lhs.getName().compareToIgnoreCase(rhs.getName()); } } }
FilePickerFragment extends AbstractFilePickerFragment<File> { protected int compareFiles(@NonNull File lhs, @NonNull File rhs) { if (lhs.isDirectory() && !rhs.isDirectory()) { return -1; } else if (rhs.isDirectory() && !lhs.isDirectory()) { return 1; } else { return lhs.getName().compareToIgnoreCase(rhs.getName()); } } FilePickerFragment(); }
FilePickerFragment extends AbstractFilePickerFragment<File> { protected int compareFiles(@NonNull File lhs, @NonNull File rhs) { if (lhs.isDirectory() && !rhs.isDirectory()) { return -1; } else if (rhs.isDirectory() && !lhs.isDirectory()) { return 1; } else { return lhs.getName().compareToIgnoreCase(rhs.getName()); } } FilePickerFragment(); void showHiddenItems(boolean showHiddenItems); boolean areHiddenItemsShown(); @Override void onRequestPermissionsResult(int requestCode,
                                           @NonNull String[] permissions,
                                           @NonNull int[] grantResults); @Override boolean isDir(@NonNull final File path); @NonNull @Override String getName(@NonNull File path); @NonNull @Override File getParent(@NonNull final File from); @NonNull @Override File getPath(@NonNull final String path); @NonNull @Override String getFullPath(@NonNull final File path); @NonNull @Override File getRoot(); @NonNull @Override Uri toUri(@NonNull final File file); @NonNull @Override Loader<SortedList<File>> getLoader(); @Override void onNewFolder(@NonNull final String name); }
FilePickerFragment extends AbstractFilePickerFragment<File> { protected int compareFiles(@NonNull File lhs, @NonNull File rhs) { if (lhs.isDirectory() && !rhs.isDirectory()) { return -1; } else if (rhs.isDirectory() && !lhs.isDirectory()) { return 1; } else { return lhs.getName().compareToIgnoreCase(rhs.getName()); } } FilePickerFragment(); void showHiddenItems(boolean showHiddenItems); boolean areHiddenItemsShown(); @Override void onRequestPermissionsResult(int requestCode,
                                           @NonNull String[] permissions,
                                           @NonNull int[] grantResults); @Override boolean isDir(@NonNull final File path); @NonNull @Override String getName(@NonNull File path); @NonNull @Override File getParent(@NonNull final File from); @NonNull @Override File getPath(@NonNull final String path); @NonNull @Override String getFullPath(@NonNull final File path); @NonNull @Override File getRoot(); @NonNull @Override Uri toUri(@NonNull final File file); @NonNull @Override Loader<SortedList<File>> getLoader(); @Override void onNewFolder(@NonNull final String name);  }