Hide "Add to a group" if you don't have any groups.

This commit is contained in:
Alan Evans
2020-07-10 12:06:00 -03:00
committed by Greyson Parrelli
parent f3dbe4416f
commit 137cd45497
7 changed files with 50 additions and 2 deletions

View File

@@ -251,6 +251,20 @@ public final class GroupDatabase extends Database {
return new Reader(cursor);
}
public int getActiveGroupCount() {
SQLiteDatabase db = databaseHelper.getReadableDatabase();
String[] cols = { "COUNT(*)" };
String query = ACTIVE + " = 1";
try (Cursor cursor = db.query(TABLE_NAME, cols, query, null, null, null, null)) {
if (cursor != null && cursor.moveToFirst()) {
return cursor.getInt(0);
}
}
return 0;
}
@WorkerThread
public @NonNull List<Recipient> getGroupMembers(@NonNull GroupId groupId, @NonNull MemberSet memberSet) {
if (groupId.isV2()) {