Exemplo n.º 1
0
 /* package private */ static String getExtensions(Capabilities capabilities) {
   if (capabilities == null || capabilities.getSupportedExtensions().isEmpty()) {
     return "";
   }
   StringBuilder extensions = new StringBuilder();
   for (String capability : capabilities.getSupportedExtensions()) {
     extensions.append(EXTENSION_SEPARATOR).append(capability);
   }
   return extensions.substring(EXTENSION_SEPARATOR.length());
 }
Exemplo n.º 2
0
  private void displayCapabilities(Capabilities capabilities) {
    CheckBox imageCSh = (CheckBox) findViewById(R.id.image_sharing);
    CheckBox videoCSh = (CheckBox) findViewById(R.id.video_sharing);
    CheckBox ft = (CheckBox) findViewById(R.id.file_transfer);
    CheckBox im = (CheckBox) findViewById(R.id.im);
    CheckBox geoloc = (CheckBox) findViewById(R.id.geoloc_push);
    TextView extensions = (TextView) findViewById(R.id.extensions);
    TextView timestamp = (TextView) findViewById(R.id.last_refresh);
    CheckBox automata = (CheckBox) findViewById(R.id.automata);

    if (capabilities != null) {
      // Set capabilities
      imageCSh.setChecked(capabilities.hasCapabilities(Capabilities.CAPABILITY_IMAGE_SHARING));
      videoCSh.setChecked(capabilities.hasCapabilities(Capabilities.CAPABILITY_VIDEO_SHARING));
      ft.setChecked(capabilities.hasCapabilities(Capabilities.CAPABILITY_FILE_TRANSFER));
      im.setChecked(capabilities.hasCapabilities(Capabilities.CAPABILITY_IM));
      geoloc.setChecked(capabilities.hasCapabilities(Capabilities.CAPABILITY_GEOLOC_PUSH));
    }
    // Set extensions
    extensions.setVisibility(View.VISIBLE);
    extensions.setText(getExtensions(capabilities));
    automata.setChecked((capabilities != null) && capabilities.isAutomata());
    timestamp.setText(
        (capabilities != null)
            ? DateUtils.getRelativeTimeSpanString(
                capabilities.getTimestamp(),
                System.currentTimeMillis(),
                DateUtils.MINUTE_IN_MILLIS,
                DateUtils.FORMAT_ABBREV_RELATIVE)
            : "");
  }