fix #140, カラム一覧で通称に「@.」を含むアカウントのカラムが消える
This commit is contained in:
parent
86597ce6ea
commit
2a4e3745f0
|
@ -57,8 +57,8 @@ class ActColumnList : AppCompatActivity() {
|
|||
super.onSaveInstanceState(outState)
|
||||
|
||||
outState.putInt(EXTRA_SELECTION, old_selection)
|
||||
|
||||
val array =listAdapter.itemList.map { it.json }.toJsonArray()
|
||||
|
||||
val array = listAdapter.itemList.map { it.json }.toJsonArray()
|
||||
AppState.saveColumnList(this, TMP_FILE_COLUMN_LIST, array)
|
||||
}
|
||||
|
||||
|
@ -141,7 +141,7 @@ class ActColumnList : AppCompatActivity() {
|
|||
try {
|
||||
AppState.loadColumnList(this, TMP_FILE_COLUMN_LIST)
|
||||
?.objectList()
|
||||
?.forEachIndexed{index,src->
|
||||
?.forEachIndexed { index, src ->
|
||||
try {
|
||||
val item = MyItem(src, index.toLong(), this)
|
||||
tmp_list.add(item)
|
||||
|
@ -197,22 +197,15 @@ class ActColumnList : AppCompatActivity() {
|
|||
internal class MyItem(val json : JsonObject, val id : Long, context : Context) {
|
||||
|
||||
val name : String = json.optString(Column.KEY_COLUMN_NAME)
|
||||
val acct : Acct = Acct.parse(json.optString(Column.KEY_COLUMN_ACCESS))
|
||||
val acct : Acct = Acct.parse(json.optString(Column.KEY_COLUMN_ACCESS_ACCT))
|
||||
val acct_name : String = json.optString(Column.KEY_COLUMN_ACCESS_STR)
|
||||
val old_index = json.optInt(Column.KEY_OLD_INDEX)
|
||||
val type = ColumnType.parse(json.optInt(Column.KEY_TYPE))
|
||||
val acct_color_fg : Int
|
||||
val acct_color_bg : Int
|
||||
val acct_color_bg = json.optInt(Column.KEY_COLUMN_ACCESS_COLOR_BG, 0)
|
||||
val acct_color_fg = json.optInt(Column.KEY_COLUMN_ACCESS_COLOR, 0)
|
||||
.notZero() ?: getAttributeColor(context, R.attr.colorColumnListItemText)
|
||||
var bOldSelection : Boolean = false
|
||||
|
||||
init {
|
||||
var c = json.optInt(Column.KEY_COLUMN_ACCESS_COLOR, 0)
|
||||
this.acct_color_fg =
|
||||
if(c != 0) c else getAttributeColor(context, R.attr.colorColumnListItemText)
|
||||
|
||||
c = json.optInt(Column.KEY_COLUMN_ACCESS_COLOR_BG, 0)
|
||||
this.acct_color_bg = c
|
||||
}
|
||||
|
||||
fun setOldSelection(b : Boolean) {
|
||||
bOldSelection = b
|
||||
}
|
||||
|
@ -241,7 +234,7 @@ class ActColumnList : AppCompatActivity() {
|
|||
fun bind(item : MyItem) {
|
||||
itemView.tag = item // itemView は親クラスのメンバ変数
|
||||
ivBookmark.visibility = if(item.bOldSelection) View.VISIBLE else View.INVISIBLE
|
||||
tvAccess.text = item.acct.pretty
|
||||
tvAccess.text = item.acct_name
|
||||
tvAccess.setTextColor(item.acct_color_fg)
|
||||
tvAccess.setBackgroundColor(item.acct_color_bg)
|
||||
tvAccess.setPaddingRelative(acct_pad_lr, 0, acct_pad_lr, 0)
|
||||
|
@ -270,7 +263,7 @@ class ActColumnList : AppCompatActivity() {
|
|||
val item = clickedView.tag as MyItem
|
||||
|
||||
var tv : TextView = dragView.findViewById(R.id.tvAccess)
|
||||
tv.text = item.acct.pretty
|
||||
tv.text = item.acct_name
|
||||
tv.setTextColor(item.acct_color_fg)
|
||||
tv.setBackgroundColor(item.acct_color_bg)
|
||||
|
||||
|
|
|
@ -27,6 +27,7 @@ import java.util.concurrent.atomic.AtomicInteger
|
|||
import java.util.concurrent.atomic.AtomicLong
|
||||
import java.util.regex.Pattern
|
||||
import kotlin.collections.ArrayList
|
||||
import kotlin.jvm.Throws
|
||||
|
||||
enum class StreamingIndicatorState {
|
||||
NONE,
|
||||
|
@ -182,7 +183,8 @@ class Column(
|
|||
|
||||
private const val KEY_REMOTE_ONLY = "remoteOnly"
|
||||
|
||||
internal const val KEY_COLUMN_ACCESS = "column_access"
|
||||
internal const val KEY_COLUMN_ACCESS_ACCT = "column_access"
|
||||
internal const val KEY_COLUMN_ACCESS_STR = "column_access_str"
|
||||
internal const val KEY_COLUMN_ACCESS_COLOR = "column_access_color"
|
||||
internal const val KEY_COLUMN_ACCESS_COLOR_BG = "column_access_color_bg"
|
||||
internal const val KEY_COLUMN_NAME = "column_name"
|
||||
|
@ -949,7 +951,8 @@ class Column(
|
|||
|
||||
// 以下は保存には必要ないが、カラムリスト画面で使う
|
||||
val ac = AcctColor.load(access_info)
|
||||
dst[KEY_COLUMN_ACCESS] = ac.nickname
|
||||
dst[KEY_COLUMN_ACCESS_ACCT] = access_info.acct.ascii
|
||||
dst[KEY_COLUMN_ACCESS_STR] = ac.nickname
|
||||
dst[KEY_COLUMN_ACCESS_COLOR] = ac.color_fg
|
||||
dst[KEY_COLUMN_ACCESS_COLOR_BG] = ac.color_bg
|
||||
dst[KEY_COLUMN_NAME] = getColumnName(true)
|
||||
|
|
Loading…
Reference in New Issue