mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-13 11:19:04 +01:00
Effectively final.
This commit is contained in:
@@ -242,7 +242,7 @@ class AndroidNotificationManagerImpl implements AndroidNotificationManager,
|
||||
});
|
||||
}
|
||||
|
||||
private void showContactNotification(final ContactId c) {
|
||||
private void showContactNotification(ContactId c) {
|
||||
androidExecutor.runOnUiThread(() -> {
|
||||
if (blockContacts) return;
|
||||
if (c.equals(blockedContact)) return;
|
||||
@@ -255,7 +255,7 @@ class AndroidNotificationManagerImpl implements AndroidNotificationManager,
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearContactNotification(final ContactId c) {
|
||||
public void clearContactNotification(ContactId c) {
|
||||
androidExecutor.runOnUiThread(() -> {
|
||||
Integer count = contactCounts.remove(c);
|
||||
if (count == null) return; // Already cleared
|
||||
@@ -350,7 +350,7 @@ class AndroidNotificationManagerImpl implements AndroidNotificationManager,
|
||||
}
|
||||
|
||||
@UiThread
|
||||
private void showGroupMessageNotification(final GroupId g) {
|
||||
private void showGroupMessageNotification(GroupId g) {
|
||||
androidExecutor.runOnUiThread(() -> {
|
||||
if (blockGroups) return;
|
||||
if (g.equals(blockedGroup)) return;
|
||||
@@ -363,7 +363,7 @@ class AndroidNotificationManagerImpl implements AndroidNotificationManager,
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearGroupMessageNotification(final GroupId g) {
|
||||
public void clearGroupMessageNotification(GroupId g) {
|
||||
androidExecutor.runOnUiThread(() -> {
|
||||
Integer count = groupCounts.remove(g);
|
||||
if (count == null) return; // Already cleared
|
||||
@@ -427,7 +427,7 @@ class AndroidNotificationManagerImpl implements AndroidNotificationManager,
|
||||
}
|
||||
|
||||
@UiThread
|
||||
private void showForumPostNotification(final GroupId g) {
|
||||
private void showForumPostNotification(GroupId g) {
|
||||
androidExecutor.runOnUiThread(() -> {
|
||||
if (blockForums) return;
|
||||
if (g.equals(blockedGroup)) return;
|
||||
@@ -440,7 +440,7 @@ class AndroidNotificationManagerImpl implements AndroidNotificationManager,
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearForumPostNotification(final GroupId g) {
|
||||
public void clearForumPostNotification(GroupId g) {
|
||||
androidExecutor.runOnUiThread(() -> {
|
||||
Integer count = forumCounts.remove(g);
|
||||
if (count == null) return; // Already cleared
|
||||
@@ -504,7 +504,7 @@ class AndroidNotificationManagerImpl implements AndroidNotificationManager,
|
||||
}
|
||||
|
||||
@UiThread
|
||||
private void showBlogPostNotification(final GroupId g) {
|
||||
private void showBlogPostNotification(GroupId g) {
|
||||
androidExecutor.runOnUiThread(() -> {
|
||||
if (blockBlogs) return;
|
||||
if (g.equals(blockedGroup)) return;
|
||||
@@ -517,7 +517,7 @@ class AndroidNotificationManagerImpl implements AndroidNotificationManager,
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearBlogPostNotification(final GroupId g) {
|
||||
public void clearBlogPostNotification(GroupId g) {
|
||||
androidExecutor.runOnUiThread(() -> {
|
||||
Integer count = blogCounts.remove(g);
|
||||
if (count == null) return; // Already cleared
|
||||
@@ -611,24 +611,24 @@ class AndroidNotificationManagerImpl implements AndroidNotificationManager,
|
||||
}
|
||||
|
||||
@Override
|
||||
public void blockNotification(final GroupId g) {
|
||||
public void blockNotification(GroupId g) {
|
||||
androidExecutor.runOnUiThread((Runnable) () -> blockedGroup = g);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unblockNotification(final GroupId g) {
|
||||
public void unblockNotification(GroupId g) {
|
||||
androidExecutor.runOnUiThread(() -> {
|
||||
if (g.equals(blockedGroup)) blockedGroup = null;
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void blockContactNotification(final ContactId c) {
|
||||
public void blockContactNotification(ContactId c) {
|
||||
androidExecutor.runOnUiThread((Runnable) () -> blockedContact = c);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unblockContactNotification(final ContactId c) {
|
||||
public void unblockContactNotification(ContactId c) {
|
||||
androidExecutor.runOnUiThread(() -> {
|
||||
if (c.equals(blockedContact)) blockedContact = null;
|
||||
});
|
||||
|
||||
@@ -80,7 +80,7 @@ public class AppModule {
|
||||
@Provides
|
||||
@Singleton
|
||||
DatabaseConfig provideDatabaseConfig(Application app) {
|
||||
final File dir = app.getApplicationContext().getDir("db", MODE_PRIVATE);
|
||||
File dir = app.getApplicationContext().getDir("db", MODE_PRIVATE);
|
||||
@MethodsNotNullByDefault
|
||||
@ParametersNotNullByDefault
|
||||
DatabaseConfig databaseConfig = new DatabaseConfig() {
|
||||
@@ -132,7 +132,7 @@ public class AppModule {
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
DevConfig provideDevConfig(final CryptoComponent crypto) {
|
||||
DevConfig provideDevConfig(CryptoComponent crypto) {
|
||||
@NotNullByDefault
|
||||
DevConfig devConfig = new DevConfig() {
|
||||
|
||||
|
||||
@@ -111,7 +111,7 @@ public class BriarService extends Service {
|
||||
}.start();
|
||||
}
|
||||
|
||||
private void showStartupFailureNotification(final StartResult result) {
|
||||
private void showStartupFailureNotification(StartResult result) {
|
||||
androidExecutor.runOnUiThread(() -> {
|
||||
NotificationCompat.Builder b =
|
||||
new NotificationCompat.Builder(BriarService.this);
|
||||
|
||||
@@ -151,7 +151,7 @@ public abstract class BaseActivity extends AppCompatActivity
|
||||
}
|
||||
|
||||
@Override
|
||||
public void runOnUiThreadUnlessDestroyed(final Runnable r) {
|
||||
public void runOnUiThreadUnlessDestroyed(Runnable r) {
|
||||
runOnUiThread(() -> {
|
||||
if (!destroyed && !isFinishing()) r.run();
|
||||
});
|
||||
|
||||
@@ -97,7 +97,7 @@ public abstract class BriarActivity extends BaseActivity {
|
||||
return toolbar;
|
||||
}
|
||||
|
||||
protected void signOut(final boolean removeFromRecentApps) {
|
||||
protected void signOut(boolean removeFromRecentApps) {
|
||||
if (briarController.hasEncryptionKey()) {
|
||||
// Don't use UiResultHandler because we want the result even if
|
||||
// this activity has been destroyed
|
||||
|
||||
@@ -84,7 +84,7 @@ abstract class BaseControllerImpl extends DbControllerImpl
|
||||
this.listener = listener;
|
||||
}
|
||||
|
||||
void onBlogPostAdded(final BlogPostHeader h, final boolean local) {
|
||||
void onBlogPostAdded(BlogPostHeader h, boolean local) {
|
||||
listener.runOnUiThreadUnlessDestroyed(
|
||||
() -> listener.onBlogPostAdded(h, local));
|
||||
}
|
||||
@@ -94,8 +94,8 @@ abstract class BaseControllerImpl extends DbControllerImpl
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadBlogPosts(final GroupId groupId,
|
||||
final ResultExceptionHandler<Collection<BlogPostItem>, DbException> handler) {
|
||||
public void loadBlogPosts(GroupId groupId,
|
||||
ResultExceptionHandler<Collection<BlogPostItem>, DbException> handler) {
|
||||
runOnDbThread(() -> {
|
||||
try {
|
||||
Collection<BlogPostItem> items = loadItems(groupId);
|
||||
@@ -129,8 +129,8 @@ abstract class BaseControllerImpl extends DbControllerImpl
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadBlogPost(final BlogPostHeader header,
|
||||
final ResultExceptionHandler<BlogPostItem, DbException> handler) {
|
||||
public void loadBlogPost(BlogPostHeader header,
|
||||
ResultExceptionHandler<BlogPostItem, DbException> handler) {
|
||||
|
||||
String body = bodyCache.get(header.getId());
|
||||
if (body != null) {
|
||||
@@ -155,8 +155,8 @@ abstract class BaseControllerImpl extends DbControllerImpl
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadBlogPost(final GroupId g, final MessageId m,
|
||||
final ResultExceptionHandler<BlogPostItem, DbException> handler) {
|
||||
public void loadBlogPost(GroupId g, MessageId m,
|
||||
ResultExceptionHandler<BlogPostItem, DbException> handler) {
|
||||
|
||||
BlogPostHeader header = headerCache.get(m);
|
||||
if (header != null) {
|
||||
@@ -182,9 +182,8 @@ abstract class BaseControllerImpl extends DbControllerImpl
|
||||
}
|
||||
|
||||
@Override
|
||||
public void repeatPost(final BlogPostItem item,
|
||||
final @Nullable String comment,
|
||||
final ExceptionHandler<DbException> handler) {
|
||||
public void repeatPost(BlogPostItem item, @Nullable String comment,
|
||||
ExceptionHandler<DbException> handler) {
|
||||
runOnDbThread(() -> {
|
||||
try {
|
||||
LocalAuthor a = identityManager.getLocalAuthor();
|
||||
|
||||
@@ -32,7 +32,7 @@ public class BlogActivity extends BriarActivity
|
||||
Intent i = getIntent();
|
||||
byte[] b = i.getByteArrayExtra(GROUP_ID);
|
||||
if (b == null) throw new IllegalStateException("No group ID in intent");
|
||||
final GroupId groupId = new GroupId(b);
|
||||
GroupId groupId = new GroupId(b);
|
||||
blogController.setGroupId(groupId);
|
||||
|
||||
setContentView(R.layout.activity_fragment_container_toolbar);
|
||||
|
||||
@@ -125,32 +125,32 @@ class BlogControllerImpl extends BaseControllerImpl
|
||||
}
|
||||
}
|
||||
|
||||
private void onBlogInvitationAccepted(final ContactId c) {
|
||||
private void onBlogInvitationAccepted(ContactId c) {
|
||||
listener.runOnUiThreadUnlessDestroyed(
|
||||
() -> listener.onBlogInvitationAccepted(c));
|
||||
}
|
||||
|
||||
private void onBlogLeft(final ContactId c) {
|
||||
private void onBlogLeft(ContactId c) {
|
||||
listener.runOnUiThreadUnlessDestroyed(() -> listener.onBlogLeft(c));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadBlogPosts(
|
||||
final ResultExceptionHandler<Collection<BlogPostItem>, DbException> handler) {
|
||||
ResultExceptionHandler<Collection<BlogPostItem>, DbException> handler) {
|
||||
if (groupId == null) throw new IllegalStateException();
|
||||
loadBlogPosts(groupId, handler);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadBlogPost(final MessageId m,
|
||||
final ResultExceptionHandler<BlogPostItem, DbException> handler) {
|
||||
public void loadBlogPost(MessageId m,
|
||||
ResultExceptionHandler<BlogPostItem, DbException> handler) {
|
||||
if (groupId == null) throw new IllegalStateException();
|
||||
loadBlogPost(groupId, m, handler);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadBlog(
|
||||
final ResultExceptionHandler<BlogItem, DbException> handler) {
|
||||
ResultExceptionHandler<BlogItem, DbException> handler) {
|
||||
if (groupId == null) throw new IllegalStateException();
|
||||
runOnDbThread(() -> {
|
||||
try {
|
||||
@@ -173,8 +173,7 @@ class BlogControllerImpl extends BaseControllerImpl
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteBlog(
|
||||
final ResultExceptionHandler<Void, DbException> handler) {
|
||||
public void deleteBlog(ResultExceptionHandler<Void, DbException> handler) {
|
||||
if (groupId == null) throw new IllegalStateException();
|
||||
runOnDbThread(() -> {
|
||||
try {
|
||||
@@ -195,7 +194,7 @@ class BlogControllerImpl extends BaseControllerImpl
|
||||
|
||||
@Override
|
||||
public void loadSharingContacts(
|
||||
final ResultExceptionHandler<Collection<ContactId>, DbException> handler) {
|
||||
ResultExceptionHandler<Collection<ContactId>, DbException> handler) {
|
||||
if (groupId == null) throw new IllegalStateException();
|
||||
runOnDbThread(() -> {
|
||||
try {
|
||||
|
||||
@@ -137,7 +137,7 @@ public class BlogFragment extends BaseFragment
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(final MenuItem item) {
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
case R.id.action_write_blog_post:
|
||||
Intent i = new Intent(getActivity(),
|
||||
@@ -184,7 +184,7 @@ public class BlogFragment extends BaseFragment
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlogPostAdded(BlogPostHeader header, final boolean local) {
|
||||
public void onBlogPostAdded(BlogPostHeader header, boolean local) {
|
||||
blogController.loadBlogPost(header,
|
||||
new UiResultExceptionHandler<BlogPostItem, DbException>(
|
||||
this) {
|
||||
@@ -224,7 +224,7 @@ public class BlogFragment extends BaseFragment
|
||||
getContext().startActivity(i);
|
||||
}
|
||||
|
||||
private void loadBlogPosts(final boolean reload) {
|
||||
private void loadBlogPosts(boolean reload) {
|
||||
blogController.loadBlogPosts(
|
||||
new UiResultExceptionHandler<Collection<BlogPostItem>,
|
||||
DbException>(this) {
|
||||
|
||||
@@ -88,7 +88,7 @@ class BlogPostViewHolder extends RecyclerView.ViewHolder {
|
||||
return "blogPost" + id.hashCode();
|
||||
}
|
||||
|
||||
void bindItem(@Nullable final BlogPostItem item) {
|
||||
void bindItem(@Nullable BlogPostItem item) {
|
||||
if (item == null) return;
|
||||
|
||||
setTransitionName(item.getId());
|
||||
@@ -152,7 +152,7 @@ class BlogPostViewHolder extends RecyclerView.ViewHolder {
|
||||
}
|
||||
}
|
||||
|
||||
private void onBindComment(final BlogCommentItem item) {
|
||||
private void onBindComment(BlogCommentItem item) {
|
||||
// reblogger
|
||||
reblogger.setAuthor(item.getAuthor());
|
||||
reblogger.setAuthorStatus(item.getAuthorStatus());
|
||||
|
||||
@@ -96,7 +96,7 @@ class FeedControllerImpl extends BaseControllerImpl
|
||||
|
||||
@Override
|
||||
public void loadBlogPosts(
|
||||
final ResultExceptionHandler<Collection<BlogPostItem>, DbException> handler) {
|
||||
ResultExceptionHandler<Collection<BlogPostItem>, DbException> handler) {
|
||||
runOnDbThread(() -> {
|
||||
try {
|
||||
long now = System.currentTimeMillis();
|
||||
@@ -122,7 +122,7 @@ class FeedControllerImpl extends BaseControllerImpl
|
||||
|
||||
@Override
|
||||
public void loadPersonalBlog(
|
||||
final ResultExceptionHandler<Blog, DbException> handler) {
|
||||
ResultExceptionHandler<Blog, DbException> handler) {
|
||||
runOnDbThread(() -> {
|
||||
try {
|
||||
long now = System.currentTimeMillis();
|
||||
|
||||
@@ -135,8 +135,8 @@ public class FeedFragment extends BaseFragment implements
|
||||
});
|
||||
}
|
||||
|
||||
private void loadBlogPosts(final boolean clear) {
|
||||
final int revision = adapter.getRevision();
|
||||
private void loadBlogPosts(boolean clear) {
|
||||
int revision = adapter.getRevision();
|
||||
feedController.loadBlogPosts(
|
||||
new UiResultExceptionHandler<Collection<BlogPostItem>, DbException>(
|
||||
this) {
|
||||
@@ -167,7 +167,7 @@ public class FeedFragment extends BaseFragment implements
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(final MenuItem item) {
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
if (personalBlog == null) return false;
|
||||
switch (item.getItemId()) {
|
||||
case R.id.action_write_blog_post:
|
||||
@@ -193,7 +193,7 @@ public class FeedFragment extends BaseFragment implements
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlogPostAdded(BlogPostHeader header, final boolean local) {
|
||||
public void onBlogPostAdded(BlogPostHeader header, boolean local) {
|
||||
feedController.loadBlogPost(header,
|
||||
new UiResultExceptionHandler<BlogPostItem, DbException>(
|
||||
this) {
|
||||
|
||||
@@ -34,7 +34,7 @@ class RssFeedAdapter extends BriarAdapter<Feed, RssFeedAdapter.FeedViewHolder> {
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(FeedViewHolder ui, int position) {
|
||||
final Feed item = getItemAt(position);
|
||||
Feed item = getItemAt(position);
|
||||
if (item == null) return;
|
||||
|
||||
// Feed Title
|
||||
|
||||
@@ -118,7 +118,7 @@ public class RssFeedImportActivity extends BriarActivity {
|
||||
importFeed(url);
|
||||
}
|
||||
|
||||
private void importFeed(final String url) {
|
||||
private void importFeed(String url) {
|
||||
ioExecutor.execute(() -> {
|
||||
try {
|
||||
feedManager.addFeed(url);
|
||||
|
||||
@@ -103,7 +103,7 @@ public class RssFeedManageActivity extends BriarActivity
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDeleteClick(final Feed feed) {
|
||||
public void onDeleteClick(Feed feed) {
|
||||
DialogInterface.OnClickListener okListener =
|
||||
(dialog, which) -> deleteFeed(feed);
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(this,
|
||||
@@ -118,7 +118,7 @@ public class RssFeedManageActivity extends BriarActivity
|
||||
}
|
||||
|
||||
private void loadFeeds() {
|
||||
final int revision = adapter.getRevision();
|
||||
int revision = adapter.getRevision();
|
||||
runOnDbThread(() -> {
|
||||
try {
|
||||
displayFeeds(revision, feedManager.getFeeds());
|
||||
@@ -129,7 +129,7 @@ public class RssFeedManageActivity extends BriarActivity
|
||||
});
|
||||
}
|
||||
|
||||
private void displayFeeds(final int revision, final List<Feed> feeds) {
|
||||
private void displayFeeds(int revision, List<Feed> feeds) {
|
||||
runOnUiThreadUnlessDestroyed(() -> {
|
||||
if (revision == adapter.getRevision()) {
|
||||
adapter.incrementRevision();
|
||||
@@ -142,7 +142,7 @@ public class RssFeedManageActivity extends BriarActivity
|
||||
});
|
||||
}
|
||||
|
||||
private void deleteFeed(final Feed feed) {
|
||||
private void deleteFeed(Feed feed) {
|
||||
runOnDbThread(() -> {
|
||||
try {
|
||||
feedManager.removeFeed(feed);
|
||||
@@ -161,7 +161,7 @@ public class RssFeedManageActivity extends BriarActivity
|
||||
});
|
||||
}
|
||||
|
||||
private void onFeedDeleted(final Feed feed) {
|
||||
private void onFeedDeleted(Feed feed) {
|
||||
runOnUiThreadUnlessDestroyed(() -> {
|
||||
adapter.incrementRevision();
|
||||
adapter.remove(feed);
|
||||
|
||||
@@ -140,7 +140,7 @@ public class WriteBlogPostActivity extends BriarActivity
|
||||
storePost(body);
|
||||
}
|
||||
|
||||
private void storePost(final String body) {
|
||||
private void storePost(String body) {
|
||||
runOnDbThread(() -> {
|
||||
long now = System.currentTimeMillis();
|
||||
try {
|
||||
|
||||
@@ -23,7 +23,7 @@ public abstract class BaseContactListAdapter<I extends ContactItem, VH extends C
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(final VH ui, int position) {
|
||||
public void onBindViewHolder(VH ui, int position) {
|
||||
I item = items.get(position);
|
||||
ui.bind(item, listener);
|
||||
}
|
||||
|
||||
@@ -37,8 +37,7 @@ public class ContactItemViewHolder<I extends ContactItem>
|
||||
bulb = (ImageView) v.findViewById(R.id.bulbView);
|
||||
}
|
||||
|
||||
protected void bind(final I item,
|
||||
@Nullable final OnContactClickListener<I> listener) {
|
||||
protected void bind(I item, @Nullable OnContactClickListener<I> listener) {
|
||||
Author author = item.getContact().getAuthor();
|
||||
avatar.setImageDrawable(
|
||||
new IdenticonDrawable(author.getId().getBytes()));
|
||||
|
||||
@@ -158,7 +158,7 @@ public class ContactListFragment extends BaseFragment implements EventListener {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(final MenuItem item) {
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
// Handle presses on the action bar items
|
||||
switch (item.getItemId()) {
|
||||
case R.id.action_add_contact:
|
||||
@@ -191,7 +191,7 @@ public class ContactListFragment extends BaseFragment implements EventListener {
|
||||
}
|
||||
|
||||
private void loadContacts() {
|
||||
final int revision = adapter.getRevision();
|
||||
int revision = adapter.getRevision();
|
||||
listener.runOnDbThread(() -> {
|
||||
try {
|
||||
long now = System.currentTimeMillis();
|
||||
@@ -218,8 +218,7 @@ public class ContactListFragment extends BaseFragment implements EventListener {
|
||||
});
|
||||
}
|
||||
|
||||
private void displayContacts(final int revision,
|
||||
final List<ContactListItem> contacts) {
|
||||
private void displayContacts(int revision, List<ContactListItem> contacts) {
|
||||
runOnUiThreadUnlessDestroyed(() -> {
|
||||
if (revision == adapter.getRevision()) {
|
||||
adapter.incrementRevision();
|
||||
@@ -282,7 +281,7 @@ public class ContactListFragment extends BaseFragment implements EventListener {
|
||||
}
|
||||
}
|
||||
|
||||
private void updateItem(final ContactId c, final BaseMessageHeader h) {
|
||||
private void updateItem(ContactId c, BaseMessageHeader h) {
|
||||
runOnUiThreadUnlessDestroyed(() -> {
|
||||
adapter.incrementRevision();
|
||||
int position = adapter.findItemPosition(c);
|
||||
@@ -295,7 +294,7 @@ public class ContactListFragment extends BaseFragment implements EventListener {
|
||||
});
|
||||
}
|
||||
|
||||
private void removeItem(final ContactId c) {
|
||||
private void removeItem(ContactId c) {
|
||||
runOnUiThreadUnlessDestroyed(() -> {
|
||||
adapter.incrementRevision();
|
||||
int position = adapter.findItemPosition(c);
|
||||
@@ -304,7 +303,7 @@ public class ContactListFragment extends BaseFragment implements EventListener {
|
||||
});
|
||||
}
|
||||
|
||||
private void setConnected(final ContactId c, final boolean connected) {
|
||||
private void setConnected(ContactId c, boolean connected) {
|
||||
runOnUiThreadUnlessDestroyed(() -> {
|
||||
adapter.incrementRevision();
|
||||
int position = adapter.findItemPosition(c);
|
||||
|
||||
@@ -268,7 +268,7 @@ public class ConversationActivity extends BriarActivity
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(final MenuItem item) {
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
// Handle presses on the action bar items
|
||||
switch (item.getItemId()) {
|
||||
case android.R.id.home:
|
||||
@@ -338,7 +338,7 @@ public class ConversationActivity extends BriarActivity
|
||||
}
|
||||
|
||||
private void loadMessages() {
|
||||
final int revision = adapter.getRevision();
|
||||
int revision = adapter.getRevision();
|
||||
runOnDbThread(() -> {
|
||||
try {
|
||||
long now = System.currentTimeMillis();
|
||||
@@ -370,10 +370,10 @@ public class ConversationActivity extends BriarActivity
|
||||
});
|
||||
}
|
||||
|
||||
private void displayMessages(final int revision,
|
||||
final Collection<PrivateMessageHeader> headers,
|
||||
final Collection<IntroductionMessage> introductions,
|
||||
final Collection<InvitationMessage> invitations) {
|
||||
private void displayMessages(int revision,
|
||||
Collection<PrivateMessageHeader> headers,
|
||||
Collection<IntroductionMessage> introductions,
|
||||
Collection<InvitationMessage> invitations) {
|
||||
runOnUiThreadUnlessDestroyed(() -> {
|
||||
if (revision == adapter.getRevision()) {
|
||||
adapter.incrementRevision();
|
||||
@@ -436,7 +436,7 @@ public class ConversationActivity extends BriarActivity
|
||||
return items;
|
||||
}
|
||||
|
||||
private void loadMessageBody(final MessageId m) {
|
||||
private void loadMessageBody(MessageId m) {
|
||||
runOnDbThread(() -> {
|
||||
try {
|
||||
long now = System.currentTimeMillis();
|
||||
@@ -451,7 +451,7 @@ public class ConversationActivity extends BriarActivity
|
||||
});
|
||||
}
|
||||
|
||||
private void displayMessageBody(final MessageId m, final String body) {
|
||||
private void displayMessageBody(MessageId m, String body) {
|
||||
runOnUiThreadUnlessDestroyed(() -> {
|
||||
bodyCache.put(m, body);
|
||||
SparseArray<ConversationItem> messages =
|
||||
@@ -543,7 +543,7 @@ public class ConversationActivity extends BriarActivity
|
||||
}
|
||||
}
|
||||
|
||||
private void addConversationItem(final ConversationItem item) {
|
||||
private void addConversationItem(ConversationItem item) {
|
||||
runOnUiThreadUnlessDestroyed(() -> {
|
||||
adapter.incrementRevision();
|
||||
adapter.add(item);
|
||||
@@ -552,10 +552,10 @@ public class ConversationActivity extends BriarActivity
|
||||
});
|
||||
}
|
||||
|
||||
private void handleIntroductionRequest(final IntroductionRequest m) {
|
||||
private void handleIntroductionRequest(IntroductionRequest m) {
|
||||
getContactNameTask().addListener(new FutureTaskListener<String>() {
|
||||
@Override
|
||||
public void onSuccess(final String contactName) {
|
||||
public void onSuccess(String contactName) {
|
||||
runOnUiThreadUnlessDestroyed(() -> {
|
||||
ConversationItem item = ConversationItem
|
||||
.from(ConversationActivity.this, contactName, m);
|
||||
@@ -563,17 +563,17 @@ public class ConversationActivity extends BriarActivity
|
||||
});
|
||||
}
|
||||
@Override
|
||||
public void onFailure(final Throwable exception) {
|
||||
public void onFailure(Throwable exception) {
|
||||
runOnUiThreadUnlessDestroyed(
|
||||
() -> handleDbException((DbException) exception));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void handleIntroductionResponse(final IntroductionResponse m) {
|
||||
private void handleIntroductionResponse(IntroductionResponse m) {
|
||||
getContactNameTask().addListener(new FutureTaskListener<String>() {
|
||||
@Override
|
||||
public void onSuccess(final String contactName) {
|
||||
public void onSuccess(String contactName) {
|
||||
runOnUiThreadUnlessDestroyed(() -> {
|
||||
ConversationItem item = ConversationItem
|
||||
.from(ConversationActivity.this, contactName, m);
|
||||
@@ -581,17 +581,17 @@ public class ConversationActivity extends BriarActivity
|
||||
});
|
||||
}
|
||||
@Override
|
||||
public void onFailure(final Throwable exception) {
|
||||
public void onFailure(Throwable exception) {
|
||||
runOnUiThreadUnlessDestroyed(
|
||||
() -> handleDbException((DbException) exception));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void handleInvitationRequest(final InvitationRequest m) {
|
||||
private void handleInvitationRequest(InvitationRequest m) {
|
||||
getContactNameTask().addListener(new FutureTaskListener<String>() {
|
||||
@Override
|
||||
public void onSuccess(final String contactName) {
|
||||
public void onSuccess(String contactName) {
|
||||
runOnUiThreadUnlessDestroyed(() -> {
|
||||
ConversationItem item = ConversationItem
|
||||
.from(ConversationActivity.this, contactName, m);
|
||||
@@ -599,17 +599,17 @@ public class ConversationActivity extends BriarActivity
|
||||
});
|
||||
}
|
||||
@Override
|
||||
public void onFailure(final Throwable exception) {
|
||||
public void onFailure(Throwable exception) {
|
||||
runOnUiThreadUnlessDestroyed(
|
||||
() -> handleDbException((DbException) exception));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void handleInvitationResponse(final InvitationResponse m) {
|
||||
private void handleInvitationResponse(InvitationResponse m) {
|
||||
getContactNameTask().addListener(new FutureTaskListener<String>() {
|
||||
@Override
|
||||
public void onSuccess(final String contactName) {
|
||||
public void onSuccess(String contactName) {
|
||||
runOnUiThreadUnlessDestroyed(() -> {
|
||||
ConversationItem item = ConversationItem
|
||||
.from(ConversationActivity.this, contactName, m);
|
||||
@@ -617,15 +617,15 @@ public class ConversationActivity extends BriarActivity
|
||||
});
|
||||
}
|
||||
@Override
|
||||
public void onFailure(final Throwable exception) {
|
||||
public void onFailure(Throwable exception) {
|
||||
runOnUiThreadUnlessDestroyed(
|
||||
() -> handleDbException((DbException) exception));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void markMessages(final Collection<MessageId> messageIds,
|
||||
final boolean sent, final boolean seen) {
|
||||
private void markMessages(Collection<MessageId> messageIds,
|
||||
boolean sent, boolean seen) {
|
||||
runOnUiThreadUnlessDestroyed(() -> {
|
||||
adapter.incrementRevision();
|
||||
Set<MessageId> messages = new HashSet<>(messageIds);
|
||||
@@ -659,7 +659,7 @@ public class ConversationActivity extends BriarActivity
|
||||
return item == null ? 0 : item.getTime() + 1;
|
||||
}
|
||||
|
||||
private void loadGroupId(final String body, final long timestamp) {
|
||||
private void loadGroupId(String body, long timestamp) {
|
||||
runOnDbThread(() -> {
|
||||
try {
|
||||
messagingGroupId =
|
||||
@@ -672,7 +672,7 @@ public class ConversationActivity extends BriarActivity
|
||||
});
|
||||
}
|
||||
|
||||
private void createMessage(final String body, final long timestamp) {
|
||||
private void createMessage(String body, long timestamp) {
|
||||
cryptoExecutor.execute(() -> {
|
||||
try {
|
||||
//noinspection ConstantConditions init in loadGroupId()
|
||||
@@ -683,7 +683,7 @@ public class ConversationActivity extends BriarActivity
|
||||
});
|
||||
}
|
||||
|
||||
private void storeMessage(final PrivateMessage m, final String body) {
|
||||
private void storeMessage(PrivateMessage m, String body) {
|
||||
runOnDbThread(() -> {
|
||||
try {
|
||||
long now = System.currentTimeMillis();
|
||||
@@ -739,7 +739,7 @@ public class ConversationActivity extends BriarActivity
|
||||
});
|
||||
}
|
||||
|
||||
private void enableIntroductionActionIfAvailable(final MenuItem item) {
|
||||
private void enableIntroductionActionIfAvailable(MenuItem item) {
|
||||
runOnDbThread(() -> {
|
||||
try {
|
||||
if (contactManager.getActiveContacts().size() > 1) {
|
||||
@@ -757,7 +757,7 @@ public class ConversationActivity extends BriarActivity
|
||||
});
|
||||
}
|
||||
|
||||
private void enableIntroductionAction(final MenuItem item) {
|
||||
private void enableIntroductionAction(MenuItem item) {
|
||||
runOnUiThreadUnlessDestroyed(() -> item.setEnabled(true));
|
||||
}
|
||||
|
||||
@@ -817,7 +817,7 @@ public class ConversationActivity extends BriarActivity
|
||||
if (!item.isRead()) markMessageRead(item.getGroupId(), item.getId());
|
||||
}
|
||||
|
||||
private void markMessageRead(final GroupId g, final MessageId m) {
|
||||
private void markMessageRead(GroupId g, MessageId m) {
|
||||
runOnDbThread(() -> {
|
||||
try {
|
||||
long now = System.currentTimeMillis();
|
||||
@@ -833,8 +833,7 @@ public class ConversationActivity extends BriarActivity
|
||||
|
||||
@UiThread
|
||||
@Override
|
||||
public void respondToRequest(final ConversationRequestItem item,
|
||||
final boolean accept) {
|
||||
public void respondToRequest(ConversationRequestItem item, boolean accept) {
|
||||
item.setAnswered(true);
|
||||
int position = adapter.findItemPosition(item);
|
||||
if (position != INVALID_POSITION) {
|
||||
|
||||
@@ -25,10 +25,10 @@ class ConversationRequestViewHolder extends ConversationNoticeInViewHolder {
|
||||
}
|
||||
|
||||
void bind(ConversationItem conversationItem,
|
||||
final ConversationListener listener) {
|
||||
ConversationListener listener) {
|
||||
super.bind(conversationItem);
|
||||
|
||||
final ConversationRequestItem item =
|
||||
ConversationRequestItem item =
|
||||
(ConversationRequestItem) conversationItem;
|
||||
|
||||
if (item.wasAnswered() && item.canBeOpened()) {
|
||||
|
||||
@@ -117,7 +117,7 @@ public abstract class BaseContactSelectorFragment<I extends SelectableContactIte
|
||||
onSelectionChanged();
|
||||
}
|
||||
|
||||
private void loadContacts(final Collection<ContactId> selection) {
|
||||
private void loadContacts(Collection<ContactId> selection) {
|
||||
getController().loadContacts(groupId, selection,
|
||||
new UiResultExceptionHandler<Collection<I>, DbException>(
|
||||
this) {
|
||||
|
||||
@@ -25,7 +25,7 @@ public abstract class ContactSelectorActivity
|
||||
extends BriarActivity
|
||||
implements BaseFragmentListener, ContactSelectorListener {
|
||||
|
||||
final static String CONTACTS = "contacts";
|
||||
protected final static String CONTACTS = "contacts";
|
||||
|
||||
// Subclasses may initialise the group ID in different places
|
||||
protected GroupId groupId;
|
||||
|
||||
@@ -38,9 +38,8 @@ public abstract class ContactSelectorControllerImpl
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadContacts(final GroupId g,
|
||||
final Collection<ContactId> selection,
|
||||
final ResultExceptionHandler<Collection<SelectableContactItem>, DbException> handler) {
|
||||
public void loadContacts(GroupId g, Collection<ContactId> selection,
|
||||
ResultExceptionHandler<Collection<SelectableContactItem>, DbException> handler) {
|
||||
runOnDbThread(() -> {
|
||||
try {
|
||||
Collection<SelectableContactItem> contacts = new ArrayList<>();
|
||||
|
||||
@@ -36,7 +36,7 @@ public abstract class ContactSelectorFragment extends
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(final MenuItem item) {
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
case R.id.action_contacts_selected:
|
||||
selectedContacts = adapter.getSelectedContactIds();
|
||||
|
||||
@@ -66,7 +66,7 @@ public class BriarControllerImpl implements BriarController {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void signOut(final ResultHandler<Void> eventHandler) {
|
||||
public void signOut(ResultHandler<Void> eventHandler) {
|
||||
new Thread() {
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
@@ -28,7 +28,7 @@ public class DbControllerImpl implements DbController {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void runOnDbThread(final Runnable task) {
|
||||
public void runOnDbThread(Runnable task) {
|
||||
dbExecutor.execute(() -> {
|
||||
try {
|
||||
lifecycleManager.waitForDatabase();
|
||||
|
||||
@@ -58,7 +58,7 @@ public class SharingControllerImpl implements SharingController, EventListener {
|
||||
}
|
||||
}
|
||||
|
||||
private void setConnected(final ContactId c) {
|
||||
private void setConnected(ContactId c) {
|
||||
if (listener == null) return;
|
||||
listener.runOnUiThreadUnlessDestroyed(() -> {
|
||||
if (contacts.contains(c)) {
|
||||
|
||||
@@ -19,7 +19,7 @@ public abstract class UiExceptionHandler<E extends Exception>
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onException(final E exception) {
|
||||
public void onException(E exception) {
|
||||
listener.runOnUiThreadUnlessDestroyed(() -> onExceptionUi(exception));
|
||||
}
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ public abstract class UiResultExceptionHandler<R, E extends Exception>
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResult(final R result) {
|
||||
public void onResult(R result) {
|
||||
listener.runOnUiThreadUnlessDestroyed(() -> onResultUi(result));
|
||||
}
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ public abstract class UiResultHandler<R> implements ResultHandler<R> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResult(final R result) {
|
||||
public void onResult(R result) {
|
||||
listener.runOnUiThreadUnlessDestroyed(() -> onResultUi(result));
|
||||
}
|
||||
|
||||
|
||||
@@ -120,7 +120,7 @@ public class CreateForumActivity extends BriarActivity {
|
||||
storeForum(nameEntry.getText().toString());
|
||||
}
|
||||
|
||||
private void storeForum(final String name) {
|
||||
private void storeForum(String name) {
|
||||
runOnDbThread(() -> {
|
||||
try {
|
||||
long now = System.currentTimeMillis();
|
||||
@@ -136,7 +136,7 @@ public class CreateForumActivity extends BriarActivity {
|
||||
});
|
||||
}
|
||||
|
||||
private void displayForum(final Forum f) {
|
||||
private void displayForum(Forum f) {
|
||||
runOnUiThreadUnlessDestroyed(() -> {
|
||||
Intent i = new Intent(CreateForumActivity.this,
|
||||
ForumActivity.class);
|
||||
|
||||
@@ -106,7 +106,7 @@ public class ForumActivity extends
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(final MenuItem item) {
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
// Handle presses on the action bar items
|
||||
switch (item.getItemId()) {
|
||||
case R.id.action_forum_share:
|
||||
|
||||
@@ -120,7 +120,7 @@ class ForumControllerImpl extends
|
||||
|
||||
@Override
|
||||
public void loadSharingContacts(
|
||||
final ResultExceptionHandler<Collection<ContactId>, DbException> handler) {
|
||||
ResultExceptionHandler<Collection<ContactId>, DbException> handler) {
|
||||
runOnDbThread(() -> {
|
||||
try {
|
||||
Collection<Contact> contacts =
|
||||
@@ -137,9 +137,9 @@ class ForumControllerImpl extends
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createAndStoreMessage(final String body,
|
||||
@Nullable final ForumItem parentItem,
|
||||
final ResultExceptionHandler<ForumItem, DbException> handler) {
|
||||
public void createAndStoreMessage(String body,
|
||||
@Nullable ForumItem parentItem,
|
||||
ResultExceptionHandler<ForumItem, DbException> handler) {
|
||||
runOnDbThread(() -> {
|
||||
try {
|
||||
LocalAuthor author = identityManager.getLocalAuthor();
|
||||
@@ -156,9 +156,9 @@ class ForumControllerImpl extends
|
||||
});
|
||||
}
|
||||
|
||||
private void createMessage(final String body, final long timestamp,
|
||||
final @Nullable MessageId parentId, final LocalAuthor author,
|
||||
final ResultExceptionHandler<ForumItem, DbException> handler) {
|
||||
private void createMessage(String body, long timestamp,
|
||||
@Nullable MessageId parentId, LocalAuthor author,
|
||||
ResultExceptionHandler<ForumItem, DbException> handler) {
|
||||
cryptoExecutor.execute(() -> {
|
||||
LOG.info("Creating forum post...");
|
||||
ForumPost msg = forumManager.createLocalPost(getGroupId(), body,
|
||||
@@ -184,17 +184,17 @@ class ForumControllerImpl extends
|
||||
}
|
||||
|
||||
private void onForumPostReceived(ForumPostHeader h, String body) {
|
||||
final ForumItem item = buildItem(h, body);
|
||||
ForumItem item = buildItem(h, body);
|
||||
listener.runOnUiThreadUnlessDestroyed(
|
||||
() -> listener.onItemReceived(item));
|
||||
}
|
||||
|
||||
private void onForumInvitationAccepted(final ContactId c) {
|
||||
private void onForumInvitationAccepted(ContactId c) {
|
||||
listener.runOnUiThreadUnlessDestroyed(
|
||||
() -> listener.onInvitationAccepted(c));
|
||||
}
|
||||
|
||||
private void onForumLeft(final ContactId c) {
|
||||
private void onForumLeft(ContactId c) {
|
||||
listener.runOnUiThreadUnlessDestroyed(() -> listener.onForumLeft(c));
|
||||
}
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ class ForumListAdapter
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(ForumViewHolder ui, int position) {
|
||||
final ForumListItem item = getItemAt(position);
|
||||
ForumListItem item = getItemAt(position);
|
||||
if (item == null) return;
|
||||
|
||||
// Avatar
|
||||
|
||||
@@ -140,7 +140,7 @@ public class ForumListFragment extends BaseEventFragment implements
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(final MenuItem item) {
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
// Handle presses on the action bar items
|
||||
switch (item.getItemId()) {
|
||||
case R.id.action_create_forum:
|
||||
@@ -154,7 +154,7 @@ public class ForumListFragment extends BaseEventFragment implements
|
||||
}
|
||||
|
||||
private void loadForums() {
|
||||
final int revision = adapter.getRevision();
|
||||
int revision = adapter.getRevision();
|
||||
listener.runOnDbThread(() -> {
|
||||
try {
|
||||
long now = System.currentTimeMillis();
|
||||
@@ -178,8 +178,7 @@ public class ForumListFragment extends BaseEventFragment implements
|
||||
});
|
||||
}
|
||||
|
||||
private void displayForums(final int revision,
|
||||
final Collection<ForumListItem> forums) {
|
||||
private void displayForums(int revision, Collection<ForumListItem> forums) {
|
||||
runOnUiThreadUnlessDestroyed(() -> {
|
||||
if (revision == adapter.getRevision()) {
|
||||
adapter.incrementRevision();
|
||||
@@ -207,7 +206,7 @@ public class ForumListFragment extends BaseEventFragment implements
|
||||
});
|
||||
}
|
||||
|
||||
private void displayAvailableForums(final int availableCount) {
|
||||
private void displayAvailableForums(int availableCount) {
|
||||
runOnUiThreadUnlessDestroyed(() -> {
|
||||
if (availableCount == 0) {
|
||||
snackbar.dismiss();
|
||||
@@ -247,7 +246,7 @@ public class ForumListFragment extends BaseEventFragment implements
|
||||
}
|
||||
}
|
||||
|
||||
private void updateItem(final GroupId g, final ForumPostHeader m) {
|
||||
private void updateItem(GroupId g, ForumPostHeader m) {
|
||||
runOnUiThreadUnlessDestroyed(() -> {
|
||||
adapter.incrementRevision();
|
||||
int position = adapter.findItemPosition(g);
|
||||
@@ -259,7 +258,7 @@ public class ForumListFragment extends BaseEventFragment implements
|
||||
});
|
||||
}
|
||||
|
||||
private void removeForum(final GroupId g) {
|
||||
private void removeForum(GroupId g) {
|
||||
runOnUiThreadUnlessDestroyed(() -> {
|
||||
adapter.incrementRevision();
|
||||
int position = adapter.findItemPosition(g);
|
||||
|
||||
@@ -44,7 +44,7 @@ public abstract class BaseFragment extends Fragment
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(final MenuItem item) {
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
case android.R.id.home:
|
||||
listener.onBackPressed();
|
||||
@@ -79,8 +79,8 @@ public abstract class BaseFragment extends Fragment
|
||||
|
||||
@CallSuper
|
||||
@Override
|
||||
public void runOnUiThreadUnlessDestroyed(final Runnable r) {
|
||||
final Activity activity = getActivity();
|
||||
public void runOnUiThreadUnlessDestroyed(Runnable r) {
|
||||
Activity activity = getActivity();
|
||||
if (activity != null) {
|
||||
activity.runOnUiThread(() -> {
|
||||
// Note that we don't have to check if the activity has
|
||||
|
||||
@@ -134,7 +134,7 @@ public class ContactChooserFragment extends BaseFragment {
|
||||
});
|
||||
}
|
||||
|
||||
private void displayContacts(final List<ContactListItem> contacts) {
|
||||
private void displayContacts(List<ContactListItem> contacts) {
|
||||
runOnUiThreadUnlessDestroyed(() -> {
|
||||
if (contacts.isEmpty()) list.showData();
|
||||
else adapter.addAll(contacts);
|
||||
|
||||
@@ -118,8 +118,7 @@ public class IntroductionMessageFragment extends BaseFragment
|
||||
return TAG;
|
||||
}
|
||||
|
||||
private void prepareToSetUpViews(final int contactId1,
|
||||
final int contactId2) {
|
||||
private void prepareToSetUpViews(int contactId1, int contactId2) {
|
||||
introductionActivity.runOnDbThread(() -> {
|
||||
try {
|
||||
Contact c1 = contactManager.getContact(
|
||||
@@ -133,7 +132,7 @@ public class IntroductionMessageFragment extends BaseFragment
|
||||
});
|
||||
}
|
||||
|
||||
private void setUpViews(final Contact c1, final Contact c2) {
|
||||
private void setUpViews(Contact c1, Contact c2) {
|
||||
introductionActivity.runOnUiThreadUnlessDestroyed(() -> {
|
||||
contact1 = c1;
|
||||
contact2 = c2;
|
||||
@@ -159,7 +158,7 @@ public class IntroductionMessageFragment extends BaseFragment
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(final MenuItem item) {
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
case android.R.id.home:
|
||||
introductionActivity.hideSoftKeyboard(ui.message);
|
||||
@@ -185,8 +184,7 @@ public class IntroductionMessageFragment extends BaseFragment
|
||||
introductionActivity.supportFinishAfterTransition();
|
||||
}
|
||||
|
||||
private void makeIntroduction(final Contact c1, final Contact c2,
|
||||
final String msg) {
|
||||
private void makeIntroduction(Contact c1, Contact c2, String msg) {
|
||||
introductionActivity.runOnDbThread(() -> {
|
||||
// actually make the introduction
|
||||
try {
|
||||
|
||||
@@ -352,7 +352,7 @@ public class CameraView extends SurfaceView implements SurfaceHolder.Callback,
|
||||
}
|
||||
|
||||
@Override
|
||||
public void surfaceCreated(final SurfaceHolder holder) {
|
||||
public void surfaceCreated(SurfaceHolder holder) {
|
||||
post(() -> {
|
||||
try {
|
||||
surfaceCreatedUi(holder);
|
||||
@@ -375,8 +375,7 @@ public class CameraView extends SurfaceView implements SurfaceHolder.Callback,
|
||||
}
|
||||
|
||||
@Override
|
||||
public void surfaceChanged(final SurfaceHolder holder, int format,
|
||||
final int w, final int h) {
|
||||
public void surfaceChanged(SurfaceHolder holder, int format, int w, int h) {
|
||||
post(() -> {
|
||||
try {
|
||||
surfaceChangedUi(holder, w, h);
|
||||
@@ -411,7 +410,7 @@ public class CameraView extends SurfaceView implements SurfaceHolder.Callback,
|
||||
}
|
||||
|
||||
@Override
|
||||
public void surfaceDestroyed(final SurfaceHolder holder) {
|
||||
public void surfaceDestroyed(SurfaceHolder holder) {
|
||||
post(() -> surfaceDestroyedUi(holder));
|
||||
}
|
||||
|
||||
@@ -427,7 +426,7 @@ public class CameraView extends SurfaceView implements SurfaceHolder.Callback,
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutoFocus(boolean success, final Camera camera) {
|
||||
public void onAutoFocus(boolean success, Camera camera) {
|
||||
LOG.info("Auto focus succeeded: " + success);
|
||||
postDelayed(this::retryAutoFocus, AUTO_FOCUS_RETRY_DELAY);
|
||||
}
|
||||
|
||||
@@ -99,7 +99,7 @@ public class KeyAgreementActivity extends BriarActivity implements
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(final MenuItem item) {
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
case android.R.id.home:
|
||||
onBackPressed();
|
||||
@@ -204,11 +204,11 @@ public class KeyAgreementActivity extends BriarActivity implements
|
||||
}
|
||||
}
|
||||
|
||||
private void keyAgreementFinished(final KeyAgreementResult result) {
|
||||
private void keyAgreementFinished(KeyAgreementResult result) {
|
||||
runOnUiThreadUnlessDestroyed(() -> startContactExchange(result));
|
||||
}
|
||||
|
||||
private void startContactExchange(final KeyAgreementResult result) {
|
||||
private void startContactExchange(KeyAgreementResult result) {
|
||||
runOnDbThread(() -> {
|
||||
LocalAuthor localAuthor;
|
||||
// Load the local pseudonym
|
||||
@@ -229,7 +229,7 @@ public class KeyAgreementActivity extends BriarActivity implements
|
||||
}
|
||||
|
||||
@Override
|
||||
public void contactExchangeSucceeded(final Author remoteAuthor) {
|
||||
public void contactExchangeSucceeded(Author remoteAuthor) {
|
||||
runOnUiThreadUnlessDestroyed(() -> {
|
||||
String contactName = remoteAuthor.getName();
|
||||
String format = getString(string.contact_added_toast);
|
||||
@@ -240,7 +240,7 @@ public class KeyAgreementActivity extends BriarActivity implements
|
||||
}
|
||||
|
||||
@Override
|
||||
public void duplicateContact(final Author remoteAuthor) {
|
||||
public void duplicateContact(Author remoteAuthor) {
|
||||
runOnUiThreadUnlessDestroyed(() -> {
|
||||
String contactName = remoteAuthor.getName();
|
||||
String format = getString(string.contact_already_exists);
|
||||
|
||||
@@ -30,8 +30,8 @@ class QrCodeUtils {
|
||||
int smallestDimen = Math.min(dm.widthPixels, dm.heightPixels);
|
||||
try {
|
||||
// Generate QR code
|
||||
final BitMatrix encoded = new QRCodeWriter().encode(
|
||||
input, QR_CODE, smallestDimen, smallestDimen);
|
||||
BitMatrix encoded = new QRCodeWriter().encode(input, QR_CODE,
|
||||
smallestDimen, smallestDimen);
|
||||
// Convert QR code to Bitmap
|
||||
int width = encoded.getWidth();
|
||||
int height = encoded.getHeight();
|
||||
|
||||
@@ -157,8 +157,7 @@ public class ShowQrCodeFragment extends BaseEventFragment
|
||||
getActivity().registerReceiver(receiver, filter);
|
||||
|
||||
// Enable BT adapter if it is not already on.
|
||||
final BluetoothAdapter adapter =
|
||||
BluetoothAdapter.getDefaultAdapter();
|
||||
BluetoothAdapter adapter = BluetoothAdapter.getDefaultAdapter();
|
||||
if (adapter != null && !adapter.isEnabled()) {
|
||||
waitingForBluetooth = true;
|
||||
eventBus.broadcast(new EnableBluetoothEvent());
|
||||
@@ -189,8 +188,8 @@ public class ShowQrCodeFragment extends BaseEventFragment
|
||||
|
||||
@UiThread
|
||||
private void startListening() {
|
||||
final KeyAgreementTask oldTask = task;
|
||||
final KeyAgreementTask newTask = keyAgreementTaskFactory.createTask();
|
||||
KeyAgreementTask oldTask = task;
|
||||
KeyAgreementTask newTask = keyAgreementTaskFactory.createTask();
|
||||
task = newTask;
|
||||
ioExecutor.execute(() -> {
|
||||
if (oldTask != null) oldTask.stopListening();
|
||||
@@ -200,7 +199,7 @@ public class ShowQrCodeFragment extends BaseEventFragment
|
||||
|
||||
@UiThread
|
||||
private void stopListening() {
|
||||
final KeyAgreementTask oldTask = task;
|
||||
KeyAgreementTask oldTask = task;
|
||||
ioExecutor.execute(() -> {
|
||||
if (oldTask != null) oldTask.stopListening();
|
||||
});
|
||||
@@ -257,11 +256,11 @@ public class ShowQrCodeFragment extends BaseEventFragment
|
||||
}
|
||||
|
||||
@UiThread
|
||||
private void generateBitmapQR(final Payload payload) {
|
||||
private void generateBitmapQR(Payload payload) {
|
||||
// Get narrowest screen dimension
|
||||
Context context = getContext();
|
||||
if (context == null) return;
|
||||
final DisplayMetrics dm = context.getResources().getDisplayMetrics();
|
||||
DisplayMetrics dm = context.getResources().getDisplayMetrics();
|
||||
new AsyncTask<Void, Void, Bitmap>() {
|
||||
|
||||
@Override
|
||||
@@ -286,7 +285,7 @@ public class ShowQrCodeFragment extends BaseEventFragment
|
||||
}.execute();
|
||||
}
|
||||
|
||||
private void setQrCode(final Payload localPayload) {
|
||||
private void setQrCode(Payload localPayload) {
|
||||
runOnUiThreadUnlessDestroyed(() -> generateBitmapQR(localPayload));
|
||||
}
|
||||
|
||||
@@ -311,7 +310,7 @@ public class ShowQrCodeFragment extends BaseEventFragment
|
||||
});
|
||||
}
|
||||
|
||||
private void keyAgreementAborted(final boolean remoteAborted) {
|
||||
private void keyAgreementAborted(boolean remoteAborted) {
|
||||
runOnUiThreadUnlessDestroyed(() -> {
|
||||
reset();
|
||||
mainProgressContainer.setVisibility(INVISIBLE);
|
||||
@@ -325,7 +324,7 @@ public class ShowQrCodeFragment extends BaseEventFragment
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleResult(final Result result) {
|
||||
public void handleResult(Result result) {
|
||||
runOnUiThreadUnlessDestroyed(() -> {
|
||||
LOG.info("Got result from decoder");
|
||||
// Ignore results until the KeyAgreementTask is ready
|
||||
|
||||
@@ -47,9 +47,9 @@ public class PasswordControllerImpl extends ConfigControllerImpl
|
||||
}
|
||||
|
||||
@Override
|
||||
public void validatePassword(final String password,
|
||||
final ResultHandler<Boolean> resultHandler) {
|
||||
final byte[] encrypted = getEncryptedKey();
|
||||
public void validatePassword(String password,
|
||||
ResultHandler<Boolean> resultHandler) {
|
||||
byte[] encrypted = getEncryptedKey();
|
||||
cryptoExecutor.execute(() -> {
|
||||
byte[] key = crypto.decryptWithPassword(encrypted, password);
|
||||
if (key == null) {
|
||||
@@ -62,9 +62,9 @@ public class PasswordControllerImpl extends ConfigControllerImpl
|
||||
}
|
||||
|
||||
@Override
|
||||
public void changePassword(final String password, final String newPassword,
|
||||
final ResultHandler<Boolean> resultHandler) {
|
||||
final byte[] encrypted = getEncryptedKey();
|
||||
public void changePassword(String password, String newPassword,
|
||||
ResultHandler<Boolean> resultHandler) {
|
||||
byte[] encrypted = getEncryptedKey();
|
||||
cryptoExecutor.execute(() -> {
|
||||
byte[] key = crypto.decryptWithPassword(encrypted, password);
|
||||
if (key == null) {
|
||||
|
||||
@@ -2,7 +2,6 @@ package org.briarproject.briar.android.navdrawer;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.annotation.TargetApi;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.content.res.Configuration;
|
||||
import android.os.Bundle;
|
||||
@@ -283,8 +282,7 @@ public class NavDrawerActivity extends BriarActivity implements
|
||||
if (daysUntilExpiry < 0) signOut();
|
||||
|
||||
// show expiry warning text
|
||||
final ViewGroup
|
||||
expiryWarning = (ViewGroup) findViewById(R.id.expiryWarning);
|
||||
ViewGroup expiryWarning = (ViewGroup) findViewById(R.id.expiryWarning);
|
||||
TextView expiryWarningText =
|
||||
(TextView) expiryWarning.findViewById(R.id.expiryWarningText);
|
||||
// make close button functional
|
||||
@@ -320,20 +318,16 @@ public class NavDrawerActivity extends BriarActivity implements
|
||||
new AlertDialog.Builder(this, R.style.BriarDialogTheme)
|
||||
.setMessage(R.string.setup_doze_intro)
|
||||
.setPositiveButton(R.string.ok,
|
||||
new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog,
|
||||
int which) {
|
||||
Intent i = getDozeWhitelistingIntent(
|
||||
NavDrawerActivity.this);
|
||||
startActivityForResult(i,
|
||||
REQUEST_DOZE_WHITELISTING);
|
||||
}
|
||||
(dialog, which) -> {
|
||||
Intent i = getDozeWhitelistingIntent(
|
||||
NavDrawerActivity.this);
|
||||
startActivityForResult(i,
|
||||
REQUEST_DOZE_WHITELISTING);
|
||||
})
|
||||
.show();
|
||||
}
|
||||
|
||||
private void initializeTransports(final LayoutInflater inflater) {
|
||||
private void initializeTransports(LayoutInflater inflater) {
|
||||
transports = new ArrayList<>(3);
|
||||
|
||||
Transport tor = new Transport();
|
||||
@@ -407,7 +401,7 @@ public class NavDrawerActivity extends BriarActivity implements
|
||||
};
|
||||
}
|
||||
|
||||
private void setTransport(final TransportId id, final boolean enabled) {
|
||||
private void setTransport(TransportId id, boolean enabled) {
|
||||
runOnUiThreadUnlessDestroyed(() -> {
|
||||
if (transports == null || transportsAdapter == null) return;
|
||||
for (Transport t : transports) {
|
||||
|
||||
@@ -8,11 +8,11 @@ import org.briarproject.briar.android.controller.handler.ResultHandler;
|
||||
@NotNullByDefault
|
||||
public interface NavDrawerController extends ActivityLifecycleController {
|
||||
|
||||
enum ExpiryWarning { SHOW, NO, UPDATE };
|
||||
enum ExpiryWarning { SHOW, NO, UPDATE }
|
||||
|
||||
boolean isTransportRunning(TransportId transportId);
|
||||
|
||||
void showExpiryWarning(final ResultHandler<ExpiryWarning> handler);
|
||||
void showExpiryWarning(ResultHandler<ExpiryWarning> handler);
|
||||
|
||||
void expiryWarningDismissed();
|
||||
|
||||
|
||||
@@ -96,14 +96,13 @@ public class NavDrawerControllerImpl extends DbControllerImpl
|
||||
}
|
||||
}
|
||||
|
||||
private void transportStateUpdate(final TransportId id,
|
||||
final boolean enabled) {
|
||||
private void transportStateUpdate(TransportId id, boolean enabled) {
|
||||
listener.runOnUiThreadUnlessDestroyed(
|
||||
() -> listener.stateUpdate(id, enabled));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showExpiryWarning(final ResultHandler<ExpiryWarning> handler) {
|
||||
public void showExpiryWarning(ResultHandler<ExpiryWarning> handler) {
|
||||
runOnDbThread(() -> {
|
||||
try {
|
||||
Settings settings =
|
||||
|
||||
@@ -110,7 +110,7 @@ public class GroupActivity extends
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onNamedGroupLoaded(final PrivateGroup group) {
|
||||
protected void onNamedGroupLoaded(PrivateGroup group) {
|
||||
setTitle(group.getName());
|
||||
controller.loadLocalAuthor(
|
||||
new UiResultExceptionHandler<LocalAuthor, DbException>(this) {
|
||||
@@ -144,7 +144,7 @@ public class GroupActivity extends
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(final MenuItem item) {
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
case R.id.action_group_member_list:
|
||||
Intent i1 = new Intent(this, GroupMemberListActivity.class);
|
||||
|
||||
@@ -83,13 +83,12 @@ class GroupControllerImpl extends
|
||||
GroupMessageAddedEvent g = (GroupMessageAddedEvent) e;
|
||||
if (!g.isLocal() && g.getGroupId().equals(getGroupId())) {
|
||||
LOG.info("Group message received, adding...");
|
||||
final GroupMessageItem item =
|
||||
buildItem(g.getHeader(), g.getBody());
|
||||
GroupMessageItem item = buildItem(g.getHeader(), g.getBody());
|
||||
listener.runOnUiThreadUnlessDestroyed(
|
||||
() -> listener.onItemReceived(item));
|
||||
}
|
||||
} else if (e instanceof ContactRelationshipRevealedEvent) {
|
||||
final ContactRelationshipRevealedEvent c =
|
||||
ContactRelationshipRevealedEvent c =
|
||||
(ContactRelationshipRevealedEvent) e;
|
||||
if (getGroupId().equals(c.getGroupId())) {
|
||||
listener.runOnUiThreadUnlessDestroyed(() ->
|
||||
@@ -99,7 +98,7 @@ class GroupControllerImpl extends
|
||||
} else if (e instanceof GroupInvitationResponseReceivedEvent) {
|
||||
GroupInvitationResponseReceivedEvent g =
|
||||
(GroupInvitationResponseReceivedEvent) e;
|
||||
final GroupInvitationResponse r =
|
||||
GroupInvitationResponse r =
|
||||
(GroupInvitationResponse) g.getResponse();
|
||||
if (getGroupId().equals(r.getShareableId()) && r.wasAccepted()) {
|
||||
listener.runOnUiThreadUnlessDestroyed(
|
||||
@@ -141,7 +140,7 @@ class GroupControllerImpl extends
|
||||
|
||||
@Override
|
||||
public void loadSharingContacts(
|
||||
final ResultExceptionHandler<Collection<ContactId>, DbException> handler) {
|
||||
ResultExceptionHandler<Collection<ContactId>, DbException> handler) {
|
||||
runOnDbThread(() -> {
|
||||
try {
|
||||
Collection<GroupMember> members =
|
||||
@@ -160,9 +159,9 @@ class GroupControllerImpl extends
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createAndStoreMessage(final String body,
|
||||
@Nullable final GroupMessageItem parentItem,
|
||||
final ResultExceptionHandler<GroupMessageItem, DbException> handler) {
|
||||
public void createAndStoreMessage(String body,
|
||||
@Nullable GroupMessageItem parentItem,
|
||||
ResultExceptionHandler<GroupMessageItem, DbException> handler) {
|
||||
runOnDbThread(() -> {
|
||||
try {
|
||||
LocalAuthor author = identityManager.getLocalAuthor();
|
||||
@@ -183,10 +182,10 @@ class GroupControllerImpl extends
|
||||
});
|
||||
}
|
||||
|
||||
private void createMessage(final String body, final long timestamp,
|
||||
final @Nullable MessageId parentId, final LocalAuthor author,
|
||||
final MessageId previousMsgId,
|
||||
final ResultExceptionHandler<GroupMessageItem, DbException> handler) {
|
||||
private void createMessage(String body, long timestamp,
|
||||
@Nullable MessageId parentId, LocalAuthor author,
|
||||
MessageId previousMsgId,
|
||||
ResultExceptionHandler<GroupMessageItem, DbException> handler) {
|
||||
cryptoExecutor.execute(() -> {
|
||||
LOG.info("Creating group message...");
|
||||
GroupMessage msg = groupMessageFactory
|
||||
@@ -218,7 +217,7 @@ class GroupControllerImpl extends
|
||||
|
||||
@Override
|
||||
public void loadLocalAuthor(
|
||||
final ResultExceptionHandler<LocalAuthor, DbException> handler) {
|
||||
ResultExceptionHandler<LocalAuthor, DbException> handler) {
|
||||
runOnDbThread(() -> {
|
||||
try {
|
||||
LocalAuthor author = identityManager.getLocalAuthor();
|
||||
|
||||
@@ -32,7 +32,7 @@ class JoinMessageItemViewHolder
|
||||
else bind((JoinMessageItem) item);
|
||||
}
|
||||
|
||||
private void bindForCreator(final JoinMessageItem item) {
|
||||
private void bindForCreator(JoinMessageItem item) {
|
||||
if (item.isInitial()) {
|
||||
textView.setText(R.string.groups_member_created_you);
|
||||
} else {
|
||||
@@ -42,8 +42,8 @@ class JoinMessageItemViewHolder
|
||||
}
|
||||
}
|
||||
|
||||
private void bind(final JoinMessageItem item) {
|
||||
final Context ctx = getContext();
|
||||
private void bind(JoinMessageItem item) {
|
||||
Context ctx = getContext();
|
||||
|
||||
if (item.isInitial()) {
|
||||
textView.setText(ctx.getString(R.string.groups_member_created,
|
||||
|
||||
@@ -74,8 +74,8 @@ class CreateGroupControllerImpl extends ContactSelectorControllerImpl
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createGroup(final String name,
|
||||
final ResultExceptionHandler<GroupId, DbException> handler) {
|
||||
public void createGroup(String name,
|
||||
ResultExceptionHandler<GroupId, DbException> handler) {
|
||||
runOnDbThread(() -> {
|
||||
try {
|
||||
LocalAuthor author = identityManager.getLocalAuthor();
|
||||
@@ -87,9 +87,8 @@ class CreateGroupControllerImpl extends ContactSelectorControllerImpl
|
||||
});
|
||||
}
|
||||
|
||||
private void createGroupAndMessages(final LocalAuthor author,
|
||||
final String name,
|
||||
final ResultExceptionHandler<GroupId, DbException> handler) {
|
||||
private void createGroupAndMessages(LocalAuthor author, String name,
|
||||
ResultExceptionHandler<GroupId, DbException> handler) {
|
||||
cryptoExecutor.execute(() -> {
|
||||
LOG.info("Creating group...");
|
||||
PrivateGroup group =
|
||||
@@ -102,9 +101,8 @@ class CreateGroupControllerImpl extends ContactSelectorControllerImpl
|
||||
});
|
||||
}
|
||||
|
||||
private void storeGroup(final PrivateGroup group,
|
||||
final GroupMessage joinMsg,
|
||||
final ResultExceptionHandler<GroupId, DbException> handler) {
|
||||
private void storeGroup(PrivateGroup group, GroupMessage joinMsg,
|
||||
ResultExceptionHandler<GroupId, DbException> handler) {
|
||||
runOnDbThread(() -> {
|
||||
LOG.info("Adding group to database...");
|
||||
try {
|
||||
@@ -123,9 +121,8 @@ class CreateGroupControllerImpl extends ContactSelectorControllerImpl
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendInvitation(final GroupId g,
|
||||
final Collection<ContactId> contactIds, final String message,
|
||||
final ResultExceptionHandler<Void, DbException> handler) {
|
||||
public void sendInvitation(GroupId g, Collection<ContactId> contactIds,
|
||||
String message, ResultExceptionHandler<Void, DbException> handler) {
|
||||
runOnDbThread(() -> {
|
||||
try {
|
||||
LocalAuthor localAuthor = identityManager.getLocalAuthor();
|
||||
@@ -145,9 +142,9 @@ class CreateGroupControllerImpl extends ContactSelectorControllerImpl
|
||||
});
|
||||
}
|
||||
|
||||
private void signInvitations(final GroupId g, final LocalAuthor localAuthor,
|
||||
final Collection<Contact> contacts, final String message,
|
||||
final ResultExceptionHandler<Void, DbException> handler) {
|
||||
private void signInvitations(GroupId g, LocalAuthor localAuthor,
|
||||
Collection<Contact> contacts, String message,
|
||||
ResultExceptionHandler<Void, DbException> handler) {
|
||||
cryptoExecutor.execute(() -> {
|
||||
long timestamp = clock.currentTimeMillis();
|
||||
List<InvitationContext> contexts = new ArrayList<>();
|
||||
@@ -161,9 +158,9 @@ class CreateGroupControllerImpl extends ContactSelectorControllerImpl
|
||||
});
|
||||
}
|
||||
|
||||
private void sendInvitations(final GroupId g,
|
||||
final Collection<InvitationContext> contexts, final String message,
|
||||
final ResultExceptionHandler<Void, DbException> handler) {
|
||||
private void sendInvitations(GroupId g,
|
||||
Collection<InvitationContext> contexts, String message,
|
||||
ResultExceptionHandler<Void, DbException> handler) {
|
||||
runOnDbThread(() -> {
|
||||
try {
|
||||
String msg = message.isEmpty() ? null : message;
|
||||
|
||||
@@ -64,9 +64,8 @@ class GroupInvitationControllerImpl
|
||||
}
|
||||
|
||||
@Override
|
||||
public void respondToInvitation(final GroupInvitationItem item,
|
||||
final boolean accept,
|
||||
final ExceptionHandler<DbException> handler) {
|
||||
public void respondToInvitation(GroupInvitationItem item, boolean accept,
|
||||
ExceptionHandler<DbException> handler) {
|
||||
runOnDbThread(() -> {
|
||||
try {
|
||||
PrivateGroup g = item.getShareable();
|
||||
|
||||
@@ -17,8 +17,8 @@ class GroupInvitationViewHolder
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBind(@Nullable final GroupInvitationItem item,
|
||||
final InvitationClickListener<GroupInvitationItem> listener) {
|
||||
public void onBind(@Nullable GroupInvitationItem item,
|
||||
InvitationClickListener<GroupInvitationItem> listener) {
|
||||
super.onBind(item, listener);
|
||||
if (item == null) return;
|
||||
|
||||
|
||||
@@ -119,7 +119,7 @@ class GroupListControllerImpl extends DbControllerImpl
|
||||
}
|
||||
}
|
||||
|
||||
private void onGroupMessageAdded(final GroupMessageHeader h) {
|
||||
private void onGroupMessageAdded(GroupMessageHeader h) {
|
||||
listener.runOnUiThreadUnlessDestroyed(
|
||||
() -> listener.onGroupMessageAdded(h));
|
||||
}
|
||||
@@ -129,22 +129,22 @@ class GroupListControllerImpl extends DbControllerImpl
|
||||
() -> listener.onGroupInvitationReceived());
|
||||
}
|
||||
|
||||
private void onGroupAdded(final GroupId g) {
|
||||
private void onGroupAdded(GroupId g) {
|
||||
listener.runOnUiThreadUnlessDestroyed(() -> listener.onGroupAdded(g));
|
||||
}
|
||||
|
||||
private void onGroupRemoved(final GroupId g) {
|
||||
private void onGroupRemoved(GroupId g) {
|
||||
listener.runOnUiThreadUnlessDestroyed(() -> listener.onGroupRemoved(g));
|
||||
}
|
||||
|
||||
private void onGroupDissolved(final GroupId g) {
|
||||
private void onGroupDissolved(GroupId g) {
|
||||
listener.runOnUiThreadUnlessDestroyed(
|
||||
() -> listener.onGroupDissolved(g));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadGroups(
|
||||
final ResultExceptionHandler<Collection<GroupItem>, DbException> handler) {
|
||||
ResultExceptionHandler<Collection<GroupItem>, DbException> handler) {
|
||||
runOnDbThread(() -> {
|
||||
try {
|
||||
long now = System.currentTimeMillis();
|
||||
@@ -173,8 +173,7 @@ class GroupListControllerImpl extends DbControllerImpl
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeGroup(final GroupId g,
|
||||
final ExceptionHandler<DbException> handler) {
|
||||
public void removeGroup(GroupId g, ExceptionHandler<DbException> handler) {
|
||||
runOnDbThread(() -> {
|
||||
try {
|
||||
long now = System.currentTimeMillis();
|
||||
@@ -191,7 +190,7 @@ class GroupListControllerImpl extends DbControllerImpl
|
||||
|
||||
@Override
|
||||
public void loadAvailableGroups(
|
||||
final ResultExceptionHandler<Integer, DbException> handler) {
|
||||
ResultExceptionHandler<Integer, DbException> handler) {
|
||||
runOnDbThread(() -> {
|
||||
try {
|
||||
handler.onResult(
|
||||
|
||||
@@ -113,7 +113,7 @@ public class GroupListFragment extends BaseFragment implements
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(final MenuItem item) {
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
case R.id.action_add_group:
|
||||
Intent i = new Intent(getContext(), CreateGroupActivity.class);
|
||||
@@ -184,7 +184,7 @@ public class GroupListFragment extends BaseFragment implements
|
||||
}
|
||||
|
||||
private void loadGroups() {
|
||||
final int revision = adapter.getRevision();
|
||||
int revision = adapter.getRevision();
|
||||
controller.loadGroups(
|
||||
new UiResultExceptionHandler<Collection<GroupItem>, DbException>(
|
||||
this) {
|
||||
|
||||
@@ -50,8 +50,8 @@ class GroupViewHolder extends RecyclerView.ViewHolder {
|
||||
remove = (Button) v.findViewById(R.id.removeButton);
|
||||
}
|
||||
|
||||
void bindView(final Context ctx, final GroupItem group,
|
||||
final OnGroupRemoveClickListener listener) {
|
||||
void bindView(Context ctx, GroupItem group,
|
||||
OnGroupRemoveClickListener listener) {
|
||||
// Avatar
|
||||
avatar.setText(group.getName().substring(0, 1));
|
||||
avatar.setBackgroundBytes(group.getId().getBytes());
|
||||
|
||||
@@ -38,7 +38,7 @@ public class GroupMemberListActivity extends BriarActivity {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(@Nullable final Bundle state) {
|
||||
public void onCreate(@Nullable Bundle state) {
|
||||
super.onCreate(state);
|
||||
|
||||
setContentView(R.layout.activity_sharing_status);
|
||||
|
||||
@@ -40,7 +40,7 @@ class GroupMemberListControllerImpl extends DbControllerImpl
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadMembers(final GroupId groupId, final
|
||||
public void loadMembers(GroupId groupId,
|
||||
ResultExceptionHandler<Collection<MemberListItem>, DbException> handler) {
|
||||
runOnDbThread(() -> {
|
||||
try {
|
||||
|
||||
@@ -59,9 +59,8 @@ class RevealContactsControllerImpl extends DbControllerImpl
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadContacts(final GroupId g,
|
||||
final Collection<ContactId> selection,
|
||||
final ResultExceptionHandler<Collection<RevealableContactItem>, DbException> handler) {
|
||||
public void loadContacts(GroupId g, Collection<ContactId> selection,
|
||||
ResultExceptionHandler<Collection<RevealableContactItem>, DbException> handler) {
|
||||
runOnDbThread(() -> {
|
||||
try {
|
||||
handler.onResult(getItems(g, selection));
|
||||
@@ -98,7 +97,7 @@ class RevealContactsControllerImpl extends DbControllerImpl
|
||||
|
||||
@Override
|
||||
public void isOnboardingNeeded(
|
||||
final ResultExceptionHandler<Boolean, DbException> handler) {
|
||||
ResultExceptionHandler<Boolean, DbException> handler) {
|
||||
runOnDbThread(() -> {
|
||||
try {
|
||||
Settings settings =
|
||||
@@ -129,8 +128,8 @@ class RevealContactsControllerImpl extends DbControllerImpl
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reveal(final GroupId g, final Collection<ContactId> contacts,
|
||||
final ExceptionHandler<DbException> handler) {
|
||||
public void reveal(GroupId g, Collection<ContactId> contacts,
|
||||
ExceptionHandler<DbException> handler) {
|
||||
runOnDbThread(() -> {
|
||||
for (ContactId c : contacts) {
|
||||
try {
|
||||
|
||||
@@ -93,7 +93,7 @@ public class DevReportActivity extends BaseCrashReportDialog
|
||||
Toolbar tb = (Toolbar) findViewById(R.id.toolbar);
|
||||
getDelegate().setSupportActionBar(tb);
|
||||
|
||||
final View requestReport = findViewById(R.id.request_report);
|
||||
View requestReport = findViewById(R.id.request_report);
|
||||
userCommentView = (EditText) findViewById(R.id.user_comment);
|
||||
userEmailView = (EditText) findViewById(R.id.user_email);
|
||||
includeDebugReport = (CheckBox) findViewById(R.id.include_debug_report);
|
||||
@@ -170,7 +170,7 @@ public class DevReportActivity extends BaseCrashReportDialog
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(final MenuItem item) {
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
// Handle presses on the action bar items
|
||||
switch (item.getItemId()) {
|
||||
case android.R.id.home:
|
||||
@@ -243,8 +243,7 @@ public class DevReportActivity extends BaseCrashReportDialog
|
||||
protected CrashReportData doInBackground(Void... args) {
|
||||
File reportFile = (File) getIntent().getSerializableExtra(
|
||||
EXTRA_REPORT_FILE);
|
||||
final CrashReportPersister persister =
|
||||
new CrashReportPersister();
|
||||
CrashReportPersister persister = new CrashReportPersister();
|
||||
try {
|
||||
return persister.load(reportFile);
|
||||
} catch (IOException e) {
|
||||
@@ -293,8 +292,7 @@ public class DevReportActivity extends BaseCrashReportDialog
|
||||
userEmailView.setEnabled(false);
|
||||
sendReport.setEnabled(false);
|
||||
progress.setVisibility(VISIBLE);
|
||||
final boolean includeReport =
|
||||
!isFeedback() || includeDebugReport.isChecked();
|
||||
boolean includeReport = !isFeedback() || includeDebugReport.isChecked();
|
||||
new AsyncTask<Void, Void, Boolean>() {
|
||||
|
||||
@Override
|
||||
|
||||
@@ -215,8 +215,7 @@ public class SettingsFragment extends PreferenceFragmentCompat
|
||||
});
|
||||
}
|
||||
|
||||
private void displaySettings(final boolean btSetting,
|
||||
final int torSetting) {
|
||||
private void displaySettings(boolean btSetting, int torSetting) {
|
||||
listener.runOnUiThreadUnlessDestroyed(() -> {
|
||||
enableBluetooth.setValue(Boolean.toString(btSetting));
|
||||
torNetwork.setValue(Integer.toString(torSetting));
|
||||
@@ -301,7 +300,7 @@ public class SettingsFragment extends PreferenceFragmentCompat
|
||||
else eventBus.broadcast(new DisableBluetoothEvent());
|
||||
}
|
||||
|
||||
private void storeTorSettings(final int torSetting) {
|
||||
private void storeTorSettings(int torSetting) {
|
||||
listener.runOnDbThread(() -> {
|
||||
try {
|
||||
Settings s = new Settings();
|
||||
@@ -317,7 +316,7 @@ public class SettingsFragment extends PreferenceFragmentCompat
|
||||
});
|
||||
}
|
||||
|
||||
private void storeBluetoothSettings(final boolean btSetting) {
|
||||
private void storeBluetoothSettings(boolean btSetting) {
|
||||
listener.runOnDbThread(() -> {
|
||||
try {
|
||||
Settings s = new Settings();
|
||||
@@ -333,7 +332,7 @@ public class SettingsFragment extends PreferenceFragmentCompat
|
||||
});
|
||||
}
|
||||
|
||||
private void storeSettings(final Settings settings) {
|
||||
private void storeSettings(Settings settings) {
|
||||
listener.runOnDbThread(() -> {
|
||||
try {
|
||||
long now = System.currentTimeMillis();
|
||||
|
||||
@@ -64,7 +64,7 @@ public abstract class BaseMessageFragment extends BaseFragment
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(final MenuItem item) {
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
case android.R.id.home:
|
||||
if (message.isKeyboardOpen()) message.hideSoftKeyboard();
|
||||
|
||||
@@ -58,9 +58,8 @@ class BlogInvitationControllerImpl
|
||||
}
|
||||
|
||||
@Override
|
||||
public void respondToInvitation(final SharingInvitationItem item,
|
||||
final boolean accept,
|
||||
final ExceptionHandler<DbException> handler) {
|
||||
public void respondToInvitation(SharingInvitationItem item, boolean accept,
|
||||
ExceptionHandler<DbException> handler) {
|
||||
runOnDbThread(() -> {
|
||||
try {
|
||||
Blog f = (Blog) item.getShareable();
|
||||
|
||||
@@ -59,9 +59,8 @@ class ForumInvitationControllerImpl
|
||||
}
|
||||
|
||||
@Override
|
||||
public void respondToInvitation(final SharingInvitationItem item,
|
||||
final boolean accept,
|
||||
final ExceptionHandler<DbException> handler) {
|
||||
public void respondToInvitation(SharingInvitationItem item, boolean accept,
|
||||
ExceptionHandler<DbException> handler) {
|
||||
runOnDbThread(() -> {
|
||||
try {
|
||||
Forum f = (Forum) item.getShareable();
|
||||
|
||||
@@ -85,8 +85,8 @@ public abstract class InvitationActivity<I extends InvitationItem>
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadInvitations(final boolean clear) {
|
||||
final int revision = adapter.getRevision();
|
||||
public void loadInvitations(boolean clear) {
|
||||
int revision = adapter.getRevision();
|
||||
getController().loadInvitations(clear,
|
||||
new UiResultExceptionHandler<Collection<I>, DbException>(
|
||||
this) {
|
||||
@@ -104,8 +104,7 @@ public abstract class InvitationActivity<I extends InvitationItem>
|
||||
|
||||
abstract protected InvitationController<I> getController();
|
||||
|
||||
protected void respondToInvitation(final I item,
|
||||
final boolean accept) {
|
||||
protected void respondToInvitation(I item, boolean accept) {
|
||||
getController().respondToInvitation(item, accept,
|
||||
new UiExceptionHandler<DbException>(this) {
|
||||
@Override
|
||||
@@ -121,8 +120,8 @@ public abstract class InvitationActivity<I extends InvitationItem>
|
||||
@StringRes
|
||||
abstract protected int getDeclineRes();
|
||||
|
||||
protected void displayInvitations(final int revision,
|
||||
final Collection<I> invitations, final boolean clear) {
|
||||
protected void displayInvitations(int revision, Collection<I> invitations,
|
||||
boolean clear) {
|
||||
runOnUiThreadUnlessDestroyed(() -> {
|
||||
if (invitations.isEmpty()) {
|
||||
LOG.info("No more invitations available, finishing");
|
||||
|
||||
@@ -27,7 +27,7 @@ public abstract class InvitationAdapter<I extends InvitationItem, VH extends Inv
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(VH ui, int position) {
|
||||
final I item = getItemAt(position);
|
||||
I item = getItemAt(position);
|
||||
if (item == null) return;
|
||||
ui.onBind(item, listener);
|
||||
}
|
||||
|
||||
@@ -91,8 +91,8 @@ public abstract class InvitationControllerImpl<I extends InvitationItem>
|
||||
protected abstract ClientId getShareableClientId();
|
||||
|
||||
@Override
|
||||
public void loadInvitations(final boolean clear,
|
||||
final ResultExceptionHandler<Collection<I>, DbException> handler) {
|
||||
public void loadInvitations(boolean clear,
|
||||
ResultExceptionHandler<Collection<I>, DbException> handler) {
|
||||
runOnDbThread(() -> {
|
||||
Collection<I> invitations = new ArrayList<>();
|
||||
try {
|
||||
|
||||
@@ -38,8 +38,7 @@ public class InvitationViewHolder<I extends InvitationItem>
|
||||
}
|
||||
|
||||
@CallSuper
|
||||
public void onBind(@Nullable final I item,
|
||||
final InvitationClickListener<I> listener) {
|
||||
public void onBind(@Nullable I item, InvitationClickListener<I> listener) {
|
||||
if (item == null) return;
|
||||
|
||||
avatar.setText(item.getShareable().getName().substring(0, 1));
|
||||
|
||||
@@ -55,9 +55,8 @@ class ShareBlogControllerImpl extends ContactSelectorControllerImpl
|
||||
}
|
||||
|
||||
@Override
|
||||
public void share(final GroupId g, final Collection<ContactId> contacts,
|
||||
final String message,
|
||||
final ExceptionHandler<DbException> handler) {
|
||||
public void share(GroupId g, Collection<ContactId> contacts, String message,
|
||||
ExceptionHandler<DbException> handler) {
|
||||
runOnDbThread(() -> {
|
||||
try {
|
||||
String msg = isNullOrEmpty(message) ? null : message;
|
||||
|
||||
@@ -55,9 +55,8 @@ class ShareForumControllerImpl extends ContactSelectorControllerImpl
|
||||
}
|
||||
|
||||
@Override
|
||||
public void share(final GroupId g, final Collection<ContactId> contacts,
|
||||
final String message,
|
||||
final ExceptionHandler<DbException> handler) {
|
||||
public void share(GroupId g, Collection<ContactId> contacts,
|
||||
String message, ExceptionHandler<DbException> handler) {
|
||||
runOnDbThread(() -> {
|
||||
try {
|
||||
String msg = isNullOrEmpty(message) ? null : message;
|
||||
|
||||
@@ -5,6 +5,7 @@ import android.view.View;
|
||||
import org.briarproject.bramble.api.contact.Contact;
|
||||
import org.briarproject.bramble.util.StringUtils;
|
||||
import org.briarproject.briar.R;
|
||||
import org.briarproject.briar.android.sharing.InvitationAdapter.InvitationClickListener;
|
||||
import org.briarproject.briar.api.sharing.SharingInvitationItem;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -20,8 +21,8 @@ class SharingInvitationViewHolder
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBind(@Nullable final SharingInvitationItem item,
|
||||
final InvitationAdapter.InvitationClickListener<SharingInvitationItem> listener) {
|
||||
public void onBind(@Nullable SharingInvitationItem item,
|
||||
InvitationClickListener<SharingInvitationItem> listener) {
|
||||
super.onBind(item, listener);
|
||||
if (item == null) return;
|
||||
|
||||
|
||||
@@ -78,7 +78,7 @@ abstract class SharingStatusActivity extends BriarActivity {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(final MenuItem item) {
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
// Handle presses on the action bar items
|
||||
switch (item.getItemId()) {
|
||||
case android.R.id.home:
|
||||
@@ -115,7 +115,7 @@ abstract class SharingStatusActivity extends BriarActivity {
|
||||
});
|
||||
}
|
||||
|
||||
private void displaySharedWith(final List<ContactItem> contacts) {
|
||||
private void displaySharedWith(List<ContactItem> contacts) {
|
||||
runOnUiThreadUnlessDestroyed(() -> {
|
||||
if (contacts.isEmpty()) list.showData();
|
||||
else adapter.addAll(contacts);
|
||||
|
||||
@@ -40,7 +40,7 @@ public abstract class BaseThreadItemViewHolder<I extends ThreadItem>
|
||||
}
|
||||
|
||||
@CallSuper
|
||||
public void bind(final I item, final ThreadItemListener<I> listener) {
|
||||
public void bind(I item, ThreadItemListener<I> listener) {
|
||||
textView.setText(StringUtils.trim(item.getText()));
|
||||
|
||||
author.setAuthor(item.getAuthor());
|
||||
|
||||
@@ -140,8 +140,8 @@ public class ThreadItemAdapter<I extends ThreadItem>
|
||||
* because then the view port is unknown.
|
||||
*/
|
||||
public UnreadCount getUnreadCount() {
|
||||
final int positionTop = layoutManager.findFirstVisibleItemPosition();
|
||||
final int positionBottom = layoutManager.findLastVisibleItemPosition();
|
||||
int positionTop = layoutManager.findFirstVisibleItemPosition();
|
||||
int positionBottom = layoutManager.findLastVisibleItemPosition();
|
||||
if (positionTop == NO_POSITION && positionBottom == NO_POSITION)
|
||||
return new UnreadCount(0, 0);
|
||||
|
||||
@@ -161,7 +161,7 @@ public class ThreadItemAdapter<I extends ThreadItem>
|
||||
* Returns the position of the first unread item below the current viewport
|
||||
*/
|
||||
int getVisibleUnreadPosBottom() {
|
||||
final int positionBottom = layoutManager.findLastVisibleItemPosition();
|
||||
int positionBottom = layoutManager.findLastVisibleItemPosition();
|
||||
if (positionBottom == NO_POSITION) return NO_POSITION;
|
||||
for (int i = positionBottom + 1; i < items.size(); i++) {
|
||||
if (!items.get(i).isRead()) return i;
|
||||
@@ -173,7 +173,7 @@ public class ThreadItemAdapter<I extends ThreadItem>
|
||||
* Returns the position of the first unread item above the current viewport
|
||||
*/
|
||||
int getVisibleUnreadPosTop() {
|
||||
final int positionTop = layoutManager.findFirstVisibleItemPosition();
|
||||
int positionTop = layoutManager.findFirstVisibleItemPosition();
|
||||
int position = NO_POSITION;
|
||||
for (int i = 0; i < items.size(); i++) {
|
||||
if (i < positionTop && !items.get(i).isRead()) {
|
||||
|
||||
@@ -171,7 +171,7 @@ public abstract class ThreadListActivity<G extends NamedGroup, I extends ThreadI
|
||||
protected abstract void onNamedGroupLoaded(G groupItem);
|
||||
|
||||
protected void loadItems() {
|
||||
final int revision = adapter.getRevision();
|
||||
int revision = adapter.getRevision();
|
||||
getController().loadItems(
|
||||
new UiResultExceptionHandler<ThreadItemList<I>, DbException>(
|
||||
this) {
|
||||
@@ -198,7 +198,7 @@ public abstract class ThreadListActivity<G extends NamedGroup, I extends ThreadI
|
||||
});
|
||||
}
|
||||
|
||||
private void displayItems(final ThreadItemList<I> items) {
|
||||
private void displayItems(ThreadItemList<I> items) {
|
||||
adapter.setItems(items);
|
||||
MessageId messageId = items.getFirstVisibleItemId();
|
||||
if (messageId != null)
|
||||
@@ -281,7 +281,7 @@ public abstract class ThreadListActivity<G extends NamedGroup, I extends ThreadI
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onReplyClick(final I item) {
|
||||
public void onReplyClick(I item) {
|
||||
replyId = item.getId();
|
||||
updateTextInput();
|
||||
if (textInput.isKeyboardOpen()) {
|
||||
|
||||
@@ -99,7 +99,7 @@ public abstract class ThreadListControllerImpl<G extends NamedGroup, I extends T
|
||||
|
||||
@Override
|
||||
public void onActivityDestroy() {
|
||||
final MessageId messageId = listener.getFirstVisibleMessageId();
|
||||
MessageId messageId = listener.getFirstVisibleMessageId();
|
||||
if (messageId != null) {
|
||||
dbExecutor.execute(() -> {
|
||||
try {
|
||||
@@ -127,7 +127,7 @@ public abstract class ThreadListControllerImpl<G extends NamedGroup, I extends T
|
||||
|
||||
@Override
|
||||
public void loadNamedGroup(
|
||||
final ResultExceptionHandler<G, DbException> handler) {
|
||||
ResultExceptionHandler<G, DbException> handler) {
|
||||
checkGroupId();
|
||||
runOnDbThread(() -> {
|
||||
try {
|
||||
@@ -150,7 +150,7 @@ public abstract class ThreadListControllerImpl<G extends NamedGroup, I extends T
|
||||
|
||||
@Override
|
||||
public void loadItems(
|
||||
final ResultExceptionHandler<ThreadItemList<I>, DbException> handler) {
|
||||
ResultExceptionHandler<ThreadItemList<I>, DbException> handler) {
|
||||
checkGroupId();
|
||||
runOnDbThread(() -> {
|
||||
try {
|
||||
@@ -194,7 +194,7 @@ public abstract class ThreadListControllerImpl<G extends NamedGroup, I extends T
|
||||
}
|
||||
|
||||
@Override
|
||||
public void markItemsRead(final Collection<I> items) {
|
||||
public void markItemsRead(Collection<I> items) {
|
||||
runOnDbThread(() -> {
|
||||
try {
|
||||
long now = System.currentTimeMillis();
|
||||
@@ -213,8 +213,8 @@ public abstract class ThreadListControllerImpl<G extends NamedGroup, I extends T
|
||||
@DatabaseExecutor
|
||||
protected abstract void markRead(MessageId id) throws DbException;
|
||||
|
||||
protected void storePost(final M msg, final String body,
|
||||
final ResultExceptionHandler<I, DbException> resultHandler) {
|
||||
protected void storePost(M msg, String body,
|
||||
ResultExceptionHandler<I, DbException> resultHandler) {
|
||||
runOnDbThread(() -> {
|
||||
try {
|
||||
long now = System.currentTimeMillis();
|
||||
@@ -235,7 +235,7 @@ public abstract class ThreadListControllerImpl<G extends NamedGroup, I extends T
|
||||
protected abstract H addLocalMessage(M message) throws DbException;
|
||||
|
||||
@Override
|
||||
public void deleteNamedGroup(final ExceptionHandler<DbException> handler) {
|
||||
public void deleteNamedGroup(ExceptionHandler<DbException> handler) {
|
||||
runOnDbThread(() -> {
|
||||
try {
|
||||
long now = System.currentTimeMillis();
|
||||
|
||||
@@ -37,7 +37,7 @@ public class ThreadPostViewHolder<I extends ThreadItem>
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bind(final I item, final ThreadItemListener<I> listener) {
|
||||
public void bind(I item, ThreadItemListener<I> listener) {
|
||||
super.bind(item, listener);
|
||||
|
||||
for (int i = 0; i < lvls.length; i++) {
|
||||
|
||||
@@ -115,7 +115,7 @@ public class UiUtils {
|
||||
for (URLSpan span : spans) {
|
||||
int start = ssb.getSpanStart(span);
|
||||
int end = ssb.getSpanEnd(span);
|
||||
final String url = span.getURL();
|
||||
String url = span.getURL();
|
||||
ssb.removeSpan(span);
|
||||
ClickableSpan cSpan = new ClickableSpan() {
|
||||
@Override
|
||||
@@ -140,8 +140,7 @@ public class UiUtils {
|
||||
return "bulb" + c.getInt();
|
||||
}
|
||||
|
||||
public static OnClickListener getGoToSettingsListener(
|
||||
final Context context) {
|
||||
public static OnClickListener getGoToSettingsListener(Context context) {
|
||||
return (dialog, which) -> {
|
||||
Intent i = new Intent();
|
||||
i.setAction("android.settings.APPLICATION_DETAILS_SETTINGS");
|
||||
|
||||
@@ -57,7 +57,7 @@ public class LinkDialogFragment extends DialogFragment {
|
||||
List activities = packageManager.queryIntentActivities(i,
|
||||
PackageManager.MATCH_DEFAULT_ONLY);
|
||||
boolean choice = activities.size() > 1;
|
||||
final Intent intent = choice ? Intent.createChooser(i,
|
||||
Intent intent = choice ? Intent.createChooser(i,
|
||||
getString(R.string.link_warning_open_link)) : i;
|
||||
|
||||
Button openButton = (Button) v.findViewById(R.id.openButton);
|
||||
|
||||
@@ -65,7 +65,7 @@ public class KeyboardAwareLinearLayout extends LinearLayout {
|
||||
@Nullable AttributeSet attrs, int defStyle) {
|
||||
super(context, attrs, defStyle);
|
||||
rotation = getDeviceRotation();
|
||||
final int statusBarRes = getResources()
|
||||
int statusBarRes = getResources()
|
||||
.getIdentifier("status_bar_height", "dimen", "android");
|
||||
minKeyboardSize =
|
||||
getResources().getDimensionPixelSize(R.dimen.min_keyboard_size);
|
||||
@@ -199,7 +199,7 @@ public class KeyboardAwareLinearLayout extends LinearLayout {
|
||||
prefs.edit().putInt("keyboard_height_portrait", height).apply();
|
||||
}
|
||||
|
||||
public void postOnKeyboardClose(final Runnable runnable) {
|
||||
public void postOnKeyboardClose(Runnable runnable) {
|
||||
if (keyboardOpen) {
|
||||
addOnKeyboardHiddenListener(new OnKeyboardHiddenListener() {
|
||||
@Override
|
||||
@@ -213,7 +213,7 @@ public class KeyboardAwareLinearLayout extends LinearLayout {
|
||||
}
|
||||
}
|
||||
|
||||
public void postOnKeyboardOpen(final Runnable runnable) {
|
||||
public void postOnKeyboardOpen(Runnable runnable) {
|
||||
if (!keyboardOpen) {
|
||||
addOnKeyboardShownListener(new OnKeyboardShownListener() {
|
||||
@Override
|
||||
|
||||
@@ -56,7 +56,7 @@ public class EmojiDrawer extends LinearLayout {
|
||||
}
|
||||
|
||||
private void initView() {
|
||||
final View v = LayoutInflater.from(getContext())
|
||||
View v = LayoutInflater.from(getContext())
|
||||
.inflate(R.layout.emoji_drawer, this, true);
|
||||
initializeResources(v);
|
||||
initializePageModels();
|
||||
|
||||
@@ -33,8 +33,8 @@ public class EmojiEditText extends AppCompatEditText {
|
||||
}
|
||||
|
||||
public void insertEmoji(String emoji) {
|
||||
final int start = getSelectionStart();
|
||||
final int end = getSelectionEnd();
|
||||
int start = getSelectionStart();
|
||||
int end = getSelectionEnd();
|
||||
|
||||
getText().replace(Math.min(start, end), Math.max(start, end), emoji);
|
||||
setSelection(start + emoji.length());
|
||||
|
||||
@@ -33,7 +33,7 @@ public class EmojiPageView extends FrameLayout {
|
||||
public EmojiPageView(Context context, @Nullable AttributeSet attrs,
|
||||
int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
final View view = LayoutInflater.from(getContext())
|
||||
View view = LayoutInflater.from(getContext())
|
||||
.inflate(R.layout.emoji_grid_layout, this, true);
|
||||
grid = (GridView) view.findViewById(R.id.emoji);
|
||||
grid.setColumnWidth(getResources()
|
||||
|
||||
@@ -135,10 +135,10 @@ public class EmojiProvider {
|
||||
return null;
|
||||
}
|
||||
|
||||
final EmojiDrawable drawable = new EmojiDrawable(drawInfo, decodeScale);
|
||||
EmojiDrawable drawable = new EmojiDrawable(drawInfo, decodeScale);
|
||||
drawInfo.page.get().addListener(new FutureTaskListener<Bitmap>() {
|
||||
@Override
|
||||
public void onSuccess(final Bitmap result) {
|
||||
public void onSuccess(Bitmap result) {
|
||||
androidExecutor.runOnUiThread(() -> drawable.setBitmap(result));
|
||||
}
|
||||
|
||||
|
||||
@@ -109,7 +109,7 @@ public class RecentEmojiPageModel implements EmojiPageModel {
|
||||
return result;
|
||||
}
|
||||
|
||||
private void save(final String serialized) {
|
||||
private void save(String serialized) {
|
||||
dbExecutor.execute(() -> {
|
||||
Settings settings = new Settings();
|
||||
settings.put(EMOJI_LRU_PREFERENCE, serialized);
|
||||
|
||||
@@ -41,11 +41,11 @@ public class ListenableFutureTask<V> extends FutureTask<V> {
|
||||
this.identifier = identifier;
|
||||
}
|
||||
|
||||
public ListenableFutureTask(final V result) {
|
||||
public ListenableFutureTask(V result) {
|
||||
this(result, null);
|
||||
}
|
||||
|
||||
private ListenableFutureTask(final V result, @Nullable Object identifier) {
|
||||
private ListenableFutureTask(V result, @Nullable Object identifier) {
|
||||
super(() -> result);
|
||||
this.identifier = identifier;
|
||||
this.run();
|
||||
|
||||
@@ -40,14 +40,14 @@ public class BitmapUtil {
|
||||
private static <T> Bitmap createScaledBitmapInto(Context context, T model,
|
||||
int width, int height)
|
||||
throws BitmapDecodingException {
|
||||
final Bitmap rough = Downsampler.AT_LEAST
|
||||
Bitmap rough = Downsampler.AT_LEAST
|
||||
.decode(getInputStreamForModel(context, model),
|
||||
Glide.get(context).getBitmapPool(),
|
||||
width, height, DecodeFormat.PREFER_RGB_565);
|
||||
|
||||
final Resource<Bitmap> resource = BitmapResource
|
||||
Resource<Bitmap> resource = BitmapResource
|
||||
.obtain(rough, Glide.get(context).getBitmapPool());
|
||||
final Resource<Bitmap> result =
|
||||
Resource<Bitmap> result =
|
||||
new FitCenter(context).transform(resource, width, height);
|
||||
|
||||
if (result == null) {
|
||||
|
||||
Reference in New Issue
Block a user