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:paddingTop="2dip"
|
||||
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
|
||||
android:id="@+id/chip"
|
||||
android:background="@drawable/appointment_indicator_leftside_1"
|
||||
@ -22,15 +13,18 @@
|
||||
android:layout_height="20dip"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_alignParentLeft="true" />
|
||||
<include layout="@layout/message_list_widgets" android:id="@+id/widgets" />
|
||||
<TextView
|
||||
android:id="@+id/date"
|
||||
android:ellipsize="end"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:singleLine="true"
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
android:layout_width="70dip"
|
||||
android:paddingRight="3dip"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toLeftOf="@+id/flagged" />
|
||||
android:gravity="right|bottom"
|
||||
android:layout_alignWithParentIfMissing="true"
|
||||
android:layout_toLeftOf="@+id/widgets" />
|
||||
<TextView
|
||||
android:id="@+id/from"
|
||||
android:ellipsize="end"
|
||||
@ -52,6 +46,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="10dip"
|
||||
android:layout_marginRight="1dip"
|
||||
android:layout_toRightOf="@+id/chip"
|
||||
android:layout_alignWithParentIfMissing="true"
|
||||
android:layout_toRightOf="@+id/chip"
|
||||
android:layout_toLeftOf="@+id/from" />
|
||||
</RelativeLayout>
|
||||
|
@ -13,26 +13,7 @@
|
||||
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"
|
||||
/>
|
||||
<!-- 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=""
|
||||
/>
|
||||
<include layout="@layout/message_list_widgets" android:id="@+id/widgets" />
|
||||
<TextView
|
||||
android:id="@+id/subject"
|
||||
android:ellipsize="end"
|
||||
@ -42,8 +23,8 @@
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="10dip"
|
||||
android:layout_toLeftOf="@id/flagged"
|
||||
android:layout_toRightOf="@+id/selected_checkbox"
|
||||
android:layout_toLeftOf="@id/widgets"
|
||||
android:layout_toRightOf="@+id/chip"
|
||||
android:layout_marginRight="1dip" />
|
||||
<TextView
|
||||
android:id="@+id/date"
|
||||
@ -51,24 +32,27 @@
|
||||
android:paddingRight="5dip"
|
||||
android:paddingLeft="5dip"
|
||||
android:singleLine="true"
|
||||
android:gravity="right|bottom"
|
||||
android:textColor="?android:attr/textColorSecondary"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toLeftOf="@id/flagged"
|
||||
android:layout_toLeftOf="@id/widgets"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:background="@android:color/transparent"
|
||||
|
||||
/>
|
||||
<TextView
|
||||
android:id="@+id/from"
|
||||
android:ellipsize="end"
|
||||
android:singleLine="true"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="?android:attr/textColorSecondary"
|
||||
android:paddingLeft="12dip"
|
||||
<TextView
|
||||
android:id="@+id/from"
|
||||
android:ellipsize="end"
|
||||
android:singleLine="true"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="?android:attr/textColorSecondary"
|
||||
android:paddingLeft="12dip"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_toLeftOf="@id/date"
|
||||
android:layout_toRightOf="@+id/selected_checkbox"
|
||||
android:layout_alignParentBottom="true"
|
||||
/>
|
||||
android:layout_toRightOf="@id/chip"
|
||||
/>
|
||||
|
||||
</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;
|
||||
vg.setDescendantFocusability(ViewGroup.FOCUS_BEFORE_DESCENDANTS);
|
||||
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.setFocusable(true);
|
||||
delete.setFocusableInTouchMode(true);
|
||||
if (delete.requestFocus())
|
||||
{
|
||||
v.setFocusable(false);
|
||||
Log.v(Email.LOG_TAG, "is in touch mode");
|
||||
}
|
||||
Button flagged = (Button) v.findViewById(R.id.flagged);
|
||||
delete.setVisibility(View.GONE);
|
||||
flagged.setVisibility(View.VISIBLE);
|
||||
selected.setVisibility(View.GONE);
|
||||
}
|
||||
else if (flagged.getVisibility() == View.VISIBLE)
|
||||
{
|
||||
delete.setVisibility(View.GONE);
|
||||
flagged.setVisibility(View.GONE);
|
||||
selected.setVisibility(View.VISIBLE);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
// Delete was already visible
|
||||
delete.requestFocus();
|
||||
delete.setVisibility(View.VISIBLE);
|
||||
flagged.setVisibility(View.GONE);
|
||||
selected.setVisibility(View.GONE);
|
||||
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@ -1770,26 +1775,17 @@ public class MessageList extends K9ListActivity
|
||||
int subjectColor = holder.from.getCurrentTextColor(); // Get from another field that never changes color
|
||||
|
||||
|
||||
|
||||
holder.selected.setVisibility(View.GONE);
|
||||
holder.delete.setVisibility(View.GONE);
|
||||
holder.flagged.setVisibility(View.VISIBLE);
|
||||
|
||||
// XXX TODO there has to be some way to walk our view hierarchy and get this
|
||||
holder.flagged.setTag((Integer)position);
|
||||
holder.delete.setTag((Integer)position);
|
||||
|
||||
|
||||
|
||||
|
||||
if (message.flagged)
|
||||
{
|
||||
holder.flagged.setChecked(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
holder.flagged.setChecked(false);
|
||||
}
|
||||
|
||||
|
||||
holder.flagged.setChecked(message.flagged);
|
||||
holder.selected.setChecked(message.selected);
|
||||
|
||||
|
||||
if (message.downloaded)
|
||||
@ -1814,10 +1810,6 @@ public class MessageList extends K9ListActivity
|
||||
message.hasAttachments ? mAttachmentIcon : null, // right
|
||||
null); // bottom
|
||||
holder.position = position;
|
||||
if (holder.selected!=null)
|
||||
{
|
||||
holder.selected.setChecked(message.selected);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1829,10 +1821,7 @@ public class MessageList extends K9ListActivity
|
||||
holder.date.setText("No date");
|
||||
holder.from.setCompoundDrawablesWithIntrinsicBounds(null, null, null, null);
|
||||
holder.position = -1;
|
||||
if (holder.selected!=null)
|
||||
{
|
||||
holder.selected.setChecked(false);
|
||||
}
|
||||
holder.selected.setChecked(false);
|
||||
}
|
||||
return view;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user