Permalink
Browse files

Change style for task projects & contexts from bold to gray

* Instead of bolding the metadata, it should be lightened
* Also made the line numbers black when "Show line numbers" setting is selected
* Closes #76
  • Loading branch information...
1 parent 96a4892 commit ea2a1c01842576877335a2ce66460c79dbe78699 @ginatrapani ginatrapani committed Jan 29, 2011
View
@@ -7,10 +7,11 @@
<TextView android:id="@+id/taskid" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:padding="4dip"
- android:textSize="10dip" android:layout_below="@id/taskprio" />
+ android:textSize="10dip" android:layout_below="@id/taskprio"
+ android:textColor="@color/black" />
<TextView android:id="@+id/tasktext" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:padding="4dip"
- android:layout_toRightOf="@id/taskprio" android:textSize="16dip"/>
+ android:layout_toRightOf="@id/taskprio" android:textSize="16dip" />
</RelativeLayout>
@@ -792,8 +792,8 @@ public View getView(int position, View convertView, ViewGroup parent) {
+ TaskHelper.toString(task.prio) + ")");
}
SpannableString ss = new SpannableString(task.text);
- Util.setBold(ss, TaskHelper.getProjects(task.text));
- Util.setBold(ss, TaskHelper.getContexts(task.text));
+ Util.setGray(ss, TaskHelper.getProjects(task.text));
+ Util.setGray(ss, TaskHelper.getContexts(task.text));
holder.tasktext.setText(ss);
Resources res = getResources();
@@ -49,10 +49,11 @@
import android.content.Context;
import android.content.DialogInterface;
import android.content.DialogInterface.OnClickListener;
+import android.graphics.Color;
import android.os.Environment;
import android.text.Spannable;
import android.text.SpannableString;
-import android.text.style.StyleSpan;
+import android.text.style.ForegroundColorSpan;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
@@ -333,20 +334,19 @@ public static void createParentDirectory(File dest) throws TodoException {
return adapter;
}
- public static void setBold(SpannableString ss, List<String> items) {
+ public static void setGray(SpannableString ss, List<String> items) {
String data = ss.toString();
for (String item : items) {
int i = data.indexOf("@" + item);
if (i != -1) {
- // ss.setSpan(what, start, end, flags);
- ss.setSpan(new StyleSpan(android.graphics.Typeface.BOLD),
- i + 1, i + 1 + item.length(),
+ ss.setSpan(new ForegroundColorSpan(Color.GRAY), i,
+ i + 1 + item.length(),
Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
}
int j = data.indexOf("+" + item);
if (j != -1) {
- ss.setSpan(new StyleSpan(android.graphics.Typeface.BOLD),
- j + 1, j + 1 + item.length(),
+ ss.setSpan(new ForegroundColorSpan(Color.GRAY), j,
+ j + 1 + item.length(),
Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
}
}

0 comments on commit ea2a1c0

Please sign in to comment.