Skip to content

Commit

Permalink
Improved task list item presentation
Browse files Browse the repository at this point in the history
* Strikethrough completed items
* Removed priority parentheses
* Aligned item number horizontally
* Set item number visibility to GONE when preference is unchecked
* Closes todotxt#129
  • Loading branch information
ginatrapani committed Feb 12, 2011
1 parent f160c12 commit e1b2b20
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 11 deletions.
16 changes: 8 additions & 8 deletions res/layout/list_item.xml
Expand Up @@ -23,24 +23,24 @@ You should have received a copy of the GNU General Public License along with Tod
@author Gina Trapani <ginatrapani[at]gmail[dot]com>
@author mathias <mathias[at]ws7862[dot](none)>
@author mathias <mathias[at]x2[dot](none)>
@license http://www.gnu.org/licenses/gpl.html
@copyright 2009-2011 Gina Trapani, mathias
-->

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android">

<TextView android:id="@+id/taskprio" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:padding="4dip"
android:textStyle="bold" android:textSize="16dip" />

<TextView android:id="@+id/taskid" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:gravity="bottom"
android:textSize="10dip" android:layout_alignBaseline="@+id/taskprio"
android:textColor="@color/grey" android:paddingLeft="4dip" />

<TextView android:id="@+id/taskprio" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:padding="4dip"
android:textSize="10dip" android:layout_below="@id/taskprio"
android:textColor="@color/black" />
android:textSize="16dip" android:textStyle="bold"
android:layout_toRightOf="@id/taskid" />

<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:textSize="16dip" android:layout_toRightOf="@id/taskprio" />

</RelativeLayout>
18 changes: 15 additions & 3 deletions src/com/todotxt/todotxttouch/TodoTxtTouch.java
Expand Up @@ -55,6 +55,7 @@
import android.content.SharedPreferences.Editor;
import android.content.SharedPreferences.OnSharedPreferenceChangeListener;
import android.content.res.Resources;
import android.graphics.Paint;
import android.os.AsyncTask;
import android.os.Bundle;
import android.text.SpannableString;
Expand Down Expand Up @@ -831,7 +832,8 @@ public View getView(int position, View convertView, ViewGroup parent) {
if (task.getPriority() == Priority.NONE) {
holder.taskprio.setText(" ");
} else {
holder.taskprio.setText(task.getPriority().inFileFormat());
holder.taskprio
.setText(task.getPriority().inScreenFormat());
}
SpannableString ss = new SpannableString(task.inScreenFormat());
Util.setGray(ss, task.getProjects());
Expand All @@ -857,11 +859,21 @@ public View getView(int position, View convertView, ViewGroup parent) {
default:
holder.taskprio.setTextColor(res.getColor(R.color.black));
}
if (task.isCompleted()) {
Log.v(TAG, "Striking through " + task.getText());
holder.tasktext.setPaintFlags(holder.tasktext
.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG);
} else {
holder.tasktext.setPaintFlags(holder.tasktext
.getPaintFlags() & ~Paint.STRIKE_THRU_TEXT_FLAG);
}

// hide line numbers unless show preference is checked
if (!m_app.m_prefs.getBoolean("showlinenumberspref", false)) {
holder.taskid.setTextColor(res.getColor(R.color.white));
holder.taskid.setVisibility(View.GONE);
} else {
holder.taskid.setVisibility(View.VISIBLE);
}

}
return convertView;
}
Expand Down

0 comments on commit e1b2b20

Please sign in to comment.