本文整理汇总了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));
}
示例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();
}
}
示例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;
}
示例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<>();
}
示例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;
}
示例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;
}
示例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>();
}
示例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));
}
示例9: getInputId
import android.media.tv.TvContract; //导入方法依赖的package包/类
public static String getInputId(Context context) {
return TvContract.buildInputId(new ComponentName(context, TunerTvInputService.class));
}
示例10: buildInputId
import android.media.tv.TvContract; //导入方法依赖的package包/类
public static String buildInputId(Context context) {
return TvContract.buildInputId(new ComponentName(context, TestTvInputService.class));
}
示例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);
}