use of com.voipgrid.vialer.util.DialHelper in project vialer-android by VoIPGRID.
the class CallRecordAdapter method onClick.
@Override
public void onClick(View view) {
// Get the position of the list item the buttons is clicked for.
View parentRow = (View) view.getParent();
ListView listView = (ListView) parentRow.getParent();
final int position = listView.getPositionForView(parentRow);
// Get the call record.
CallRecord callRecord = getItem(position);
String direction = callRecord.getDirection();
String numberToCall = null;
// Determine direction and the number we need to call.
if (direction.equals(CallRecord.DIRECTION_OUTBOUND)) {
numberToCall = callRecord.getDialedNumber();
} else if (direction.equals(CallRecord.DIRECTION_INBOUND)) {
numberToCall = callRecord.getCaller();
}
if (numberToCall != null && !mCallAlreadySetup) {
mCallAlreadySetup = true;
new DialHelper(mActivity, new JsonStorage(mActivity), ConnectivityHelper.get(mActivity), new AnalyticsHelper(((AnalyticsApplication) mActivity.getApplication()).getDefaultTracker())).callNumber(numberToCall, "");
PreferenceManager.getDefaultSharedPreferences(mActivity).edit().putString(DialerActivity.LAST_DIALED, numberToCall).apply();
}
}
use of com.voipgrid.vialer.util.DialHelper in project vialer-android by VoIPGRID.
the class DialerActivity method onCallNumber.
/**
* Initiate an outgoing call by starting CallActivity and pass a SipUri based on the number
*
* @param number number to call
* @param contactName contact name to display
*/
public void onCallNumber(String number, String contactName) {
DialHelper dialHelper = new DialHelper(this, mJsonStorage, mConnectivityHelper, mAnalyticsHelper);
String phoneNumberToCall = PhoneNumberUtils.format(number);
if (number.length() < 1) {
Toast.makeText(this, getString(R.string.dialer_invalid_number), Toast.LENGTH_LONG).show();
} else {
dialHelper.callNumber(phoneNumberToCall, contactName);
mSharedPreferences.edit().putString(LAST_DIALED, number).apply();
mNumberInputView.clear();
}
}
Aggregations