diff options
author | Stefan Niedermann <info@niedermann.it> | 2020-03-30 11:05:42 +0300 |
---|---|---|
committer | Stefan Niedermann <info@niedermann.it> | 2020-03-30 11:05:42 +0300 |
commit | f55be0bef4df2113a105ddf6f3f435adb462e77f (patch) | |
tree | 1c004c9f2771c5fd5883c9fa21f98e5ecc9100c1 /app/src/main/java/it/niedermann/nextcloud/deck/ui/stack | |
parent | 48d4cd030149047684ae03276d7bd34b4fc1fec0 (diff) |
Remove unnecessary syncManager.getStack call
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 | 34 |
1 files changed, 14 insertions, 20 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 29bab1fb7..212e4d937 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 @@ -16,7 +16,6 @@ import java.util.List; import it.niedermann.nextcloud.deck.databinding.FragmentStackBinding; import it.niedermann.nextcloud.deck.model.Account; import it.niedermann.nextcloud.deck.model.full.FullCard; -import it.niedermann.nextcloud.deck.model.full.FullStack; import it.niedermann.nextcloud.deck.persistence.sync.SyncManager; import it.niedermann.nextcloud.deck.ui.card.CardAdapter; import it.niedermann.nextcloud.deck.ui.card.CardAdapter.SelectCardListener; @@ -104,25 +103,20 @@ public class StackFragment extends Fragment { binding.emptyContentView.hideDescription(); } - //FIXME: noone needs the outer getStack. having only the inner getFullCardsForStack is totally fine. - syncManager.getStack(account.getId(), stackId).observe(getViewLifecycleOwner(), (FullStack stack) -> { - 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.GONE); - adapter.setCardList(cards); - //FIXME: the problem i see is in setCardList. it doesn't really update the UI somehow. - // 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); - } - }); - }); - } + syncManager.getFullCardsForStack(account.getId(), stackId).observe(getViewLifecycleOwner(), (List<FullCard> cards) -> { + activity.runOnUiThread(() -> { + if (cards != null && cards.size() > 0) { + binding.emptyContentView.setVisibility(View.GONE); + adapter.setCardList(cards); + // FIXME the problem i see is in setCardList. it doesn't really update the UI somehow. + // 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); + } + }); }); return binding.getRoot(); } |