From c26ad9c0b1f718e5839dae19811a85fabb71ca05 Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Fri, 21 Sep 2012 09:47:23 +0200 Subject: [PATCH] A click on a history entry calls the address, a click on the right button displays the details --- src/org/linphone/HistoryFragment.java | 14 +++++++--- src/org/linphone/HistorySimpleFragment.java | 29 +++++++++++++-------- 2 files changed, 29 insertions(+), 14 deletions(-) diff --git a/src/org/linphone/HistoryFragment.java b/src/org/linphone/HistoryFragment.java index f3c91e867..063889ea2 100644 --- a/src/org/linphone/HistoryFragment.java +++ b/src/org/linphone/HistoryFragment.java @@ -245,7 +245,7 @@ public class HistoryFragment extends Fragment implements OnClickListener, OnChil } else { address = log.getTo(); } - LinphoneActivity.instance().displayHistoryDetail(address.asStringUriOnly(), log); + LinphoneActivity.instance().setAddresGoToDialerAndCall(address.asStringUriOnly(), address.getDisplayName(), null); } return false; } @@ -342,8 +342,8 @@ public class HistoryFragment extends Fragment implements OnClickListener, OnChil view = mInflater.inflate(R.layout.history_cell, parent,false); } - LinphoneCallLog log = (LinphoneCallLog) getChild(groupPosition, childPosition); - LinphoneAddress address; + final LinphoneCallLog log = (LinphoneCallLog) getChild(groupPosition, childPosition); + final LinphoneAddress address; TextView dateAndTime = (TextView) view.findViewById(R.id.dateAndTime); ImageView detail = (ImageView) view.findViewById(R.id.detail); @@ -374,6 +374,14 @@ public class HistoryFragment extends Fragment implements OnClickListener, OnChil } else { delete.setVisibility(View.GONE); detail.setVisibility(View.VISIBLE); + detail.setOnClickListener(new OnClickListener() { + @Override + public void onClick(View v) { + if (LinphoneActivity.isInstanciated()) { + LinphoneActivity.instance().displayHistoryDetail(address.asStringUriOnly(), log); + } + } + }); } return view; diff --git a/src/org/linphone/HistorySimpleFragment.java b/src/org/linphone/HistorySimpleFragment.java index a445a6b53..2c121d89b 100644 --- a/src/org/linphone/HistorySimpleFragment.java +++ b/src/org/linphone/HistorySimpleFragment.java @@ -161,16 +161,15 @@ public class HistorySimpleFragment extends Fragment implements OnClickListener, mLogs = Arrays.asList(LinphoneManager.getLc().getCallLogs()); historyList.setAdapter(new CallHistoryAdapter(getActivity().getApplicationContext())); } else { - LinphoneCallLog log = mLogs.get(position); - LinphoneAddress address; - if (log.getDirection() == CallDirection.Incoming) { - address = log.getFrom(); - } else { - address = log.getTo(); - } - if (LinphoneActivity.isInstanciated()) { - LinphoneActivity.instance().displayHistoryDetail(address.asStringUriOnly(), log); + LinphoneCallLog log = mLogs.get(position); + LinphoneAddress address; + if (log.getDirection() == CallDirection.Incoming) { + address = log.getFrom(); + } else { + address = log.getTo(); + } + LinphoneActivity.instance().setAddresGoToDialerAndCall(address.asStringUriOnly(), address.getDisplayName(), null); } } } @@ -274,8 +273,8 @@ public class HistorySimpleFragment extends Fragment implements OnClickListener, view = mInflater.inflate(R.layout.history_cell_simple, parent,false); } - LinphoneCallLog log = mLogs.get(position); - LinphoneAddress address; + final LinphoneCallLog log = mLogs.get(position); + final LinphoneAddress address; TextView contact = (TextView) view.findViewById(R.id.sipUri); ImageView detail = (ImageView) view.findViewById(R.id.detail); @@ -320,6 +319,14 @@ public class HistorySimpleFragment extends Fragment implements OnClickListener, } else { delete.setVisibility(View.GONE); detail.setVisibility(View.VISIBLE); + detail.setOnClickListener(new OnClickListener() { + @Override + public void onClick(View v) { + if (LinphoneActivity.isInstanciated()) { + LinphoneActivity.instance().displayHistoryDetail(address.asStringUriOnly(), log); + } + } + }); } return view;