Signed-off-by: tobiasKaminsky <tobias@kaminsky.me>
This commit is contained in:
tobiasKaminsky 2020-09-14 16:47:01 +02:00
parent 02d0f8aec0
commit 2e9269510a
No known key found for this signature in database
GPG key ID: 0E00D4D47D0C5AF7
4 changed files with 22 additions and 4 deletions

View file

@ -32,9 +32,17 @@ class UploadFilesActivityIT : AbstractIT() {
@Test
// @ScreenshotTest // TODO re-enable and make sure that folder content on emulator is the same on all devices
fun open() {
fun noneSelected() {
val sut: UploadFilesActivity = activityRule.launchActivity(null)
screenshot(sut)
}
fun fileSelected() {
val sut: UploadFilesActivity = activityRule.launchActivity(null)
// TODO select one
screenshot(sut)
}
}

View file

@ -109,6 +109,7 @@ public class UploadFilesActivity extends DrawerActivity implements LocalFileList
private Menu mOptionsMenu;
private SearchView mSearchView;
private Spinner mBehaviourSpinner;
private MaterialButton uploadButton;
/**
* Helper to launch the UploadFilesActivity for which you would like a result when it finished. Your
@ -179,9 +180,10 @@ public class UploadFilesActivity extends DrawerActivity implements LocalFileList
cancelButton.setTextColor(ThemeColorUtils.primaryColor(this, true));
cancelButton.setOnClickListener(this);
MaterialButton uploadButton = findViewById(R.id.upload_files_btn_upload);
uploadButton = findViewById(R.id.upload_files_btn_upload);
ThemeButtonUtils.colorPrimaryButton(uploadButton, this);
uploadButton.setOnClickListener(this);
uploadButton.setEnabled(false);
int localBehaviour = preferences.getUploaderBehaviour();
@ -548,7 +550,7 @@ public class UploadFilesActivity extends DrawerActivity implements LocalFileList
*/
@Override
public void onFileClick(File file) {
// nothing to do
uploadButton.setEnabled(mFileListFragment.getCheckedFilesCount() > 0);
}
/**

View file

@ -426,7 +426,7 @@ public class LocalFileListAdapter extends RecyclerView.Adapter<RecyclerView.View
output = resources.getQuantityString(R.plurals.file_list__footer__folder, foldersCount, foldersCount);
} else {
output = resources.getQuantityString(R.plurals.file_list__footer__file, filesCount, filesCount) + ", " +
resources.getQuantityString(R.plurals.file_list__footer__folder, foldersCount, foldersCount);
resources.getQuantityString(R.plurals.file_list__footer__folder, foldersCount, foldersCount);
}
return output;
@ -436,6 +436,10 @@ public class LocalFileListAdapter extends RecyclerView.Adapter<RecyclerView.View
this.gridView = gridView;
}
public int checkedFilesCount() {
return checkedFiles.size();
}
private static class LocalFileListItemViewHolder extends LocalFileListGridItemViewHolder {
private final TextView fileSize;
private final TextView lastModification;

View file

@ -294,6 +294,10 @@ public class LocalFileListFragment extends ExtendedListFragment implements
return mAdapter.getCheckedFilesPath();
}
public int getCheckedFilesCount() {
return mAdapter.checkedFilesCount();
}
public void sortFiles(FileSortOrder sortOrder) {
mSortButton.setText(DisplayUtils.getSortOrderStringId(sortOrder));
mAdapter.setSortOrder(sortOrder);