Merge pull request #8091 from nextcloud/hardenEmptyNotificationTest

Harden notification empty screenshot test
This commit is contained in:
Andy Scherzinger 2021-03-09 09:05:28 +01:00 committed by GitHub
commit 1e0ec8b2d4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -202,6 +202,7 @@ public class NotificationsActivity extends DrawerActivity implements Notificatio
@VisibleForTesting
public void populateList(List<Notification> notifications) {
initializeAdapter();
adapter.setNotificationItems(notifications);
binding.loadingContent.setVisibility(View.GONE);
@ -220,19 +221,7 @@ public class NotificationsActivity extends DrawerActivity implements Notificatio
private void fetchAndSetData() {
Thread t = new Thread(() -> {
if (client == null && optionalUser.isPresent()) {
try {
User user = optionalUser.get();
client = clientFactory.create(user);
} catch (ClientFactory.CreationException e) {
Log_OC.e(TAG, "Error initializing client", e);
}
}
if (adapter == null) {
adapter = new NotificationListAdapter(client, this);
binding.list.setAdapter(adapter);
}
initializeAdapter();
RemoteOperation getRemoteNotificationOperation = new GetNotificationsRemoteOperation();
final RemoteOperationResult result = getRemoteNotificationOperation.execute(client);
@ -253,6 +242,25 @@ public class NotificationsActivity extends DrawerActivity implements Notificatio
t.start();
}
private void initializeClient() {
if (client == null && optionalUser.isPresent()) {
try {
User user = optionalUser.get();
client = clientFactory.create(user);
} catch (ClientFactory.CreationException e) {
Log_OC.e(TAG, "Error initializing client", e);
}
}
}
private void initializeAdapter() {
initializeClient();
if (adapter == null) {
adapter = new NotificationListAdapter(client, this);
binding.list.setAdapter(adapter);
}
}
private void hideRefreshLayoutLoader() {
runOnUiThread(() -> {
binding.swipeContainingList.setRefreshing(false);