Adds additional utility methods.

cusax-fix
Damian Minkov 13 years ago
parent cd5a0b7bc0
commit a9c65e9cd3

@ -300,16 +300,37 @@ && hasContactCapabilities(contact,
* @return is call enabled for metaContact. * @return is call enabled for metaContact.
*/ */
public boolean isCallEnabled(DetailsResponseListener listener) public boolean isCallEnabled(DetailsResponseListener listener)
{
return isCallEnabled(listener, true);
}
/**
* Is call enabled for metaContact. If any of the child
* contacts has call enabled.
* @param listener the <tt>DetailsResponseListener</tt> to listen for result
* details
* @param checkForTelephonyOpSet whether we should check for registered
* telephony operation sets that can be used to dial out, can be used
* in plugins dialing out using methods outside the provider.
* @return is call enabled for metaContact.
*/
public boolean isCallEnabled(DetailsResponseListener listener,
boolean checkForTelephonyOpSet)
{ {
// make sure children are checked // make sure children are checked
if(!checkMetaContactPhones(listener)) if(!checkMetaContactPhones(listener))
return false; return false;
boolean hasPhoneCheck = hasPhones;
if(checkForTelephonyOpSet)
hasPhoneCheck =
hasPhones && AccountUtils.getRegisteredProviders(
OperationSetBasicTelephony.class).size() > 0;
return metaContact.getDefaultContact( return metaContact.getDefaultContact(
OperationSetBasicTelephony.class) != null OperationSetBasicTelephony.class) != null
|| (hasPhones || hasPhoneCheck;
&& AccountUtils.getRegisteredProviders(
OperationSetBasicTelephony.class).size() > 0);
} }
/** /**
@ -319,7 +340,21 @@ public boolean isCallEnabled(DetailsResponseListener listener)
*/ */
public boolean isCallEnabled() public boolean isCallEnabled()
{ {
return isCallEnabled((DetailsResponseListener) null); return isCallEnabled(null, true);
}
/**
* Is call enabled for metaContact. If any of the child
* contacts has call enabled.
* @param checkForTelephonyOpSet whether we should check for registered
* telephony operation sets that can be used to dial out, can be used
* in plugins dialing out using methods outside the provider.
* @return is call enabled for metaContact.
*/
public boolean isCallEnabled(boolean checkForTelephonyOpSet)
{
return isCallEnabled(null,
checkForTelephonyOpSet);
} }
/** /**

Loading…
Cancel
Save