mirror of
https://github.com/moparisthebest/k-9
synced 2024-12-25 00:58:50 -05:00
A first implementation of "starred" messages in portrait list views
This commit is contained in:
parent
3bc8a0a8d4
commit
b328cbe991
@ -13,6 +13,16 @@
|
||||
android:layout_width="4dip"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_centerVertical="true" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/flagged"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:focusable="false"
|
||||
style="?android:attr/starStyle"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_alignParentRight="true"
|
||||
/>
|
||||
<TextView
|
||||
android:id="@+id/subject"
|
||||
android:ellipsize="end"
|
||||
@ -22,6 +32,7 @@
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="10dip"
|
||||
android:layout_toLeftOf="@id/flagged"
|
||||
android:layout_marginRight="1dip" />
|
||||
<TextView
|
||||
android:id="@+id/date"
|
||||
@ -32,7 +43,7 @@
|
||||
android:textColor="?android:attr/textColorSecondary"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_toLeftOf="@id/flagged"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:background="@android:color/transparent"
|
||||
/>
|
||||
@ -48,5 +59,5 @@
|
||||
android:layout_toLeftOf="@id/date"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentBottom="true"
|
||||
/>
|
||||
/>
|
||||
</RelativeLayout>
|
||||
|
@ -27,6 +27,7 @@ import android.view.LayoutInflater;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.Window;
|
||||
import android.view.ContextMenu.ContextMenuInfo;
|
||||
@ -1415,20 +1416,36 @@ public class MessageList extends K9ListActivity {
|
||||
holder.from = (TextView) view.findViewById(R.id.from);
|
||||
holder.date = (TextView) view.findViewById(R.id.date);
|
||||
holder.chip = view.findViewById(R.id.chip);
|
||||
holder.flagged = (CheckBox) view.findViewById(R.id.flagged);
|
||||
holder.flagged.setOnClickListener(new OnClickListener() {
|
||||
public void onClick(View v) {
|
||||
// Perform action on clicks
|
||||
MessageInfoHolder message = (MessageInfoHolder) getItem((Integer)v.getTag());
|
||||
onToggleFlag(message);
|
||||
}
|
||||
});
|
||||
|
||||
holder.chip.setBackgroundResource(colorChipResId);
|
||||
view.setTag(holder);
|
||||
}
|
||||
|
||||
|
||||
if (message != null) {
|
||||
holder.chip.getBackground().setAlpha(message.read ? 0 : 255);
|
||||
holder.subject.setTypeface(null, message.read && !message.flagged ? Typeface.NORMAL : Typeface.BOLD);
|
||||
holder.subject.setTypeface(null, message.read ? Typeface.NORMAL : Typeface.BOLD);
|
||||
|
||||
int subjectColor = holder.from.getCurrentTextColor(); // Get from another field that never changes color
|
||||
|
||||
holder.flagged.setTag((Integer)position);
|
||||
|
||||
if (message.flagged) {
|
||||
subjectColor = Email.FLAGGED_COLOR;
|
||||
}
|
||||
holder.flagged.setChecked(true);
|
||||
} else {
|
||||
holder.flagged.setChecked(false);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
if (message.downloaded) {
|
||||
holder.chip.getBackground().setAlpha(message.read ? 0 : 127);
|
||||
@ -1663,6 +1680,7 @@ public class MessageList extends K9ListActivity {
|
||||
public TextView preview;
|
||||
public TextView from;
|
||||
public TextView date;
|
||||
public CheckBox flagged;
|
||||
public View chip;
|
||||
}
|
||||
|
||||
|
@ -257,11 +257,11 @@ public class MessageView extends K9Activity
|
||||
mCcView.setText(values[5]);
|
||||
mAttachmentIcon.setVisibility(msg.arg1 == 1 ? View.VISIBLE : View.GONE);
|
||||
if ((msg.arg2 & FLAG_FLAGGED) != 0) {
|
||||
mSubjectView.setTextColor(0xff000000 | Email.FLAGGED_COLOR);
|
||||
}
|
||||
else {
|
||||
mSubjectView.setTextColor(0xff000000 | defaultSubjectColor );
|
||||
|
||||
|
||||
}
|
||||
mSubjectView.setTextColor(0xff000000 | defaultSubjectColor );
|
||||
|
||||
if ((msg.arg2 & FLAG_ANSWERED) != 0) {
|
||||
Drawable answeredIcon = getResources().getDrawable(
|
||||
R.drawable.ic_mms_answered_small);
|
||||
|
Loading…
Reference in New Issue
Block a user