feat: revamping text activities (#406)
* feat(storyReply): redesigned components * feat(storyReply): fixed all markdowns
This commit is contained in:
parent
5473ac8238
commit
ce7ae28e1e
19 changed files with 550 additions and 108 deletions
|
@ -201,7 +201,8 @@
|
|||
android:name=".others.imagesearch.ImageSearchActivity"
|
||||
android:parentActivityName=".MainActivity" />
|
||||
<activity
|
||||
android:name=".util.MarkdownCreatorActivity"/>
|
||||
android:name=".util.MarkdownCreatorActivity"
|
||||
android:windowSoftInputMode="adjustResize" />
|
||||
<activity android:name=".parsers.ParserTestActivity" />
|
||||
<activity
|
||||
android:name=".media.ReviewActivity"
|
||||
|
|
|
@ -2,6 +2,10 @@ package ani.dantotsu.util
|
|||
|
||||
import android.os.Bundle
|
||||
import android.view.ViewGroup
|
||||
import android.widget.FrameLayout
|
||||
import android.widget.ImageView
|
||||
import android.widget.LinearLayout
|
||||
import androidx.appcompat.app.AlertDialog
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.core.view.updateLayoutParams
|
||||
import androidx.core.widget.addTextChangedListener
|
||||
|
@ -15,6 +19,8 @@ import ani.dantotsu.openLinkInBrowser
|
|||
import ani.dantotsu.statusBarHeight
|
||||
import ani.dantotsu.themes.ThemeManager
|
||||
import ani.dantotsu.toast
|
||||
import com.google.android.material.textfield.TextInputEditText
|
||||
import com.google.android.material.textfield.TextInputLayout
|
||||
import io.noties.markwon.editor.MarkwonEditor
|
||||
import io.noties.markwon.editor.MarkwonEditorTextWatcher
|
||||
import kotlinx.coroutines.DelicateCoroutinesApi
|
||||
|
@ -24,8 +30,30 @@ class MarkdownCreatorActivity : AppCompatActivity() {
|
|||
private lateinit var binding: ActivityMarkdownCreatorBinding
|
||||
private lateinit var type: String
|
||||
private var text: String = ""
|
||||
var ping: String? = null
|
||||
private var ping: String? = null
|
||||
private var parentId: Int = 0
|
||||
private var isPreviewMode: Boolean = false
|
||||
|
||||
enum class MarkdownFormat(
|
||||
val syntax: String,
|
||||
val selectionOffset: Int,
|
||||
val imageViewId: Int
|
||||
) {
|
||||
BOLD("****", 2, R.id.formatBold),
|
||||
ITALIC("**", 1, R.id.formatItalic),
|
||||
STRIKETHROUGH("~~~~", 2, R.id.formatStrikethrough),
|
||||
SPOILER("||", 2, R.id.formatSpoiler),
|
||||
LINK("[Placeholder](%s)", 0, R.id.formatLink),
|
||||
IMAGE("img(%s)", 0, R.id.formatImage),
|
||||
YOUTUBE("youtube(%s)", 0, R.id.formatYoutube),
|
||||
VIDEO("webm(%s)", 0, R.id.formatVideo),
|
||||
ORDERED_LIST("1. ", 3, R.id.formatListOrdered),
|
||||
UNORDERED_LIST("- ", 2, R.id.formatListUnordered),
|
||||
HEADING("# ", 2, R.id.formatTitle),
|
||||
CENTERED("~~~~~~", 3, R.id.formatCenter),
|
||||
QUOTE("> ", 2, R.id.formatQuote),
|
||||
CODE("``", 1, R.id.formatCode)
|
||||
}
|
||||
|
||||
@OptIn(DelicateCoroutinesApi::class)
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
|
@ -36,11 +64,15 @@ class MarkdownCreatorActivity : AppCompatActivity() {
|
|||
binding.markdownCreatorToolbar.updateLayoutParams<ViewGroup.MarginLayoutParams> {
|
||||
topMargin = statusBarHeight
|
||||
}
|
||||
binding.buttonContainer.updateLayoutParams<ViewGroup.MarginLayoutParams> {
|
||||
binding.markdownOptionsContainer.updateLayoutParams<ViewGroup.MarginLayoutParams> {
|
||||
bottomMargin += navBarHeight
|
||||
}
|
||||
setContentView(binding.root)
|
||||
|
||||
val params = binding.createButton.layoutParams as ViewGroup.MarginLayoutParams
|
||||
params.marginEnd = 16 * resources.displayMetrics.density.toInt()
|
||||
binding.createButton.layoutParams = params
|
||||
|
||||
if (intent.hasExtra("type")) {
|
||||
type = intent.getStringExtra("type")!!
|
||||
} else {
|
||||
|
@ -69,17 +101,12 @@ class MarkdownCreatorActivity : AppCompatActivity() {
|
|||
text = ping ?: ""
|
||||
binding.editText.setText(text)
|
||||
binding.editText.addTextChangedListener {
|
||||
if (!binding.markdownCreatorPreviewCheckbox.isChecked) {
|
||||
if (!isPreviewMode) {
|
||||
text = it.toString()
|
||||
}
|
||||
}
|
||||
previewMarkdown(false)
|
||||
binding.markdownCreatorPreviewCheckbox.setOnClickListener {
|
||||
previewMarkdown(binding.markdownCreatorPreviewCheckbox.isChecked)
|
||||
}
|
||||
binding.cancelButton.setOnClickListener {
|
||||
onBackPressedDispatcher.onBackPressed()
|
||||
}
|
||||
|
||||
binding.markdownCreatorBack.setOnClickListener {
|
||||
onBackPressedDispatcher.onBackPressed()
|
||||
}
|
||||
|
@ -89,10 +116,10 @@ class MarkdownCreatorActivity : AppCompatActivity() {
|
|||
toast(getString(R.string.cannot_be_empty))
|
||||
return@setOnClickListener
|
||||
}
|
||||
AlertDialogBuilder(this).apply {
|
||||
AlertDialog.Builder(this, R.style.MyPopup).apply {
|
||||
setTitle(R.string.warning)
|
||||
setMessage(R.string.post_to_anilist_warning)
|
||||
setPosButton(R.string.ok) {
|
||||
setPositiveButton(R.string.ok) { _, _ ->
|
||||
launchIO {
|
||||
val editId = intent.getIntExtra("edit", -1)
|
||||
val isEdit = editId != -1
|
||||
|
@ -119,14 +146,126 @@ class MarkdownCreatorActivity : AppCompatActivity() {
|
|||
finish()
|
||||
}
|
||||
}
|
||||
setNeutralButton(R.string.open_rules) {
|
||||
setNeutralButton(R.string.open_rules) { _, _ ->
|
||||
openLinkInBrowser("https://anilist.co/forum/thread/14")
|
||||
}
|
||||
setNegButton(R.string.cancel)
|
||||
setNegativeButton(R.string.cancel, null)
|
||||
}.show()
|
||||
}
|
||||
|
||||
binding.createButton.setOnLongClickListener {
|
||||
isPreviewMode = !isPreviewMode
|
||||
previewMarkdown(isPreviewMode)
|
||||
if (isPreviewMode) {
|
||||
toast("Preview enabled")
|
||||
} else {
|
||||
toast("Preview disabled")
|
||||
}
|
||||
true
|
||||
}
|
||||
binding.editText.requestFocus()
|
||||
setupMarkdownButtons()
|
||||
}
|
||||
|
||||
private fun setupMarkdownButtons() {
|
||||
MarkdownFormat.entries.forEach { format ->
|
||||
findViewById<ImageView>(format.imageViewId)?.setOnClickListener {
|
||||
applyMarkdownFormat(format)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun applyMarkdownFormat(format: MarkdownFormat) {
|
||||
val start = binding.editText.selectionStart
|
||||
val end = binding.editText.selectionEnd
|
||||
|
||||
if (start != end) {
|
||||
val selectedText = binding.editText.text?.substring(start, end) ?: ""
|
||||
val lines = selectedText.split("\n")
|
||||
|
||||
val newText = when (format) {
|
||||
MarkdownFormat.UNORDERED_LIST -> {
|
||||
lines.joinToString("\n") { "- $it" }
|
||||
}
|
||||
MarkdownFormat.ORDERED_LIST -> {
|
||||
lines.mapIndexed { index, line -> "${index + 1}. $line" }.joinToString("\n")
|
||||
}
|
||||
else -> {
|
||||
if (format.syntax.contains("%s")) {
|
||||
String.format(format.syntax, selectedText)
|
||||
} else {
|
||||
format.syntax.substring(0, format.selectionOffset) +
|
||||
selectedText +
|
||||
format.syntax.substring(format.selectionOffset)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
binding.editText.text?.replace(start, end, newText)
|
||||
binding.editText.setSelection(start + newText.length)
|
||||
} else {
|
||||
if (format.syntax.contains("%s")) {
|
||||
showInputDialog(format, start)
|
||||
} else {
|
||||
val newText = format.syntax
|
||||
binding.editText.text?.insert(start, newText)
|
||||
binding.editText.setSelection(start + format.selectionOffset)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private fun showInputDialog(format: MarkdownFormat, position: Int) {
|
||||
val inputLayout = TextInputLayout(this).apply {
|
||||
layoutParams = ViewGroup.LayoutParams(
|
||||
ViewGroup.LayoutParams.MATCH_PARENT,
|
||||
ViewGroup.LayoutParams.WRAP_CONTENT
|
||||
)
|
||||
boxBackgroundMode = TextInputLayout.BOX_BACKGROUND_OUTLINE
|
||||
hint = "Paste your link here"
|
||||
isHintEnabled = true
|
||||
}
|
||||
|
||||
val inputEditText = TextInputEditText(this).apply {
|
||||
layoutParams = LinearLayout.LayoutParams(
|
||||
LinearLayout.LayoutParams.MATCH_PARENT,
|
||||
LinearLayout.LayoutParams.WRAP_CONTENT
|
||||
)
|
||||
}
|
||||
|
||||
inputLayout.addView(inputEditText)
|
||||
|
||||
val container = FrameLayout(this).apply {
|
||||
addView(inputLayout)
|
||||
layoutParams = ViewGroup.LayoutParams(
|
||||
ViewGroup.LayoutParams.MATCH_PARENT,
|
||||
ViewGroup.LayoutParams.MATCH_PARENT
|
||||
)
|
||||
setPadding(64, 64, 64, 0)
|
||||
}
|
||||
|
||||
val dialog = AlertDialog.Builder(this, R.style.MyPopup).apply {
|
||||
setView(container)
|
||||
setPositiveButton(getString(R.string.ok)) { dialog, _ ->
|
||||
val input = inputEditText.text.toString()
|
||||
val formattedText = String.format(format.syntax, input)
|
||||
binding.editText.text?.insert(position, formattedText)
|
||||
binding.editText.setSelection(position + formattedText.length)
|
||||
dialog.dismiss()
|
||||
}
|
||||
setNegativeButton(getString(R.string.cancel)) { dialog, _ ->
|
||||
dialog.dismiss()
|
||||
}
|
||||
}.create()
|
||||
|
||||
val widthInDp = 245
|
||||
val layoutParams = ViewGroup.LayoutParams(
|
||||
(widthInDp * resources.displayMetrics.density).toInt(),
|
||||
ViewGroup.LayoutParams.WRAP_CONTENT
|
||||
)
|
||||
dialog.window?.setLayout(layoutParams.width, layoutParams.height)
|
||||
dialog.show()
|
||||
inputEditText.requestFocus()
|
||||
}
|
||||
|
||||
private fun previewMarkdown(preview: Boolean) {
|
||||
|
|
10
app/src/main/res/drawable/format_align_center_24.xml
Normal file
10
app/src/main/res/drawable/format_align_center_24.xml
Normal file
|
@ -0,0 +1,10 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:tint="?attr/colorControlNormal"
|
||||
android:viewportWidth="960"
|
||||
android:viewportHeight="960">
|
||||
<path
|
||||
android:fillColor="@android:color/white"
|
||||
android:pathData="M120,840L120,760L840,760L840,840L120,840ZM280,680L280,600L680,600L680,680L280,680ZM120,520L120,440L840,440L840,520L120,520ZM280,360L280,280L680,280L680,360L280,360ZM120,200L120,120L840,120L840,200L120,200Z" />
|
||||
</vector>
|
10
app/src/main/res/drawable/format_bold_24.xml
Normal file
10
app/src/main/res/drawable/format_bold_24.xml
Normal file
|
@ -0,0 +1,10 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:tint="?attr/colorControlNormal"
|
||||
android:viewportWidth="960"
|
||||
android:viewportHeight="960">
|
||||
<path
|
||||
android:fillColor="@android:color/white"
|
||||
android:pathData="M272,760L272,200L493,200Q558,200 613,240Q668,280 668,351Q668,402 645,429.5Q622,457 602,469L602,469Q627,480 657.5,510Q688,540 688,600Q688,689 623,724.5Q558,760 501,760L272,760ZM393,648L497,648Q545,648 555.5,623.5Q566,599 566,588Q566,577 555.5,552.5Q545,528 494,528L393,528L393,648ZM393,420L486,420Q519,420 534,403Q549,386 549,365Q549,341 532,326Q515,311 488,311L393,311L393,420Z" />
|
||||
</vector>
|
10
app/src/main/res/drawable/format_code_24.xml
Normal file
10
app/src/main/res/drawable/format_code_24.xml
Normal file
|
@ -0,0 +1,10 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:tint="?attr/colorControlNormal"
|
||||
android:viewportWidth="960"
|
||||
android:viewportHeight="960">
|
||||
<path
|
||||
android:fillColor="@android:color/white"
|
||||
android:pathData="M668,692Q657,703 640.5,703Q624,703 612,691Q600,679 600,662.5Q600,646 612,634L767,479L611,323Q600,312 600.5,295.5Q601,279 612,268Q623,257 640,257Q657,257 668,268L852,452Q864,464 864,480Q864,496 852,508L668,692ZM292,692L108,508Q96,496 96,480Q96,464 108,452L292,268Q303,257 320,256.5Q337,256 349,268Q361,280 361,296.5Q361,313 349,325L193,481L349,637Q360,648 359.5,664.5Q359,681 348,692Q337,703 320,703Q303,703 292,692Z" />
|
||||
</vector>
|
10
app/src/main/res/drawable/format_image_24.xml
Normal file
10
app/src/main/res/drawable/format_image_24.xml
Normal file
|
@ -0,0 +1,10 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:tint="?attr/colorControlNormal"
|
||||
android:viewportWidth="960"
|
||||
android:viewportHeight="960">
|
||||
<path
|
||||
android:fillColor="@android:color/white"
|
||||
android:pathData="M200,840Q167,840 143.5,816.5Q120,793 120,760L120,200Q120,167 143.5,143.5Q167,120 200,120L760,120Q793,120 816.5,143.5Q840,167 840,200L840,760Q840,793 816.5,816.5Q793,840 760,840L200,840ZM200,760L760,760Q760,760 760,760Q760,760 760,760L760,200Q760,200 760,200Q760,200 760,200L200,200Q200,200 200,200Q200,200 200,200L200,760Q200,760 200,760Q200,760 200,760ZM240,680L720,680L570,480L450,640L360,520L240,680ZM200,760Q200,760 200,760Q200,760 200,760L200,200Q200,200 200,200Q200,200 200,200L200,200Q200,200 200,200Q200,200 200,200L200,760Q200,760 200,760Q200,760 200,760L200,760Z" />
|
||||
</vector>
|
10
app/src/main/res/drawable/format_italic_24.xml
Normal file
10
app/src/main/res/drawable/format_italic_24.xml
Normal file
|
@ -0,0 +1,10 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:tint="?attr/colorControlNormal"
|
||||
android:viewportWidth="960"
|
||||
android:viewportHeight="960">
|
||||
<path
|
||||
android:fillColor="@android:color/white"
|
||||
android:pathData="M200,760L200,660L360,660L480,300L320,300L320,200L720,200L720,300L580,300L460,660L600,660L600,760L200,760Z" />
|
||||
</vector>
|
10
app/src/main/res/drawable/format_link_24.xml
Normal file
10
app/src/main/res/drawable/format_link_24.xml
Normal file
|
@ -0,0 +1,10 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:tint="?attr/colorControlNormal"
|
||||
android:viewportWidth="960"
|
||||
android:viewportHeight="960">
|
||||
<path
|
||||
android:fillColor="@android:color/white"
|
||||
android:pathData="M440,680L280,680Q197,680 138.5,621.5Q80,563 80,480Q80,397 138.5,338.5Q197,280 280,280L440,280L440,360L280,360Q230,360 195,395Q160,430 160,480Q160,530 195,565Q230,600 280,600L440,600L440,680ZM320,520L320,440L640,440L640,520L320,520ZM520,680L520,600L680,600Q730,600 765,565Q800,530 800,480Q800,430 765,395Q730,360 680,360L520,360L520,280L680,280Q763,280 821.5,338.5Q880,397 880,480Q880,563 821.5,621.5Q763,680 680,680L520,680Z" />
|
||||
</vector>
|
11
app/src/main/res/drawable/format_list_bulleted_24.xml
Normal file
11
app/src/main/res/drawable/format_list_bulleted_24.xml
Normal file
|
@ -0,0 +1,11 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:autoMirrored="true"
|
||||
android:tint="?attr/colorControlNormal"
|
||||
android:viewportWidth="960"
|
||||
android:viewportHeight="960">
|
||||
<path
|
||||
android:fillColor="@android:color/white"
|
||||
android:pathData="M400,760Q383,760 371.5,748.5Q360,737 360,720Q360,703 371.5,691.5Q383,680 400,680L800,680Q817,680 828.5,691.5Q840,703 840,720Q840,737 828.5,748.5Q817,760 800,760L400,760ZM400,520Q383,520 371.5,508.5Q360,497 360,480Q360,463 371.5,451.5Q383,440 400,440L800,440Q817,440 828.5,451.5Q840,463 840,480Q840,497 828.5,508.5Q817,520 800,520L400,520ZM400,280Q383,280 371.5,268.5Q360,257 360,240Q360,223 371.5,211.5Q383,200 400,200L800,200Q817,200 828.5,211.5Q840,223 840,240Q840,257 828.5,268.5Q817,280 800,280L400,280ZM200,800Q167,800 143.5,776.5Q120,753 120,720Q120,687 143.5,663.5Q167,640 200,640Q233,640 256.5,663.5Q280,687 280,720Q280,753 256.5,776.5Q233,800 200,800ZM200,560Q167,560 143.5,536.5Q120,513 120,480Q120,447 143.5,423.5Q167,400 200,400Q233,400 256.5,423.5Q280,447 280,480Q280,513 256.5,536.5Q233,560 200,560ZM200,320Q167,320 143.5,296.5Q120,273 120,240Q120,207 143.5,183.5Q167,160 200,160Q233,160 256.5,183.5Q280,207 280,240Q280,273 256.5,296.5Q233,320 200,320Z" />
|
||||
</vector>
|
10
app/src/main/res/drawable/format_list_numbered_24.xml
Normal file
10
app/src/main/res/drawable/format_list_numbered_24.xml
Normal file
|
@ -0,0 +1,10 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:tint="?attr/colorControlNormal"
|
||||
android:viewportWidth="960"
|
||||
android:viewportHeight="960">
|
||||
<path
|
||||
android:fillColor="@android:color/white"
|
||||
android:pathData="M120,880L120,820L220,820L220,790L160,790L160,730L220,730L220,700L120,700L120,640L240,640Q257,640 268.5,651.5Q280,663 280,680L280,720Q280,737 268.5,748.5Q257,760 240,760Q257,760 268.5,771.5Q280,783 280,800L280,840Q280,857 268.5,868.5Q257,880 240,880L120,880ZM120,600L120,490Q120,473 131.5,461.5Q143,450 160,450L220,450L220,420L120,420L120,360L240,360Q257,360 268.5,371.5Q280,383 280,400L280,470Q280,487 268.5,498.5Q257,510 240,510L180,510L180,540L280,540L280,600L120,600ZM180,320L180,140L120,140L120,80L240,80L240,320L180,320ZM360,760L360,680L840,680L840,760L360,760ZM360,520L360,440L840,440L840,520L360,520ZM360,280L360,200L840,200L840,280L360,280Z" />
|
||||
</vector>
|
10
app/src/main/res/drawable/format_quote_24.xml
Normal file
10
app/src/main/res/drawable/format_quote_24.xml
Normal file
|
@ -0,0 +1,10 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:tint="?attr/colorControlNormal"
|
||||
android:viewportWidth="960"
|
||||
android:viewportHeight="960">
|
||||
<path
|
||||
android:fillColor="@android:color/white"
|
||||
android:pathData="M228,720L320,560Q320,560 320,560Q320,560 320,560Q254,560 207,513Q160,466 160,400Q160,334 207,287Q254,240 320,240Q386,240 433,287Q480,334 480,400Q480,423 474.5,442.5Q469,462 458,480L320,720L228,720ZM588,720L680,560Q680,560 680,560Q680,560 680,560Q614,560 567,513Q520,466 520,400Q520,334 567,287Q614,240 680,240Q746,240 793,287Q840,334 840,400Q840,423 834.5,442.5Q829,462 818,480L680,720L588,720ZM320,460Q345,460 362.5,442.5Q380,425 380,400Q380,375 362.5,357.5Q345,340 320,340Q295,340 277.5,357.5Q260,375 260,400Q260,425 277.5,442.5Q295,460 320,460ZM680,460Q705,460 722.5,442.5Q740,425 740,400Q740,375 722.5,357.5Q705,340 680,340Q655,340 637.5,357.5Q620,375 620,400Q620,425 637.5,442.5Q655,460 680,460ZM680,400Q680,400 680,400Q680,400 680,400Q680,400 680,400Q680,400 680,400Q680,400 680,400Q680,400 680,400Q680,400 680,400Q680,400 680,400ZM320,400Q320,400 320,400Q320,400 320,400Q320,400 320,400Q320,400 320,400Q320,400 320,400Q320,400 320,400Q320,400 320,400Q320,400 320,400Z" />
|
||||
</vector>
|
10
app/src/main/res/drawable/format_spoiler_24.xml
Normal file
10
app/src/main/res/drawable/format_spoiler_24.xml
Normal file
|
@ -0,0 +1,10 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:tint="?attr/colorControlNormal"
|
||||
android:viewportWidth="960"
|
||||
android:viewportHeight="960">
|
||||
<path
|
||||
android:fillColor="@android:color/white"
|
||||
android:pathData="M644,532L586,474Q595,427 559,386Q523,345 466,354L408,296Q425,288 442.5,284Q460,280 480,280Q555,280 607.5,332.5Q660,385 660,460Q660,480 656,497.5Q652,515 644,532ZM772,658L714,602Q752,573 781.5,538.5Q811,504 832,460Q782,359 688.5,299.5Q595,240 480,240Q451,240 423,244Q395,248 368,256L306,194Q347,177 390,168.5Q433,160 480,160Q631,160 749,243.5Q867,327 920,460Q897,519 859.5,569.5Q822,620 772,658ZM792,904L624,738Q589,749 553.5,754.5Q518,760 480,760Q329,760 211,676.5Q93,593 40,460Q61,407 93,361.5Q125,316 166,280L56,168L112,112L848,848L792,904ZM222,336Q193,362 169,393Q145,424 128,460Q178,561 271.5,620.5Q365,680 480,680Q500,680 519,677.5Q538,675 558,672L522,634Q511,637 501,638.5Q491,640 480,640Q405,640 352.5,587.5Q300,535 300,460Q300,449 301.5,439Q303,429 306,418L222,336ZM541,429L541,429Q541,429 541,429Q541,429 541,429Q541,429 541,429Q541,429 541,429Q541,429 541,429Q541,429 541,429ZM390,504Q390,504 390,504Q390,504 390,504L390,504Q390,504 390,504Q390,504 390,504Q390,504 390,504Q390,504 390,504Z" />
|
||||
</vector>
|
10
app/src/main/res/drawable/format_strikethrough_24.xml
Normal file
10
app/src/main/res/drawable/format_strikethrough_24.xml
Normal file
|
@ -0,0 +1,10 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:tint="?attr/colorControlNormal"
|
||||
android:viewportWidth="960"
|
||||
android:viewportHeight="960">
|
||||
<path
|
||||
android:fillColor="@android:color/white"
|
||||
android:pathData="M80,560L80,480L880,480L880,560L80,560ZM420,400L420,280L200,280L200,160L760,160L760,280L540,280L540,400L420,400ZM420,800L420,640L540,640L540,800L420,800Z" />
|
||||
</vector>
|
10
app/src/main/res/drawable/format_title_24.xml
Normal file
10
app/src/main/res/drawable/format_title_24.xml
Normal file
|
@ -0,0 +1,10 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="960"
|
||||
android:viewportHeight="960"
|
||||
android:tint="?attr/colorControlNormal">
|
||||
<path
|
||||
android:fillColor="@android:color/white"
|
||||
android:pathData="M420,280L260,280Q235,280 217.5,262.5Q200,245 200,220Q200,195 217.5,177.5Q235,160 260,160L700,160Q725,160 742.5,177.5Q760,195 760,220Q760,245 742.5,262.5Q725,280 700,280L540,280L540,740Q540,765 522.5,782.5Q505,800 480,800Q455,800 437.5,782.5Q420,765 420,740L420,280Z"/>
|
||||
</vector>
|
11
app/src/main/res/drawable/format_video_24.xml
Normal file
11
app/src/main/res/drawable/format_video_24.xml
Normal file
|
@ -0,0 +1,11 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:autoMirrored="true"
|
||||
android:tint="?attr/colorControlNormal"
|
||||
android:viewportWidth="960"
|
||||
android:viewportHeight="960">
|
||||
<path
|
||||
android:fillColor="@android:color/white"
|
||||
android:pathData="M160,800Q127,800 103.5,776.5Q80,753 80,720L80,240Q80,207 103.5,183.5Q127,160 160,160L640,160Q673,160 696.5,183.5Q720,207 720,240L720,420L880,260L880,700L720,540L720,720Q720,753 696.5,776.5Q673,800 640,800L160,800ZM160,720L640,720Q640,720 640,720Q640,720 640,720L640,240Q640,240 640,240Q640,240 640,240L160,240Q160,240 160,240Q160,240 160,240L160,720Q160,720 160,720Q160,720 160,720ZM160,720Q160,720 160,720Q160,720 160,720L160,240Q160,240 160,240Q160,240 160,240L160,240Q160,240 160,240Q160,240 160,240L160,720Q160,720 160,720Q160,720 160,720L160,720Z" />
|
||||
</vector>
|
10
app/src/main/res/drawable/format_youtube_24.xml
Normal file
10
app/src/main/res/drawable/format_youtube_24.xml
Normal file
|
@ -0,0 +1,10 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:tint="?attr/colorControlNormal"
|
||||
android:viewportWidth="960"
|
||||
android:viewportHeight="960">
|
||||
<path
|
||||
android:fillColor="@android:color/white"
|
||||
android:pathData="M616,718Q589,719 564.5,719.5Q540,720 521,720Q499,720 480,720Q409,720 347,718Q294,716 242.5,712.5Q191,709 168,703Q142,696 123,677Q104,658 97,632Q91,609 87.5,576Q84,543 82,513Q80,477 80,440Q80,403 82,367Q84,337 87.5,304Q91,271 97,248Q104,222 123,203Q142,184 168,177Q191,171 242.5,167.5Q294,164 347,162Q409,160 480,160Q551,160 613,162Q666,164 717.5,167.5Q769,171 792,177Q818,184 837,203Q856,222 863,248Q869,271 872.5,304Q876,337 878,367Q880,403 880,440L880,457Q861,449 841,444.5Q821,440 800,440Q717,440 658.5,498.5Q600,557 600,640Q600,661 604,680.5Q608,700 616,718ZM400,560L608,440L400,320L400,560ZM760,760L760,680L680,680L680,600L760,600L760,520L840,520L840,600L920,600L920,680L840,680L840,760L760,760Z" />
|
||||
</vector>
|
|
@ -1,10 +1,16 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
android:fitsSystemWindows="false">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
app:layout_behavior="@string/appbar_scrolling_view_behavior">
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/markdownCreatorToolbar"
|
||||
|
@ -40,23 +46,34 @@
|
|||
android:textSize="18sp"
|
||||
tools:text="@string/placeholder" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/markdownCreatorPreviewCheckbox"
|
||||
<Button
|
||||
android:id="@+id/createButton"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="end|center_vertical"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:contentDescription="@string/preview"
|
||||
android:text="@string/preview"
|
||||
tools:ignore="ContentDescription" />
|
||||
android:fontFamily="@font/poppins_bold"
|
||||
android:maxLines="1"
|
||||
android:text="@string/publish"
|
||||
app:cornerRadius="16dp"
|
||||
tools:ignore="ButtonStyle" />
|
||||
</FrameLayout>
|
||||
|
||||
<ScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"
|
||||
android:fillViewport="true">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:padding="16dp">
|
||||
|
||||
<EditText
|
||||
android:id="@+id/editText"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"
|
||||
android:layout_margin="16dp"
|
||||
android:layout_height="590dp"
|
||||
android:fontFamily="@font/poppins"
|
||||
android:inputType="textMultiLine"
|
||||
android:padding="16dp"
|
||||
|
@ -65,43 +82,172 @@
|
|||
android:textColor="?attr/colorOnBackground"
|
||||
android:textIsSelectable="true"
|
||||
android:textSize="12sp"
|
||||
app:layout_constraintTop_toBottomOf="@+id/markdownCreatorToolbar"
|
||||
android:hint="@string/reply_hint"
|
||||
tools:ignore="LabelFor" />
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/buttonContainer"
|
||||
android:id="@+id/markdownOptionsContainer"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom|center_horizontal"
|
||||
android:layout_marginBottom="24dp"
|
||||
android:gravity="center_horizontal"
|
||||
android:orientation="horizontal"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent">
|
||||
android:layout_gravity="bottom|end"
|
||||
android:layout_marginHorizontal="13dp"
|
||||
android:orientation="vertical"
|
||||
android:padding="8dp"
|
||||
android:windowSoftInputMode="adjustResize">
|
||||
|
||||
<Button
|
||||
android:id="@+id/cancelButton"
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="64dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:fontFamily="@font/poppins_bold"
|
||||
android:maxLines="1"
|
||||
android:text="@string/cancel"
|
||||
app:cornerRadius="16dp"
|
||||
tools:ignore="ButtonStyle" />
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<Button
|
||||
android:id="@+id/createButton"
|
||||
<ImageView
|
||||
android:id="@+id/formatBold"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="64dp"
|
||||
android:layout_marginStart="16dp"
|
||||
android:fontFamily="@font/poppins_bold"
|
||||
android:maxLines="1"
|
||||
android:text="@string/create"
|
||||
app:cornerRadius="16dp"
|
||||
tools:ignore="ButtonStyle" />
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="6dp"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:src="@drawable/format_bold_24"
|
||||
app:tint="?attr/colorOnBackground"
|
||||
tools:ignore="ContentDescription" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/formatItalic"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="6dp"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:src="@drawable/format_italic_24"
|
||||
app:tint="?attr/colorOnBackground"
|
||||
tools:ignore="ContentDescription" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/formatStrikethrough"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="6dp"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:src="@drawable/format_strikethrough_24"
|
||||
app:tint="?attr/colorOnBackground"
|
||||
tools:ignore="ContentDescription" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/formatSpoiler"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="6dp"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:src="@drawable/format_spoiler_24"
|
||||
app:tint="?attr/colorOnBackground"
|
||||
tools:ignore="ContentDescription" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/formatLink"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="6dp"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:src="@drawable/format_link_24"
|
||||
app:tint="?attr/colorOnBackground"
|
||||
tools:ignore="ContentDescription" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/formatImage"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="6dp"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:src="@drawable/format_image_24"
|
||||
app:tint="?attr/colorOnBackground"
|
||||
tools:ignore="ContentDescription" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/formatYoutube"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="6dp"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:src="@drawable/format_youtube_24"
|
||||
app:tint="?attr/colorOnBackground"
|
||||
tools:ignore="ContentDescription" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/formatVideo"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="6dp"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:src="@drawable/format_video_24"
|
||||
app:tint="?attr/colorOnBackground"
|
||||
tools:ignore="ContentDescription" />
|
||||
</LinearLayout>
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/formatListOrdered"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="6dp"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:src="@drawable/format_list_numbered_24"
|
||||
app:tint="?attr/colorOnBackground"
|
||||
tools:ignore="ContentDescription" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/formatListUnordered"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="6dp"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:src="@drawable/format_list_bulleted_24"
|
||||
app:tint="?attr/colorOnBackground"
|
||||
tools:ignore="ContentDescription" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/formatTitle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="6dp"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:src="@drawable/format_title_24"
|
||||
app:tint="?attr/colorOnBackground"
|
||||
tools:ignore="ContentDescription" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/formatCenter"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="6dp"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:src="@drawable/format_align_center_24"
|
||||
app:tint="?attr/colorOnBackground"
|
||||
tools:ignore="ContentDescription" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/formatQuote"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="6dp"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:src="@drawable/format_quote_24"
|
||||
app:tint="?attr/colorOnBackground"
|
||||
tools:ignore="ContentDescription" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/formatCode"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="6dp"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:src="@drawable/format_code_24"
|
||||
app:tint="?attr/colorOnBackground"
|
||||
tools:ignore="ContentDescription" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
|
@ -65,6 +65,18 @@
|
|||
</LinearLayout>
|
||||
</androidx.core.widget.NestedScrollView>
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/addStory"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:scaleX="2.2"
|
||||
android:scaleY="2.2"
|
||||
android:background="?attr/selectableItemBackgroundBorderless"
|
||||
android:src="@drawable/ic_circle_add"
|
||||
app:layout_goneMarginBottom="40dp"
|
||||
app:layout_goneMarginRight="8dp"
|
||||
app:layout_constraintBottom_toBottomOf="@id/textActivityContainer"
|
||||
app:layout_constraintEnd_toEndOf="@id/textActivityContainer" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
|
|
|
@ -367,6 +367,8 @@
|
|||
<string name="apply">Apply</string>
|
||||
<string name="cancel">Cancel</string>
|
||||
<string name="edit">Edit</string>
|
||||
<string name="publish">Publish</string>
|
||||
<string name="reply_hint">Write a response…</string>
|
||||
<string name="this_season">This Season</string>
|
||||
<string name="next_season">Next Season</string>
|
||||
<string name="previous_season">Previous Season</string>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue