Improved interface for fast new chat field

This commit is contained in:
Sylvain Berfini 2012-09-20 18:10:56 +02:00
parent c8fe3f1d98
commit 1358258d72
3 changed files with 39 additions and 7 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

View file

@ -55,14 +55,36 @@
</LinearLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:contentDescription="@string/content_description_cancel"
android:id="@+id/clearFastChatField"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
android:src="@drawable/list_delete"
android:layout_centerVertical="true"
android:layout_alignParentRight="true"
android:paddingLeft="5dp"
android:paddingRight="5dp"/>
<EditText
android:id="@+id/newFastChat"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/new_fast_chat"
android:textColor="@android:color/black"
android:background="@drawable/chat_fast_address_background"
android:gravity="center"
android:layout_toLeftOf="@id/clearFastChatField"
android:paddingRight="5dp"
android:inputType="textEmailAddress"/>
</RelativeLayout>
<ListView
android:id="@+id/chatList"
android:layout_width="match_parent"

View file

@ -48,6 +48,7 @@ public class ChatListFragment extends Fragment implements OnClickListener, OnIte
private List<String> mConversations, mDrafts;
private ListView chatList;
private TextView edit, ok, newDiscussion;
private ImageView clearFastChat;
private EditText fastNewChat;
private boolean isEditMode = false;
@ -63,12 +64,18 @@ public class ChatListFragment extends Fragment implements OnClickListener, OnIte
edit = (TextView) view.findViewById(R.id.edit);
edit.setOnClickListener(this);
newDiscussion = (TextView) view.findViewById(R.id.newDiscussion);
newDiscussion.setOnClickListener(this);
ok = (TextView) view.findViewById(R.id.ok);
ok.setOnClickListener(this);
clearFastChat = (ImageView) view.findViewById(R.id.clearFastChatField);
clearFastChat.setOnClickListener(this);
fastNewChat = (EditText) view.findViewById(R.id.newFastChat);
return view;
}
@ -112,7 +119,10 @@ public class ChatListFragment extends Fragment implements OnClickListener, OnIte
public void onClick(View v) {
int id = v.getId();
if (id == R.id.ok) {
if (id == R.id.clearFastChatField) {
fastNewChat.setText("");
}
else if (id == R.id.ok) {
edit.setVisibility(View.VISIBLE);
ok.setVisibility(View.GONE);
isEditMode = false;