Exemplo n.º 1
0
  /*
   * list 列表中是否已经存在当前ip
   */
  private boolean filter(String ip) {
    boolean isExists = false;

    for (ServiceInfo s : serviceInfoList) {
      if (ip.equals(s.getServiceUrl())) {
        isExists = true;
        break;
      }
    }
    return isExists;
  }
Exemplo n.º 2
0
    @Override
    protected void onPostExecute(List<ServiceInfo> result) {

      // TODO Auto-generated method stub
      super.onPostExecute(result);
      // 采用 备用的 本地服务器地址 列表 默认是 2个
      ServiceInfo s1 = new ServiceInfo();
      s1.setServiceName("联通:" + SystemUrlSet.this.getApplication().getString(R.string.host1));
      s1.setServiceUrl(SystemUrlSet.this.getApplication().getString(R.string.host1));
      s1.setPort(SystemUrlSet.this.getApplication().getString(R.string.port1));
      serviceInfoList.add(s1);

      ServiceInfo s2 = new ServiceInfo();
      s2.setServiceName("电信:" + SystemUrlSet.this.getApplication().getString(R.string.host2));
      s2.setServiceUrl(SystemUrlSet.this.getApplication().getString(R.string.host2));
      s2.setPort(SystemUrlSet.this.getApplication().getString(R.string.port2));
      serviceInfoList.add(s2);

      //				ServiceInfo s3 = new ServiceInfo();
      //				s3.setServiceName("本地测试byPoe");
      //				s3.setServiceUrl(SystemUrlSet.this.getApplication().getString(R.string.host3));
      //				s3.setPort(SystemUrlSet.this.getApplication().getString(R.string.port3));
      //				serviceInfoList.add(s3);

      ServiceInfo s4 = MyApplication.getInstance().getServiceInfo();
      if (!filter(s4.getServiceUrl())) {
        serviceInfoList.add(s4);
      }

      if (serviceInfoList.size() > 0) {
        // 设置服务器选择列表
        adapter = new SystemUrlSetAdapter(SystemUrlSet.this, serviceInfoList);
        listView.setAdapter(adapter);
      }
      progressbar.setVisibility(View.GONE);
    }