Update tooltip to Material3 spec.
This commit is contained in:
parent
e610ee419f
commit
ffeb60fcdd
11 changed files with 120 additions and 78 deletions
|
@ -18,6 +18,7 @@ import androidx.annotation.Px;
|
|||
import androidx.annotation.StringRes;
|
||||
import androidx.core.content.ContextCompat;
|
||||
|
||||
import org.signal.core.util.DimensionUnit;
|
||||
import org.thoughtcrime.securesms.R;
|
||||
import org.thoughtcrime.securesms.mms.GlideApp;
|
||||
import org.thoughtcrime.securesms.util.ViewUtil;
|
||||
|
@ -83,10 +84,10 @@ public class TooltipPopup extends PopupWindow {
|
|||
|
||||
if (backgroundTint == 0) {
|
||||
bubble.getBackground().setColorFilter(ContextCompat.getColor(anchor.getContext(), R.color.tooltip_default_color), PorterDuff.Mode.MULTIPLY);
|
||||
arrow.setColorFilter(ContextCompat.getColor(anchor.getContext(), R.color.tooltip_default_color), PorterDuff.Mode.MULTIPLY);
|
||||
arrow.setColorFilter(ContextCompat.getColor(anchor.getContext(), R.color.tooltip_default_color), PorterDuff.Mode.SRC_IN);
|
||||
} else {
|
||||
bubble.getBackground().setColorFilter(backgroundTint, PorterDuff.Mode.MULTIPLY);
|
||||
arrow.setColorFilter(backgroundTint, PorterDuff.Mode.MULTIPLY);
|
||||
arrow.setColorFilter(backgroundTint, PorterDuff.Mode.SRC_IN);
|
||||
}
|
||||
|
||||
if (iconGlideModel != null) {
|
||||
|
@ -148,8 +149,10 @@ public class TooltipPopup extends PopupWindow {
|
|||
switch (position) {
|
||||
case POSITION_ABOVE:
|
||||
xoffset += startMargin;
|
||||
xoffset -= DimensionUnit.DP.toPixels(20);
|
||||
case POSITION_BELOW:
|
||||
xoffset += startMargin;
|
||||
xoffset -= DimensionUnit.DP.toPixels(20);
|
||||
break;
|
||||
case POSITION_LEFT:
|
||||
xoffset += startMargin;
|
||||
|
|
|
@ -290,7 +290,7 @@ object ContactSearchItems {
|
|||
override fun bind(model: T) {
|
||||
checkbox.visible = displayCheckBox
|
||||
checkbox.isChecked = isSelected(model)
|
||||
itemView.setOnClickListener { onClick(itemView, getData(model), isSelected(model)) }
|
||||
itemView.setOnClickListener { onClick(avatar, getData(model), isSelected(model)) }
|
||||
bindLongPress(model)
|
||||
|
||||
if (payload.isNotEmpty()) {
|
||||
|
|
|
@ -16,7 +16,6 @@ import android.widget.Toast
|
|||
import androidx.annotation.PluralsRes
|
||||
import androidx.annotation.StringRes
|
||||
import androidx.appcompat.widget.AppCompatImageView
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.core.os.bundleOf
|
||||
import androidx.core.view.ViewCompat
|
||||
import androidx.core.view.doOnNextLayout
|
||||
|
@ -28,7 +27,6 @@ import androidx.fragment.app.setFragmentResultListener
|
|||
import androidx.fragment.app.viewModels
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||
import org.signal.core.util.DimensionUnit
|
||||
import org.signal.core.util.logging.Log
|
||||
import org.thoughtcrime.securesms.R
|
||||
import org.thoughtcrime.securesms.components.ContactFilterView
|
||||
|
@ -394,12 +392,10 @@ class MultiselectForwardFragment :
|
|||
}
|
||||
|
||||
private fun displayTooltip(anchor: View, @StringRes text: Int) {
|
||||
// 22dp + gutter
|
||||
TooltipPopup
|
||||
.forTarget(anchor)
|
||||
.setStartMargin(DimensionUnit.DP.toPixels(16f).toInt())
|
||||
.setText(text)
|
||||
.setTextColor(ContextCompat.getColor(requireContext(), R.color.signal_colorOnPrimaryContainer))
|
||||
.setBackgroundTint(ContextCompat.getColor(requireContext(), R.color.signal_colorPrimaryContainer))
|
||||
.show(TooltipPopup.POSITION_BELOW)
|
||||
}
|
||||
|
||||
|
|
9
app/src/main/res/drawable/ic_tooltip_arrow_down.xml
Normal file
9
app/src/main/res/drawable/ic_tooltip_arrow_down.xml
Normal file
|
@ -0,0 +1,9 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="20dp"
|
||||
android:height="12dp"
|
||||
android:viewportWidth="20"
|
||||
android:viewportHeight="12">
|
||||
<path
|
||||
android:pathData="M10,9L1,-0L19,-0L10,9Z"
|
||||
android:fillColor="#000000"/>
|
||||
</vector>
|
13
app/src/main/res/drawable/ic_tooltip_arrow_left.xml
Normal file
13
app/src/main/res/drawable/ic_tooltip_arrow_left.xml
Normal file
|
@ -0,0 +1,13 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="12dp"
|
||||
android:height="20dp"
|
||||
android:viewportWidth="12"
|
||||
android:viewportHeight="20">
|
||||
<group>
|
||||
<clip-path
|
||||
android:pathData="M0,20l0,-20l12,-0l0,20z"/>
|
||||
<path
|
||||
android:pathData="M3,10L12,1L12,19L3,10Z"
|
||||
android:fillColor="#000000"/>
|
||||
</group>
|
||||
</vector>
|
13
app/src/main/res/drawable/ic_tooltip_arrow_right.xml
Normal file
13
app/src/main/res/drawable/ic_tooltip_arrow_right.xml
Normal file
|
@ -0,0 +1,13 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="12dp"
|
||||
android:height="20dp"
|
||||
android:viewportWidth="12"
|
||||
android:viewportHeight="20">
|
||||
<group>
|
||||
<clip-path
|
||||
android:pathData="M12,0l-0,20l-12,0l-0,-20z"/>
|
||||
<path
|
||||
android:pathData="M9,10L-0,19L-0,1L9,10Z"
|
||||
android:fillColor="#000000"/>
|
||||
</group>
|
||||
</vector>
|
9
app/src/main/res/drawable/ic_tooltip_arrow_up.xml
Normal file
9
app/src/main/res/drawable/ic_tooltip_arrow_up.xml
Normal file
|
@ -0,0 +1,9 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="20dp"
|
||||
android:height="12dp"
|
||||
android:viewportWidth="20"
|
||||
android:viewportHeight="12">
|
||||
<path
|
||||
android:pathData="M10,3L19,12H1L10,3Z"
|
||||
android:fillColor="#000000"/>
|
||||
</vector>
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" >
|
||||
<solid android:color="@color/white"/>
|
||||
<corners android:radius="8dp"/>
|
||||
<corners android:radius="18dp"/>
|
||||
</shape>
|
|
@ -1,43 +1,38 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
tools:viewBindingIgnore="true"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:clipChildren="false"
|
||||
android:clipToPadding="false"
|
||||
android:maxWidth="320dp"
|
||||
android:orientation="horizontal">
|
||||
tools:viewBindingIgnore="true">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/tooltip_arrow_start"
|
||||
android:layout_width="8dp"
|
||||
android:layout_height="16dp"
|
||||
android:elevation="6dp"
|
||||
android:layout_width="12dp"
|
||||
android:layout_height="20dp"
|
||||
android:importantForAccessibility="no"
|
||||
android:scaleType="fitXY"
|
||||
android:visibility="gone"
|
||||
app:srcCompat="@drawable/ic_triangle_left"
|
||||
tools:tint="@color/core_blue"
|
||||
android:visibility="invisible"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:srcCompat="@drawable/ic_tooltip_arrow_left"
|
||||
app:tint="@color/signal_colorPrimaryContainer"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:clipChildren="false"
|
||||
android:clipToPadding="false"
|
||||
android:orientation="vertical">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/tooltip_arrow_top"
|
||||
android:layout_width="16dp"
|
||||
android:layout_height="8dp"
|
||||
android:elevation="6dp"
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="12dp"
|
||||
android:importantForAccessibility="no"
|
||||
android:scaleType="fitXY"
|
||||
android:visibility="gone"
|
||||
app:srcCompat="@drawable/ic_triangle_up"
|
||||
tools:tint="@color/core_blue"
|
||||
android:visibility="invisible"
|
||||
app:layout_constraintStart_toStartOf="@id/tooltip_bubble"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:srcCompat="@drawable/ic_tooltip_arrow_up"
|
||||
app:tint="@color/signal_colorPrimaryContainer"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<LinearLayout
|
||||
|
@ -47,10 +42,13 @@
|
|||
android:background="@drawable/tooltip_background"
|
||||
android:clipChildren="false"
|
||||
android:clipToPadding="false"
|
||||
android:elevation="6dp"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal"
|
||||
android:padding="16dp">
|
||||
android:padding="16dp"
|
||||
app:layout_constraintStart_toEndOf="@id/tooltip_arrow_start"
|
||||
app:layout_constraintTop_toBottomOf="@id/tooltip_arrow_top"
|
||||
app:layout_constraintWidth_max="320dp"
|
||||
tools:backgroundTint="@color/signal_colorPrimaryContainer">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/tooltip_icon"
|
||||
|
@ -58,8 +56,8 @@
|
|||
android:layout_height="20dp"
|
||||
android:layout_marginEnd="2dp"
|
||||
android:visibility="gone"
|
||||
app:tint="@color/signal_colorPrimaryContainer"
|
||||
tools:src="@drawable/ic_person_white_24dp"
|
||||
tools:tint="@color/core_blue"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<TextView
|
||||
|
@ -67,32 +65,35 @@
|
|||
style="@style/Signal.Text.BodyMedium"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
tools:text="It is my gift. It is my curse." />
|
||||
tools:text="It is my gift. It is my curse. It is my gift. It is my curse. It is my gift. It is my curse. It is my gift. It is my curse." />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/tooltip_arrow_bottom"
|
||||
android:layout_width="16dp"
|
||||
android:layout_height="8dp"
|
||||
android:elevation="6dp"
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="12dp"
|
||||
android:importantForAccessibility="no"
|
||||
android:scaleType="fitXY"
|
||||
android:visibility="gone"
|
||||
app:srcCompat="@drawable/ic_triangle_down"
|
||||
tools:tint="@color/core_blue"
|
||||
android:visibility="invisible"
|
||||
app:layout_constraintStart_toStartOf="@id/tooltip_bubble"
|
||||
app:layout_constraintTop_toBottomOf="@id/tooltip_bubble"
|
||||
app:srcCompat="@drawable/ic_tooltip_arrow_down"
|
||||
app:tint="@color/signal_colorPrimaryContainer"
|
||||
tools:visibility="visible" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/tooltip_arrow_end"
|
||||
android:layout_width="8dp"
|
||||
android:layout_height="16dp"
|
||||
android:elevation="6dp"
|
||||
android:layout_width="12dp"
|
||||
android:layout_height="20dp"
|
||||
android:importantForAccessibility="no"
|
||||
android:scaleType="fitXY"
|
||||
android:visibility="gone"
|
||||
app:srcCompat="@drawable/ic_triangle_right"
|
||||
tools:tint="@color/core_blue"
|
||||
android:visibility="invisible"
|
||||
app:layout_constraintStart_toEndOf="@id/tooltip_bubble"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:srcCompat="@drawable/ic_tooltip_arrow_right"
|
||||
app:tint="@color/signal_colorPrimaryContainer"
|
||||
tools:visibility="visible" />
|
||||
|
||||
</LinearLayout>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
|
|
|
@ -156,8 +156,6 @@
|
|||
|
||||
<color name="sticker_management_action_button_color">@color/core_grey_25</color>
|
||||
|
||||
<color name="tooltip_default_color">@color/core_grey_75</color>
|
||||
|
||||
<color name="wallpaper_preview_background">@color/transparent_black_60</color>
|
||||
<color name="wallpaper_compose_background">@color/signal_colorTransparentInverse4</color>
|
||||
<color name="wallpaper_toolbar_background">@color/core_black</color>
|
||||
|
|
|
@ -161,7 +161,7 @@
|
|||
|
||||
<color name="sticker_management_action_button_color">@color/core_grey_90</color>
|
||||
|
||||
<color name="tooltip_default_color">@color/core_white</color>
|
||||
<color name="tooltip_default_color">@color/signal_colorSecondaryContainer</color>
|
||||
|
||||
<color name="wallpaper_preview_background">@color/transparent_white_30</color>
|
||||
<color name="wallpaper_compose_background">@color/signal_colorTransparent4</color>
|
||||
|
|
Loading…
Add table
Reference in a new issue