From 8444e5406054a733ee9c837fa43574e7e44ec21b Mon Sep 17 00:00:00 2001 From: LucasGGamerM Date: Sun, 13 Apr 2025 12:44:45 -0300 Subject: [PATCH] refactor(ContentType.java): add the ContentType class back. Full implementation is still missing --- .../android/model/ContentType.java | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 mastodon/src/main/java/org/joinmastodon/android/model/ContentType.java diff --git a/mastodon/src/main/java/org/joinmastodon/android/model/ContentType.java b/mastodon/src/main/java/org/joinmastodon/android/model/ContentType.java new file mode 100644 index 000000000..79957bfcb --- /dev/null +++ b/mastodon/src/main/java/org/joinmastodon/android/model/ContentType.java @@ -0,0 +1,39 @@ +package org.joinmastodon.android.model; + +import android.view.Menu; + +import androidx.annotation.Nullable; + +import com.google.gson.annotations.SerializedName; + +import org.joinmastodon.android.R; + +public enum ContentType { + @SerializedName("text/plain") + PLAIN, + @SerializedName("text/html") + HTML, + @SerializedName("text/markdown") + MARKDOWN, + @SerializedName("text/bbcode") + BBCODE, // akkoma + @SerializedName("text/x.misskeymarkdown") + MISSKEY_MARKDOWN, // akkoma/*key + @SerializedName("") + UNSPECIFIED; + + public int getName() { + return switch(this) { + case PLAIN -> R.string.sk_content_type_plain; + case HTML -> R.string.sk_content_type_html; + case MARKDOWN -> R.string.sk_content_type_markdown; + case BBCODE -> R.string.sk_content_type_bbcode; + case MISSKEY_MARKDOWN -> R.string.sk_content_type_mfm; + case UNSPECIFIED -> R.string.sk_content_type_unspecified; + }; + } + + public boolean supportedByInstance(Instance i) { + return i.isAkkoma() || (this!=BBCODE && this!=MISSKEY_MARKDOWN); + } +}