mirror of
https://github.com/tateisu/SubwayTooter
synced 2025-02-09 16:48:47 +01:00
システム通知にacctを表示する設定。リストメンバー追加ダイアログのバグ修正。
This commit is contained in:
parent
240da00dc9
commit
30bb9444aa
@ -1262,42 +1262,56 @@ class PollingWorker private constructor(contextArg : Context) {
|
||||
dstListJson.add(src)
|
||||
}
|
||||
|
||||
private fun getNotificationLine(type : String, display_name : CharSequence) =
|
||||
when(type) {
|
||||
private fun getNotificationLine(item:Data):String{
|
||||
val name = when(Pref.bpShowAcctInSystemNotification(pref)) {
|
||||
false -> item.notification.accountRef?.decoded_display_name
|
||||
|
||||
true -> {
|
||||
val acct = item.notification.accountRef?.get()?.acct
|
||||
if(acct?.isNotEmpty() == true) {
|
||||
"@$acct"
|
||||
} else {
|
||||
null
|
||||
}
|
||||
}
|
||||
} ?: "?"
|
||||
return when(item.notification.type) {
|
||||
TootNotification.TYPE_MENTION,
|
||||
TootNotification.TYPE_REPLY ->
|
||||
"- " + context.getString(R.string.display_name_replied_by, display_name)
|
||||
"- " + context.getString(R.string.display_name_replied_by, name)
|
||||
|
||||
TootNotification.TYPE_RENOTE,
|
||||
TootNotification.TYPE_REBLOG ->
|
||||
"- " + context.getString(R.string.display_name_boosted_by, display_name)
|
||||
"- " + context.getString(R.string.display_name_boosted_by, name)
|
||||
|
||||
TootNotification.TYPE_QUOTE ->
|
||||
"- " + context.getString(R.string.display_name_quoted_by, display_name)
|
||||
"- " + context.getString(R.string.display_name_quoted_by, name)
|
||||
|
||||
TootNotification.TYPE_FOLLOW ->
|
||||
"- " + context.getString(R.string.display_name_followed_by, display_name)
|
||||
"- " + context.getString(R.string.display_name_followed_by, name)
|
||||
|
||||
TootNotification.TYPE_UNFOLLOW ->
|
||||
"- " + context.getString(R.string.display_name_unfollowed_by, display_name)
|
||||
"- " + context.getString(R.string.display_name_unfollowed_by, name)
|
||||
|
||||
TootNotification.TYPE_FAVOURITE ->
|
||||
"- " + context.getString(R.string.display_name_favourited_by, display_name)
|
||||
"- " + context.getString(R.string.display_name_favourited_by, name)
|
||||
|
||||
TootNotification.TYPE_REACTION ->
|
||||
"- " + context.getString(R.string.display_name_reaction_by, display_name)
|
||||
"- " + context.getString(R.string.display_name_reaction_by, name)
|
||||
|
||||
TootNotification.TYPE_VOTE ->
|
||||
"- " + context.getString(R.string.display_name_voted_by, display_name)
|
||||
"- " + context.getString(R.string.display_name_voted_by, name)
|
||||
|
||||
TootNotification.TYPE_FOLLOW_REQUEST ->
|
||||
"- " + context.getString(
|
||||
R.string.display_name_follow_request_by,
|
||||
display_name
|
||||
name
|
||||
)
|
||||
|
||||
else -> "- " + "?"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private fun showNotification(data_list : ArrayList<Data>) {
|
||||
|
||||
@ -1443,11 +1457,11 @@ class PollingWorker private constructor(contextArg : Context) {
|
||||
|
||||
log.d("showNotification[${account.acct}] creating notification(7)")
|
||||
|
||||
var a = getNotificationLine(
|
||||
item.notification.type,
|
||||
item.notification.accountRef?.decoded_display_name ?: "?"
|
||||
)
|
||||
|
||||
var a = getNotificationLine(item)
|
||||
|
||||
val acct = item.access_info.acct
|
||||
|
||||
if(data_list.size == 1) {
|
||||
builder.setContentTitle(a)
|
||||
builder.setContentText(acct)
|
||||
@ -1462,10 +1476,7 @@ class PollingWorker private constructor(contextArg : Context) {
|
||||
for(i in 0 .. 4) {
|
||||
if(i >= data_list.size) break
|
||||
item = data_list[i]
|
||||
a = getNotificationLine(
|
||||
item.notification.type,
|
||||
item.notification.accountRef?.decoded_display_name ?: "?"
|
||||
)
|
||||
a = getNotificationLine(item)
|
||||
style.addLine(a)
|
||||
}
|
||||
builder.setStyle(style)
|
||||
|
@ -356,7 +356,11 @@ object Pref {
|
||||
false,
|
||||
R.id.swMoveNotificationsQuickFilter
|
||||
)
|
||||
|
||||
val bpShowAcctInSystemNotification = BooleanPref(
|
||||
"ShowAcctInSystemNotification",
|
||||
false,
|
||||
R.id.swShowAcctInSystemNotification
|
||||
)
|
||||
// int
|
||||
|
||||
val ipBackButtonAction = IntPref("back_button_action", 0)
|
||||
|
@ -15,10 +15,7 @@ import jp.juggler.subwaytooter.action.Action_List
|
||||
import jp.juggler.subwaytooter.action.Action_ListMember
|
||||
import jp.juggler.subwaytooter.action.makeAccountListNonPseudo
|
||||
import jp.juggler.subwaytooter.api.*
|
||||
import jp.juggler.subwaytooter.api.entity.EntityId
|
||||
import jp.juggler.subwaytooter.api.entity.TootAccount
|
||||
import jp.juggler.subwaytooter.api.entity.TootList
|
||||
import jp.juggler.subwaytooter.api.entity.parseList
|
||||
import jp.juggler.subwaytooter.api.entity.*
|
||||
import jp.juggler.subwaytooter.table.AcctColor
|
||||
import jp.juggler.subwaytooter.table.SavedAccount
|
||||
import jp.juggler.subwaytooter.util.NetworkEmojiInvalidator
|
||||
@ -179,11 +176,11 @@ class DlgListMember(
|
||||
|
||||
// リストに追加したいアカウントの自タンスでのアカウントIDを取得する
|
||||
var result = client.syncAccountByAcct(list_owner,target_user_full_acct)
|
||||
local_who = result?.data as? TootAccount
|
||||
|
||||
val local_who = this@DlgListMember.local_who
|
||||
val local_who = (result?.data as? TootAccountRef)?.get()
|
||||
?: return TootApiResult(activity.getString(R.string.account_sync_failed))
|
||||
|
||||
this@DlgListMember.local_who = local_who
|
||||
|
||||
if(list_owner.isMisskey){
|
||||
// 今のmisskeyではリスト全スキャンしないとユーザの登録状況が分からない
|
||||
val params = list_owner.putMisskeyApiToken(JSONObject())
|
||||
|
@ -89,5 +89,23 @@
|
||||
|
||||
<View style="@style/setting_divider"/>
|
||||
|
||||
|
||||
<TextView
|
||||
style="@style/setting_row_label"
|
||||
android:text="@string/show_acct_in_system_notification"
|
||||
/>
|
||||
|
||||
<LinearLayout style="@style/setting_row_form">
|
||||
|
||||
<Switch
|
||||
android:id="@+id/swShowAcctInSystemNotification"
|
||||
style="@style/setting_horizontal_stretch"
|
||||
android:gravity="center"
|
||||
/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<View style="@style/setting_divider"/>
|
||||
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
@ -64,6 +64,7 @@
|
||||
android:contentDescription="@string/drag_handle"
|
||||
android:scaleType="center"
|
||||
android:src="@drawable/ic_order"
|
||||
android:tint="?attr/colorVectorDrawable"
|
||||
/>
|
||||
|
||||
<LinearLayout
|
||||
@ -109,6 +110,7 @@
|
||||
android:contentDescription="@string/last_selection"
|
||||
android:scaleType="center"
|
||||
android:src="@drawable/ic_bookmark"
|
||||
android:tint="?attr/colorVectorDrawable"
|
||||
/>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
@ -53,6 +53,7 @@
|
||||
android:scaleType="center"
|
||||
android:src="@drawable/ic_order"
|
||||
android:visibility="gone"
|
||||
android:tint="?attr/colorVectorDrawable"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
@ -72,6 +73,7 @@
|
||||
android:id="@+id/btnSound"
|
||||
android:src="@drawable/ic_volume_up"
|
||||
android:contentDescription="@string/check_sound"
|
||||
android:tint="?attr/colorVectorDrawable"
|
||||
/>
|
||||
</LinearLayout>
|
||||
|
||||
|
@ -851,5 +851,6 @@
|
||||
<string name="move_notifications_quick_filter_to_column_setting">通知カラムのクイックフィルタをカラム設定内部に表示する(アプリ再起動が必要)</string>
|
||||
<string name="copy_account_id">アカウントID %1$s をコピー</string>
|
||||
<string name="open_in_admin_ui">管理者WebUIで開く</string>
|
||||
<string name="show_acct_in_system_notification">システム通知に(ユーザ名ではなく)acctを使用する</string>
|
||||
|
||||
</resources>
|
||||
|
@ -873,5 +873,6 @@
|
||||
<string name="move_notifications_quick_filter_to_column_setting">Show notifications quick filter in column setting (app restart required)</string>
|
||||
<string name="copy_account_id">Copy account ID %1$s</string>
|
||||
<string name="open_in_admin_ui">Open in admin web UI</string>
|
||||
<string name="show_acct_in_system_notification">Show acct (instead of user name) in system notification</string>
|
||||
|
||||
</resources>
|
Loading…
x
Reference in New Issue
Block a user