1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-12-24 08:38:51 -05:00

Round our color chips, clean up color hcip rendering a bit

This commit is contained in:
Jesse Vincent 2010-12-28 09:11:10 +00:00
parent 4c9c478d8d
commit 0c426c9c4b
9 changed files with 62 additions and 6 deletions

View File

@ -14,6 +14,8 @@
android:id="@+id/chip"
android:layout_width="6dip"
android:layout_height="fill_parent"
android:layout_marginTop="2dip"
android:layout_marginBottom="1dip"
android:layout_centerVertical="true"
android:layout_alignParentLeft="true" />
@ -24,7 +26,7 @@
android:layout_weight="1"
android:orientation="horizontal"
android:gravity="center_vertical"
android:paddingLeft="1dip" >
android:paddingLeft="6dip" >
<ImageButton
android:id="@+id/folders"

View File

@ -12,6 +12,8 @@
<View
android:id="@+id/chip"
android:layout_width="6dip"
android:layout_marginTop="2dip"
android:layout_marginBottom="1dip"
android:layout_height="fill_parent"
android:layout_centerVertical="true"
android:layout_alignParentLeft="true" />

View File

@ -9,6 +9,8 @@
>
<View
android:id="@+id/chip"
android:layout_marginTop="1dip"
android:layout_marginBottom="1dip"
android:layout_width="6dip"
android:layout_height="fill_parent" />
<LinearLayout

View File

@ -18,6 +18,7 @@ import com.fsck.k9.mail.store.LocalStore;
import com.fsck.k9.mail.store.StorageManager;
import com.fsck.k9.mail.store.LocalStore.LocalFolder;
import com.fsck.k9.mail.store.StorageManager.StorageProvider;
import com.fsck.k9.view.ColorChip;
import java.util.ArrayList;
import java.util.Arrays;
@ -691,6 +692,11 @@ public class Account implements BaseAccount
}
public ColorChip generateColorChip() {
return new ColorChip( mChipColor);
}
public String getUuid()
{
return mUuid;

View File

@ -27,6 +27,7 @@ import com.fsck.k9.activity.setup.Prefs;
import com.fsck.k9.controller.MessagingController;
import com.fsck.k9.controller.MessagingListener;
import com.fsck.k9.mail.Flag;
import com.fsck.k9.view.ColorChip;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
@ -1010,7 +1011,7 @@ public class Accounts extends K9ListActivity implements OnItemClickListener, OnC
{
Account realAccount = (Account)account;
holder.chip.setBackgroundColor(realAccount.getChipColor());
holder.chip.setBackgroundDrawable(realAccount.generateColorChip().drawable());
if (unreadMessageCount == null)
{
holder.chip.getBackground().setAlpha(0);
@ -1027,7 +1028,7 @@ public class Accounts extends K9ListActivity implements OnItemClickListener, OnC
}
else
{
holder.chip.setBackgroundColor(0x00000000);
holder.chip.setBackgroundDrawable(new ColorChip(0xff999999).drawable());
}

View File

@ -0,0 +1,39 @@
package com.fsck.k9.view;
import android.graphics.Path;
import android.graphics.drawable.ShapeDrawable;
import android.graphics.drawable.shapes.PathShape;
public class ColorChip {
private static final Path CHIP_PATH = new Path();
static
{
CHIP_PATH.lineTo(6,0);
CHIP_PATH.cubicTo( 8f, 0f, 10f, 0f, 10f, 2f );
CHIP_PATH.lineTo(10, 8);
CHIP_PATH.cubicTo( 10f, 9f, 10f, 10f, 6f, 10f );
CHIP_PATH.lineTo(0,10);
CHIP_PATH.close();
}
private ShapeDrawable mDrawable;
public ColorChip(int color) {
mDrawable = new ShapeDrawable(new PathShape(CHIP_PATH, 10, 10));
mDrawable.getPaint().setColor(color);
}
public ShapeDrawable drawable () {
return mDrawable;
}
}

View File

@ -1417,7 +1417,7 @@ public class FolderList extends K9ListActivity
}
);
holder.chip.setBackgroundColor(mAccount.getChipColor());
holder.chip.setBackgroundDrawable(mAccount.generateColorChip().drawable());
holder.chip.getBackground().setAlpha(folder.unreadMessageCount == 0 ? 127 : 255);
holder.folderName.setTextSize(TypedValue.COMPLEX_UNIT_DIP, mFontSizes.getFolderName());

View File

@ -74,6 +74,8 @@ import com.fsck.k9.mail.store.LocalStore;
import com.fsck.k9.mail.store.StorageManager;
import com.fsck.k9.mail.store.LocalStore.LocalFolder;
import com.fsck.k9.mail.store.LocalStore.LocalMessage;
import com.fsck.k9.view.ColorChip;
/**
* MessageList is the primary user interface for the program. This Activity
@ -2749,7 +2751,9 @@ public class MessageList
holder.selected.setVisibility(message.selected ? View.VISIBLE : View.GONE);
}
holder.chip.setBackgroundColor(message.message.getFolder().getAccount().getChipColor());
holder.chip.setBackgroundDrawable(message.message.getFolder().getAccount().generateColorChip().drawable());
holder.chip.getBackground().setAlpha(message.read ? 127 : 255);
view.getBackground().setAlpha(message.downloaded ? 0 : 127);

View File

@ -478,7 +478,7 @@ public class MessageView extends K9Activity implements OnClickListener
mAttachmentIcon.setVisibility(((LocalMessage) message).hasAttachments() ? View.VISIBLE : View.GONE);
mFlagged.setChecked(message.isSet(Flag.FLAGGED));
mSubjectView.setTextColor(0xff000000 | defaultSubjectColor);
chip.setBackgroundColor(mAccount.getChipColor());
chip.setBackgroundDrawable(mAccount.generateColorChip().drawable());
chip.getBackground().setAlpha(!message.isSet(Flag.SEEN) ? 255 : 127);
if (message.isSet(Flag.ANSWERED))
{