Some text added under image buttons + animation for history delete all button like iOS

This commit is contained in:
Sylvain Berfini 2012-09-20 16:45:25 +02:00
parent ac6361fe2a
commit a5084da2c8
17 changed files with 296 additions and 71 deletions

View file

Before

Width:  |  Height:  |  Size: 305 B

After

Width:  |  Height:  |  Size: 305 B

View file

@ -2,8 +2,6 @@
<selector xmlns:android="http://schemas.android.com/apk/res/android"> <selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true" <item android:state_pressed="true"
android:drawable="@drawable/history_delete_over" /> android:drawable="@drawable/history_delete_over" />
<item android:state_enabled="false"
android:drawable="@drawable/history_delete_disabled" />
<item <item
android:drawable="@drawable/history_delete_default" /> android:drawable="@drawable/history_delete_default" />
</selector> </selector>

View file

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_enabled="false"
android:color="@color/text_button" />
<item android:color="@color/text_button_selected" />
</selector>

View file

@ -10,30 +10,42 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="horizontal"> android:orientation="horizontal">
<ImageView <TextView
android:contentDescription="@string/content_description_new_discussion" android:contentDescription="@string/content_description_new_discussion"
android:id="@+id/newDiscussion" android:id="@+id/newDiscussion"
android:src="@drawable/chat_new" android:background="@drawable/chat_new"
android:text="@string/button_new_chat"
android:gravity="center"
android:paddingTop="25dp"
android:textColor="@color/text_button"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:scaleType="centerCrop" android:scaleType="centerCrop"
android:adjustViewBounds="true" android:adjustViewBounds="true"
android:layout_weight="1"/> android:layout_weight="1"/>
<ImageView <TextView
android:contentDescription="@string/content_description_edit" android:contentDescription="@string/content_description_edit"
android:id="@+id/edit" android:id="@+id/edit"
android:src="@drawable/chat_edit" android:background="@drawable/chat_edit"
android:text="@string/button_edit"
android:gravity="center"
android:paddingTop="25dp"
android:textColor="@color/text_button"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:scaleType="centerCrop" android:scaleType="centerCrop"
android:adjustViewBounds="true" android:adjustViewBounds="true"
android:layout_weight="1"/> android:layout_weight="1"/>
<ImageView <TextView
android:contentDescription="@string/content_description_validate" android:contentDescription="@string/content_description_validate"
android:id="@+id/ok" android:id="@+id/ok"
android:src="@drawable/chat_ok" android:background="@drawable/chat_ok"
android:text="@string/button_ok"
android:gravity="center"
android:paddingTop="25dp"
android:textColor="@color/text_button"
android:visibility="gone" android:visibility="gone"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"

View file

@ -11,20 +11,28 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="horizontal"> android:orientation="horizontal">
<ImageView <TextView
android:contentDescription="@string/content_description_edit" android:contentDescription="@string/content_description_edit"
android:id="@+id/editContact" android:id="@+id/editContact"
android:src="@drawable/contact_edit" android:background="@drawable/contact_edit"
android:text="@string/button_edit"
android:gravity="center"
android:paddingTop="25dp"
android:textColor="@color/text_button"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:scaleType="centerCrop" android:scaleType="centerCrop"
android:adjustViewBounds="true" android:adjustViewBounds="true"
android:layout_weight="1"/> android:layout_weight="1"/>
<ImageView <TextView
android:contentDescription="@string/content_description_add_contact" android:contentDescription="@string/content_description_add_contact"
android:id="@+id/newContact" android:id="@+id/newContact"
android:src="@drawable/contact_add" android:background="@drawable/contact_add"
android:text="@string/button_add_contact"
android:gravity="center"
android:paddingTop="25dp"
android:textColor="@color/text_button"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:scaleType="centerCrop" android:scaleType="centerCrop"

View file

@ -10,30 +10,42 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="horizontal"> android:orientation="horizontal">
<ImageView <TextView
android:contentDescription="@string/content_description_all_contacts" android:contentDescription="@string/content_description_all_contacts"
android:id="@+id/allContacts" android:id="@+id/allContacts"
android:src="@drawable/all_contacts" android:background="@drawable/all_contacts"
android:text="@string/button_all_contacts"
android:gravity="center"
android:paddingTop="25dp"
android:textColor="@drawable/switch_button_text_color"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:scaleType="centerCrop" android:scaleType="centerCrop"
android:adjustViewBounds="true" android:adjustViewBounds="true"
android:layout_weight="1"/> android:layout_weight="1"/>
<ImageView <TextView
android:contentDescription="@string/content_description_linphone_contacts" android:contentDescription="@string/content_description_linphone_contacts"
android:id="@+id/linphoneContacts" android:id="@+id/linphoneContacts"
android:src="@drawable/linphone_contacts" android:background="@drawable/linphone_contacts"
android:text="@string/button_sip_contacts"
android:gravity="center"
android:paddingTop="25dp"
android:textColor="@drawable/switch_button_text_color"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:scaleType="centerCrop" android:scaleType="centerCrop"
android:adjustViewBounds="true" android:adjustViewBounds="true"
android:layout_weight="1"/> android:layout_weight="1"/>
<ImageView <TextView
android:contentDescription="@string/content_description_add_contact" android:contentDescription="@string/content_description_add_contact"
android:id="@+id/newContact" android:id="@+id/newContact"
android:src="@drawable/new_contact" android:background="@drawable/new_contact"
android:text="@string/button_add_contact"
android:gravity="center"
android:paddingTop="25dp"
android:textColor="@color/text_button"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:scaleType="centerCrop" android:scaleType="centerCrop"

View file

@ -8,52 +8,73 @@
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="horizontal"> android:orientation="horizontal"
android:background="@drawable/toolsbar_background">
<ImageView <TextView
android:contentDescription="@string/content_description_delete" android:contentDescription="@string/content_description_delete"
android:id="@+id/deleteAll" android:id="@+id/deleteAll"
android:src="@drawable/history_delete" android:background="@drawable/history_delete"
android:text="@string/button_delete_all"
android:gravity="center"
android:paddingTop="25dp"
android:textColor="@color/text_button"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:scaleType="centerCrop" android:scaleType="centerCrop"
android:adjustViewBounds="true" android:adjustViewBounds="true"
android:layout_weight="1"/> android:layout_weight="1"/>
<ImageView <TextView
android:contentDescription="@string/content_description_all_calls" android:contentDescription="@string/content_description_all_calls"
android:id="@+id/allCalls" android:id="@+id/allCalls"
android:src="@drawable/history_all" android:background="@drawable/history_all"
android:text="@string/button_all_call"
android:gravity="center"
android:paddingTop="20dp"
android:textColor="@drawable/switch_button_text_color"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:scaleType="centerCrop" android:scaleType="centerCrop"
android:adjustViewBounds="true" android:adjustViewBounds="true"
android:layout_weight="1"/> android:layout_weight="1"/>
<ImageView <TextView
android:contentDescription="@string/content_description_missed_calls" android:contentDescription="@string/content_description_missed_calls"
android:id="@+id/missedCalls" android:id="@+id/missedCalls"
android:src="@drawable/history_missed" android:background="@drawable/history_missed"
android:text="@string/button_missed_call"
android:gravity="center"
android:paddingTop="20dp"
android:textColor="@drawable/switch_button_text_color"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:scaleType="centerCrop" android:scaleType="centerCrop"
android:adjustViewBounds="true" android:adjustViewBounds="true"
android:layout_weight="1"/> android:layout_weight="1"/>
<ImageView <TextView
android:contentDescription="@string/content_description_edit" android:contentDescription="@string/content_description_edit"
android:id="@+id/edit" android:id="@+id/edit"
android:src="@drawable/history_edit" android:background="@drawable/history_edit"
android:text="@string/button_edit"
android:gravity="center"
android:paddingTop="25dp"
android:textColor="@color/text_button"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:scaleType="centerCrop" android:scaleType="centerCrop"
android:adjustViewBounds="true" android:adjustViewBounds="true"
android:layout_weight="1"/> android:layout_weight="1"/>
<ImageView <TextView
android:contentDescription="@string/content_description_validate" android:contentDescription="@string/content_description_validate"
android:id="@+id/ok" android:id="@+id/ok"
android:src="@drawable/history_ok" android:background="@drawable/history_ok"
android:text="@string/button_ok"
android:gravity="center"
android:paddingTop="25dp"
android:textColor="@color/text_button"
android:visibility="gone" android:visibility="gone"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"

View file

@ -8,52 +8,73 @@
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="horizontal"> android:orientation="horizontal"
android:background="@drawable/toolsbar_background">
<ImageView <TextView
android:contentDescription="@string/content_description_delete" android:contentDescription="@string/content_description_delete"
android:id="@+id/deleteAll" android:id="@+id/deleteAll"
android:src="@drawable/history_delete" android:background="@drawable/history_delete"
android:text="@string/button_delete_all"
android:gravity="center"
android:paddingTop="25dp"
android:textColor="@color/text_button"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:scaleType="centerCrop" android:scaleType="centerCrop"
android:adjustViewBounds="true" android:adjustViewBounds="true"
android:layout_weight="1"/> android:layout_weight="1"/>
<ImageView <TextView
android:contentDescription="@string/content_description_all_calls" android:contentDescription="@string/content_description_all_calls"
android:id="@+id/allCalls" android:id="@+id/allCalls"
android:src="@drawable/history_all" android:background="@drawable/history_all"
android:text="@string/button_all_call"
android:gravity="center"
android:paddingTop="20dp"
android:textColor="@drawable/switch_button_text_color"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:scaleType="centerCrop" android:scaleType="centerCrop"
android:adjustViewBounds="true" android:adjustViewBounds="true"
android:layout_weight="1"/> android:layout_weight="1"/>
<ImageView <TextView
android:contentDescription="@string/content_description_missed_calls" android:contentDescription="@string/content_description_missed_calls"
android:id="@+id/missedCalls" android:id="@+id/missedCalls"
android:src="@drawable/history_missed" android:background="@drawable/history_missed"
android:text="@string/button_missed_call"
android:gravity="center"
android:paddingTop="20dp"
android:textColor="@drawable/switch_button_text_color"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:scaleType="centerCrop" android:scaleType="centerCrop"
android:adjustViewBounds="true" android:adjustViewBounds="true"
android:layout_weight="1"/> android:layout_weight="1"/>
<ImageView <TextView
android:contentDescription="@string/content_description_edit" android:contentDescription="@string/content_description_edit"
android:id="@+id/edit" android:id="@+id/edit"
android:src="@drawable/history_edit" android:background="@drawable/history_edit"
android:text="@string/button_edit"
android:gravity="center"
android:paddingTop="25dp"
android:textColor="@color/text_button"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:scaleType="centerCrop" android:scaleType="centerCrop"
android:adjustViewBounds="true" android:adjustViewBounds="true"
android:layout_weight="1"/> android:layout_weight="1"/>
<ImageView <TextView
android:contentDescription="@string/content_description_validate" android:contentDescription="@string/content_description_validate"
android:id="@+id/ok" android:id="@+id/ok"
android:src="@drawable/history_ok" android:background="@drawable/history_ok"
android:text="@string/button_ok"
android:gravity="center"
android:paddingTop="25dp"
android:textColor="@color/text_button"
android:visibility="gone" android:visibility="gone"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"

View file

@ -272,6 +272,16 @@
<string name="button_setup_cancel">Annuler</string> <string name="button_setup_cancel">Annuler</string>
<string name="button_setup_back">Retour</string> <string name="button_setup_back">Retour</string>
<string name="button_setup_next">Allons-y</string> <string name="button_setup_next">Allons-y</string>
<string name="button_new_chat">Nouveau chat</string>
<string name="button_edit">Modifier</string>
<string name="button_ok">Valider</string>
<string name="button_all_contacts">Tous</string>
<string name="button_sip_contacts">SIP</string>
<string name="button_add_contact">Nouveau contact</string>
<string name="button_all_call">Tous</string>
<string name="button_missed_call">Manqués</string>
<string name="button_delete_all">Tout supprimer</string>
<string name="share_picture_size_small">Petite</string> <string name="share_picture_size_small">Petite</string>
<string name="share_picture_size_medium">Moyenne</string> <string name="share_picture_size_medium">Moyenne</string>

View file

@ -6,6 +6,8 @@
<color name="text_over">#ffb9c4cb</color> <color name="text_over">#ffb9c4cb</color>
<color name="text_default">#ff5b656f</color> <color name="text_default">#ff5b656f</color>
<color name="text_header">#ff7e8e9e</color> <color name="text_header">#ff7e8e9e</color>
<color name="text_button">#ff41484f</color>
<color name="text_button_selected">#ffa6b3bf</color>
<color name="numpad_background_bottom">#ffe4edf2</color> <color name="numpad_background_bottom">#ffe4edf2</color>
<color name="numpad_background_dialer">#ffd8d8d8</color> <color name="numpad_background_dialer">#ffd8d8d8</color>

View file

@ -323,6 +323,16 @@
<string name="button_setup_cancel">Cancel</string> <string name="button_setup_cancel">Cancel</string>
<string name="button_setup_back">Back</string> <string name="button_setup_back">Back</string>
<string name="button_setup_next">Let\'s go</string> <string name="button_setup_next">Let\'s go</string>
<string name="button_new_chat">New conversation</string>
<string name="button_edit">Edit</string>
<string name="button_ok">Okay</string>
<string name="button_all_contacts">All</string>
<string name="button_sip_contacts">SIP</string>
<string name="button_add_contact">New contact</string>
<string name="button_all_call">All</string>
<string name="button_missed_call">Missed</string>
<string name="button_delete_all">Delete All</string>
<string name="share_picture_size_small">Small</string> <string name="share_picture_size_small">Small</string>
<string name="share_picture_size_medium">Medium</string> <string name="share_picture_size_medium">Medium</string>

View file

@ -47,7 +47,7 @@ public class ChatListFragment extends Fragment implements OnClickListener, OnIte
private LayoutInflater mInflater; private LayoutInflater mInflater;
private List<String> mConversations, mDrafts; private List<String> mConversations, mDrafts;
private ListView chatList; private ListView chatList;
private ImageView edit, ok, newDiscussion; private TextView edit, ok, newDiscussion;
private EditText fastNewChat; private EditText fastNewChat;
private boolean isEditMode = false; private boolean isEditMode = false;
@ -61,11 +61,11 @@ public class ChatListFragment extends Fragment implements OnClickListener, OnIte
chatList.setOnItemClickListener(this); chatList.setOnItemClickListener(this);
registerForContextMenu(chatList); registerForContextMenu(chatList);
edit = (ImageView) view.findViewById(R.id.edit); edit = (TextView) view.findViewById(R.id.edit);
edit.setOnClickListener(this); edit.setOnClickListener(this);
newDiscussion = (ImageView) view.findViewById(R.id.newDiscussion); newDiscussion = (TextView) view.findViewById(R.id.newDiscussion);
newDiscussion.setOnClickListener(this); newDiscussion.setOnClickListener(this);
ok = (ImageView) view.findViewById(R.id.ok); ok = (TextView) view.findViewById(R.id.ok);
ok.setOnClickListener(this); ok.setOnClickListener(this);
fastNewChat = (EditText) view.findViewById(R.id.newFastChat); fastNewChat = (EditText) view.findViewById(R.id.newFastChat);

View file

@ -30,7 +30,6 @@ import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.View.OnClickListener; import android.view.View.OnClickListener;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TableLayout; import android.widget.TableLayout;
import android.widget.TextView; import android.widget.TextView;
@ -39,7 +38,7 @@ import android.widget.TextView;
*/ */
public class ContactFragment extends Fragment implements OnClickListener { public class ContactFragment extends Fragment implements OnClickListener {
private Contact contact; private Contact contact;
private ImageView editContact, newContact; private TextView editContact, newContact;
private LayoutInflater inflater; private LayoutInflater inflater;
private View view; private View view;
@ -64,9 +63,9 @@ public class ContactFragment extends Fragment implements OnClickListener {
this.inflater = inflater; this.inflater = inflater;
view = inflater.inflate(R.layout.contact, container, false); view = inflater.inflate(R.layout.contact, container, false);
editContact = (ImageView) view.findViewById(R.id.editContact); editContact = (TextView) view.findViewById(R.id.editContact);
editContact.setOnClickListener(this); editContact.setOnClickListener(this);
newContact = (ImageView) view.findViewById(R.id.newContact); newContact = (TextView) view.findViewById(R.id.newContact);
newContact.setOnClickListener(this); newContact.setOnClickListener(this);
return view; return view;

View file

@ -47,7 +47,7 @@ import android.widget.TextView;
public class ContactsFragment extends Fragment implements OnClickListener, OnItemClickListener { public class ContactsFragment extends Fragment implements OnClickListener, OnItemClickListener {
private LayoutInflater mInflater; private LayoutInflater mInflater;
private ListView contactsList; private ListView contactsList;
private ImageView allContacts, linphoneContacts, newContact; private TextView allContacts, linphoneContacts, newContact;
private boolean onlyDisplayLinphoneContacts; private boolean onlyDisplayLinphoneContacts;
private int lastKnownPosition; private int lastKnownPosition;
private AlphabetIndexer indexer; private AlphabetIndexer indexer;
@ -68,13 +68,13 @@ public class ContactsFragment extends Fragment implements OnClickListener, OnIte
contactsList = (ListView) view.findViewById(R.id.contactsList); contactsList = (ListView) view.findViewById(R.id.contactsList);
contactsList.setOnItemClickListener(this); contactsList.setOnItemClickListener(this);
allContacts = (ImageView) view.findViewById(R.id.allContacts); allContacts = (TextView) view.findViewById(R.id.allContacts);
allContacts.setOnClickListener(this); allContacts.setOnClickListener(this);
linphoneContacts = (ImageView) view.findViewById(R.id.linphoneContacts); linphoneContacts = (TextView) view.findViewById(R.id.linphoneContacts);
linphoneContacts.setOnClickListener(this); linphoneContacts.setOnClickListener(this);
newContact = (ImageView) view.findViewById(R.id.newContact); newContact = (TextView) view.findViewById(R.id.newContact);
newContact.setOnClickListener(this); newContact.setOnClickListener(this);
newContact.setEnabled(LinphoneManager.getLc().getCallsNb() == 0); newContact.setEnabled(LinphoneManager.getLc().getCallsNb() == 0);

View file

@ -38,6 +38,9 @@ import android.view.ContextMenu.ContextMenuInfo;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.View.OnClickListener; import android.view.View.OnClickListener;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.view.animation.Animation.AnimationListener;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.BaseExpandableListAdapter; import android.widget.BaseExpandableListAdapter;
import android.widget.ExpandableListView; import android.widget.ExpandableListView;
@ -53,7 +56,7 @@ public class HistoryFragment extends Fragment implements OnClickListener, OnChil
private Handler mHandler = new Handler(); private Handler mHandler = new Handler();
private ExpandableListView historyList; private ExpandableListView historyList;
private LayoutInflater mInflater; private LayoutInflater mInflater;
private ImageView allCalls, missedCalls, edit, ok, deleteAll; private TextView allCalls, missedCalls, edit, ok, deleteAll;
private boolean onlyDisplayMissedCalls, isEditMode; private boolean onlyDisplayMissedCalls, isEditMode;
private SparseArray<List<LinphoneCallLog>> mLogs; private SparseArray<List<LinphoneCallLog>> mLogs;
@ -67,23 +70,23 @@ public class HistoryFragment extends Fragment implements OnClickListener, OnChil
historyList.setOnChildClickListener(this); historyList.setOnChildClickListener(this);
historyList.setOnGroupClickListener(this); historyList.setOnGroupClickListener(this);
deleteAll = (ImageView) view.findViewById(R.id.deleteAll); deleteAll = (TextView) view.findViewById(R.id.deleteAll);
deleteAll.setOnClickListener(this); deleteAll.setOnClickListener(this);
deleteAll.setEnabled(false); deleteAll.setVisibility(View.INVISIBLE);
allCalls = (ImageView) view.findViewById(R.id.allCalls); allCalls = (TextView) view.findViewById(R.id.allCalls);
allCalls.setOnClickListener(this); allCalls.setOnClickListener(this);
missedCalls = (ImageView) view.findViewById(R.id.missedCalls); missedCalls = (TextView) view.findViewById(R.id.missedCalls);
missedCalls.setOnClickListener(this); missedCalls.setOnClickListener(this);
allCalls.setEnabled(false); allCalls.setEnabled(false);
onlyDisplayMissedCalls = false; onlyDisplayMissedCalls = false;
edit = (ImageView) view.findViewById(R.id.edit); edit = (TextView) view.findViewById(R.id.edit);
edit.setOnClickListener(this); edit.setOnClickListener(this);
ok = (ImageView) view.findViewById(R.id.ok); ok = (TextView) view.findViewById(R.id.ok);
ok.setOnClickListener(this); ok.setOnClickListener(this);
return view; return view;
@ -195,13 +198,13 @@ public class HistoryFragment extends Fragment implements OnClickListener, OnChil
else if (id == R.id.ok) { else if (id == R.id.ok) {
edit.setVisibility(View.VISIBLE); edit.setVisibility(View.VISIBLE);
ok.setVisibility(View.GONE); ok.setVisibility(View.GONE);
deleteAll.setEnabled(false); hideDeleteAllButton();
isEditMode = false; isEditMode = false;
} }
else if (id == R.id.edit) { else if (id == R.id.edit) {
edit.setVisibility(View.GONE); edit.setVisibility(View.GONE);
ok.setVisibility(View.VISIBLE); ok.setVisibility(View.VISIBLE);
deleteAll.setEnabled(true); showDeleteAllButton();
isEditMode = true; isEditMode = true;
} }
else if (id == R.id.deleteAll) { else if (id == R.id.deleteAll) {
@ -247,6 +250,66 @@ public class HistoryFragment extends Fragment implements OnClickListener, OnChil
return false; return false;
} }
private void hideDeleteAllButton() {
if (deleteAll == null || deleteAll.getVisibility() != View.VISIBLE) {
return;
}
if (getActivity().getResources().getBoolean(R.bool.disable_animations)) {
deleteAll.setVisibility(View.INVISIBLE);
} else {
Animation animation = AnimationUtils.loadAnimation(getActivity(), R.anim.slide_out_right_to_left);
animation.setAnimationListener(new AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
}
@Override
public void onAnimationRepeat(Animation animation) {
}
@Override
public void onAnimationEnd(Animation animation) {
deleteAll.setVisibility(View.INVISIBLE);
animation.setAnimationListener(null);
}
});
deleteAll.startAnimation(animation);
}
}
private void showDeleteAllButton() {
if (deleteAll == null || deleteAll.getVisibility() == View.VISIBLE) {
return;
}
if (getActivity().getResources().getBoolean(R.bool.disable_animations)) {
deleteAll.setVisibility(View.VISIBLE);
} else {
Animation animation = AnimationUtils.loadAnimation(getActivity(), R.anim.slide_in_left_to_right);
animation.setAnimationListener(new AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
}
@Override
public void onAnimationRepeat(Animation animation) {
}
@Override
public void onAnimationEnd(Animation animation) {
deleteAll.setVisibility(View.VISIBLE);
animation.setAnimationListener(null);
}
});
deleteAll.startAnimation(animation);
}
}
class CallHistoryAdapter extends BaseExpandableListAdapter { class CallHistoryAdapter extends BaseExpandableListAdapter {
private Bitmap missedCall, outgoingCall, incomingCall; private Bitmap missedCall, outgoingCall, incomingCall;

View file

@ -38,6 +38,9 @@ import android.view.MenuItem;
import android.view.View; import android.view.View;
import android.view.View.OnClickListener; import android.view.View.OnClickListener;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.view.animation.Animation;
import android.view.animation.Animation.AnimationListener;
import android.view.animation.AnimationUtils;
import android.widget.AdapterView; import android.widget.AdapterView;
import android.widget.AdapterView.AdapterContextMenuInfo; import android.widget.AdapterView.AdapterContextMenuInfo;
import android.widget.AdapterView.OnItemClickListener; import android.widget.AdapterView.OnItemClickListener;
@ -52,7 +55,7 @@ import android.widget.TextView;
public class HistorySimpleFragment extends Fragment implements OnClickListener, OnItemClickListener { public class HistorySimpleFragment extends Fragment implements OnClickListener, OnItemClickListener {
private ListView historyList; private ListView historyList;
private LayoutInflater mInflater; private LayoutInflater mInflater;
private ImageView allCalls, missedCalls, edit, ok, deleteAll; private TextView allCalls, missedCalls, edit, ok, deleteAll;
private boolean onlyDisplayMissedCalls, isEditMode; private boolean onlyDisplayMissedCalls, isEditMode;
private List<LinphoneCallLog> mLogs; private List<LinphoneCallLog> mLogs;
@ -66,23 +69,23 @@ public class HistorySimpleFragment extends Fragment implements OnClickListener,
historyList.setOnItemClickListener(this); historyList.setOnItemClickListener(this);
registerForContextMenu(historyList); registerForContextMenu(historyList);
deleteAll = (ImageView) view.findViewById(R.id.deleteAll); deleteAll = (TextView) view.findViewById(R.id.deleteAll);
deleteAll.setOnClickListener(this); deleteAll.setOnClickListener(this);
deleteAll.setEnabled(false); deleteAll.setVisibility(View.INVISIBLE);
allCalls = (ImageView) view.findViewById(R.id.allCalls); allCalls = (TextView) view.findViewById(R.id.allCalls);
allCalls.setOnClickListener(this); allCalls.setOnClickListener(this);
missedCalls = (ImageView) view.findViewById(R.id.missedCalls); missedCalls = (TextView) view.findViewById(R.id.missedCalls);
missedCalls.setOnClickListener(this); missedCalls.setOnClickListener(this);
allCalls.setEnabled(false); allCalls.setEnabled(false);
onlyDisplayMissedCalls = false; onlyDisplayMissedCalls = false;
edit = (ImageView) view.findViewById(R.id.edit); edit = (TextView) view.findViewById(R.id.edit);
edit.setOnClickListener(this); edit.setOnClickListener(this);
ok = (ImageView) view.findViewById(R.id.ok); ok = (TextView) view.findViewById(R.id.ok);
ok.setOnClickListener(this); ok.setOnClickListener(this);
return view; return view;
@ -133,13 +136,13 @@ public class HistorySimpleFragment extends Fragment implements OnClickListener,
else if (id == R.id.ok) { else if (id == R.id.ok) {
edit.setVisibility(View.VISIBLE); edit.setVisibility(View.VISIBLE);
ok.setVisibility(View.GONE); ok.setVisibility(View.GONE);
deleteAll.setEnabled(false); hideDeleteAllButton();
isEditMode = false; isEditMode = false;
} }
else if (id == R.id.edit) { else if (id == R.id.edit) {
edit.setVisibility(View.GONE); edit.setVisibility(View.GONE);
ok.setVisibility(View.VISIBLE); ok.setVisibility(View.VISIBLE);
deleteAll.setEnabled(true); showDeleteAllButton();
isEditMode = true; isEditMode = true;
} }
else if (id == R.id.deleteAll) { else if (id == R.id.deleteAll) {
@ -172,6 +175,66 @@ public class HistorySimpleFragment extends Fragment implements OnClickListener,
} }
} }
private void hideDeleteAllButton() {
if (deleteAll == null || deleteAll.getVisibility() != View.VISIBLE) {
return;
}
if (getActivity().getResources().getBoolean(R.bool.disable_animations)) {
deleteAll.setVisibility(View.INVISIBLE);
} else {
Animation animation = AnimationUtils.loadAnimation(getActivity(), R.anim.slide_out_right_to_left);
animation.setAnimationListener(new AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
}
@Override
public void onAnimationRepeat(Animation animation) {
}
@Override
public void onAnimationEnd(Animation animation) {
deleteAll.setVisibility(View.INVISIBLE);
animation.setAnimationListener(null);
}
});
deleteAll.startAnimation(animation);
}
}
private void showDeleteAllButton() {
if (deleteAll == null || deleteAll.getVisibility() == View.VISIBLE) {
return;
}
if (getActivity().getResources().getBoolean(R.bool.disable_animations)) {
deleteAll.setVisibility(View.VISIBLE);
} else {
Animation animation = AnimationUtils.loadAnimation(getActivity(), R.anim.slide_in_left_to_right);
animation.setAnimationListener(new AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
}
@Override
public void onAnimationRepeat(Animation animation) {
}
@Override
public void onAnimationEnd(Animation animation) {
deleteAll.setVisibility(View.VISIBLE);
animation.setAnimationListener(null);
}
});
deleteAll.startAnimation(animation);
}
}
class CallHistoryAdapter extends BaseAdapter { class CallHistoryAdapter extends BaseAdapter {
private Bitmap missedCall, outgoingCall, incomingCall; private Bitmap missedCall, outgoingCall, incomingCall;

View file

@ -59,7 +59,6 @@ import android.support.v4.app.Fragment;
import android.support.v4.app.Fragment.SavedState; import android.support.v4.app.Fragment.SavedState;
import android.support.v4.app.FragmentActivity; import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentManager.BackStackEntry;
import android.support.v4.app.FragmentTransaction; import android.support.v4.app.FragmentTransaction;
import android.view.Gravity; import android.view.Gravity;
import android.view.KeyEvent; import android.view.KeyEvent;