Merge pull request #355 from sdex/show_content_description_toast_on_long_click

Show a toast with content description on long click on action buttons
This commit is contained in:
Tibor Kaputa 2022-05-25 11:29:43 +02:00 committed by GitHub
commit 6b1f38ed19
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 27 additions and 0 deletions

View File

@ -185,6 +185,18 @@ class CallActivity : SimpleActivity() {
it.applyColorFilter(getProperTextColor())
}
arrayOf(
call_toggle_microphone, call_toggle_speaker, call_dialpad,
call_toggle_hold, call_add, call_swap, call_merge, call_manage
).forEach { imageView ->
imageView.setOnLongClickListener {
if (!imageView.contentDescription.isNullOrEmpty()) {
toast(imageView.contentDescription.toString())
}
true
}
}
call_sim_id.setTextColor(getProperTextColor().getContrastColor())
}

View File

@ -5,6 +5,7 @@ import android.view.Menu
import android.view.ViewGroup
import com.bumptech.glide.Glide
import com.simplemobiletools.commons.adapters.MyRecyclerViewAdapter
import com.simplemobiletools.commons.extensions.toast
import com.simplemobiletools.commons.helpers.LOWER_ALPHA
import com.simplemobiletools.commons.helpers.SimpleContactsHelper
import com.simplemobiletools.commons.views.MyRecyclerView
@ -66,6 +67,12 @@ class ConferenceCallsAdapter(
activity.finish()
}
}
itemView.item_conference_call_split.setOnLongClickListener {
if (!it.contentDescription.isNullOrEmpty()) {
itemView.context.toast(it.contentDescription.toString())
}
true
}
itemView.item_conference_call_end.isEnabled = canDisconnect
itemView.item_conference_call_end.alpha = if (canDisconnect) 1.0f else LOWER_ALPHA
itemView.item_conference_call_end.setOnClickListener {
@ -76,6 +83,12 @@ class ConferenceCallsAdapter(
activity.finish()
}
}
itemView.item_conference_call_end.setOnLongClickListener {
if (!it.contentDescription.isNullOrEmpty()) {
itemView.context.toast(it.contentDescription.toString())
}
true
}
}
bindViewHolder(holder)
}

View File

@ -163,6 +163,7 @@
android:layout_width="@dimen/dialpad_button_size"
android:layout_height="@dimen/dialpad_button_size"
android:background="?attr/selectableItemBackgroundBorderless"
android:contentDescription="@string/turn_microphone_off"
android:padding="@dimen/medium_margin"
android:src="@drawable/ic_microphone_vector"
app:layout_constraintBottom_toBottomOf="parent"
@ -176,6 +177,7 @@
android:layout_width="@dimen/dialpad_button_size"
android:layout_height="@dimen/dialpad_button_size"
android:background="?attr/selectableItemBackgroundBorderless"
android:contentDescription="@string/turn_speaker_on"
android:padding="@dimen/medium_margin"
android:src="@drawable/ic_speaker_off_vector"
app:layout_constraintBottom_toBottomOf="parent"