mirror of
https://github.com/moparisthebest/k-9
synced 2024-11-23 18:02:15 -05:00
make the Delete, Select and Star buttons share the same screenspace.
right now we toggle per row. next up is toggle all at once
This commit is contained in:
parent
695aa42347
commit
622155a57a
@ -6,15 +6,6 @@
|
|||||||
android:paddingRight="1dip"
|
android:paddingRight="1dip"
|
||||||
android:paddingTop="2dip"
|
android:paddingTop="2dip"
|
||||||
android:background="@drawable/message_list_item_background">
|
android:background="@drawable/message_list_item_background">
|
||||||
<CheckBox
|
|
||||||
android:id="@+id/flagged"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="23dip"
|
|
||||||
android:focusable="false"
|
|
||||||
style="?android:attr/starStyle"
|
|
||||||
android:layout_gravity="center_vertical"
|
|
||||||
android:layout_alignParentRight="true"
|
|
||||||
/>
|
|
||||||
<View
|
<View
|
||||||
android:id="@+id/chip"
|
android:id="@+id/chip"
|
||||||
android:background="@drawable/appointment_indicator_leftside_1"
|
android:background="@drawable/appointment_indicator_leftside_1"
|
||||||
@ -22,15 +13,18 @@
|
|||||||
android:layout_height="20dip"
|
android:layout_height="20dip"
|
||||||
android:layout_centerVertical="true"
|
android:layout_centerVertical="true"
|
||||||
android:layout_alignParentLeft="true" />
|
android:layout_alignParentLeft="true" />
|
||||||
|
<include layout="@layout/message_list_widgets" android:id="@+id/widgets" />
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/date"
|
android:id="@+id/date"
|
||||||
android:ellipsize="end"
|
|
||||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||||
android:singleLine="true"
|
android:singleLine="true"
|
||||||
android:textColor="?android:attr/textColorPrimary"
|
android:textColor="?android:attr/textColorPrimary"
|
||||||
android:layout_width="70dip"
|
android:layout_width="70dip"
|
||||||
|
android:paddingRight="3dip"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_toLeftOf="@+id/flagged" />
|
android:gravity="right|bottom"
|
||||||
|
android:layout_alignWithParentIfMissing="true"
|
||||||
|
android:layout_toLeftOf="@+id/widgets" />
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/from"
|
android:id="@+id/from"
|
||||||
android:ellipsize="end"
|
android:ellipsize="end"
|
||||||
@ -52,6 +46,7 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:paddingLeft="10dip"
|
android:paddingLeft="10dip"
|
||||||
android:layout_marginRight="1dip"
|
android:layout_marginRight="1dip"
|
||||||
android:layout_toRightOf="@+id/chip"
|
android:layout_alignWithParentIfMissing="true"
|
||||||
|
android:layout_toRightOf="@+id/chip"
|
||||||
android:layout_toLeftOf="@+id/from" />
|
android:layout_toLeftOf="@+id/from" />
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
@ -13,26 +13,7 @@
|
|||||||
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
|
<include layout="@layout/message_list_widgets" android:id="@+id/widgets" />
|
||||||
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"
|
|
||||||
/>
|
|
||||||
<!-- http://stackoverflow.com/questions/1121192/android-custom-listview-unable-to-click-on-items -->
|
|
||||||
<CheckBox
|
|
||||||
android:id="@+id/selected_checkbox"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="fill_parent"
|
|
||||||
android:button="@drawable/checkbox"
|
|
||||||
android:layout_toRightOf="@+id/chip"
|
|
||||||
android:layout_centerVertical="true"
|
|
||||||
android:focusable="false"
|
|
||||||
android:text=""
|
|
||||||
/>
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/subject"
|
android:id="@+id/subject"
|
||||||
android:ellipsize="end"
|
android:ellipsize="end"
|
||||||
@ -42,8 +23,8 @@
|
|||||||
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_toLeftOf="@id/widgets"
|
||||||
android:layout_toRightOf="@+id/selected_checkbox"
|
android:layout_toRightOf="@+id/chip"
|
||||||
android:layout_marginRight="1dip" />
|
android:layout_marginRight="1dip" />
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/date"
|
android:id="@+id/date"
|
||||||
@ -51,24 +32,27 @@
|
|||||||
android:paddingRight="5dip"
|
android:paddingRight="5dip"
|
||||||
android:paddingLeft="5dip"
|
android:paddingLeft="5dip"
|
||||||
android:singleLine="true"
|
android:singleLine="true"
|
||||||
|
android:gravity="right|bottom"
|
||||||
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_toLeftOf="@id/flagged"
|
android:layout_toLeftOf="@id/widgets"
|
||||||
android:layout_alignParentBottom="true"
|
android:layout_alignParentBottom="true"
|
||||||
android:background="@android:color/transparent"
|
android:background="@android:color/transparent"
|
||||||
|
|
||||||
/>
|
/>
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/from"
|
android:id="@+id/from"
|
||||||
android:ellipsize="end"
|
android:ellipsize="end"
|
||||||
android:singleLine="true"
|
android:singleLine="true"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||||
android:textColor="?android:attr/textColorSecondary"
|
android:textColor="?android:attr/textColorSecondary"
|
||||||
android:paddingLeft="12dip"
|
android:paddingLeft="12dip"
|
||||||
|
android:layout_alignParentBottom="true"
|
||||||
android:layout_toLeftOf="@id/date"
|
android:layout_toLeftOf="@id/date"
|
||||||
android:layout_toRightOf="@+id/selected_checkbox"
|
android:layout_toRightOf="@id/chip"
|
||||||
android:layout_alignParentBottom="true"
|
/>
|
||||||
/>
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
36
res/layout/message_list_widgets.xml
Normal file
36
res/layout/message_list_widgets.xml
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_alignParentRight="true"
|
||||||
|
android:layout_width="30dip"
|
||||||
|
android:layout_height="30dip"
|
||||||
|
>
|
||||||
|
<ImageButton
|
||||||
|
android:id="@+id/delete"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignParentLeft="true"
|
||||||
|
android:focusable="true"
|
||||||
|
style="?android:attr/buttonStyleSmall"
|
||||||
|
android:src="@drawable/ic_delete"
|
||||||
|
/>
|
||||||
|
<CheckBox
|
||||||
|
android:id="@+id/flagged"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:focusable="true"
|
||||||
|
style="?android:attr/starStyle"
|
||||||
|
android:layout_gravity="center_vertical"
|
||||||
|
/>
|
||||||
|
<!-- http://stackoverflow.com/questions/1121192/android-custom-listview-unable-to-click-on-items
|
||||||
|
we want something a bit bigger than it is right now -->
|
||||||
|
<CheckBox
|
||||||
|
android:id="@+id/selected_checkbox"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_centerVertical="true"
|
||||||
|
android:focusable="false"
|
||||||
|
android:button="@drawable/checkbox"
|
||||||
|
android:text=""
|
||||||
|
/>
|
||||||
|
</LinearLayout>
|
@ -557,23 +557,28 @@ public class MessageList extends K9ListActivity
|
|||||||
ViewGroup vg = (ViewGroup) v;
|
ViewGroup vg = (ViewGroup) v;
|
||||||
vg.setDescendantFocusability(ViewGroup.FOCUS_BEFORE_DESCENDANTS);
|
vg.setDescendantFocusability(ViewGroup.FOCUS_BEFORE_DESCENDANTS);
|
||||||
ImageButton delete = (ImageButton) v.findViewById(R.id.delete);
|
ImageButton delete = (ImageButton) v.findViewById(R.id.delete);
|
||||||
if (delete.getVisibility() == View.GONE)
|
Button flagged = (Button) v.findViewById(R.id.flagged);
|
||||||
|
CheckBox selected = (CheckBox) v.findViewById(R.id.selected_checkbox);
|
||||||
|
|
||||||
|
if (delete.getVisibility() == View.VISIBLE)
|
||||||
{
|
{
|
||||||
delete.setVisibility(View.VISIBLE);
|
delete.setVisibility(View.GONE);
|
||||||
delete.setFocusable(true);
|
flagged.setVisibility(View.VISIBLE);
|
||||||
delete.setFocusableInTouchMode(true);
|
selected.setVisibility(View.GONE);
|
||||||
if (delete.requestFocus())
|
}
|
||||||
{
|
else if (flagged.getVisibility() == View.VISIBLE)
|
||||||
v.setFocusable(false);
|
{
|
||||||
Log.v(Email.LOG_TAG, "is in touch mode");
|
delete.setVisibility(View.GONE);
|
||||||
}
|
|
||||||
Button flagged = (Button) v.findViewById(R.id.flagged);
|
|
||||||
flagged.setVisibility(View.GONE);
|
flagged.setVisibility(View.GONE);
|
||||||
|
selected.setVisibility(View.VISIBLE);
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Delete was already visible
|
delete.setVisibility(View.VISIBLE);
|
||||||
delete.requestFocus();
|
flagged.setVisibility(View.GONE);
|
||||||
|
selected.setVisibility(View.GONE);
|
||||||
|
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -1770,26 +1775,17 @@ public class MessageList extends K9ListActivity
|
|||||||
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.selected.setVisibility(View.GONE);
|
||||||
holder.delete.setVisibility(View.GONE);
|
holder.delete.setVisibility(View.GONE);
|
||||||
holder.flagged.setVisibility(View.VISIBLE);
|
holder.flagged.setVisibility(View.VISIBLE);
|
||||||
|
|
||||||
// XXX TODO there has to be some way to walk our view hierarchy and get this
|
// XXX TODO there has to be some way to walk our view hierarchy and get this
|
||||||
holder.flagged.setTag((Integer)position);
|
holder.flagged.setTag((Integer)position);
|
||||||
holder.delete.setTag((Integer)position);
|
holder.delete.setTag((Integer)position);
|
||||||
|
|
||||||
|
|
||||||
|
holder.flagged.setChecked(message.flagged);
|
||||||
|
holder.selected.setChecked(message.selected);
|
||||||
if (message.flagged)
|
|
||||||
{
|
|
||||||
holder.flagged.setChecked(true);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
holder.flagged.setChecked(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (message.downloaded)
|
if (message.downloaded)
|
||||||
@ -1814,10 +1810,6 @@ public class MessageList extends K9ListActivity
|
|||||||
message.hasAttachments ? mAttachmentIcon : null, // right
|
message.hasAttachments ? mAttachmentIcon : null, // right
|
||||||
null); // bottom
|
null); // bottom
|
||||||
holder.position = position;
|
holder.position = position;
|
||||||
if (holder.selected!=null)
|
|
||||||
{
|
|
||||||
holder.selected.setChecked(message.selected);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -1829,10 +1821,7 @@ public class MessageList extends K9ListActivity
|
|||||||
holder.date.setText("No date");
|
holder.date.setText("No date");
|
||||||
holder.from.setCompoundDrawablesWithIntrinsicBounds(null, null, null, null);
|
holder.from.setCompoundDrawablesWithIntrinsicBounds(null, null, null, null);
|
||||||
holder.position = -1;
|
holder.position = -1;
|
||||||
if (holder.selected!=null)
|
holder.selected.setChecked(false);
|
||||||
{
|
|
||||||
holder.selected.setChecked(false);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user