本文整理汇总了Java中com.connectsdk.core.Util.runOnUI方法的典型用法代码示例。如果您正苦于以下问题:Java Util.runOnUI方法的具体用法?Java Util.runOnUI怎么用?Java Util.runOnUI使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.connectsdk.core.Util
的用法示例。
在下文中一共展示了Util.runOnUI方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addCapabilities
import com.connectsdk.core.Util; //导入方法依赖的package包/类
public void addCapabilities(final List<String> capabilities) {
if (capabilities == null)
return;
for (String capability : capabilities) {
if (capability == null || capability.length() == 0 || mCapabilities.contains(capability))
continue;
mCapabilities.add(capability);
}
Util.runOnUI(new Runnable() {
@Override
public void run() {
if (listener != null)
listener.onCapabilitiesUpdated(DeviceService.this, capabilities, new ArrayList<String>());
}
});
}
示例2: addCapability
import com.connectsdk.core.Util; //导入方法依赖的package包/类
public void addCapability(final String capability) {
if (capability == null || capability.length() == 0 || this.mCapabilities.contains(capability))
return;
this.mCapabilities.add(capability);
Util.runOnUI(new Runnable() {
@Override
public void run() {
List<String> added = new ArrayList<String>();
added.add(capability);
if (listener != null)
listener.onCapabilitiesUpdated(DeviceService.this, added, new ArrayList<String>());
}
});
}
示例3: disconnect
import com.connectsdk.core.Util; //导入方法依赖的package包/类
@Override
public void disconnect() {
endPairing(null);
connected = false;
if (mServiceReachability != null)
mServiceReachability.stop();
Util.runOnUI(new Runnable() {
@Override
public void run() {
if (listener != null)
listener.onDisconnect(NetcastTVService.this, null);
}
});
if (httpServer != null) {
httpServer.stop();
httpServer = null;
}
state = State.INITIAL;
}
示例4: onDeviceReady
import com.connectsdk.core.Util; //导入方法依赖的package包/类
@Override
public void onDeviceReady(final ConnectableDevice device) {
Util.runOnUI(new Runnable() {
@Override
public void run() {
hidePairingDialog();
if (device == pendingDevice) {
activeDevice = pendingDevice;
if (listener != null)
listener.onPickDevice(pendingDevice);
}
}
});
}
示例5: addService
import com.connectsdk.core.Util; //导入方法依赖的package包/类
/**
* Adds a DeviceService to the ConnectableDevice instance. Only one instance of each DeviceService type (webOS, Netcast, etc) may be attached to a single ConnectableDevice instance. If a device contains your service type already, your service will not be added.
*
* @param service DeviceService to be added
*/
public void addService(DeviceService service) {
final List<String> added = getMismatchCapabilities(service.getCapabilities(), getCapabilities());
service.setListener(this);
Util.runOnUI(new Runnable() {
@Override
public void run() {
for (ConnectableDeviceListener listener : listeners)
listener.onCapabilityUpdated(ConnectableDevice.this, added, new ArrayList<String>());
}
});
services.put(service.getServiceName(), service);
}
示例6: disconnect
import com.connectsdk.core.Util; //导入方法依赖的package包/类
@Override
public void disconnect() {
connected = false;
if (mServiceReachability != null)
mServiceReachability.stop();
Util.runOnUI(new Runnable() {
@Override
public void run() {
if (listener != null) {
listener.onDisconnect(DLNAService.this, null);
}
}
});
Util.runInBackground(new Runnable() {
@Override
public void run() {
httpServer.stop();
}
});
}
示例7: notifyListenersOfNewService
import com.connectsdk.core.Util; //导入方法依赖的package包/类
private void notifyListenersOfNewService(ServiceDescription service) {
List<String> serviceIds = serviceIdsForFilter(service.getServiceFilter());
for (String serviceId : serviceIds) {
ServiceDescription _newService = service.clone();
_newService.setServiceID(serviceId);
final ServiceDescription newService = _newService;
Util.runOnUI(new Runnable() {
@Override
public void run() {
for (DiscoveryProviderListener listener : serviceListeners) {
listener.onServiceAdded(SSDPDiscoveryProvider.this, newService);
}
}
});
}
}
示例8: reportConnected
import com.connectsdk.core.Util; //导入方法依赖的package包/类
protected void reportConnected(boolean ready) {
if (listener == null)
return;
// only run callback on main thread if the callback is leaving the SDK
if (listener instanceof ConnectableDevice)
listener.onConnectionSuccess(this);
else {
Util.runOnUI(new Runnable() {
@Override
public void run() {
if (listener != null)
listener.onConnectionSuccess(DeviceService.this);
}
});
}
}
示例9: notifyListenersOfLostService
import com.connectsdk.core.Util; //导入方法依赖的package包/类
private void notifyListenersOfLostService(ServiceDescription service) {
List<String> serviceIds = serviceIdsForFilter(service.getServiceFilter());
for (String serviceId : serviceIds) {
ServiceDescription _newService = service.clone();
_newService.setServiceID(serviceId);
final ServiceDescription newService = _newService;
Util.runOnUI(new Runnable() {
@Override
public void run() {
for (DiscoveryProviderListener listener : serviceListeners) {
listener.onServiceRemoved(SSDPDiscoveryProvider.this, newService);
}
}
});
}
}
示例10: serviceRemoved
import com.connectsdk.core.Util; //导入方法依赖的package包/类
@Override
public void serviceRemoved(ServiceEvent ev) {
@SuppressWarnings("deprecation")
String uuid = ev.getInfo().getHostAddress();
final ServiceDescription service = foundServices.get(uuid);
if (service != null) {
Util.runOnUI(new Runnable() {
@Override
public void run() {
for (DiscoveryProviderListener listener : serviceListeners) {
listener.onServiceRemoved(ZeroconfDiscoveryProvider.this, service);
}
}
});
}
}
示例11: rescan
import com.connectsdk.core.Util; //导入方法依赖的package包/类
@Override
public void rescan() {
Util.runOnUI(new Runnable() {
@Override
public void run() {
mMediaRouter.addCallback(mMediaRouteSelector, mMediaRouterCallback,
MediaRouter.CALLBACK_FLAG_REQUEST_DISCOVERY);
}
});
}
示例12: disconnect
import com.connectsdk.core.Util; //导入方法依赖的package包/类
@Override
public void disconnect() {
Log.d(Util.T, "attempting to disconnect to " + serviceDescription.getIpAddress());
Util.runOnUI(new Runnable() {
@Override
public void run() {
if (listener != null)
listener.onDisconnect(WebOSTVService.this, null);
}
});
if (socket != null) {
socket.setListener(null);
socket.disconnect();
socket = null;
}
if (mAppToAppIdMappings != null)
mAppToAppIdMappings.clear();
if (mWebAppSessions != null) {
Enumeration<WebOSWebAppSession> iterator = mWebAppSessions.elements();
while (iterator.hasMoreElements()) {
WebOSWebAppSession session = iterator.nextElement();
session.disconnectFromWebApp();
}
mWebAppSessions.clear();
}
}
示例13: notifyListenersThatDiscoveryFailed
import com.connectsdk.core.Util; //导入方法依赖的package包/类
private void notifyListenersThatDiscoveryFailed(final ServiceCommandError error) {
Util.runOnUI(new Runnable() {
@Override
public void run() {
for (DiscoveryProviderListener listener : serviceListeners) {
listener.onServiceDiscoveryFailed(FireTVDiscoveryProvider.this, error);
}
}
});
}
示例14: onDiscoveryFailed
import com.connectsdk.core.Util; //导入方法依赖的package包/类
@Override
public void onDiscoveryFailed(DiscoveryManager manager, ServiceCommandError error) {
Util.runOnUI(new Runnable () {
@Override
public void run() {
pickerAdapter.clear();
}
});
}
示例15: onDeviceUpdated
import com.connectsdk.core.Util; //导入方法依赖的package包/类
@Override
public void onDeviceUpdated(DiscoveryManager manager, final ConnectableDevice device) {
Util.runOnUI(new Runnable () {
@Override
public void run() {
pickerAdapter.notifyDataSetChanged();
}
});
}