(Misskey)投稿画面の最大文字数を3000にする

This commit is contained in:
tateisu 2018-12-03 08:14:54 +09:00
parent 0ae936ed70
commit 788933cb11
1 changed files with 38 additions and 33 deletions

View File

@ -977,42 +977,47 @@ class ActPost : AppCompatActivity(), View.OnClickListener, PostAttachment.Callba
private var lastInstanceTask : TootTaskRunner? = null private var lastInstanceTask : TootTaskRunner? = null
private fun getMaxCharCount() : Int { private fun getMaxCharCount() : Int {
val account = account val account = account
if(account != null
&& ! account.isPseudo
&& ! account.isMisskey
) {
val info = account.instance
var lastTask = lastInstanceTask
// 情報がないか古いなら再取得 when{
if(info == null || System.currentTimeMillis() - info.time_parse >= 300000L) { account == null || account.isPseudo -> {}
// 同時に実行するタスクは1つまで
if(lastTask?.isActive != true) {
lastTask = TootTaskRunner(this, TootTaskRunner.PROGRESS_NONE)
lastInstanceTask = lastTask
lastTask.run(account, object : TootTask {
var newInfo : TootInstance? = null
override fun background(client : TootApiClient) : TootApiResult? { account.isMisskey ->return 3000
val result = client.request("/api/v1/instance")
newInfo = TootParser(this@ActPost, account).instance(result?.jsonObject)
return result
}
override fun handleResult(result : TootApiResult?) { else->{
if(isFinishing || isDestroyed) return val info = account.instance
if(newInfo != null) {
account.instance = newInfo // 情報がないか古いなら再取得
updateTextCount() if(info == null || System.currentTimeMillis() - info.time_parse >= 300000L) {
// 同時に実行するタスクは1つまで
var lastTask = lastInstanceTask
if(lastTask?.isActive != true) {
lastTask = TootTaskRunner(this, TootTaskRunner.PROGRESS_NONE)
lastInstanceTask = lastTask
lastTask.run(account, object : TootTask {
var newInfo : TootInstance? = null
override fun background(client : TootApiClient) : TootApiResult? {
val result = client.request("/api/v1/instance")
newInfo = TootParser(this@ActPost, account).instance(result?.jsonObject)
return result
} }
}
})
}
}
if(info != null) { override fun handleResult(result : TootApiResult?) {
val max = info.max_toot_chars if(isFinishing || isDestroyed) return
if(newInfo != null) {
account.instance = newInfo
updateTextCount()
}
}
})
// fall thru
}
}
val max = info?.max_toot_chars
if(max != null && max > 0) return max if(max != null && max > 0) return max
} }
} }