mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-12 10:49:06 +01:00
Factor out a reuseable MessageFragment
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package org.briarproject.android.sharing;
|
||||
|
||||
import org.briarproject.R;
|
||||
import org.briarproject.android.ActivityComponent;
|
||||
import org.briarproject.api.blogs.BlogSharingManager;
|
||||
import org.briarproject.api.contact.Contact;
|
||||
@@ -7,18 +8,17 @@ import org.briarproject.api.contact.ContactId;
|
||||
import org.briarproject.api.db.DbException;
|
||||
import org.briarproject.api.sync.GroupId;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
public class ShareBlogActivity extends ShareActivity {
|
||||
|
||||
// Fields that are accessed from background threads must be volatile
|
||||
@Inject
|
||||
volatile BlogSharingManager blogSharingManager;
|
||||
protected volatile BlogSharingManager blogSharingManager;
|
||||
|
||||
ShareMessageFragment getMessageFragment(GroupId groupId,
|
||||
Collection<ContactId> contacts) {
|
||||
return ShareBlogMessageFragment.newInstance(groupId, contacts);
|
||||
@Override
|
||||
BaseMessageFragment getMessageFragment() {
|
||||
return ShareBlogMessageFragment.newInstance();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -26,10 +26,20 @@ public class ShareBlogActivity extends ShareActivity {
|
||||
component.inject(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* This must only be called from a DbThread
|
||||
*/
|
||||
@Override
|
||||
public boolean isDisabled(GroupId groupId, Contact c) throws DbException {
|
||||
return !blogSharingManager.canBeShared(groupId, c);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void share(GroupId g, ContactId c, String msg)
|
||||
throws DbException {
|
||||
blogSharingManager.sendInvitation(g, c, msg);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getSharingError() {
|
||||
return R.string.blogs_sharing_error;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user