Skip to content

Fix header crash while scrolling in a playlist or just after deleting a video in it#12996

Merged
Stypox merged 3 commits intoTeamNewPipe:devfrom
whistlingwoods:reapply-local-list-header-fix-by-j-haldane
Jan 27, 2026
Merged

Fix header crash while scrolling in a playlist or just after deleting a video in it#12996
Stypox merged 3 commits intoTeamNewPipe:devfrom
whistlingwoods:reapply-local-list-header-fix-by-j-haldane

Conversation

@whistlingwoods
Copy link
Contributor

@whistlingwoods whistlingwoods commented Jan 3, 2026

What is it?

  • Bugfix (user facing)
  • Feature (user facing) ⚠️ Your PR must target the refactor branch
  • Codebase improvement (dev facing)
  • Meta improvement to the project (dev facing)

Description of the changes in your PR

Fixes the following issue(s)

APK testing

The APK can be found by going to the "Checks" tab below the title. On the left pane, click on "CI", scroll down to "artifacts" and click "app" to download the zip file which contains the debug APK of this PR. You can find more info and a video demonstration on this wiki page.

Due diligence

whistlingwoods and others added 2 commits January 4, 2026 00:40
... Crash in lists (ViewHolder views not attached) in StatisticsPlaylistFragment

Co-Authored-By: j-haldane <200528955+j-haldane@users.noreply.github.com>
Co-Authored-By: j-haldane <200528955+j-haldane@users.noreply.github.com>
@github-actions github-actions bot added the size/medium PRs with less than 250 changed lines label Jan 3, 2026
@whistlingwoods whistlingwoods changed the title Fix header crash while scrolling in a playlist or after just deleting a video in it Fix header crash while scrolling in a playlist or just after deleting a video in it Jan 3, 2026
@whistlingwoods whistlingwoods force-pushed the reapply-local-list-header-fix-by-j-haldane branch from 80fd46a to cea5dd4 Compare January 15, 2026 13:54
@AudricV AudricV added ready for review Most of the work is done, PR is now ready for a review bug Issue is related to a bug GUI Issue is related to the graphical user interface labels Jan 24, 2026
@github-project-automation github-project-automation bot moved this to Todo in v0.28.x Jan 26, 2026
@ShareASmile ShareASmile moved this from Todo to In Progress in v0.28.x Jan 26, 2026
Copy link
Member

@Stypox Stypox left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! I was wondering whether this should be done also for footer, but it turns out that, while the footer View is always set, showFooter is always equal to false in local lists. So I am pushing a commit to add some @Deprecated and calling it a day, since I want to avoid touching code that works.

Here is the path for footer supplier
commit b759c91a147a662d30e938ed39834120cc12e75b
Merge: cea5dd474 f9ef7938b
Author: Stypox <stypox@pm.me>
Date:   Tue Jan 27 21:24:06 2026 +0100

    On pr12996: Use footerSupplier instead of footer (but useless since footer always invisible anyway)

diff --cc app/src/main/java/org/schabi/newpipe/local/BaseLocalListFragment.java
index 00a721bcf,00a721bcf..af22c814b
--- a/app/src/main/java/org/schabi/newpipe/local/BaseLocalListFragment.java
+++ b/app/src/main/java/org/schabi/newpipe/local/BaseLocalListFragment.java
@@@ -138,7 -138,7 +138,7 @@@ public abstract class BaseLocalListFrag
              itemListAdapter.setHeaderSupplier(listHeaderSupplier);
          }
          footerRootBinding = getListFooter();
--        itemListAdapter.setFooter(footerRootBinding.getRoot());
++        itemListAdapter.setFooterSupplier(footerRootBinding::getRoot);
  
          itemsList.setAdapter(itemListAdapter);
      }
diff --cc app/src/main/java/org/schabi/newpipe/local/LocalItemListAdapter.java
index 3bb84e2de,3bb84e2de..7e4c78256
--- a/app/src/main/java/org/schabi/newpipe/local/LocalItemListAdapter.java
+++ b/app/src/main/java/org/schabi/newpipe/local/LocalItemListAdapter.java
@@@ -90,7 -90,7 +90,7 @@@ public class LocalItemListAdapter exten
  
      private boolean showFooter = false;
      private Supplier<View> headerSupplier = null;
--    private View footer = null;
++    private Supplier<View> footerSupplier = null;
      private ItemViewMode itemViewMode = ItemViewMode.LIST;
      private boolean useItemHandle = false;
  
@@@ -126,12 -126,12 +126,12 @@@
          if (DEBUG) {
              Log.d(TAG, "addItems() after > offsetStart = " + offsetStart + ", "
                      + "localItems.size() = " + localItems.size() + ", "
--                    + "header = " + hasHeader() + ", footer = " + footer + ", "
++                    + "header = " + hasHeader() + ", footer = " + hasFooter() + ", "
                      + "showFooter = " + showFooter);
          }
          notifyItemRangeInserted(offsetStart, data.size());
  
--        if (footer != null && showFooter) {
++        if (hasFooter() && showFooter) {
              final int footerNow = sizeConsideringHeader();
              notifyItemMoved(offsetStart, footerNow);
  
@@@ -199,14 -199,14 +199,18 @@@
          }
      }
  
--    public void setFooter(final View view) {
--        this.footer = view;
++    public void setFooterSupplier(@Nullable final Supplier<View> footerSupplier) {
++        this.footerSupplier = footerSupplier;
      }
  
      protected boolean hasHeader() {
          return this.headerSupplier != null;
      }
  
++    protected boolean hasFooter() {
++        return this.footerSupplier != null;
++    }
++
      public void showFooter(final boolean show) {
          if (DEBUG) {
              Log.d(TAG, "showFooter() called with: show = [" + show + "]");
@@@ -241,14 -241,14 +245,14 @@@
          if (hasHeader()) {
              count++;
          }
--        if (footer != null && showFooter) {
++        if (hasFooter() && showFooter) {
              count++;
          }
  
          if (DEBUG) {
              Log.d(TAG, "getItemCount() called, count = " + count + ", "
                      + "localItems.size() = " + localItems.size() + ", "
--                    + "header = " + hasHeader() + ", footer = " + footer + ", "
++                    + "header = " + hasHeader() + ", footer = " + hasFooter() + ", "
                      + "showFooter = " + showFooter);
          }
          return count;
@@@ -266,7 -266,7 +270,7 @@@
          } else if (hasHeader()) {
              position--;
          }
--        if (footer != null && position == localItems.size() && showFooter) {
++        if (hasFooter() && position == localItems.size() && showFooter) {
              return FOOTER_TYPE;
          }
          final LocalItem item = localItems.get(position);
@@@ -326,7 -326,7 +330,7 @@@
              case HEADER_TYPE:
                  return new HeaderFooterHolder(headerSupplier.get());
              case FOOTER_TYPE:
--                return new HeaderFooterHolder(footer);
++                return new HeaderFooterHolder(footerSupplier.get());
              case LOCAL_PLAYLIST_HOLDER_TYPE:
                  return new LocalPlaylistItemHolder(localItemBuilder, parent);
              case LOCAL_PLAYLIST_GRID_HOLDER_TYPE:
@@@ -381,8 -381,8 +385,8 @@@
          } else if (holder instanceof HeaderFooterHolder && position == 0 && hasHeader()) {
              ((HeaderFooterHolder) holder).view = headerSupplier.get();
          } else if (holder instanceof HeaderFooterHolder && position == sizeConsideringHeader()
--                && footer != null && showFooter) {
--            ((HeaderFooterHolder) holder).view = footer;
++                && hasFooter() && showFooter) {
++            ((HeaderFooterHolder) holder).view = footerSupplier.get();
          }
      }

@Stypox Stypox merged commit d0f32b3 into TeamNewPipe:dev Jan 27, 2026
5 checks passed
@github-project-automation github-project-automation bot moved this from In Progress to Done in v0.28.x Jan 27, 2026
@whistlingwoods whistlingwoods deleted the reapply-local-list-header-fix-by-j-haldane branch January 27, 2026 20:53
@ShareASmile ShareASmile removed the ready for review Most of the work is done, PR is now ready for a review label Jan 29, 2026
@ShareASmile ShareASmile restored the reapply-local-list-header-fix-by-j-haldane branch March 3, 2026 19:43
@whistlingwoods whistlingwoods deleted the reapply-local-list-header-fix-by-j-haldane branch March 15, 2026 17:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Issue is related to a bug GUI Issue is related to the graphical user interface size/medium PRs with less than 250 changed lines

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Crash in lists (ViewHolder views not attached)

4 participants