Update History

This commit is contained in:
Margaux Clerc 2015-09-04 12:04:06 +02:00
parent a5b4d854db
commit 2c178d8c5f
13 changed files with 192 additions and 193 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 27 KiB

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 879 B

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 2.9 KiB

View file

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true"
android:drawable="@drawable/list_details_default" />
android:drawable="@drawable/list_details_over" />
<item
android:drawable="@drawable/list_details_default" />
</selector>

View file

@ -19,19 +19,19 @@
<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:src="@drawable/history_all"
android:background="@drawable/toolbar_button"
android:gravity="center"
android:layout_width="wrap_content"
android:layout_height="match_parent"/>
<RelativeLayout
android:id="@+id/all_calls_select"
android:contentDescription="@string/content_description_contacts"
android:background="@color/colorA"
android:contentDescription="@string/content_description_contacts"
android:layout_alignRight="@id/all_calls"
android:layout_width="match_parent"
android:layout_height="5dp"
@ -46,10 +46,10 @@
android:adjustViewBounds="true">
<ImageView
android:contentDescription="@string/content_description_missed_calls"
android:id="@+id/missed_calls"
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"
@ -57,8 +57,8 @@
<RelativeLayout
android:id="@+id/missed_calls_select"
android:contentDescription="@string/content_description_contacts"
android:background="@color/colorA"
android:contentDescription="@string/content_description_contacts"
android:layout_alignRight="@id/missed_calls"
android:layout_width="match_parent"
android:layout_height="5dp"
@ -69,9 +69,9 @@
<ImageView
android:id="@+id/delete"
android:contentDescription="@string/content_description_valid"
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"
@ -81,9 +81,9 @@
<ImageView
android:id="@+id/select_all"
android:contentDescription="@string/content_description_valid"
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"
@ -93,9 +93,9 @@
<ImageView
android:id="@+id/deselect_all"
android:contentDescription="@string/content_description_valid"
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"
@ -106,9 +106,9 @@
<ImageView
android:id="@+id/edit"
android:contentDescription="@string/content_description_edit"
android:src="@drawable/edit_list"
android:background="@drawable/toolbar_button"
android:contentDescription="@string/content_description_edit"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_alignParentRight="true"
@ -127,22 +127,20 @@
<TextView
android:id="@+id/noCallHistory"
android:text="@string/no_call_history"
style="@style/font6"
android:visibility="gone"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:text="@string/no_call_history"
android:textColor="@drawable/text_color"
android:textAppearance="@android:style/TextAppearance.Large"/>
android:gravity="center"/>
<TextView
android:id="@+id/noMissedCallHistory"
android:text="@string/no_missed_call_history"
style="@style/font6"
android:visibility="gone"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:text="@string/no_missed_call_history"
android:textColor="@drawable/text_color"
android:textAppearance="@android:style/TextAppearance.Large"/>
android:gravity="center"/>
</LinearLayout>

View file

@ -2,21 +2,30 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/list_selector"
android:background="@color/colorH"
android:gravity="center_vertical"
android:orientation="vertical" >
<TextView
<LinearLayout
android:id="@+id/separator"
android:paddingLeft="10dp"
android:layout_width="match_parent"
android:layout_height="30dp"
android:textSize="20sp"
android:background="@color/colorH"
android:textColor="@color/colorA"
android:textStyle="bold"
android:textAllCaps="true"
android:gravity="center"/>
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="@+id/separator_text"
style="@style/font1"
android:layout_width="match_parent"
android:layout_height="40dp"
android:gravity="center"/>
<ImageView
android:background="@color/colorE"
android:layout_width="match_parent"
android:layout_height="1dp"/>
</LinearLayout>
<RelativeLayout
android:layout_width="match_parent"
@ -24,47 +33,63 @@
android:layout_margin="5dp"
android:gravity="center_vertical">
<ImageView
android:id="@+id/contact_picture"
android:contentDescription="@string/content_description_contact_picture"
android:src="@drawable/avatar"
<RelativeLayout
android:id="@+id/avatar_layout"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:adjustViewBounds="true"
android:layout_alignParentLeft="true"
android:layout_marginLeft="5dp"/>
android:layout_height="wrap_content">
<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:adjustViewBounds="true"
android:layout_alignParentLeft="true"
android:layout_marginLeft="5dp"/>
<ImageView
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: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:layout_toRightOf="@id/contact_picture"
android:layout_toRightOf="@id/avatar_layout"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:adjustViewBounds="true"
android:src="@drawable/call_status_incoming"
android:layout_marginLeft="5dp"/>
<TextView
android:id="@+id/sipUri"
android:id="@+id/sip_uri"
style="@style/font6"
android:lines="1"
android:textSize="30sp"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_toRightOf="@id/icon"
android:ellipsize="marquee"
android:marqueeRepeatLimit="marquee_forever"
android:scrollHorizontally="true"
android:fadingEdge="horizontal"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="@color/text_contrast"
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:contentDescription="@string/content_description_detail"
android:src="@drawable/list_detail"
android:contentDescription="@string/content_description_detail"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_alignParentRight="true"
@ -75,10 +100,10 @@
<CheckBox
android:id="@+id/delete"
android:button="@drawable/checkbox"
android:contentDescription="@string/content_description_delete"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:contentDescription="@string/content_description_delete"
android:visibility="gone"
android:paddingLeft="5dp"
android:paddingRight="5dp" />

View file

@ -6,18 +6,17 @@
android:orientation="vertical" >
<RelativeLayout
android:id="@+id/relativeLayout"
android:layout_width="match_parent"
android:layout_height="60dp"
android:layout_gravity="bottom"
android:background="@color/colorF"
android:id="@+id/relativeLayout">
android:background="@color/colorF">
<ImageView
android:id="@+id/back"
android:contentDescription="@string/content_description_back"
android:src="@drawable/back"
android:background="@drawable/toolbar_button"
android:contentDescription="@string/content_description_back"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_alignParentLeft="true"
@ -27,11 +26,11 @@
<ImageView
android:id="@+id/add_contact"
android:src="@drawable/contact_add"
android:background="@drawable/toolbar_button"
android:contentDescription="@string/content_description_add_contact"
android:layout_alignParentRight="true"
android:padding="10dp"
android:src="@drawable/contact_add"
android:background="@drawable/toolbar_button"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:adjustViewBounds="true"/>
@ -48,34 +47,46 @@
android:orientation="vertical">
<RelativeLayout
<RelativeLayout
android:id="@+id/avatar_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center">
<ImageView
android:id="@+id/contactPicture"
android:id="@+id/contact_picture"
android:src="@drawable/avatar"
android:contentDescription="@string/content_description_contact_picture"
android:layout_width="120dp"
android:layout_height="120dp"
android:src="@drawable/avatar" />
android:adjustViewBounds="true"
android:layout_alignParentLeft="true"
android:layout_marginLeft="5dp"/>
<ImageView
android:id="@+id/mask"
android:src="@drawable/avatar_mask"
android:contentDescription="@string/content_description_contact_picture"
android:layout_width="120dp"
android:layout_height="120dp"
android:adjustViewBounds="true"
android:layout_alignParentLeft="true"
android:layout_marginLeft="5dp"/>
</RelativeLayout>
<TextView
android:id="@+id/contactName"
android:id="@+id/contact_name"
style="@style/font5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="@color/colorC" />
android:layout_height="wrap_content"/>
<TextView
android:id="@+id/contactAddress"
android:id="@+id/contact_address"
style="@style/font2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="@color/colorA" />
android:layout_height="wrap_content"/>
</LinearLayout>
<LinearLayout
@ -92,59 +103,58 @@
android:paddingRight="10dp">
<ImageView
android:id="@+id/call"
android:src="@drawable/call_start_body_default"
android:contentDescription="@string/content_description_dial_back"
android:id="@+id/dialBack"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
android:src="@drawable/call_start_body_default"
android:layout_centerInParent="true" />
android:layout_centerInParent="true"/>
</RelativeLayout>
<RelativeLayout
android:id="@+id/chat_row"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/chatRow"
android:paddingLeft="10dp"
android:paddingRight="10dp">
<ImageView
android:id="@+id/chat"
android:src="@drawable/chat_start_body_default"
android:contentDescription="@string/content_description_chat"
android:id="@+id/chat"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
android:src="@drawable/chat_start_body_default"
android:layout_centerInParent="true" />
</RelativeLayout>
</LinearLayout>
<LinearLayout
android:id="@+id/logRow"
android:id="@+id/log_row"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingTop="20dp">
<View
android:background="@color/colorE"
android:layout_width="wrap_content"
android:layout_height="1dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:background="@color/colorE"/>
android:layout_marginRight="10dp"/>
<TextView
android:layout_marginTop="10dp"
android:id="@+id/call_direction"
android:text="@string/call"
style="@style/font13"
android:textAllCaps="true"
android:layout_marginTop="2dp"
android:layout_gravity="center"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/call"
android:textAllCaps="true"
android:textColor="@color/colorE" />
android:layout_height="wrap_content"/>
<LinearLayout
android:layout_width="match_parent"
@ -153,29 +163,19 @@
android:gravity="center"
android:padding="10dp">
<TextView
android:id="@+id/callDirection"
android:paddingRight="10dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/text_contrast" />
<TextView
android:id="@+id/date"
style="@style/font10"
android:paddingRight="10dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/text_contrast" />
android:layout_height="wrap_content"/>
<TextView
android:id="@+id/time"
style="@style/font10"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/text_contrast" />
android:layout_height="wrap_content" />
</LinearLayout>
</LinearLayout>
</LinearLayout>

View file

@ -1,29 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical">
<ImageView
android:contentDescription="@string/content_description_delete"
android:id="@+id/delete"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="invisible"
android:src="@drawable/list_delete"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_alignParentRight="true" />
<TextView
android:id="@+id/sipUri"
android:lines="1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="@color/text_contrast"
android:layout_marginLeft="30dp"
android:layout_alignParentLeft="true"
android:layout_toLeftOf="@id/delete" />
</RelativeLayout>

View file

@ -36,7 +36,7 @@
<color name="numpad_background_bottom">#ffe4edf2</color>
<color name="numpad_background_dialer">#ffd8d8d8</color>
<color name="numpad_background_top">#ffb1bdc3</color>
<color name="missed_calls_background">#ffcf4c29</color>
<color name="transparent">#00000000</color>

View file

@ -54,10 +54,10 @@ public class HistoryDetailFragment extends Fragment implements OnClickListener {
String status = getArguments().getString("CallStatus");
String callTime = getArguments().getString("CallTime");
String callDate = getArguments().getString("CallDate");
view = inflater.inflate(R.layout.history_detail, container, false);
dialBack = (ImageView) view.findViewById(R.id.dialBack);
dialBack = (ImageView) view.findViewById(R.id.call);
dialBack.setOnClickListener(this);
back = (ImageView) view.findViewById(R.id.back);
@ -71,16 +71,16 @@ public class HistoryDetailFragment extends Fragment implements OnClickListener {
addToContacts = (ImageView) view.findViewById(R.id.add_contact);
addToContacts.setOnClickListener(this);
contactPicture = (ImageView) view.findViewById(R.id.contactPicture);
contactPicture = (ImageView) view.findViewById(R.id.contact_picture);
contactName = (TextView) view.findViewById(R.id.contactName);
contactName = (TextView) view.findViewById(R.id.contact_name);
if (displayName == null && getResources().getBoolean(R.bool.only_display_username_if_unknown) && LinphoneUtils.isSipAddress(sipUri)) {
displayName = LinphoneUtils.getUsernameFromAddress(sipUri);
}
contactAddress = (TextView) view.findViewById(R.id.contactAddress);
contactAddress = (TextView) view.findViewById(R.id.contact_address);
callDirection = (TextView) view.findViewById(R.id.callDirection);
callDirection = (TextView) view.findViewById(R.id.call_direction);
time = (TextView) view.findViewById(R.id.time);
date = (TextView) view.findViewById(R.id.date);
@ -99,11 +99,11 @@ public class HistoryDetailFragment extends Fragment implements OnClickListener {
}
if (status.equals("Missed")) {
callDirection.setText(getString(R.string.call_state_missed));
callDirection.setText(getString(R.string.call_state_missed) + " call");
} else if (status.equals("Incoming")) {
callDirection.setText(getString(R.string.call_state_incoming));
callDirection.setText(getString(R.string.call_state_incoming) + " call");
} else if (status.equals("Outgoing")) {
callDirection.setText(getString(R.string.call_state_outgoing));
callDirection.setText(getString(R.string.call_state_outgoing) + " call");
} else {
callDirection.setText(status);
}
@ -116,10 +116,10 @@ public class HistoryDetailFragment extends Fragment implements OnClickListener {
lAddress = LinphoneCoreFactory.instance().createLinphoneAddress(sipUri);
Contact contact = ContactsManager.getInstance().findContactWithAddress(getActivity().getContentResolver(), lAddress);
if (contact != null) {
//LinphoneUtils.setImagePictureFromUri(view.getContext(), contactPicture.getView(),contact.getPhotoUri(), contact.getThumbnailUri(), R.drawable.unknown_small);
LinphoneUtils.setImagePictureFromUri(view.getContext(),contactPicture,contact.getPhotoUri(),contact.getThumbnailUri());
view.findViewById(R.id.add_contact).setVisibility(View.GONE);
} else {
//LinphoneUtils.setImagePictureFromUri(view.getContext(), contactPicture.getView(),null, null ,R.drawable.unknown_small);
contactPicture.setImageResource(R.drawable.avatar);
}
} catch (LinphoneCoreException e) {
e.printStackTrace();
@ -157,7 +157,7 @@ public class HistoryDetailFragment extends Fragment implements OnClickListener {
if (id == R.id.back) {
getFragmentManager().popBackStackImmediate();
} if (id == R.id.dialBack) {
} if (id == R.id.call) {
LinphoneActivity.instance().setAddresGoToDialerAndCall(sipUri, displayName, pictureUri == null ? null : Uri.parse(pictureUri));
} else if (id == R.id.chat) {
LinphoneActivity.instance().displayChat(sipUri);

View file

@ -27,7 +27,6 @@ import org.linphone.core.CallDirection;
import org.linphone.core.LinphoneAddress;
import org.linphone.core.LinphoneCallLog;
import org.linphone.core.LinphoneCallLog.CallStatus;
import org.linphone.mediastream.Log;
import android.annotation.SuppressLint;
import android.app.Dialog;
@ -53,6 +52,7 @@ import android.widget.Button;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.RelativeLayout;
import android.widget.TextView;
@ -66,7 +66,7 @@ public class HistoryFragment extends Fragment implements OnClickListener, OnItem
private TextView noCallHistory, noMissedCallHistory;
private ImageView missedCalls, allCalls, edit, selectAll, deselectAll, deleteAll;
private RelativeLayout allCallsSelected, missedCallsSelected;
private boolean onlyDisplayMissedCalls, isEditMode, isSelectAll, isDeselectAll;
private boolean onlyDisplayMissedCalls, isEditMode;
private List<LinphoneCallLog> mLogs;
@Override
@ -110,10 +110,6 @@ public class HistoryFragment extends Fragment implements OnClickListener, OnItem
edit = (ImageView) view.findViewById(R.id.edit);
edit.setOnClickListener(this);
isSelectAll = false;
isDeselectAll = false;
return view;
}
@ -190,42 +186,6 @@ public class HistoryFragment extends Fragment implements OnClickListener, OnItem
public void onClick(View v) {
int id = v.getId();
if (id == R.id.delete) {
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);
isEditMode = false;
delete.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
int size = historyList.getAdapter().getCount();
for(int i=0; i<size; i++) {
if(historyList.isItemChecked(i)){
LinphoneCallLog log = mLogs.get(i);
LinphoneManager.getLc().removeCallLog(log);
}
}
refresh();
historyList.setChoiceMode(AbsListView.CHOICE_MODE_MULTIPLE);
historyList.setAdapter(new CallHistoryAdapter(getActivity()));
dialog.dismiss();
}
});
cancel.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
dialog.dismiss();
}
});
dialog.show();
edit.setVisibility(View.VISIBLE);
selectAll.setVisibility(View.GONE);
deselectAll.setVisibility(View.GONE);
deleteAll.setVisibility(View.GONE);
}
if (id == R.id.edit) {
edit.setVisibility(View.GONE);
selectAll.setVisibility(View.VISIBLE);
@ -249,7 +209,7 @@ public class HistoryFragment extends Fragment implements OnClickListener, OnItem
onlyDisplayMissedCalls = true;
}
if (!hideHistoryListAndDisplayMessageIfEmpty()) {
if (!hideHistoryListAndDisplayMessageIfEmpty() && !isEditMode) {
historyList.setChoiceMode(AbsListView.CHOICE_MODE_MULTIPLE);
historyList.setAdapter(new CallHistoryAdapter(getActivity().getApplicationContext()));
}
@ -266,9 +226,6 @@ public class HistoryFragment extends Fragment implements OnClickListener, OnItem
for(int i=0; i<size; i++) {
historyList.setItemChecked(i, true);
}
isSelectAll = true;
isDeselectAll = false;
}
if (id == R.id.deselect_all) {
deselectAll.setVisibility(View.GONE);
@ -278,6 +235,36 @@ public class HistoryFragment extends Fragment implements OnClickListener, OnItem
historyList.setItemChecked(i, false);
}
}
if (id == R.id.delete) {
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);
delete.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
int size = historyList.getAdapter().getCount();
for(int i=0; i<size; i++) {
if(historyList.isItemChecked(i)){
LinphoneCallLog log = mLogs.get(i);
LinphoneManager.getLc().removeCallLog(log);
}
}
dialog.dismiss();
quitEditMode();
}
});
cancel.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
dialog.dismiss();
quitEditMode();
}
});
dialog.show();
}
}
@Override
@ -360,6 +347,19 @@ public class HistoryFragment extends Fragment implements OnClickListener, OnItem
}
}
public void quitEditMode(){
isEditMode = false;
selectAll.setVisibility(View.GONE);
deselectAll.setVisibility(View.GONE);
deleteAll.setVisibility(View.GONE);
edit.setVisibility(View.VISIBLE);
refresh();
if (!hideHistoryListAndDisplayMessageIfEmpty()){
historyList.setChoiceMode(AbsListView.CHOICE_MODE_MULTIPLE);
historyList.setAdapter(new CallHistoryAdapter(getActivity().getApplicationContext()));
}
}
class CallHistoryAdapter extends BaseAdapter {
CallHistoryAdapter(Context aContext) {
}
@ -411,30 +411,31 @@ public class HistoryFragment extends Fragment implements OnClickListener, OnItem
public View getView(final int position, View convertView, ViewGroup parent) {
View view = null;
ViewHolder holder;
if (convertView != null) {
view = convertView;
holder = (ViewHolder) view.getTag();
} else {
view = mInflater.inflate(R.layout.history_cell, parent,false);
ViewHolder holder = new ViewHolder();
holder.contact = (TextView) view.findViewById(R.id.sipUri);
holder = new ViewHolder();
holder.contact = (TextView) view.findViewById(R.id.sip_uri);
holder.detail = (ImageView) view.findViewById(R.id.detail);
holder.delete = (CheckBox) view.findViewById(R.id.delete);
holder.callDirection = (ImageView) view.findViewById(R.id.icon);
view.setTag(holder);
holder.contactPicture = (ImageView) view.findViewById(R.id.contact_picture);
}
ViewHolder holder = (ViewHolder) view.getTag();
final LinphoneCallLog log = mLogs.get(position);
long timestamp = log.getTimestamp();
final LinphoneAddress address;
holder.contact.setSelected(true); // For automated horizontal scrolling of long texts
TextView separator = (TextView) view.findViewById(R.id.separator);
LinearLayout separator = (LinearLayout) view.findViewById(R.id.separator);
TextView separatorText = (TextView) view.findViewById(R.id.separator_text);
Calendar logTime = Calendar.getInstance();
logTime.setTimeInMillis(timestamp);
separator.setText(timestampToHumanDate(logTime));
separatorText.setText(timestampToHumanDate(logTime));
if (position > 0) {
LinphoneCallLog previousLog = mLogs.get(position-1);
@ -463,11 +464,14 @@ public class HistoryFragment extends Fragment implements OnClickListener, OnItem
holder.callDirection.setImageResource(R.drawable.call_status_outgoing);
}
Contact c = ContactsManager.getInstance().findContactWithAddress(address);
Contact c = ContactsManager.getInstance().findContactWithAddress(getActivity().getContentResolver(), address);
String displayName = null;
final String sipUri = address.asStringUriOnly();
if(c != null){
displayName = c.getName();
LinphoneUtils.setImagePictureFromUri(view.getContext(),holder.contactPicture,c.getPhotoUri(),c.getThumbnailUri());
} else {
holder.contactPicture.setImageResource(R.drawable.avatar);
}
if (displayName == null) {
@ -511,6 +515,7 @@ public class HistoryFragment extends Fragment implements OnClickListener, OnItem
}
});
}
view.setTag(holder);
return view;
}
}
@ -520,6 +525,6 @@ public class HistoryFragment extends Fragment implements OnClickListener, OnItem
ImageView detail;
CheckBox delete;
ImageView callDirection;
int position;
ImageView contactPicture;
}
}