Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
briar
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
briar
briar
Commits
c17ef869
Verified
Commit
c17ef869
authored
8 years ago
by
Torsten Grote
Browse files
Options
Downloads
Patches
Plain Diff
Clear Forum Invitation adapter only when invitations could be removed
parent
cf6aa019
No related branches found
No related tags found
1 merge request
!255
Remove forum invitations from list instead of reloading
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
briar-android/src/org/briarproject/android/forum/ForumInvitationsActivity.java
+17
-14
17 additions, 14 deletions
.../briarproject/android/forum/ForumInvitationsActivity.java
with
17 additions
and
14 deletions
briar-android/src/org/briarproject/android/forum/ForumInvitationsActivity.java
+
17
−
14
View file @
c17ef869
...
@@ -71,10 +71,17 @@ public class ForumInvitationsActivity extends BriarActivity
...
@@ -71,10 +71,17 @@ public class ForumInvitationsActivity extends BriarActivity
public
void
onResume
()
{
public
void
onResume
()
{
super
.
onResume
();
super
.
onResume
();
eventBus
.
addListener
(
this
);
eventBus
.
addListener
(
this
);
loadForums
();
loadForums
(
false
);
}
}
private
void
loadForums
()
{
@Override
public
void
onPause
()
{
super
.
onPause
();
eventBus
.
removeListener
(
this
);
adapter
.
clear
();
}
private
void
loadForums
(
final
boolean
clear
)
{
runOnDbThread
(
new
Runnable
()
{
runOnDbThread
(
new
Runnable
()
{
@Override
@Override
public
void
run
()
{
public
void
run
()
{
...
@@ -97,7 +104,7 @@ public class ForumInvitationsActivity extends BriarActivity
...
@@ -97,7 +104,7 @@ public class ForumInvitationsActivity extends BriarActivity
long
duration
=
System
.
currentTimeMillis
()
-
now
;
long
duration
=
System
.
currentTimeMillis
()
-
now
;
if
(
LOG
.
isLoggable
(
INFO
))
if
(
LOG
.
isLoggable
(
INFO
))
LOG
.
info
(
"Load took "
+
duration
+
" ms"
);
LOG
.
info
(
"Load took "
+
duration
+
" ms"
);
displayForums
(
forums
);
displayForums
(
forums
,
clear
);
}
catch
(
DbException
e
)
{
}
catch
(
DbException
e
)
{
if
(
LOG
.
isLoggable
(
WARNING
))
if
(
LOG
.
isLoggable
(
WARNING
))
LOG
.
log
(
WARNING
,
e
.
toString
(),
e
);
LOG
.
log
(
WARNING
,
e
.
toString
(),
e
);
...
@@ -106,7 +113,8 @@ public class ForumInvitationsActivity extends BriarActivity
...
@@ -106,7 +113,8 @@ public class ForumInvitationsActivity extends BriarActivity
});
});
}
}
private
void
displayForums
(
final
Collection
<
ForumInvitationItem
>
forums
)
{
private
void
displayForums
(
final
Collection
<
ForumInvitationItem
>
forums
,
final
boolean
clear
)
{
runOnUiThread
(
new
Runnable
()
{
runOnUiThread
(
new
Runnable
()
{
@Override
@Override
public
void
run
()
{
public
void
run
()
{
...
@@ -114,38 +122,33 @@ public class ForumInvitationsActivity extends BriarActivity
...
@@ -114,38 +122,33 @@ public class ForumInvitationsActivity extends BriarActivity
LOG
.
info
(
"No forums available, finishing"
);
LOG
.
info
(
"No forums available, finishing"
);
finish
();
finish
();
}
else
{
}
else
{
if
(
clear
)
adapter
.
clear
();
adapter
.
addAll
(
forums
);
adapter
.
addAll
(
forums
);
}
}
}
}
});
});
}
}
@Override
public
void
onPause
()
{
super
.
onPause
();
eventBus
.
removeListener
(
this
);
}
@Override
@Override
public
void
eventOccurred
(
Event
e
)
{
public
void
eventOccurred
(
Event
e
)
{
if
(
e
instanceof
ContactRemovedEvent
)
{
if
(
e
instanceof
ContactRemovedEvent
)
{
LOG
.
info
(
"Contact removed, reloading"
);
LOG
.
info
(
"Contact removed, reloading"
);
loadForums
();
loadForums
(
true
);
}
else
if
(
e
instanceof
GroupAddedEvent
)
{
}
else
if
(
e
instanceof
GroupAddedEvent
)
{
GroupAddedEvent
g
=
(
GroupAddedEvent
)
e
;
GroupAddedEvent
g
=
(
GroupAddedEvent
)
e
;
if
(
g
.
getGroup
().
getClientId
().
equals
(
forumManager
.
getClientId
()))
{
if
(
g
.
getGroup
().
getClientId
().
equals
(
forumManager
.
getClientId
()))
{
LOG
.
info
(
"Forum added, reloading"
);
LOG
.
info
(
"Forum added, reloading"
);
loadForums
();
loadForums
(
false
);
}
}
}
else
if
(
e
instanceof
GroupRemovedEvent
)
{
}
else
if
(
e
instanceof
GroupRemovedEvent
)
{
GroupRemovedEvent
g
=
(
GroupRemovedEvent
)
e
;
GroupRemovedEvent
g
=
(
GroupRemovedEvent
)
e
;
if
(
g
.
getGroup
().
getClientId
().
equals
(
forumManager
.
getClientId
()))
{
if
(
g
.
getGroup
().
getClientId
().
equals
(
forumManager
.
getClientId
()))
{
LOG
.
info
(
"Forum removed, reloading"
);
LOG
.
info
(
"Forum removed, reloading"
);
loadForums
();
loadForums
(
true
);
}
}
}
else
if
(
e
instanceof
ForumInvitationReceivedEvent
)
{
}
else
if
(
e
instanceof
ForumInvitationReceivedEvent
)
{
LOG
.
info
(
"Available forums updated, reloading"
);
LOG
.
info
(
"Available forums updated, reloading"
);
loadForums
();
loadForums
(
false
);
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment