Example usage for android.media.tv TvInputInfo canRecord

List of usage examples for android.media.tv TvInputInfo canRecord

Introduction

In this page you can find the example usage for android.media.tv TvInputInfo canRecord.

Prototype

public boolean canRecord() 

Source Link

Document

Returns true if this TV input can record TV programs, false otherwise.

Usage

From source file:com.android.tv.dvr.DvrSessionManager.java

@VisibleForTesting
DvrSessionManager(Context context, TvInputManager tvInputManager, Handler handler) {
    SoftPreconditions.checkFeatureEnabled(context, CommonFeatures.DVR, TAG);
    mTvInputManager = tvInputManager;//  www. ja v  a2s  . c  om
    mContext = context.getApplicationContext();
    for (TvInputInfo info : tvInputManager.getTvInputList()) {
        if (DEBUG) {
            Log.d(TAG, info + " canRecord=" + info.canRecord() + " tunerCount=" + info.getTunerCount());
        }
        if (info.canRecord()) {
            mRecordingTvInputs.put(info.getId(), info);
        }
    }
    tvInputManager.registerCallback(this, handler);

}

From source file:com.android.tv.dvr.DvrSessionManager.java

@Override
public void onInputAdded(String inputId) {
    super.onInputAdded(inputId);
    TvInputInfo info = mTvInputManager.getTvInputInfo(inputId);
    if (DEBUG) {//from   w w w . j  av a2s.  co  m
        Log.d(TAG, "onInputAdded " + info.toString() + " canRecord=" + info.canRecord() + " tunerCount="
                + info.getTunerCount());
    }
    if (info.canRecord()) {
        mRecordingTvInputs.put(inputId, info);
    }
}

From source file:com.android.tv.dvr.DvrSessionManager.java

@Override
public void onInputUpdated(String inputId) {
    super.onInputUpdated(inputId);
    TvInputInfo info = mTvInputManager.getTvInputInfo(inputId);
    if (DEBUG) {//from ww w . j  a v  a  2 s . c  o  m
        Log.d(TAG, "onInputUpdated " + info.toString() + " canRecord=" + info.canRecord() + " tunerCount="
                + info.getTunerCount());
    }
    if (info.canRecord()) {
        mRecordingTvInputs.put(inputId, info);
    } else {
        mRecordingTvInputs.remove(inputId);
    }
}

From source file:com.android.tv.menu.ChannelsRowAdapter.java

@Override
public void update() {
    List<Channel> channelList = new ArrayList<>();
    Channel dummyChannel = new Channel.Builder().build();
    // For guide item
    channelList.add(dummyChannel);/*from www  . ja  v  a  2 s. c om*/
    // For setup item
    TvInputManagerHelper inputManager = TvApplication.getSingletons(mContext).getTvInputManagerHelper();
    boolean showSetupCard = SetupUtils.getInstance(mContext).hasNewInput(inputManager);
    Channel currentChannel = ((MainActivity) mContext).getCurrentChannel();
    boolean showAppLinkCard = Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && currentChannel != null
            && currentChannel.getAppLinkType(mContext) != Channel.APP_LINK_TYPE_NONE;
    boolean showDvrCard = false;
    boolean showRecordCard = false;
    if (mDvrFeatureEnabled) {
        for (TvInputInfo info : inputManager.getTvInputInfos(true, true)) {
            if (info.canRecord()) {
                showDvrCard = true;
                break;
            }
        }
        if (currentChannel != null && currentChannel.getInputId() != null) {
            TvInputInfo inputInfo = inputManager.getTvInputInfo(currentChannel.getInputId());
            if ((inputInfo.canRecord() && inputInfo.getTunerCount() > 1)) {
                showRecordCard = true;
            }
        }
    }

    mViewType[0] = R.layout.menu_card_guide;
    int index = 1;
    if (showSetupCard) {
        channelList.add(dummyChannel);
        mViewType[index++] = R.layout.menu_card_setup;
    }
    if (showDvrCard) {
        channelList.add(dummyChannel);
        mViewType[index++] = R.layout.menu_card_dvr;
    }
    if (showRecordCard) {
        channelList.add(currentChannel);
        mViewType[index++] = R.layout.menu_card_record;
    }
    if (showAppLinkCard) {
        channelList.add(currentChannel);
        mViewType[index++] = R.layout.menu_card_app_link;
    }
    for (; index < mViewType.length; ++index) {
        mViewType[index] = R.layout.menu_card_channel;
    }
    channelList.addAll(getRecentChannels());
    setItemList(channelList);
}