mirror of
https://github.com/yuliskov/SmartTube.git
synced 2026-02-05 06:12:06 -06:00
subscribed channel group fix
This commit is contained in:
Submodule MediaServiceCore updated: a5ff54a1f8...44f4447db5
Submodule SharedModules updated: c2af7e663f...1caaebbce3
@@ -198,7 +198,7 @@ public class BrowsePresenter extends BasePresenter<BrowseView> implements Sectio
|
||||
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));
|
||||
mSectionsMapping.put(MediaGroup.TYPE_NOTIFICATIONS, new BrowseSection(MediaGroup.TYPE_NOTIFICATIONS, getContext().getString(R.string.header_notifications), BrowseSection.TYPE_GRID, R.drawable.icon_notification, false));
|
||||
|
||||
if (mSidebarService.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));
|
||||
@@ -968,7 +968,7 @@ public class BrowsePresenter extends BasePresenter<BrowseView> implements Sectio
|
||||
|
||||
private Observable<MediaGroup> createPinnedGridAction(Video item) {
|
||||
if (item.channelGroupId != -1) {
|
||||
return mContentService.getSubscriptionsObserve(ChannelGroupServiceWrapper.instance(getContext()).getChannelGroupIds(item.channelGroupId));
|
||||
return mContentService.getSubscriptionsObserve(ChannelGroupServiceWrapper.instance(getContext()).findChannelIdsForGroup(item.channelGroupId));
|
||||
}
|
||||
|
||||
return ChannelUploadsPresenter.instance(getContext()).obtainUploadsObservable(item);
|
||||
@@ -1136,17 +1136,18 @@ public class BrowsePresenter extends BasePresenter<BrowseView> implements Sectio
|
||||
private void appendLocalSubscriptions() {
|
||||
updateVideoGrid(getCurrentSection(),
|
||||
mContentService.getSubscriptionsObserve(
|
||||
ChannelGroupServiceWrapper.instance(getContext()).getChannelGroupIds(ChannelGroupServiceWrapper.SUBSCRIPTION_GROUP_ID)), -1);
|
||||
ChannelGroupServiceWrapper.instance(getContext()).findSubscribedChannelIds()), -1);
|
||||
}
|
||||
|
||||
private void appendLocalChannels() {
|
||||
ChannelGroup subscriptions = ChannelGroupServiceWrapper.instance(getContext()).findChannelGroup(ChannelGroupServiceWrapper.SUBSCRIPTION_GROUP_ID);
|
||||
ChannelGroup subscriptions = ChannelGroupServiceWrapper.instance(getContext()).findSubscribedChannelGroup();
|
||||
if (subscriptions != null) {
|
||||
List<Video> channels = new ArrayList<>();
|
||||
for (ChannelGroup.Channel channel : subscriptions.getChannels()) {
|
||||
channels.add(Video.from(channel));
|
||||
}
|
||||
VideoGroup group = VideoGroup.from(channels, 0);
|
||||
//group.setAction(VideoGroup.ACTION_REPLACE);
|
||||
group.setType(MediaGroup.TYPE_CHANNEL_UPLOADS);
|
||||
getView().updateSection(group);
|
||||
}
|
||||
|
||||
@@ -7,7 +7,6 @@ import android.net.Uri;
|
||||
import com.liskovsoft.mediaserviceinterfaces.yt.ChannelGroupService;
|
||||
import com.liskovsoft.mediaserviceinterfaces.yt.data.ChannelGroup;
|
||||
import com.liskovsoft.mediaserviceinterfaces.yt.data.ChannelGroup.Channel;
|
||||
import com.liskovsoft.smartyoutubetv2.common.app.models.data.Video;
|
||||
import com.liskovsoft.smartyoutubetv2.common.prefs.AppPrefs;
|
||||
import com.liskovsoft.smartyoutubetv2.common.prefs.AppPrefs.ProfileChangeListener;
|
||||
import com.liskovsoft.youtubeapi.service.YouTubeServiceManager;
|
||||
@@ -17,7 +16,6 @@ import java.util.List;
|
||||
import io.reactivex.Observable;
|
||||
|
||||
public class ChannelGroupServiceWrapper implements ProfileChangeListener {
|
||||
public static final int SUBSCRIPTION_GROUP_ID = 1_000;
|
||||
@SuppressLint("StaticFieldLeak")
|
||||
private static ChannelGroupServiceWrapper sInstance;
|
||||
private final Context mContext;
|
||||
@@ -52,8 +50,16 @@ public class ChannelGroupServiceWrapper implements ProfileChangeListener {
|
||||
mService.removeChannelGroup(group);
|
||||
}
|
||||
|
||||
public String[] getChannelGroupIds(int channelGroupId) {
|
||||
return mService.getChannelGroupIds(channelGroupId);
|
||||
public String[] findChannelIdsForGroup(int channelGroupId) {
|
||||
return mService.findChannelIdsForGroup(channelGroupId);
|
||||
}
|
||||
|
||||
public String[] findSubscribedChannelIds() {
|
||||
return mService.findSubscribedChannelIds();
|
||||
}
|
||||
|
||||
public ChannelGroup findSubscribedChannelGroup() {
|
||||
return mService.findSubscribedChannelGroup();
|
||||
}
|
||||
|
||||
public ChannelGroup findChannelGroup(int channelGroupId) {
|
||||
|
||||
Reference in New Issue
Block a user