微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

android.os.RemoteCallbackList的实例源码

项目:Musicoco    文件PlayControlImpl.java   
public PlayControlImpl(Context context) {
    this.context = context;
    this.mSongchangelisteners = new RemoteCallbackList<>();
    this.mStatuschangelisteners = new RemoteCallbackList<>();
    this.mPlayListchangelisteners = new RemoteCallbackList<>();
    this.mDataIsReadyListeners = new RemoteCallbackList<>();

    this.sessionManager = new MediaSessionManager(context,this);
    this.focusManager = new AudioFocusManager(context,this);
    this.manager = PlayController.getMediaController(
            context,focusManager,sessionManager,new NotifyStatusChange(),new NotifySongChange(),new NotifyPlayListChange());
}
项目:Zom-Android    文件ImConnectionAdapter.java   
public ImConnectionAdapter(long providerId,long accountId,ImConnection connection,Remoteimservice service) {
    mProviderId = providerId;
    mAccountId = accountId;
    mConnection = connection;
    mService = service;
    mConnectionListener = new ConnectionListenerAdapter();
    mConnection.addConnectionListener(mConnectionListener);
    if ((connection.getCapability() & ImConnection.CAPABILITY_GROUP_CHAT) != 0) {
        mGroupManager = mConnection.getChatGroupManager();
        mInvitationListener = new InvitationListenerAdapter();
        mGroupManager.setInvitationListener(mInvitationListener);
    }

    mChatSessionManager = new ChatSessionManagerAdapter(this);
    mContactListManager = new ContactListManagerAdapter(this);
    mRemoteConnListeners = new RemoteCallbackList<>();

}
项目:ics-openconnect    文件ExternalOpenVPNService.java   
@Override public void handleMessage(Message msg) {

            RemoteCallbackList<IOpenVPNStatusCallback> callbacks;
            switch (msg.what) {
            case SEND_TOALL:
                if(service ==null || service.get() == null)
                    return;

                callbacks = service.get().mCallbacks;


                // broadcast to all clients the new value.
                final int N = callbacks.beginbroadcast();
                for (int i=0; i<N; i++) {
                    try {
                        sendUpdate(callbacks.getbroadcastItem(i),(UpdateMessage) msg.obj);
                    } catch (remoteexception e) {
                        // The RemoteCallbackList will take care of removing
                        // the dead object for us.
                    }
                }
                callbacks.finishbroadcast();
                break;
            }
        }
项目:network-buffer    文件NetworkService.java   
@Override
public void onCreate() {
  // Todo: make this multi-threaded... someday.
  mScheduledExecutor = Executors.newScheduledThreadPool(1);

  // Start a periodic garbage collection task to check for and cleanup any
  // terminated delay sockets.
  mScheduledExecutor.scheduleAtFixedrate(new Runnable() {
    @Override
    public void run() {
      for (Long handle : mDelaySockets.keySet()) {
        DelaySocket delaySocket = mDelaySockets.get(handle);
        if (delaySocket != null && delaySocket.isTerminated()) {
          delaySocket.close();
          mDelaySockets.remove(handle);
        }
      }
    }
  },4000,TimeUnit.MILLISECONDS);

  mCallbacks = new RemoteCallbackList<INetworkServiceCallback>();
  mnotificationmanager = (notificationmanager) getSystemService(NOTIFICATION_SERVICE);
  mDelaySockets = new ConcurrentHashMap<Long,DelaySocket>();
  showNotification();
}
项目:FullRobolectricTestSample    文件RemoteCallbackListTest.java   
@Test
public void testBasicWiring() throws Exception {
  RemoteCallbackList<Foo> fooRemoteCallbackList = new RemoteCallbackList<Foo>();
  Foo callback = new Foo();
  fooRemoteCallbackList.register(callback);

  fooRemoteCallbackList.beginbroadcast();

  assertthat(fooRemoteCallbackList.getbroadcastItem(0)).isSameAs(callback);
}
项目:NotiziePolitiche    文件FeedRetrieverService.java   
@Override
public void onCreate() {
    super.onCreate();

    try {
        listeners = new RemoteCallbackList<IFeedRetrieverServiceCallback>();
        NotiziePoliticheApplication app = (NotiziePoliticheApplication) getApplication();
        app.firstTimeInitApplication();

        Intent i = new Intent(getApplicationContext(),RefreshAllReceiver.class);
        intentRefreshAll = PendingIntent.getbroadcast(
                getApplicationContext(),i,PendingIntent.FLAG_UPDATE_CURRENT);

        i = new Intent(getApplicationContext(),RemoveExpiredDataReceiver.class);
        intentExpiredData = PendingIntent.getbroadcast(
                getApplicationContext(),PendingIntent.FLAG_UPDATE_CURRENT);

        configureServiceParameters();

    } catch (Exception e) {
        Log.e(getClass().getName(),"Creating the Feeds service",e);
        throw new RuntimeException(e);
    }
}
项目:yyox    文件ConnectionEvent.java   
public ConnectionEvent(RemoteCallbackList<ConnectionCallBack> mCallbackList) {
    this.mCallbackList = mCallbackList;
}

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。