static void handle(Context context, AbsContactItem item) {
   if (item == VERIFY) {
     SystemMessageActivity.start(context);
   } else if (item == NORMAL_TEAM) {
     TeamListActivity.start(context, ItemTypes.TEAMS.NORMAL_TEAM);
   } else if (item == ADVANCED_TEAM) {
     TeamListActivity.start(context, ItemTypes.TEAMS.ADVANCED_TEAM);
   } else if (item == MY_COMPUTER) {
     SessionHelper.startP2PSession(context, DemoCache.getAccount());
   } else if (item == BLACK_LIST) {
     BlackListActivity.start(context);
   }
 }
  public void init() {
    if (inited) {
      return;
    }

    // init thread pool
    executor =
        new NimTaskExecutor(
            "NIM_HTTP_TASK_EXECUTOR", new NimTaskExecutor.Config(1, 3, 10 * 1000, true));

    // init HttpClient supporting multi thread access
    HttpParams httpParams = new BasicHttpParams();
    // 设置最大连接数
    ConnManagerParams.setMaxTotalConnections(httpParams, MAX_CONNECTIONS);
    // 设置获取连接的最大等待时间
    ConnManagerParams.setTimeout(httpParams, WAIT_TIMEOUT);
    // 设置每个路由最大连接数
    ConnManagerParams.setMaxConnectionsPerRoute(
        httpParams, new ConnPerRouteBean(MAX_ROUTE_CONNECTIONS));
    // 设置连接超时时间
    HttpConnectionParams.setConnectionTimeout(httpParams, CONNECT_TIMEOUT);
    // 设置读取超时时间
    HttpConnectionParams.setSoTimeout(httpParams, READ_TIMEOUT);

    SchemeRegistry registry = new SchemeRegistry();
    registry.register(new Scheme("http", PlainSocketFactory.getSocketFactory(), 80));
    registry.register(new Scheme("https", SSLSocketFactory.getSocketFactory(), 443));

    SSLSocketFactory.getSocketFactory().setHostnameVerifier(new AllowAllHostnameVerifier());

    connManager = new ThreadSafeClientConnManager(httpParams, registry);
    client = new DefaultHttpClient(connManager, httpParams);

    uiHandler = new Handler(DemoCache.getContext().getMainLooper());

    inited = true;
  }
Example #3
0
 public void initLocalSurfaceView() {
   avChatSurface.initSmallSurfaceView(DemoCache.getAccount());
 }
Example #4
0
 /**
  * 初始化大小图像
  *
  * @param largeAccount 对方的帐号
  */
 public void initAllSurfaceView(String largeAccount) {
   avChatSurface.initLargeSurfaceView(largeAccount);
   avChatSurface.initSmallSurfaceView(DemoCache.getAccount());
 }
 public AVChatSoundPlayer() {
   this.context = DemoCache.getContext();
 }