Update history view
This commit is contained in:
parent
b7869d703e
commit
35204a3808
4 changed files with 66 additions and 90 deletions
|
@ -6,6 +6,7 @@
|
|||
android:orientation="vertical" >
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/top_bar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="60dp"
|
||||
android:layout_gravity="top"
|
||||
|
@ -13,19 +14,17 @@
|
|||
|
||||
<RelativeLayout
|
||||
android:id="@+id/all_calls_layout"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:adjustViewBounds="true">
|
||||
android:layout_width="70dp"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/all_calls"
|
||||
android:src="@drawable/history_all"
|
||||
android:background="@drawable/toolbar_button"
|
||||
android:contentDescription="@string/content_description_all_calls"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:padding="10dp"
|
||||
android:gravity="center"
|
||||
android:layout_width="wrap_content"
|
||||
android:padding="15dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"/>
|
||||
|
||||
<RelativeLayout
|
||||
|
@ -41,8 +40,8 @@
|
|||
|
||||
<RelativeLayout
|
||||
android:layout_toRightOf="@id/all_calls_layout"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="70dp"
|
||||
android:layout_height="match_parent"
|
||||
android:adjustViewBounds="true">
|
||||
|
||||
<ImageView
|
||||
|
@ -50,9 +49,9 @@
|
|||
android:src="@drawable/history_missed"
|
||||
android:background="@drawable/toolbar_button"
|
||||
android:contentDescription="@string/content_description_missed_calls"
|
||||
android:padding="10dp"
|
||||
android:gravity="center"
|
||||
android:layout_width="wrap_content"
|
||||
android:padding="15dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"/>
|
||||
|
||||
<RelativeLayout
|
||||
|
@ -67,56 +66,19 @@
|
|||
|
||||
</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
|
||||
android:id="@+id/edit"
|
||||
android:src="@drawable/edit_list_button"
|
||||
android:background="@drawable/toolbar_button"
|
||||
android:contentDescription="@string/content_description_edit"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_width="70dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_alignParentRight="true"
|
||||
android:padding="10dp"
|
||||
android:adjustViewBounds="true"/>
|
||||
|
||||
android:padding="15dp"/>
|
||||
</RelativeLayout>
|
||||
|
||||
<include layout="@layout/edit_list"/>
|
||||
|
||||
<ListView
|
||||
android:id="@+id/historyList"
|
||||
android:layout_width="match_parent"
|
||||
|
|
|
@ -36,14 +36,15 @@
|
|||
<RelativeLayout
|
||||
android:id="@+id/avatar_layout"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content">
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/contact_picture"
|
||||
android:src="@drawable/avatar"
|
||||
android:contentDescription="@string/content_description_contact_picture"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp"
|
||||
android:layout_width="35dp"
|
||||
android:layout_height="35dp"
|
||||
android:adjustViewBounds="true"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_marginLeft="5dp"/>
|
||||
|
@ -52,40 +53,25 @@
|
|||
android:id="@+id/mask"
|
||||
android:src="@drawable/avatar_mask"
|
||||
android:contentDescription="@string/content_description_contact_picture"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp"
|
||||
android:layout_width="35dp"
|
||||
android:layout_height="35dp"
|
||||
android:adjustViewBounds="true"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_marginLeft="5dp"/>
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/icon"
|
||||
android:src="@drawable/call_status_incoming"
|
||||
android:contentDescription="@string/content_description_call_direction"
|
||||
android:padding="5dp"
|
||||
android:padding="7dp"
|
||||
android:layout_toRightOf="@id/avatar_layout"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:adjustViewBounds="true"
|
||||
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
|
||||
android:id="@+id/detail"
|
||||
android:src="@drawable/list_detail"
|
||||
|
@ -104,9 +90,24 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_centerInParent="true"
|
||||
android:visibility="gone"
|
||||
android:paddingLeft="5dp"
|
||||
android:paddingRight="5dp" />
|
||||
android:padding="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>
|
||||
|
||||
|
|
|
@ -66,7 +66,7 @@ public class HistoryDetailFragment extends Fragment implements OnClickListener {
|
|||
chat = (ImageView) view.findViewById(R.id.chat);
|
||||
chat.setOnClickListener(this);
|
||||
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.setOnClickListener(this);
|
||||
|
|
|
@ -60,8 +60,8 @@ public class HistoryFragment extends Fragment implements OnClickListener, OnItem
|
|||
private ListView historyList;
|
||||
private LayoutInflater mInflater;
|
||||
private TextView noCallHistory, noMissedCallHistory;
|
||||
private ImageView missedCalls, allCalls, edit, selectAll, deselectAll, delete;
|
||||
private RelativeLayout allCallsSelected, missedCallsSelected;
|
||||
private ImageView missedCalls, allCalls, edit, selectAll, deselectAll, delete, cancel;
|
||||
private RelativeLayout allCallsSelected, missedCallsSelected, editList, topBar;
|
||||
private boolean onlyDisplayMissedCalls, isEditMode;
|
||||
private List<LinphoneCallLog> mLogs;
|
||||
|
||||
|
@ -79,7 +79,12 @@ public class HistoryFragment extends Fragment implements OnClickListener, OnItem
|
|||
|
||||
delete = (ImageView) view.findViewById(R.id.delete);
|
||||
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.setOnClickListener(this);
|
||||
|
@ -193,7 +198,17 @@ public class HistoryFragment extends Fragment implements OnClickListener, OnItem
|
|||
return;
|
||||
}
|
||||
|
||||
if (id == R.id.cancel) {
|
||||
quitEditMode();
|
||||
return;
|
||||
}
|
||||
|
||||
if (id == R.id.delete) {
|
||||
if(historyList.getCheckedItemCount() == 0) {
|
||||
quitEditMode();
|
||||
return;
|
||||
}
|
||||
|
||||
final Dialog dialog = LinphoneActivity.instance().displayDialog(getString(R.string.delete_text));
|
||||
Button delete = (Button) dialog.findViewById(R.id.delete);
|
||||
Button cancel = (Button) dialog.findViewById(R.id.cancel);
|
||||
|
@ -218,13 +233,6 @@ public class HistoryFragment extends Fragment implements OnClickListener, OnItem
|
|||
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) {
|
||||
allCalls.setEnabled(false);
|
||||
allCallsSelected.setVisibility(View.VISIBLE);
|
||||
|
@ -241,6 +249,12 @@ public class HistoryFragment extends Fragment implements OnClickListener, OnItem
|
|||
onlyDisplayMissedCalls = true;
|
||||
}
|
||||
|
||||
if (id == R.id.edit) {
|
||||
topBar.setVisibility(View.GONE);
|
||||
editList.setVisibility(View.VISIBLE);
|
||||
isEditMode = true;
|
||||
}
|
||||
|
||||
if (!hideHistoryListAndDisplayMessageIfEmpty()) {
|
||||
historyList.setChoiceMode(AbsListView.CHOICE_MODE_MULTIPLE);
|
||||
historyList.setAdapter(new CallHistoryAdapter(getActivity().getApplicationContext()));
|
||||
|
@ -335,10 +349,9 @@ public class HistoryFragment extends Fragment implements OnClickListener, OnItem
|
|||
|
||||
public void quitEditMode(){
|
||||
isEditMode = false;
|
||||
selectAll.setVisibility(View.GONE);
|
||||
deselectAll.setVisibility(View.GONE);
|
||||
delete.setVisibility(View.GONE);
|
||||
edit.setVisibility(View.VISIBLE);
|
||||
editList.setVisibility(View.GONE);
|
||||
topBar.setVisibility(View.VISIBLE);
|
||||
|
||||
refresh();
|
||||
if (!hideHistoryListAndDisplayMessageIfEmpty()){
|
||||
historyList.setChoiceMode(AbsListView.CHOICE_MODE_MULTIPLE);
|
||||
|
@ -483,7 +496,7 @@ public class HistoryFragment extends Fragment implements OnClickListener, OnItem
|
|||
historyList.setItemChecked(position, b);
|
||||
}
|
||||
});
|
||||
holder.detail.setVisibility(View.GONE);
|
||||
holder.detail.setVisibility(View.INVISIBLE);
|
||||
if(historyList.isItemChecked(position)) {
|
||||
holder.select.setChecked(true);
|
||||
} else {
|
||||
|
|
Loading…
Reference in a new issue