Create polls (#1452)
* add AddPollDialog * add support for pleroma poll options * add PollPreviewView * add Poll support to drafts * add license header, cleanup * rename drawable files to correct size * fix tests * fix bug with Poll having wrong duration after delete&redraft * add input validation * grey out poll button when its disabled * code cleanup & small improvements
This commit is contained in:
parent
444df322a7
commit
51c6852492
61 changed files with 1540 additions and 76 deletions
|
@ -17,6 +17,7 @@ import com.google.gson.reflect.TypeToken;
|
|||
import com.keylesspalace.tusky.BuildConfig;
|
||||
import com.keylesspalace.tusky.db.TootDao;
|
||||
import com.keylesspalace.tusky.db.TootEntity;
|
||||
import com.keylesspalace.tusky.entity.NewPoll;
|
||||
import com.keylesspalace.tusky.entity.Status;
|
||||
|
||||
import java.io.File;
|
||||
|
@ -41,17 +42,18 @@ public final class SaveTootHelper {
|
|||
|
||||
@SuppressLint("StaticFieldLeak")
|
||||
public boolean saveToot(@NonNull String content,
|
||||
@NonNull String contentWarning,
|
||||
@Nullable String savedJsonUrls,
|
||||
@NonNull List<String> mediaUris,
|
||||
@NonNull List<String> mediaDescriptions,
|
||||
int savedTootUid,
|
||||
@Nullable String inReplyToId,
|
||||
@Nullable String replyingStatusContent,
|
||||
@Nullable String replyingStatusAuthorUsername,
|
||||
@NonNull Status.Visibility statusVisibility) {
|
||||
@NonNull String contentWarning,
|
||||
@Nullable String savedJsonUrls,
|
||||
@NonNull List<String> mediaUris,
|
||||
@NonNull List<String> mediaDescriptions,
|
||||
int savedTootUid,
|
||||
@Nullable String inReplyToId,
|
||||
@Nullable String replyingStatusContent,
|
||||
@Nullable String replyingStatusAuthorUsername,
|
||||
@NonNull Status.Visibility statusVisibility,
|
||||
@Nullable NewPoll poll) {
|
||||
|
||||
if (TextUtils.isEmpty(content) && mediaUris.isEmpty()) {
|
||||
if (TextUtils.isEmpty(content) && mediaUris.isEmpty() && poll == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -86,7 +88,8 @@ public final class SaveTootHelper {
|
|||
inReplyToId,
|
||||
replyingStatusContent,
|
||||
replyingStatusAuthorUsername,
|
||||
statusVisibility);
|
||||
statusVisibility,
|
||||
poll);
|
||||
|
||||
new AsyncTask<Void, Void, Void>() {
|
||||
@Override
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue