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


Java Util.runOnUI方法代码示例

本文整理汇总了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>());
        }
    });
}
 
开发者ID:PTCE,项目名称:popcorn-android,代码行数:22,代码来源:DeviceService.java

示例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>());
        }
    });
}
 
开发者ID:david-fenton,项目名称:Connect-SDK-Cordova-Plugin,代码行数:19,代码来源:DeviceService.java

示例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;
}
 
开发者ID:david-fenton,项目名称:Connect-SDK-Cordova-Plugin,代码行数:26,代码来源:NetcastTVService.java

示例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);
            }
        }
    });
}
 
开发者ID:PTCE,项目名称:popcorn-android,代码行数:17,代码来源:SimpleDevicePicker.java

示例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);
}
 
开发者ID:david-fenton,项目名称:Connect-SDK-Cordova-Plugin,代码行数:22,代码来源:ConnectableDevice.java

示例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();
        }
    });

}
 
开发者ID:PTCE,项目名称:popcorn-android,代码行数:26,代码来源:DLNAService.java

示例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);
                }
            }
        });
    }
}
 
开发者ID:PTCE,项目名称:popcorn-android,代码行数:22,代码来源:SSDPDiscoveryProvider.java

示例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);
            }
        });
    }
}
 
开发者ID:david-fenton,项目名称:Connect-SDK-Cordova-Plugin,代码行数:18,代码来源:DeviceService.java

示例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);
                }
            }
        });
    }
}
 
开发者ID:david-fenton,项目名称:Connect-SDK-Cordova-Plugin,代码行数:21,代码来源:SSDPDiscoveryProvider.java

示例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);
                }
            }
        });
    }
}
 
开发者ID:david-fenton,项目名称:Connect-SDK-Cordova-Plugin,代码行数:19,代码来源:ZeroconfDiscoveryProvider.java

示例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);
        }
    });
}
 
开发者ID:david-fenton,项目名称:Connect-SDK-Cordova-Plugin,代码行数:12,代码来源:CastDiscoveryProvider.java

示例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();
    }
}
 
开发者ID:david-fenton,项目名称:Connect-SDK-Cordova-Plugin,代码行数:34,代码来源:WebOSTVService.java

示例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);
            }
        }
    });
}
 
开发者ID:PTCE,项目名称:popcorn-android,代码行数:11,代码来源:FireTVDiscoveryProvider.java

示例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();
        }
    });
}
 
开发者ID:david-fenton,项目名称:Connect-SDK-Cordova-Plugin,代码行数:10,代码来源:DevicePickerListView.java

示例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();
        }
    });
}
 
开发者ID:david-fenton,项目名称:Connect-SDK-Cordova-Plugin,代码行数:10,代码来源:DevicePickerListView.java


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