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


Java TvInputInfo类代码示例

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


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

示例1: addSchedule

import android.media.tv.TvInputInfo; //导入依赖的package包/类
private ScheduledRecording addSchedule(Program program, long priority) {
    TvInputInfo input = Utils.getTvInputInfoForProgram(mAppContext, program);
    if (input == null) {
        Log.e(TAG, "Can't find input for program: " + program);
        return null;
    }
    ScheduledRecording schedule;
    SeriesRecording seriesRecording = getSeriesRecording(program);
    schedule = createScheduledRecordingBuilder(input.getId(), program)
            .setPriority(priority)
            .setSeriesRecordingId(seriesRecording == null ? SeriesRecording.ID_NOT_SET
                    : seriesRecording.getId())
            .build();
    mDataManager.addScheduledRecording(schedule);
    return schedule;
}
 
开发者ID:trevd,项目名称:android_packages_apps_tv,代码行数:17,代码来源:DvrManager.java

示例2: addSeriesRecording

import android.media.tv.TvInputInfo; //导入依赖的package包/类
/**
 * Adds a new series recording and schedules for the programs with the initial state.
 */
public SeriesRecording addSeriesRecording(Program selectedProgram,
        List<Program> programsToSchedule, @SeriesState int initialState) {
    Log.i(TAG, "Adding series recording for program " + selectedProgram + ", and schedules: "
            + programsToSchedule);
    if (!SoftPreconditions.checkState(mDataManager.isInitialized())) {
        return null;
    }
    TvInputInfo input = Utils.getTvInputInfoForProgram(mAppContext, selectedProgram);
    if (input == null) {
        Log.e(TAG, "Can't find input for program: " + selectedProgram);
        return null;
    }
    SeriesRecording seriesRecording = SeriesRecording.builder(input.getId(), selectedProgram)
            .setPriority(mScheduleManager.suggestNewSeriesPriority())
            .setState(initialState)
            .build();
    mDataManager.addSeriesRecording(seriesRecording);
    // The schedules for the recorded programs should be added not to create the schedule the
    // duplicate episodes.
    addRecordedProgramToSeriesRecording(seriesRecording);
    addScheduleToSeriesRecording(seriesRecording, programsToSchedule);
    return seriesRecording;
}
 
开发者ID:trevd,项目名称:android_packages_apps_tv,代码行数:27,代码来源:DvrManager.java

示例3: 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

示例4: onCreateView

import android.media.tv.TvInputInfo; //导入依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
        Bundle savedInstanceState) {
    Bundle args = getArguments();
    if (args != null) {
        mProgram = args.getParcelable(DvrHalfSizedDialogFragment.KEY_PROGRAM);
    }
    SoftPreconditions.checkArgument(mProgram != null);
    TvInputInfo input = Utils.getTvInputInfoForProgram(getContext(), mProgram);
    SoftPreconditions.checkNotNull(input);
    List<ScheduledRecording> conflicts = null;
    if (input != null) {
        conflicts = TvApplication.getSingletons(getContext()).getDvrManager()
                .getConflictingSchedules(mProgram);
    }
    if (conflicts == null) {
        conflicts = Collections.emptyList();
    }
    if (conflicts.isEmpty()) {
        dismissDialog();
    }
    setConflicts(conflicts);
    return super.onCreateView(inflater, container, savedInstanceState);
}
 
开发者ID:trevd,项目名称:android_packages_apps_tv,代码行数:25,代码来源:DvrConflictFragment.java

示例5: 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

示例6: getConflictingSchedulesForWatching

import android.media.tv.TvInputInfo; //导入依赖的package包/类
/**
 * Returns priority ordered list of all scheduled recordings that will not be recorded if
 * the user keeps watching this channel.
 * <p>
 * Note that if the user keeps watching the channel, the channel can be recorded.
 */
public List<ScheduledRecording> getConflictingSchedulesForWatching(long channelId) {
    SoftPreconditions.checkState(mInitialized, TAG, "Not initialized yet");
    SoftPreconditions.checkState(channelId != Channel.INVALID_ID, TAG, "Invalid channel ID");
    TvInputInfo input = Utils.getTvInputInfoForChannelId(mContext, channelId);
    SoftPreconditions.checkState(input != null, TAG, "Can't find input for channel ID: "
            + channelId);
    if (!mInitialized || channelId == Channel.INVALID_ID || input == null) {
        return Collections.emptyList();
    }
    List<ScheduledRecording> schedules = mInputScheduleMap.get(input.getId());
    if (schedules == null || schedules.isEmpty()) {
        return Collections.emptyList();
    }
    return getConflictingSchedulesForWatching(input.getId(), channelId,
            System.currentTimeMillis(), suggestNewPriority(), schedules, input.getTunerCount());
}
 
开发者ID:trevd,项目名称:android_packages_apps_tv,代码行数:23,代码来源:DvrScheduleManager.java

示例7: 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

示例8: onStart

import android.media.tv.TvInputInfo; //导入依赖的package包/类
private void onStart() {
    if (!mStarted) {
        mStarted = true;
        mCancelLoadTask = false;
        if (!PermissionUtils.hasAccessWatchedHistory(mContext)) {
            mWatchedHistoryManager = new WatchedHistoryManager(mContext);
            mWatchedHistoryManager.setListener(this);
            mWatchedHistoryManager.start();
        } else {
            mContext.getContentResolver().registerContentObserver(
                    TvContract.WatchedPrograms.CONTENT_URI, true, mContentObserver);
            mHandler.obtainMessage(MSG_UPDATE_WATCH_HISTORY,
                    TvContract.WatchedPrograms.CONTENT_URI)
                    .sendToTarget();
        }
        mTvInputManager = (TvInputManager) mContext.getSystemService(Context.TV_INPUT_SERVICE);
        mTvInputManager.registerCallback(mInternalCallback, mHandler);
        for (TvInputInfo input : mTvInputManager.getTvInputList()) {
            mInputs.add(input.getId());
        }
    }
    if (mChannelRecordMapLoaded) {
        mHandler.sendEmptyMessage(MSG_NOTIFY_CHANNEL_RECORD_MAP_LOADED);
    }
}
 
开发者ID:trevd,项目名称:android_packages_apps_tv,代码行数:26,代码来源:RecommendationDataManager.java

示例9: compare

import android.media.tv.TvInputInfo; //导入依赖的package包/类
@Override
public int compare(TvInputInfo lhs, TvInputInfo rhs) {
    boolean lhsIsNewInput = mSetupUtils.isNewInput(lhs.getId());
    boolean rhsIsNewInput = mSetupUtils.isNewInput(rhs.getId());
    if (lhsIsNewInput != rhsIsNewInput) {
        // New input first.
        return lhsIsNewInput ? -1 : 1;
    }
    if (!lhsIsNewInput) {
        // Checks only when the inputs are not new.
        boolean lhsSetupDone = mSetupUtils.isSetupDone(lhs.getId());
        boolean rhsSetupDone = mSetupUtils.isSetupDone(rhs.getId());
        if (lhsSetupDone != rhsSetupDone) {
            // An input which has not been setup comes first.
            return lhsSetupDone ? 1 : -1;
        }
    }
    return mInputManager.getDefaultTvInputInfoComparator().compare(lhs, rhs);
}
 
开发者ID:trevd,项目名称:android_packages_apps_tv,代码行数:20,代码来源:TvInputNewComparator.java

示例10: run

import android.media.tv.TvInputInfo; //导入依赖的package包/类
@Override
public void run() {
    List<TvInputInfo> infoList = mTvInputManagerHelper.getTvInputInfos(false, false);
    int systemInputCount = 0;
    int nonSystemInputCount = 0;
    for (TvInputInfo info : infoList) {
        if (mTvInputManagerHelper.isSystemInput(info)) {
            systemInputCount++;
        } else {
            nonSystemInputCount++;
        }
    }
    ConfigurationInfo configurationInfo = new ConfigurationInfo(systemInputCount,
            nonSystemInputCount);
    mTracker.sendConfigurationInfo(configurationInfo);
}
 
开发者ID:trevd,项目名称:android_packages_apps_tv,代码行数:17,代码来源:SendConfigInfoRunnable.java

示例11: isAvailable

import android.media.tv.TvInputInfo; //导入依赖的package包/类
private boolean isAvailable() {
    if (!mPipInput.isAvailable()) {
        return false;
    }

    // If this input shares the same parent with the current main input, you cannot select
    // it. (E.g. two HDMI CEC devices that are connected to HDMI port 1 through an A/V
    // receiver.)
    PipInput pipInput = mPipInputManager.getPipInput(getMainActivity().getCurrentChannel());
    if (pipInput == null) {
        return false;
    }
    TvInputInfo mainInputInfo = pipInput.getInputInfo();
    TvInputInfo pipInputInfo = mPipInput.getInputInfo();
    return mainInputInfo == null || pipInputInfo == null
            || !TextUtils.equals(mainInputInfo.getId(), pipInputInfo.getId())
            && !TextUtils.equals(mainInputInfo.getParentId(), pipInputInfo.getParentId());
}
 
开发者ID:trevd,项目名称:android_packages_apps_tv,代码行数:19,代码来源:PipInputSelectorFragment.java

示例12: updateLabel

import android.media.tv.TvInputInfo; //导入依赖的package包/类
public void updateLabel() {
    MainActivity mainActivity = (MainActivity) getContext();
    Channel channel = mainActivity.getCurrentChannel();
    if (channel == null || !channel.isPassthrough()) {
        return;
    }
    TvInputInfo input = mainActivity.getTvInputManagerHelper().getTvInputInfo(
            channel.getInputId());
    CharSequence customLabel = input.loadCustomLabel(getContext());
    CharSequence label = input.loadLabel(getContext());
    if (TextUtils.isEmpty(customLabel) || customLabel.equals(label)) {
        mInputLabelTextView.setText(label);
        mSecondaryInputLabelTextView.setVisibility(View.GONE);
    } else {
        mInputLabelTextView.setText(customLabel);
        mSecondaryInputLabelTextView.setText(label);
        mSecondaryInputLabelTextView.setVisibility(View.VISIBLE);
    }
}
 
开发者ID:trevd,项目名称:android_packages_apps_tv,代码行数:20,代码来源:InputBannerView.java

示例13: onInputAdded

import android.media.tv.TvInputInfo; //导入依赖的package包/类
@Override
public void onInputAdded(String inputId) {
    if (DEBUG) Log.d(TAG, "onInputAdded " + inputId);
    if (isInBlackList(inputId)) {
        return;
    }
    TvInputInfo info = mTvInputManager.getTvInputInfo(inputId);
    if (info != null) {
        mInputMap.put(inputId, info);
        mInputStateMap.put(inputId, mTvInputManager.getInputState(inputId));
        mInputIdToPartnerInputMap.put(inputId, isPartnerInput(info));
    }
    mContentRatingsManager.update();
    for (TvInputCallback callback : mCallbacks) {
        callback.onInputAdded(inputId);
    }
}
 
开发者ID:trevd,项目名称:android_packages_apps_tv,代码行数:18,代码来源:TvInputManagerHelper.java

示例14: start

import android.media.tv.TvInputInfo; //导入依赖的package包/类
public void start() {
    if (mStarted) {
        return;
    }
    if (DEBUG) Log.d(TAG, "start");
    mStarted = true;
    mTvInputManager.registerCallback(mInternalCallback, mHandler);
    mInputMap.clear();
    mInputStateMap.clear();
    mInputIdToPartnerInputMap.clear();
    for (TvInputInfo input : mTvInputManager.getTvInputList()) {
        if (DEBUG) Log.d(TAG, "Input detected " + input);
        String inputId = input.getId();
        if (isInBlackList(inputId)) {
            continue;
        }
        mInputMap.put(inputId, input);
        int state = mTvInputManager.getInputState(inputId);
        mInputStateMap.put(inputId, state);
        mInputIdToPartnerInputMap.put(inputId, isPartnerInput(input));
    }
    SoftPreconditions.checkState(mInputStateMap.size() == mInputMap.size(), TAG,
            "mInputStateMap not the same size as mInputMap");
    mContentRatingsManager.update();
}
 
开发者ID:trevd,项目名称:android_packages_apps_tv,代码行数:26,代码来源:TvInputManagerHelper.java

示例15: getPipInputSize

import android.media.tv.TvInputInfo; //导入依赖的package包/类
/**
 * Gets the size of inputs for PIP.
 *
 * <p>The hidden inputs are not counted.
 *
 * @param availableOnly If {@code true}, it counts only available PIP inputs. Please see {@link
 *        PipInput#isAvailable()} for the details of availability.
 */
public int getPipInputSize(boolean availableOnly) {
    int count = 0;
    for (PipInput pipInput : mPipInputMap.values()) {
        if (!pipInput.isHidden() && (!availableOnly || pipInput.mAvailable)) {
            ++count;
        }
        if (pipInput.isPassthrough()) {
            TvInputInfo info = pipInput.getInputInfo();
            // Do not count HDMI ports if a CEC device is directly connected to the port.
            if (info.getParentId() != null && !info.isConnectedToHdmiSwitch()) {
                --count;
            }
        }
    }
    return count;
}
 
开发者ID:trevd,项目名称:android_packages_apps_tv,代码行数:25,代码来源:PipInputManager.java


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