フォローリクエスト一覧に承認/却下ボタンを追加

This commit is contained in:
tateisu 2018-04-18 01:29:50 +09:00
parent 3772c9d99e
commit 12f35c1b9a
21 changed files with 72 additions and 9 deletions

1
.gitignore vendored
View File

@ -3,6 +3,7 @@
/local.properties
/.idea/workspace.xml
/.idea/libraries
/.idea/assetWizardSettings.xml
.DS_Store
/build
/captures

View File

@ -37,7 +37,7 @@ dependencies {
implementation project(':apng_android')
implementation 'com.android.support:appcompat-v7:27.1.0'
implementation "com.android.support:appcompat-v7:$asl_version"
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'

View File

@ -12,8 +12,8 @@ android {
minSdkVersion 21
targetSdkVersion 27
versionCode 237
versionName "2.3.7"
versionCode 238
versionName "2.3.8"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

View File

@ -206,7 +206,7 @@ class Column(
TYPE_DOMAIN_BLOCKS -> R.attr.ic_domain_block
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_account_add
TYPE_FOLLOW_REQUESTS -> R.attr.ic_follow_wait
TYPE_LIST_LIST -> R.attr.ic_list_list
TYPE_LIST_MEMBER -> R.attr.ic_list_member
TYPE_LIST_TL -> R.attr.ic_list_tl

View File

@ -111,6 +111,10 @@ internal class ItemViewHolder(
private lateinit var btnListTL : Button
private lateinit var btnListMore : ImageButton
private lateinit var llFollowRequest : View
private lateinit var btnFollowRequestAccept : View
private lateinit var btnFollowRequestDeny : View
private lateinit var llExtra : LinearLayout
private lateinit var tvApplication : TextView
@ -163,6 +167,9 @@ internal class ItemViewHolder(
llFollow.setOnLongClickListener(this)
btnFollow.setOnClickListener(this)
btnFollowRequestAccept.setOnClickListener(this)
btnFollowRequestDeny.setOnClickListener(this)
// ロングタップ
ivThumbnail.setOnLongClickListener(this)
@ -309,6 +316,7 @@ internal class ItemViewHolder(
llStatus.visibility = View.GONE
llSearchTag.visibility = View.GONE
llList.visibility = View.GONE
llFollowRequest.visibility = View.GONE
llExtra.removeAllViews()
var c : Int
@ -478,6 +486,10 @@ internal class ItemViewHolder(
val relation = UserRelation.load(access_info.db_id, who.id)
Styler.setFollowIcon(activity, btnFollow, ivFollowedBy, relation, who)
if(column.column_type == Column.TYPE_FOLLOW_REQUESTS) {
llFollowRequest.visibility = View.VISIBLE
}
}
private fun showStatus(activity : ActMain, status : TootStatus) {
@ -950,6 +962,18 @@ internal class ItemViewHolder(
.show(activity, item.title)
}
btnFollowRequestAccept -> follow_account?.let { who ->
DlgConfirm.openSimple(activity,activity.getString(R.string.follow_accept_confirm,AcctColor.getNickname(access_info.getFullAcct(who)))){
Action_Follow.authorizeFollowRequest(activity, access_info, who, true)
}
}
btnFollowRequestDeny -> follow_account?.let { who ->
DlgConfirm.openSimple(activity,activity.getString(R.string.follow_deny_confirm,AcctColor.getNickname(access_info.getFullAcct(who)))){
Action_Follow.authorizeFollowRequest(activity, access_info, who, false)
}
}
else -> when(v.id) {
R.id.ivCardThumbnail -> status_showing?.card?.url?.let { url ->
if(url.isNotEmpty()) App1.openCustomTab(activity, url)
@ -1844,6 +1868,29 @@ internal class ItemViewHolder(
startMargin = dip(4)
}
}
llFollowRequest = linearLayout {
lparams(matchParent, wrapContent) {
topMargin = dip(6)
}
gravity = Gravity.END
btnFollowRequestAccept = imageButton {
background = ContextCompat.getDrawable(context, R.drawable.btn_bg_transparent)
contentDescription = context.getString(R.string.follow_accept)
imageResource = Styler.getAttributeResourceId(context, R.attr.ic_check)
setPadding(0,0,0,0)
}.lparams(dip(48f),dip(32f))
btnFollowRequestDeny = imageButton {
background = ContextCompat.getDrawable(context, R.drawable.btn_bg_transparent)
contentDescription = context.getString(R.string.follow_deny)
imageResource = Styler.getAttributeResourceId(context, R.attr.btn_close)
setPadding(0,0,0,0)
}.lparams(dip(48f),dip(32f)){
startMargin = dip(4)
}
}
}
}

View File

@ -45,7 +45,7 @@ object DlgConfirm {
}
@SuppressLint("InflateParams")
fun openSimple(activity : Activity, message : String, callback : EmptyCallback) {
fun openSimple(activity : Activity, message : String, callback : ()->Unit ) {
val view = activity.layoutInflater.inflate(R.layout.dlg_confirm, null, false)
val tvMessage = view.findViewById<TextView>(R.id.tvMessage)
val cbSkipNext = view.findViewById<CheckBox>(R.id.cbSkipNext)

Binary file not shown.

After

Width:  |  Height:  |  Size: 324 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 291 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 208 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 196 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 305 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 289 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 506 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 462 B

View File

@ -65,7 +65,7 @@
<item
android:id="@+id/nav_follow_requests"
android:icon="?attr/ic_account_add"
android:icon="?attr/ic_follow_wait"
android:title="@string/follow_requests"/>
<item

View File

@ -637,8 +637,12 @@
\nBut if you want to use "custom notification listener", or if you are the member of very limited instances that is supported by ST\'s app server,
\nyou can use "push" notifications, but you have to allow sending access tokens to the app server. (this is mastodon's defect)</string>
<string name="pull_notification_check_interval">Pull notification check interval (unit: minutes, default:15, min:15)</string>
<string name="follow_accept">accept</string>
<string name="follow_deny">deny</string>
<string name="follow_accept_confirm">Approve the follow request from %1$s ?</string>
<string name="follow_deny_confirm">Reject the follow request from %1$s ?</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

@ -916,4 +916,8 @@
<string name="send_access_token_to_app_server">アクセストークンをアプリサーバに送信する</string>
<string name="send_access_token_to_app_server_desc">通常は"pull"通知(すこし遅れる)を利用できます。それは端末上で動作するのでアプリサーバは必要ありません。しかしカスタム通知リスナを使う場合やSTがサポートする限られたインスタンスのユーザである場合は"push"通知を利用することができます。ただしアクセストークンをアプリサーバに送信する必要があります(これはマストドンの欠陥です)。</string>
<string name="pull_notification_check_interval">Pull通知の確認間隔 (単位:分, デフォルト:15, 最低: 15)</string>
<string name="follow_accept">承認</string>
<string name="follow_deny">却下</string>
<string name="follow_accept_confirm">%1$sからのフォローリクエストを承認しますか?</string>
<string name="follow_deny_confirm">%1$sからのフォローリクエストを却下しますか?</string>
</resources>

View File

@ -138,5 +138,6 @@
<attr name="ic_right" format="reference" />
<attr name="ic_volume_up" format="reference" />
<attr name="ic_face" format="reference" />
<attr name="ic_check" format="reference" />
</resources>

View File

@ -623,4 +623,8 @@
\nBut if you want to use "custom notification listener", or if you are the member of very limited instances that is supported by ST\'s app server,
\nyou can use "push" notifications, but you have to allow sending access tokens to the app server. (this is mastodon's defect)</string>
<string name="pull_notification_check_interval">Pull notification check interval (unit: minutes, default:15, min:15)</string>
<string name="follow_accept">accept</string>
<string name="follow_deny">deny</string>
<string name="follow_accept_confirm">Approve the follow request from %1$s ?</string>
<string name="follow_deny_confirm">Reject the follow request from %1$s ?</string>
</resources>

View File

@ -109,6 +109,7 @@
<item name="ic_right">@drawable/ic_right</item>
<item name="ic_volume_up">@drawable/ic_volume_up</item>
<item name="ic_face">@drawable/ic_face</item>
<item name="ic_check">@drawable/ic_check</item>
</style>
@ -222,6 +223,7 @@
<item name="ic_right">@drawable/ic_right_dark</item>
<item name="ic_volume_up">@drawable/ic_volume_up_dark</item>
<item name="ic_face">@drawable/ic_face_dark</item>
<item name="ic_check">@drawable/ic_check_dark</item>
</style>

View File

@ -4,7 +4,7 @@ buildscript {
ext.kotlin_coroutines_version = '0.21.2'
ext.anko_version='0.10.4'
ext.asl_version='27.1.1'
ext.firebase_version='12.0.1'
ext.firebase_version='15.0.0'
repositories {
jcenter()
@ -12,7 +12,7 @@ buildscript {
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.0'
classpath 'com.android.tools.build:gradle:3.1.1'
classpath 'com.google.gms:google-services:3.0.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}