diff --git a/common/src/main/java/com/liskovsoft/smartyoutubetv2/common/app/presenters/BrowsePresenter.java b/common/src/main/java/com/liskovsoft/smartyoutubetv2/common/app/presenters/BrowsePresenter.java index 4da8638a44..bb2afdb3e4 100644 --- a/common/src/main/java/com/liskovsoft/smartyoutubetv2/common/app/presenters/BrowsePresenter.java +++ b/common/src/main/java/com/liskovsoft/smartyoutubetv2/common/app/presenters/BrowsePresenter.java @@ -1080,10 +1080,10 @@ private void handleLoadError() { getView().showError(new CategoryEmptyError(getContext())); Utils.postDelayed(mRefreshSection, 30_000); } - if (isHomeSection()) { // maybe the history turned off? - MediaServiceManager.instance().enableHistory(true); - mGeneralData.enableHistory(true); - } + //if (isHomeSection()) { // maybe the history turned off? + // MediaServiceManager.instance().enableHistory(true); + // mGeneralData.enableHistory(true); + //} } private void appendLocalHistory(@NonNull VideoGroup videoGroup) { diff --git a/common/src/main/java/com/liskovsoft/smartyoutubetv2/common/app/presenters/browse/BaseBrowsePresenter.java b/common/src/main/java/com/liskovsoft/smartyoutubetv2/common/app/presenters/browse/BaseBrowsePresenter.java deleted file mode 100644 index 489a7291ed..0000000000 --- a/common/src/main/java/com/liskovsoft/smartyoutubetv2/common/app/presenters/browse/BaseBrowsePresenter.java +++ /dev/null @@ -1,90 +0,0 @@ -package com.liskovsoft.smartyoutubetv2.common.app.presenters.browse; - -import android.content.Context; - -import com.liskovsoft.mediaserviceinterfaces.yt.data.Account; -import com.liskovsoft.smartyoutubetv2.common.app.models.data.BrowseSection; -import com.liskovsoft.smartyoutubetv2.common.app.models.data.Video; -import com.liskovsoft.smartyoutubetv2.common.app.models.errors.ErrorFragmentData; -import com.liskovsoft.smartyoutubetv2.common.app.presenters.browse.BrowsePresenter; -import com.liskovsoft.smartyoutubetv2.common.app.presenters.interfaces.SectionPresenter; -import com.liskovsoft.smartyoutubetv2.common.app.presenters.interfaces.VideoGroupPresenter; -import com.liskovsoft.smartyoutubetv2.common.app.views.BrowseView; -import com.liskovsoft.smartyoutubetv2.common.misc.MediaServiceManager.AccountChangeListener; - -public abstract class BaseBrowsePresenter implements SectionPresenter, VideoGroupPresenter, AccountChangeListener { - private final BrowsePresenter mBrowsePresenter; - - public BaseBrowsePresenter(BrowsePresenter root) { - mBrowsePresenter = root; - } - - public void updateSections() {} - public void updateChannelSorting() {} - public void updatePlaylistsStyle() {} - public boolean isItemPinned(Video item) { return false; } - public void moveSectionUp(BrowseSection section) {} - public void moveSectionDown(BrowseSection section) {} - public void renameSection(BrowseSection section) {} - public void enableAllSections(boolean enable) {} - public void enableSection(int sectionId, boolean enable) {} - public void pinItem(Video item) {} - public void pinItem(String title, int resId, ErrorFragmentData data) {} - public void unpinItem(Video item) {} - public void refresh() {} - public void refresh(boolean focusOnContent) {} - public boolean isMultiGridChannelUploadsSection() { return false; } - public boolean isSettingsSection() { return false; } - public boolean isPlaylistsSection() { return false; } - public boolean isHomeSection() { return false; } - public boolean isHistorySection() { return false; } - public boolean isSubscriptionsSection() { return false; } - public boolean isPinnedSection() { return false; } - public void selectSection(int sectionId) {} - public boolean inForeground() { return false; } - - public void onSectionFocused(int sectionId) {} - public void onSectionLongPressed(int sectionId) {} - - public void onVideoItemSelected(Video item) {} - public void onVideoItemClicked(Video item) {} - public void onVideoItemLongClicked(Video item) {} - public void onScrollEnd(Video item) {} - public boolean hasPendingActions() { return false; } - - public void onAccountChanged(Account account) {} - - // BasePresenter - - final public Video getCurrentVideo() { return getRoot().getCurrentVideo(); } - - final public BrowsePresenter getRoot() { - return mBrowsePresenter; - } - - public void onViewInitialized() {} - - public void onViewPaused() {} - - public void onViewDestroyed() {} - - final public Context getContext() { - return getRoot().getContext(); - } - - final public void syncItem(Video video) { - getRoot().syncItem(video); - } - - final public BrowseView getView() { - return getRoot().getView(); - } - - final public void removeItem(Video item) { - getRoot().removeItem(item); - } - - final public void removeItemAuthor(Video item) { - getRoot().removeItemAuthor(item); - } -} diff --git a/common/src/main/java/com/liskovsoft/smartyoutubetv2/common/app/presenters/browse/BrowsePresenter.java b/common/src/main/java/com/liskovsoft/smartyoutubetv2/common/app/presenters/browse/BrowsePresenter.java deleted file mode 100644 index 6e1b80daef..0000000000 --- a/common/src/main/java/com/liskovsoft/smartyoutubetv2/common/app/presenters/browse/BrowsePresenter.java +++ /dev/null @@ -1,248 +0,0 @@ -package com.liskovsoft.smartyoutubetv2.common.app.presenters.browse; - -import android.annotation.SuppressLint; -import android.content.Context; - -import com.liskovsoft.mediaserviceinterfaces.yt.data.Account; -import com.liskovsoft.sharedutils.mylogger.Log; -import com.liskovsoft.smartyoutubetv2.common.app.models.data.BrowseSection; -import com.liskovsoft.smartyoutubetv2.common.app.models.data.Video; -import com.liskovsoft.smartyoutubetv2.common.app.models.errors.ErrorFragmentData; -import com.liskovsoft.smartyoutubetv2.common.app.presenters.base.BasePresenter; -import com.liskovsoft.smartyoutubetv2.common.app.presenters.browse.BaseBrowsePresenter; -import com.liskovsoft.smartyoutubetv2.common.app.presenters.browse.PocketTubePresenter; -import com.liskovsoft.smartyoutubetv2.common.app.presenters.browse.SectionsPresenter; -import com.liskovsoft.smartyoutubetv2.common.app.presenters.interfaces.SectionPresenter; -import com.liskovsoft.smartyoutubetv2.common.app.presenters.interfaces.VideoGroupPresenter; -import com.liskovsoft.smartyoutubetv2.common.app.views.BrowseView; -import com.liskovsoft.smartyoutubetv2.common.misc.MediaServiceManager.AccountChangeListener; -import com.liskovsoft.smartyoutubetv2.common.utils.Utils; - -import java.util.List; -import java.util.concurrent.CopyOnWriteArrayList; - -public class BrowsePresenter extends BasePresenter implements SectionPresenter, VideoGroupPresenter, AccountChangeListener { - private static final String TAG = BrowsePresenter.class.getSimpleName(); - @SuppressLint("StaticFieldLeak") - private static BrowsePresenter sInstance; - private final List mListeners = new CopyOnWriteArrayList<>(); - private Video mCurrentVideo; - - private BrowsePresenter(Context context) { - super(context); - - mListeners.add(new SectionsPresenter(this)); - mListeners.add(new PocketTubePresenter(this)); - } - - public static BrowsePresenter instance(Context context) { - if (sInstance == null) { - sInstance = new BrowsePresenter(context); - } - - sInstance.setContext(context); - - return sInstance; - } - - public static void unhold() { - sInstance = null; - } - - @Override - public void onViewInitialized() { - super.onViewInitialized(); - - Utils.process(mListeners, BaseBrowsePresenter::onViewInitialized); - } - - @Override - public void onViewPaused() { - super.onViewPaused(); - - Utils.process(mListeners, BaseBrowsePresenter::onViewPaused); - } - - public void updateSections() { - if (getView() == null) { - return; - } - - Utils.process(mListeners, BaseBrowsePresenter::updateSections); - } - - public void updateChannelSorting() { - Utils.process(mListeners, BaseBrowsePresenter::updateChannelSorting); - } - - public void updatePlaylistsStyle() { - Utils.process(mListeners, BaseBrowsePresenter::updatePlaylistsStyle); - } - - @Override - public void onViewDestroyed() { - super.onViewDestroyed(); - - Utils.process(mListeners, BaseBrowsePresenter::onViewDestroyed); - } - - @Override - public void onVideoItemSelected(Video item) { - if (getView() == null) { - return; - } - - mCurrentVideo = item; - - Utils.process(mListeners, listener -> listener.onVideoItemSelected(item)); - } - - @Override - public void onVideoItemClicked(Video item) { - if (getContext() == null) { - return; - } - - Utils.process(mListeners, listener -> listener.onVideoItemClicked(item)); - } - - @Override - public void onVideoItemLongClicked(Video item) { - if (getContext() == null) { - return; - } - - Utils.process(mListeners, listener -> listener.onVideoItemLongClicked(item)); - } - - @Override - public void onScrollEnd(Video item) { - if (item == null) { - Log.e(TAG, "Can't scroll. Video is null."); - return; - } - - Utils.process(mListeners, listener -> listener.onScrollEnd(item)); - } - - @Override - public void onSectionFocused(int sectionId) { - mCurrentVideo = null; // fast scroll through the sections (fix empty selected item) - - Utils.process(mListeners, listener -> listener.onSectionFocused(sectionId)); - } - - @Override - public void onSectionLongPressed(int sectionId) { - Utils.process(mListeners, listener -> listener.onSectionLongPressed(sectionId)); - } - - @Override - public boolean hasPendingActions() { - return Utils.chainProcess(mListeners, BaseBrowsePresenter::hasPendingActions); - } - - public boolean isItemPinned(Video item) { - return Utils.chainProcess(mListeners, listener -> listener.isItemPinned(item)); - } - - public void moveSectionUp(BrowseSection section) { - Utils.process(mListeners, listener -> listener.moveSectionUp(section)); - } - - public void moveSectionDown(BrowseSection section) { - Utils.process(mListeners, listener -> listener.moveSectionDown(section)); - } - - public void renameSection(BrowseSection section) { - Utils.process(mListeners, listener -> listener.renameSection(section)); - } - - public void enableAllSections(boolean enable) { - Utils.process(mListeners, listener -> listener.enableAllSections(enable)); - } - - public void enableSection(int sectionId, boolean enable) { - Utils.process(mListeners, listener -> listener.enableSection(sectionId, enable)); - } - - public void pinItem(Video item) { - if (getView() == null) { - return; - } - - Utils.process(mListeners, listener -> listener.pinItem(item)); - } - - public void pinItem(String title, int resId, ErrorFragmentData data) { - if (getView() == null) { - return; - } - - Utils.process(mListeners, listener -> listener.pinItem(title, resId, data)); - } - - public void unpinItem(Video item) { - Utils.process(mListeners, listener -> listener.unpinItem(item)); - } - - public void refresh() { - Utils.process(mListeners, BaseBrowsePresenter::refresh); - } - - public void refresh(boolean focusOnContent) { - Utils.process(mListeners, listener -> listener.refresh(focusOnContent)); - } - - /** - * Is Channels new look enabled? - */ - public boolean isMultiGridChannelUploadsSection() { - return Utils.chainProcess(mListeners, BaseBrowsePresenter::isMultiGridChannelUploadsSection); - } - - public boolean isSettingsSection() { - return Utils.chainProcess(mListeners, BaseBrowsePresenter::isSettingsSection); - } - - public boolean isPlaylistsSection() { - return Utils.chainProcess(mListeners, BaseBrowsePresenter::isPlaylistsSection); - } - - public boolean isHomeSection() { - return Utils.chainProcess(mListeners, BaseBrowsePresenter::isHomeSection); - } - - public boolean isHistorySection() { - return Utils.chainProcess(mListeners, BaseBrowsePresenter::isHistorySection); - } - - public boolean isSubscriptionsSection() { - return Utils.chainProcess(mListeners, BaseBrowsePresenter::isSubscriptionsSection); - } - - public boolean isPinnedSection() { - return Utils.chainProcess(mListeners, BaseBrowsePresenter::isPinnedSection); - } - - public void selectSection(int sectionId) { - Utils.process(mListeners, listener -> listener.selectSection(sectionId)); - } - - public boolean inForeground() { - return Utils.chainProcess(mListeners, BaseBrowsePresenter::inForeground); - } - - //private boolean isGridSection() { - // return mCurrentSection != null && mCurrentSection.getType() != BrowseSection.TYPE_ROW; - //} - - @Override - public void onAccountChanged(Account account) { - Utils.process(mListeners, listener -> listener.onAccountChanged(account)); - } - - public Video getCurrentVideo() { - return mCurrentVideo; - } -} diff --git a/common/src/main/java/com/liskovsoft/smartyoutubetv2/common/app/presenters/browse/PocketTubePresenter.java b/common/src/main/java/com/liskovsoft/smartyoutubetv2/common/app/presenters/browse/PocketTubePresenter.java deleted file mode 100644 index 8a40873f25..0000000000 --- a/common/src/main/java/com/liskovsoft/smartyoutubetv2/common/app/presenters/browse/PocketTubePresenter.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.liskovsoft.smartyoutubetv2.common.app.presenters.browse; - -import com.liskovsoft.smartyoutubetv2.common.app.presenters.browse.BrowsePresenter; - -public class PocketTubePresenter extends BaseBrowsePresenter { - public PocketTubePresenter(BrowsePresenter root) { - super(root); - } -} diff --git a/common/src/main/java/com/liskovsoft/smartyoutubetv2/common/app/presenters/browse/SectionsPresenter.java b/common/src/main/java/com/liskovsoft/smartyoutubetv2/common/app/presenters/browse/SectionsPresenter.java deleted file mode 100644 index f63075e93f..0000000000 --- a/common/src/main/java/com/liskovsoft/smartyoutubetv2/common/app/presenters/browse/SectionsPresenter.java +++ /dev/null @@ -1,1092 +0,0 @@ -package com.liskovsoft.smartyoutubetv2.common.app.presenters.browse; - -import android.content.Context; - -import com.liskovsoft.mediaserviceinterfaces.yt.ContentService; -import com.liskovsoft.mediaserviceinterfaces.yt.MediaItemService; -import com.liskovsoft.mediaserviceinterfaces.yt.NotificationsService; -import com.liskovsoft.mediaserviceinterfaces.yt.ServiceManager; -import com.liskovsoft.mediaserviceinterfaces.yt.SignInService; -import com.liskovsoft.mediaserviceinterfaces.yt.data.Account; -import com.liskovsoft.mediaserviceinterfaces.yt.data.MediaGroup; -import com.liskovsoft.sharedutils.helpers.Helpers; -import com.liskovsoft.sharedutils.helpers.ScreenHelper; -import com.liskovsoft.sharedutils.locale.LocaleUtility; -import com.liskovsoft.sharedutils.mylogger.Log; -import com.liskovsoft.sharedutils.rx.RxHelper; -import com.liskovsoft.smartyoutubetv2.common.R; -import com.liskovsoft.smartyoutubetv2.common.app.models.data.BrowseSection; -import com.liskovsoft.smartyoutubetv2.common.app.models.data.SettingsGroup; -import com.liskovsoft.smartyoutubetv2.common.app.models.data.SettingsItem; -import com.liskovsoft.smartyoutubetv2.common.app.models.data.Video; -import com.liskovsoft.smartyoutubetv2.common.app.models.data.VideoGroup; -import com.liskovsoft.smartyoutubetv2.common.app.models.errors.CategoryEmptyError; -import com.liskovsoft.smartyoutubetv2.common.app.models.errors.ErrorFragmentData; -import com.liskovsoft.smartyoutubetv2.common.app.models.errors.PasswordError; -import com.liskovsoft.smartyoutubetv2.common.app.models.errors.SignInError; -import com.liskovsoft.smartyoutubetv2.common.app.presenters.browse.BrowsePresenter; -import com.liskovsoft.smartyoutubetv2.common.app.presenters.ChannelPresenter; -import com.liskovsoft.smartyoutubetv2.common.app.presenters.ChannelUploadsPresenter; -import com.liskovsoft.smartyoutubetv2.common.app.presenters.dialogs.VideoActionPresenter; -import com.liskovsoft.smartyoutubetv2.common.app.presenters.dialogs.menu.ChannelUploadsMenuPresenter; -import com.liskovsoft.smartyoutubetv2.common.app.presenters.dialogs.menu.SectionMenuPresenter; -import com.liskovsoft.smartyoutubetv2.common.app.presenters.dialogs.menu.VideoMenuPresenter; -import com.liskovsoft.smartyoutubetv2.common.app.presenters.dialogs.menu.VideoMenuPresenter.VideoMenuCallback; -import com.liskovsoft.smartyoutubetv2.common.app.views.BrowseView; -import com.liskovsoft.smartyoutubetv2.common.app.views.ViewManager; -import com.liskovsoft.smartyoutubetv2.common.misc.AppDataSourceManager; -import com.liskovsoft.smartyoutubetv2.common.misc.DeArrowProcessor; -import com.liskovsoft.smartyoutubetv2.common.misc.MediaServiceManager; -import com.liskovsoft.smartyoutubetv2.common.prefs.AccountsData; -import com.liskovsoft.smartyoutubetv2.common.prefs.GeneralData; -import com.liskovsoft.smartyoutubetv2.common.prefs.MainUIData; -import com.liskovsoft.smartyoutubetv2.common.utils.Utils; -import com.liskovsoft.youtubeapi.service.YouTubeServiceManager; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.concurrent.Callable; - -import io.reactivex.Observable; -import io.reactivex.disposables.Disposable; - -public class SectionsPresenter extends BaseBrowsePresenter { - private static final String TAG = SectionsPresenter.class.getSimpleName(); - private static final long HEADER_REFRESH_PERIOD_MS = 120 * 60 * 1_000; - private final MainUIData mMainUIData; - private final GeneralData mGeneralData; - private final List mSections; - private final List mErrorSections; - private final Map> mGridMapping; - private final Map>> mRowMapping; - private final Map>> mSettingsGridMapping; - private final Map mSectionsMapping; - private final AppDataSourceManager mDataSourcePresenter; - private final ContentService mContentService; - private final MediaItemService mItemService; - private final SignInService mSignInService; - private final NotificationsService mNotificationsService; - private final DeArrowProcessor mDeArrowProcessor; - private final List mActions; - private final Runnable mRefreshSection = this::refresh; - private BrowseSection mCurrentSection; - private long mLastUpdateTimeMs; - private int mBootSectionIndex; - private int mBootstrapSectionId = -1; - - public SectionsPresenter(BrowsePresenter root) { - super(root); - mDataSourcePresenter = AppDataSourceManager.instance(); - mSections = new ArrayList<>(); - mErrorSections = new ArrayList<>(); - mGridMapping = new HashMap<>(); - mRowMapping = new HashMap<>(); - mSettingsGridMapping = new HashMap<>(); - mSectionsMapping = new HashMap<>(); - mMainUIData = MainUIData.instance(getContext()); - mGeneralData = GeneralData.instance(getContext()); - MediaServiceManager.instance().addAccountListener(this); - ScreenHelper.updateScreenInfo(getContext()); - - ServiceManager service = YouTubeServiceManager.instance(); - mContentService = service.getContentService(); - mItemService = service.getMediaItemService(); - mSignInService = service.getSignInService(); - mNotificationsService = service.getNotificationsService(); - mDeArrowProcessor = new DeArrowProcessor(getContext(), this::syncItem); - mActions = new ArrayList<>(); - - initSections(); - } - - @Override - public void onViewInitialized() { - super.onViewInitialized(); - - if (getView() == null) { - return; - } - - updateChannelSorting(); - updatePlaylistsStyle(); - updateSections(); - Utils.updateRemoteControlService(getContext()); - - // Move default focus - int selectedSectionIndex = findSectionIndex(mCurrentSection != null ? mCurrentSection.getId() : mBootstrapSectionId); - mBootstrapSectionId = -1; - getView().selectSection(selectedSectionIndex != -1 ? selectedSectionIndex : mBootSectionIndex, true); - } - - @Override - public void onViewPaused() { - super.onViewPaused(); - - saveSelectedItems(); - } - - private void saveSelectedItems() { - // Fix position reset when jumping between sections - if (getCurrentVideo() != null && getCurrentVideo().getPositionInsideGroup() == 0 && (System.currentTimeMillis() - getCurrentVideo().timestamp) < 10_000) { - return; - } - - if ((isSubscriptionsSection() && mGeneralData.isRememberSubscriptionsPositionEnabled()) || - (isPinnedSection() && mGeneralData.isRememberPinnedPositionEnabled())) { - mGeneralData.setSelectedItem(mCurrentSection.getId(), getCurrentVideo()); - } - } - - private void restoreSelectedItems() { - if ((isSubscriptionsSection() && mGeneralData.isRememberSubscriptionsPositionEnabled()) || - (isPinnedSection() && mGeneralData.isRememberPinnedPositionEnabled())) { - getView().selectSectionItem(mGeneralData.getSelectedItem(mCurrentSection.getId())); - } - } - - private void initSections() { - initSectionMapping(); - - initSectionCallbacks(); - - initSettingsSubCategories(); - } - - private void initSectionMapping() { - String country = LocaleUtility.getCurrentLocale(getContext()).getCountry(); - int uploadsType = mMainUIData.isUploadsOldLookEnabled() ? BrowseSection.TYPE_GRID : BrowseSection.TYPE_MULTI_GRID; - - mSectionsMapping.put(MediaGroup.TYPE_HOME, new BrowseSection(MediaGroup.TYPE_HOME, getContext().getString(R.string.header_home), BrowseSection.TYPE_ROW, R.drawable.icon_home)); - mSectionsMapping.put(MediaGroup.TYPE_SHORTS, new BrowseSection(MediaGroup.TYPE_SHORTS, getContext().getString(R.string.header_shorts), BrowseSection.TYPE_SHORTS_GRID, R.drawable.icon_shorts)); - mSectionsMapping.put(MediaGroup.TYPE_TRENDING, new BrowseSection(MediaGroup.TYPE_TRENDING, getContext().getString(R.string.header_trending), BrowseSection.TYPE_ROW, R.drawable.icon_trending)); - mSectionsMapping.put(MediaGroup.TYPE_KIDS_HOME, new BrowseSection(MediaGroup.TYPE_KIDS_HOME, getContext().getString(R.string.header_kids_home), BrowseSection.TYPE_ROW, R.drawable.icon_kids_home)); - mSectionsMapping.put(MediaGroup.TYPE_SPORTS, new BrowseSection(MediaGroup.TYPE_SPORTS, getContext().getString(R.string.header_sports), BrowseSection.TYPE_ROW, R.drawable.icon_sports)); - mSectionsMapping.put(MediaGroup.TYPE_GAMING, new BrowseSection(MediaGroup.TYPE_GAMING, getContext().getString(R.string.header_gaming), BrowseSection.TYPE_ROW, R.drawable.icon_gaming)); - if (!Helpers.equalsAny(country, "RU", "BY")) { - mSectionsMapping.put(MediaGroup.TYPE_NEWS, new BrowseSection(MediaGroup.TYPE_NEWS, getContext().getString(R.string.header_news), BrowseSection.TYPE_ROW, R.drawable.icon_news)); - } - mSectionsMapping.put(MediaGroup.TYPE_MUSIC, new BrowseSection(MediaGroup.TYPE_MUSIC, getContext().getString(R.string.header_music), BrowseSection.TYPE_ROW, R.drawable.icon_music)); - mSectionsMapping.put(MediaGroup.TYPE_CHANNEL_UPLOADS, new BrowseSection(MediaGroup.TYPE_CHANNEL_UPLOADS, getContext().getString(R.string.header_channels), uploadsType, R.drawable.icon_channels, true)); - mSectionsMapping.put(MediaGroup.TYPE_SUBSCRIPTIONS, new BrowseSection(MediaGroup.TYPE_SUBSCRIPTIONS, getContext().getString(R.string.header_subscriptions), BrowseSection.TYPE_GRID, R.drawable.icon_subscriptions, true)); - mSectionsMapping.put(MediaGroup.TYPE_HISTORY, new BrowseSection(MediaGroup.TYPE_HISTORY, getContext().getString(R.string.header_history), BrowseSection.TYPE_GRID, R.drawable.icon_history, true)); - mSectionsMapping.put(MediaGroup.TYPE_USER_PLAYLISTS, new BrowseSection(MediaGroup.TYPE_USER_PLAYLISTS, getContext().getString(R.string.header_playlists), BrowseSection.TYPE_ROW, R.drawable.icon_playlist, true)); - mSectionsMapping.put(MediaGroup.TYPE_NOTIFICATIONS, new BrowseSection(MediaGroup.TYPE_NOTIFICATIONS, getContext().getString(R.string.header_notifications), BrowseSection.TYPE_GRID, R.drawable.icon_notification, true)); - - if (mGeneralData.isSettingsSectionEnabled()) { - mSectionsMapping.put(MediaGroup.TYPE_SETTINGS, new BrowseSection(MediaGroup.TYPE_SETTINGS, getContext().getString(R.string.header_settings), BrowseSection.TYPE_SETTINGS_GRID, R.drawable.icon_settings)); - } - } - - private void initSectionCallbacks() { - mRowMapping.put(MediaGroup.TYPE_HOME, mGeneralData.isOldHomeLookEnabled() ? mContentService.getHomeV1Observe() : mContentService.getHomeObserve()); - mRowMapping.put(MediaGroup.TYPE_TRENDING, mContentService.getTrendingObserve()); - mRowMapping.put(MediaGroup.TYPE_KIDS_HOME, mContentService.getKidsHomeObserve()); - mRowMapping.put(MediaGroup.TYPE_SPORTS, mContentService.getSportsObserve()); - mRowMapping.put(MediaGroup.TYPE_NEWS, mContentService.getNewsObserve()); - mRowMapping.put(MediaGroup.TYPE_MUSIC, mContentService.getMusicObserve()); - mRowMapping.put(MediaGroup.TYPE_GAMING, mContentService.getGamingObserve()); - mRowMapping.put(MediaGroup.TYPE_USER_PLAYLISTS, mContentService.getPlaylistsObserve()); - - mGridMapping.put(MediaGroup.TYPE_SHORTS, mContentService.getShortsObserve()); - mGridMapping.put(MediaGroup.TYPE_SUBSCRIPTIONS, mContentService.getSubscriptionsObserve()); - mGridMapping.put(MediaGroup.TYPE_HISTORY, mContentService.getHistoryObserve()); - mGridMapping.put(MediaGroup.TYPE_CHANNEL_UPLOADS, mContentService.getSubscribedChannelsByUpdateObserve()); - mGridMapping.put(MediaGroup.TYPE_NOTIFICATIONS, mNotificationsService.getNotificationItemsObserve()); - } - - private void initPinnedSections() { - mSections.clear(); - - Collection