Improved contacts numbers handling

This commit is contained in:
Sylvain Berfini 2012-09-27 12:05:45 +02:00
parent b259902326
commit 63c5cf01f5

View file

@ -20,6 +20,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
import java.io.InputStream; import java.io.InputStream;
import org.linphone.compatibility.Compatibility; import org.linphone.compatibility.Compatibility;
import org.linphone.core.LinphoneProxyConfig;
import org.linphone.ui.AvatarWithShadow; import org.linphone.ui.AvatarWithShadow;
import android.content.Intent; import android.content.Intent;
@ -112,13 +113,16 @@ public class ContactFragment extends Fragment implements OnClickListener {
v.findViewById(R.id.dial).setVisibility(View.GONE); v.findViewById(R.id.dial).setVisibility(View.GONE);
} }
v.findViewById(R.id.chat).setOnClickListener(chatListener);
if (LinphoneUtils.isSipAddress(numberOrAddress)) { if (LinphoneUtils.isSipAddress(numberOrAddress)) {
v.findViewById(R.id.chat).setOnClickListener(chatListener);
v.findViewById(R.id.chat).setTag(numberOrAddress); v.findViewById(R.id.chat).setTag(numberOrAddress);
} else { } else {
v.findViewById(R.id.chat).setVisibility(View.INVISIBLE); LinphoneProxyConfig lpc = LinphoneManager.getLc().getDefaultProxyConfig();
if (displayChatAddressOnly) { if (lpc != null) {
v.setVisibility(View.GONE); if (!numberOrAddress.startsWith("sip:")) {
numberOrAddress = "sip:" + numberOrAddress;
}
v.findViewById(R.id.chat).setTag(numberOrAddress + "@" + lpc.getDomain());
} }
} }