1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-12-26 01:28:50 -05:00

Indicate read state in chips

This commit is contained in:
Jesse Vincent 2012-09-10 11:01:51 -04:00
parent 047b5287b3
commit c9897a5c84
4 changed files with 15 additions and 6 deletions

View File

@ -756,8 +756,12 @@ public class Account implements BaseAccount {
}
public ColorChip generateColorChip(boolean messageRead) {
return new ColorChip(mChipColor, messageRead);
}
public ColorChip generateColorChip() {
return new ColorChip(mChipColor);
return new ColorChip(mChipColor, false);
}

View File

@ -1747,7 +1747,7 @@ public class Accounts extends K9ListActivity implements OnItemClickListener {
}
} else {
holder.chip.setBackgroundDrawable(new ColorChip(0xff999999).drawable());
holder.chip.setBackgroundDrawable(new ColorChip(0xff999999, false).drawable());
}

View File

@ -2240,7 +2240,7 @@ public class MessageList extends K9ListActivity implements OnItemClickListener,
holder.chip.setBackgroundDrawable(message.message.getFolder().getAccount().generateColorChip().drawable());
holder.chip.setBackgroundDrawable(message.message.getFolder().getAccount().generateColorChip(message.read).drawable());
// TODO: Make these colors part of the theme
if (K9.getK9Theme() == K9.THEME_LIGHT) {
// Light theme: light grey background for read messages

View File

@ -1,5 +1,6 @@
package com.fsck.k9.view;
import android.graphics.Paint;
import android.graphics.Path;
import android.graphics.drawable.ShapeDrawable;
import android.graphics.drawable.shapes.PathShape;
@ -9,23 +10,27 @@ public class ColorChip {
static {
CHIP_PATH.addCircle(8,8,8f,Path.Direction.CW);
CHIP_PATH.addCircle(8,8,7f,Path.Direction.CW);
CHIP_PATH.close();
}
private ShapeDrawable mDrawable;
public ColorChip(int color) {
public ColorChip(int color, boolean messageRead) {
mDrawable = new ShapeDrawable(new PathShape(CHIP_PATH, 16f, 16f));
mDrawable.getPaint().setStrokeWidth(2);
if (messageRead) {
// Read messages get an outlined circle
mDrawable.getPaint().setStyle(Paint.Style.STROKE);
}
mDrawable.getPaint().setColor(color);
}
public ShapeDrawable drawable() {
return mDrawable;
}