From b421787bbee058108d7e7f5d1896b1ad1f484ef2 Mon Sep 17 00:00:00 2001 From: kyori19 Date: Sun, 21 Apr 2019 22:16:39 +0900 Subject: [PATCH] Implement redraft feature. (#1190) * Implement "Delete and Edit" feature * Some changes to ComposeActivity Support for uploaded medias, sensitive option. Fix typo. Change names of some extra keys. * Use Glide instead of Picasso * Pass ArrayList instead of json * Change wording for re-draft * Fix test --- .../keylesspalace/tusky/ComposeActivity.java | 145 ++++++++++++------ .../tusky/SavedTootActivity.java | 4 +- .../conversation/ConversationEntity.kt | 2 +- .../com/keylesspalace/tusky/db/Converters.kt | 4 +- .../com/keylesspalace/tusky/entity/Status.kt | 2 +- .../tusky/fragment/SFragment.java | 61 +++++++- .../tusky/repository/TimelineRepository.kt | 12 +- .../main/res/menu/status_more_for_user.xml | 3 + app/src/main/res/values-ja/strings.xml | 1 + app/src/main/res/values/strings.xml | 2 + .../tusky/BottomSheetActivityTest.kt | 2 +- .../tusky/fragment/TimelineRepositoryTest.kt | 3 +- 12 files changed, 178 insertions(+), 63 deletions(-) diff --git a/app/src/main/java/com/keylesspalace/tusky/ComposeActivity.java b/app/src/main/java/com/keylesspalace/tusky/ComposeActivity.java index 04aa41f7..840be168 100644 --- a/app/src/main/java/com/keylesspalace/tusky/ComposeActivity.java +++ b/app/src/main/java/com/keylesspalace/tusky/ComposeActivity.java @@ -60,13 +60,32 @@ import android.widget.PopupMenu; import android.widget.TextView; import android.widget.Toast; +import androidx.annotation.ColorInt; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.annotation.Px; +import androidx.annotation.StringRes; +import androidx.appcompat.app.ActionBar; +import androidx.appcompat.app.AlertDialog; +import androidx.appcompat.content.res.AppCompatResources; +import androidx.appcompat.widget.Toolbar; +import androidx.core.app.ActivityCompat; +import androidx.core.content.ContextCompat; +import androidx.core.content.FileProvider; +import androidx.core.view.inputmethod.InputConnectionCompat; +import androidx.core.view.inputmethod.InputContentInfoCompat; +import androidx.lifecycle.Lifecycle; +import androidx.recyclerview.widget.GridLayoutManager; +import androidx.recyclerview.widget.RecyclerView; +import androidx.transition.TransitionManager; + import com.bumptech.glide.Glide; import com.google.android.material.bottomsheet.BottomSheetBehavior; import com.google.android.material.snackbar.Snackbar; import com.google.gson.Gson; import com.google.gson.reflect.TypeToken; -import com.keylesspalace.tusky.adapter.EmojiAdapter; import com.keylesspalace.tusky.adapter.ComposeAutoCompleteAdapter; +import com.keylesspalace.tusky.adapter.EmojiAdapter; import com.keylesspalace.tusky.adapter.OnEmojiSelectedListener; import com.keylesspalace.tusky.db.AccountEntity; import com.keylesspalace.tusky.db.AppDatabase; @@ -81,10 +100,10 @@ import com.keylesspalace.tusky.entity.Status; import com.keylesspalace.tusky.network.MastodonApi; import com.keylesspalace.tusky.network.ProgressRequestBody; import com.keylesspalace.tusky.service.SendTootService; +import com.keylesspalace.tusky.util.ComposeTokenizer; import com.keylesspalace.tusky.util.CountUpDownLatch; import com.keylesspalace.tusky.util.DownsizeImageTask; import com.keylesspalace.tusky.util.ListUtils; -import com.keylesspalace.tusky.util.ComposeTokenizer; import com.keylesspalace.tusky.util.SaveTootHelper; import com.keylesspalace.tusky.util.SpanUtilsKt; import com.keylesspalace.tusky.util.StringUtils; @@ -114,24 +133,6 @@ import java.util.concurrent.CountDownLatch; import javax.inject.Inject; -import androidx.annotation.ColorInt; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.annotation.Px; -import androidx.annotation.StringRes; -import androidx.appcompat.app.ActionBar; -import androidx.appcompat.app.AlertDialog; -import androidx.appcompat.content.res.AppCompatResources; -import androidx.appcompat.widget.Toolbar; -import androidx.core.app.ActivityCompat; -import androidx.core.content.ContextCompat; -import androidx.core.content.FileProvider; -import androidx.core.view.inputmethod.InputConnectionCompat; -import androidx.core.view.inputmethod.InputContentInfoCompat; -import androidx.lifecycle.Lifecycle; -import androidx.recyclerview.widget.GridLayoutManager; -import androidx.recyclerview.widget.RecyclerView; -import androidx.transition.TransitionManager; import at.connyduck.sparkbutton.helpers.Utils; import io.reactivex.Single; import io.reactivex.SingleObserver; @@ -171,16 +172,18 @@ public final class ComposeActivity private static final int PERMISSIONS_REQUEST_READ_EXTERNAL_STORAGE = 1; private static final String SAVED_TOOT_UID_EXTRA = "saved_toot_uid"; - private static final String SAVED_TOOT_TEXT_EXTRA = "saved_toot_text"; + private static final String TOOT_TEXT_EXTRA = "toot_text"; private static final String SAVED_JSON_URLS_EXTRA = "saved_json_urls"; private static final String SAVED_JSON_DESCRIPTIONS_EXTRA = "saved_json_descriptions"; - private static final String SAVED_TOOT_VISIBILITY_EXTRA = "saved_toot_visibility"; + private static final String TOOT_VISIBILITY_EXTRA = "toot_visibility"; private static final String IN_REPLY_TO_ID_EXTRA = "in_reply_to_id"; - private static final String REPLY_VISIBILITY_EXTRA = "reply_visibilty"; + private static final String REPLY_VISIBILITY_EXTRA = "reply_visibility"; private static final String CONTENT_WARNING_EXTRA = "content_warning"; - private static final String MENTIONED_USERNAMES_EXTRA = "netnioned_usernames"; + private static final String MENTIONED_USERNAMES_EXTRA = "mentioned_usernames"; private static final String REPLYING_STATUS_AUTHOR_USERNAME_EXTRA = "replying_author_nickname_extra"; private static final String REPLYING_STATUS_CONTENT_EXTRA = "replying_status_content"; + private static final String MEDIA_ATTACHMENTS_EXTRA = "media_attachments"; + private static final String SENSITIVE_EXTRA = "sensitive"; // Mastodon only counts URLs as this long in terms of status character limits static final int MAXIMUM_URL_LENGTH = 23; // https://github.com/tootsuite/mastodon/blob/1656663/app/models/media_attachment.rb#L94 @@ -409,6 +412,7 @@ public final class ComposeActivity String[] mentionedUsernames = null; ArrayList loadedDraftMediaUris = null; ArrayList loadedDraftMediaDescriptions = null; + ArrayList mediaAttachments = null; inReplyToId = null; if (intent != null) { @@ -432,14 +436,13 @@ public final class ComposeActivity } } - // If come from SavedTootActivity - String savedTootText = intent.getStringExtra(SAVED_TOOT_TEXT_EXTRA); - if (!TextUtils.isEmpty(savedTootText)) { - startingText = savedTootText; - textEditor.setText(savedTootText); + String tootText = intent.getStringExtra(TOOT_TEXT_EXTRA); + if (!TextUtils.isEmpty(tootText)) { + textEditor.setText(tootText); } // try to redo a list of media + // If come from SavedTootActivity String savedJsonUrls = intent.getStringExtra(SAVED_JSON_URLS_EXTRA); String savedJsonDescriptions = intent.getStringExtra(SAVED_JSON_DESCRIPTIONS_EXTRA); if (!TextUtils.isEmpty(savedJsonUrls)) { @@ -452,15 +455,20 @@ public final class ComposeActivity new TypeToken>() { }.getType()); } + // If come from redraft + mediaAttachments = intent.getParcelableArrayListExtra(MEDIA_ATTACHMENTS_EXTRA); int savedTootUid = intent.getIntExtra(SAVED_TOOT_UID_EXTRA, 0); if (savedTootUid != 0) { this.savedTootUid = savedTootUid; + + // If come from SavedTootActivity + startingText = tootText; } - int savedTootVisibility = intent.getIntExtra(SAVED_TOOT_VISIBILITY_EXTRA, Status.Visibility.UNKNOWN.getNum()); - if (savedTootVisibility != Status.Visibility.UNKNOWN.getNum()) { - startingVisibility = Status.Visibility.byNum(savedTootVisibility); + int tootVisibility = intent.getIntExtra(TOOT_VISIBILITY_EXTRA, Status.Visibility.UNKNOWN.getNum()); + if (tootVisibility != Status.Visibility.UNKNOWN.getNum()) { + startingVisibility = Status.Visibility.byNum(tootVisibility); } if (intent.hasExtra(REPLYING_STATUS_AUTHOR_USERNAME_EXTRA)) { @@ -491,6 +499,8 @@ public final class ComposeActivity if (intent.hasExtra(REPLYING_STATUS_CONTENT_EXTRA)) { replyContentTextView.setText(intent.getStringExtra(REPLYING_STATUS_CONTENT_EXTRA)); } + + statusMarkSensitive = intent.getBooleanExtra(SENSITIVE_EXTRA, false); } // After the starting state is finalised, the interface can be set to reflect this state. @@ -575,6 +585,25 @@ public final class ComposeActivity } pickMedia(uri, mediaSize, description); } + } else if (!ListUtils.isEmpty(mediaAttachments)) { + for (int mediaIndex =0; mediaIndex < mediaAttachments.size(); ++mediaIndex) { + Attachment media = mediaAttachments.get(mediaIndex); + QueuedMedia.Type type; + switch (media.getType()) { + case UNKNOWN: + case IMAGE: + default: { + type = QueuedMedia.Type.IMAGE; + break; + } + case VIDEO: + case GIFV: { + type = QueuedMedia.Type.VIDEO; + break; + } + } + addMediaToQueue(media.getId(), type, media.getPreviewUrl(), media.getDescription()); + } } else if (savedMediaQueued != null) { for (SavedQueuedMedia item : savedMediaQueued) { Bitmap preview = getImageThumbnail(getContentResolver(), item.uri, thumbnailViewSize); @@ -1111,6 +1140,11 @@ public final class ComposeActivity addMediaToQueue(null, type, preview, uri, mediaSize, null, description); } + private void addMediaToQueue(String id, QueuedMedia.Type type, String previewUrl, @Nullable String description) { + addMediaToQueue(id, type, null, Uri.parse(previewUrl), 0, + QueuedMedia.ReadyStage.UPLOADED, description); + } + private void addMediaToQueue(@Nullable String id, QueuedMedia.Type type, Bitmap preview, Uri uri, long mediaSize, QueuedMedia.ReadyStage readyStage, @Nullable String description) { final QueuedMedia item = new QueuedMedia(type, uri, new ProgressImageView(this), @@ -1126,7 +1160,14 @@ public final class ComposeActivity layoutParams.setMargins(margin, 0, margin, marginBottom); view.setLayoutParams(layoutParams); view.setScaleType(ImageView.ScaleType.CENTER_CROP); - view.setImageBitmap(preview); + if (preview != null) { + view.setImageBitmap(preview); + } else { + Glide.with(this) + .load(uri) + .placeholder(null) + .into(view); + } view.setOnClickListener(v -> onMediaClick(item, v)); view.setContentDescription(getString(R.string.action_delete)); mediaPreviewBar.addView(view); @@ -1782,7 +1823,7 @@ public final class ComposeActivity @Nullable private Integer savedTootUid; @Nullable - private String savedTootText; + private String tootText; @Nullable private String savedJsonUrls; @Nullable @@ -1794,21 +1835,25 @@ public final class ComposeActivity @Nullable private Status.Visibility replyVisibility; @Nullable - private Status.Visibility savedVisibility; + private Status.Visibility visibility; @Nullable private String contentWarning; @Nullable private String replyingStatusAuthor; @Nullable private String replyingStatusContent; + @Nullable + private ArrayList mediaAttachments; + private boolean sensitive = false; + public IntentBuilder savedTootUid(int uid) { this.savedTootUid = uid; return this; } - public IntentBuilder savedTootText(String savedTootText) { - this.savedTootText = savedTootText; + public IntentBuilder tootText(String tootText) { + this.tootText = tootText; return this; } @@ -1822,8 +1867,8 @@ public final class ComposeActivity return this; } - public IntentBuilder savedVisibility(Status.Visibility savedVisibility) { - this.savedVisibility = savedVisibility; + public IntentBuilder visibility(Status.Visibility visibility) { + this.visibility = visibility; return this; } @@ -1857,14 +1902,24 @@ public final class ComposeActivity return this; } + public IntentBuilder mediaAttachments(ArrayList mediaAttachments) { + this.mediaAttachments = mediaAttachments; + return this; + } + + public IntentBuilder sensitive(boolean sensitive) { + this.sensitive = sensitive; + return this; + } + public Intent build(Context context) { Intent intent = new Intent(context, ComposeActivity.class); if (savedTootUid != null) { intent.putExtra(SAVED_TOOT_UID_EXTRA, (int) savedTootUid); } - if (savedTootText != null) { - intent.putExtra(SAVED_TOOT_TEXT_EXTRA, savedTootText); + if (tootText != null) { + intent.putExtra(TOOT_TEXT_EXTRA, tootText); } if (savedJsonUrls != null) { intent.putExtra(SAVED_JSON_URLS_EXTRA, savedJsonUrls); @@ -1882,8 +1937,8 @@ public final class ComposeActivity if (replyVisibility != null) { intent.putExtra(REPLY_VISIBILITY_EXTRA, replyVisibility.getNum()); } - if (savedVisibility != null) { - intent.putExtra(SAVED_TOOT_VISIBILITY_EXTRA, savedVisibility.getNum()); + if (visibility != null) { + intent.putExtra(TOOT_VISIBILITY_EXTRA, visibility.getNum()); } if (contentWarning != null) { intent.putExtra(CONTENT_WARNING_EXTRA, contentWarning); @@ -1894,6 +1949,10 @@ public final class ComposeActivity if (replyingStatusAuthor != null) { intent.putExtra(REPLYING_STATUS_AUTHOR_USERNAME_EXTRA, replyingStatusAuthor); } + if (mediaAttachments != null) { + intent.putParcelableArrayListExtra(MEDIA_ATTACHMENTS_EXTRA, mediaAttachments); + } + intent.putExtra(SENSITIVE_EXTRA, sensitive); return intent; } } diff --git a/app/src/main/java/com/keylesspalace/tusky/SavedTootActivity.java b/app/src/main/java/com/keylesspalace/tusky/SavedTootActivity.java index bed3ec86..4cc67b8f 100644 --- a/app/src/main/java/com/keylesspalace/tusky/SavedTootActivity.java +++ b/app/src/main/java/com/keylesspalace/tusky/SavedTootActivity.java @@ -155,14 +155,14 @@ public final class SavedTootActivity extends BaseActivity implements SavedTootAd public void click(int position, TootEntity item) { Intent intent = new ComposeActivity.IntentBuilder() .savedTootUid(item.getUid()) - .savedTootText(item.getText()) + .tootText(item.getText()) .contentWarning(item.getContentWarning()) .savedJsonUrls(item.getUrls()) .savedJsonDescriptions(item.getDescriptions()) .inReplyToId(item.getInReplyToId()) .replyingStatusAuthor(item.getInReplyToUsername()) .replyingStatusContent(item.getInReplyToText()) - .savedVisibility(item.getVisibility()) + .visibility(item.getVisibility()) .build(this); startActivity(intent); } diff --git a/app/src/main/java/com/keylesspalace/tusky/components/conversation/ConversationEntity.kt b/app/src/main/java/com/keylesspalace/tusky/components/conversation/ConversationEntity.kt index 3dbbfa56..959c586a 100644 --- a/app/src/main/java/com/keylesspalace/tusky/components/conversation/ConversationEntity.kt +++ b/app/src/main/java/com/keylesspalace/tusky/components/conversation/ConversationEntity.kt @@ -71,7 +71,7 @@ data class ConversationStatusEntity( val favourited: Boolean, val sensitive: Boolean, val spoilerText: String, - val attachments: List, + val attachments: ArrayList, val mentions: Array, val showingHiddenContent: Boolean, val expanded: Boolean, diff --git a/app/src/main/java/com/keylesspalace/tusky/db/Converters.kt b/app/src/main/java/com/keylesspalace/tusky/db/Converters.kt index fec036ba..21eee4d7 100644 --- a/app/src/main/java/com/keylesspalace/tusky/db/Converters.kt +++ b/app/src/main/java/com/keylesspalace/tusky/db/Converters.kt @@ -95,8 +95,8 @@ class Converters { } @TypeConverter - fun jsonToAttachmentList(attachmentListJson: String?): List? { - return gson.fromJson(attachmentListJson, object : TypeToken>() {}.type) + fun jsonToAttachmentList(attachmentListJson: String?): ArrayList? { + return gson.fromJson(attachmentListJson, object : TypeToken>() {}.type) } @TypeConverter diff --git a/app/src/main/java/com/keylesspalace/tusky/entity/Status.kt b/app/src/main/java/com/keylesspalace/tusky/entity/Status.kt index 05c817a0..f6eba693 100644 --- a/app/src/main/java/com/keylesspalace/tusky/entity/Status.kt +++ b/app/src/main/java/com/keylesspalace/tusky/entity/Status.kt @@ -36,7 +36,7 @@ data class Status( var sensitive: Boolean, @SerializedName("spoiler_text") val spoilerText: String, val visibility: Visibility, - @SerializedName("media_attachments") var attachments: List, + @SerializedName("media_attachments") var attachments: ArrayList, val mentions: Array, val application: Application?, var pinned: Boolean? diff --git a/app/src/main/java/com/keylesspalace/tusky/fragment/SFragment.java b/app/src/main/java/com/keylesspalace/tusky/fragment/SFragment.java index be675571..b52f21e2 100644 --- a/app/src/main/java/com/keylesspalace/tusky/fragment/SFragment.java +++ b/app/src/main/java/com/keylesspalace/tusky/fragment/SFragment.java @@ -21,17 +21,25 @@ import android.content.ClipData; import android.content.ClipboardManager; import android.content.Context; import android.content.Intent; - import android.content.pm.PackageManager; import android.net.Uri; import android.os.Build; import android.os.Environment; +import android.text.SpannableStringBuilder; import android.text.Spanned; +import android.text.style.URLSpan; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.Toast; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.appcompat.app.AlertDialog; +import androidx.appcompat.widget.PopupMenu; +import androidx.core.app.ActivityOptionsCompat; +import androidx.core.view.ViewCompat; + import com.keylesspalace.tusky.BaseActivity; import com.keylesspalace.tusky.BottomSheetActivity; import com.keylesspalace.tusky.ComposeActivity; @@ -56,13 +64,6 @@ import java.util.Set; import javax.inject.Inject; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.appcompat.app.AlertDialog; -import androidx.appcompat.widget.PopupMenu; -import androidx.core.app.ActivityOptionsCompat; -import androidx.core.view.ViewCompat; - /* Note from Andrew on Jan. 22, 2017: This class is a design problem for me, so I left it with an * awkward name. TimelineFragment and NotificationFragment have significant overlap but the nature * of that is complicated by how they're coupled with Status and Notification and the corresponding @@ -274,6 +275,10 @@ public abstract class SFragment extends BaseFragment implements Injectable { showConfirmDeleteDialog(id, position); return true; } + case R.id.status_delete_and_redraft: { + showConfirmEditDialog(id, position, status); + return true; + } case R.id.pin: { timelineCases.pin(status, !status.isPinned()); return true; @@ -343,6 +348,46 @@ public abstract class SFragment extends BaseFragment implements Injectable { .show(); } + private void showConfirmEditDialog(final String id, final int position, Status status) { + if (getActivity() == null) { + return; + } + new AlertDialog.Builder(getActivity()) + .setMessage(R.string.dialog_redraft_toot_warning) + .setPositiveButton(android.R.string.ok, (dialogInterface, i) -> { + timelineCases.delete(id); + removeItem(position); + + Intent intent = new ComposeActivity.IntentBuilder() + .tootText(getEditableText(status.getContent(), status.getMentions())) + .inReplyToId(status.getInReplyToId()) + .visibility(status.getVisibility()) + .contentWarning(status.getSpoilerText()) + .mediaAttachments(status.getAttachments()) + .sensitive(status.getSensitive()) + .build(getContext()); + startActivity(intent); + }) + .setNegativeButton(android.R.string.cancel, null) + .show(); + } + + private String getEditableText(Spanned content, Status.Mention[] mentions) { + SpannableStringBuilder builder = new SpannableStringBuilder(content); + for (URLSpan span : content.getSpans(0, content.length(), URLSpan.class)) { + String url = span.getURL(); + for (Status.Mention mention : mentions) { + if (url.equals(mention.getUrl())) { + int start = builder.getSpanStart(span); + int end = builder.getSpanEnd(span); + builder.replace(start, end, '@' + mention.getUsername()); + break; + } + } + } + return builder.toString(); + } + private void openAsAccount(String statusUrl, AccountEntity account) { accountManager.setActiveAccount(account); Intent intent = new Intent(getContext(), MainActivity.class); diff --git a/app/src/main/java/com/keylesspalace/tusky/repository/TimelineRepository.kt b/app/src/main/java/com/keylesspalace/tusky/repository/TimelineRepository.kt index f9318f2b..30093a2a 100644 --- a/app/src/main/java/com/keylesspalace/tusky/repository/TimelineRepository.kt +++ b/app/src/main/java/com/keylesspalace/tusky/repository/TimelineRepository.kt @@ -11,12 +11,16 @@ import com.keylesspalace.tusky.entity.Status import com.keylesspalace.tusky.network.MastodonApi import com.keylesspalace.tusky.repository.TimelineRequestMode.DISK import com.keylesspalace.tusky.repository.TimelineRequestMode.NETWORK -import com.keylesspalace.tusky.util.* +import com.keylesspalace.tusky.util.Either +import com.keylesspalace.tusky.util.HtmlConverter +import com.keylesspalace.tusky.util.dec +import com.keylesspalace.tusky.util.inc import io.reactivex.Single import io.reactivex.schedulers.Schedulers import java.io.IOException import java.util.* import java.util.concurrent.TimeUnit +import kotlin.collections.ArrayList data class Placeholder(val id: String) @@ -191,8 +195,8 @@ class TimelineRepositoryImpl( return Either.Left(Placeholder(this.status.serverId)) } - val attachments: List = gson.fromJson(status.attachments, - object : TypeToken>() {}.type) ?: listOf() + val attachments: ArrayList = gson.fromJson(status.attachments, + object : TypeToken>() {}.type) ?: ArrayList() val mentions: Array = gson.fromJson(status.mentions, Array::class.java) ?: arrayOf() val application = gson.fromJson(status.application, Status.Application::class.java) @@ -242,7 +246,7 @@ class TimelineRepositoryImpl( sensitive = false, spoilerText = "", visibility = status.visibility!!, - attachments = listOf(), + attachments = ArrayList(), mentions = arrayOf(), application = null, pinned = false diff --git a/app/src/main/res/menu/status_more_for_user.xml b/app/src/main/res/menu/status_more_for_user.xml index 2fce654a..9b363e49 100644 --- a/app/src/main/res/menu/status_more_for_user.xml +++ b/app/src/main/res/menu/status_more_for_user.xml @@ -29,4 +29,7 @@ + \ No newline at end of file diff --git a/app/src/main/res/values-ja/strings.xml b/app/src/main/res/values-ja/strings.xml index e0bec10f..c8144343 100644 --- a/app/src/main/res/values-ja/strings.xml +++ b/app/src/main/res/values-ja/strings.xml @@ -74,6 +74,7 @@ ブーストを表示 通報 削除 + 削除して編集 トゥート トゥート! 再試行 diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 357f22d8..5b814182 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -83,6 +83,7 @@ Show boosts Report Delete + Delete and re-draft TOOT TOOT! Retry @@ -179,6 +180,7 @@ Revoke the follow request? Unfollow this account? Delete this toot? + Delete and re-draft this toot? Public: Post to public timelines Unlisted: Do not show in public timelines diff --git a/app/src/test/java/com/keylesspalace/tusky/BottomSheetActivityTest.kt b/app/src/test/java/com/keylesspalace/tusky/BottomSheetActivityTest.kt index baa78b69..e87e8434 100644 --- a/app/src/test/java/com/keylesspalace/tusky/BottomSheetActivityTest.kt +++ b/app/src/test/java/com/keylesspalace/tusky/BottomSheetActivityTest.kt @@ -81,7 +81,7 @@ class BottomSheetActivityTest { false, "", Status.Visibility.PUBLIC, - listOf(), + ArrayList(), arrayOf(), null, pinned = false diff --git a/app/src/test/java/com/keylesspalace/tusky/fragment/TimelineRepositoryTest.kt b/app/src/test/java/com/keylesspalace/tusky/fragment/TimelineRepositoryTest.kt index 68853de1..d8c483dd 100644 --- a/app/src/test/java/com/keylesspalace/tusky/fragment/TimelineRepositoryTest.kt +++ b/app/src/test/java/com/keylesspalace/tusky/fragment/TimelineRepositoryTest.kt @@ -30,6 +30,7 @@ import org.mockito.Mock import org.mockito.MockitoAnnotations import java.util.* import java.util.concurrent.TimeUnit +import kotlin.collections.ArrayList class TimelineRepositoryTest { @Mock @@ -297,7 +298,7 @@ class TimelineRepositoryTest { spoilerText = "", reblogged = true, favourited = false, - attachments = listOf(), + attachments = ArrayList(), mentions = arrayOf(), application = null, inReplyToAccountId = null,