Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
briar
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
681
Issues
681
List
Boards
Labels
Service Desk
Milestones
Merge Requests
16
Merge Requests
16
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
briar
briar
Commits
cdbe2a00
Verified
Commit
cdbe2a00
authored
Oct 29, 2018
by
Torsten Grote
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[android] Show alias for creator of private group in list of private groups
parent
a51dc7e0
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
32 additions
and
4 deletions
+32
-4
briar-android/src/main/java/org/briarproject/briar/android/privategroup/list/GroupItem.java
...iarproject/briar/android/privategroup/list/GroupItem.java
+9
-1
briar-android/src/main/java/org/briarproject/briar/android/privategroup/list/GroupListControllerImpl.java
...ar/android/privategroup/list/GroupListControllerImpl.java
+19
-1
briar-android/src/main/java/org/briarproject/briar/android/privategroup/list/GroupViewHolder.java
...ject/briar/android/privategroup/list/GroupViewHolder.java
+4
-2
No files found.
briar-android/src/main/java/org/briarproject/briar/android/privategroup/list/GroupItem.java
View file @
cdbe2a00
package
org.briarproject.briar.android.privategroup.list
;
import
org.briarproject.bramble.api.identity.Author
;
import
org.briarproject.bramble.api.identity.AuthorInfo
;
import
org.briarproject.bramble.api.nullsafety.NotNullByDefault
;
import
org.briarproject.bramble.api.sync.GroupId
;
import
org.briarproject.briar.api.client.MessageTracker.GroupCount
;
...
...
@@ -12,12 +13,15 @@ import org.briarproject.briar.api.privategroup.PrivateGroup;
class
GroupItem
{
private
final
PrivateGroup
privateGroup
;
private
final
AuthorInfo
authorInfo
;
private
int
messageCount
,
unreadCount
;
private
long
timestamp
;
private
boolean
dissolved
;
GroupItem
(
PrivateGroup
privateGroup
,
GroupCount
count
,
boolean
dissolved
)
{
GroupItem
(
PrivateGroup
privateGroup
,
AuthorInfo
authorInfo
,
GroupCount
count
,
boolean
dissolved
)
{
this
.
privateGroup
=
privateGroup
;
this
.
authorInfo
=
authorInfo
;
this
.
messageCount
=
count
.
getMsgCount
();
this
.
unreadCount
=
count
.
getUnreadCount
();
this
.
timestamp
=
count
.
getLatestMsgTime
();
...
...
@@ -46,6 +50,10 @@ class GroupItem {
return
privateGroup
.
getCreator
();
}
AuthorInfo
getCreatorInfo
()
{
return
authorInfo
;
}
String
getName
()
{
return
privateGroup
.
getName
();
}
...
...
briar-android/src/main/java/org/briarproject/briar/android/privategroup/list/GroupListControllerImpl.java
View file @
cdbe2a00
...
...
@@ -2,12 +2,15 @@ package org.briarproject.briar.android.privategroup.list;
import
android.support.annotation.CallSuper
;
import
org.briarproject.bramble.api.contact.ContactManager
;
import
org.briarproject.bramble.api.db.DatabaseExecutor
;
import
org.briarproject.bramble.api.db.DbException
;
import
org.briarproject.bramble.api.db.NoSuchGroupException
;
import
org.briarproject.bramble.api.event.Event
;
import
org.briarproject.bramble.api.event.EventBus
;
import
org.briarproject.bramble.api.event.EventListener
;
import
org.briarproject.bramble.api.identity.AuthorId
;
import
org.briarproject.bramble.api.identity.AuthorInfo
;
import
org.briarproject.bramble.api.lifecycle.LifecycleManager
;
import
org.briarproject.bramble.api.nullsafety.MethodsNotNullByDefault
;
import
org.briarproject.bramble.api.nullsafety.ParametersNotNullByDefault
;
...
...
@@ -30,7 +33,9 @@ import org.briarproject.briar.api.privategroup.invitation.GroupInvitationManager
import
java.util.ArrayList
;
import
java.util.Collection
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.concurrent.Executor
;
import
java.util.logging.Logger
;
...
...
@@ -52,6 +57,7 @@ class GroupListControllerImpl extends DbControllerImpl
private
final
PrivateGroupManager
groupManager
;
private
final
GroupInvitationManager
groupInvitationManager
;
private
final
ContactManager
contactManager
;
private
final
AndroidNotificationManager
notificationManager
;
private
final
EventBus
eventBus
;
...
...
@@ -61,10 +67,12 @@ class GroupListControllerImpl extends DbControllerImpl
GroupListControllerImpl
(
@DatabaseExecutor
Executor
dbExecutor
,
LifecycleManager
lifecycleManager
,
PrivateGroupManager
groupManager
,
GroupInvitationManager
groupInvitationManager
,
ContactManager
contactManager
,
AndroidNotificationManager
notificationManager
,
EventBus
eventBus
)
{
super
(
dbExecutor
,
lifecycleManager
);
this
.
groupManager
=
groupManager
;
this
.
groupInvitationManager
=
groupInvitationManager
;
this
.
contactManager
=
contactManager
;
this
.
notificationManager
=
notificationManager
;
this
.
eventBus
=
eventBus
;
}
...
...
@@ -153,12 +161,22 @@ class GroupListControllerImpl extends DbControllerImpl
Collection
<
PrivateGroup
>
groups
=
groupManager
.
getPrivateGroups
();
List
<
GroupItem
>
items
=
new
ArrayList
<>(
groups
.
size
());
Map
<
AuthorId
,
AuthorInfo
>
authorInfos
=
new
HashMap
<>();
for
(
PrivateGroup
g
:
groups
)
{
try
{
GroupId
id
=
g
.
getId
();
AuthorId
authorId
=
g
.
getCreator
().
getId
();
AuthorInfo
authorInfo
;
if
(
authorInfos
.
containsKey
(
authorId
))
{
authorInfo
=
authorInfos
.
get
(
authorId
);
}
else
{
authorInfo
=
contactManager
.
getAuthorInfo
(
authorId
);
authorInfos
.
put
(
authorId
,
authorInfo
);
}
GroupCount
count
=
groupManager
.
getGroupCount
(
id
);
boolean
dissolved
=
groupManager
.
isDissolved
(
id
);
items
.
add
(
new
GroupItem
(
g
,
count
,
dissolved
));
items
.
add
(
new
GroupItem
(
g
,
authorInfo
,
count
,
dissolved
));
}
catch
(
NoSuchGroupException
e
)
{
// Continue
}
...
...
briar-android/src/main/java/org/briarproject/briar/android/privategroup/list/GroupViewHolder.java
View file @
cdbe2a00
...
...
@@ -20,6 +20,7 @@ import static android.view.View.GONE;
import
static
android
.
view
.
View
.
VISIBLE
;
import
static
org
.
briarproject
.
briar
.
android
.
activity
.
BriarActivity
.
GROUP_ID
;
import
static
org
.
briarproject
.
briar
.
android
.
activity
.
BriarActivity
.
GROUP_NAME
;
import
static
org
.
briarproject
.
briar
.
android
.
util
.
UiUtils
.
getContactDisplayName
;
@MethodsNotNullByDefault
@ParametersNotNullByDefault
...
...
@@ -60,8 +61,9 @@ class GroupViewHolder extends RecyclerView.ViewHolder {
name
.
setText
(
group
.
getName
());
// Creator
creator
.
setText
(
ctx
.
getString
(
R
.
string
.
groups_created_by
,
group
.
getCreator
().
getName
()));
String
creatorName
=
getContactDisplayName
(
group
.
getCreator
(),
group
.
getCreatorInfo
().
getAlias
());
creator
.
setText
(
ctx
.
getString
(
R
.
string
.
groups_created_by
,
creatorName
));
if
(!
group
.
isDissolved
())
{
// full visibility
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment