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


Java TvContract.buildInputId方法代码示例

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


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

示例1: SetupUtils

import android.media.tv.TvContract; //导入方法依赖的package包/类
private SetupUtils(TvApplication tvApplication) {
    mTvApplication = tvApplication;
    mSharedPreferences = PreferenceManager.getDefaultSharedPreferences(tvApplication);
    mSetUpInputs = new ArraySet<>();
    mSetUpInputs.addAll(mSharedPreferences.getStringSet(PREF_KEY_SET_UP_INPUTS,
            Collections.emptySet()));
    mKnownInputs = new ArraySet<>();
    mKnownInputs.addAll(mSharedPreferences.getStringSet(PREF_KEY_KNOWN_INPUTS,
            Collections.emptySet()));
    mRecognizedInputs = new ArraySet<>();
    mRecognizedInputs.addAll(mSharedPreferences.getStringSet(PREF_KEY_RECOGNIZED_INPUTS,
            mKnownInputs));
    mIsFirstTune = mSharedPreferences.getBoolean(PREF_KEY_IS_FIRST_TUNE, true);
    mTunerInputId = TvContract.buildInputId(new ComponentName(tvApplication,
            TunerTvInputService.class));
}
 
开发者ID:trevd,项目名称:android_packages_apps_tv,代码行数:17,代码来源:SetupUtils.java

示例2: actuallyWriteData

import android.media.tv.TvContract; //导入方法依赖的package包/类
private static void actuallyWriteData(final Context context, GoogleApiClient gapi) {
        DriveSettingsManager sm = new DriveSettingsManager(context);
        sm.setGoogleDriveSyncable(gapi, new DriveSettingsManager.GoogleDriveListener() {
            @Override
            public void onActionFinished(boolean cloudToLocal) {
                Log.d(TAG, "Action finished " + cloudToLocal);
            }
        });
        try {
            sm.writeToGoogleDrive(DriveId.decodeFromString(sm.getString(R.string.sm_google_drive_id)),
                    ChannelDatabase.getInstance(context).toString());
            GoogleDriveBroadcastReceiver.changeStatus(context,
                    GoogleDriveBroadcastReceiver.EVENT_UPLOAD_COMPLETE);

            final String info = TvContract.buildInputId(TV_INPUT_SERVICE);
            CumulusJobService.requestImmediateSync1(context, info, CumulusJobService.DEFAULT_IMMEDIATE_EPG_DURATION_MILLIS,
                    new ComponentName(context, CumulusJobService.class));
            Log.d(TAG, "Data actually written");
//            Toast.makeText(context, "Channels uploaded", Toast.LENGTH_SHORT).show();
        } catch(Exception e) {
            // Probably invalid drive id. No worries, just let someone know
            Log.e(TAG, e.getMessage() + "");
            Toast.makeText(context, R.string.invalid_file,
                    Toast.LENGTH_SHORT).show();
        }
    }
 
开发者ID:Fleker,项目名称:CumulusTV,代码行数:27,代码来源:ActivityUtils.java

示例3: createSetupActivity

import android.media.tv.TvContract; //导入方法依赖的package包/类
/**
 * Returns a {@link Intent} to launch the tuner TV input service.
 *
 * @param context a {@link Context} instance
 */
public static Intent createSetupActivity(Context context) {
    String inputId = TvContract.buildInputId(new ComponentName(context.getPackageName(),
            TunerTvInputService.class.getName()));

    // Make an intent to launch the setup activity of USB tuner TV input.
    Intent intent = TvCommonUtils.createSetupIntent(
            new Intent(context, TunerSetupActivity.class), inputId);
    intent.putExtra(TvCommonConstants.EXTRA_INPUT_ID, inputId);
    Intent tvActivityIntent = new Intent();
    tvActivityIntent.setComponent(new ComponentName(context, TV_ACTIVITY_CLASS_NAME));
    intent.putExtra(TvCommonConstants.EXTRA_ACTIVITY_AFTER_COMPLETION, tvActivityIntent);
    return intent;
}
 
开发者ID:trevd,项目名称:android_packages_apps_tv,代码行数:19,代码来源:TunerSetupActivity.java

示例4: ChannelDataManager

import android.media.tv.TvContract; //导入方法依赖的package包/类
public ChannelDataManager(Context context) {
    mContext = context;
    mInputId = TvContract.buildInputId(new ComponentName(mContext.getPackageName(),
            TunerTvInputService.class.getName()));
    mChannelsUri = TvContract.buildChannelsUriForInput(mInputId);
    mTunerChannelMap = new ConcurrentHashMap<>();
    mTunerChannelIdMap = new ConcurrentSkipListMap<>();
    mHandlerThread = new HandlerThread("TvInputServiceBackgroundThread");
    mHandlerThread.start();
    mHandler = new Handler(mHandlerThread.getLooper(), this);
    mIsScanning = new AtomicBoolean();
    mScannedChannels = new ConcurrentSkipListSet<>();
    mPreviousScannedChannels = new ConcurrentSkipListSet<>();
}
 
开发者ID:trevd,项目名称:android_packages_apps_tv,代码行数:15,代码来源:ChannelDataManager.java

示例5: getCurrentChannels

import android.media.tv.TvContract; //导入方法依赖的package包/类
/**
 * Goes into the TV guide and obtains the channels currently registered
 * @return An ArrayList of channels
 */
public List<Channel> getCurrentChannels(Context mContext) {
    try {
        ApplicationInfo app = getApplicationContext().getPackageManager().getApplicationInfo(getApplicationContext().getPackageName(), PackageManager.GET_META_DATA);
        Bundle bundle = app.metaData;
        final String service = bundle.getString("TvInputService");
        String channels = TvContract.buildInputId(new ComponentName(getPackageName(), service.substring(getPackageName().length())));
        Uri channelsQuery = TvContract.buildChannelsUriForInput(channels);
        Log.d(TAG, channels + " " + channelsQuery.toString());
        List<Channel> list = new ArrayList<>();
        Cursor cursor = null;
        try {
            cursor = mContext.getContentResolver().query(channelsQuery, null, null, null, null);
            while(cursor != null && cursor.moveToNext()) {
                Channel channel = new Channel()
                        .setNumber(cursor.getString(cursor.getColumnIndex(TvContract.Channels.COLUMN_DISPLAY_NUMBER)))
                        .setName(cursor.getString(cursor.getColumnIndex(TvContract.Channels.COLUMN_DISPLAY_NAME)))
                        .setOriginalNetworkId(cursor.getInt(cursor.getColumnIndex(TvContract.Channels.COLUMN_ORIGINAL_NETWORK_ID)))
                        .setTransportStreamId(cursor.getInt(cursor.getColumnIndex(TvContract.Channels.COLUMN_TRANSPORT_STREAM_ID)))
                        .setServiceId(cursor.getInt(cursor.getColumnIndex(TvContract.Channels.COLUMN_SERVICE_ID)))
                        .setVideoHeight(1080)
                        .setVideoWidth(1920)
                        .setPrograms(getPrograms(getApplicationContext(),
                                TvContract.buildChannelUri(cursor.getInt(cursor.getColumnIndex(TvContract.Channels._ID)))));
                list.add(channel);
            }
        } finally {
            if (cursor != null) {
                cursor.close();
            }
        }
        return list;
    } catch (PackageManager.NameNotFoundException e) {
        e.printStackTrace();
    }
    return null;
}
 
开发者ID:Fleker,项目名称:ChannelSurfer,代码行数:41,代码来源:TvInputProvider.java

示例6: getProgramRightNow

import android.media.tv.TvContract; //导入方法依赖的package包/类
/**
 * Queries the channel list to find the given channel and then queries the EPG (electronic
 * programming guide) to find the program that is playing right now.
 * @param channel The channel you are tuned to
 * @return The current program on provided channel
 */
public Program getProgramRightNow(Channel channel) {
    ApplicationInfo app = null;
    try {
        app = getApplicationContext().getPackageManager().getApplicationInfo(getApplicationContext().getPackageName(), PackageManager.GET_META_DATA);
        Bundle bundle = app.metaData;
        final String service = bundle.getString("TvInputService");
        String channels = TvContract.buildInputId(new ComponentName(getPackageName(), service.substring(getPackageName().length())));
        Log.d(TAG, new ComponentName(getPackageName(), service.substring(getPackageName().length())).flattenToString());

        List<Program> programs = getPrograms(getApplicationContext(),
                TvContract.buildChannelUri(channel.getChannelId()));
        Log.d(TAG, "Program from channel "+TvContract.buildChannelUri(channel.getChannelId()));
        Log.d(TAG, "Program from chanel "+channel.getChannelId());
        Program currentProgram = null;
        for(Program p: programs) {
            if(p.getStartTimeUtcMillis() < new Date().getTime()) {
                currentProgram = p;
            }
        }
        return currentProgram;

    } catch (PackageManager.NameNotFoundException e) {
        e.printStackTrace();
    }
    return null;
}
 
开发者ID:Fleker,项目名称:ChannelSurfer,代码行数:33,代码来源:TvInputProvider.java

示例7: ChannelManager

import android.media.tv.TvContract; //导入方法依赖的package包/类
/**
 * Constructor
 *
 * @param context Application context
 */
public ChannelManager(DtvManager dvbManager, Context context) {
    mContext = context;
    mDvbManager = dvbManager;
    mDTVManger = mDvbManager.getDtvManager();
    mRouteManager = mDvbManager.getRouteManager();
    mScanControl = mDvbManager.getDtvManager().getScanControl();
    mInputId = TvContract.buildInputId(new ComponentName(mContext,
            TvService.class));
    mIpOnlyChannels = new ArrayList<ChannelDescriptor>();
}
 
开发者ID:iWedia,项目名称:iWediaSimpleTvInputService,代码行数:16,代码来源:ChannelManager.java

示例8: onConnected

import android.media.tv.TvContract; //导入方法依赖的package包/类
@Override
public void onConnected(Bundle bundle) {
    if (DEBUG) {
        Log.d(TAG, "Connected - Sync w/ drive");
    }
    //Let's sync with GDrive
    ActivityUtils.writeDriveData(mContext, gapi);

    final String info = TvContract.buildInputId(ActivityUtils.TV_INPUT_SERVICE);
    CumulusJobService.requestImmediateSync1(mContext, info, CumulusJobService.DEFAULT_IMMEDIATE_EPG_DURATION_MILLIS,
            new ComponentName(mContext, CumulusJobService.class));
}
 
开发者ID:Fleker,项目名称:CumulusTV,代码行数:13,代码来源:DataReceiver.java

示例9: getInputId

import android.media.tv.TvContract; //导入方法依赖的package包/类
public static String getInputId(Context context) {
    return TvContract.buildInputId(new ComponentName(context, TunerTvInputService.class));
}
 
开发者ID:trevd,项目名称:android_packages_apps_tv,代码行数:4,代码来源:TunerTvInputService.java

示例10: buildInputId

import android.media.tv.TvContract; //导入方法依赖的package包/类
public static String buildInputId(Context context) {
    return TvContract.buildInputId(new ComponentName(context, TestTvInputService.class));
}
 
开发者ID:trevd,项目名称:android_packages_apps_tv,代码行数:4,代码来源:TestTvInputService.java

示例11: updateChannelMap

import android.media.tv.TvContract; //导入方法依赖的package包/类
private void updateChannelMap() {
    ComponentName component = new ComponentName(BaseTvInputService.this.getPackageName(),
            BaseTvInputService.this.getClass().getName());
    String inputId = TvContract.buildInputId(component);
    mChannelMap = TvContractUtils.buildChannelMap(mContentResolver, inputId);
}
 
开发者ID:googlesamples,项目名称:androidtv-sample-inputs,代码行数:7,代码来源:BaseTvInputService.java


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