diff options
author | Stefan Niedermann <info@niedermann.it> | 2021-03-29 12:27:48 +0300 |
---|---|---|
committer | Stefan Niedermann <info@niedermann.it> | 2021-03-29 12:27:48 +0300 |
commit | bba5fc76f3e23cca019e6da806b1fd31306dd020 (patch) | |
tree | 08eeab63aba9ae9e9779c133025a5a0fbc5c6e85 /app/src/main | |
parent | 70dd7c70e4f8a2c40ff12f91f8f4ab82da2e7cfa (diff) |
Remove need for lifecycleOwner in CardAdapter and StackFragment
Signed-off-by: Stefan Niedermann <info@niedermann.it>
Diffstat (limited to 'app/src/main')
4 files changed, 5 insertions, 10 deletions
diff --git a/app/src/main/java/it/niedermann/nextcloud/deck/ui/archivedcards/ArchivedCardsActvitiy.java b/app/src/main/java/it/niedermann/nextcloud/deck/ui/archivedcards/ArchivedCardsActvitiy.java index b3533528e..c0b922778 100644 --- a/app/src/main/java/it/niedermann/nextcloud/deck/ui/archivedcards/ArchivedCardsActvitiy.java +++ b/app/src/main/java/it/niedermann/nextcloud/deck/ui/archivedcards/ArchivedCardsActvitiy.java @@ -64,7 +64,7 @@ public class ArchivedCardsActvitiy extends BrandedActivity { LiveDataHelper.observeOnce(viewModel.getFullBoardById(account.getId(), boardId), this, (fullBoard) -> { viewModel.setCurrentBoard(fullBoard.getBoard()); - adapter = new ArchivedCardsAdapter(this, getSupportFragmentManager(), viewModel, this); + adapter = new ArchivedCardsAdapter(this, getSupportFragmentManager(), viewModel); binding.recyclerView.setAdapter(adapter); viewModel.getArchivedFullCardsForBoard(account.getId(), boardId).observe(this, (fullCards) -> adapter.setCardList(fullCards)); diff --git a/app/src/main/java/it/niedermann/nextcloud/deck/ui/archivedcards/ArchivedCardsAdapter.java b/app/src/main/java/it/niedermann/nextcloud/deck/ui/archivedcards/ArchivedCardsAdapter.java index 8968cbd72..8a60b9544 100644 --- a/app/src/main/java/it/niedermann/nextcloud/deck/ui/archivedcards/ArchivedCardsAdapter.java +++ b/app/src/main/java/it/niedermann/nextcloud/deck/ui/archivedcards/ArchivedCardsAdapter.java @@ -5,7 +5,6 @@ import android.view.MenuItem; import androidx.annotation.NonNull; import androidx.fragment.app.FragmentManager; -import androidx.lifecycle.LifecycleOwner; import it.niedermann.nextcloud.deck.DeckLog; import it.niedermann.nextcloud.deck.R; @@ -21,8 +20,8 @@ import it.niedermann.nextcloud.deck.ui.exception.ExceptionDialogFragment; public class ArchivedCardsAdapter extends CardAdapter { @SuppressWarnings("WeakerAccess") - public ArchivedCardsAdapter(@NonNull Activity activity, @NonNull FragmentManager fragmentManager, @NonNull MainViewModel viewModel, @NonNull LifecycleOwner lifecycleOwner) { - super(activity, fragmentManager, 0L, viewModel, lifecycleOwner, null); + public ArchivedCardsAdapter(@NonNull Activity activity, @NonNull FragmentManager fragmentManager, @NonNull MainViewModel viewModel) { + super(activity, fragmentManager, 0L, viewModel, null); } @Override diff --git a/app/src/main/java/it/niedermann/nextcloud/deck/ui/card/CardAdapter.java b/app/src/main/java/it/niedermann/nextcloud/deck/ui/card/CardAdapter.java index 1e92eb1b3..e25bf9719 100644 --- a/app/src/main/java/it/niedermann/nextcloud/deck/ui/card/CardAdapter.java +++ b/app/src/main/java/it/niedermann/nextcloud/deck/ui/card/CardAdapter.java @@ -14,7 +14,6 @@ import androidx.annotation.Nullable; import androidx.annotation.StringRes; import androidx.core.content.ContextCompat; import androidx.fragment.app.FragmentManager; -import androidx.lifecycle.LifecycleOwner; import androidx.recyclerview.widget.RecyclerView; import java.util.ArrayList; @@ -58,19 +57,16 @@ public class CardAdapter extends RecyclerView.Adapter<AbstractCardViewHolder> im @NonNull protected List<FullCard> cardList = new ArrayList<>(); @NonNull - protected LifecycleOwner lifecycleOwner; - @NonNull protected String counterMaxValue; @ColorInt protected int mainColor; @StringRes private final int shareLinkRes; - public CardAdapter(@NonNull Activity activity, @NonNull FragmentManager fragmentManager, long stackId, @NonNull MainViewModel mainViewModel, @NonNull LifecycleOwner lifecycleOwner, @Nullable SelectCardListener selectCardListener) { + public CardAdapter(@NonNull Activity activity, @NonNull FragmentManager fragmentManager, long stackId, @NonNull MainViewModel mainViewModel, @Nullable SelectCardListener selectCardListener) { this.activity = activity; this.counterMaxValue = this.activity.getString(R.string.counter_max_value); this.fragmentManager = fragmentManager; - this.lifecycleOwner = lifecycleOwner; this.shareLinkRes = mainViewModel.getCurrentAccount().getServerDeckVersionAsObject().getShareLinkResource(); this.stackId = stackId; this.mainViewModel = mainViewModel; 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 80440b9d0..93437e37a 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 @@ -81,7 +81,7 @@ public class StackFragment extends BrandedFragment implements DragAndDropTab<Car return binding.getRoot(); } - adapter = new CardAdapter(requireActivity(), getChildFragmentManager(), stackId, mainViewModel, this, + adapter = new CardAdapter(requireActivity(), getChildFragmentManager(), stackId, mainViewModel, (requireActivity() instanceof SelectCardListener) ? (SelectCardListener) requireActivity() : null); |