フォロー推奨APIに対応

This commit is contained in:
tateisu 2018-07-03 13:37:07 +09:00
parent 469f8eb5e0
commit 1cc875f1f3
6 changed files with 42 additions and 10 deletions

View File

@ -1025,6 +1025,12 @@ class ActMain : AppCompatActivity()
false,
Column.TYPE_FOLLOW_REQUESTS
)
R.id.nav_follow_suggestion-> Action_Account.timeline(
this,
defaultInsertPosition,
false,
Column.TYPE_FOLLOW_SUGGESTION
)
// R.id.nav_add_trend_tag ->Action_Account.timeline(
// this,
// defaultInsertPosition,

View File

@ -73,10 +73,11 @@ class Column(
"/api/v1/accounts/%d/following?limit=$READ_LIMIT" // 1:account_id
private const val PATH_ACCOUNT_FOLLOWERS =
"/api/v1/accounts/%d/followers?limit=$READ_LIMIT" // 1:account_id
private const val PATH_MUTES = "/api/v1/mutes?limit=$READ_LIMIT" // 1:account_id
private const val PATH_BLOCKS = "/api/v1/blocks?limit=$READ_LIMIT" // 1:account_id
private const val PATH_FOLLOW_REQUESTS =
"/api/v1/follow_requests?limit=$READ_LIMIT" // 1:account_id
private const val PATH_MUTES = "/api/v1/mutes?limit=$READ_LIMIT"
private const val PATH_BLOCKS = "/api/v1/blocks?limit=$READ_LIMIT"
private const val PATH_FOLLOW_REQUESTS = "/api/v1/follow_requests?limit=$READ_LIMIT"
private const val PATH_FOLLOW_SUGGESTION = "/api/v1/suggestions?limit=$READ_LIMIT"
private const val PATH_BOOSTED_BY =
"/api/v1/statuses/%s/reblogged_by?limit=$READ_LIMIT" // 1:status_id
private const val PATH_FAVOURITED_BY =
@ -165,6 +166,7 @@ class Column(
internal const val TYPE_SEARCH_TS = 22
internal const val TYPE_DIRECT_MESSAGES = 23
internal const val TYPE_TREND_TAG = 24
internal const val TYPE_FOLLOW_SUGGESTION = 25
internal const val TAB_STATUS = 0
internal const val TAB_FOLLOWING = 1
@ -207,6 +209,7 @@ class Column(
TYPE_SEARCH_TS -> context.getString(R.string.toot_search_ts)
TYPE_INSTANCE_INFORMATION -> context.getString(R.string.instance_information)
TYPE_FOLLOW_REQUESTS -> context.getString(R.string.follow_requests)
TYPE_FOLLOW_SUGGESTION -> context.getString(R.string.follow_suggestion)
TYPE_LIST_LIST -> context.getString(R.string.lists)
TYPE_LIST_MEMBER -> context.getString(R.string.list_member)
TYPE_LIST_TL -> context.getString(R.string.list_timeline)
@ -235,6 +238,7 @@ class Column(
TYPE_SEARCH, TYPE_SEARCH_MSP, TYPE_SEARCH_TS -> R.attr.ic_search
TYPE_INSTANCE_INFORMATION -> R.attr.ic_info
TYPE_FOLLOW_REQUESTS -> R.attr.ic_follow_wait
TYPE_FOLLOW_SUGGESTION -> R.attr.ic_follow_plus
TYPE_LIST_LIST -> R.attr.ic_list_list
TYPE_LIST_MEMBER -> R.attr.ic_list_member
TYPE_LIST_TL -> R.attr.ic_list_tl
@ -254,7 +258,7 @@ class Column(
private val time_format_hhmm = SimpleDateFormat("HH:mm", Locale.getDefault())
private fun getResetTimeString() :String{
private fun getResetTimeString() : String {
time_format_hhmm.timeZone = TimeZone.getDefault()
return time_format_hhmm.format(Date(0L))
}
@ -1121,7 +1125,11 @@ class Column(
try {
val re = Pattern.compile(regex_text)
column_regex_filter =
{ text : CharSequence? -> if(text?.isEmpty() != false ) false else re.matcher(text).find() }
{ text : CharSequence? ->
if(text?.isEmpty() != false) false else re.matcher(
text
).find()
}
} catch(ex : Throwable) {
log.trace(ex)
}
@ -1807,6 +1815,10 @@ class Column(
client,
PATH_FOLLOW_REQUESTS
)
TYPE_FOLLOW_SUGGESTION -> return parseAccountList(
client,
PATH_FOLLOW_SUGGESTION
)
TYPE_FAVOURITES -> return getStatuses(client, PATH_FAVOURITES)
@ -1894,7 +1906,10 @@ class Column(
this.list_tmp = addAll(this.list_tmp, src)
this.list_tmp = addOne(
this.list_tmp, TootMessageHolder(
context.getString(R.string.trend_tag_desc,getResetTimeString()),
context.getString(
R.string.trend_tag_desc,
getResetTimeString()
),
gravity = Gravity.END
)
)
@ -2800,6 +2815,7 @@ class Column(
TYPE_DOMAIN_BLOCKS -> getDomainList(client, PATH_DOMAIN_BLOCK)
TYPE_FOLLOW_REQUESTS -> getAccountList(client, PATH_FOLLOW_REQUESTS)
TYPE_FOLLOW_SUGGESTION -> getAccountList(client, PATH_FOLLOW_SUGGESTION)
TYPE_HASHTAG -> getStatusList(client, makeHashtagUrl(hashtag))
@ -3281,6 +3297,7 @@ class Column(
TYPE_BLOCKS -> getAccountList(client, PATH_BLOCKS)
TYPE_FOLLOW_REQUESTS -> getAccountList(client, PATH_FOLLOW_REQUESTS)
TYPE_FOLLOW_SUGGESTION -> getAccountList(client, PATH_FOLLOW_SUGGESTION)
TYPE_PROFILE -> when(profile_tab) {
@ -3530,7 +3547,8 @@ class Column(
// カラム設定に正規表現フィルタを含めるなら真
fun canStatusFilter() : Boolean {
return when(column_type) {
TYPE_REPORTS, TYPE_MUTES, TYPE_BLOCKS, TYPE_DOMAIN_BLOCKS, TYPE_FOLLOW_REQUESTS,
TYPE_REPORTS, TYPE_MUTES, TYPE_BLOCKS, TYPE_DOMAIN_BLOCKS,
TYPE_FOLLOW_REQUESTS, TYPE_FOLLOW_SUGGESTION,
TYPE_BOOSTED_BY, TYPE_FAVOURITED_BY, TYPE_INSTANCE_INFORMATION, TYPE_LIST_LIST, TYPE_LIST_MEMBER,
TYPE_TREND_TAG -> false
else -> true

View File

@ -78,6 +78,11 @@
android:icon="?attr/ic_follow_wait"
android:title="@string/follow_requests"/>
<item
android:id="@+id/nav_follow_suggestion"
android:icon="?attr/ic_follow_plus"
android:title="@string/follow_suggestion"/>
<item
android:id="@+id/nav_add_mutes"
android:icon="?attr/ic_mute"

View File

@ -689,8 +689,9 @@
<string name="notification_tl_icon_size">Notification TL icon size (unit:dp. default:32. app restart required)</string>
<string name="post_button_tapped_repeatly">Post button was tapped repeatedly</string>
<string name="regex_filter_matches_empty_string">regex filter matches to empty string.</string>
<string name="follow_suggestion">Follow suggestion</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>-->

View File

@ -967,5 +967,6 @@
<string name="notification_tl_icon_size">通知TLのアイコンサイズ (単位:dp。デフォルト:32。アプリ再起動が必要)</string>
<string name="post_button_tapped_repeatly">投稿ボタンの連打を検出</string>
<string name="regex_filter_matches_empty_string">正規表現フィルタは空文字列にマッチしてしまいます</string>
<string name="follow_suggestion">フォロー推奨ユーザ</string>
</resources>

View File

@ -674,4 +674,5 @@
<string name="notification_tl_icon_size">Notification TL icon size (unit:dp. default:32. app restart required)</string>
<string name="post_button_tapped_repeatly">Post button was tapped repeatedly</string>
<string name="regex_filter_matches_empty_string">regex filter matches to empty string.</string>
<string name="follow_suggestion">Follow suggestion</string>
</resources>