mirror of
https://github.com/moparisthebest/k-9
synced 2024-11-27 19:52:17 -05:00
Round our color chips, clean up color hcip rendering a bit
This commit is contained in:
parent
4c9c478d8d
commit
0c426c9c4b
@ -14,6 +14,8 @@
|
|||||||
android:id="@+id/chip"
|
android:id="@+id/chip"
|
||||||
android:layout_width="6dip"
|
android:layout_width="6dip"
|
||||||
android:layout_height="fill_parent"
|
android:layout_height="fill_parent"
|
||||||
|
android:layout_marginTop="2dip"
|
||||||
|
android:layout_marginBottom="1dip"
|
||||||
android:layout_centerVertical="true"
|
android:layout_centerVertical="true"
|
||||||
android:layout_alignParentLeft="true" />
|
android:layout_alignParentLeft="true" />
|
||||||
|
|
||||||
@ -24,7 +26,7 @@
|
|||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
android:paddingLeft="1dip" >
|
android:paddingLeft="6dip" >
|
||||||
|
|
||||||
<ImageButton
|
<ImageButton
|
||||||
android:id="@+id/folders"
|
android:id="@+id/folders"
|
||||||
|
@ -12,6 +12,8 @@
|
|||||||
<View
|
<View
|
||||||
android:id="@+id/chip"
|
android:id="@+id/chip"
|
||||||
android:layout_width="6dip"
|
android:layout_width="6dip"
|
||||||
|
android:layout_marginTop="2dip"
|
||||||
|
android:layout_marginBottom="1dip"
|
||||||
android:layout_height="fill_parent"
|
android:layout_height="fill_parent"
|
||||||
android:layout_centerVertical="true"
|
android:layout_centerVertical="true"
|
||||||
android:layout_alignParentLeft="true" />
|
android:layout_alignParentLeft="true" />
|
||||||
|
@ -9,6 +9,8 @@
|
|||||||
>
|
>
|
||||||
<View
|
<View
|
||||||
android:id="@+id/chip"
|
android:id="@+id/chip"
|
||||||
|
android:layout_marginTop="1dip"
|
||||||
|
android:layout_marginBottom="1dip"
|
||||||
android:layout_width="6dip"
|
android:layout_width="6dip"
|
||||||
android:layout_height="fill_parent" />
|
android:layout_height="fill_parent" />
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
|
@ -18,6 +18,7 @@ import com.fsck.k9.mail.store.LocalStore;
|
|||||||
import com.fsck.k9.mail.store.StorageManager;
|
import com.fsck.k9.mail.store.StorageManager;
|
||||||
import com.fsck.k9.mail.store.LocalStore.LocalFolder;
|
import com.fsck.k9.mail.store.LocalStore.LocalFolder;
|
||||||
import com.fsck.k9.mail.store.StorageManager.StorageProvider;
|
import com.fsck.k9.mail.store.StorageManager.StorageProvider;
|
||||||
|
import com.fsck.k9.view.ColorChip;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
@ -691,6 +692,11 @@ public class Account implements BaseAccount
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public ColorChip generateColorChip() {
|
||||||
|
return new ColorChip( mChipColor);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public String getUuid()
|
public String getUuid()
|
||||||
{
|
{
|
||||||
return mUuid;
|
return mUuid;
|
||||||
|
@ -27,6 +27,7 @@ import com.fsck.k9.activity.setup.Prefs;
|
|||||||
import com.fsck.k9.controller.MessagingController;
|
import com.fsck.k9.controller.MessagingController;
|
||||||
import com.fsck.k9.controller.MessagingListener;
|
import com.fsck.k9.controller.MessagingListener;
|
||||||
import com.fsck.k9.mail.Flag;
|
import com.fsck.k9.mail.Flag;
|
||||||
|
import com.fsck.k9.view.ColorChip;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
@ -1010,7 +1011,7 @@ public class Accounts extends K9ListActivity implements OnItemClickListener, OnC
|
|||||||
{
|
{
|
||||||
Account realAccount = (Account)account;
|
Account realAccount = (Account)account;
|
||||||
|
|
||||||
holder.chip.setBackgroundColor(realAccount.getChipColor());
|
holder.chip.setBackgroundDrawable(realAccount.generateColorChip().drawable());
|
||||||
if (unreadMessageCount == null)
|
if (unreadMessageCount == null)
|
||||||
{
|
{
|
||||||
holder.chip.getBackground().setAlpha(0);
|
holder.chip.getBackground().setAlpha(0);
|
||||||
@ -1027,7 +1028,7 @@ public class Accounts extends K9ListActivity implements OnItemClickListener, OnC
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
holder.chip.setBackgroundColor(0x00000000);
|
holder.chip.setBackgroundDrawable(new ColorChip(0xff999999).drawable());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
39
src/com/fsck/k9/activity/ColorChip.java
Normal file
39
src/com/fsck/k9/activity/ColorChip.java
Normal 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;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -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.chip.getBackground().setAlpha(folder.unreadMessageCount == 0 ? 127 : 255);
|
||||||
|
|
||||||
holder.folderName.setTextSize(TypedValue.COMPLEX_UNIT_DIP, mFontSizes.getFolderName());
|
holder.folderName.setTextSize(TypedValue.COMPLEX_UNIT_DIP, mFontSizes.getFolderName());
|
||||||
|
@ -74,6 +74,8 @@ import com.fsck.k9.mail.store.LocalStore;
|
|||||||
import com.fsck.k9.mail.store.StorageManager;
|
import com.fsck.k9.mail.store.StorageManager;
|
||||||
import com.fsck.k9.mail.store.LocalStore.LocalFolder;
|
import com.fsck.k9.mail.store.LocalStore.LocalFolder;
|
||||||
import com.fsck.k9.mail.store.LocalStore.LocalMessage;
|
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
|
* 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.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);
|
holder.chip.getBackground().setAlpha(message.read ? 127 : 255);
|
||||||
view.getBackground().setAlpha(message.downloaded ? 0 : 127);
|
view.getBackground().setAlpha(message.downloaded ? 0 : 127);
|
||||||
|
|
||||||
|
@ -478,7 +478,7 @@ public class MessageView extends K9Activity implements OnClickListener
|
|||||||
mAttachmentIcon.setVisibility(((LocalMessage) message).hasAttachments() ? View.VISIBLE : View.GONE);
|
mAttachmentIcon.setVisibility(((LocalMessage) message).hasAttachments() ? View.VISIBLE : View.GONE);
|
||||||
mFlagged.setChecked(message.isSet(Flag.FLAGGED));
|
mFlagged.setChecked(message.isSet(Flag.FLAGGED));
|
||||||
mSubjectView.setTextColor(0xff000000 | defaultSubjectColor);
|
mSubjectView.setTextColor(0xff000000 | defaultSubjectColor);
|
||||||
chip.setBackgroundColor(mAccount.getChipColor());
|
chip.setBackgroundDrawable(mAccount.generateColorChip().drawable());
|
||||||
chip.getBackground().setAlpha(!message.isSet(Flag.SEEN) ? 255 : 127);
|
chip.getBackground().setAlpha(!message.isSet(Flag.SEEN) ? 255 : 127);
|
||||||
if (message.isSet(Flag.ANSWERED))
|
if (message.isSet(Flag.ANSWERED))
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user