Enhanced simple history

This commit is contained in:
Sylvain Berfini 2012-10-05 11:33:18 +02:00
parent 6d5f201d07
commit 9d0855d2f5
2 changed files with 9 additions and 5 deletions

View file

@ -132,7 +132,7 @@ public class HistorySimpleFragment extends Fragment implements OnClickListener,
mLogs = Arrays.asList(LinphoneManager.getLc().getCallLogs());
if (!hideHistoryListAndDisplayMessageIfEmpty()) {
historyList.setAdapter(new CallHistoryAdapter(getActivity().getApplicationContext()));
historyList.setAdapter(new CallHistoryAdapter(getActivity()));
}
}
@ -149,7 +149,7 @@ public class HistorySimpleFragment extends Fragment implements OnClickListener,
LinphoneManager.getLc().removeCallLog(log);
mLogs = Arrays.asList(LinphoneManager.getLc().getCallLogs());
if (!hideHistoryListAndDisplayMessageIfEmpty()) {
historyList.setAdapter(new CallHistoryAdapter(getActivity().getApplicationContext()));
historyList.setAdapter(new CallHistoryAdapter(getActivity()));
}
return true;
}
@ -314,7 +314,6 @@ public class HistorySimpleFragment extends Fragment implements OnClickListener,
ImageView delete = (ImageView) view.findViewById(R.id.delete);
ImageView callDirection = (ImageView) view.findViewById(R.id.icon);
if (log.getDirection() == CallDirection.Incoming) {
address = log.getFrom();
if (log.getStatus() == CallStatus.Missed) {

View file

@ -29,6 +29,7 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
import java.util.regex.Pattern;
import org.linphone.core.LinphoneAddress;
import org.linphone.core.LinphoneCall;
@ -63,13 +64,17 @@ public final class LinphoneUtils {
private LinphoneUtils(){}
private static boolean preventVolumeBarToDisplay = false;
private static final String sipAddressRegExp = "^(sip:)?(\\+)?[a-z0-9]+([_\\.-][a-z0-9]+)*@([a-z0-9]+([\\.-][a-z0-9]+)*)+\\.[a-z]{2,}(:[0-9]{2,5})?$";
private static final String strictSipAddressRegExp = "^sip:(\\+)?[a-z0-9]+([_\\.-][a-z0-9]+)*@([a-z0-9]+([\\.-][a-z0-9]+)*)+\\.[a-z]{2,}$";
public static boolean isSipAddress(String numberOrAddress) {
return numberOrAddress != null && numberOrAddress.matches("^(sip:)?(\\+)?[a-z0-9]+([_\\.-][a-z0-9]+)*@([a-z0-9]+([\\.-][a-z0-9]+)*)+\\.[a-z]{2,}$");
Pattern p = Pattern.compile(sipAddressRegExp);
return p.matcher(numberOrAddress).matches();
}
public static boolean isStrictSipAddress(String numberOrAddress) {
return numberOrAddress != null && numberOrAddress.matches("^sip:(\\+)?[a-z0-9]+([_\\.-][a-z0-9]+)*@([a-z0-9]+([\\.-][a-z0-9]+)*)+\\.[a-z]{2,}$");
Pattern p = Pattern.compile(strictSipAddressRegExp);
return p.matcher(numberOrAddress).matches();
}
public static String getUsernameFromAddress(String address) {