本文整理汇总了Java中com.connectsdk.service.capability.WebAppLauncher类的典型用法代码示例。如果您正苦于以下问题:Java WebAppLauncher类的具体用法?Java WebAppLauncher怎么用?Java WebAppLauncher使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
WebAppLauncher类属于com.connectsdk.service.capability包,在下文中一共展示了WebAppLauncher类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getPriorityLevel
import com.connectsdk.service.capability.WebAppLauncher; //导入依赖的package包/类
@Override
public CapabilityPriorityLevel getPriorityLevel(Class<? extends CapabilityMethods> clazz) {
if (clazz.equals(MediaPlayer.class)) {
return getMediaPlayerCapabilityLevel();
}
else if (clazz.equals(MediaControl.class)) {
return getMediaControlCapabilityLevel();
}
else if (clazz.equals(VolumeControl.class)) {
return getVolumeControlCapabilityLevel();
}
else if (clazz.equals(WebAppLauncher.class)) {
return getWebAppLauncherCapabilityLevel();
}
return CapabilityPriorityLevel.NOT_SUPPORTED;
}
示例2: onCreate
import com.connectsdk.service.capability.WebAppLauncher; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_fullscreen);
mLaunchButton = (Button) findViewById(R.id.launchButton);
mLaunchButton.setOnClickListener(mLaunchClickListener);
mCloseButton = (Button) findViewById(R.id.closeButton);
mCloseButton.setOnClickListener(mCloseClickListener);
mSendButton = (Button) findViewById(R.id.sendButton);
mSendButton.setOnClickListener(sendClickListener);
mMessageText = (EditText) findViewById(R.id.messageText);
mStatusTextView = (TextView) findViewById(R.id.statusTextView);
DiscoveryManager.init(getApplicationContext());
CapabilityFilter webAppFilter = new CapabilityFilter(WebAppLauncher.Launch, WebAppLauncher.Close, WebAppLauncher.Message_Send);
DiscoveryManager.getInstance().setCapabilityFilters(webAppFilter);
DiscoveryManager.getInstance().start();
mDevicePicker = new DevicePicker(this);
}
示例3: onClick
import com.connectsdk.service.capability.WebAppLauncher; //导入依赖的package包/类
@Override
public void onClick(View v) {
if (mWebAppSession != null) {
mWebAppSession.setWebAppSessionListener(null);
mWebAppSession.disconnectFromWebApp();
mWebAppSession = null;
launchWebAppButton.setEnabled(true);
joinWebAppButton.setEnabled(getTv().hasCapability(WebAppLauncher.Join));
sendMessageButton.setEnabled(false);
sendJSONButton.setEnabled(false);
leaveWebAppButton.setEnabled(false);
closeWebAppButton.setEnabled(false);
isLaunched = false;
}
}
示例4: onWebAppSessionDisconnect
import com.connectsdk.service.capability.WebAppLauncher; //导入依赖的package包/类
@Override
public void onWebAppSessionDisconnect(WebAppSession webAppSession) {
Log.d("LG", "Device was disconnected");
if (webAppSession != mWebAppSession) {
webAppSession.setWebAppSessionListener(null);
return;
}
launchWebAppButton.setEnabled(true);
if (getTv() != null) joinWebAppButton.setEnabled(getTv().hasCapability(WebAppLauncher.Join));
sendMessageButton.setEnabled(false);
sendJSONButton.setEnabled(false);
leaveWebAppButton.setEnabled(false);
closeWebAppButton.setEnabled(false);
mWebAppSession.setWebAppSessionListener(null);
mWebAppSession = null;
isLaunched = false;
}
示例5: onSuccess
import com.connectsdk.service.capability.WebAppLauncher; //导入依赖的package包/类
@Override
public void onSuccess(Object response) {
if (getTv() == null)
return;
if (getTv().hasCapability(WebAppLauncher.Message_Send_JSON))
sendJSONButton.setEnabled(true);
if (getTv().hasCapability(WebAppLauncher.Message_Send))
sendMessageButton.setEnabled(true);
leaveWebAppButton.setEnabled(getTv().hasCapability(WebAppLauncher.Disconnect));
closeWebAppButton.setEnabled(true);
launchWebAppButton.setEnabled(false);
isLaunched = true;
}
示例6: updateCapabilities
import com.connectsdk.service.capability.WebAppLauncher; //导入依赖的package包/类
@Override
protected void updateCapabilities() {
List<String> capabilities = new ArrayList<String>();
Collections.addAll(capabilities, MediaPlayer.Capabilities);
capabilities.add(Subtitle_WebVTT);
Collections.addAll(capabilities, VolumeControl.Capabilities);
capabilities.add(Play);
capabilities.add(Pause);
capabilities.add(Stop);
capabilities.add(Duration);
capabilities.add(Seek);
capabilities.add(Position);
capabilities.add(PlayState);
capabilities.add(PlayState_Subscribe);
capabilities.add(WebAppLauncher.Launch);
capabilities.add(Message_Send);
capabilities.add(Message_Receive);
capabilities.add(Message_Send_JSON);
capabilities.add(Message_Receive_JSON);
capabilities.add(WebAppLauncher.Connect);
capabilities.add(WebAppLauncher.Disconnect);
capabilities.add(WebAppLauncher.Join);
capabilities.add(WebAppLauncher.Close);
setCapabilities(capabilities);
}
示例7: closeLaunchSession
import com.connectsdk.service.capability.WebAppLauncher; //导入依赖的package包/类
/**
* Closes the session on the first screen device. Depending on the sessionType, the associated service will have different ways of handling the close functionality.
*
* @param launchSession LaunchSession to close
* @param listener (optional) listener to be called on success/failure
*/
public void closeLaunchSession(LaunchSession launchSession, ResponseListener<Object> listener) {
if (launchSession == null) {
Util.postError(listener, new ServiceCommandError(0, "You must provide a valid LaunchSession", null));
return;
}
DeviceService service = launchSession.getService();
if (service == null) {
Util.postError(listener, new ServiceCommandError(0, "There is no service attached to this launch session", null));
return;
}
switch (launchSession.getSessionType()) {
case App:
if (service instanceof Launcher)
((Launcher) service).closeApp(launchSession, listener);
break;
case Media:
if (service instanceof MediaPlayer)
((MediaPlayer) service).closeMedia(launchSession, listener);
break;
case ExternalInputPicker:
if (service instanceof ExternalInputControl)
((ExternalInputControl) service).closeInputPicker(launchSession, listener);
break;
case WebApp:
if (service instanceof WebAppLauncher)
((WebAppLauncher) service).closeWebApp(launchSession, listener);
break;
case Unknown:
default:
Util.postError(listener, new ServiceCommandError(0, "This DeviceService does not know ho to close this LaunchSession", null));
break;
}
}
示例8: webAppLauncher_launchWebApp
import com.connectsdk.service.capability.WebAppLauncher; //导入依赖的package包/类
@CommandMethod
public void webAppLauncher_launchWebApp(JSCommand command, JSONObject args) throws JSONException {
String webAppId = args.getString("webAppId");
JSONObject params = args.optJSONObject("params");
if (params != null && device.hasCapability(WebAppLauncher.Launch_Params))
device.getWebAppLauncher().launchWebApp(webAppId, params, command.getWebAppLaunchListener());
else
device.getWebAppLauncher().launchWebApp(webAppId, command.getWebAppLaunchListener());
}
示例9: updateCapabilities
import com.connectsdk.service.capability.WebAppLauncher; //导入依赖的package包/类
@Override
protected void updateCapabilities() {
List<String> capabilities = new ArrayList<String>();
Collections.addAll(capabilities, MediaPlayer.Capabilities);
Collections.addAll(capabilities, VolumeControl.Capabilities);
capabilities.add(Play);
capabilities.add(Pause);
capabilities.add(Stop);
capabilities.add(Duration);
capabilities.add(Seek);
capabilities.add(Position);
capabilities.add(PlayState);
capabilities.add(Subtitles_Vtt);
capabilities.add(PlayState_Subscribe);
capabilities.add(WebAppLauncher.Launch);
capabilities.add(Message_Send);
capabilities.add(Message_Receive);
capabilities.add(Message_Send_JSON);
capabilities.add(Message_Receive_JSON);
capabilities.add(WebAppLauncher.Connect);
capabilities.add(WebAppLauncher.Disconnect);
capabilities.add(WebAppLauncher.Join);
capabilities.add(WebAppLauncher.Close);
setCapabilities(capabilities);
}
示例10: testGetPriorityLevel
import com.connectsdk.service.capability.WebAppLauncher; //导入依赖的package包/类
@Test
public void testGetPriorityLevel() {
Assert.assertEquals(CapabilityMethods.CapabilityPriorityLevel.HIGH,
service.getPriorityLevel(MediaPlayer.class));
Assert.assertEquals(CapabilityMethods.CapabilityPriorityLevel.NOT_SUPPORTED,
service.getPriorityLevel(ExternalInputControl.class));
Assert.assertEquals(CapabilityMethods.CapabilityPriorityLevel.NOT_SUPPORTED,
service.getPriorityLevel(KeyControl.class));
Assert.assertEquals(CapabilityMethods.CapabilityPriorityLevel.NOT_SUPPORTED,
service.getPriorityLevel(Launcher.class));
Assert.assertEquals(CapabilityMethods.CapabilityPriorityLevel.HIGH,
service.getPriorityLevel(MediaControl.class));
Assert.assertEquals(CapabilityMethods.CapabilityPriorityLevel.NOT_SUPPORTED,
service.getPriorityLevel(MouseControl.class));
Assert.assertEquals(CapabilityMethods.CapabilityPriorityLevel.NOT_SUPPORTED,
service.getPriorityLevel(PlaylistControl.class));
Assert.assertEquals(CapabilityMethods.CapabilityPriorityLevel.NOT_SUPPORTED,
service.getPriorityLevel(PowerControl.class));
Assert.assertEquals(CapabilityMethods.CapabilityPriorityLevel.NOT_SUPPORTED,
service.getPriorityLevel(TextInputControl.class));
Assert.assertEquals(CapabilityMethods.CapabilityPriorityLevel.NOT_SUPPORTED,
service.getPriorityLevel(ToastControl.class));
Assert.assertEquals(CapabilityMethods.CapabilityPriorityLevel.NOT_SUPPORTED,
service.getPriorityLevel(TVControl.class));
Assert.assertEquals(CapabilityMethods.CapabilityPriorityLevel.NOT_SUPPORTED,
service.getPriorityLevel(VolumeControl.class));
Assert.assertEquals(CapabilityMethods.CapabilityPriorityLevel.NOT_SUPPORTED,
service.getPriorityLevel(WebAppLauncher.class));
Assert.assertEquals(CapabilityMethods.CapabilityPriorityLevel.NOT_SUPPORTED,
service.getPriorityLevel(null));
}
示例11: setTv
import com.connectsdk.service.capability.WebAppLauncher; //导入依赖的package包/类
public void setTv(ConnectableDevice tv)
{
mTv = tv;
if (tv == null) {
launcher = null;
mediaPlayer = null;
mediaControl = null;
tvControl = null;
volumeControl = null;
toastControl = null;
textInputControl = null;
mouseControl = null;
externalInputControl = null;
powerControl = null;
keyControl = null;
webAppLauncher = null;
disableButtons();
}
else {
launcher = mTv.getCapability(Launcher.class);
mediaPlayer = mTv.getCapability(MediaPlayer.class);
mediaControl = mTv.getCapability(MediaControl.class);
tvControl = mTv.getCapability(TVControl.class);
volumeControl = mTv.getCapability(VolumeControl.class);
toastControl = mTv.getCapability(ToastControl.class);
textInputControl = mTv.getCapability(TextInputControl.class);
mouseControl = mTv.getCapability(MouseControl.class);
externalInputControl = mTv.getCapability(ExternalInputControl.class);
powerControl = mTv.getCapability(PowerControl.class);
keyControl = mTv.getCapability(KeyControl.class);
webAppLauncher = mTv.getCapability(WebAppLauncher.class);
enableButtons();
}
}
示例12: getWebAppLauncher
import com.connectsdk.service.capability.WebAppLauncher; //导入依赖的package包/类
@Override
public WebAppLauncher getWebAppLauncher() {
return this;
}
示例13: testGetCapabilities
import com.connectsdk.service.capability.WebAppLauncher; //导入依赖的package包/类
@Test
public void testGetCapabilities() {
Set<String> expectedCapabilities = new HashSet<String>(Arrays.asList(
MediaPlayer.Display_Image,
MediaPlayer.Play_Video,
MediaPlayer.Play_Audio,
MediaPlayer.Close,
MediaPlayer.MetaData_Title,
MediaPlayer.MetaData_Description,
MediaPlayer.MetaData_Thumbnail,
MediaPlayer.MetaData_MimeType,
MediaPlayer.MediaInfo_Get,
MediaPlayer.MediaInfo_Subscribe,
VolumeControl.Volume_Get,
VolumeControl.Volume_Set,
VolumeControl.Volume_Up_Down,
VolumeControl.Volume_Subscribe,
VolumeControl.Mute_Get,
VolumeControl.Mute_Set,
VolumeControl.Mute_Subscribe,
MediaControl.Play,
MediaControl.Pause,
MediaControl.Stop,
MediaControl.Duration,
MediaControl.Seek,
MediaControl.Position,
MediaControl.PlayState,
MediaPlayer.Subtitle_WebVTT,
MediaControl.PlayState_Subscribe,
WebAppLauncher.Launch,
WebAppLauncher.Message_Send,
WebAppLauncher.Message_Receive,
WebAppLauncher.Message_Send_JSON,
WebAppLauncher.Message_Receive_JSON,
WebAppLauncher.Connect,
WebAppLauncher.Disconnect,
WebAppLauncher.Join,
WebAppLauncher.Close
));
Set<String> capabilities = new HashSet<String>(service.getCapabilities());
Assert.assertEquals(expectedCapabilities, capabilities);
}
示例14: getPriorityLevel
import com.connectsdk.service.capability.WebAppLauncher; //导入依赖的package包/类
@Override
public CapabilityPriorityLevel getPriorityLevel(Class<? extends CapabilityMethods> clazz) {
if (clazz.equals(MediaPlayer.class)) {
return getMediaPlayerCapabilityLevel();
}
else if (clazz.equals(MediaControl.class)) {
return getMediaControlCapabilityLevel();
}
else if (clazz.equals(Launcher.class)) {
return getLauncherCapabilityLevel();
}
else if (clazz.equals(TVControl.class)) {
return getTVControlCapabilityLevel();
}
else if (clazz.equals(VolumeControl.class)) {
return getVolumeControlCapabilityLevel();
}
else if (clazz.equals(ExternalInputControl.class)) {
return getExternalInputControlPriorityLevel();
}
else if (clazz.equals(MouseControl.class)) {
return getMouseControlCapabilityLevel();
}
else if (clazz.equals(TextInputControl.class)) {
return getTextInputControlCapabilityLevel();
}
else if (clazz.equals(PowerControl.class)) {
return getPowerControlCapabilityLevel();
}
else if (clazz.equals(KeyControl.class)) {
return getKeyControlCapabilityLevel();
}
else if (clazz.equals(ToastControl.class)) {
return getToastControlCapabilityLevel();
}
else if (clazz.equals(WebAppLauncher.class)) {
return getWebAppLauncherCapabilityLevel();
}
else if (clazz.equals(PlaylistControl.class)) {
return getPlaylistControlCapabilityLevel();
}
return CapabilityPriorityLevel.NOT_SUPPORTED;
}
示例15: getWebAppLauncher
import com.connectsdk.service.capability.WebAppLauncher; //导入依赖的package包/类
/**************
Web App Launcher
**************/
@Override
public WebAppLauncher getWebAppLauncher() {
return this;
}