Update history view

This commit is contained in:
Margaux Clerc 2015-09-18 18:38:10 +02:00
parent b7869d703e
commit 35204a3808
4 changed files with 66 additions and 90 deletions

View file

@ -6,6 +6,7 @@
android:orientation="vertical" > android:orientation="vertical" >
<RelativeLayout <RelativeLayout
android:id="@+id/top_bar"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="60dp" android:layout_height="60dp"
android:layout_gravity="top" android:layout_gravity="top"
@ -13,19 +14,17 @@
<RelativeLayout <RelativeLayout
android:id="@+id/all_calls_layout" android:id="@+id/all_calls_layout"
android:layout_width="wrap_content" android:layout_width="70dp"
android:layout_height="wrap_content" android:layout_height="match_parent">
android:adjustViewBounds="true">
<ImageView <ImageView
android:id="@+id/all_calls" android:id="@+id/all_calls"
android:src="@drawable/history_all" android:src="@drawable/history_all"
android:background="@drawable/toolbar_button" android:background="@drawable/toolbar_button"
android:contentDescription="@string/content_description_all_calls" android:contentDescription="@string/content_description_all_calls"
android:layout_alignParentLeft="true"
android:padding="10dp"
android:gravity="center" android:gravity="center"
android:layout_width="wrap_content" android:padding="15dp"
android:layout_width="match_parent"
android:layout_height="match_parent"/> android:layout_height="match_parent"/>
<RelativeLayout <RelativeLayout
@ -41,8 +40,8 @@
<RelativeLayout <RelativeLayout
android:layout_toRightOf="@id/all_calls_layout" android:layout_toRightOf="@id/all_calls_layout"
android:layout_width="wrap_content" android:layout_width="70dp"
android:layout_height="wrap_content" android:layout_height="match_parent"
android:adjustViewBounds="true"> android:adjustViewBounds="true">
<ImageView <ImageView
@ -50,9 +49,9 @@
android:src="@drawable/history_missed" android:src="@drawable/history_missed"
android:background="@drawable/toolbar_button" android:background="@drawable/toolbar_button"
android:contentDescription="@string/content_description_missed_calls" android:contentDescription="@string/content_description_missed_calls"
android:padding="10dp"
android:gravity="center" android:gravity="center"
android:layout_width="wrap_content" android:padding="15dp"
android:layout_width="match_parent"
android:layout_height="match_parent"/> android:layout_height="match_parent"/>
<RelativeLayout <RelativeLayout
@ -67,56 +66,19 @@
</RelativeLayout> </RelativeLayout>
<ImageView
android:id="@+id/delete"
android:src="@drawable/delete"
android:background="@drawable/toolbar_button"
android:contentDescription="@string/content_description_valid"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_alignParentRight="true"
android:padding="10dp"
android:adjustViewBounds="true"
android:visibility="gone"/>
<ImageView
android:id="@+id/select_all"
android:src="@drawable/select_all"
android:background="@drawable/toolbar_button"
android:contentDescription="@string/content_description_valid"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_toLeftOf="@id/delete"
android:padding="10dp"
android:adjustViewBounds="true"
android:visibility="gone"/>
<ImageView
android:id="@+id/deselect_all"
android:src="@drawable/deselect_all"
android:background="@drawable/toolbar_button"
android:contentDescription="@string/content_description_valid"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_toLeftOf="@id/delete"
android:padding="10dp"
android:adjustViewBounds="true"
android:visibility="gone"/>
<ImageView <ImageView
android:id="@+id/edit" android:id="@+id/edit"
android:src="@drawable/edit_list_button" android:src="@drawable/edit_list_button"
android:background="@drawable/toolbar_button" android:background="@drawable/toolbar_button"
android:contentDescription="@string/content_description_edit" android:contentDescription="@string/content_description_edit"
android:layout_width="wrap_content" android:layout_width="70dp"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_alignParentRight="true" android:layout_alignParentRight="true"
android:padding="10dp" android:padding="15dp"/>
android:adjustViewBounds="true"/>
</RelativeLayout> </RelativeLayout>
<include layout="@layout/edit_list"/>
<ListView <ListView
android:id="@+id/historyList" android:id="@+id/historyList"
android:layout_width="match_parent" android:layout_width="match_parent"

View file

@ -36,14 +36,15 @@
<RelativeLayout <RelativeLayout
android:id="@+id/avatar_layout" android:id="@+id/avatar_layout"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content"> android:layout_height="match_parent"
android:gravity="center">
<ImageView <ImageView
android:id="@+id/contact_picture" android:id="@+id/contact_picture"
android:src="@drawable/avatar" android:src="@drawable/avatar"
android:contentDescription="@string/content_description_contact_picture" android:contentDescription="@string/content_description_contact_picture"
android:layout_width="40dp" android:layout_width="35dp"
android:layout_height="40dp" android:layout_height="35dp"
android:adjustViewBounds="true" android:adjustViewBounds="true"
android:layout_alignParentLeft="true" android:layout_alignParentLeft="true"
android:layout_marginLeft="5dp"/> android:layout_marginLeft="5dp"/>
@ -52,40 +53,25 @@
android:id="@+id/mask" android:id="@+id/mask"
android:src="@drawable/avatar_mask" android:src="@drawable/avatar_mask"
android:contentDescription="@string/content_description_contact_picture" android:contentDescription="@string/content_description_contact_picture"
android:layout_width="40dp" android:layout_width="35dp"
android:layout_height="40dp" android:layout_height="35dp"
android:adjustViewBounds="true" android:adjustViewBounds="true"
android:layout_alignParentLeft="true" android:layout_alignParentLeft="true"
android:layout_marginLeft="5dp"/> android:layout_marginLeft="5dp"/>
</RelativeLayout> </RelativeLayout>
<ImageView <ImageView
android:id="@+id/icon" android:id="@+id/icon"
android:src="@drawable/call_status_incoming" android:src="@drawable/call_status_incoming"
android:contentDescription="@string/content_description_call_direction" android:contentDescription="@string/content_description_call_direction"
android:padding="5dp" android:padding="7dp"
android:layout_toRightOf="@id/avatar_layout" android:layout_toRightOf="@id/avatar_layout"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="match_parent" android:layout_height="match_parent"
android:adjustViewBounds="true" android:adjustViewBounds="true"
android:layout_marginLeft="5dp"/> android:layout_marginLeft="5dp"/>
<TextView
android:id="@+id/sip_uri"
style="@style/font6"
android:lines="1"
android:ellipsize="marquee"
android:marqueeRepeatLimit="marquee_forever"
android:scrollHorizontally="true"
android:fadingEdge="horizontal"
android:singleLine="true"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_toRightOf="@id/icon"
android:layout_marginLeft="10dp" />
<ImageView <ImageView
android:id="@+id/detail" android:id="@+id/detail"
android:src="@drawable/list_detail" android:src="@drawable/list_detail"
@ -104,9 +90,24 @@
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_alignParentRight="true"
android:layout_centerInParent="true"
android:visibility="gone" android:visibility="gone"
android:paddingLeft="5dp" android:padding="5dp" />
android:paddingRight="5dp" />
<TextView
android:id="@+id/sip_uri"
style="@style/font6"
android:lines="1"
android:ellipsize="marquee"
android:marqueeRepeatLimit="marquee_forever"
android:scrollHorizontally="true"
android:fadingEdge="horizontal"
android:singleLine="true"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_toRightOf="@id/icon"
android:layout_toLeftOf="@id/detail"
android:layout_marginLeft="10dp" />
</RelativeLayout> </RelativeLayout>

View file

@ -66,7 +66,7 @@ public class HistoryDetailFragment extends Fragment implements OnClickListener {
chat = (ImageView) view.findViewById(R.id.chat); chat = (ImageView) view.findViewById(R.id.chat);
chat.setOnClickListener(this); chat.setOnClickListener(this);
if (getResources().getBoolean(R.bool.disable_chat)) if (getResources().getBoolean(R.bool.disable_chat))
view.findViewById(R.id.chatRow).setVisibility(View.GONE); view.findViewById(R.id.chat).setVisibility(View.GONE);
addToContacts = (ImageView) view.findViewById(R.id.add_contact); addToContacts = (ImageView) view.findViewById(R.id.add_contact);
addToContacts.setOnClickListener(this); addToContacts.setOnClickListener(this);

View file

@ -60,8 +60,8 @@ public class HistoryFragment extends Fragment implements OnClickListener, OnItem
private ListView historyList; private ListView historyList;
private LayoutInflater mInflater; private LayoutInflater mInflater;
private TextView noCallHistory, noMissedCallHistory; private TextView noCallHistory, noMissedCallHistory;
private ImageView missedCalls, allCalls, edit, selectAll, deselectAll, delete; private ImageView missedCalls, allCalls, edit, selectAll, deselectAll, delete, cancel;
private RelativeLayout allCallsSelected, missedCallsSelected; private RelativeLayout allCallsSelected, missedCallsSelected, editList, topBar;
private boolean onlyDisplayMissedCalls, isEditMode; private boolean onlyDisplayMissedCalls, isEditMode;
private List<LinphoneCallLog> mLogs; private List<LinphoneCallLog> mLogs;
@ -79,7 +79,12 @@ public class HistoryFragment extends Fragment implements OnClickListener, OnItem
delete = (ImageView) view.findViewById(R.id.delete); delete = (ImageView) view.findViewById(R.id.delete);
delete.setOnClickListener(this); delete.setOnClickListener(this);
delete.setVisibility(View.INVISIBLE);
editList = (RelativeLayout) view.findViewById(R.id.edit_list);
topBar = (RelativeLayout) view.findViewById(R.id.top_bar);
cancel = (ImageView) view.findViewById(R.id.cancel);
cancel.setOnClickListener(this);
allCalls = (ImageView) view.findViewById(R.id.all_calls); allCalls = (ImageView) view.findViewById(R.id.all_calls);
allCalls.setOnClickListener(this); allCalls.setOnClickListener(this);
@ -193,7 +198,17 @@ public class HistoryFragment extends Fragment implements OnClickListener, OnItem
return; return;
} }
if (id == R.id.cancel) {
quitEditMode();
return;
}
if (id == R.id.delete) { if (id == R.id.delete) {
if(historyList.getCheckedItemCount() == 0) {
quitEditMode();
return;
}
final Dialog dialog = LinphoneActivity.instance().displayDialog(getString(R.string.delete_text)); final Dialog dialog = LinphoneActivity.instance().displayDialog(getString(R.string.delete_text));
Button delete = (Button) dialog.findViewById(R.id.delete); Button delete = (Button) dialog.findViewById(R.id.delete);
Button cancel = (Button) dialog.findViewById(R.id.cancel); Button cancel = (Button) dialog.findViewById(R.id.cancel);
@ -218,13 +233,6 @@ public class HistoryFragment extends Fragment implements OnClickListener, OnItem
return; return;
} }
if (id == R.id.edit) {
edit.setVisibility(View.GONE);
selectAll.setVisibility(View.VISIBLE);
delete.setVisibility(View.VISIBLE);
isEditMode = true;
}
if (id == R.id.all_calls) { if (id == R.id.all_calls) {
allCalls.setEnabled(false); allCalls.setEnabled(false);
allCallsSelected.setVisibility(View.VISIBLE); allCallsSelected.setVisibility(View.VISIBLE);
@ -241,6 +249,12 @@ public class HistoryFragment extends Fragment implements OnClickListener, OnItem
onlyDisplayMissedCalls = true; onlyDisplayMissedCalls = true;
} }
if (id == R.id.edit) {
topBar.setVisibility(View.GONE);
editList.setVisibility(View.VISIBLE);
isEditMode = true;
}
if (!hideHistoryListAndDisplayMessageIfEmpty()) { if (!hideHistoryListAndDisplayMessageIfEmpty()) {
historyList.setChoiceMode(AbsListView.CHOICE_MODE_MULTIPLE); historyList.setChoiceMode(AbsListView.CHOICE_MODE_MULTIPLE);
historyList.setAdapter(new CallHistoryAdapter(getActivity().getApplicationContext())); historyList.setAdapter(new CallHistoryAdapter(getActivity().getApplicationContext()));
@ -335,10 +349,9 @@ public class HistoryFragment extends Fragment implements OnClickListener, OnItem
public void quitEditMode(){ public void quitEditMode(){
isEditMode = false; isEditMode = false;
selectAll.setVisibility(View.GONE); editList.setVisibility(View.GONE);
deselectAll.setVisibility(View.GONE); topBar.setVisibility(View.VISIBLE);
delete.setVisibility(View.GONE);
edit.setVisibility(View.VISIBLE);
refresh(); refresh();
if (!hideHistoryListAndDisplayMessageIfEmpty()){ if (!hideHistoryListAndDisplayMessageIfEmpty()){
historyList.setChoiceMode(AbsListView.CHOICE_MODE_MULTIPLE); historyList.setChoiceMode(AbsListView.CHOICE_MODE_MULTIPLE);
@ -483,7 +496,7 @@ public class HistoryFragment extends Fragment implements OnClickListener, OnItem
historyList.setItemChecked(position, b); historyList.setItemChecked(position, b);
} }
}); });
holder.detail.setVisibility(View.GONE); holder.detail.setVisibility(View.INVISIBLE);
if(historyList.isItemChecked(position)) { if(historyList.isItemChecked(position)) {
holder.select.setChecked(true); holder.select.setChecked(true);
} else { } else {