Tint pending group invites menu icon.
This commit is contained in:
parent
8e962bf992
commit
4e55d2d941
3 changed files with 33 additions and 9 deletions
|
@ -1,6 +1,9 @@
|
|||
package org.thoughtcrime.securesms.groups.ui;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.TypedArray;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuInflater;
|
||||
|
@ -12,9 +15,13 @@ import androidx.annotation.MenuRes;
|
|||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.widget.PopupMenu;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.core.graphics.drawable.DrawableCompat;
|
||||
|
||||
import org.thoughtcrime.securesms.R;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
public final class PopupMenuView extends View {
|
||||
|
||||
@MenuRes private int menu;
|
||||
|
@ -23,22 +30,34 @@ public final class PopupMenuView extends View {
|
|||
|
||||
public PopupMenuView(Context context) {
|
||||
super(context);
|
||||
init();
|
||||
init(null);
|
||||
}
|
||||
|
||||
public PopupMenuView(Context context, @Nullable AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
init();
|
||||
init(attrs);
|
||||
}
|
||||
|
||||
public PopupMenuView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
init();
|
||||
init(attrs);
|
||||
}
|
||||
|
||||
private void init() {
|
||||
private void init(@Nullable AttributeSet attrs) {
|
||||
setBackgroundResource(R.drawable.ic_more_vert_24);
|
||||
|
||||
if (attrs != null) {
|
||||
TypedArray typedArray = getContext().getTheme().obtainStyledAttributes(attrs, R.styleable.PopupMenuView, 0, 0);
|
||||
int tint = typedArray.getColor(R.styleable.PopupMenuView_background_tint, Color.BLACK);
|
||||
Drawable drawable = ContextCompat.getDrawable(getContext(), R.drawable.ic_more_vert_24);
|
||||
|
||||
DrawableCompat.setTint(Objects.requireNonNull(drawable), tint);
|
||||
|
||||
setBackground(drawable);
|
||||
|
||||
typedArray.recycle();
|
||||
}
|
||||
|
||||
setOnClickListener(v -> {
|
||||
if (callback != null) {
|
||||
PopupMenu popup = new PopupMenu(getContext(), v);
|
||||
|
|
|
@ -16,19 +16,19 @@
|
|||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:src="@tools:sample/avatars"/>
|
||||
tools:src="@tools:sample/avatars" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatCheckBox
|
||||
android:id="@+id/recipient_selected"
|
||||
android:background="?attr/contact_selection_checkbox_background"
|
||||
android:button="@null"
|
||||
android:layout_width="22dp"
|
||||
android:layout_height="22dp"
|
||||
android:focusable="false"
|
||||
android:background="?attr/contact_selection_checkbox_background"
|
||||
android:button="@null"
|
||||
android:clickable="false"
|
||||
android:focusable="false"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/recipient_avatar"
|
||||
app:layout_constraintEnd_toEndOf="@+id/recipient_avatar"
|
||||
tools:checked="true"/>
|
||||
tools:checked="true" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/recipient_name"
|
||||
|
@ -80,6 +80,7 @@
|
|||
android:layout_height="24dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:visibility="gone"
|
||||
app:background_tint="?title_text_color_primary"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
|
|
|
@ -535,6 +535,10 @@
|
|||
<attr name="selectable" format="boolean" />
|
||||
</declare-styleable>
|
||||
|
||||
<declare-styleable name="PopupMenuView">
|
||||
<attr name="background_tint" format="color" />
|
||||
</declare-styleable>
|
||||
|
||||
<declare-styleable name="WebRtcAudioOutputToggleButtonState">
|
||||
<attr name="state_speaker_on" format="boolean" />
|
||||
<attr name="state_speaker_off" format="boolean" />
|
||||
|
|
Loading…
Add table
Reference in a new issue