Home | History | Annotate | Download | only in api
      1 /*
      2  * Copyright (C) 2018 The Android Open Source Project
      3  *
      4  * Licensed under the Apache License, Version 2.0 (the "License");
      5  * you may not use this file except in compliance with the License.
      6  * You may obtain a copy of the License at
      7  *
      8  *      http://www.apache.org/licenses/LICENSE-2.0
      9  *
     10  * Unless required by applicable law or agreed to in writing, software
     11  * distributed under the License is distributed on an "AS IS" BASIS,
     12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13  * See the License for the specific language governing permissions and
     14  * limitations under the License.
     15  */
     16 package com.android.tv.data.api;
     17 
     18 import android.content.Context;
     19 import android.content.Intent;
     20 import android.net.Uri;
     21 import android.support.annotation.Nullable;
     22 import com.android.tv.util.images.ImageLoader.ImageLoaderCallback;
     23 
     24 /**
     25  * Interface for {@link com.android.tv.data.ChannelImpl}.
     26  *
     27  * <p><b>NOTE</b> Normally you should not use an interface for a data object like {@code
     28  * ChannelImpl}, however there are many circular dependencies. An interface is the easiest way to
     29  * break the cycles.
     30  */
     31 public interface Channel {
     32 
     33     long INVALID_ID = -1;
     34     int LOAD_IMAGE_TYPE_CHANNEL_LOGO = 1;
     35     int LOAD_IMAGE_TYPE_APP_LINK_ICON = 2;
     36     int LOAD_IMAGE_TYPE_APP_LINK_POSTER_ART = 3;
     37     /**
     38      * When a TIS doesn't provide any information about app link, and it doesn't have a leanback
     39      * launch intent, there will be no app link card for the TIS.
     40      */
     41     int APP_LINK_TYPE_NONE = -1;
     42     /**
     43      * When a TIS provide a specific app link information, the app link card will be {@code
     44      * APP_LINK_TYPE_CHANNEL} which contains all the provided information.
     45      */
     46     int APP_LINK_TYPE_CHANNEL = 1;
     47     /**
     48      * When a TIS doesn't provide a specific app link information, but the app has a leanback launch
     49      * intent, the app link card will be {@code APP_LINK_TYPE_APP} which launches the application.
     50      */
     51     int APP_LINK_TYPE_APP = 2;
     52     /** Channel number delimiter between major and minor parts. */
     53     char CHANNEL_NUMBER_DELIMITER = '-';
     54 
     55     long getId();
     56 
     57     Uri getUri();
     58 
     59     String getPackageName();
     60 
     61     String getInputId();
     62 
     63     String getType();
     64 
     65     String getDisplayNumber();
     66 
     67     @Nullable
     68     String getDisplayName();
     69 
     70     String getDescription();
     71 
     72     String getVideoFormat();
     73 
     74     boolean isPassthrough();
     75 
     76     String getDisplayText();
     77 
     78     String getAppLinkText();
     79 
     80     int getAppLinkColor();
     81 
     82     String getAppLinkIconUri();
     83 
     84     String getAppLinkPosterArtUri();
     85 
     86     String getAppLinkIntentUri();
     87 
     88     String getLogoUri();
     89 
     90     boolean isRecordingProhibited();
     91 
     92     boolean isPhysicalTunerChannel();
     93 
     94     boolean isBrowsable();
     95 
     96     boolean isSearchable();
     97 
     98     boolean isLocked();
     99 
    100     boolean hasSameReadOnlyInfo(Channel mCurrentChannel);
    101 
    102     void setChannelLogoExist(boolean result);
    103 
    104     void setBrowsable(boolean browsable);
    105 
    106     void setLocked(boolean locked);
    107 
    108     void copyFrom(Channel channel);
    109 
    110     void setLogoUri(String logoUri);
    111 
    112     boolean channelLogoExists();
    113 
    114     void loadBitmap(
    115             Context context,
    116             int loadImageTypeChannelLogo,
    117             int mChannelLogoImageViewWidth,
    118             int mChannelLogoImageViewHeight,
    119             ImageLoaderCallback<?> channelLogoCallback);
    120 
    121     int getAppLinkType(Context context);
    122 
    123     Intent getAppLinkIntent(Context context);
    124 
    125     void prefetchImage(
    126             Context mContext,
    127             int loadImageTypeChannelLogo,
    128             int mPosterArtWidth,
    129             int mPosterArtHeight);
    130 }
    131