mirror of
https://github.com/TwidereProject/Twidere-Android
synced 2025-02-01 09:16:47 +01:00
fixed quote with other accounts color label
This commit is contained in:
parent
d621430fab
commit
c113de0134
@ -207,7 +207,7 @@ class ParcelableActivitiesAdapter(
|
||||
return holder
|
||||
}
|
||||
ITEM_VIEW_TYPE_TITLE_SUMMARY -> {
|
||||
val view = inflater.inflate(R.layout.card_item_activity_summary_compact, parent, false)
|
||||
val view = inflater.inflate(R.layout.list_item_activity_summary_compact, parent, false)
|
||||
val holder = ActivityTitleSummaryViewHolder(view, this)
|
||||
holder.setOnClickListeners()
|
||||
holder.setupViewOptions()
|
||||
|
@ -34,6 +34,9 @@ import android.text.TextWatcher
|
||||
import android.view.Gravity
|
||||
import android.view.View
|
||||
import android.widget.EditText
|
||||
import android.widget.ImageButton
|
||||
import android.widget.LinearLayout
|
||||
import android.widget.RelativeLayout
|
||||
import com.bumptech.glide.Glide
|
||||
import com.twitter.Validator
|
||||
import org.mariotaku.ktextension.Bundle
|
||||
@ -53,18 +56,22 @@ import org.mariotaku.twidere.util.Analyzer
|
||||
import org.mariotaku.twidere.util.EditTextEnterHandler
|
||||
import org.mariotaku.twidere.util.LinkCreator
|
||||
import org.mariotaku.twidere.util.Utils.isMyRetweet
|
||||
import org.mariotaku.twidere.view.ColorLabelRelativeLayout
|
||||
import org.mariotaku.twidere.view.ComposeEditText
|
||||
import org.mariotaku.twidere.view.StatusTextCountView
|
||||
import org.mariotaku.twidere.view.holder.StatusViewHolder
|
||||
|
||||
class RetweetQuoteDialogFragment : BaseDialogFragment() {
|
||||
private var popupMenu: PopupMenu? = null
|
||||
private lateinit var popupMenu: PopupMenu
|
||||
|
||||
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
|
||||
val builder = AlertDialog.Builder(context)
|
||||
val status = this.status
|
||||
val accountKey = this.accountKey
|
||||
val details = AccountUtils.getAccountDetails(AccountManager.get(context), accountKey, true)!!
|
||||
val status = this.status.apply {
|
||||
account_key = details.key
|
||||
account_color = details.color
|
||||
}
|
||||
|
||||
builder.setView(R.layout.dialog_status_quote_retweet)
|
||||
builder.setTitle(R.string.retweet_quote_confirm_title)
|
||||
@ -72,7 +79,7 @@ class RetweetQuoteDialogFragment : BaseDialogFragment() {
|
||||
builder.setNegativeButton(android.R.string.cancel, null)
|
||||
builder.setNeutralButton(R.string.action_quote) { _, _ ->
|
||||
val intent = Intent(INTENT_ACTION_QUOTE)
|
||||
val menu = popupMenu!!.menu
|
||||
val menu = popupMenu.menu
|
||||
val quoteOriginalStatus = menu.findItem(R.id.quote_original_status)
|
||||
intent.putExtra(EXTRA_STATUS, status)
|
||||
intent.putExtra(EXTRA_QUOTE_ORIGINAL_STATUS, quoteOriginalStatus.isChecked)
|
||||
@ -83,13 +90,13 @@ class RetweetQuoteDialogFragment : BaseDialogFragment() {
|
||||
dialog.setOnShowListener {
|
||||
it as AlertDialog
|
||||
it.applyTheme()
|
||||
val itemContent = it.findViewById(R.id.itemContent)!!
|
||||
val textCountView = it.findViewById(R.id.comment_text_count) as StatusTextCountView
|
||||
val itemMenu = it.findViewById(R.id.itemMenu)!!
|
||||
val actionButtons = it.findViewById(R.id.actionButtons)!!
|
||||
val commentContainer = it.findViewById(R.id.comment_container)!!
|
||||
val editComment = it.findViewById(R.id.edit_comment) as ComposeEditText
|
||||
val commentMenu = it.findViewById(R.id.comment_menu)!!
|
||||
val itemContent = it.findViewById(R.id.itemContent) as ColorLabelRelativeLayout
|
||||
val textCountView = it.findViewById(R.id.commentTextCount) as StatusTextCountView
|
||||
val itemMenu = it.findViewById(R.id.itemMenu) as ImageButton
|
||||
val actionButtons = it.findViewById(R.id.actionButtons) as LinearLayout
|
||||
val commentContainer = it.findViewById(R.id.commentContainer) as RelativeLayout
|
||||
val editComment = it.findViewById(R.id.editComment) as ComposeEditText
|
||||
val commentMenu = it.findViewById(R.id.commentMenu) as ImageButton
|
||||
|
||||
val adapter = DummyItemAdapter(context, requestManager = Glide.with(this))
|
||||
adapter.setShouldShowAccountsColor(true)
|
||||
@ -135,20 +142,20 @@ class RetweetQuoteDialogFragment : BaseDialogFragment() {
|
||||
})
|
||||
|
||||
popupMenu = PopupMenu(context, commentMenu, Gravity.NO_GRAVITY,
|
||||
R.attr.actionOverflowMenuStyle, 0)
|
||||
commentMenu.setOnClickListener { popupMenu!!.show() }
|
||||
commentMenu.setOnTouchListener(popupMenu!!.dragToOpenListener)
|
||||
popupMenu!!.inflate(R.menu.menu_dialog_comment)
|
||||
val menu = popupMenu!!.menu
|
||||
menu.setItemAvailability(R.id.quote_original_status,
|
||||
status.retweet_id != null || status.quoted_id != null)
|
||||
popupMenu!!.setOnMenuItemClickListener(PopupMenu.OnMenuItemClickListener { item ->
|
||||
if (item.isCheckable) {
|
||||
item.isChecked = !item.isChecked
|
||||
return@OnMenuItemClickListener true
|
||||
}
|
||||
false
|
||||
})
|
||||
R.attr.actionOverflowMenuStyle, 0).apply {
|
||||
inflate(R.menu.menu_dialog_comment)
|
||||
menu.setItemAvailability(R.id.quote_original_status, status.retweet_id != null || status.quoted_id != null)
|
||||
setOnMenuItemClickListener(PopupMenu.OnMenuItemClickListener { item ->
|
||||
if (item.isCheckable) {
|
||||
item.isChecked = !item.isChecked
|
||||
return@OnMenuItemClickListener true
|
||||
}
|
||||
false
|
||||
})
|
||||
}
|
||||
commentMenu.setOnClickListener { popupMenu.show() }
|
||||
commentMenu.setOnTouchListener(popupMenu.dragToOpenListener)
|
||||
commentMenu.visibility = if (popupMenu.menu.hasVisibleItems()) View.VISIBLE else View.GONE
|
||||
|
||||
it.getButton(DialogInterface.BUTTON_POSITIVE).setOnClickListener {
|
||||
var dismissDialog = false
|
||||
@ -188,7 +195,7 @@ class RetweetQuoteDialogFragment : BaseDialogFragment() {
|
||||
positiveButton.setText(R.string.action_retweet)
|
||||
positiveButton.isEnabled = !status.user_is_protected
|
||||
}
|
||||
val textCountView = (dialog.findViewById(R.id.comment_text_count) as StatusTextCountView?)!!
|
||||
val textCountView = (dialog.findViewById(R.id.commentTextCount) as StatusTextCountView?)!!
|
||||
textCountView.textCount = validator.getTweetLength(s.toString())
|
||||
}
|
||||
|
||||
@ -203,9 +210,9 @@ class RetweetQuoteDialogFragment : BaseDialogFragment() {
|
||||
showProtectedConfirmation: Boolean): Boolean {
|
||||
val twitter = twitterWrapper
|
||||
val dialog = dialog ?: return false
|
||||
val editComment = dialog.findViewById(R.id.edit_comment) as EditText
|
||||
val editComment = dialog.findViewById(R.id.editComment) as EditText
|
||||
if (useQuote(editComment.length() > 0, account)) {
|
||||
val menu = popupMenu!!.menu
|
||||
val menu = popupMenu.menu
|
||||
val itemQuoteOriginalStatus = menu.findItem(R.id.quote_original_status)
|
||||
val statusLink: Uri
|
||||
val quoteOriginalStatus = itemQuoteOriginalStatus.isChecked
|
||||
|
@ -20,10 +20,10 @@
|
||||
-->
|
||||
|
||||
<ScrollView
|
||||
android:id="@+id/status_container"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/status_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:paddingBottom="@dimen/element_spacing_normal"
|
||||
@ -37,12 +37,12 @@
|
||||
android:orientation="vertical">
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/comment_container"
|
||||
android:id="@+id/commentContainer"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<org.mariotaku.twidere.view.ComposeEditText
|
||||
android:id="@+id/edit_comment"
|
||||
android:id="@+id/editComment"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:completionThreshold="1"
|
||||
@ -52,39 +52,39 @@
|
||||
android:visibility="visible"
|
||||
app:backgroundTint="?colorAccent">
|
||||
|
||||
<requestFocus />
|
||||
<requestFocus/>
|
||||
</org.mariotaku.twidere.view.ComposeEditText>
|
||||
|
||||
<org.mariotaku.twidere.view.StatusTextCountView
|
||||
android:id="@+id/comment_text_count"
|
||||
android:id="@+id/commentTextCount"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignBottom="@+id/comment_menu"
|
||||
android:layout_alignLeft="@+id/edit_comment"
|
||||
android:layout_alignStart="@+id/edit_comment"
|
||||
android:layout_alignTop="@+id/comment_menu"
|
||||
android:layout_below="@+id/edit_comment"
|
||||
android:layout_toLeftOf="@+id/comment_menu"
|
||||
android:layout_toStartOf="@+id/comment_menu"
|
||||
android:layout_height="@dimen/element_size_normal"
|
||||
android:layout_alignBottom="@+id/commentMenu"
|
||||
android:layout_alignLeft="@+id/editComment"
|
||||
android:layout_alignStart="@+id/editComment"
|
||||
android:layout_alignTop="@+id/commentMenu"
|
||||
android:layout_below="@+id/editComment"
|
||||
android:layout_toLeftOf="@+id/commentMenu"
|
||||
android:layout_toStartOf="@+id/commentMenu"
|
||||
android:gravity="center_vertical|start"
|
||||
android:paddingLeft="@dimen/element_spacing_normal"
|
||||
android:paddingRight="@dimen/element_spacing_normal"
|
||||
tools:text="140" />
|
||||
tools:text="140"/>
|
||||
|
||||
<org.mariotaku.twidere.view.IconActionButton
|
||||
android:id="@+id/comment_menu"
|
||||
android:id="@+id/commentMenu"
|
||||
style="?cardActionButtonStyle"
|
||||
android:layout_width="@dimen/element_size_normal"
|
||||
android:layout_height="@dimen/element_size_normal"
|
||||
android:layout_alignEnd="@+id/edit_comment"
|
||||
android:layout_alignRight="@+id/edit_comment"
|
||||
android:layout_below="@+id/edit_comment"
|
||||
android:layout_alignEnd="@+id/editComment"
|
||||
android:layout_alignRight="@+id/editComment"
|
||||
android:layout_below="@+id/editComment"
|
||||
android:color="?android:textColorTertiary"
|
||||
android:focusable="false"
|
||||
android:src="@drawable/ic_action_more_vertical" />
|
||||
android:src="@drawable/ic_action_more_vertical"/>
|
||||
</RelativeLayout>
|
||||
|
||||
<include layout="@layout/list_item_status" />
|
||||
<include layout="@layout/list_item_status"/>
|
||||
</LinearLayout>
|
||||
|
||||
</ScrollView>
|
@ -12,7 +12,6 @@
|
||||
android:padding="@dimen/element_spacing_normal"
|
||||
app:ignorePadding="true">
|
||||
|
||||
|
||||
<org.mariotaku.twidere.view.IconActionView
|
||||
android:id="@+id/activity_type"
|
||||
android:layout_width="@dimen/element_size_small"
|
Loading…
x
Reference in New Issue
Block a user