diff --git a/src/main/java/com/todoroo/astrid/tags/TagsControlSet.java b/src/main/java/com/todoroo/astrid/tags/TagsControlSet.java index 77ba19286..86de88193 100644 --- a/src/main/java/com/todoroo/astrid/tags/TagsControlSet.java +++ b/src/main/java/com/todoroo/astrid/tags/TagsControlSet.java @@ -6,8 +6,10 @@ package com.todoroo.astrid.tags; import android.content.DialogInterface; +import android.graphics.drawable.Drawable; import android.os.Bundle; import android.support.annotation.Nullable; +import android.support.v4.graphics.drawable.DrawableCompat; import android.support.v7.app.AlertDialog; import android.text.Editable; import android.text.SpannableString; @@ -24,6 +26,7 @@ import android.view.ViewGroup; import android.view.inputmethod.EditorInfo; import android.widget.ArrayAdapter; import android.widget.AutoCompleteTextView; +import android.widget.CheckedTextView; import android.widget.LinearLayout; import android.widget.ListView; import android.widget.TextView; @@ -51,6 +54,7 @@ import org.tasks.R; import org.tasks.dialogs.DialogBuilder; import org.tasks.injection.FragmentComponent; import org.tasks.themes.ThemeCache; +import org.tasks.themes.ThemeColor; import org.tasks.ui.TaskEditControlFragment; import java.util.ArrayList; @@ -149,7 +153,8 @@ public final class TagsControlSet extends TaskEditControlFragment { } else { tagList = tagService.getTagNames(taskId); } - allTagNames = newArrayList(ImmutableSet.copyOf(transform(tagService.getTagList(), new Function() { + final List allTags = tagService.getTagList(); + allTagNames = newArrayList(ImmutableSet.copyOf(transform(allTags, new Function() { @Override public String apply(TagData tagData) { return tagData.getName(); @@ -158,7 +163,20 @@ public final class TagsControlSet extends TaskEditControlFragment { dialogView = inflater.inflate(R.layout.control_set_tag_list, null); newTags = (LinearLayout) dialogView.findViewById(R.id.newTags); selectedTags = (ListView) dialogView.findViewById(R.id.existingTags); - selectedTags.setAdapter(new ArrayAdapter<>(getActivity(), R.layout.simple_list_item_multiple_choice_themed, allTagNames)); + ArrayAdapter adapter = new ArrayAdapter(getActivity(), R.layout.simple_list_item_multiple_choice_themed, allTags) { + @Override + public View getView(int position, View convertView, ViewGroup parent) { + CheckedTextView view = (CheckedTextView) super.getView(position, convertView, parent); + TagData tagData = allTags.get(position); + ThemeColor themeColor = themeCache.getThemeColor(tagData.getColor() >= 0 ? tagData.getColor() : 19); + view.setText(tagData.getName()); + Drawable drawable = DrawableCompat.wrap(getResources().getDrawable(R.drawable.ic_label_24dp)); + DrawableCompat.setTint(drawable, themeColor.getPrimaryColor()); + view.setCompoundDrawablesWithIntrinsicBounds(drawable, null, null, null); + return view; + } + }; + selectedTags.setAdapter(adapter); addTag(""); for (String tag : tagList) { setTagSelected(tag); diff --git a/src/main/res/layout/control_set_tag_list.xml b/src/main/res/layout/control_set_tag_list.xml index 92c064276..e28db0ccb 100644 --- a/src/main/res/layout/control_set_tag_list.xml +++ b/src/main/res/layout/control_set_tag_list.xml @@ -31,6 +31,8 @@ android:layout_marginLeft="3dip" android:layout_marginRight="3dip" android:layout_weight="100" + android:dividerHeight="0dp" + android:divider="@null" android:choiceMode="multipleChoice"/> diff --git a/src/main/res/layout/simple_list_item_multiple_choice_themed.xml b/src/main/res/layout/simple_list_item_multiple_choice_themed.xml index 4595c4b71..78b938664 100644 --- a/src/main/res/layout/simple_list_item_multiple_choice_themed.xml +++ b/src/main/res/layout/simple_list_item_multiple_choice_themed.xml @@ -1,5 +1,4 @@ - -