use of com.owncloud.android.ui.fragment.OCFileListBottomSheetActions in project android by nextcloud.
the class DialogFragmentIT method testBottomSheet.
@Test
@ScreenshotTest
public void testBottomSheet() {
if (Looper.myLooper() == null) {
Looper.prepare();
}
OCFileListBottomSheetActions action = new OCFileListBottomSheetActions() {
@Override
public void createFolder() {
}
@Override
public void uploadFromApp() {
}
@Override
public void uploadFiles() {
}
@Override
public void newDocument() {
}
@Override
public void newSpreadsheet() {
}
@Override
public void newPresentation() {
}
@Override
public void directCameraUpload() {
}
@Override
public void scanDocUpload() {
}
@Override
public void showTemplate(Creator creator, String headline) {
}
@Override
public void createRichWorkspace() {
}
};
DeviceInfo info = new DeviceInfo();
OCFile ocFile = new OCFile("/test.md");
Intent intent = new Intent(targetContext, FileDisplayActivity.class);
FileDisplayActivity fda = activityRule.launchActivity(intent);
// add direct editing info
DirectEditing directEditing = new DirectEditing();
directEditing.getCreators().put("1", new Creator("1", "text", "text file", ".md", "application/octet-stream", false));
directEditing.getCreators().put("2", new Creator("2", "md", "markdown file", ".md", "application/octet-stream", false));
directEditing.getEditors().put("text", new Editor("1", "Text", new ArrayList<>(Collections.singletonList(MimeTypeUtil.MIMETYPE_TEXT_MARKDOWN)), new ArrayList<>(), false));
String json = new Gson().toJson(directEditing);
new ArbitraryDataProvider(targetContext.getContentResolver()).storeOrUpdateKeyValue(user.getAccountName(), ArbitraryDataProvider.DIRECT_EDITING, json);
// activate templates
OCCapability capability = fda.getCapabilities();
capability.setRichDocuments(CapabilityBooleanType.TRUE);
capability.setRichDocumentsDirectEditing(CapabilityBooleanType.TRUE);
capability.setRichDocumentsTemplatesAvailable(CapabilityBooleanType.TRUE);
OCFileListBottomSheetDialog sut = new OCFileListBottomSheetDialog(fda, action, info, user, ocFile);
fda.runOnUiThread(sut::show);
waitForIdleSync();
screenshot(sut.getWindow().getDecorView());
}
Aggregations