Loading src/com/android/documentsui/sorting/HeaderCell.java +13 −11 Original line number Diff line number Diff line Loading @@ -19,8 +19,6 @@ package com.android.documentsui.sorting; import android.animation.AnimatorInflater; import android.animation.LayoutTransition; import android.animation.ObjectAnimator; import androidx.annotation.AnimatorRes; import androidx.annotation.StringRes; import android.content.Context; import android.util.AttributeSet; import android.view.Gravity; Loading @@ -29,14 +27,14 @@ import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.TextView; import androidx.annotation.AnimatorRes; import androidx.annotation.StringRes; import com.android.documentsui.R; import com.android.documentsui.sorting.SortDimension; /** * A clickable, sortable table header cell layout. * * It updates its display when it binds to {@link SortDimension} and changes the status of sorting * when it's clicked. * A clickable, sortable table header cell layout. It updates its display when it binds to {@link * SortDimension} and changes the status of sorting when it's clicked. */ public class HeaderCell extends LinearLayout { Loading @@ -62,7 +60,7 @@ public class HeaderCell extends LinearLayout { setVisibility(dimension.getVisibility()); if (dimension.getVisibility() == View.VISIBLE) { TextView label = (TextView) findViewById(R.id.label); TextView label = findViewById(R.id.label); label.setText(dimension.getLabelId()); switch (dimension.getDataType()) { case SortDimension.DATA_TYPE_NUMBER: Loading @@ -77,17 +75,21 @@ public class HeaderCell extends LinearLayout { } if (mCurDirection != dimension.getSortDirection()) { ImageView arrow = (ImageView) findViewById(R.id.sort_arrow); ImageView arrow = findViewById(R.id.sort_arrow); switch (dimension.getSortDirection()) { case SortDimension.SORT_DIRECTION_NONE: arrow.setVisibility(View.GONE); break; case SortDimension.SORT_DIRECTION_ASCENDING: showArrow(arrow, R.animator.arrow_rotate_up, showArrow( arrow, R.animator.arrow_rotate_up, R.string.sort_direction_ascending); break; case SortDimension.SORT_DIRECTION_DESCENDING: showArrow(arrow, R.animator.arrow_rotate_down, showArrow( arrow, R.animator.arrow_rotate_down, R.string.sort_direction_descending); break; default: Loading src/com/android/documentsui/sorting/TableHeaderController.java +17 −21 Original line number Diff line number Diff line Loading @@ -22,24 +22,19 @@ import com.android.documentsui.R; import javax.annotation.Nullable; /** * View controller for table header that associates header cells in table header and columns. */ /** View controller for table header that associates header cells in table header and columns. */ public final class TableHeaderController implements SortController.WidgetController { private View mTableHeader; private final HeaderCell mTitleCell; private final HeaderCell mSummaryCell; private final HeaderCell mSizeCell; private final HeaderCell mFileTypeCell; private final HeaderCell mDateCell; private final SortModel mModel; // We assign this here porque each method reference creates a new object // instance (which is wasteful). private final View.OnClickListener mOnCellClickListener = this::onCellClicked; private final SortModel.UpdateListener mModelListener = this::onModelUpdate; private final SortModel mModel; private final View mTableHeader; private TableHeaderController(SortModel sortModel, View tableHeader) { assert (sortModel != null); Loading @@ -48,17 +43,23 @@ public final class TableHeaderController implements SortController.WidgetControl mModel = sortModel; mTableHeader = tableHeader; mTitleCell = (HeaderCell) tableHeader.findViewById(android.R.id.title); mSummaryCell = (HeaderCell) tableHeader.findViewById(android.R.id.summary); mSizeCell = (HeaderCell) tableHeader.findViewById(R.id.size); mFileTypeCell = (HeaderCell) tableHeader.findViewById(R.id.file_type); mDateCell = (HeaderCell) tableHeader.findViewById(R.id.date); mTitleCell = tableHeader.findViewById(android.R.id.title); mSummaryCell = tableHeader.findViewById(android.R.id.summary); mSizeCell = tableHeader.findViewById(R.id.size); mFileTypeCell = tableHeader.findViewById(R.id.file_type); mDateCell = tableHeader.findViewById(R.id.date); onModelUpdate(mModel, SortModel.UPDATE_TYPE_UNSPECIFIED); mModel.addListener(mModelListener); } /** Creates a TableHeaderController. */ public static @Nullable TableHeaderController create( SortModel sortModel, @Nullable View tableHeader) { return (tableHeader == null) ? null : new TableHeaderController(sortModel, tableHeader); } private void onModelUpdate(SortModel model, int updateTypeUnspecified) { bindCell(mTitleCell, SortModel.SORT_DIMENSION_ID_TITLE); bindCell(mSummaryCell, SortModel.SORT_DIMENSION_ID_SUMMARY); Loading Loading @@ -97,9 +98,4 @@ public final class TableHeaderController implements SortController.WidgetControl mModel.sortByUser(dimension.getId(), dimension.getNextDirection()); } public static @Nullable TableHeaderController create( SortModel sortModel, @Nullable View tableHeader) { return (tableHeader == null) ? null : new TableHeaderController(sortModel, tableHeader); } } tests/common/com/android/documentsui/bots/SortBot.java +13 −14 Original line number Diff line number Diff line Loading @@ -49,10 +49,11 @@ import com.android.documentsui.sorting.SortModel; import org.hamcrest.Matcher; /** * A test helper class that provides support for controlling the UI Breadcrumb * programmatically, and making assertions against the state of the UI. * <p> * Support for working directly with Roots and Directory view can be found in the respective bots. * A test helper class that provides support for controlling the UI Breadcrumb programmatically, and * making assertions against the state of the UI. * * <p>Support for working directly with Roots and Directory view can be found in the respective * bots. */ public class SortBot extends Bots.BaseBot { Loading @@ -78,16 +79,15 @@ public class SortBot extends Bots.BaseBot { result = sortByMenu(id, direction); } assertTrue("Sorting by id: " + id + " in direction: " + direction + " failed.", result); assertTrue("Sorting by id: " + id + " in direction: " + direction + " failed.", result); } public boolean isHeaderShow() { return Matchers.present(mColumnBot.MATCHER); return Matchers.present(ColumnSortBot.MATCHER); } public void assertHeaderHide() { assertFalse(Matchers.present(mColumnBot.MATCHER)); assertFalse(Matchers.present(ColumnSortBot.MATCHER)); } public void assertHeaderShow() { Loading @@ -98,7 +98,7 @@ public class SortBot extends Bots.BaseBot { // or with espresso. It's sad that I'm leaving you // with this little gremlin, but we all have to // move on and get stuff done :) assertTrue(Matchers.present(mColumnBot.MATCHER)); assertTrue(Matchers.present(ColumnSortBot.MATCHER)); } private boolean sortByMenu(int id, @SortDirection int direction) { Loading Loading @@ -131,9 +131,8 @@ public class SortBot extends Bots.BaseBot { private static final Matcher<View> MATCHER = withId(R.id.table_header); private boolean sortBy(String label, @SortDirection int direction) { final Matcher<View> cellMatcher = allOf( withChild(withText(label)), isDescendantOfA(MATCHER)); final Matcher<View> cellMatcher = allOf(withChild(withText(label)), isDescendantOfA(MATCHER)); onView(cellMatcher).perform(click()); final @SortDirection int viewDirection = getDirection(cellMatcher); Loading tests/functional/com/android/documentsui/SortDocumentUiTest.java +30 −41 Original line number Diff line number Diff line Loading @@ -39,20 +39,16 @@ public class SortDocumentUiTest extends ActivityTest<FilesActivity> { private static final String MIME_3 = "image/jpeg"; // JPG image private static final String[] FILES = {FILE_1, FILE_3, FILE_2}; private static final String[] FILES_IN_MODIFIED_DESC = reverse(FILES); private static final String[] MIMES = {MIME_1, MIME_3, MIME_2}; private static final String[] DIRS = {DIR_1, DIR_2}; private static final String[] DIRS_IN_MODIFIED_DESC = reverse(DIRS); private static final String[] DIRS_IN_NAME_ASC = {DIR_2, DIR_1}; private static final String[] DIRS_IN_NAME_DESC = reverse(DIRS_IN_NAME_ASC); private static final String[] FILES_IN_NAME_ASC = {FILE_2, FILE_1, FILE_3}; private static final String[] FILES_IN_NAME_DESC = reverse(FILES_IN_NAME_ASC); private static final String[] FILES_IN_SIZE_ASC = {FILE_2, FILE_1, FILE_3}; private static final String[] FILES_IN_SIZE_DESC = reverse(FILES_IN_SIZE_ASC); private static final String[] DIRS_IN_MODIFIED_DESC = reverse(DIRS); private static final String[] FILES_IN_MODIFIED_DESC = reverse(FILES); private static final String[] FILES_IN_TYPE_ASC = {FILE_2, FILE_3, FILE_1}; private static final String[] FILES_IN_TYPE_DESC = reverse(FILES_IN_TYPE_ASC); Loading @@ -60,6 +56,16 @@ public class SortDocumentUiTest extends ActivityTest<FilesActivity> { super(FilesActivity.class); } private static String[] reverse(String[] array) { String[] ret = new String[array.length]; for (int i = 0; i < array.length; ++i) { ret[ret.length - i - 1] = array[i]; } return ret; } @Override public void setUp() throws Exception { super.setUp(); Loading @@ -71,8 +77,9 @@ public class SortDocumentUiTest extends ActivityTest<FilesActivity> { } /** * Initiate test files. It allows waiting between creations of files, so that we can assure * the modified date of each document is different. * Initiate test files. It allows waiting between creations of files, so that we can assure the * modified date of each document is different. * * @param sleep time to sleep in ms */ private void initFiles(long sleep) throws Exception { Loading Loading @@ -110,8 +117,7 @@ public class SortDocumentUiTest extends ActivityTest<FilesActivity> { bots.main.switchToListMode(); bots.sort.sortBy( SortModel.SORT_DIMENSION_ID_SIZE, SortDimension.SORT_DIRECTION_ASCENDING); bots.sort.sortBy(SortModel.SORT_DIMENSION_ID_SIZE, SortDimension.SORT_DIRECTION_ASCENDING); bots.directory.assertOrder(DIRS_IN_NAME_ASC, FILES_IN_SIZE_ASC); } Loading @@ -120,8 +126,7 @@ public class SortDocumentUiTest extends ActivityTest<FilesActivity> { bots.main.switchToListMode(); bots.sort.sortBy( SortModel.SORT_DIMENSION_ID_SIZE, SortDimension.SORT_DIRECTION_DESCENDING); bots.sort.sortBy(SortModel.SORT_DIMENSION_ID_SIZE, SortDimension.SORT_DIRECTION_DESCENDING); bots.directory.assertOrder(DIRS_IN_NAME_ASC, FILES_IN_SIZE_DESC); } Loading @@ -130,8 +135,7 @@ public class SortDocumentUiTest extends ActivityTest<FilesActivity> { bots.main.switchToListMode(); bots.sort.sortBy( SortModel.SORT_DIMENSION_ID_DATE, SortDimension.SORT_DIRECTION_ASCENDING); bots.sort.sortBy(SortModel.SORT_DIMENSION_ID_DATE, SortDimension.SORT_DIRECTION_ASCENDING); bots.directory.assertOrder(DIRS, FILES); } Loading @@ -140,8 +144,7 @@ public class SortDocumentUiTest extends ActivityTest<FilesActivity> { bots.main.switchToListMode(); bots.sort.sortBy( SortModel.SORT_DIMENSION_ID_DATE, SortDimension.SORT_DIRECTION_DESCENDING); bots.sort.sortBy(SortModel.SORT_DIMENSION_ID_DATE, SortDimension.SORT_DIRECTION_DESCENDING); bots.directory.assertOrder(DIRS_IN_MODIFIED_DESC, FILES_IN_MODIFIED_DESC); } Loading Loading @@ -180,8 +183,7 @@ public class SortDocumentUiTest extends ActivityTest<FilesActivity> { bots.main.switchToGridMode(); bots.sort.sortBy( SortModel.SORT_DIMENSION_ID_SIZE, SortDimension.SORT_DIRECTION_ASCENDING); bots.sort.sortBy(SortModel.SORT_DIMENSION_ID_SIZE, SortDimension.SORT_DIRECTION_ASCENDING); bots.directory.assertOrder(DIRS_IN_NAME_ASC, FILES_IN_SIZE_ASC); } Loading @@ -190,8 +192,7 @@ public class SortDocumentUiTest extends ActivityTest<FilesActivity> { bots.main.switchToGridMode(); bots.sort.sortBy( SortModel.SORT_DIMENSION_ID_SIZE, SortDimension.SORT_DIRECTION_DESCENDING); bots.sort.sortBy(SortModel.SORT_DIMENSION_ID_SIZE, SortDimension.SORT_DIRECTION_DESCENDING); bots.directory.assertOrder(DIRS_IN_NAME_ASC, FILES_IN_SIZE_DESC); } Loading @@ -200,8 +201,7 @@ public class SortDocumentUiTest extends ActivityTest<FilesActivity> { bots.main.switchToGridMode(); bots.sort.sortBy( SortModel.SORT_DIMENSION_ID_DATE, SortDimension.SORT_DIRECTION_ASCENDING); bots.sort.sortBy(SortModel.SORT_DIMENSION_ID_DATE, SortDimension.SORT_DIRECTION_ASCENDING); bots.directory.assertOrder(DIRS, FILES); } Loading @@ -210,8 +210,7 @@ public class SortDocumentUiTest extends ActivityTest<FilesActivity> { bots.main.switchToGridMode(); bots.sort.sortBy( SortModel.SORT_DIMENSION_ID_DATE, SortDimension.SORT_DIRECTION_DESCENDING); bots.sort.sortBy(SortModel.SORT_DIMENSION_ID_DATE, SortDimension.SORT_DIRECTION_DESCENDING); bots.directory.assertOrder(DIRS_IN_MODIFIED_DESC, FILES_IN_MODIFIED_DESC); } Loading @@ -234,14 +233,4 @@ public class SortDocumentUiTest extends ActivityTest<FilesActivity> { SortModel.SORT_DIMENSION_ID_FILE_TYPE, SortDimension.SORT_DIRECTION_DESCENDING); bots.directory.assertOrder(DIRS_IN_NAME_ASC, FILES_IN_TYPE_DESC); } private static String[] reverse(String[] array) { String[] ret = new String[array.length]; for (int i = 0; i < array.length; ++i) { ret[ret.length - i - 1] = array[i]; } return ret; } } Loading
src/com/android/documentsui/sorting/HeaderCell.java +13 −11 Original line number Diff line number Diff line Loading @@ -19,8 +19,6 @@ package com.android.documentsui.sorting; import android.animation.AnimatorInflater; import android.animation.LayoutTransition; import android.animation.ObjectAnimator; import androidx.annotation.AnimatorRes; import androidx.annotation.StringRes; import android.content.Context; import android.util.AttributeSet; import android.view.Gravity; Loading @@ -29,14 +27,14 @@ import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.TextView; import androidx.annotation.AnimatorRes; import androidx.annotation.StringRes; import com.android.documentsui.R; import com.android.documentsui.sorting.SortDimension; /** * A clickable, sortable table header cell layout. * * It updates its display when it binds to {@link SortDimension} and changes the status of sorting * when it's clicked. * A clickable, sortable table header cell layout. It updates its display when it binds to {@link * SortDimension} and changes the status of sorting when it's clicked. */ public class HeaderCell extends LinearLayout { Loading @@ -62,7 +60,7 @@ public class HeaderCell extends LinearLayout { setVisibility(dimension.getVisibility()); if (dimension.getVisibility() == View.VISIBLE) { TextView label = (TextView) findViewById(R.id.label); TextView label = findViewById(R.id.label); label.setText(dimension.getLabelId()); switch (dimension.getDataType()) { case SortDimension.DATA_TYPE_NUMBER: Loading @@ -77,17 +75,21 @@ public class HeaderCell extends LinearLayout { } if (mCurDirection != dimension.getSortDirection()) { ImageView arrow = (ImageView) findViewById(R.id.sort_arrow); ImageView arrow = findViewById(R.id.sort_arrow); switch (dimension.getSortDirection()) { case SortDimension.SORT_DIRECTION_NONE: arrow.setVisibility(View.GONE); break; case SortDimension.SORT_DIRECTION_ASCENDING: showArrow(arrow, R.animator.arrow_rotate_up, showArrow( arrow, R.animator.arrow_rotate_up, R.string.sort_direction_ascending); break; case SortDimension.SORT_DIRECTION_DESCENDING: showArrow(arrow, R.animator.arrow_rotate_down, showArrow( arrow, R.animator.arrow_rotate_down, R.string.sort_direction_descending); break; default: Loading
src/com/android/documentsui/sorting/TableHeaderController.java +17 −21 Original line number Diff line number Diff line Loading @@ -22,24 +22,19 @@ import com.android.documentsui.R; import javax.annotation.Nullable; /** * View controller for table header that associates header cells in table header and columns. */ /** View controller for table header that associates header cells in table header and columns. */ public final class TableHeaderController implements SortController.WidgetController { private View mTableHeader; private final HeaderCell mTitleCell; private final HeaderCell mSummaryCell; private final HeaderCell mSizeCell; private final HeaderCell mFileTypeCell; private final HeaderCell mDateCell; private final SortModel mModel; // We assign this here porque each method reference creates a new object // instance (which is wasteful). private final View.OnClickListener mOnCellClickListener = this::onCellClicked; private final SortModel.UpdateListener mModelListener = this::onModelUpdate; private final SortModel mModel; private final View mTableHeader; private TableHeaderController(SortModel sortModel, View tableHeader) { assert (sortModel != null); Loading @@ -48,17 +43,23 @@ public final class TableHeaderController implements SortController.WidgetControl mModel = sortModel; mTableHeader = tableHeader; mTitleCell = (HeaderCell) tableHeader.findViewById(android.R.id.title); mSummaryCell = (HeaderCell) tableHeader.findViewById(android.R.id.summary); mSizeCell = (HeaderCell) tableHeader.findViewById(R.id.size); mFileTypeCell = (HeaderCell) tableHeader.findViewById(R.id.file_type); mDateCell = (HeaderCell) tableHeader.findViewById(R.id.date); mTitleCell = tableHeader.findViewById(android.R.id.title); mSummaryCell = tableHeader.findViewById(android.R.id.summary); mSizeCell = tableHeader.findViewById(R.id.size); mFileTypeCell = tableHeader.findViewById(R.id.file_type); mDateCell = tableHeader.findViewById(R.id.date); onModelUpdate(mModel, SortModel.UPDATE_TYPE_UNSPECIFIED); mModel.addListener(mModelListener); } /** Creates a TableHeaderController. */ public static @Nullable TableHeaderController create( SortModel sortModel, @Nullable View tableHeader) { return (tableHeader == null) ? null : new TableHeaderController(sortModel, tableHeader); } private void onModelUpdate(SortModel model, int updateTypeUnspecified) { bindCell(mTitleCell, SortModel.SORT_DIMENSION_ID_TITLE); bindCell(mSummaryCell, SortModel.SORT_DIMENSION_ID_SUMMARY); Loading Loading @@ -97,9 +98,4 @@ public final class TableHeaderController implements SortController.WidgetControl mModel.sortByUser(dimension.getId(), dimension.getNextDirection()); } public static @Nullable TableHeaderController create( SortModel sortModel, @Nullable View tableHeader) { return (tableHeader == null) ? null : new TableHeaderController(sortModel, tableHeader); } }
tests/common/com/android/documentsui/bots/SortBot.java +13 −14 Original line number Diff line number Diff line Loading @@ -49,10 +49,11 @@ import com.android.documentsui.sorting.SortModel; import org.hamcrest.Matcher; /** * A test helper class that provides support for controlling the UI Breadcrumb * programmatically, and making assertions against the state of the UI. * <p> * Support for working directly with Roots and Directory view can be found in the respective bots. * A test helper class that provides support for controlling the UI Breadcrumb programmatically, and * making assertions against the state of the UI. * * <p>Support for working directly with Roots and Directory view can be found in the respective * bots. */ public class SortBot extends Bots.BaseBot { Loading @@ -78,16 +79,15 @@ public class SortBot extends Bots.BaseBot { result = sortByMenu(id, direction); } assertTrue("Sorting by id: " + id + " in direction: " + direction + " failed.", result); assertTrue("Sorting by id: " + id + " in direction: " + direction + " failed.", result); } public boolean isHeaderShow() { return Matchers.present(mColumnBot.MATCHER); return Matchers.present(ColumnSortBot.MATCHER); } public void assertHeaderHide() { assertFalse(Matchers.present(mColumnBot.MATCHER)); assertFalse(Matchers.present(ColumnSortBot.MATCHER)); } public void assertHeaderShow() { Loading @@ -98,7 +98,7 @@ public class SortBot extends Bots.BaseBot { // or with espresso. It's sad that I'm leaving you // with this little gremlin, but we all have to // move on and get stuff done :) assertTrue(Matchers.present(mColumnBot.MATCHER)); assertTrue(Matchers.present(ColumnSortBot.MATCHER)); } private boolean sortByMenu(int id, @SortDirection int direction) { Loading Loading @@ -131,9 +131,8 @@ public class SortBot extends Bots.BaseBot { private static final Matcher<View> MATCHER = withId(R.id.table_header); private boolean sortBy(String label, @SortDirection int direction) { final Matcher<View> cellMatcher = allOf( withChild(withText(label)), isDescendantOfA(MATCHER)); final Matcher<View> cellMatcher = allOf(withChild(withText(label)), isDescendantOfA(MATCHER)); onView(cellMatcher).perform(click()); final @SortDirection int viewDirection = getDirection(cellMatcher); Loading
tests/functional/com/android/documentsui/SortDocumentUiTest.java +30 −41 Original line number Diff line number Diff line Loading @@ -39,20 +39,16 @@ public class SortDocumentUiTest extends ActivityTest<FilesActivity> { private static final String MIME_3 = "image/jpeg"; // JPG image private static final String[] FILES = {FILE_1, FILE_3, FILE_2}; private static final String[] FILES_IN_MODIFIED_DESC = reverse(FILES); private static final String[] MIMES = {MIME_1, MIME_3, MIME_2}; private static final String[] DIRS = {DIR_1, DIR_2}; private static final String[] DIRS_IN_MODIFIED_DESC = reverse(DIRS); private static final String[] DIRS_IN_NAME_ASC = {DIR_2, DIR_1}; private static final String[] DIRS_IN_NAME_DESC = reverse(DIRS_IN_NAME_ASC); private static final String[] FILES_IN_NAME_ASC = {FILE_2, FILE_1, FILE_3}; private static final String[] FILES_IN_NAME_DESC = reverse(FILES_IN_NAME_ASC); private static final String[] FILES_IN_SIZE_ASC = {FILE_2, FILE_1, FILE_3}; private static final String[] FILES_IN_SIZE_DESC = reverse(FILES_IN_SIZE_ASC); private static final String[] DIRS_IN_MODIFIED_DESC = reverse(DIRS); private static final String[] FILES_IN_MODIFIED_DESC = reverse(FILES); private static final String[] FILES_IN_TYPE_ASC = {FILE_2, FILE_3, FILE_1}; private static final String[] FILES_IN_TYPE_DESC = reverse(FILES_IN_TYPE_ASC); Loading @@ -60,6 +56,16 @@ public class SortDocumentUiTest extends ActivityTest<FilesActivity> { super(FilesActivity.class); } private static String[] reverse(String[] array) { String[] ret = new String[array.length]; for (int i = 0; i < array.length; ++i) { ret[ret.length - i - 1] = array[i]; } return ret; } @Override public void setUp() throws Exception { super.setUp(); Loading @@ -71,8 +77,9 @@ public class SortDocumentUiTest extends ActivityTest<FilesActivity> { } /** * Initiate test files. It allows waiting between creations of files, so that we can assure * the modified date of each document is different. * Initiate test files. It allows waiting between creations of files, so that we can assure the * modified date of each document is different. * * @param sleep time to sleep in ms */ private void initFiles(long sleep) throws Exception { Loading Loading @@ -110,8 +117,7 @@ public class SortDocumentUiTest extends ActivityTest<FilesActivity> { bots.main.switchToListMode(); bots.sort.sortBy( SortModel.SORT_DIMENSION_ID_SIZE, SortDimension.SORT_DIRECTION_ASCENDING); bots.sort.sortBy(SortModel.SORT_DIMENSION_ID_SIZE, SortDimension.SORT_DIRECTION_ASCENDING); bots.directory.assertOrder(DIRS_IN_NAME_ASC, FILES_IN_SIZE_ASC); } Loading @@ -120,8 +126,7 @@ public class SortDocumentUiTest extends ActivityTest<FilesActivity> { bots.main.switchToListMode(); bots.sort.sortBy( SortModel.SORT_DIMENSION_ID_SIZE, SortDimension.SORT_DIRECTION_DESCENDING); bots.sort.sortBy(SortModel.SORT_DIMENSION_ID_SIZE, SortDimension.SORT_DIRECTION_DESCENDING); bots.directory.assertOrder(DIRS_IN_NAME_ASC, FILES_IN_SIZE_DESC); } Loading @@ -130,8 +135,7 @@ public class SortDocumentUiTest extends ActivityTest<FilesActivity> { bots.main.switchToListMode(); bots.sort.sortBy( SortModel.SORT_DIMENSION_ID_DATE, SortDimension.SORT_DIRECTION_ASCENDING); bots.sort.sortBy(SortModel.SORT_DIMENSION_ID_DATE, SortDimension.SORT_DIRECTION_ASCENDING); bots.directory.assertOrder(DIRS, FILES); } Loading @@ -140,8 +144,7 @@ public class SortDocumentUiTest extends ActivityTest<FilesActivity> { bots.main.switchToListMode(); bots.sort.sortBy( SortModel.SORT_DIMENSION_ID_DATE, SortDimension.SORT_DIRECTION_DESCENDING); bots.sort.sortBy(SortModel.SORT_DIMENSION_ID_DATE, SortDimension.SORT_DIRECTION_DESCENDING); bots.directory.assertOrder(DIRS_IN_MODIFIED_DESC, FILES_IN_MODIFIED_DESC); } Loading Loading @@ -180,8 +183,7 @@ public class SortDocumentUiTest extends ActivityTest<FilesActivity> { bots.main.switchToGridMode(); bots.sort.sortBy( SortModel.SORT_DIMENSION_ID_SIZE, SortDimension.SORT_DIRECTION_ASCENDING); bots.sort.sortBy(SortModel.SORT_DIMENSION_ID_SIZE, SortDimension.SORT_DIRECTION_ASCENDING); bots.directory.assertOrder(DIRS_IN_NAME_ASC, FILES_IN_SIZE_ASC); } Loading @@ -190,8 +192,7 @@ public class SortDocumentUiTest extends ActivityTest<FilesActivity> { bots.main.switchToGridMode(); bots.sort.sortBy( SortModel.SORT_DIMENSION_ID_SIZE, SortDimension.SORT_DIRECTION_DESCENDING); bots.sort.sortBy(SortModel.SORT_DIMENSION_ID_SIZE, SortDimension.SORT_DIRECTION_DESCENDING); bots.directory.assertOrder(DIRS_IN_NAME_ASC, FILES_IN_SIZE_DESC); } Loading @@ -200,8 +201,7 @@ public class SortDocumentUiTest extends ActivityTest<FilesActivity> { bots.main.switchToGridMode(); bots.sort.sortBy( SortModel.SORT_DIMENSION_ID_DATE, SortDimension.SORT_DIRECTION_ASCENDING); bots.sort.sortBy(SortModel.SORT_DIMENSION_ID_DATE, SortDimension.SORT_DIRECTION_ASCENDING); bots.directory.assertOrder(DIRS, FILES); } Loading @@ -210,8 +210,7 @@ public class SortDocumentUiTest extends ActivityTest<FilesActivity> { bots.main.switchToGridMode(); bots.sort.sortBy( SortModel.SORT_DIMENSION_ID_DATE, SortDimension.SORT_DIRECTION_DESCENDING); bots.sort.sortBy(SortModel.SORT_DIMENSION_ID_DATE, SortDimension.SORT_DIRECTION_DESCENDING); bots.directory.assertOrder(DIRS_IN_MODIFIED_DESC, FILES_IN_MODIFIED_DESC); } Loading @@ -234,14 +233,4 @@ public class SortDocumentUiTest extends ActivityTest<FilesActivity> { SortModel.SORT_DIMENSION_ID_FILE_TYPE, SortDimension.SORT_DIRECTION_DESCENDING); bots.directory.assertOrder(DIRS_IN_NAME_ASC, FILES_IN_TYPE_DESC); } private static String[] reverse(String[] array) { String[] ret = new String[array.length]; for (int i = 0; i < array.length; ++i) { ret[ret.length - i - 1] = array[i]; } return ret; } }