mirror of
				https://github.com/TeamNewPipe/NewPipe
				synced 2025-10-31 15:23:00 +00:00 
			
		
		
		
	Return ViewBinding instead of View in BaseLocalListFragment's getListHeader() and getListFooter() methods.
This commit is contained in:
		| @@ -4,6 +4,8 @@ import android.content.SharedPreferences; | |||||||
| import android.content.res.Configuration; | import android.content.res.Configuration; | ||||||
| import android.content.res.Resources; | import android.content.res.Resources; | ||||||
| import android.os.Bundle; | import android.os.Bundle; | ||||||
|  |  | ||||||
|  | import androidx.annotation.Nullable; | ||||||
| import androidx.preference.PreferenceManager; | import androidx.preference.PreferenceManager; | ||||||
| import android.util.Log; | import android.util.Log; | ||||||
| import android.view.Menu; | import android.view.Menu; | ||||||
| @@ -15,8 +17,10 @@ import androidx.fragment.app.Fragment; | |||||||
| import androidx.recyclerview.widget.GridLayoutManager; | import androidx.recyclerview.widget.GridLayoutManager; | ||||||
| import androidx.recyclerview.widget.LinearLayoutManager; | import androidx.recyclerview.widget.LinearLayoutManager; | ||||||
| import androidx.recyclerview.widget.RecyclerView; | import androidx.recyclerview.widget.RecyclerView; | ||||||
|  | import androidx.viewbinding.ViewBinding; | ||||||
|  |  | ||||||
| import org.schabi.newpipe.R; | import org.schabi.newpipe.R; | ||||||
|  | import org.schabi.newpipe.databinding.PignateFooterBinding; | ||||||
| import org.schabi.newpipe.fragments.BaseStateFragment; | import org.schabi.newpipe.fragments.BaseStateFragment; | ||||||
| import org.schabi.newpipe.fragments.list.ListViewContract; | import org.schabi.newpipe.fragments.list.ListViewContract; | ||||||
|  |  | ||||||
| @@ -42,8 +46,8 @@ public abstract class BaseLocalListFragment<I, N> extends BaseStateFragment<I> | |||||||
|     //////////////////////////////////////////////////////////////////////////*/ |     //////////////////////////////////////////////////////////////////////////*/ | ||||||
|  |  | ||||||
|     private static final int LIST_MODE_UPDATE_FLAG = 0x32; |     private static final int LIST_MODE_UPDATE_FLAG = 0x32; | ||||||
|     private View headerRootView; |     private ViewBinding headerRootBinding; | ||||||
|     private View footerRootView; |     private ViewBinding footerRootBinding; | ||||||
|     protected LocalItemListAdapter itemListAdapter; |     protected LocalItemListAdapter itemListAdapter; | ||||||
|     protected RecyclerView itemsList; |     protected RecyclerView itemsList; | ||||||
|     private int updateFlags = 0; |     private int updateFlags = 0; | ||||||
| @@ -86,12 +90,13 @@ public abstract class BaseLocalListFragment<I, N> extends BaseStateFragment<I> | |||||||
|     // Lifecycle - View |     // Lifecycle - View | ||||||
|     //////////////////////////////////////////////////////////////////////////*/ |     //////////////////////////////////////////////////////////////////////////*/ | ||||||
|  |  | ||||||
|     protected View getListHeader() { |     @Nullable | ||||||
|  |     protected ViewBinding getListHeader() { | ||||||
|         return null; |         return null; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     protected View getListFooter() { |     protected ViewBinding getListFooter() { | ||||||
|         return activity.getLayoutInflater().inflate(R.layout.pignate_footer, itemsList, false); |         return PignateFooterBinding.inflate(activity.getLayoutInflater(), itemsList, false); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     protected RecyclerView.LayoutManager getGridLayoutManager() { |     protected RecyclerView.LayoutManager getGridLayoutManager() { | ||||||
| @@ -120,10 +125,12 @@ public abstract class BaseLocalListFragment<I, N> extends BaseStateFragment<I> | |||||||
|         itemsList.setLayoutManager(useGrid ? getGridLayoutManager() : getListLayoutManager()); |         itemsList.setLayoutManager(useGrid ? getGridLayoutManager() : getListLayoutManager()); | ||||||
|  |  | ||||||
|         itemListAdapter.setUseGridVariant(useGrid); |         itemListAdapter.setUseGridVariant(useGrid); | ||||||
|         headerRootView = getListHeader(); |         headerRootBinding = getListHeader(); | ||||||
|         itemListAdapter.setHeader(headerRootView); |         if (headerRootBinding != null) { | ||||||
|         footerRootView = getListFooter(); |             itemListAdapter.setHeader(headerRootBinding.getRoot()); | ||||||
|         itemListAdapter.setFooter(footerRootView); |         } | ||||||
|  |         footerRootBinding = getListFooter(); | ||||||
|  |         itemListAdapter.setFooter(footerRootBinding.getRoot()); | ||||||
|  |  | ||||||
|         itemsList.setAdapter(itemListAdapter); |         itemsList.setAdapter(itemListAdapter); | ||||||
|     } |     } | ||||||
| @@ -180,8 +187,8 @@ public abstract class BaseLocalListFragment<I, N> extends BaseStateFragment<I> | |||||||
|         if (itemsList != null) { |         if (itemsList != null) { | ||||||
|             animateView(itemsList, false, 200); |             animateView(itemsList, false, 200); | ||||||
|         } |         } | ||||||
|         if (headerRootView != null) { |         if (headerRootBinding != null) { | ||||||
|             animateView(headerRootView, false, 200); |             animateView(headerRootBinding.getRoot(), false, 200); | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|  |  | ||||||
| @@ -191,8 +198,8 @@ public abstract class BaseLocalListFragment<I, N> extends BaseStateFragment<I> | |||||||
|         if (itemsList != null) { |         if (itemsList != null) { | ||||||
|             animateView(itemsList, true, 200); |             animateView(itemsList, true, 200); | ||||||
|         } |         } | ||||||
|         if (headerRootView != null) { |         if (headerRootBinding != null) { | ||||||
|             animateView(headerRootView, true, 200); |             animateView(headerRootBinding.getRoot(), true, 200); | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|  |  | ||||||
| @@ -204,8 +211,8 @@ public abstract class BaseLocalListFragment<I, N> extends BaseStateFragment<I> | |||||||
|         if (itemsList != null) { |         if (itemsList != null) { | ||||||
|             animateView(itemsList, false, 200); |             animateView(itemsList, false, 200); | ||||||
|         } |         } | ||||||
|         if (headerRootView != null) { |         if (headerRootBinding != null) { | ||||||
|             animateView(headerRootView, false, 200); |             animateView(headerRootBinding.getRoot(), false, 200); | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -10,13 +10,12 @@ import android.view.MenuInflater; | |||||||
| import android.view.MenuItem; | import android.view.MenuItem; | ||||||
| import android.view.View; | import android.view.View; | ||||||
| import android.view.ViewGroup; | import android.view.ViewGroup; | ||||||
| import android.widget.ImageView; |  | ||||||
| import android.widget.TextView; |  | ||||||
| import android.widget.Toast; | import android.widget.Toast; | ||||||
|  |  | ||||||
| import androidx.annotation.NonNull; | import androidx.annotation.NonNull; | ||||||
| import androidx.annotation.Nullable; | import androidx.annotation.Nullable; | ||||||
| import androidx.appcompat.app.AlertDialog; | import androidx.appcompat.app.AlertDialog; | ||||||
|  | import androidx.viewbinding.ViewBinding; | ||||||
|  |  | ||||||
| import com.google.android.material.snackbar.Snackbar; | import com.google.android.material.snackbar.Snackbar; | ||||||
|  |  | ||||||
| @@ -26,6 +25,8 @@ import org.schabi.newpipe.R; | |||||||
| import org.schabi.newpipe.database.LocalItem; | import org.schabi.newpipe.database.LocalItem; | ||||||
| import org.schabi.newpipe.database.stream.StreamStatisticsEntry; | import org.schabi.newpipe.database.stream.StreamStatisticsEntry; | ||||||
| import org.schabi.newpipe.database.stream.model.StreamEntity; | import org.schabi.newpipe.database.stream.model.StreamEntity; | ||||||
|  | import org.schabi.newpipe.databinding.PlaylistControlBinding; | ||||||
|  | import org.schabi.newpipe.databinding.StatisticPlaylistControlBinding; | ||||||
| import org.schabi.newpipe.extractor.stream.StreamInfoItem; | import org.schabi.newpipe.extractor.stream.StreamInfoItem; | ||||||
| import org.schabi.newpipe.extractor.stream.StreamType; | import org.schabi.newpipe.extractor.stream.StreamType; | ||||||
| import org.schabi.newpipe.info_list.InfoItemDialog; | import org.schabi.newpipe.info_list.InfoItemDialog; | ||||||
| @@ -60,13 +61,10 @@ public class StatisticsPlaylistFragment | |||||||
|     @State |     @State | ||||||
|     Parcelable itemsListState; |     Parcelable itemsListState; | ||||||
|     private StatisticSortMode sortMode = StatisticSortMode.LAST_PLAYED; |     private StatisticSortMode sortMode = StatisticSortMode.LAST_PLAYED; | ||||||
|     private View headerPlayAllButton; |  | ||||||
|     private View headerPopupButton; |     private StatisticPlaylistControlBinding headerBinding; | ||||||
|     private View headerBackgroundButton; |     private PlaylistControlBinding playlistControlBinding; | ||||||
|     private View playlistCtrl; |  | ||||||
|     private View sortButton; |  | ||||||
|     private ImageView sortButtonIcon; |  | ||||||
|     private TextView sortButtonText; |  | ||||||
|     /* Used for independent events */ |     /* Used for independent events */ | ||||||
|     private Subscription databaseSubscription; |     private Subscription databaseSubscription; | ||||||
|     private HistoryRecordManager recordManager; |     private HistoryRecordManager recordManager; | ||||||
| @@ -131,17 +129,12 @@ public class StatisticsPlaylistFragment | |||||||
|     } |     } | ||||||
|  |  | ||||||
|     @Override |     @Override | ||||||
|     protected View getListHeader() { |     protected ViewBinding getListHeader() { | ||||||
|         final View headerRootLayout = activity.getLayoutInflater() |         headerBinding = StatisticPlaylistControlBinding.inflate(activity.getLayoutInflater(), | ||||||
|                 .inflate(R.layout.statistic_playlist_control, itemsList, false); |                 itemsList, false); | ||||||
|         playlistCtrl = headerRootLayout.findViewById(R.id.playlist_control); |         playlistControlBinding = headerBinding.playlistControl; | ||||||
|         headerPlayAllButton = headerRootLayout.findViewById(R.id.playlist_ctrl_play_all_button); |  | ||||||
|         headerPopupButton = headerRootLayout.findViewById(R.id.playlist_ctrl_play_popup_button); |         return headerBinding; | ||||||
|         headerBackgroundButton = headerRootLayout.findViewById(R.id.playlist_ctrl_play_bg_button); |  | ||||||
|         sortButton = headerRootLayout.findViewById(R.id.sortButton); |  | ||||||
|         sortButtonIcon = headerRootLayout.findViewById(R.id.sortButtonIcon); |  | ||||||
|         sortButtonText = headerRootLayout.findViewById(R.id.sortButtonText); |  | ||||||
|         return headerRootLayout; |  | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     @Override |     @Override | ||||||
| @@ -245,14 +238,13 @@ public class StatisticsPlaylistFragment | |||||||
|         if (itemListAdapter != null) { |         if (itemListAdapter != null) { | ||||||
|             itemListAdapter.unsetSelectedListener(); |             itemListAdapter.unsetSelectedListener(); | ||||||
|         } |         } | ||||||
|         if (headerBackgroundButton != null) { |         if (playlistControlBinding != null) { | ||||||
|             headerBackgroundButton.setOnClickListener(null); |             playlistControlBinding.playlistCtrlPlayBgButton.setOnClickListener(null); | ||||||
|         } |             playlistControlBinding.playlistCtrlPlayAllButton.setOnClickListener(null); | ||||||
|         if (headerPlayAllButton != null) { |             playlistControlBinding.playlistCtrlPlayPopupButton.setOnClickListener(null); | ||||||
|             headerPlayAllButton.setOnClickListener(null); |  | ||||||
|         } |             headerBinding = null; | ||||||
|         if (headerPopupButton != null) { |             playlistControlBinding = null; | ||||||
|             headerPopupButton.setOnClickListener(null); |  | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         if (databaseSubscription != null) { |         if (databaseSubscription != null) { | ||||||
| @@ -311,7 +303,7 @@ public class StatisticsPlaylistFragment | |||||||
|             return; |             return; | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         playlistCtrl.setVisibility(View.VISIBLE); |         playlistControlBinding.getRoot().setVisibility(View.VISIBLE); | ||||||
|  |  | ||||||
|         itemListAdapter.clearStreamItemList(); |         itemListAdapter.clearStreamItemList(); | ||||||
|  |  | ||||||
| @@ -326,13 +318,13 @@ public class StatisticsPlaylistFragment | |||||||
|             itemsListState = null; |             itemsListState = null; | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         headerPlayAllButton.setOnClickListener(view -> |         playlistControlBinding.playlistCtrlPlayAllButton.setOnClickListener(view -> | ||||||
|                 NavigationHelper.playOnMainPlayer(activity, getPlayQueue())); |                 NavigationHelper.playOnMainPlayer(activity, getPlayQueue())); | ||||||
|         headerPopupButton.setOnClickListener(view -> |         playlistControlBinding.playlistCtrlPlayPopupButton.setOnClickListener(view -> | ||||||
|                 NavigationHelper.playOnPopupPlayer(activity, getPlayQueue(), false)); |                 NavigationHelper.playOnPopupPlayer(activity, getPlayQueue(), false)); | ||||||
|         headerBackgroundButton.setOnClickListener(view -> |         playlistControlBinding.playlistCtrlPlayBgButton.setOnClickListener(view -> | ||||||
|                 NavigationHelper.playOnBackgroundPlayer(activity, getPlayQueue(), false)); |                 NavigationHelper.playOnBackgroundPlayer(activity, getPlayQueue(), false)); | ||||||
|         sortButton.setOnClickListener(view -> toggleSortMode()); |         headerBinding.sortButton.setOnClickListener(view -> toggleSortMode()); | ||||||
|  |  | ||||||
|         hideLoading(); |         hideLoading(); | ||||||
|     } |     } | ||||||
| @@ -368,15 +360,15 @@ public class StatisticsPlaylistFragment | |||||||
|         if (sortMode == StatisticSortMode.LAST_PLAYED) { |         if (sortMode == StatisticSortMode.LAST_PLAYED) { | ||||||
|             sortMode = StatisticSortMode.MOST_PLAYED; |             sortMode = StatisticSortMode.MOST_PLAYED; | ||||||
|             setTitle(getString(R.string.title_most_played)); |             setTitle(getString(R.string.title_most_played)); | ||||||
|             sortButtonIcon.setImageResource( |             headerBinding.sortButtonIcon.setImageResource( | ||||||
|                 ThemeHelper.resolveResourceIdFromAttr(requireContext(), R.attr.ic_history)); |                 ThemeHelper.resolveResourceIdFromAttr(requireContext(), R.attr.ic_history)); | ||||||
|             sortButtonText.setText(R.string.title_last_played); |             headerBinding.sortButtonText.setText(R.string.title_last_played); | ||||||
|         } else { |         } else { | ||||||
|             sortMode = StatisticSortMode.LAST_PLAYED; |             sortMode = StatisticSortMode.LAST_PLAYED; | ||||||
|             setTitle(getString(R.string.title_last_played)); |             setTitle(getString(R.string.title_last_played)); | ||||||
|             sortButtonIcon.setImageResource( |             headerBinding.sortButtonIcon.setImageResource( | ||||||
|                 ThemeHelper.resolveResourceIdFromAttr(requireContext(), R.attr.ic_filter_list)); |                 ThemeHelper.resolveResourceIdFromAttr(requireContext(), R.attr.ic_filter_list)); | ||||||
|             sortButtonText.setText(R.string.title_most_played); |             headerBinding.sortButtonText.setText(R.string.title_most_played); | ||||||
|         } |         } | ||||||
|         startLoading(true); |         startLoading(true); | ||||||
|     } |     } | ||||||
|   | |||||||
| @@ -14,7 +14,6 @@ import android.view.MenuItem; | |||||||
| import android.view.View; | import android.view.View; | ||||||
| import android.view.ViewGroup; | import android.view.ViewGroup; | ||||||
| import android.widget.EditText; | import android.widget.EditText; | ||||||
| import android.widget.TextView; |  | ||||||
| import android.widget.Toast; | import android.widget.Toast; | ||||||
|  |  | ||||||
| import androidx.annotation.NonNull; | import androidx.annotation.NonNull; | ||||||
| @@ -22,6 +21,7 @@ import androidx.annotation.Nullable; | |||||||
| import androidx.appcompat.app.AlertDialog; | import androidx.appcompat.app.AlertDialog; | ||||||
| import androidx.recyclerview.widget.ItemTouchHelper; | import androidx.recyclerview.widget.ItemTouchHelper; | ||||||
| import androidx.recyclerview.widget.RecyclerView; | import androidx.recyclerview.widget.RecyclerView; | ||||||
|  | import androidx.viewbinding.ViewBinding; | ||||||
|  |  | ||||||
| import org.reactivestreams.Subscriber; | import org.reactivestreams.Subscriber; | ||||||
| import org.reactivestreams.Subscription; | import org.reactivestreams.Subscription; | ||||||
| @@ -32,6 +32,8 @@ import org.schabi.newpipe.database.history.model.StreamHistoryEntry; | |||||||
| import org.schabi.newpipe.database.playlist.PlaylistStreamEntry; | import org.schabi.newpipe.database.playlist.PlaylistStreamEntry; | ||||||
| import org.schabi.newpipe.database.stream.model.StreamEntity; | import org.schabi.newpipe.database.stream.model.StreamEntity; | ||||||
| import org.schabi.newpipe.database.stream.model.StreamStateEntity; | import org.schabi.newpipe.database.stream.model.StreamStateEntity; | ||||||
|  | import org.schabi.newpipe.databinding.LocalPlaylistHeaderBinding; | ||||||
|  | import org.schabi.newpipe.databinding.PlaylistControlBinding; | ||||||
| import org.schabi.newpipe.extractor.stream.StreamInfoItem; | import org.schabi.newpipe.extractor.stream.StreamInfoItem; | ||||||
| import org.schabi.newpipe.extractor.stream.StreamType; | import org.schabi.newpipe.extractor.stream.StreamType; | ||||||
| import org.schabi.newpipe.info_list.InfoItemDialog; | import org.schabi.newpipe.info_list.InfoItemDialog; | ||||||
| @@ -77,13 +79,8 @@ public class LocalPlaylistFragment extends BaseLocalListFragment<List<PlaylistSt | |||||||
|     @State |     @State | ||||||
|     Parcelable itemsListState; |     Parcelable itemsListState; | ||||||
|  |  | ||||||
|     private View headerRootLayout; |     private LocalPlaylistHeaderBinding headerBinding; | ||||||
|     private TextView headerTitleView; |     private PlaylistControlBinding playlistControlBinding; | ||||||
|     private TextView headerStreamCount; |  | ||||||
|     private View playlistControl; |  | ||||||
|     private View headerPlayAllButton; |  | ||||||
|     private View headerPopupButton; |  | ||||||
|     private View headerBackgroundButton; |  | ||||||
|  |  | ||||||
|     private ItemTouchHelper itemTouchHelper; |     private ItemTouchHelper itemTouchHelper; | ||||||
|  |  | ||||||
| @@ -137,8 +134,8 @@ public class LocalPlaylistFragment extends BaseLocalListFragment<List<PlaylistSt | |||||||
|     public void setTitle(final String title) { |     public void setTitle(final String title) { | ||||||
|         super.setTitle(title); |         super.setTitle(title); | ||||||
|  |  | ||||||
|         if (headerTitleView != null) { |         if (headerBinding != null) { | ||||||
|             headerTitleView.setText(title); |             headerBinding.playlistTitleView.setText(title); | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|  |  | ||||||
| @@ -149,28 +146,21 @@ public class LocalPlaylistFragment extends BaseLocalListFragment<List<PlaylistSt | |||||||
|     } |     } | ||||||
|  |  | ||||||
|     @Override |     @Override | ||||||
|     protected View getListHeader() { |     protected ViewBinding getListHeader() { | ||||||
|         headerRootLayout = activity.getLayoutInflater() |         headerBinding = LocalPlaylistHeaderBinding.inflate(activity.getLayoutInflater(), itemsList, | ||||||
|                 .inflate(R.layout.local_playlist_header, itemsList, false); |                 false); | ||||||
|  |         playlistControlBinding = headerBinding.playlistControl; | ||||||
|  |  | ||||||
|         headerTitleView = headerRootLayout.findViewById(R.id.playlist_title_view); |         headerBinding.playlistTitleView.setSelected(true); | ||||||
|         headerTitleView.setSelected(true); |  | ||||||
|  |  | ||||||
|         headerStreamCount = headerRootLayout.findViewById(R.id.playlist_stream_count); |         return headerBinding; | ||||||
|  |  | ||||||
|         playlistControl = headerRootLayout.findViewById(R.id.playlist_control); |  | ||||||
|         headerPlayAllButton = headerRootLayout.findViewById(R.id.playlist_ctrl_play_all_button); |  | ||||||
|         headerPopupButton = headerRootLayout.findViewById(R.id.playlist_ctrl_play_popup_button); |  | ||||||
|         headerBackgroundButton = headerRootLayout.findViewById(R.id.playlist_ctrl_play_bg_button); |  | ||||||
|  |  | ||||||
|         return headerRootLayout; |  | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     @Override |     @Override | ||||||
|     protected void initListeners() { |     protected void initListeners() { | ||||||
|         super.initListeners(); |         super.initListeners(); | ||||||
|  |  | ||||||
|         headerTitleView.setOnClickListener(view -> createRenameDialog()); |         headerBinding.playlistTitleView.setOnClickListener(view -> createRenameDialog()); | ||||||
|  |  | ||||||
|         itemTouchHelper = new ItemTouchHelper(getItemTouchCallback()); |         itemTouchHelper = new ItemTouchHelper(getItemTouchCallback()); | ||||||
|         itemTouchHelper.attachToRecyclerView(itemsList); |         itemTouchHelper.attachToRecyclerView(itemsList); | ||||||
| @@ -210,22 +200,18 @@ public class LocalPlaylistFragment extends BaseLocalListFragment<List<PlaylistSt | |||||||
|     @Override |     @Override | ||||||
|     public void showLoading() { |     public void showLoading() { | ||||||
|         super.showLoading(); |         super.showLoading(); | ||||||
|         if (headerRootLayout != null) { |         if (headerBinding != null) { | ||||||
|             animateView(headerRootLayout, false, 200); |             animateView(headerBinding.getRoot(), false, 200); | ||||||
|         } |             animateView(playlistControlBinding.getRoot(), false, 200); | ||||||
|         if (playlistControl != null) { |  | ||||||
|             animateView(playlistControl, false, 200); |  | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     @Override |     @Override | ||||||
|     public void hideLoading() { |     public void hideLoading() { | ||||||
|         super.hideLoading(); |         super.hideLoading(); | ||||||
|         if (headerRootLayout != null) { |         if (headerBinding != null) { | ||||||
|             animateView(headerRootLayout, true, 200); |             animateView(headerBinding.getRoot(), true, 200); | ||||||
|         } |             animateView(playlistControlBinding.getRoot(), true, 200); | ||||||
|         if (playlistControl != null) { |  | ||||||
|             animateView(playlistControl, true, 200); |  | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|  |  | ||||||
| @@ -277,14 +263,13 @@ public class LocalPlaylistFragment extends BaseLocalListFragment<List<PlaylistSt | |||||||
|         if (itemListAdapter != null) { |         if (itemListAdapter != null) { | ||||||
|             itemListAdapter.unsetSelectedListener(); |             itemListAdapter.unsetSelectedListener(); | ||||||
|         } |         } | ||||||
|         if (headerBackgroundButton != null) { |         if (playlistControlBinding != null) { | ||||||
|             headerBackgroundButton.setOnClickListener(null); |             playlistControlBinding.playlistCtrlPlayBgButton.setOnClickListener(null); | ||||||
|         } |             playlistControlBinding.playlistCtrlPlayAllButton.setOnClickListener(null); | ||||||
|         if (headerPlayAllButton != null) { |             playlistControlBinding.playlistCtrlPlayPopupButton.setOnClickListener(null); | ||||||
|             headerPlayAllButton.setOnClickListener(null); |  | ||||||
|         } |             headerBinding = null; | ||||||
|         if (headerPopupButton != null) { |             playlistControlBinding = null; | ||||||
|             headerPopupButton.setOnClickListener(null); |  | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         if (databaseSubscription != null) { |         if (databaseSubscription != null) { | ||||||
| @@ -494,19 +479,19 @@ public class LocalPlaylistFragment extends BaseLocalListFragment<List<PlaylistSt | |||||||
|         } |         } | ||||||
|         setVideoCount(itemListAdapter.getItemsList().size()); |         setVideoCount(itemListAdapter.getItemsList().size()); | ||||||
|  |  | ||||||
|         headerPlayAllButton.setOnClickListener(view -> |         playlistControlBinding.playlistCtrlPlayAllButton.setOnClickListener(view -> | ||||||
|                 NavigationHelper.playOnMainPlayer(activity, getPlayQueue())); |                 NavigationHelper.playOnMainPlayer(activity, getPlayQueue())); | ||||||
|         headerPopupButton.setOnClickListener(view -> |         playlistControlBinding.playlistCtrlPlayPopupButton.setOnClickListener(view -> | ||||||
|                 NavigationHelper.playOnPopupPlayer(activity, getPlayQueue(), false)); |                 NavigationHelper.playOnPopupPlayer(activity, getPlayQueue(), false)); | ||||||
|         headerBackgroundButton.setOnClickListener(view -> |         playlistControlBinding.playlistCtrlPlayBgButton.setOnClickListener(view -> | ||||||
|                 NavigationHelper.playOnBackgroundPlayer(activity, getPlayQueue(), false)); |                 NavigationHelper.playOnBackgroundPlayer(activity, getPlayQueue(), false)); | ||||||
|  |  | ||||||
|         headerPopupButton.setOnLongClickListener(view -> { |         playlistControlBinding.playlistCtrlPlayPopupButton.setOnLongClickListener(view -> { | ||||||
|             NavigationHelper.enqueueOnPopupPlayer(activity, getPlayQueue(), true); |             NavigationHelper.enqueueOnPopupPlayer(activity, getPlayQueue(), true); | ||||||
|             return true; |             return true; | ||||||
|         }); |         }); | ||||||
|  |  | ||||||
|         headerBackgroundButton.setOnLongClickListener(view -> { |         playlistControlBinding.playlistCtrlPlayBgButton.setOnLongClickListener(view -> { | ||||||
|             NavigationHelper.enqueueOnBackgroundPlayer(activity, getPlayQueue(), true); |             NavigationHelper.enqueueOnBackgroundPlayer(activity, getPlayQueue(), true); | ||||||
|             return true; |             return true; | ||||||
|         }); |         }); | ||||||
| @@ -806,8 +791,9 @@ public class LocalPlaylistFragment extends BaseLocalListFragment<List<PlaylistSt | |||||||
|     } |     } | ||||||
|  |  | ||||||
|     private void setVideoCount(final long count) { |     private void setVideoCount(final long count) { | ||||||
|         if (activity != null && headerStreamCount != null) { |         if (activity != null && headerBinding != null) { | ||||||
|             headerStreamCount.setText(Localization.localizeStreamCount(activity, count)); |             headerBinding.playlistStreamCount.setText(Localization | ||||||
|  |                     .localizeStreamCount(activity, count)); | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -40,7 +40,10 @@ | |||||||
|         android:layout_height="wrap_content" |         android:layout_height="wrap_content" | ||||||
|         android:layout_below="@id/playlist_stream_count"> |         android:layout_below="@id/playlist_stream_count"> | ||||||
|  |  | ||||||
|         <include layout="@layout/playlist_control" /> |         <include | ||||||
|  |             android:id="@+id/playlist_control" | ||||||
|  |             layout="@layout/playlist_control" /> | ||||||
|  |  | ||||||
|     </LinearLayout> |     </LinearLayout> | ||||||
|  |  | ||||||
| </RelativeLayout> | </RelativeLayout> | ||||||
|   | |||||||
| @@ -38,6 +38,8 @@ | |||||||
|             tools:ignore="RtlHardcoded" /> |             tools:ignore="RtlHardcoded" /> | ||||||
|     </RelativeLayout> |     </RelativeLayout> | ||||||
|  |  | ||||||
|     <include layout="@layout/playlist_control" /> |     <include | ||||||
|  |         android:id="@+id/playlist_control" | ||||||
|  |         layout="@layout/playlist_control" /> | ||||||
|  |  | ||||||
| </LinearLayout> | </LinearLayout> | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Isira Seneviratne
					Isira Seneviratne