add user_hides_network
This commit is contained in:
parent
b36125028a
commit
73bfc9d859
|
@ -241,7 +241,6 @@ class Column(
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
@Suppress("HasPlatformType")
|
||||
val reMaxId = Pattern.compile("[&?]max_id=(\\d+)") // より古いデータの取得に使う
|
||||
|
||||
|
@ -612,7 +611,7 @@ class Column(
|
|||
return when(column_type) {
|
||||
|
||||
TYPE_PROFILE -> {
|
||||
val who = who_account?.find()
|
||||
val who = who_account?.get()
|
||||
context.getString(
|
||||
R.string.profile_of,
|
||||
if(who != null)
|
||||
|
@ -751,7 +750,7 @@ class Column(
|
|||
if(who_id == (o.status?.account?.id ?: INVALID_ACCOUNT)) continue
|
||||
if(who_id == (o.status?.reblog?.account?.id ?: INVALID_ACCOUNT)) continue
|
||||
} else if(o is TootAccountRef) {
|
||||
if(who_id == o.find().id) continue
|
||||
if(who_id == o.get().id) continue
|
||||
}
|
||||
|
||||
tmp_list.add(o)
|
||||
|
@ -770,7 +769,7 @@ class Column(
|
|||
val tmp_list = ArrayList<TimelineItem>(list_data.size)
|
||||
for(o in list_data) {
|
||||
if(o is TootAccountRef) {
|
||||
if(o.find().id == who_id) continue
|
||||
if(o.get().id == who_id) continue
|
||||
}
|
||||
tmp_list.add(o)
|
||||
}
|
||||
|
@ -788,7 +787,7 @@ class Column(
|
|||
val tmp_list = ArrayList<TimelineItem>(list_data.size)
|
||||
for(o in list_data) {
|
||||
if(o is TootAccountRef) {
|
||||
if(o.find().id == who_id) continue
|
||||
if(o.get().id == who_id) continue
|
||||
}
|
||||
tmp_list.add(o)
|
||||
}
|
||||
|
@ -808,7 +807,7 @@ class Column(
|
|||
val tmp_list = ArrayList<TimelineItem>(list_data.size)
|
||||
for(o in list_data) {
|
||||
if(o is TootAccountRef) {
|
||||
if(o.find().id == who_id) continue
|
||||
if(o.get().id == who_id) continue
|
||||
}
|
||||
tmp_list.add(o)
|
||||
}
|
||||
|
@ -1253,21 +1252,22 @@ class Column(
|
|||
// @Nullable String parseMaxId( TootApiResult result ){
|
||||
// if( result != null && result.link_older != null ){
|
||||
// Matcher m = reMaxId.matcher( result.link_older );
|
||||
// if( m.find() ) return m.group( 1 );
|
||||
// if( m.get() ) return m.group( 1 );
|
||||
// }
|
||||
// return null;
|
||||
// }
|
||||
|
||||
internal fun loadProfileAccount(client : TootApiClient, bForceReload : Boolean) {
|
||||
internal fun loadProfileAccount(client : TootApiClient, bForceReload : Boolean) : TootAccount? {
|
||||
if(bForceReload || this.who_account == null) {
|
||||
val result = client.request(String.format(Locale.JAPAN, PATH_ACCOUNT, profile_id))
|
||||
val parser =TootParser(context, access_info)
|
||||
val a = TootAccountRef.mayNull(parser,parser.account(result?.jsonObject))
|
||||
val parser = TootParser(context, access_info)
|
||||
val a = TootAccountRef.mayNull(parser, parser.account(result?.jsonObject))
|
||||
if(a != null) {
|
||||
this.who_account = a
|
||||
client.publishApiProgress("") // カラムヘッダの再表示
|
||||
}
|
||||
}
|
||||
return this.who_account?.get()
|
||||
}
|
||||
|
||||
internal fun loadListInfo(client : TootApiClient, bForceReload : Boolean) {
|
||||
|
@ -1290,17 +1290,17 @@ class Column(
|
|||
internal val tag_set = HashSet<String>()
|
||||
|
||||
internal fun add(whoRef : TootAccountRef?) {
|
||||
add(whoRef?.find())
|
||||
add(whoRef?.get())
|
||||
}
|
||||
|
||||
|
||||
internal fun add(who : TootAccount?) {
|
||||
who?:return
|
||||
who ?: return
|
||||
who_set.add(who.id)
|
||||
acct_set.add("@" + access_info.getFullAcct(who))
|
||||
//
|
||||
add(who.movedRef)
|
||||
}
|
||||
|
||||
|
||||
internal fun add(s : TootStatus?) {
|
||||
if(s == null) return
|
||||
add(s.accountRef)
|
||||
|
@ -3692,7 +3692,7 @@ class Column(
|
|||
holder.setScrollPosition(ScrollPosition(0, 0))
|
||||
} else if(restore_idx < - 1) {
|
||||
// 可視範囲の検出に失敗
|
||||
log.d("mergeStreamingMessage: has VH. can't find visible range.")
|
||||
log.d("mergeStreamingMessage: has VH. can't get visible range.")
|
||||
} else {
|
||||
// 現在の要素が表示され続けるようにしたい
|
||||
log.d("mergeStreamingMessage: has VH. added=$added")
|
||||
|
|
|
@ -54,7 +54,7 @@ internal class DlgContextMenu(
|
|||
|
||||
val column_type = column.column_type
|
||||
|
||||
val who = whoRef?.find()
|
||||
val who = whoRef?.get()
|
||||
val status = this.status
|
||||
|
||||
this.relation = UserRelation.load(access_info.db_id, who?.id ?: - 1)
|
||||
|
@ -365,7 +365,7 @@ internal class DlgContextMenu(
|
|||
val pos = activity.nextPosition(column)
|
||||
|
||||
val whoRef = this.whoRef
|
||||
val who = whoRef?.find()
|
||||
val who = whoRef?.get()
|
||||
|
||||
if(whoRef != null && who != null) {
|
||||
when(v.id) {
|
||||
|
@ -653,7 +653,7 @@ internal class DlgContextMenu(
|
|||
}
|
||||
|
||||
override fun onLongClick(v : View) : Boolean {
|
||||
val who = whoRef?.find()
|
||||
val who = whoRef?.get()
|
||||
|
||||
when(v.id) {
|
||||
R.id.btnFollow -> {
|
||||
|
|
|
@ -14,7 +14,6 @@ import android.view.Gravity
|
|||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.*
|
||||
import jp.juggler.emoji.EmojiMap201709
|
||||
|
||||
import java.util.ArrayList
|
||||
|
||||
|
@ -377,7 +376,7 @@ internal class ItemViewHolder(
|
|||
private fun showNotification(n : TootNotification) {
|
||||
val n_status = n.status
|
||||
val n_accountRef = n.accountRef
|
||||
val n_account = n_accountRef?.find()
|
||||
val n_account = n_accountRef?.get()
|
||||
when(n.type) {
|
||||
TootNotification.TYPE_FAVOURITE -> {
|
||||
if(n_account != null) showBoost(
|
||||
|
@ -469,7 +468,7 @@ internal class ItemViewHolder(
|
|||
text : Spannable
|
||||
) {
|
||||
boost_account = whoRef
|
||||
val who = whoRef.find()
|
||||
val who = whoRef.get()
|
||||
boost_time = time
|
||||
llBoosted.visibility = View.VISIBLE
|
||||
ivBoosted.setImageResource(Styler.getAttributeResourceId(activity, icon_attr_id))
|
||||
|
@ -481,7 +480,7 @@ internal class ItemViewHolder(
|
|||
|
||||
private fun showAccount(whoRef : TootAccountRef) {
|
||||
follow_account = whoRef
|
||||
val who = whoRef.find()
|
||||
val who = whoRef.get()
|
||||
llFollow.visibility = View.VISIBLE
|
||||
ivFollow.setImageUrl(
|
||||
activity.pref,
|
||||
|
@ -508,7 +507,7 @@ internal class ItemViewHolder(
|
|||
showStatusTime(activity, tvTime, who = status.account, status = status)
|
||||
|
||||
val whoRef = status.accountRef
|
||||
val who = whoRef.find()
|
||||
val who = whoRef.get()
|
||||
this.status_account = whoRef
|
||||
|
||||
setAcct(tvAcct, access_info.getFullAcct(who), who.acct)
|
||||
|
@ -914,7 +913,7 @@ internal class ItemViewHolder(
|
|||
if(access_info.isPseudo) {
|
||||
DlgContextMenu(activity, column, whoRef, null, notification).show()
|
||||
} else {
|
||||
Action_User.profileLocal(activity, pos, access_info, whoRef.find())
|
||||
Action_User.profileLocal(activity, pos, access_info, whoRef.get())
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -922,7 +921,7 @@ internal class ItemViewHolder(
|
|||
if(access_info.isPseudo) {
|
||||
DlgContextMenu(activity, column, whoRef, null, notification).show()
|
||||
} else {
|
||||
Action_User.profileLocal(activity, pos, access_info, whoRef.find())
|
||||
Action_User.profileLocal(activity, pos, access_info, whoRef.get())
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -930,7 +929,7 @@ internal class ItemViewHolder(
|
|||
if(access_info.isPseudo) {
|
||||
DlgContextMenu(activity, column, whoRef, null, notification).show()
|
||||
} else {
|
||||
Action_User.profileLocal(activity, pos, access_info, whoRef.find())
|
||||
Action_User.profileLocal(activity, pos, access_info, whoRef.get())
|
||||
}
|
||||
}
|
||||
btnFollow -> follow_account?.let { who ->
|
||||
|
@ -999,7 +998,7 @@ internal class ItemViewHolder(
|
|||
}
|
||||
|
||||
btnFollowRequestAccept -> follow_account?.let { whoRef ->
|
||||
val who = whoRef.find()
|
||||
val who = whoRef.get()
|
||||
DlgConfirm.openSimple(
|
||||
activity,
|
||||
activity.getString(
|
||||
|
@ -1012,7 +1011,7 @@ internal class ItemViewHolder(
|
|||
}
|
||||
|
||||
btnFollowRequestDeny -> follow_account?.let { whoRef ->
|
||||
val who = whoRef.find()
|
||||
val who = whoRef.get()
|
||||
DlgConfirm.openSimple(
|
||||
activity,
|
||||
activity.getString(
|
||||
|
@ -1084,7 +1083,7 @@ internal class ItemViewHolder(
|
|||
activity,
|
||||
activity.nextPosition(column),
|
||||
access_info,
|
||||
whoRef.find()
|
||||
whoRef.get()
|
||||
)
|
||||
}
|
||||
return true
|
||||
|
|
|
@ -227,7 +227,7 @@ internal class StatusButtons(
|
|||
|
||||
btnFollow2 -> {
|
||||
val accountRef = status.accountRef
|
||||
val account = accountRef.find()
|
||||
val account = accountRef.get()
|
||||
val relation = this.relation ?: return
|
||||
|
||||
when {
|
||||
|
|
|
@ -1,10 +1,6 @@
|
|||
package jp.juggler.subwaytooter
|
||||
|
||||
import android.graphics.Paint
|
||||
import android.graphics.Typeface
|
||||
import android.graphics.drawable.Drawable
|
||||
import android.graphics.drawable.ShapeDrawable
|
||||
import android.graphics.drawable.shapes.Shape
|
||||
import android.support.v4.view.ViewCompat
|
||||
import android.text.SpannableStringBuilder
|
||||
import android.text.Spanned
|
||||
|
@ -143,7 +139,7 @@ internal class ViewHolderHeaderProfile(
|
|||
|
||||
val whoRef = column.who_account
|
||||
this.whoRef = whoRef
|
||||
val who = whoRef?.find()
|
||||
val who = whoRef?.get()
|
||||
|
||||
showColor()
|
||||
|
||||
|
@ -315,7 +311,7 @@ internal class ViewHolderHeaderProfile(
|
|||
private fun showMoved(who : TootAccount, movedRef : TootAccountRef?) {
|
||||
if(movedRef == null) return
|
||||
this.movedRef = movedRef
|
||||
val moved = movedRef.find()
|
||||
val moved = movedRef.get()
|
||||
|
||||
llMoved.visibility = View.VISIBLE
|
||||
tvMoved.visibility = View.VISIBLE
|
||||
|
@ -371,7 +367,7 @@ internal class ViewHolderHeaderProfile(
|
|||
|
||||
when(v.id) {
|
||||
|
||||
R.id.ivBackground, R.id.tvRemoteProfileWarning -> whoRef?.find()?.url?.let { url ->
|
||||
R.id.ivBackground, R.id.tvRemoteProfileWarning -> whoRef?.get()?.url?.let { url ->
|
||||
App1.openCustomTab(activity, url)
|
||||
}
|
||||
|
||||
|
@ -413,7 +409,7 @@ internal class ViewHolderHeaderProfile(
|
|||
activity,
|
||||
activity.nextPosition(column),
|
||||
access_info,
|
||||
movedRef.find()
|
||||
movedRef.get()
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -428,7 +424,7 @@ internal class ViewHolderHeaderProfile(
|
|||
activity,
|
||||
activity.nextPosition(column),
|
||||
access_info,
|
||||
whoRef?.find()
|
||||
whoRef?.get()
|
||||
)
|
||||
return true
|
||||
}
|
||||
|
@ -438,7 +434,7 @@ internal class ViewHolderHeaderProfile(
|
|||
activity,
|
||||
activity.nextPosition(column),
|
||||
access_info,
|
||||
movedRef?.find()
|
||||
movedRef?.get()
|
||||
)
|
||||
return true
|
||||
}
|
||||
|
@ -451,7 +447,7 @@ internal class ViewHolderHeaderProfile(
|
|||
}
|
||||
|
||||
fun updateRelativeTime() {
|
||||
val who = whoRef?.find()
|
||||
val who = whoRef?.get()
|
||||
if(who != null) {
|
||||
tvCreated.text = TootStatus.formatTime(tvCreated.context, who.time_created_at, true)
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@ object Action_Follow {
|
|||
bConfirmed : Boolean = false,
|
||||
callback : EmptyCallback? = null
|
||||
) {
|
||||
val who = whoRef.find()
|
||||
val who = whoRef.get()
|
||||
|
||||
if(access_info.isMe(who)) {
|
||||
showToast(activity, false, R.string.it_is_you)
|
||||
|
@ -431,7 +431,7 @@ object Action_Follow {
|
|||
whoRef : TootAccountRef,
|
||||
bAllow : Boolean
|
||||
) {
|
||||
val who = whoRef.find()
|
||||
val who = whoRef.get()
|
||||
if(access_info.isMe(who)) {
|
||||
showToast(activity, false, R.string.it_is_you)
|
||||
return
|
||||
|
|
|
@ -226,7 +226,7 @@ object Action_User {
|
|||
if(jsonObject != null) {
|
||||
val tmp = TootParser(activity, access_info).results(jsonObject)
|
||||
if(tmp != null && tmp.accounts.isNotEmpty()) {
|
||||
who_local = tmp.accounts[0].find()
|
||||
who_local = tmp.accounts[0].get()
|
||||
} else {
|
||||
return TootApiResult(activity.getString(R.string.user_id_conversion_failed))
|
||||
}
|
||||
|
|
|
@ -57,7 +57,7 @@ class DuplicateMap {
|
|||
}
|
||||
|
||||
is TootAccountRef -> {
|
||||
val id = o.find().id
|
||||
val id = o.get().id
|
||||
if(set_account_id.contains(id)) return true
|
||||
set_account_id.add(id)
|
||||
}
|
||||
|
|
|
@ -76,7 +76,7 @@ open class TootAccount(
|
|||
val movedRef : TootAccountRef?
|
||||
|
||||
val moved : TootAccount?
|
||||
get() = movedRef?.find()
|
||||
get() = movedRef?.get()
|
||||
|
||||
val fields : ArrayList<Pair<String, String>>?
|
||||
|
||||
|
@ -84,6 +84,8 @@ open class TootAccount(
|
|||
|
||||
val bot : Boolean
|
||||
|
||||
val user_hides_network : Boolean
|
||||
|
||||
init {
|
||||
var sv : String?
|
||||
|
||||
|
@ -114,7 +116,8 @@ open class TootAccount(
|
|||
this.fields = parseFields(src.optJSONArray("fields"))
|
||||
|
||||
this.bot = src.optBoolean("bot", false)
|
||||
|
||||
this.user_hides_network = src.optBoolean("user_hides_network")
|
||||
|
||||
when(parser.serviceType) {
|
||||
ServiceType.MASTODON -> {
|
||||
|
||||
|
@ -124,7 +127,7 @@ open class TootAccount(
|
|||
|
||||
this.acct = src.notEmptyOrThrow("acct")
|
||||
this.host = findHostFromUrl(acct, hostAccess, url)
|
||||
?: throw RuntimeException("can't find host from acct or url")
|
||||
?: throw RuntimeException("can't get host from acct or url")
|
||||
|
||||
this.followers_count = src.parseLong("followers_count")
|
||||
this.following_count = src.parseLong("following_count")
|
||||
|
@ -146,7 +149,7 @@ open class TootAccount(
|
|||
|
||||
sv = src.notEmptyOrThrow("acct")
|
||||
this.host = findHostFromUrl(sv, null, url)
|
||||
?: throw RuntimeException("can't find host from acct or url")
|
||||
?: throw RuntimeException("can't get host from acct or url")
|
||||
this.acct = this.username + "@" + this.host
|
||||
|
||||
this.followers_count = src.parseLong("followers_count")
|
||||
|
@ -167,7 +170,7 @@ open class TootAccount(
|
|||
|
||||
// MSPはLTLの情報しか持ってないのでacctは常にホスト名部分を持たない
|
||||
this.host = findHostFromUrl(null, null, url)
|
||||
?: throw RuntimeException("can't find host from url")
|
||||
?: throw RuntimeException("can't get host from url")
|
||||
this.acct = this.username + "@" + host
|
||||
|
||||
this.followers_count = null
|
||||
|
|
|
@ -26,9 +26,7 @@ class TootAccountRef(parser: TootParser, account:TootAccount) : TimelineItem() {
|
|||
).decodeHTML(account.note)
|
||||
}
|
||||
|
||||
fun find() : TootAccount {
|
||||
return TootAccountMap.find(this)
|
||||
}
|
||||
fun get() = TootAccountMap.find(this)
|
||||
|
||||
companion object {
|
||||
fun mayNull(parser: TootParser, account:TootAccount?) :TootAccountRef? {
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package jp.juggler.subwaytooter.api.entity
|
||||
|
||||
import jp.juggler.subwaytooter.api.TootAccountMap
|
||||
import jp.juggler.subwaytooter.api.TootParser
|
||||
import jp.juggler.subwaytooter.util.notEmptyOrThrow
|
||||
import jp.juggler.subwaytooter.util.parseLong
|
||||
|
@ -20,7 +19,7 @@ class TootNotification(
|
|||
val time_created_at : Long
|
||||
|
||||
val account : TootAccount?
|
||||
get() = accountRef?.find()
|
||||
get() = accountRef?.get()
|
||||
|
||||
init {
|
||||
time_created_at = TootStatus.parseTime(created_at)
|
||||
|
|
|
@ -193,7 +193,7 @@ class DlgListMember(
|
|||
val search_result = TootParser(activity, list_owner ).results(jsonObject)
|
||||
if(search_result != null) {
|
||||
for(aRef in search_result.accounts) {
|
||||
val a = aRef.find()
|
||||
val a = aRef.get()
|
||||
if(target_user_full_acct.equals(list_owner .getFullAcct(a), ignoreCase = true)) {
|
||||
local_who = a
|
||||
break
|
||||
|
|
Loading…
Reference in New Issue