Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #10787 from JosJuice/channel-uri
Android: Add app link intent URI to channels projection
  • Loading branch information
lioncash committed Aug 4, 2022
2 parents 098fc8c + 1d77217 commit 4617ee7
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
Expand Up @@ -87,7 +87,7 @@ protected Boolean doInBackground(Void... voids)
}
else
{
subscriptions = TvUtil.createUniversalSubscriptions();
subscriptions = TvUtil.createUniversalSubscriptions(context);
for (HomeScreenChannel subscription : subscriptions)
{
long channelId = createChannel(subscription);
Expand Down
Expand Up @@ -98,7 +98,8 @@ protected Boolean doInBackground(Long... channelIds)
Channel channel = TvUtil.getChannelById(context, channelId);
for (Platform platform : Platform.values())
{
if (channel != null && channel.getDisplayName().equals(platform.getIdString()))
if (channel != null &&
channel.getAppLinkIntentUri().equals(AppLinkHelper.buildBrowseUri(platform)))
{
getGamesByPlatform(platform);
syncPrograms(channelId);
Expand Down
Expand Up @@ -50,8 +50,9 @@

private static final String[] CHANNELS_PROJECTION = {
TvContractCompat.Channels._ID,
TvContract.Channels.COLUMN_DISPLAY_NAME,
TvContractCompat.Channels.COLUMN_BROWSABLE
TvContractCompat.Channels.COLUMN_DISPLAY_NAME,
TvContractCompat.Channels.COLUMN_BROWSABLE,
TvContractCompat.Channels.COLUMN_APP_LINK_INTENT_URI
};
private static final String LEANBACK_PACKAGE = "com.google.android.tvlauncher";

Expand Down Expand Up @@ -253,21 +254,19 @@ private static int getJobIdForChannelId(long channelId)
/**
* Generates all subscriptions for homescreen channels.
*/
public static List<HomeScreenChannel> createUniversalSubscriptions()
public static List<HomeScreenChannel> createUniversalSubscriptions(Context context)
{
return new ArrayList<>(createPlatformSubscriptions());
return new ArrayList<>(createPlatformSubscriptions(context));
}

private static List<HomeScreenChannel> createPlatformSubscriptions()
private static List<HomeScreenChannel> createPlatformSubscriptions(Context context)
{
List<HomeScreenChannel> subs = new ArrayList<>();
for (Platform platform : Platform.values())
{
// TODO: Replace the getIdString calls with getHeaderName to get localized names.
// This would require SyncProgramsJobService to stop using the display name as a key
subs.add(new HomeScreenChannel(
platform.getIdString(),
platform.getIdString(),
context.getString(platform.getHeaderName()),
context.getString(platform.getHeaderName()),
AppLinkHelper.buildBrowseUri(platform)));
}
return subs;
Expand Down

0 comments on commit 4617ee7

Please sign in to comment.