mirror of
https://github.com/nextcloud/android.git
synced 2024-10-23 04:26:01 +03:00
Merge pull request #8091 from nextcloud/hardenEmptyNotificationTest
Harden notification empty screenshot test
This commit is contained in:
commit
1e0ec8b2d4
1 changed files with 21 additions and 13 deletions
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue