diff options
author | ByteHamster <info@bytehamster.com> | 2022-05-07 20:52:42 +0200 |
---|---|---|
committer | ByteHamster <info@bytehamster.com> | 2022-05-07 20:52:45 +0200 |
commit | f0fe9aa7103ea24505d06b7c63a730a8a6d933b0 (patch) | |
tree | cb382b29205017a252b6f0a056ba74580c6f61e6 /app | |
parent | 5fdd7f671e5b33efe1bf5b2c876c926c6a0099e2 (diff) | |
download | AntennaPod-f0fe9aa7103ea24505d06b7c63a730a8a6d933b0.zip |
Fix column change on subscriptions screen
Before, it sometimes resized the grid but not the actual covers
Diffstat (limited to 'app')
-rw-r--r-- | app/src/main/java/de/danoeh/antennapod/fragment/SubscriptionFragment.java | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/SubscriptionFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/SubscriptionFragment.java index ec3240496..af97e8dab 100644 --- a/app/src/main/java/de/danoeh/antennapod/fragment/SubscriptionFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/SubscriptionFragment.java @@ -146,13 +146,8 @@ public class SubscriptionFragment extends Fragment } subscriptionRecycler = root.findViewById(R.id.subscriptions_grid); - GridLayoutManager gridLayoutManager = new GridLayoutManager(getContext(), - prefs.getInt(PREF_NUM_COLUMNS, getDefaultNumOfColumns()), - RecyclerView.VERTICAL, - false); - subscriptionRecycler.setLayoutManager(gridLayoutManager); + setColumnNumber(prefs.getInt(PREF_NUM_COLUMNS, getDefaultNumOfColumns())); subscriptionRecycler.addItemDecoration(new SubscriptionsRecyclerAdapter.GridDividerItemDecorator()); - gridLayoutManager.setSpanCount(prefs.getInt(PREF_NUM_COLUMNS, getDefaultNumOfColumns())); registerForContextMenu(subscriptionRecycler); subscriptionAddButton = root.findViewById(R.id.subscriptions_add); progressBar = root.findViewById(R.id.progLoading); @@ -239,9 +234,9 @@ public class SubscriptionFragment extends Fragment } private void setColumnNumber(int columns) { - GridLayoutManager gridLayoutManager = (GridLayoutManager) subscriptionRecycler.getLayoutManager(); - gridLayoutManager.setSpanCount(columns); - subscriptionAdapter.notifyDataSetChanged(); + GridLayoutManager gridLayoutManager = new GridLayoutManager(getContext(), + columns, RecyclerView.VERTICAL, false); + subscriptionRecycler.setLayoutManager(gridLayoutManager); prefs.edit().putInt(PREF_NUM_COLUMNS, columns).apply(); refreshToolbarState(); } |