(Mastodon)投票の選択肢の文字数の上限を40にする。投票作成時にfriends.nico APIの選択肢をなくす。
This commit is contained in:
parent
2273f7f94c
commit
238845284a
|
@ -10,18 +10,22 @@ import android.os.Handler
|
|||
import android.text.Editable
|
||||
import android.text.InputType
|
||||
import android.text.TextWatcher
|
||||
import android.view.*
|
||||
import android.view.KeyEvent
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.view.ViewTreeObserver
|
||||
import android.view.inputmethod.EditorInfo
|
||||
import android.widget.*
|
||||
import android.widget.AdapterView
|
||||
import android.widget.ArrayAdapter
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import jp.juggler.subwaytooter.action.saveWindowSize
|
||||
import jp.juggler.subwaytooter.actpost.*
|
||||
import jp.juggler.subwaytooter.api.*
|
||||
import jp.juggler.subwaytooter.api.entity.*
|
||||
import jp.juggler.subwaytooter.api.entity.TootScheduled
|
||||
import jp.juggler.subwaytooter.api.entity.TootStatus
|
||||
import jp.juggler.subwaytooter.databinding.ActPostBinding
|
||||
import jp.juggler.subwaytooter.dialog.*
|
||||
import jp.juggler.subwaytooter.pref.PrefB
|
||||
import jp.juggler.subwaytooter.span.*
|
||||
import jp.juggler.subwaytooter.span.MyClickableSpan
|
||||
import jp.juggler.subwaytooter.span.MyClickableSpanHandler
|
||||
import jp.juggler.subwaytooter.table.SavedAccount
|
||||
import jp.juggler.subwaytooter.util.*
|
||||
import jp.juggler.subwaytooter.view.MyEditText
|
||||
|
@ -348,7 +352,6 @@ class ActPost : AppCompatActivity(),
|
|||
arrayOf(
|
||||
getString(R.string.poll_dont_make),
|
||||
getString(R.string.poll_make),
|
||||
getString(R.string.poll_make_friends_nico)
|
||||
)
|
||||
).apply {
|
||||
setDropDownViewResource(R.layout.lv_spinner_dropdown)
|
||||
|
|
|
@ -17,6 +17,7 @@ import jp.juggler.util.*
|
|||
import kotlinx.coroutines.isActive
|
||||
import okhttp3.Request
|
||||
import ru.gildor.coroutines.okhttp.await
|
||||
import kotlin.math.min
|
||||
|
||||
private val log = LogCategory("ActPostDrafts")
|
||||
|
||||
|
@ -254,11 +255,11 @@ fun ActPost.restoreDraft(draft: JsonObject) {
|
|||
|
||||
val sv = draft.string(DRAFT_POLL_TYPE)
|
||||
if (sv != null) {
|
||||
views.spPollType.setSelection(sv.toPollTypeIndex())
|
||||
views.spPollType.setSelection(min(1,sv.toPollTypeIndex()))
|
||||
} else {
|
||||
// old draft
|
||||
val bv = draft.optBoolean(DRAFT_IS_ENQUETE, false)
|
||||
views.spPollType.setSelection(if (bv) 2 else 0)
|
||||
views.spPollType.setSelection(if (bv) 1 else 0)
|
||||
}
|
||||
|
||||
views.cbMultipleChoice.isChecked = draft.optBoolean(DRAFT_POLL_MULTIPLE)
|
||||
|
@ -387,13 +388,7 @@ fun ActPost.initializeFromRedraftStatus(account: SavedAccount, jsonText: String)
|
|||
}
|
||||
|
||||
else -> {
|
||||
views.spPollType.setSelection(
|
||||
if (srcEnquete.pollType == TootPollsType.FriendsNico) {
|
||||
2
|
||||
} else {
|
||||
1
|
||||
}
|
||||
)
|
||||
views.spPollType.setSelection(1)
|
||||
text = decodeOptions.decodeHTML(srcEnquete.question)
|
||||
views.etContent.text = text
|
||||
views.etContent.setSelection(text.length)
|
||||
|
@ -488,13 +483,7 @@ fun ActPost.initializeFromEditStatus(account: SavedAccount, jsonText: String) {
|
|||
}
|
||||
|
||||
else -> {
|
||||
views.spPollType.setSelection(
|
||||
if (srcEnquete.pollType == TootPollsType.FriendsNico) {
|
||||
2
|
||||
} else {
|
||||
1
|
||||
}
|
||||
)
|
||||
views.spPollType.setSelection(1)
|
||||
text = decodeOptions.decodeHTML(srcEnquete.question)
|
||||
views.etContent.text = text
|
||||
views.etContent.setSelection(text.length)
|
||||
|
|
|
@ -311,17 +311,14 @@ fun ActPost.performPost() {
|
|||
var pollHideTotals = false
|
||||
var pollMultipleChoice = false
|
||||
when (views.spPollType.selectedItemPosition) {
|
||||
1 -> {
|
||||
0-> Unit // not poll
|
||||
else -> {
|
||||
pollType = TootPollsType.Mastodon
|
||||
pollItems = pollChoiceList()
|
||||
pollExpireSeconds = pollExpireSeconds()
|
||||
pollHideTotals = views.cbHideTotals.isChecked
|
||||
pollMultipleChoice = views.cbMultipleChoice.isChecked
|
||||
}
|
||||
2 -> {
|
||||
pollType = TootPollsType.FriendsNico
|
||||
pollItems = pollChoiceList()
|
||||
}
|
||||
}
|
||||
|
||||
val postResult = PostImpl(
|
||||
|
|
|
@ -76,7 +76,7 @@ class PostImpl(
|
|||
private val choiceMaxChars = when {
|
||||
account.isMisskey -> 15
|
||||
pollType == TootPollsType.FriendsNico -> 15
|
||||
else -> 25 // TootPollsType.Mastodon
|
||||
else -> 40 // TootPollsType.Mastodon
|
||||
}
|
||||
|
||||
private fun preCheckPollItemOne(list: List<String>, idx: Int, item: String) {
|
||||
|
|
Loading…
Reference in New Issue