mirror of
https://github.com/tateisu/SubwayTooter
synced 2025-01-29 18:19:22 +01:00
プロフカラムでフォロー、フォロワーが隠されているまたは存在しない時にメッセージを表示する
This commit is contained in:
parent
c01fd4395f
commit
0e07ff6af4
@ -1536,12 +1536,18 @@ class Column(
|
||||
|
||||
internal fun parseAccountList(
|
||||
client : TootApiClient,
|
||||
path_base : String
|
||||
path_base : String,
|
||||
emptyMessage : String? = null
|
||||
) : TootApiResult? {
|
||||
val result = client.request(path_base)
|
||||
if(result != null) {
|
||||
saveRange(result, true, true)
|
||||
this.list_tmp = addAll(null, parser.accountList(result.jsonArray))
|
||||
val src = parser.accountList(result.jsonArray)
|
||||
if(src.isEmpty() && emptyMessage != null) {
|
||||
this.list_tmp = addOne(null, TootMessageHolder(emptyMessage))
|
||||
} else {
|
||||
this.list_tmp = addAll(null, src)
|
||||
}
|
||||
}
|
||||
return result
|
||||
}
|
||||
@ -1682,12 +1688,14 @@ class Column(
|
||||
|
||||
TAB_FOLLOWING -> return parseAccountList(
|
||||
client,
|
||||
String.format(Locale.JAPAN, PATH_ACCOUNT_FOLLOWING, profile_id)
|
||||
String.format(Locale.JAPAN, PATH_ACCOUNT_FOLLOWING, profile_id),
|
||||
emptyMessage = context.getString(R.string.none_or_hidden_following)
|
||||
)
|
||||
|
||||
TAB_FOLLOWERS -> return parseAccountList(
|
||||
client,
|
||||
String.format(Locale.JAPAN, PATH_ACCOUNT_FOLLOWERS, profile_id)
|
||||
String.format(Locale.JAPAN, PATH_ACCOUNT_FOLLOWERS, profile_id),
|
||||
emptyMessage = context.getString(R.string.none_or_hidden_followers)
|
||||
)
|
||||
|
||||
TAB_STATUS -> {
|
||||
@ -2641,13 +2649,15 @@ class Column(
|
||||
|
||||
TYPE_PROFILE -> {
|
||||
loadProfileAccount(client, false)
|
||||
|
||||
|
||||
when(profile_tab) {
|
||||
TAB_FOLLOWING -> getAccountList(
|
||||
client,
|
||||
String.format(Locale.JAPAN, PATH_ACCOUNT_FOLLOWING, profile_id)
|
||||
)
|
||||
|
||||
TAB_FOLLOWERS -> return getAccountList(
|
||||
TAB_FOLLOWERS -> getAccountList(
|
||||
client,
|
||||
String.format(Locale.JAPAN, PATH_ACCOUNT_FOLLOWERS, profile_id)
|
||||
)
|
||||
@ -3176,6 +3186,7 @@ class Column(
|
||||
TYPE_FOLLOW_REQUESTS -> getAccountList(client, PATH_FOLLOW_REQUESTS)
|
||||
|
||||
TYPE_PROFILE -> when(profile_tab) {
|
||||
|
||||
TAB_FOLLOWING -> getAccountList(
|
||||
client,
|
||||
String.format(Locale.JAPAN, PATH_ACCOUNT_FOLLOWING, profile_id)
|
||||
|
@ -119,6 +119,7 @@ internal class ItemViewHolder(
|
||||
|
||||
private lateinit var tvApplication : TextView
|
||||
|
||||
private lateinit var tvMessageHolder: TextView
|
||||
private lateinit var access_info : SavedAccount
|
||||
|
||||
private var buttons_for_status : StatusButtons? = null
|
||||
@ -193,6 +194,7 @@ internal class ItemViewHolder(
|
||||
tvContent.textSize = activity.timeline_font_size_sp
|
||||
btnShowMedia.textSize = activity.timeline_font_size_sp
|
||||
tvApplication.textSize = activity.timeline_font_size_sp
|
||||
tvMessageHolder.textSize = activity.timeline_font_size_sp
|
||||
btnListTL.textSize = activity.timeline_font_size_sp
|
||||
}
|
||||
|
||||
@ -318,6 +320,7 @@ internal class ItemViewHolder(
|
||||
llList.visibility = View.GONE
|
||||
llFollowRequest.visibility = View.GONE
|
||||
llExtra.removeAllViews()
|
||||
tvMessageHolder.visibility = View.GONE
|
||||
|
||||
var c : Int
|
||||
c = if(column.content_color != 0) column.content_color else content_color_default
|
||||
@ -329,6 +332,7 @@ internal class ItemViewHolder(
|
||||
tvContent.setTextColor(c)
|
||||
//NSFWは文字色固定 btnShowMedia.setTextColor( c );
|
||||
tvApplication.setTextColor(c)
|
||||
tvMessageHolder.setTextColor(c)
|
||||
|
||||
c = if(column.acct_color != 0) column.acct_color else Styler.getAttributeColor(
|
||||
activity,
|
||||
@ -343,13 +347,6 @@ internal class ItemViewHolder(
|
||||
|
||||
this.item = item
|
||||
when(item) {
|
||||
is TootTag -> showSearchTag(item)
|
||||
is TootAccountRef -> showAccount(item)
|
||||
is TootNotification -> showNotification(item)
|
||||
is TootGap -> showGap()
|
||||
is TootDomainBlock -> showDomainBlock(item)
|
||||
is TootList -> showList(item)
|
||||
|
||||
is TootStatus -> {
|
||||
val reblog = item.reblog
|
||||
if(reblog != null) {
|
||||
@ -368,11 +365,28 @@ internal class ItemViewHolder(
|
||||
}
|
||||
}
|
||||
|
||||
is TootAccountRef -> showAccount(item)
|
||||
|
||||
is TootNotification -> showNotification(item)
|
||||
|
||||
is TootTag -> showSearchTag(item)
|
||||
is TootGap -> showGap()
|
||||
is TootDomainBlock -> showDomainBlock(item)
|
||||
is TootList -> showList(item)
|
||||
|
||||
is TootMessageHolder -> showMessageHolder(item)
|
||||
|
||||
else -> {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun showMessageHolder(item : TootMessageHolder) {
|
||||
tvMessageHolder.visibility = View.VISIBLE
|
||||
tvMessageHolder.text = item.text
|
||||
tvMessageHolder.gravity = item.gravity
|
||||
}
|
||||
|
||||
private fun showNotification(n : TootNotification) {
|
||||
val n_status = n.status
|
||||
val n_accountRef = n.accountRef
|
||||
@ -1918,6 +1932,10 @@ internal class ItemViewHolder(
|
||||
}
|
||||
}
|
||||
|
||||
tvMessageHolder = textView{
|
||||
padding =dip(4)
|
||||
}.lparams(matchParent, wrapContent)
|
||||
|
||||
llFollowRequest = linearLayout {
|
||||
lparams(matchParent, wrapContent) {
|
||||
topMargin = dip(6)
|
||||
|
@ -0,0 +1,8 @@
|
||||
package jp.juggler.subwaytooter.api.entity
|
||||
|
||||
import android.view.Gravity
|
||||
|
||||
class TootMessageHolder(
|
||||
val text : String,
|
||||
val gravity : Int = Gravity.CENTER_HORIZONTAL
|
||||
) : TimelineItem()
|
@ -674,8 +674,10 @@
|
||||
<string name="push_subscription_already_exists">Push subscription is up to date.</string>
|
||||
<string name="user_agent">User-Agent HTTP header</string>
|
||||
<string name="user_agent_error">User-Agent can\'t contains NON-ASCII characters. [%1$s]</string>
|
||||
<string name="none_or_hidden_following">There is no follows, or hidden by setting.</string>
|
||||
<string name="none_or_hidden_followers">There is no followers, or hidden by setting.</string>
|
||||
|
||||
<!--<string name="abc_action_bar_home_description">Revenir à l\'accueil</string>-->
|
||||
<!--<string name="abc_action_bar_home_description">Revenir à l\'accueil</string>-->
|
||||
<!--<string name="abc_action_bar_home_description_format">%1$s, %2$s</string>-->
|
||||
<!--<string name="abc_action_bar_home_subtitle_description_format">%1$s, %2$s, %3$s</string>-->
|
||||
<!--<string name="abc_action_bar_up_description">Revenir en haut de la page</string>-->
|
||||
|
@ -952,5 +952,7 @@
|
||||
<string name="push_subscription_already_exists">プッシュ購読は既に最新の状態です。</string>
|
||||
<string name="user_agent">User-Agent HTTPヘッダ</string>
|
||||
<string name="user_agent_error">User-Agentには非ASCII文字を使えません。[%1$s]</string>
|
||||
<string name="none_or_hidden_following">フォロー中がいません。または設定により隠されています。</string>
|
||||
<string name="none_or_hidden_followers">フォロワーはいません。または設定により隠されています。</string>
|
||||
|
||||
</resources>
|
||||
|
@ -659,4 +659,6 @@
|
||||
<string name="push_subscription_already_exists">Push subscription is up to date.</string>
|
||||
<string name="user_agent">User-Agent HTTP header</string>
|
||||
<string name="user_agent_error">User-Agent can\'t contains NON-ASCII characters. [%1$s]</string>
|
||||
<string name="none_or_hidden_following">There is no follows, or hidden by setting.</string>
|
||||
<string name="none_or_hidden_followers">There is no followers, or hidden by setting.</string>
|
||||
</resources>
|
||||
|
Loading…
x
Reference in New Issue
Block a user