Exemple #1
0
 @Override
 public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) {
   RosterItem item = (RosterItem) parent.getItemAtPosition(position);
   if (item.isGroup()) {
     String name = item.getName();
     if (!name.equals(getString(R.string.Nogroup))
         && !name.equals(getString(R.string.SelfGroup))
         && !name.equals(getString(R.string.MUC))
         && !name.equals(getString(R.string.Privates))
         && !name.equals(getString(R.string.ActiveChats)))
       RosterDialogs.renameGroupDialog(this, item.getAccount(), item.getName());
   } else if (item.isAccount()) {
     RosterDialogs.AccountMenuDialog(this, item);
   } else if (item.isEntry()) {
     String j = item.getEntry().getUser();
     if (!service.getPrivateMessages(item.getAccount()).contains(j))
       RosterDialogs.ContactMenuDialog(this, item);
     else RosterDialogs.PrivateMenuDialog(this, item);
   } else if (item.isSelf()) {
     RosterDialogs.SelfContactMenuDialog(this, item);
   } else if (item.isMuc()) {
     MucDialogs.roomMenu(this, item.getAccount(), item.getName());
   }
   return true;
 }
Exemple #2
0
  @Override
  public void onItemClick(AdapterView<?> parent, View v, int position, long id) {
    RosterItem item = (RosterItem) parent.getItemAtPosition(position);
    String name = item.getName();
    String account = item.getAccount();

    if (item.isGroup() || item.isAccount()) {
      if (item.isCollapsed()) {
        while (service.getCollapsedGroups().contains(name))
          service.getCollapsedGroups().remove(name);
        item.setCollapsed(false);
      } else {
        service.getCollapsedGroups().add(name);
        item.setCollapsed(true);
      }
      updateList();
    } else if (item.isEntry() || item.isSelf()) {
      RosterEntry re = item.getEntry();
      String jid = re.getUser();
      Intent i = new Intent(this, Chat.class);
      i.putExtra("account", account);
      i.putExtra("jid", jid);
      startActivity(i);
    } else if (item.isMuc()) {
      Intent i = new Intent(this, Chat.class);
      i.putExtra("account", account);
      i.putExtra("jid", item.getName());
      startActivity(i);
    }
  }