当前位置: 首页>>代码示例>>Java>>正文


Java GroupUtil类代码示例

本文整理汇总了Java中org.thoughtcrime.securesms.util.GroupUtil的典型用法代码示例。如果您正苦于以下问题:Java GroupUtil类的具体用法?Java GroupUtil怎么用?Java GroupUtil使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


GroupUtil类属于org.thoughtcrime.securesms.util包,在下文中一共展示了GroupUtil类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: initializeExistingGroup

import org.thoughtcrime.securesms.util.GroupUtil; //导入依赖的package包/类
private void initializeExistingGroup() {
  final String encodedGroupId = RecipientFactory.getRecipientForId(this, getIntent().getLongExtra(GROUP_RECIPIENT_EXTRA, -1), true)
                                                .getNumber();
  byte[] groupId;
  try {
    groupId = GroupUtil.getDecodedId(encodedGroupId);
  } catch (IOException ioe) {
    Log.w(TAG, "Couldn't decode the encoded groupId passed in via intent", ioe);
    groupId = null;
  }
  if (groupId != null) {
    new FillExistingGroupInfoAsyncTask(this).execute(groupId);
  } else {
    groupName.setEnabled(true);
    avatar.setEnabled(true);
    recipientsEditor.setVisibility(View.VISIBLE);
    contactsButton.setVisibility(View.VISIBLE);
  }
}
 
开发者ID:XecureIT,项目名称:PeSanKita-android,代码行数:20,代码来源:GroupCreateActivity.java

示例2: create

import org.thoughtcrime.securesms.util.GroupUtil; //导入依赖的package包/类
public void create(byte[] groupId, String title, List<String> members, String owner,
                   List<String> admins, SignalServiceAttachmentPointer avatar, String relay)
{
  ContentValues contentValues = new ContentValues();
  contentValues.put(GROUP_ID, GroupUtil.getEncodedId(groupId));
  contentValues.put(TITLE, title);
  contentValues.put(MEMBERS, Util.join(members, ","));
  contentValues.put(OWNER, owner);
  contentValues.put(ADMINS, Util.join(admins, ","));

  if (avatar != null) {
    contentValues.put(AVATAR_ID, avatar.getId());
    contentValues.put(AVATAR_KEY, avatar.getKey());
    contentValues.put(AVATAR_CONTENT_TYPE, avatar.getContentType());
  }

  contentValues.put(AVATAR_RELAY, relay);
  contentValues.put(TIMESTAMP, System.currentTimeMillis());
  contentValues.put(ACTIVE, 1);

  databaseHelper.getWritableDatabase().insert(TABLE_NAME, null, contentValues);
  notifyConversationListListeners();
}
 
开发者ID:XecureIT,项目名称:PeSanKita-android,代码行数:24,代码来源:GroupDatabase.java

示例3: update

import org.thoughtcrime.securesms.util.GroupUtil; //导入依赖的package包/类
public void update(byte[] groupId, String title, SignalServiceAttachmentPointer avatar) {
  ContentValues contentValues = new ContentValues();
  if (title != null) contentValues.put(TITLE, title);

  if (avatar != null) {
    contentValues.put(AVATAR_ID, avatar.getId());
    contentValues.put(AVATAR_CONTENT_TYPE, avatar.getContentType());
    contentValues.put(AVATAR_KEY, avatar.getKey());
  }

  databaseHelper.getWritableDatabase().update(TABLE_NAME, contentValues,
                                              GROUP_ID + " = ?",
                                              new String[] {GroupUtil.getEncodedId(groupId)});

  RecipientFactory.clearCache(context);
  notifyDatabaseListeners();
  notifyConversationListListeners();
}
 
开发者ID:XecureIT,项目名称:PeSanKita-android,代码行数:19,代码来源:GroupDatabase.java

示例4: getCurrentMembers

import org.thoughtcrime.securesms.util.GroupUtil; //导入依赖的package包/类
private List<String> getCurrentMembers(byte[] id) {
  Cursor cursor = null;

  try {
    cursor = databaseHelper.getReadableDatabase().query(TABLE_NAME, new String[] {MEMBERS},
                                                        GROUP_ID + " = ?",
                                                        new String[] {GroupUtil.getEncodedId(id)},
                                                        null, null, null);

    if (cursor != null && cursor.moveToFirst()) {
      return Util.split(cursor.getString(cursor.getColumnIndexOrThrow(MEMBERS)), ",");
    }

    return new LinkedList<>();
  } finally {
    if (cursor != null)
      cursor.close();
  }
}
 
开发者ID:XecureIT,项目名称:PeSanKita-android,代码行数:20,代码来源:GroupDatabase.java

示例5: getCurrentAdmins

import org.thoughtcrime.securesms.util.GroupUtil; //导入依赖的package包/类
private List<String> getCurrentAdmins(byte[] id) {
  Cursor cursor = null;

  try {
    cursor = databaseHelper.getReadableDatabase().query(TABLE_NAME, new String[] {ADMINS},
            GROUP_ID + " = ?",
            new String[] {GroupUtil.getEncodedId(id)},
            null, null, null);

    if (cursor != null && cursor.moveToFirst()) {
      return Util.split(cursor.getString(cursor.getColumnIndexOrThrow(ADMINS)), ",");
    }

    return new LinkedList<>();
  } finally {
    if (cursor != null)
      cursor.close();
  }
}
 
开发者ID:XecureIT,项目名称:PeSanKita-android,代码行数:20,代码来源:GroupDatabase.java

示例6: toNumberStringArray

import org.thoughtcrime.securesms.util.GroupUtil; //导入依赖的package包/类
public @NonNull String[] toNumberStringArray(boolean scrub) {
  String[] recipientsArray     = new String[recipients.size()];
  Iterator<Recipient> iterator = recipients.iterator();
  int i                        = 0;

  while (iterator.hasNext()) {
    String number = iterator.next().getNumber();

    if (scrub && number != null &&
        !Patterns.EMAIL_ADDRESS.matcher(number).matches() &&
        !GroupUtil.isEncodedGroup(number))
    {
      number = number.replaceAll("[^0-9+]", "");
    }

    recipientsArray[i++] = number;
  }

  return recipientsArray;
}
 
开发者ID:XecureIT,项目名称:PeSanKita-android,代码行数:21,代码来源:Recipients.java

示例7: getGroupRecipientDetails

import org.thoughtcrime.securesms.util.GroupUtil; //导入依赖的package包/类
private @NonNull RecipientDetails getGroupRecipientDetails(Context context, String groupId) {
  try {
    GroupDatabase.GroupRecord record = DatabaseFactory.getGroupDatabase(context)
                                                      .getGroup(GroupUtil.getDecodedId(groupId));

    if (record != null) {
      ContactPhoto contactPhoto = ContactPhotoFactory.getGroupContactPhoto(record.getAvatar());
      String       title        = record.getTitle();

      if (title == null) {
        title = context.getString(R.string.RecipientProvider_unnamed_group);;
      }

      return new RecipientDetails(title, groupId, null, contactPhoto, null);
    }

    return new RecipientDetails(context.getString(R.string.RecipientProvider_unnamed_group), groupId, null, ContactPhotoFactory.getDefaultGroupPhoto(), null);
  } catch (IOException e) {
    Log.w("RecipientProvider", e);
    return new RecipientDetails(context.getString(R.string.RecipientProvider_unnamed_group), groupId, null, ContactPhotoFactory.getDefaultGroupPhoto(), null);
  }
}
 
开发者ID:XecureIT,项目名称:PeSanKita-android,代码行数:23,代码来源:RecipientProvider.java

示例8: IncomingTextMessage

import org.thoughtcrime.securesms.util.GroupUtil; //导入依赖的package包/类
public IncomingTextMessage(String sender, int senderDeviceId, long sentTimestampMillis,
                           String encodedBody, Optional<SignalServiceGroup> group,
                           long expiresInMillis)
{
  this.message              = encodedBody;
  this.sender               = sender;
  this.senderDeviceId       = senderDeviceId;
  this.protocol             = 31337;
  this.serviceCenterAddress = "GCM";
  this.replyPathPresent     = true;
  this.pseudoSubject        = "";
  this.sentTimestampMillis  = sentTimestampMillis;
  this.push                 = true;
  this.subscriptionId       = -1;
  this.expiresInMillis      = expiresInMillis;

  if (group.isPresent()) {
    this.groupId = GroupUtil.getEncodedId(group.get().getGroupId());
  } else {
    this.groupId = null;
  }
}
 
开发者ID:XecureIT,项目名称:PeSanKita-android,代码行数:23,代码来源:IncomingTextMessage.java

示例9: IncomingMediaMessage

import org.thoughtcrime.securesms.util.GroupUtil; //导入依赖的package包/类
public IncomingMediaMessage(MasterSecretUnion masterSecret,
                            String from,
                            String to,
                            long sentTimeMillis,
                            int subscriptionId,
                            long expiresIn,
                            boolean expirationUpdate,
                            Optional<String> relay,
                            Optional<String> body,
                            Optional<SignalServiceGroup> group,
                            Optional<List<SignalServiceAttachment>> attachments)
{
  this.push             = true;
  this.from             = from;
  this.sentTimeMillis   = sentTimeMillis;
  this.body             = body.orNull();
  this.subscriptionId   = subscriptionId;
  this.expiresIn        = expiresIn;
  this.expirationUpdate = expirationUpdate;

  if (group.isPresent()) this.groupId = GroupUtil.getEncodedId(group.get().getGroupId());
  else                   this.groupId = null;

  this.to.add(to);
  this.attachments.addAll(PointerAttachment.forPointers(masterSecret, attachments));
}
 
开发者ID:XecureIT,项目名称:PeSanKita-android,代码行数:27,代码来源:IncomingMediaMessage.java

示例10: create

import org.thoughtcrime.securesms.util.GroupUtil; //导入依赖的package包/类
public void create(byte[] groupId, String title, List<String> members,
                   SignalServiceAttachmentPointer avatar, String relay)
{
  ContentValues contentValues = new ContentValues();
  contentValues.put(GROUP_ID, GroupUtil.getEncodedId(groupId));
  contentValues.put(TITLE, title);
  contentValues.put(MEMBERS, Util.join(members, ","));

  if (avatar != null) {
    contentValues.put(AVATAR_ID, avatar.getId());
    contentValues.put(AVATAR_KEY, avatar.getKey());
    contentValues.put(AVATAR_CONTENT_TYPE, avatar.getContentType());
    contentValues.put(AVATAR_DIGEST, avatar.getDigest().orNull());
  }

  contentValues.put(AVATAR_RELAY, relay);
  contentValues.put(TIMESTAMP, System.currentTimeMillis());
  contentValues.put(ACTIVE, 1);

  databaseHelper.getWritableDatabase().insert(TABLE_NAME, null, contentValues);
  RecipientFactory.clearCache(context);
  notifyConversationListListeners();
}
 
开发者ID:CableIM,项目名称:Cable-Android,代码行数:24,代码来源:GroupDatabase.java

示例11: update

import org.thoughtcrime.securesms.util.GroupUtil; //导入依赖的package包/类
public void update(byte[] groupId, String title, SignalServiceAttachmentPointer avatar) {
  ContentValues contentValues = new ContentValues();
  if (title != null) contentValues.put(TITLE, title);

  if (avatar != null) {
    contentValues.put(AVATAR_ID, avatar.getId());
    contentValues.put(AVATAR_CONTENT_TYPE, avatar.getContentType());
    contentValues.put(AVATAR_KEY, avatar.getKey());
    contentValues.put(AVATAR_DIGEST, avatar.getDigest().orNull());
  }

  databaseHelper.getWritableDatabase().update(TABLE_NAME, contentValues,
                                              GROUP_ID + " = ?",
                                              new String[] {GroupUtil.getEncodedId(groupId)});

  RecipientFactory.clearCache(context);
  notifyDatabaseListeners();
  notifyConversationListListeners();
}
 
开发者ID:CableIM,项目名称:Cable-Android,代码行数:20,代码来源:GroupDatabase.java

示例12: getGroupRecipientDetails

import org.thoughtcrime.securesms.util.GroupUtil; //导入依赖的package包/类
private @NonNull RecipientDetails getGroupRecipientDetails(Context context, String groupId) {
  try {
    GroupDatabase.GroupRecord record = DatabaseFactory.getGroupDatabase(context)
                                                      .getGroup(GroupUtil.getDecodedId(groupId));

    if (record != null) {
      ContactPhoto contactPhoto = ContactPhotoFactory.getGroupContactPhoto(record.getAvatar());
      String       title        = record.getTitle();

      if (title == null) {
        title = context.getString(R.string.RecipientProvider_unnamed_group);;
      }

      return new RecipientDetails(title, groupId, null, null, contactPhoto, null);
    }

    return new RecipientDetails(context.getString(R.string.RecipientProvider_unnamed_group), groupId, null, null, ContactPhotoFactory.getDefaultGroupPhoto(), null);
  } catch (IOException e) {
    Log.w("RecipientProvider", e);
    return new RecipientDetails(context.getString(R.string.RecipientProvider_unnamed_group), groupId, null, null, ContactPhotoFactory.getDefaultGroupPhoto(), null);
  }
}
 
开发者ID:CableIM,项目名称:Cable-Android,代码行数:23,代码来源:RecipientProvider.java

示例13: handlePushOperation

import org.thoughtcrime.securesms.util.GroupUtil; //导入依赖的package包/类
private Pair<Long, Recipients> handlePushOperation(byte[] groupId, String groupName, byte[] avatar,
                                                   Set<String> e164numbers)
    throws InvalidNumberException
{

  try {
    String     groupRecipientId = GroupUtil.getEncodedId(groupId);
    Recipients groupRecipient   = RecipientFactory.getRecipientsFromString(this, groupRecipientId, false);

    GroupContext context = GroupContext.newBuilder()
                                       .setId(ByteString.copyFrom(groupId))
                                       .setType(GroupContext.Type.UPDATE)
                                       .setName(groupName)
                                       .addAllMembers(e164numbers)
                                       .build();

    OutgoingGroupMediaMessage outgoingMessage = new OutgoingGroupMediaMessage(this, groupRecipient, context, avatar);
    long                      threadId        = MessageSender.send(this, masterSecret, outgoingMessage, -1, false);

    return new Pair<>(threadId, groupRecipient);
  } catch (RecipientFormattingException e) {
    throw new AssertionError(e);
  }
}
 
开发者ID:redcracker,项目名称:TextSecure,代码行数:25,代码来源:GroupCreateActivity.java

示例14: create

import org.thoughtcrime.securesms.util.GroupUtil; //导入依赖的package包/类
public void create(byte[] groupId, String title, List<String> members,
                   TextSecureAttachmentPointer avatar, String relay)
{
  ContentValues contentValues = new ContentValues();
  contentValues.put(GROUP_ID, GroupUtil.getEncodedId(groupId));
  contentValues.put(TITLE, title);
  contentValues.put(MEMBERS, Util.join(members, ","));

  if (avatar != null) {
    contentValues.put(AVATAR_ID, avatar.getId());
    contentValues.put(AVATAR_KEY, avatar.getKey());
    contentValues.put(AVATAR_CONTENT_TYPE, avatar.getContentType());
  }

  contentValues.put(AVATAR_RELAY, relay);
  contentValues.put(TIMESTAMP, System.currentTimeMillis());
  contentValues.put(ACTIVE, 1);

  databaseHelper.getWritableDatabase().insert(TABLE_NAME, null, contentValues);
}
 
开发者ID:redcracker,项目名称:TextSecure,代码行数:21,代码来源:GroupDatabase.java

示例15: update

import org.thoughtcrime.securesms.util.GroupUtil; //导入依赖的package包/类
public void update(byte[] groupId, String title, TextSecureAttachmentPointer avatar) {
  ContentValues contentValues = new ContentValues();
  if (title != null) contentValues.put(TITLE, title);

  if (avatar != null) {
    contentValues.put(AVATAR_ID, avatar.getId());
    contentValues.put(AVATAR_CONTENT_TYPE, avatar.getContentType());
    contentValues.put(AVATAR_KEY, avatar.getKey());
  }

  databaseHelper.getWritableDatabase().update(TABLE_NAME, contentValues,
                                              GROUP_ID + " = ?",
                                              new String[] {GroupUtil.getEncodedId(groupId)});

  RecipientFactory.clearCache();
  notifyDatabaseListeners();
}
 
开发者ID:redcracker,项目名称:TextSecure,代码行数:18,代码来源:GroupDatabase.java


注:本文中的org.thoughtcrime.securesms.util.GroupUtil类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。