mirror of
https://github.com/moparisthebest/k-9
synced 2025-01-12 14:18:02 -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_width="4dip"
|
||||||
android:layout_height="fill_parent"
|
android:layout_height="fill_parent"
|
||||||
android:layout_centerVertical="true" />
|
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
|
<TextView
|
||||||
android:id="@+id/subject"
|
android:id="@+id/subject"
|
||||||
android:ellipsize="end"
|
android:ellipsize="end"
|
||||||
@ -22,6 +32,7 @@
|
|||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:paddingLeft="10dip"
|
android:paddingLeft="10dip"
|
||||||
|
android:layout_toLeftOf="@id/flagged"
|
||||||
android:layout_marginRight="1dip" />
|
android:layout_marginRight="1dip" />
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/date"
|
android:id="@+id/date"
|
||||||
@ -32,7 +43,7 @@
|
|||||||
android:textColor="?android:attr/textColorSecondary"
|
android:textColor="?android:attr/textColorSecondary"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_alignParentRight="true"
|
android:layout_toLeftOf="@id/flagged"
|
||||||
android:layout_alignParentBottom="true"
|
android:layout_alignParentBottom="true"
|
||||||
android:background="@android:color/transparent"
|
android:background="@android:color/transparent"
|
||||||
/>
|
/>
|
||||||
|
@ -27,6 +27,7 @@ import android.view.LayoutInflater;
|
|||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
import android.view.View.OnClickListener;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.view.Window;
|
import android.view.Window;
|
||||||
import android.view.ContextMenu.ContextMenuInfo;
|
import android.view.ContextMenu.ContextMenuInfo;
|
||||||
@ -1415,21 +1416,37 @@ public class MessageList extends K9ListActivity {
|
|||||||
holder.from = (TextView) view.findViewById(R.id.from);
|
holder.from = (TextView) view.findViewById(R.id.from);
|
||||||
holder.date = (TextView) view.findViewById(R.id.date);
|
holder.date = (TextView) view.findViewById(R.id.date);
|
||||||
holder.chip = view.findViewById(R.id.chip);
|
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);
|
holder.chip.setBackgroundResource(colorChipResId);
|
||||||
view.setTag(holder);
|
view.setTag(holder);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (message != null) {
|
if (message != null) {
|
||||||
holder.chip.getBackground().setAlpha(message.read ? 0 : 255);
|
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
|
int subjectColor = holder.from.getCurrentTextColor(); // Get from another field that never changes color
|
||||||
|
|
||||||
|
holder.flagged.setTag((Integer)position);
|
||||||
|
|
||||||
if (message.flagged) {
|
if (message.flagged) {
|
||||||
subjectColor = Email.FLAGGED_COLOR;
|
holder.flagged.setChecked(true);
|
||||||
|
} else {
|
||||||
|
holder.flagged.setChecked(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (message.downloaded) {
|
if (message.downloaded) {
|
||||||
holder.chip.getBackground().setAlpha(message.read ? 0 : 127);
|
holder.chip.getBackground().setAlpha(message.read ? 0 : 127);
|
||||||
view.getBackground().setAlpha(0);
|
view.getBackground().setAlpha(0);
|
||||||
@ -1663,6 +1680,7 @@ public class MessageList extends K9ListActivity {
|
|||||||
public TextView preview;
|
public TextView preview;
|
||||||
public TextView from;
|
public TextView from;
|
||||||
public TextView date;
|
public TextView date;
|
||||||
|
public CheckBox flagged;
|
||||||
public View chip;
|
public View chip;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -257,11 +257,11 @@ public class MessageView extends K9Activity
|
|||||||
mCcView.setText(values[5]);
|
mCcView.setText(values[5]);
|
||||||
mAttachmentIcon.setVisibility(msg.arg1 == 1 ? View.VISIBLE : View.GONE);
|
mAttachmentIcon.setVisibility(msg.arg1 == 1 ? View.VISIBLE : View.GONE);
|
||||||
if ((msg.arg2 & FLAG_FLAGGED) != 0) {
|
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) {
|
if ((msg.arg2 & FLAG_ANSWERED) != 0) {
|
||||||
Drawable answeredIcon = getResources().getDrawable(
|
Drawable answeredIcon = getResources().getDrawable(
|
||||||
R.drawable.ic_mms_answered_small);
|
R.drawable.ic_mms_answered_small);
|
||||||
|
Loading…
Reference in New Issue
Block a user