2018-01-04 19:52:25 +01:00
|
|
|
package jp.juggler.subwaytooter
|
|
|
|
|
|
|
|
import android.annotation.SuppressLint
|
|
|
|
import android.app.Dialog
|
2019-01-17 20:40:51 +01:00
|
|
|
import android.content.res.ColorStateList
|
2019-02-15 02:51:22 +01:00
|
|
|
import androidx.core.app.ShareCompat
|
|
|
|
import androidx.core.content.ContextCompat
|
|
|
|
import androidx.core.view.ViewCompat
|
|
|
|
import androidx.appcompat.app.AlertDialog
|
|
|
|
import androidx.appcompat.widget.AppCompatImageButton
|
2019-01-08 10:41:07 +01:00
|
|
|
import android.view.Gravity
|
2018-01-04 19:52:25 +01:00
|
|
|
import android.view.View
|
2019-01-08 10:41:07 +01:00
|
|
|
import android.view.ViewGroup
|
2018-01-04 19:52:25 +01:00
|
|
|
import android.view.WindowManager
|
2019-01-08 10:41:07 +01:00
|
|
|
import android.widget.*
|
2018-10-01 02:10:16 +02:00
|
|
|
import jp.juggler.subwaytooter.action.*
|
2018-05-08 10:25:02 +02:00
|
|
|
import jp.juggler.subwaytooter.api.entity.TootAccountRef
|
2018-01-04 19:52:25 +01:00
|
|
|
import jp.juggler.subwaytooter.api.entity.TootNotification
|
|
|
|
import jp.juggler.subwaytooter.api.entity.TootStatus
|
2019-04-04 05:13:15 +02:00
|
|
|
import jp.juggler.subwaytooter.api.entity.TootVisibility
|
|
|
|
import jp.juggler.subwaytooter.dialog.ActionsDialog
|
2018-01-04 19:52:25 +01:00
|
|
|
import jp.juggler.subwaytooter.dialog.DlgListMember
|
|
|
|
import jp.juggler.subwaytooter.dialog.DlgQRCode
|
2019-01-08 10:41:07 +01:00
|
|
|
import jp.juggler.subwaytooter.span.MyClickableSpan
|
2018-03-15 17:23:43 +01:00
|
|
|
import jp.juggler.subwaytooter.table.FavMute
|
2018-01-04 19:52:25 +01:00
|
|
|
import jp.juggler.subwaytooter.table.SavedAccount
|
|
|
|
import jp.juggler.subwaytooter.table.UserRelation
|
2018-12-01 00:02:18 +01:00
|
|
|
import jp.juggler.util.*
|
2019-01-08 10:41:07 +01:00
|
|
|
import org.jetbrains.anko.allCaps
|
2019-01-20 22:04:57 +01:00
|
|
|
import org.jetbrains.anko.backgroundDrawable
|
2018-10-01 02:10:16 +02:00
|
|
|
import java.util.*
|
2018-01-04 19:52:25 +01:00
|
|
|
|
|
|
|
@SuppressLint("InflateParams")
|
|
|
|
internal class DlgContextMenu(
|
|
|
|
val activity : ActMain,
|
|
|
|
private val column : Column,
|
2018-05-08 10:25:02 +02:00
|
|
|
private val whoRef : TootAccountRef?,
|
2018-01-04 19:52:25 +01:00
|
|
|
private val status : TootStatus?,
|
2019-01-08 10:41:07 +01:00
|
|
|
private val notification : TootNotification? = null,
|
|
|
|
private val contentTextView : TextView? = null
|
2018-01-04 19:52:25 +01:00
|
|
|
) : View.OnClickListener, View.OnLongClickListener {
|
|
|
|
|
|
|
|
companion object {
|
|
|
|
private val log = LogCategory("DlgContextMenu")
|
|
|
|
}
|
|
|
|
|
|
|
|
private val access_info : SavedAccount
|
|
|
|
private val relation : UserRelation
|
|
|
|
|
|
|
|
private val dialog : Dialog
|
|
|
|
|
|
|
|
init {
|
|
|
|
this.access_info = column.access_info
|
2018-05-08 10:25:02 +02:00
|
|
|
|
2018-01-04 19:52:25 +01:00
|
|
|
val column_type = column.column_type
|
2018-05-08 10:25:02 +02:00
|
|
|
|
2018-05-18 19:08:46 +02:00
|
|
|
val who = whoRef?.get()
|
2018-01-04 19:52:25 +01:00
|
|
|
val status = this.status
|
|
|
|
|
2018-08-20 02:07:55 +02:00
|
|
|
this.relation = when {
|
|
|
|
who != null -> UserRelation.load(access_info.db_id, who.id)
|
|
|
|
else -> UserRelation()
|
|
|
|
}
|
2018-01-04 19:52:25 +01:00
|
|
|
val viewRoot = activity.layoutInflater.inflate(R.layout.dlg_context_menu, null, false)
|
|
|
|
this.dialog = Dialog(activity)
|
|
|
|
dialog.setContentView(viewRoot)
|
|
|
|
dialog.setCancelable(true)
|
|
|
|
dialog.setCanceledOnTouchOutside(true)
|
|
|
|
|
2019-01-09 19:40:27 +01:00
|
|
|
val llStatus : View = viewRoot.findViewById(R.id.llStatus)
|
|
|
|
val btnStatusWebPage : View = viewRoot.findViewById(R.id.btnStatusWebPage)
|
|
|
|
val btnText : View = viewRoot.findViewById(R.id.btnText)
|
|
|
|
val btnFavouriteAnotherAccount : View =
|
|
|
|
viewRoot.findViewById(R.id.btnFavouriteAnotherAccount)
|
|
|
|
val btnBoostAnotherAccount : View = viewRoot.findViewById(R.id.btnBoostAnotherAccount)
|
|
|
|
val btnReactionAnotherAccount : View = viewRoot.findViewById(R.id.btnReactionAnotherAccount)
|
|
|
|
val btnReplyAnotherAccount : View = viewRoot.findViewById(R.id.btnReplyAnotherAccount)
|
|
|
|
val btnQuotedRenote : View = viewRoot.findViewById(R.id.btnQuotedRenote)
|
|
|
|
val btnDelete : View = viewRoot.findViewById(R.id.btnDelete)
|
|
|
|
val btnRedraft : View = viewRoot.findViewById(R.id.btnRedraft)
|
|
|
|
|
|
|
|
val btnReport : View = viewRoot.findViewById(R.id.btnReport)
|
|
|
|
val btnMuteApp : Button = viewRoot.findViewById(R.id.btnMuteApp)
|
|
|
|
val llAccountActionBar : View = viewRoot.findViewById(R.id.llAccountActionBar)
|
2019-01-17 20:40:51 +01:00
|
|
|
val btnFollow : ImageButton = viewRoot.findViewById(R.id.btnFollow)
|
2019-01-09 19:40:27 +01:00
|
|
|
|
|
|
|
val btnMute : ImageView = viewRoot.findViewById(R.id.btnMute)
|
|
|
|
val btnBlock : ImageView = viewRoot.findViewById(R.id.btnBlock)
|
|
|
|
val btnProfile : View = viewRoot.findViewById(R.id.btnProfile)
|
|
|
|
val btnSendMessage : View = viewRoot.findViewById(R.id.btnSendMessage)
|
|
|
|
val btnAccountWebPage : View = viewRoot.findViewById(R.id.btnAccountWebPage)
|
|
|
|
val btnFollowRequestOK : View = viewRoot.findViewById(R.id.btnFollowRequestOK)
|
|
|
|
val btnFollowRequestNG : View = viewRoot.findViewById(R.id.btnFollowRequestNG)
|
|
|
|
val btnDeleteSuggestion : View = viewRoot.findViewById(R.id.btnDeleteSuggestion)
|
|
|
|
val btnFollowFromAnotherAccount : View =
|
|
|
|
viewRoot.findViewById(R.id.btnFollowFromAnotherAccount)
|
|
|
|
val btnSendMessageFromAnotherAccount : View =
|
|
|
|
viewRoot.findViewById(R.id.btnSendMessageFromAnotherAccount)
|
|
|
|
val btnOpenProfileFromAnotherAccount : View =
|
|
|
|
viewRoot.findViewById(R.id.btnOpenProfileFromAnotherAccount)
|
|
|
|
val btnDomainBlock : Button = viewRoot.findViewById(R.id.btnDomainBlock)
|
|
|
|
val btnInstanceInformation : Button = viewRoot.findViewById(R.id.btnInstanceInformation)
|
|
|
|
val ivFollowedBy : ImageView = viewRoot.findViewById(R.id.ivFollowedBy)
|
|
|
|
val btnOpenTimeline : Button = viewRoot.findViewById(R.id.btnOpenTimeline)
|
|
|
|
val btnConversationAnotherAccount : View =
|
|
|
|
viewRoot.findViewById(R.id.btnConversationAnotherAccount)
|
|
|
|
val btnAvatarImage : View = viewRoot.findViewById(R.id.btnAvatarImage)
|
|
|
|
|
|
|
|
val llNotification : View = viewRoot.findViewById(R.id.llNotification)
|
|
|
|
val btnNotificationDelete : View = viewRoot.findViewById(R.id.btnNotificationDelete)
|
|
|
|
val btnConversationMute : Button = viewRoot.findViewById(R.id.btnConversationMute)
|
|
|
|
|
|
|
|
val btnHideBoost : View = viewRoot.findViewById(R.id.btnHideBoost)
|
|
|
|
val btnShowBoost : View = viewRoot.findViewById(R.id.btnShowBoost)
|
|
|
|
val btnHideFavourite : View = viewRoot.findViewById(R.id.btnHideFavourite)
|
|
|
|
val btnShowFavourite : View = viewRoot.findViewById(R.id.btnShowFavourite)
|
|
|
|
|
|
|
|
val btnListMemberAddRemove : View = viewRoot.findViewById(R.id.btnListMemberAddRemove)
|
2018-10-01 02:10:16 +02:00
|
|
|
val btnEndorse : Button = viewRoot.findViewById(R.id.btnEndorse)
|
|
|
|
|
2019-01-09 19:40:27 +01:00
|
|
|
val btnAroundAccountTL : View = viewRoot.findViewById(R.id.btnAroundAccountTL)
|
|
|
|
val btnAroundLTL : View = viewRoot.findViewById(R.id.btnAroundLTL)
|
|
|
|
val btnAroundFTL : View = viewRoot.findViewById(R.id.btnAroundFTL)
|
|
|
|
val btnCopyAccountId : Button = viewRoot.findViewById(R.id.btnCopyAccountId)
|
2019-04-04 05:13:15 +02:00
|
|
|
val btnOpenAccountInAdminWebUi : Button =
|
|
|
|
viewRoot.findViewById(R.id.btnOpenAccountInAdminWebUi)
|
|
|
|
val btnOpenInstanceInAdminWebUi : Button =
|
|
|
|
viewRoot.findViewById(R.id.btnOpenInstanceInAdminWebUi)
|
|
|
|
val btnBoostWithVisibility : Button = viewRoot.findViewById(R.id.btnBoostWithVisibility)
|
2019-01-08 10:41:07 +01:00
|
|
|
val llLinks : LinearLayout = viewRoot.findViewById(R.id.llLinks)
|
|
|
|
|
2018-10-01 02:10:16 +02:00
|
|
|
btnAroundAccountTL.setOnClickListener(this)
|
|
|
|
btnAroundLTL.setOnClickListener(this)
|
|
|
|
btnAroundFTL.setOnClickListener(this)
|
2018-01-04 19:52:25 +01:00
|
|
|
|
|
|
|
btnStatusWebPage.setOnClickListener(this)
|
|
|
|
btnText.setOnClickListener(this)
|
|
|
|
btnFavouriteAnotherAccount.setOnClickListener(this)
|
|
|
|
btnBoostAnotherAccount.setOnClickListener(this)
|
2018-11-22 01:07:53 +01:00
|
|
|
btnReactionAnotherAccount.setOnClickListener(this)
|
2018-01-04 19:52:25 +01:00
|
|
|
btnReplyAnotherAccount.setOnClickListener(this)
|
2018-11-27 17:53:27 +01:00
|
|
|
btnQuotedRenote.setOnClickListener(this)
|
2018-01-04 19:52:25 +01:00
|
|
|
btnReport.setOnClickListener(this)
|
|
|
|
btnMuteApp.setOnClickListener(this)
|
|
|
|
btnDelete.setOnClickListener(this)
|
2018-06-23 04:43:18 +02:00
|
|
|
btnRedraft.setOnClickListener(this)
|
2018-01-04 19:52:25 +01:00
|
|
|
btnFollow.setOnClickListener(this)
|
|
|
|
btnMute.setOnClickListener(this)
|
|
|
|
btnBlock.setOnClickListener(this)
|
|
|
|
btnFollow.setOnLongClickListener(this)
|
|
|
|
btnProfile.setOnClickListener(this)
|
|
|
|
btnSendMessage.setOnClickListener(this)
|
|
|
|
btnAccountWebPage.setOnClickListener(this)
|
|
|
|
btnFollowRequestOK.setOnClickListener(this)
|
|
|
|
btnFollowRequestNG.setOnClickListener(this)
|
2018-07-16 20:19:19 +02:00
|
|
|
btnDeleteSuggestion.setOnClickListener(this)
|
2018-01-04 19:52:25 +01:00
|
|
|
btnFollowFromAnotherAccount.setOnClickListener(this)
|
|
|
|
btnSendMessageFromAnotherAccount.setOnClickListener(this)
|
|
|
|
btnOpenProfileFromAnotherAccount.setOnClickListener(this)
|
|
|
|
btnOpenTimeline.setOnClickListener(this)
|
|
|
|
btnConversationAnotherAccount.setOnClickListener(this)
|
|
|
|
btnAvatarImage.setOnClickListener(this)
|
|
|
|
btnNotificationDelete.setOnClickListener(this)
|
|
|
|
btnConversationMute.setOnClickListener(this)
|
|
|
|
btnHideBoost.setOnClickListener(this)
|
|
|
|
btnShowBoost.setOnClickListener(this)
|
2018-03-15 17:23:43 +01:00
|
|
|
btnHideFavourite.setOnClickListener(this)
|
|
|
|
btnShowFavourite.setOnClickListener(this)
|
2018-01-04 19:52:25 +01:00
|
|
|
btnListMemberAddRemove.setOnClickListener(this)
|
2018-01-10 16:47:35 +01:00
|
|
|
btnInstanceInformation.setOnClickListener(this)
|
|
|
|
btnDomainBlock.setOnClickListener(this)
|
2018-08-28 14:25:45 +02:00
|
|
|
btnEndorse.setOnClickListener(this)
|
2019-01-09 19:40:27 +01:00
|
|
|
btnCopyAccountId.setOnClickListener(this)
|
2019-01-11 07:16:47 +01:00
|
|
|
btnOpenAccountInAdminWebUi.setOnClickListener(this)
|
2019-01-11 10:47:30 +01:00
|
|
|
btnOpenInstanceInAdminWebUi.setOnClickListener(this)
|
2019-04-04 05:13:15 +02:00
|
|
|
btnBoostWithVisibility.setOnClickListener(this)
|
2018-01-04 19:52:25 +01:00
|
|
|
|
|
|
|
viewRoot.findViewById<View>(R.id.btnQuoteUrlStatus).setOnClickListener(this)
|
|
|
|
viewRoot.findViewById<View>(R.id.btnQuoteUrlAccount).setOnClickListener(this)
|
2018-08-17 06:12:36 +02:00
|
|
|
viewRoot.findViewById<View>(R.id.btnShareUrlStatus).setOnClickListener(this)
|
|
|
|
viewRoot.findViewById<View>(R.id.btnShareUrlAccount).setOnClickListener(this)
|
2018-01-04 19:52:25 +01:00
|
|
|
viewRoot.findViewById<View>(R.id.btnQuoteName).setOnClickListener(this)
|
|
|
|
|
|
|
|
val account_list = SavedAccount.loadAccountList(activity)
|
|
|
|
// final ArrayList< SavedAccount > account_list_non_pseudo_same_instance = new ArrayList<>();
|
|
|
|
|
|
|
|
val account_list_non_pseudo = ArrayList<SavedAccount>()
|
|
|
|
for(a in account_list) {
|
|
|
|
if(! a.isPseudo) {
|
|
|
|
account_list_non_pseudo.add(a)
|
|
|
|
// if( a.host.equalsIgnoreCase( access_info.host ) ){
|
|
|
|
// account_list_non_pseudo_same_instance.add( a );
|
|
|
|
// }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if(status == null) {
|
|
|
|
llStatus.visibility = View.GONE
|
2019-01-08 10:41:07 +01:00
|
|
|
llLinks.visibility = View.GONE
|
2018-01-04 19:52:25 +01:00
|
|
|
} else {
|
|
|
|
val status_by_me = access_info.isMe(status.account)
|
|
|
|
|
2019-01-09 19:40:27 +01:00
|
|
|
if(Pref.bpLinksInContextMenu(activity.pref) && contentTextView != null) {
|
|
|
|
|
2019-01-08 10:41:07 +01:00
|
|
|
var insPos = 0
|
2019-01-09 19:40:27 +01:00
|
|
|
|
|
|
|
fun addLinkButton(span : MyClickableSpan, caption : String) {
|
2019-01-08 10:41:07 +01:00
|
|
|
val b = Button(activity)
|
2019-01-09 19:40:27 +01:00
|
|
|
val lp = LinearLayout.LayoutParams(
|
|
|
|
ViewGroup.LayoutParams.MATCH_PARENT,
|
|
|
|
ViewGroup.LayoutParams.WRAP_CONTENT
|
|
|
|
)
|
2019-01-08 10:41:07 +01:00
|
|
|
b.layoutParams = lp
|
2019-01-20 22:04:57 +01:00
|
|
|
b.backgroundDrawable =
|
2019-01-09 19:40:27 +01:00
|
|
|
ContextCompat.getDrawable(activity, R.drawable.btn_bg_transparent)
|
2019-01-08 10:41:07 +01:00
|
|
|
b.gravity = Gravity.START or Gravity.CENTER_VERTICAL
|
2019-01-09 19:40:27 +01:00
|
|
|
b.minHeight = (activity.density * 32f + 0.5f).toInt()
|
|
|
|
b.minimumHeight = (activity.density * 32f + 0.5f).toInt()
|
|
|
|
val pad_lr = (activity.density * 8f + 0.5f).toInt()
|
|
|
|
val pad_tb = (activity.density * 4f + 0.5f).toInt()
|
|
|
|
b.setPaddingRelative(pad_lr, pad_tb, pad_lr, pad_tb)
|
2019-01-08 10:41:07 +01:00
|
|
|
b.text = caption
|
|
|
|
b.allCaps = false
|
2019-01-09 19:40:27 +01:00
|
|
|
b.setOnClickListener {
|
2019-01-19 03:36:40 +01:00
|
|
|
dialog.dismissSafe()
|
2019-01-08 10:41:07 +01:00
|
|
|
span.onClick(contentTextView)
|
|
|
|
}
|
2019-01-09 19:40:27 +01:00
|
|
|
llLinks.addView(b, insPos ++)
|
2019-01-08 10:41:07 +01:00
|
|
|
}
|
2019-01-09 19:40:27 +01:00
|
|
|
|
2019-01-08 10:41:07 +01:00
|
|
|
val dc = status.decoded_content
|
2019-01-09 19:40:27 +01:00
|
|
|
for(tag in dc.getSpans(0, dc.length, MyClickableSpan::class.java)) {
|
2019-01-08 10:41:07 +01:00
|
|
|
val start = dc.getSpanStart(tag)
|
|
|
|
val end = dc.getSpanEnd(tag)
|
2019-01-09 19:40:27 +01:00
|
|
|
val href = tag?.url ?: continue
|
|
|
|
val caption = dc.substring(start, end)
|
2019-01-08 10:41:07 +01:00
|
|
|
val head = caption[0]
|
2019-01-09 19:40:27 +01:00
|
|
|
if(head == '@' || head == '#')
|
2019-01-08 10:41:07 +01:00
|
|
|
addLinkButton(tag, caption)
|
|
|
|
else
|
|
|
|
addLinkButton(tag, href)
|
|
|
|
}
|
|
|
|
}
|
2019-01-09 19:40:27 +01:00
|
|
|
vg(llLinks, llLinks.childCount > 1)
|
2019-01-08 10:41:07 +01:00
|
|
|
|
2018-01-04 19:52:25 +01:00
|
|
|
btnDelete.visibility = if(status_by_me) View.VISIBLE else View.GONE
|
2018-06-23 04:43:18 +02:00
|
|
|
btnRedraft.visibility = if(status_by_me) View.VISIBLE else View.GONE
|
2018-01-04 19:52:25 +01:00
|
|
|
|
2019-04-04 05:13:15 +02:00
|
|
|
vg(btnBoostWithVisibility, ! access_info.isPseudo && ! access_info.isMisskey)
|
|
|
|
|
2018-05-08 10:25:02 +02:00
|
|
|
btnReport.visibility =
|
|
|
|
if(status_by_me || access_info.isPseudo) View.GONE else View.VISIBLE
|
2018-01-04 19:52:25 +01:00
|
|
|
|
|
|
|
val application_name = status.application?.name
|
2018-05-08 10:25:02 +02:00
|
|
|
if(status_by_me || application_name == null || application_name.isEmpty()) {
|
2018-01-04 19:52:25 +01:00
|
|
|
btnMuteApp.visibility = View.GONE
|
|
|
|
} else {
|
2018-05-08 10:25:02 +02:00
|
|
|
btnMuteApp.text = activity.getString(R.string.mute_app_of, application_name)
|
2018-01-04 19:52:25 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
val btnBoostedBy = viewRoot.findViewById<View>(R.id.btnBoostedBy)
|
|
|
|
val btnFavouritedBy = viewRoot.findViewById<View>(R.id.btnFavouritedBy)
|
|
|
|
btnBoostedBy.setOnClickListener(this)
|
|
|
|
btnFavouritedBy.setOnClickListener(this)
|
|
|
|
val isNA = access_info.isNA
|
|
|
|
btnBoostedBy.visibility = if(isNA) View.GONE else View.VISIBLE
|
|
|
|
btnFavouritedBy.visibility = if(isNA) View.GONE else View.VISIBLE
|
|
|
|
|
|
|
|
val btnProfilePin = viewRoot.findViewById<View>(R.id.btnProfilePin)
|
|
|
|
val btnProfileUnpin = viewRoot.findViewById<View>(R.id.btnProfileUnpin)
|
|
|
|
btnProfilePin.setOnClickListener(this)
|
|
|
|
btnProfileUnpin.setOnClickListener(this)
|
|
|
|
val canPin = status.canPin(access_info)
|
|
|
|
btnProfileUnpin.visibility = if(canPin && status.pinned) View.VISIBLE else View.GONE
|
|
|
|
btnProfilePin.visibility = if(canPin && ! status.pinned) View.VISIBLE else View.GONE
|
|
|
|
}
|
2018-11-18 03:38:52 +01:00
|
|
|
|
2018-01-04 19:52:25 +01:00
|
|
|
var bShowConversationMute = false
|
|
|
|
if(status != null) {
|
2018-05-08 10:25:02 +02:00
|
|
|
if(access_info.isMe(status.account)) {
|
2018-01-04 19:52:25 +01:00
|
|
|
bShowConversationMute = true
|
|
|
|
} else if(notification != null && TootNotification.TYPE_MENTION == notification.type) {
|
|
|
|
bShowConversationMute = true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if(! bShowConversationMute) {
|
|
|
|
btnConversationMute.visibility = View.GONE
|
|
|
|
} else {
|
2018-05-08 10:25:02 +02:00
|
|
|
val muted = status?.muted ?: false
|
2018-01-04 19:52:25 +01:00
|
|
|
btnConversationMute.setText(if(muted) R.string.unmute_this_conversation else R.string.mute_this_conversation)
|
|
|
|
}
|
|
|
|
|
|
|
|
llNotification.visibility = if(notification == null) View.GONE else View.VISIBLE
|
|
|
|
|
|
|
|
if(access_info.isPseudo) {
|
|
|
|
llAccountActionBar.visibility = View.GONE
|
|
|
|
} else {
|
|
|
|
|
|
|
|
// 被フォロー状態
|
2019-01-17 20:40:51 +01:00
|
|
|
// Styler.setFollowIconとは異なり細かい状態を表示しない
|
|
|
|
vg(ivFollowedBy, relation.followed_by)
|
2019-04-04 05:13:15 +02:00
|
|
|
|
2019-01-17 20:40:51 +01:00
|
|
|
// フォロー状態
|
|
|
|
// Styler.setFollowIconとは異なりミュートやブロックを表示しない
|
2019-04-04 05:13:15 +02:00
|
|
|
btnFollow.setImageResource(
|
2019-01-17 20:40:51 +01:00
|
|
|
when {
|
2019-04-04 05:13:15 +02:00
|
|
|
relation.getRequested(who) -> R.drawable.ic_follow_wait
|
|
|
|
relation.getFollowing(who) -> R.drawable.ic_follow_cross
|
|
|
|
else -> R.drawable.ic_follow_plus
|
2019-01-17 20:40:51 +01:00
|
|
|
}
|
2019-04-04 05:13:15 +02:00
|
|
|
)
|
|
|
|
btnFollow.imageTintList = ColorStateList.valueOf(
|
|
|
|
getAttributeColor(
|
|
|
|
activity,
|
|
|
|
when {
|
|
|
|
relation.getRequested(who) -> R.attr.colorRegexFilterError
|
|
|
|
relation.getFollowing(who) -> R.attr.colorImageButtonAccent
|
|
|
|
else -> R.attr.colorImageButton
|
|
|
|
}
|
|
|
|
)
|
|
|
|
)
|
2018-01-04 19:52:25 +01:00
|
|
|
|
2019-01-17 20:40:51 +01:00
|
|
|
// ミュート状態
|
2019-04-04 05:13:15 +02:00
|
|
|
btnMute.imageTintList = ColorStateList.valueOf(
|
|
|
|
getAttributeColor(
|
|
|
|
activity,
|
|
|
|
when(relation.muting) {
|
|
|
|
true -> R.attr.colorImageButtonAccent
|
|
|
|
else -> R.attr.colorImageButton
|
|
|
|
}
|
|
|
|
)
|
|
|
|
)
|
2018-01-04 19:52:25 +01:00
|
|
|
|
2019-01-17 20:40:51 +01:00
|
|
|
// ブロック状態
|
2019-04-04 05:13:15 +02:00
|
|
|
btnBlock.imageTintList = ColorStateList.valueOf(
|
|
|
|
getAttributeColor(
|
|
|
|
activity,
|
|
|
|
when(relation.blocking) {
|
|
|
|
true -> R.attr.colorImageButtonAccent
|
|
|
|
else -> R.attr.colorImageButton
|
|
|
|
}
|
|
|
|
)
|
|
|
|
)
|
2018-01-04 19:52:25 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if(who == null) {
|
|
|
|
btnInstanceInformation.visibility = View.GONE
|
|
|
|
btnDomainBlock.visibility = View.GONE
|
2019-01-09 19:40:27 +01:00
|
|
|
btnCopyAccountId.visibility = View.GONE
|
2019-01-11 07:16:47 +01:00
|
|
|
btnOpenAccountInAdminWebUi.visibility = View.GONE
|
2019-01-11 10:47:30 +01:00
|
|
|
btnOpenInstanceInAdminWebUi.visibility = View.GONE
|
2018-01-04 19:52:25 +01:00
|
|
|
} else {
|
2018-01-10 16:47:35 +01:00
|
|
|
val who_host = who.host
|
2018-01-04 19:52:25 +01:00
|
|
|
btnInstanceInformation.visibility = View.VISIBLE
|
2018-05-08 10:25:02 +02:00
|
|
|
btnInstanceInformation.text =
|
|
|
|
activity.getString(R.string.instance_information_of, who_host)
|
|
|
|
if(access_info.isPseudo || access_info.host.equals(who_host, ignoreCase = true)) {
|
2018-01-04 19:52:25 +01:00
|
|
|
// 疑似アカウントではドメインブロックできない
|
|
|
|
// 自ドメインはブロックできない
|
|
|
|
btnDomainBlock.visibility = View.GONE
|
|
|
|
} else {
|
2018-01-10 16:47:35 +01:00
|
|
|
btnDomainBlock.visibility = View.VISIBLE
|
|
|
|
btnDomainBlock.text = activity.getString(R.string.block_domain_that, who_host)
|
2018-01-04 19:52:25 +01:00
|
|
|
}
|
2019-01-09 19:40:27 +01:00
|
|
|
|
|
|
|
btnCopyAccountId.visibility = View.VISIBLE
|
2019-04-04 05:13:15 +02:00
|
|
|
btnCopyAccountId.text = activity.getString(R.string.copy_account_id, who.id.toString())
|
2019-01-11 07:16:47 +01:00
|
|
|
|
2019-04-04 05:13:15 +02:00
|
|
|
vg(btnOpenAccountInAdminWebUi, ! access_info.isPseudo)
|
|
|
|
vg(btnOpenInstanceInAdminWebUi, ! access_info.isPseudo)
|
2018-01-04 19:52:25 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
viewRoot.findViewById<View>(R.id.btnAccountText).setOnClickListener(this)
|
|
|
|
|
|
|
|
if(access_info.isPseudo) {
|
|
|
|
btnProfile.visibility = View.GONE
|
|
|
|
btnSendMessage.visibility = View.GONE
|
2018-08-28 14:25:45 +02:00
|
|
|
btnEndorse.visibility = View.GONE
|
|
|
|
}
|
|
|
|
|
2018-10-01 02:10:16 +02:00
|
|
|
btnEndorse.text = when(relation.endorsed) {
|
2018-08-28 14:25:45 +02:00
|
|
|
false -> activity.getString(R.string.endorse_set)
|
2018-10-01 02:10:16 +02:00
|
|
|
else -> activity.getString(R.string.endorse_unset)
|
2018-01-04 19:52:25 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if(column_type != Column.TYPE_FOLLOW_REQUESTS) {
|
|
|
|
btnFollowRequestOK.visibility = View.GONE
|
|
|
|
btnFollowRequestNG.visibility = View.GONE
|
|
|
|
}
|
|
|
|
|
2018-08-20 02:07:55 +02:00
|
|
|
if(column_type != Column.TYPE_FOLLOW_SUGGESTION) {
|
2018-07-16 20:19:19 +02:00
|
|
|
btnDeleteSuggestion.visibility = View.GONE
|
|
|
|
}
|
|
|
|
|
2018-01-04 19:52:25 +01:00
|
|
|
if(account_list_non_pseudo.isEmpty()) {
|
|
|
|
btnFollowFromAnotherAccount.visibility = View.GONE
|
|
|
|
btnSendMessageFromAnotherAccount.visibility = View.GONE
|
|
|
|
}
|
|
|
|
|
|
|
|
viewRoot.findViewById<View>(R.id.btnNickname).setOnClickListener(this)
|
|
|
|
viewRoot.findViewById<View>(R.id.btnCancel).setOnClickListener(this)
|
|
|
|
viewRoot.findViewById<View>(R.id.btnAccountQrCode).setOnClickListener(this)
|
|
|
|
|
|
|
|
if(access_info.isPseudo
|
|
|
|
|| who == null
|
|
|
|
|| ! relation.getFollowing(who)
|
|
|
|
|| relation.following_reblogs == UserRelation.REBLOG_UNKNOWN) {
|
|
|
|
btnHideBoost.visibility = View.GONE
|
|
|
|
btnShowBoost.visibility = View.GONE
|
|
|
|
} else if(relation.following_reblogs == UserRelation.REBLOG_SHOW) {
|
|
|
|
btnHideBoost.visibility = View.VISIBLE
|
|
|
|
btnShowBoost.visibility = View.GONE
|
|
|
|
} else {
|
|
|
|
btnHideBoost.visibility = View.GONE
|
|
|
|
btnShowBoost.visibility = View.VISIBLE
|
|
|
|
}
|
|
|
|
|
2018-05-08 10:25:02 +02:00
|
|
|
when {
|
|
|
|
who == null -> {
|
|
|
|
btnHideFavourite.visibility = View.GONE
|
|
|
|
btnShowFavourite.visibility = View.GONE
|
|
|
|
}
|
2018-08-20 02:07:55 +02:00
|
|
|
|
2018-05-08 10:25:02 +02:00
|
|
|
FavMute.contains(access_info.getFullAcct(who)) -> {
|
|
|
|
btnHideFavourite.visibility = View.GONE
|
|
|
|
btnShowFavourite.visibility = View.VISIBLE
|
|
|
|
}
|
2018-08-20 02:07:55 +02:00
|
|
|
|
2018-05-08 10:25:02 +02:00
|
|
|
else -> {
|
|
|
|
btnHideFavourite.visibility = View.VISIBLE
|
|
|
|
btnShowFavourite.visibility = View.GONE
|
|
|
|
}
|
2018-03-15 17:23:43 +01:00
|
|
|
}
|
|
|
|
|
2018-01-10 16:47:35 +01:00
|
|
|
val who_host = who?.host
|
2018-05-08 10:25:02 +02:00
|
|
|
if(who_host == null || who_host.isEmpty() || who_host == "?") {
|
2018-01-04 19:52:25 +01:00
|
|
|
btnOpenTimeline.visibility = View.GONE
|
|
|
|
} else {
|
2018-01-10 16:47:35 +01:00
|
|
|
btnOpenTimeline.text = activity.getString(R.string.open_local_timeline_for, who_host)
|
2018-01-04 19:52:25 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
btnListMemberAddRemove.visibility = View.VISIBLE
|
|
|
|
}
|
|
|
|
|
|
|
|
fun show() {
|
|
|
|
val window = dialog.window
|
2018-05-08 10:25:02 +02:00
|
|
|
if(window != null) {
|
2018-01-04 19:52:25 +01:00
|
|
|
val lp = window.attributes
|
|
|
|
lp.width = (0.5f + 280f * activity.density).toInt()
|
|
|
|
lp.height = WindowManager.LayoutParams.WRAP_CONTENT
|
|
|
|
window.attributes = lp
|
|
|
|
}
|
|
|
|
dialog.show()
|
|
|
|
}
|
|
|
|
|
|
|
|
override fun onClick(v : View) {
|
2019-01-19 03:36:40 +01:00
|
|
|
dialog.dismissSafe()
|
2018-01-04 19:52:25 +01:00
|
|
|
|
|
|
|
val pos = activity.nextPosition(column)
|
|
|
|
|
2018-05-08 10:25:02 +02:00
|
|
|
val whoRef = this.whoRef
|
2018-05-18 19:08:46 +02:00
|
|
|
val who = whoRef?.get()
|
2018-05-08 10:25:02 +02:00
|
|
|
|
|
|
|
if(whoRef != null && who != null) {
|
|
|
|
when(v.id) {
|
|
|
|
R.id.btnReport -> if(status is TootStatus) {
|
|
|
|
Action_User.reportForm(activity, access_info, who, status)
|
|
|
|
}
|
|
|
|
|
|
|
|
R.id.btnFollow ->
|
2018-08-28 18:24:36 +02:00
|
|
|
when {
|
2018-10-01 02:10:16 +02:00
|
|
|
|
|
|
|
access_info.isPseudo -> Action_Follow.followFromAnotherAccount(
|
|
|
|
activity,
|
|
|
|
pos,
|
|
|
|
access_info,
|
|
|
|
who
|
|
|
|
)
|
|
|
|
|
|
|
|
access_info.isMisskey && relation.getRequested(who) && ! relation.getFollowing(
|
|
|
|
who
|
|
|
|
) -> Action_Follow.deleteFollowRequest(
|
2018-05-08 10:25:02 +02:00
|
|
|
activity, pos, access_info, whoRef,
|
2018-08-28 18:24:36 +02:00
|
|
|
callback = activity.cancel_follow_request_complete_callback
|
2018-05-08 10:25:02 +02:00
|
|
|
)
|
2018-10-01 02:10:16 +02:00
|
|
|
|
2018-08-28 18:24:36 +02:00
|
|
|
else -> {
|
2018-10-01 02:10:16 +02:00
|
|
|
val bSet = ! (relation.getRequested(who) || relation.getFollowing(who))
|
2018-08-28 18:24:36 +02:00
|
|
|
Action_Follow.follow(
|
|
|
|
activity, pos, access_info, whoRef,
|
|
|
|
bFollow = bSet,
|
|
|
|
callback = when(bSet) {
|
|
|
|
true -> activity.follow_complete_callback
|
|
|
|
else -> activity.unfollow_complete_callback
|
|
|
|
}
|
|
|
|
)
|
|
|
|
}
|
2018-05-08 10:25:02 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
R.id.btnAccountText ->
|
|
|
|
ActText.open(activity, ActMain.REQUEST_CODE_TEXT, access_info, who)
|
|
|
|
|
|
|
|
R.id.btnMute ->
|
2018-10-01 02:10:16 +02:00
|
|
|
when {
|
|
|
|
|
2018-05-08 10:25:02 +02:00
|
|
|
//解除
|
2018-10-01 02:10:16 +02:00
|
|
|
relation.muting ->
|
|
|
|
Action_User.mute(
|
|
|
|
activity,
|
|
|
|
access_info,
|
|
|
|
who,
|
|
|
|
bMute = false
|
|
|
|
)
|
2018-08-24 18:56:04 +02:00
|
|
|
|
2018-10-01 02:10:16 +02:00
|
|
|
access_info.isMisskey -> {
|
|
|
|
// Misskey には「このユーザからの通知もミュート」オプションはない
|
|
|
|
|
|
|
|
@SuppressLint("InflateParams")
|
|
|
|
val view =
|
|
|
|
activity.layoutInflater.inflate(R.layout.dlg_confirm, null, false)
|
|
|
|
val tvMessage = view.findViewById<TextView>(R.id.tvMessage)
|
|
|
|
tvMessage.text =
|
|
|
|
activity.getString(R.string.confirm_mute_user, who.username)
|
|
|
|
val cbMuteNotification = view.findViewById<CheckBox>(R.id.cbSkipNext)
|
|
|
|
cbMuteNotification.visibility = View.GONE
|
|
|
|
AlertDialog.Builder(activity)
|
|
|
|
.setView(view)
|
|
|
|
.setNegativeButton(R.string.cancel, null)
|
|
|
|
.setPositiveButton(R.string.ok) { _, _ ->
|
|
|
|
Action_User.mute(
|
|
|
|
activity,
|
|
|
|
access_info,
|
|
|
|
who
|
|
|
|
)
|
|
|
|
}
|
|
|
|
.show()
|
|
|
|
}
|
2018-08-24 18:56:04 +02:00
|
|
|
|
2018-10-01 02:10:16 +02:00
|
|
|
else -> {
|
|
|
|
|
|
|
|
@SuppressLint("InflateParams")
|
|
|
|
val view =
|
|
|
|
activity.layoutInflater.inflate(R.layout.dlg_confirm, null, false)
|
|
|
|
val tvMessage = view.findViewById<TextView>(R.id.tvMessage)
|
|
|
|
tvMessage.text =
|
|
|
|
activity.getString(R.string.confirm_mute_user, who.username)
|
|
|
|
val cbMuteNotification = view.findViewById<CheckBox>(R.id.cbSkipNext)
|
|
|
|
cbMuteNotification.setText(R.string.confirm_mute_notification_for_user)
|
|
|
|
cbMuteNotification.isChecked = true
|
|
|
|
// オプション指定つきでミュート
|
|
|
|
AlertDialog.Builder(activity)
|
|
|
|
.setView(view)
|
|
|
|
.setNegativeButton(R.string.cancel, null)
|
|
|
|
.setPositiveButton(R.string.ok) { _, _ ->
|
|
|
|
Action_User.mute(
|
|
|
|
activity,
|
|
|
|
access_info,
|
|
|
|
who,
|
|
|
|
bMuteNotification = cbMuteNotification.isChecked
|
|
|
|
)
|
|
|
|
}
|
|
|
|
.show()
|
|
|
|
}
|
2018-05-08 10:25:02 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
R.id.btnBlock ->
|
|
|
|
if(relation.blocking) {
|
2018-10-30 20:29:00 +01:00
|
|
|
Action_User.block(
|
|
|
|
activity,
|
|
|
|
access_info,
|
|
|
|
who,
|
|
|
|
false
|
|
|
|
)
|
2018-05-08 10:25:02 +02:00
|
|
|
} else {
|
|
|
|
AlertDialog.Builder(activity)
|
|
|
|
.setMessage(
|
|
|
|
activity.getString(
|
|
|
|
R.string.confirm_block_user,
|
|
|
|
who.username
|
|
|
|
)
|
|
|
|
)
|
|
|
|
.setNegativeButton(R.string.cancel, null)
|
|
|
|
.setPositiveButton(R.string.ok) { _, _ ->
|
|
|
|
Action_User.block(
|
|
|
|
activity,
|
|
|
|
access_info,
|
|
|
|
who,
|
|
|
|
true
|
|
|
|
)
|
|
|
|
}
|
|
|
|
.show()
|
|
|
|
}
|
|
|
|
|
|
|
|
R.id.btnProfile ->
|
|
|
|
Action_User.profileLocal(activity, pos, access_info, who)
|
|
|
|
|
|
|
|
R.id.btnSendMessage ->
|
|
|
|
Action_User.mention(activity, access_info, who)
|
|
|
|
|
|
|
|
R.id.btnAccountWebPage -> who.url?.let { url ->
|
|
|
|
App1.openCustomTab(activity, url)
|
|
|
|
}
|
|
|
|
|
|
|
|
R.id.btnFollowRequestOK ->
|
|
|
|
Action_Follow.authorizeFollowRequest(activity, access_info, whoRef, true)
|
|
|
|
|
2018-07-16 20:19:19 +02:00
|
|
|
R.id.btnDeleteSuggestion ->
|
|
|
|
Action_User.deleteSuggestion(activity, access_info, who)
|
|
|
|
|
2018-05-08 10:25:02 +02:00
|
|
|
R.id.btnFollowRequestNG ->
|
|
|
|
Action_Follow.authorizeFollowRequest(activity, access_info, whoRef, false)
|
|
|
|
|
|
|
|
R.id.btnFollowFromAnotherAccount ->
|
|
|
|
Action_Follow.followFromAnotherAccount(activity, pos, access_info, who)
|
|
|
|
|
|
|
|
R.id.btnSendMessageFromAnotherAccount ->
|
|
|
|
Action_User.mentionFromAnotherAccount(activity, access_info, who)
|
|
|
|
|
|
|
|
R.id.btnOpenProfileFromAnotherAccount ->
|
|
|
|
Action_User.profileFromAnotherAccount(activity, pos, access_info, who)
|
|
|
|
|
|
|
|
R.id.btnNickname ->
|
|
|
|
ActNickname.open(
|
|
|
|
activity,
|
|
|
|
access_info.getFullAcct(who),
|
|
|
|
true,
|
|
|
|
ActMain.REQUEST_CODE_NICKNAME
|
|
|
|
)
|
|
|
|
|
|
|
|
R.id.btnAccountQrCode ->
|
|
|
|
DlgQRCode.open(
|
|
|
|
activity,
|
|
|
|
whoRef.decoded_display_name,
|
|
|
|
access_info.getUserUrl(who.acct)
|
|
|
|
)
|
|
|
|
|
|
|
|
R.id.btnDomainBlock ->
|
|
|
|
if(access_info.isPseudo) {
|
|
|
|
// 疑似アカウントではドメインブロックできない
|
|
|
|
showToast(activity, false, R.string.domain_block_from_pseudo)
|
|
|
|
return
|
|
|
|
} else {
|
|
|
|
val who_host = who.host
|
|
|
|
|
|
|
|
// 自分のドメインではブロックできない
|
|
|
|
if(access_info.host.equals(who_host, ignoreCase = true)) {
|
|
|
|
showToast(activity, false, R.string.domain_block_from_local)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
AlertDialog.Builder(activity)
|
|
|
|
.setMessage(activity.getString(R.string.confirm_block_domain, who_host))
|
|
|
|
.setNegativeButton(R.string.cancel, null)
|
|
|
|
.setPositiveButton(R.string.ok) { _, _ ->
|
|
|
|
Action_Instance.blockDomain(activity, access_info, who_host, true)
|
|
|
|
}
|
|
|
|
.show()
|
|
|
|
}
|
|
|
|
|
|
|
|
R.id.btnOpenTimeline -> {
|
|
|
|
val who_host = who.host
|
|
|
|
if(who_host.isEmpty() || who_host == "?") {
|
|
|
|
// 何もしない
|
|
|
|
} else {
|
|
|
|
Action_Instance.timelineLocal(activity, pos, who_host)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
R.id.btnAvatarImage -> {
|
|
|
|
val url = if(! who.avatar.isNullOrEmpty()) who.avatar else who.avatar_static
|
|
|
|
if(url != null && url.isNotEmpty()) App1.openCustomTab(activity, url)
|
|
|
|
// XXX: 設定によっては内蔵メディアビューアで開けないか?
|
|
|
|
}
|
|
|
|
|
|
|
|
R.id.btnQuoteName -> {
|
|
|
|
var sv = who.display_name
|
|
|
|
try {
|
|
|
|
val fmt = Pref.spQuoteNameFormat(activity.pref)
|
|
|
|
if(fmt.contains("%1\$s")) {
|
|
|
|
sv = String.format(fmt, sv)
|
|
|
|
}
|
|
|
|
} catch(ex : Throwable) {
|
|
|
|
log.trace(ex)
|
|
|
|
}
|
|
|
|
|
|
|
|
Action_Account.openPost(activity, sv)
|
|
|
|
}
|
|
|
|
|
|
|
|
R.id.btnHideBoost ->
|
|
|
|
Action_User.showBoosts(activity, access_info, who, false)
|
|
|
|
|
|
|
|
R.id.btnShowBoost ->
|
|
|
|
Action_User.showBoosts(activity, access_info, who, true)
|
|
|
|
|
|
|
|
R.id.btnHideFavourite -> {
|
|
|
|
val acct = access_info.getFullAcct(who)
|
|
|
|
FavMute.save(acct)
|
|
|
|
showToast(activity, false, R.string.changed)
|
|
|
|
for(column in activity.app_state.column_list) {
|
|
|
|
column.onHideFavouriteNotification(acct)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
R.id.btnShowFavourite -> {
|
|
|
|
FavMute.delete(access_info.getFullAcct(who))
|
|
|
|
showToast(activity, false, R.string.changed)
|
|
|
|
}
|
|
|
|
|
|
|
|
R.id.btnListMemberAddRemove ->
|
|
|
|
DlgListMember(activity, who, access_info).show()
|
|
|
|
|
|
|
|
R.id.btnInstanceInformation ->
|
|
|
|
Action_Instance.information(activity, pos, who.host)
|
|
|
|
|
2018-10-01 02:10:16 +02:00
|
|
|
R.id.btnEndorse -> Action_Account.endorse(
|
|
|
|
activity,
|
|
|
|
access_info,
|
|
|
|
who,
|
|
|
|
! relation.endorsed
|
|
|
|
)
|
|
|
|
|
|
|
|
R.id.btnAroundAccountTL -> Action_Instance.timelinePublicAround(
|
|
|
|
activity,
|
|
|
|
access_info,
|
|
|
|
pos,
|
|
|
|
who.host,
|
|
|
|
status,
|
|
|
|
Column.TYPE_ACCOUNT_AROUND
|
2018-11-18 03:38:52 +01:00
|
|
|
, allowPseudo = false
|
2018-10-01 02:10:16 +02:00
|
|
|
)
|
2018-11-18 03:38:52 +01:00
|
|
|
|
2018-10-01 02:10:16 +02:00
|
|
|
R.id.btnAroundLTL -> Action_Instance.timelinePublicAround(
|
|
|
|
activity,
|
|
|
|
access_info,
|
|
|
|
pos,
|
|
|
|
who.host,
|
|
|
|
status,
|
|
|
|
Column.TYPE_LOCAL_AROUND
|
|
|
|
)
|
2018-11-18 03:38:52 +01:00
|
|
|
|
2018-10-01 02:10:16 +02:00
|
|
|
R.id.btnAroundFTL -> Action_Instance.timelinePublicAround(
|
|
|
|
activity,
|
|
|
|
access_info,
|
|
|
|
pos,
|
|
|
|
who.host,
|
|
|
|
status,
|
|
|
|
Column.TYPE_FEDERATED_AROUND
|
|
|
|
)
|
|
|
|
|
2019-01-09 19:40:27 +01:00
|
|
|
R.id.btnCopyAccountId -> who.id.toString().copyToClipboard(activity)
|
2019-01-11 07:16:47 +01:00
|
|
|
|
2019-01-11 10:47:30 +01:00
|
|
|
R.id.btnOpenAccountInAdminWebUi ->
|
2019-04-04 05:13:15 +02:00
|
|
|
App1.openBrowser(
|
|
|
|
activity,
|
|
|
|
"https://${access_info.host}/admin/accounts/${who.id}"
|
|
|
|
)
|
|
|
|
|
2019-01-11 10:47:30 +01:00
|
|
|
R.id.btnOpenInstanceInAdminWebUi ->
|
2019-04-04 05:13:15 +02:00
|
|
|
App1.openBrowser(
|
|
|
|
activity,
|
|
|
|
"https://${access_info.host}/admin/instances/${who.host}"
|
|
|
|
)
|
|
|
|
|
|
|
|
R.id.btnBoostWithVisibility -> {
|
|
|
|
val status = this.status ?: return
|
|
|
|
val list = if(access_info.isMisskey) {
|
|
|
|
arrayOf(
|
|
|
|
TootVisibility.Public,
|
|
|
|
TootVisibility.UnlistedHome,
|
|
|
|
TootVisibility.PrivateFollowers,
|
|
|
|
TootVisibility.LocalPublic,
|
|
|
|
TootVisibility.LocalHome,
|
|
|
|
TootVisibility.LocalFollowers,
|
|
|
|
TootVisibility.DirectSpecified,
|
|
|
|
TootVisibility.DirectPrivate
|
|
|
|
)
|
|
|
|
} else {
|
|
|
|
arrayOf(
|
|
|
|
TootVisibility.Public,
|
|
|
|
TootVisibility.UnlistedHome,
|
|
|
|
TootVisibility.PrivateFollowers
|
|
|
|
)
|
|
|
|
}
|
|
|
|
val caption_list = list
|
|
|
|
.map { Styler.getVisibilityCaption(activity, access_info.isMisskey, it) }
|
|
|
|
.toTypedArray()
|
|
|
|
|
|
|
|
AlertDialog.Builder(activity)
|
|
|
|
.setTitle(R.string.choose_visibility)
|
|
|
|
.setItems(caption_list) { _, which ->
|
|
|
|
if(which in 0 until list.size) {
|
|
|
|
Action_Toot.boost(
|
|
|
|
activity,
|
|
|
|
access_info,
|
|
|
|
status,
|
|
|
|
access_info.getFullAcct(status.account),
|
|
|
|
NOT_CROSS_ACCOUNT,
|
|
|
|
activity.boost_complete_callback,
|
|
|
|
visibility = list[which]
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
.setNegativeButton(R.string.cancel, null)
|
|
|
|
.show()
|
|
|
|
}
|
2018-05-08 10:25:02 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-01-04 19:52:25 +01:00
|
|
|
when(v.id) {
|
|
|
|
|
|
|
|
R.id.btnStatusWebPage -> status?.url?.let { url ->
|
|
|
|
App1.openCustomTab(activity, url)
|
|
|
|
}
|
|
|
|
|
|
|
|
R.id.btnText -> if(status != null) {
|
|
|
|
ActText.open(activity, ActMain.REQUEST_CODE_TEXT, access_info, status)
|
|
|
|
}
|
|
|
|
|
2018-05-08 10:25:02 +02:00
|
|
|
R.id.btnFavouriteAnotherAccount -> Action_Toot.favouriteFromAnotherAccount(
|
|
|
|
activity,
|
|
|
|
access_info,
|
|
|
|
status
|
|
|
|
)
|
2018-01-04 19:52:25 +01:00
|
|
|
|
2018-05-08 10:25:02 +02:00
|
|
|
R.id.btnBoostAnotherAccount -> Action_Toot.boostFromAnotherAccount(
|
|
|
|
activity,
|
|
|
|
access_info,
|
|
|
|
status
|
|
|
|
)
|
2018-11-22 01:07:53 +01:00
|
|
|
R.id.btnReactionAnotherAccount -> Action_Toot.reactionFromAnotherAccount(
|
|
|
|
activity,
|
|
|
|
access_info,
|
|
|
|
status
|
|
|
|
)
|
|
|
|
|
2018-05-08 10:25:02 +02:00
|
|
|
R.id.btnReplyAnotherAccount -> Action_Toot.replyFromAnotherAccount(
|
|
|
|
activity,
|
|
|
|
access_info,
|
|
|
|
status
|
|
|
|
)
|
2018-12-01 00:02:18 +01:00
|
|
|
R.id.btnQuotedRenote -> Action_Toot.replyFromAnotherAccount(
|
2018-11-27 17:53:27 +01:00
|
|
|
activity,
|
|
|
|
access_info,
|
|
|
|
status,
|
|
|
|
quotedRenote = true
|
|
|
|
)
|
2018-05-08 10:25:02 +02:00
|
|
|
R.id.btnConversationAnotherAccount -> status?.let { status ->
|
2018-01-04 19:52:25 +01:00
|
|
|
Action_Toot.conversationOtherInstance(activity, pos, status)
|
|
|
|
}
|
|
|
|
|
2018-05-08 10:25:02 +02:00
|
|
|
R.id.btnDelete -> status?.let { status ->
|
2018-01-04 19:52:25 +01:00
|
|
|
AlertDialog.Builder(activity)
|
|
|
|
.setMessage(activity.getString(R.string.confirm_delete_status))
|
|
|
|
.setNegativeButton(R.string.cancel, null)
|
2018-05-08 10:25:02 +02:00
|
|
|
.setPositiveButton(R.string.ok) { _, _ ->
|
|
|
|
Action_Toot.delete(
|
|
|
|
activity,
|
|
|
|
access_info,
|
|
|
|
status.id
|
|
|
|
)
|
|
|
|
}
|
2018-01-04 19:52:25 +01:00
|
|
|
.show()
|
|
|
|
}
|
2018-08-20 02:07:55 +02:00
|
|
|
R.id.btnRedraft -> status?.let { status ->
|
|
|
|
Action_Toot.redraft(activity, access_info, status)
|
2018-06-23 04:43:18 +02:00
|
|
|
}
|
2018-01-04 19:52:25 +01:00
|
|
|
|
|
|
|
R.id.btnMuteApp -> status?.application?.let {
|
|
|
|
Action_App.muteApp(activity, it)
|
|
|
|
}
|
|
|
|
|
|
|
|
R.id.btnBoostedBy -> status?.let {
|
2018-05-08 10:25:02 +02:00
|
|
|
activity.addColumn(false, pos, access_info, Column.TYPE_BOOSTED_BY, it.id)
|
2018-01-04 19:52:25 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
R.id.btnFavouritedBy -> status?.let {
|
2018-05-08 10:25:02 +02:00
|
|
|
activity.addColumn(false, pos, access_info, Column.TYPE_FAVOURITED_BY, it.id)
|
2018-01-04 19:52:25 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
R.id.btnCancel -> dialog.cancel()
|
|
|
|
|
|
|
|
R.id.btnQuoteUrlStatus -> status?.url?.let { url ->
|
|
|
|
if(url.isNotEmpty()) Action_Account.openPost(activity, url)
|
|
|
|
}
|
|
|
|
|
|
|
|
R.id.btnQuoteUrlAccount -> who?.url?.let { url ->
|
|
|
|
if(url.isNotEmpty()) Action_Account.openPost(activity, url)
|
|
|
|
}
|
2018-08-17 06:12:36 +02:00
|
|
|
R.id.btnShareUrlStatus -> status?.url?.let { url ->
|
|
|
|
if(url.isNotEmpty()) shareText(activity, url)
|
|
|
|
}
|
2018-01-04 19:52:25 +01:00
|
|
|
|
2018-08-17 06:12:36 +02:00
|
|
|
R.id.btnShareUrlAccount -> who?.url?.let { url ->
|
|
|
|
if(url.isNotEmpty()) shareText(activity, url)
|
|
|
|
}
|
2018-05-08 10:25:02 +02:00
|
|
|
R.id.btnNotificationDelete -> notification?.let { notification ->
|
2018-01-04 19:52:25 +01:00
|
|
|
Action_Notification.deleteOne(activity, access_info, notification)
|
|
|
|
}
|
|
|
|
|
|
|
|
R.id.btnConversationMute -> status?.let { status ->
|
|
|
|
Action_Toot.muteConversation(activity, access_info, status)
|
|
|
|
}
|
|
|
|
|
|
|
|
R.id.btnProfilePin -> status?.let { status ->
|
|
|
|
Action_Toot.pin(activity, access_info, status, true)
|
|
|
|
}
|
|
|
|
|
|
|
|
R.id.btnProfileUnpin -> status?.let { status ->
|
|
|
|
Action_Toot.pin(activity, access_info, status, false)
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-08-17 06:12:36 +02:00
|
|
|
private fun shareText(activity : ActMain, text : String) {
|
|
|
|
ShareCompat.IntentBuilder.from(activity)
|
|
|
|
.setText(text)
|
|
|
|
.setType("text/plain")
|
|
|
|
.startChooser()
|
|
|
|
}
|
|
|
|
|
2018-01-04 19:52:25 +01:00
|
|
|
override fun onLongClick(v : View) : Boolean {
|
2018-05-18 19:08:46 +02:00
|
|
|
val who = whoRef?.get()
|
2018-01-04 19:52:25 +01:00
|
|
|
|
|
|
|
when(v.id) {
|
|
|
|
R.id.btnFollow -> {
|
2019-01-19 03:36:40 +01:00
|
|
|
dialog.dismissSafe()
|
2018-05-08 10:25:02 +02:00
|
|
|
Action_Follow.followFromAnotherAccount(
|
|
|
|
activity,
|
|
|
|
activity.nextPosition(column),
|
|
|
|
access_info,
|
|
|
|
who
|
|
|
|
)
|
2018-01-04 19:52:25 +01:00
|
|
|
return true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|