Detailed changes
@@ -2,6 +2,7 @@ package com.cheogram.android;
import android.app.Activity;
import android.content.Context;
+import android.graphics.PorterDuff;
import android.graphics.Rect;
import android.util.AttributeSet;
import android.view.LayoutInflater;
@@ -35,7 +36,7 @@ public class TagEditorView extends TokenCompleteTextView<ListItem.Tag> {
LayoutInflater inflater = (LayoutInflater) getContext().getSystemService(Activity.LAYOUT_INFLATER_SERVICE);
final TextView tv = (TextView) inflater.inflate(R.layout.list_item_tag, (ViewGroup) getParent(), false);
tv.setText(tag.getName());
- tv.setBackgroundColor(tag.getColor());
+ tv.getBackground().mutate().setColorFilter(tag.getColor(), PorterDuff.Mode.SRC_IN);
return tv;
}
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="utf-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
+ <size android:width="3dp" />
+</shape>
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="utf-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
+ <corners android:radius="50dp" />
+</shape>
@@ -5,6 +5,7 @@ import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
+import android.graphics.PorterDuff;
import android.net.Uri;
import android.os.Bundle;
import android.preference.PreferenceManager;
@@ -659,7 +660,7 @@ public class ConferenceDetailsActivity extends XmppActivity implements OnConvers
for (final ListItem.Tag tag : tagList) {
final TextView tv = (TextView) inflater.inflate(R.layout.list_item_tag, binding.tags, false);
tv.setText(tag.getName());
- tv.setBackgroundColor(tag.getColor());
+ tv.getBackground().mutate().setColorFilter(tag.getColor(), PorterDuff.Mode.SRC_IN);
binding.tags.addView(tv);
}
}
@@ -7,6 +7,7 @@ import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.pm.PackageManager;
+import android.graphics.PorterDuff;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.Build;
@@ -605,7 +606,7 @@ public class ContactDetailsActivity extends OmemoActivity implements OnAccountUp
for (final ListItem.Tag tag : tagList) {
final TextView tv = (TextView) inflater.inflate(R.layout.list_item_tag, binding.tags, false);
tv.setText(tag.getName());
- tv.setBackgroundColor(tag.getColor());
+ tv.getBackground().mutate().setColorFilter(tag.getColor(), PorterDuff.Mode.SRC_IN);
binding.tags.addView(tv);
}
}
@@ -9,6 +9,7 @@ import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.pm.PackageManager;
+import android.graphics.PorterDuff;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
@@ -740,6 +741,9 @@ public class StartConversationActivity extends XmppActivity implements XmppConne
boolean showDynamicTags = preferences.getBoolean(SettingsActivity.SHOW_DYNAMIC_TAGS, getResources().getBoolean(R.bool.show_dynamic_tags));
if (showDynamicTags) {
RecyclerView tags = mSearchView.findViewById(R.id.tags);
+ androidx.recyclerview.widget.DividerItemDecoration spacer = new androidx.recyclerview.widget.DividerItemDecoration(tags.getContext(), LinearLayoutManager.HORIZONTAL);
+ spacer.setDrawable(getResources().getDrawable(R.drawable.horizontal_space));
+ tags.addItemDecoration(spacer);
tags.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.HORIZONTAL, false));
tags.setAdapter(mTagsAdapter);
}
@@ -1568,7 +1572,7 @@ public class StartConversationActivity extends XmppActivity implements XmppConne
public void setTag(ListItem.Tag tag) {
tv.setText(tag.getName());
- tv.setBackgroundColor(tag.getColor());
+ tv.getBackground().mutate().setColorFilter(tag.getColor(), PorterDuff.Mode.SRC_IN);
}
}
@@ -1,6 +1,7 @@
package eu.siacs.conversations.ui.adapter;
import android.content.SharedPreferences;
+import android.graphics.PorterDuff;
import android.preference.PreferenceManager;
import android.view.LayoutInflater;
import android.view.View;
@@ -79,7 +80,7 @@ public class ListItemAdapter extends ArrayAdapter<ListItem> {
for (ListItem.Tag tag : tags) {
TextView tv = (TextView) inflater.inflate(R.layout.list_item_tag, viewHolder.tags, false);
tv.setText(tag.getName());
- tv.setBackgroundColor(tag.getColor());
+ tv.getBackground().mutate().setColorFilter(tag.getColor(), PorterDuff.Mode.SRC_IN);
tv.setOnClickListener(this.onTagTvClick);
viewHolder.tags.addView(tv);
}
@@ -3,6 +3,7 @@ package eu.siacs.conversations.ui.adapter;
import android.app.PendingIntent;
import android.content.Context;
import android.content.IntentSender;
+import android.graphics.PorterDuff;
import android.view.ContextMenu;
import android.view.LayoutInflater;
import android.widget.TextView;
@@ -127,13 +128,13 @@ public class UserAdapter extends ListAdapter<MucOptions.User, UserAdapter.ViewHo
for (MucOptions.Hat hat : getPseudoHats(viewHolder.binding.getRoot().getContext(), user)) {
TextView tv = (TextView) LayoutInflater.from(viewHolder.binding.getRoot().getContext()).inflate(R.layout.list_item_tag, viewHolder.binding.tags, false);
tv.setText(hat.toString());
- tv.setBackgroundColor(hat.getColor());
+ tv.getBackground().mutate().setColorFilter(hat.getColor(), PorterDuff.Mode.SRC_IN);
viewHolder.binding.tags.addView(tv);
}
for (MucOptions.Hat hat : user.getHats()) {
TextView tv = (TextView) LayoutInflater.from(viewHolder.binding.getRoot().getContext()).inflate(R.layout.list_item_tag, viewHolder.binding.tags, false);
tv.setText(hat.toString());
- tv.setBackgroundColor(hat.getColor());
+ tv.getBackground().mutate().setColorFilter(hat.getColor(), PorterDuff.Mode.SRC_IN);
viewHolder.binding.tags.addView(tv);
}
@@ -5,9 +5,10 @@
android:layout_margin="2dp"
android:maxLines="1"
android:paddingBottom="1dp"
- android:paddingLeft="4dp"
- android:paddingRight="4dp"
+ android:paddingLeft="5dp"
+ android:paddingRight="5dp"
android:paddingTop="1dp"
android:textAllCaps="true"
+ android:background="@drawable/pill"
android:textAppearance="@style/TextAppearance.Conversations.Tag"
- />
+ />