当前位置: 首页>>代码示例>>Java>>正文


Java TvInputInfo.canRecord方法代码示例

本文整理汇总了Java中android.media.tv.TvInputInfo.canRecord方法的典型用法代码示例。如果您正苦于以下问题:Java TvInputInfo.canRecord方法的具体用法?Java TvInputInfo.canRecord怎么用?Java TvInputInfo.canRecord使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.media.tv.TvInputInfo的用法示例。


在下文中一共展示了TvInputInfo.canRecord方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: isChannelRecordable

import android.media.tv.TvInputInfo; //导入方法依赖的package包/类
/**
 * Returns {@code true} if the channel can be recorded.
 * <p>
 * Note that this method doesn't check the conflict of the schedule or available tuners.
 * This can be called from the UI before the schedules are loaded.
 */
public boolean isChannelRecordable(Channel channel) {
    if (!mDataManager.isDvrScheduleLoadFinished() || channel == null) {
        return false;
    }
    TvInputInfo info = Utils.getTvInputInfoForChannelId(mAppContext, channel.getId());
    if (info == null) {
        Log.w(TAG, "Could not find TvInputInfo for " + channel);
        return false;
    }
    if (!info.canRecord()) {
        return false;
    }
    Program program = TvApplication.getSingletons(mAppContext).getProgramDataManager()
            .getCurrentProgram(channel.getId());
    return program == null || !program.isRecordingProhibited();
}
 
开发者ID:trevd,项目名称:android_packages_apps_tv,代码行数:23,代码来源:DvrManager.java

示例2: getConflictingSchedules

import android.media.tv.TvInputInfo; //导入方法依赖的package包/类
/**
 * Returns a sorted list of all scheduled recordings that will not be recorded if
 * this program is going to be recorded, with their priorities in decending order.
 * <p>
 * An empty list means there is no conflicts. If there is conflict, a priority higher than
 * the first recording in the returned list should be assigned to the new schedule of this
 * program to guarantee the program would be completely recorded.
 */
public List<ScheduledRecording> getConflictingSchedules(Program program) {
    SoftPreconditions.checkState(mInitialized, TAG, "Not initialized yet");
    SoftPreconditions.checkState(Program.isValid(program), TAG,
            "Program is invalid: " + program);
    SoftPreconditions.checkState(
            program.getStartTimeUtcMillis() < program.getEndTimeUtcMillis(), TAG,
            "Program duration is empty: " + program);
    if (!mInitialized || !Program.isValid(program)
            || program.getStartTimeUtcMillis() >= program.getEndTimeUtcMillis()) {
        return Collections.emptyList();
    }
    TvInputInfo input = Utils.getTvInputInfoForProgram(mContext, program);
    if (input == null || !input.canRecord() || input.getTunerCount() <= 0) {
        return Collections.emptyList();
    }
    return getConflictingSchedules(input, Collections.singletonList(
            ScheduledRecording.builder(input.getId(), program)
                    .setPriority(suggestHighestPriority())
                    .build()));
}
 
开发者ID:trevd,项目名称:android_packages_apps_tv,代码行数:29,代码来源:DvrScheduleManager.java

示例3: scheduleRecordingSoon

import android.media.tv.TvInputInfo; //导入方法依赖的package包/类
private void scheduleRecordingSoon(ScheduledRecording schedule) {
    TvInputInfo input = Utils.getTvInputInfoForInputId(mContext, schedule.getInputId());
    if (input == null) {
        Log.e(TAG, "Can't find input for " + schedule);
        mDataManager.changeState(schedule, ScheduledRecording.STATE_RECORDING_FAILED);
        return;
    }
    if (!input.canRecord() || input.getTunerCount() <= 0) {
        Log.e(TAG, "TV input doesn't support recording: " + input);
        mDataManager.changeState(schedule, ScheduledRecording.STATE_RECORDING_FAILED);
        return;
    }
    InputTaskScheduler scheduler = mInputSchedulerMap.get(input.getId());
    if (scheduler == null) {
        scheduler = new InputTaskScheduler(mContext, input, mLooper, mChannelDataManager,
                mDvrManager, mDataManager, mSessionManager, mClock);
        mInputSchedulerMap.put(input.getId(), scheduler);
    }
    scheduler.addSchedule(schedule);
    if (mLastStartTimePendingMs < schedule.getStartTimeMs()) {
        mLastStartTimePendingMs = schedule.getStartTimeMs();
    }
}
 
开发者ID:trevd,项目名称:android_packages_apps_tv,代码行数:24,代码来源:Scheduler.java

示例4: isProgramRecordable

import android.media.tv.TvInputInfo; //导入方法依赖的package包/类
/**
 * Returns {@code true} if the program can be recorded.
 * <p>
 * Note that this method doesn't check the conflict of the schedule or available tuners.
 * This can be called from the UI before the schedules are loaded.
 */
public boolean isProgramRecordable(Program program) {
    if (!mDataManager.isInitialized()) {
        return false;
    }
    TvInputInfo info = Utils.getTvInputInfoForProgram(mAppContext, program);
    if (info == null) {
        Log.w(TAG, "Could not find TvInputInfo for " + program);
        return false;
    }
    return info.canRecord() && !program.isRecordingProhibited();
}
 
开发者ID:trevd,项目名称:android_packages_apps_tv,代码行数:18,代码来源:DvrManager.java

示例5: tune

import android.media.tv.TvInputInfo; //导入方法依赖的package包/类
/**
 * Tunes to the channel.
 */
public void tune(Channel channel, Bundle params, OnTuneListener listener) {
    if (DEBUG) {
        Log.d(TAG, "tune: {session=" + this + ", channel=" + channel + ", params=" + params
                + ", listener=" + listener + ", mTuned=" + mTuned + "}");
    }
    mChannel = channel;
    mInputId = channel.getInputId();
    mChannelUri = channel.getUri();
    mParams = params;
    mOnTuneListener = listener;
    TvInputInfo input = mInputManager.getTvInputInfo(mInputId);
    if (input == null || (input.canRecord() && !isTunedForRecording(mChannelUri)
            && getTunedRecordingSessionCount(mInputId) >= input.getTunerCount())) {
        if (DEBUG) {
            if (input == null) {
                Log.d(TAG, "Can't find input for input ID: " + mInputId);
            } else {
                Log.d(TAG, "No more tuners to tune for input: " + input);
            }
        }
        mCallback.onConnectionFailed(mInputId);
        // Release the previous session to not to hold the unnecessary session.
        resetByRecording();
        return;
    }
    mTuned = true;
    mNeedToBeRetuned = false;
    mTvView.tune(mInputId, mChannelUri, params);
    notifyTvViewChannelChange(mChannelUri);
}
 
开发者ID:trevd,项目名称:android_packages_apps_tv,代码行数:34,代码来源:InputSessionManager.java

示例6: update

import android.media.tv.TvInputInfo; //导入方法依赖的package包/类
@Override
public void update() {
    List<Channel> channelList = new ArrayList<>();
    Channel dummyChannel = new Channel.Builder().build();
    // For guide item
    channelList.add(dummyChannel);
    // For setup item
    TvInputManagerHelper inputManager = TvApplication.getSingletons(mContext)
            .getTvInputManagerHelper();
    boolean showSetupCard = SetupUtils.getInstance(mContext).hasNewInput(inputManager);
    Channel currentChannel = getMainActivity().getCurrentChannel();
    boolean showAppLinkCard = currentChannel != null
            && currentChannel.getAppLinkType(mContext) != Channel.APP_LINK_TYPE_NONE
            // Sometimes applicationInfo can be null. b/28932537
            && inputManager.getTvInputAppInfo(currentChannel.getInputId()) != null;
    boolean showDvrCard = false;
    if (mDvrDataManager != null) {
        for (TvInputInfo info : inputManager.getTvInputInfos(true, true)) {
            if (info.canRecord()) {
                showDvrCard = true;
                break;
            }
        }
    }

    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 (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);
}
 
开发者ID:trevd,项目名称:android_packages_apps_tv,代码行数:46,代码来源:ChannelsRowAdapter.java


注:本文中的android.media.tv.TvInputInfo.canRecord方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。