refactor(ContentType.java): add the ContentType class back. Full implementation is still missing

This commit is contained in:
LucasGGamerM
2025-04-13 12:44:45 -03:00
parent af19a03f96
commit 8444e54060

View File

@@ -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);
}
}