use of com.nextcloud.android.lib.resources.profile.HoverCard in project android by nextcloud.
the class DialogFragmentIT method testProfileBottomSheet.
@Test
@ScreenshotTest
public void testProfileBottomSheet() {
if (Looper.myLooper() == null) {
Looper.prepare();
}
// Fixed values for HoverCard
List<Action> actions = new ArrayList<>();
actions.add(new Action("profile", "View profile", "https://dev.nextcloud.com/core/img/actions/profile.svg", "https://dev.nextcloud.com/index.php/u/christine"));
actions.add(new Action("core", "christine.scott@nextcloud.com", "https://dev.nextcloud.com/core/img/actions/mail.svg", "mailto:christine.scott@nextcloud.com"));
actions.add(new Action("spreed", "Talk to Christine", "https://dev.nextcloud.com/apps/spreed/img/app-dark.svg", "https://dev.nextcloud.com/apps/spreed/?callUser=christine"));
HoverCard hoverCard = new HoverCard("christine", "Christine Scott", actions);
// show dialog
Intent intent = new Intent(targetContext, FileDisplayActivity.class);
FileDisplayActivity fda = activityRule.launchActivity(intent);
ProfileBottomSheetDialog sut = new ProfileBottomSheetDialog(fda, user, hoverCard);
fda.runOnUiThread(sut::show);
waitForIdleSync();
screenshot(sut.getWindow().getDecorView());
}
use of com.nextcloud.android.lib.resources.profile.HoverCard in project android by nextcloud.
the class RetrieveHoverCardAsyncTask method doInBackground.
@Override
protected HoverCard doInBackground(Void... voids) {
try {
NextcloudClient client = clientFactory.createNextcloudClient(user);
RemoteOperationResult<HoverCard> result = new GetHoverCardRemoteOperation(userId).execute(client);
if (result.isSuccess()) {
return result.getResultData();
} else {
return null;
}
} catch (ClientFactory.CreationException | NullPointerException e) {
return null;
}
}
Aggregations