diff options
author | Stefan Niedermann <info@niedermann.it> | 2020-03-28 17:24:56 +0300 |
---|---|---|
committer | Stefan Niedermann <info@niedermann.it> | 2020-03-28 17:24:56 +0300 |
commit | 4a6b63afcc43a3eadc20910d27248d19c7982664 (patch) | |
tree | 8bc0e508702b636839273ae06d1026a22de4b54e /app/src/main/java/it/niedermann/nextcloud/deck/ui/stack | |
parent | 56bc64f9ab0320b9a9423bb0f5022ca32b5f072f (diff) |
Fix NPE
Signed-off-by: Stefan Niedermann <info@niedermann.it>
Diffstat (limited to 'app/src/main/java/it/niedermann/nextcloud/deck/ui/stack')
-rw-r--r-- | app/src/main/java/it/niedermann/nextcloud/deck/ui/stack/StackFragment.java | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/app/src/main/java/it/niedermann/nextcloud/deck/ui/stack/StackFragment.java b/app/src/main/java/it/niedermann/nextcloud/deck/ui/stack/StackFragment.java index 0adabc875..f21234247 100644 --- a/app/src/main/java/it/niedermann/nextcloud/deck/ui/stack/StackFragment.java +++ b/app/src/main/java/it/niedermann/nextcloud/deck/ui/stack/StackFragment.java @@ -108,14 +108,15 @@ public class StackFragment extends Fragment { if (stack != null) { syncManager.getFullCardsForStack(account.getId(), stack.getLocalId()).observe(getViewLifecycleOwner(), (List<FullCard> cards) -> { activity.runOnUiThread(() -> { - if (cards == null || cards.size() == 0) { - binding.emptyContentView.setVisibility(View.VISIBLE); - } else { + if (cards != null && cards.size() > 0) { binding.emptyContentView.setVisibility(View.GONE); adapter.setCardList(cards); - for(int i = 0; i < getRecyclerView().getChildCount(); i++) { - binding.recyclerView.getChildAt(i).setVisibility(View.VISIBLE); + // FIXME this is just a workaround for dropping cards in an empty stack (see CrossTabDragAndDrop on ACTION_DROP) + if(binding.recyclerView.getChildCount() > 0) { + binding.recyclerView.getChildAt(0).setVisibility(View.VISIBLE); } + } else { + binding.emptyContentView.setVisibility(View.VISIBLE); } }); }); |