2018-01-04 19:52:25 +01:00
|
|
|
package jp.juggler.subwaytooter.api
|
|
|
|
|
|
|
|
import android.content.Context
|
|
|
|
import jp.juggler.subwaytooter.api.entity.*
|
|
|
|
|
|
|
|
import org.json.JSONArray
|
|
|
|
import org.json.JSONObject
|
|
|
|
|
|
|
|
import jp.juggler.subwaytooter.table.SavedAccount
|
|
|
|
import jp.juggler.subwaytooter.util.WordTrieTree
|
|
|
|
|
|
|
|
class TootParser(
|
|
|
|
val context : Context,
|
|
|
|
val accessInfo : SavedAccount,
|
|
|
|
var pinned : Boolean = false, // プロフィールカラムからpinned TL を読んだ時だけ真
|
|
|
|
var highlightTrie : WordTrieTree? = null
|
|
|
|
) {
|
|
|
|
|
|
|
|
|
2018-01-13 07:15:52 +01:00
|
|
|
fun account(src : JSONObject?)
|
|
|
|
=TootAccount.parse(context, accessInfo, src)
|
2018-01-04 19:52:25 +01:00
|
|
|
|
2018-01-13 07:15:52 +01:00
|
|
|
fun status(src : JSONObject?,serviceType :ServiceType = ServiceType.MASTODON )
|
|
|
|
=TootStatus.parse(this, src,serviceType)
|
2018-01-04 19:52:25 +01:00
|
|
|
|
2018-01-13 07:15:52 +01:00
|
|
|
fun statusList(array : JSONArray?,serviceType :ServiceType = ServiceType.MASTODON)
|
|
|
|
=TootStatus.parseList(this, array,serviceType)
|
2018-01-04 19:52:25 +01:00
|
|
|
|
2018-01-13 07:15:52 +01:00
|
|
|
fun notification(src : JSONObject?)
|
|
|
|
=parseItem(::TootNotification,this, src)
|
2018-01-04 19:52:25 +01:00
|
|
|
|
2018-01-13 07:15:52 +01:00
|
|
|
fun notificationList(src : JSONArray?)
|
|
|
|
=parseList(::TootNotification,this, src)
|
2018-01-04 19:52:25 +01:00
|
|
|
|
2018-01-13 07:15:52 +01:00
|
|
|
fun results(src : JSONObject?)
|
|
|
|
=parseItem(::TootResults,this, src)
|
2018-01-04 19:52:25 +01:00
|
|
|
|
|
|
|
}
|