List of usage examples for android.content Intent ACTION_CALL
String ACTION_CALL
To view the source code for android.content Intent ACTION_CALL.
Click Source Link
From source file:com.newcell.calltext.ui.dialpad.DialerFragment.java
/** * Place a Voicemail call (*86)/*from w w w .ja v a2s. c om*/ */ public void placeVMCall() { Long accountToUse = SipProfile.INVALID_ID; SipProfile acc = null; acc = accountChooserButton.getSelectedAccount(); if (acc == null) { // Maybe we could inform user nothing will happen here? return; } accountToUse = acc.id; if (accountToUse >= 0) { Log.i(THIS_FILE, "PlaceVMCall - User account found"); digits.setText("*86"); placeCall(); /* * 08/06/2014 Changed Voicemail to just call *86 SipProfile vmAcc = SipProfile.getProfileFromDbId(getActivity(), acc.id, new String[] { SipProfile.FIELD_VOICE_MAIL_NBR }); if (!TextUtils.isEmpty(vmAcc.vm_nbr)) { // Account already has a VM number try { service.makeCall(vmAcc.vm_nbr, (int) acc.id); } catch (RemoteException e) { Log.e(THIS_FILE, "Service can't be called to make the call"); } } else { // Account has no VM number, get the users phone number to use String vmNumber = acc.getSipUserName(); if(!TextUtils.isEmpty(vmNumber)) { final long editedAccId = acc.id; vmAcc.vm_nbr = vmNumber; ContentValues cv = new ContentValues(); cv.put(SipProfile.FIELD_VOICE_MAIL_NBR, vmNumber); int updated = getActivity().getContentResolver() .update(ContentUris.withAppendedId( SipProfile.ACCOUNT_ID_URI_BASE, editedAccId), cv, null, null); Log.d(THIS_FILE, "Updated accounts " + updated); try { service.makeCall(vmAcc.vm_nbr, (int) acc.id); } catch(RemoteException e) { Log.e(THIS_FILE, "Service can't be called to make the call"); } } else { Toast.makeText(getActivity(), "Account phone number has not been set", Toast.LENGTH_SHORT).show(); } } * 08/06/2014 Changed Voicemail to just call *86 */ } else if (accountToUse == CallHandlerPlugin.getAccountIdForCallHandler(getActivity(), (new ComponentName(getActivity(), CallHandler.class).flattenToString()))) { // Case gsm voice mail Log.i(THIS_FILE, "PlaceVMCall - GSM voicemail"); TelephonyManager tm = (TelephonyManager) getActivity().getSystemService(Context.TELEPHONY_SERVICE); String vmNumber = tm.getVoiceMailNumber(); if (!TextUtils.isEmpty(vmNumber)) { if (service != null) { try { service.ignoreNextOutgoingCallFor(vmNumber); } catch (RemoteException e) { Log.e(THIS_FILE, "Not possible to ignore next"); } } Intent intent = new Intent(Intent.ACTION_CALL, Uri.fromParts("tel", vmNumber, null)); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(intent); } else { missingVoicemailDialog = new AlertDialog.Builder(getActivity()).setTitle(R.string.gsm) .setMessage(R.string.no_voice_mail_configured) .setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { if (missingVoicemailDialog != null) { missingVoicemailDialog.hide(); } } }).create(); // When the dialog is up, completely hide the in-call UI // underneath (which is in a partially-constructed state). missingVoicemailDialog.getWindow().addFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND); missingVoicemailDialog.show(); } } // TODO : manage others ?... for now, no way to do so cause no vm stored }
From source file:net.voxcorp.voxmobile.ui.dialpad.DialerFragment.java
public void placeVMCall() { Long accountToUse = SipProfile.INVALID_ID; SipProfile acc = null;//from w ww . j a v a 2 s . c om acc = accountChooserButton.getSelectedAccount(); if (acc != null) { accountToUse = acc.id; } if (accountToUse >= 0) { SipProfile vmAcc = SipProfile.getProfileFromDbId(getActivity(), acc.id, new String[] { SipProfile.FIELD_VOICE_MAIL_NBR }); if (!TextUtils.isEmpty(vmAcc.vm_nbr)) { // Account already have a VM number try { /** * VoX Mobile :: handle didww.com lines */ if (vmAcc.vm_nbr.startsWith("011")) { String did = vmAcc.vm_nbr; did = "+" + did.substring(3); service.makeCall(did, (int) acc.id); } else { service.makeCall(vmAcc.vm_nbr, (int) acc.id); } } catch (RemoteException e) { Log.e(THIS_FILE, "Service can't be called to make the call"); } } else { // Account has no VM number, propose to create one final long editedAccId = acc.id; LayoutInflater factory = LayoutInflater.from(getActivity()); final View textEntryView = factory.inflate(R.layout.alert_dialog_text_entry, null); missingVoicemailDialog = new AlertDialog.Builder(getActivity()).setTitle(acc.display_name) .setView(textEntryView) .setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { if (missingVoicemailDialog != null) { TextView tf = (TextView) missingVoicemailDialog.findViewById(R.id.vmfield); if (tf != null) { String vmNumber = tf.getText().toString(); if (!TextUtils.isEmpty(vmNumber)) { ContentValues cv = new ContentValues(); cv.put(SipProfile.FIELD_VOICE_MAIL_NBR, vmNumber); int updated = getActivity().getContentResolver() .update(ContentUris.withAppendedId( SipProfile.ACCOUNT_ID_URI_BASE, editedAccId), cv, null, null); Log.d(THIS_FILE, "Updated accounts " + updated); } } missingVoicemailDialog.hide(); } } }).setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { if (missingVoicemailDialog != null) { missingVoicemailDialog.hide(); } } }).create(); // When the dialog is up, completely hide the in-call UI // underneath (which is in a partially-constructed state). missingVoicemailDialog.getWindow().addFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND); missingVoicemailDialog.show(); } } else if (accountToUse == CallHandlerPlugin.getAccountIdForCallHandler(getActivity(), (new ComponentName(getActivity(), net.voxcorp.voxmobile.plugins.telephony.CallHandler.class) .flattenToString()))) { // Case gsm voice mail TelephonyManager tm = (TelephonyManager) getActivity().getSystemService(Context.TELEPHONY_SERVICE); String vmNumber = tm.getVoiceMailNumber(); if (!TextUtils.isEmpty(vmNumber)) { if (service != null) { try { service.ignoreNextOutgoingCallFor(vmNumber); } catch (RemoteException e) { Log.e(THIS_FILE, "Not possible to ignore next"); } } Intent intent = new Intent(Intent.ACTION_CALL, Uri.fromParts("tel", vmNumber, null)); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(intent); } else { missingVoicemailDialog = new AlertDialog.Builder(getActivity()).setTitle(R.string.gsm) .setMessage(R.string.no_voice_mail_configured) .setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { if (missingVoicemailDialog != null) { missingVoicemailDialog.hide(); } } }).create(); // When the dialog is up, completely hide the in-call UI // underneath (which is in a partially-constructed state). missingVoicemailDialog.getWindow().addFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND); missingVoicemailDialog.show(); } } // TODO : manage others ?... for now, no way to do so cause no vm stored }
From source file:com.csipsimple.ui.dialpad.DialerFragment.java
public void placeVMCall() { Long accountToUse = SipProfile.INVALID_ID; SipProfile acc = null;/*w w w. j a v a 2s.c o m*/ acc = accountChooserButton.getSelectedAccount(); if (acc == null) { // Maybe we could inform user nothing will happen here? return; } accountToUse = acc.id; if (accountToUse >= 0) { SipProfile vmAcc = SipProfile.getProfileFromDbId(getActivity(), acc.id, new String[] { SipProfile.FIELD_VOICE_MAIL_NBR }); if (!TextUtils.isEmpty(vmAcc.vm_nbr)) { // Account already have a VM number try { service.makeCall(vmAcc.vm_nbr, (int) acc.id); } catch (RemoteException e) { Log.e(THIS_FILE, "Service can't be called to make the call"); } } else { // Account has no VM number, propose to create one final long editedAccId = acc.id; LayoutInflater factory = LayoutInflater.from(getActivity()); final View textEntryView = factory.inflate(R.layout.alert_dialog_text_entry, null); missingVoicemailDialog = new AlertDialog.Builder(getActivity()).setTitle(acc.display_name) .setView(textEntryView) .setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { if (missingVoicemailDialog != null) { TextView tf = (TextView) missingVoicemailDialog.findViewById(R.id.vmfield); if (tf != null) { String vmNumber = tf.getText().toString(); if (!TextUtils.isEmpty(vmNumber)) { ContentValues cv = new ContentValues(); cv.put(SipProfile.FIELD_VOICE_MAIL_NBR, vmNumber); int updated = getActivity().getContentResolver() .update(ContentUris.withAppendedId( SipProfile.ACCOUNT_ID_URI_BASE, editedAccId), cv, null, null); Log.d(THIS_FILE, "Updated accounts " + updated); } } missingVoicemailDialog.hide(); } } }).setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { if (missingVoicemailDialog != null) { missingVoicemailDialog.hide(); } } }).create(); // When the dialog is up, completely hide the in-call UI // underneath (which is in a partially-constructed state). missingVoicemailDialog.getWindow().addFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND); missingVoicemailDialog.show(); } } else if (accountToUse == CallHandlerPlugin.getAccountIdForCallHandler(getActivity(), (new ComponentName(getActivity(), com.csipsimple.plugins.telephony.CallHandler.class) .flattenToString()))) { // Case gsm voice mail TelephonyManager tm = (TelephonyManager) getActivity().getSystemService(Context.TELEPHONY_SERVICE); String vmNumber = tm.getVoiceMailNumber(); if (!TextUtils.isEmpty(vmNumber)) { if (service != null) { try { service.ignoreNextOutgoingCallFor(vmNumber); } catch (RemoteException e) { Log.e(THIS_FILE, "Not possible to ignore next"); } } Intent intent = new Intent(Intent.ACTION_CALL, Uri.fromParts("tel", vmNumber, null)); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(intent); } else { missingVoicemailDialog = new AlertDialog.Builder(getActivity()).setTitle(R.string.gsm) .setMessage(R.string.no_voice_mail_configured) .setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { if (missingVoicemailDialog != null) { missingVoicemailDialog.hide(); } } }).create(); // When the dialog is up, completely hide the in-call UI // underneath (which is in a partially-constructed state). missingVoicemailDialog.getWindow().addFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND); missingVoicemailDialog.show(); } } // TODO : manage others ?... for now, no way to do so cause no vm stored }
From source file:com.voiceblue.phone.ui.dialpad.DialerFragment.java
public void placeVMCall() { Long accountToUse = SipProfile.INVALID_ID; SipProfile acc = null;/*from w ww . j a v a 2s . c o m*/ acc = accountChooserButton.getSelectedAccount(); if (acc == null) { // Maybe we could inform user nothing will happen here? return; } accountToUse = acc.id; if (accountToUse >= 0) { SipProfile vmAcc = SipProfile.getProfileFromDbId(getActivity(), acc.id, new String[] { SipProfile.FIELD_VOICE_MAIL_NBR }); if (!TextUtils.isEmpty(vmAcc.vm_nbr)) { // Account already have a VM number try { service.makeCall(vmAcc.vm_nbr, (int) acc.id); } catch (RemoteException e) { Log.e(THIS_FILE, "Service can't be called to make the call"); } } else { // Account has no VM number, propose to create one final long editedAccId = acc.id; LayoutInflater factory = LayoutInflater.from(getActivity()); final View textEntryView = factory.inflate(R.layout.alert_dialog_text_entry, null); missingVoicemailDialog = new AlertDialog.Builder(getActivity()).setTitle(acc.display_name) .setView(textEntryView) .setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { if (missingVoicemailDialog != null) { TextView tf = (TextView) missingVoicemailDialog.findViewById(R.id.vmfield); if (tf != null) { String vmNumber = tf.getText().toString(); if (!TextUtils.isEmpty(vmNumber)) { ContentValues cv = new ContentValues(); cv.put(SipProfile.FIELD_VOICE_MAIL_NBR, vmNumber); int updated = getActivity().getContentResolver() .update(ContentUris.withAppendedId( SipProfile.ACCOUNT_ID_URI_BASE, editedAccId), cv, null, null); Log.d(THIS_FILE, "Updated accounts " + updated); } } missingVoicemailDialog.hide(); } } }).setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { if (missingVoicemailDialog != null) { missingVoicemailDialog.hide(); } } }).create(); // When the dialog is up, completely hide the in-call UI // underneath (which is in a partially-constructed state). missingVoicemailDialog.getWindow().addFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND); missingVoicemailDialog.show(); } } else if (accountToUse == CallHandlerPlugin.getAccountIdForCallHandler(getActivity(), (new ComponentName(getActivity(), com.voiceblue.phone.plugins.telephony.CallHandler.class) .flattenToString()))) { // Case gsm voice mail TelephonyManager tm = (TelephonyManager) getActivity().getSystemService(Context.TELEPHONY_SERVICE); String vmNumber = tm.getVoiceMailNumber(); if (!TextUtils.isEmpty(vmNumber)) { if (service != null) { try { service.ignoreNextOutgoingCallFor(vmNumber); } catch (RemoteException e) { Log.e(THIS_FILE, "Not possible to ignore next"); } } Intent intent = new Intent(Intent.ACTION_CALL, Uri.fromParts("tel", vmNumber, null)); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(intent); } else { missingVoicemailDialog = new AlertDialog.Builder(getActivity()).setTitle(R.string.gsm) .setMessage(R.string.no_voice_mail_configured) .setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { if (missingVoicemailDialog != null) { missingVoicemailDialog.hide(); } } }).create(); // When the dialog is up, completely hide the in-call UI // underneath (which is in a partially-constructed state). missingVoicemailDialog.getWindow().addFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND); missingVoicemailDialog.show(); } } // TODO : manage others ?... for now, no way to do so cause no vm stored }
From source file:com.morestudio.littledot.doctor.ui.dialpad.DialerFragment.java
public void placeVMCall() { Long accountToUse = SipProfile.INVALID_ID; SipProfile acc = null;//from w w w. j a v a 2 s . c o m acc = accountChooserButton.getSelectedAccount(); if (acc == null) { // Maybe we could inform user nothing will happen here? return; } accountToUse = acc.id; if (accountToUse >= 0) { SipProfile vmAcc = SipProfile.getProfileFromDbId(getActivity(), acc.id, new String[] { SipProfile.FIELD_VOICE_MAIL_NBR }); if (!TextUtils.isEmpty(vmAcc.vm_nbr)) { // Account already have a VM number try { service.makeCall(vmAcc.vm_nbr, (int) acc.id); } catch (RemoteException e) { Log.e(THIS_FILE, "Service can't be called to make the call"); } } else { // Account has no VM number, propose to create one final long editedAccId = acc.id; LayoutInflater factory = LayoutInflater.from(getActivity()); final View textEntryView = factory.inflate(R.layout.alert_dialog_text_entry, null); missingVoicemailDialog = new AlertDialog.Builder(getActivity()).setTitle(acc.display_name) .setView(textEntryView) .setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { if (missingVoicemailDialog != null) { TextView tf = (TextView) missingVoicemailDialog.findViewById(R.id.vmfield); if (tf != null) { String vmNumber = tf.getText().toString(); if (!TextUtils.isEmpty(vmNumber)) { ContentValues cv = new ContentValues(); cv.put(SipProfile.FIELD_VOICE_MAIL_NBR, vmNumber); int updated = getActivity().getContentResolver() .update(ContentUris.withAppendedId( SipProfile.ACCOUNT_ID_URI_BASE, editedAccId), cv, null, null); Log.d(THIS_FILE, "Updated accounts " + updated); } } missingVoicemailDialog.hide(); } } }).setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { if (missingVoicemailDialog != null) { missingVoicemailDialog.hide(); } } }).create(); // When the dialog is up, completely hide the in-call UI // underneath (which is in a partially-constructed state). missingVoicemailDialog.getWindow().addFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND); missingVoicemailDialog.show(); } } else if (accountToUse == CallHandlerPlugin .getAccountIdForCallHandler(getActivity(), (new ComponentName(getActivity(), com.morestudio.littledot.doctor.plugins.telephony.CallHandler.class) .flattenToString()))) { // Case gsm voice mail TelephonyManager tm = (TelephonyManager) getActivity().getSystemService(Context.TELEPHONY_SERVICE); String vmNumber = tm.getVoiceMailNumber(); if (!TextUtils.isEmpty(vmNumber)) { if (service != null) { try { service.ignoreNextOutgoingCallFor(vmNumber); } catch (RemoteException e) { Log.e(THIS_FILE, "Not possible to ignore next"); } } Intent intent = new Intent(Intent.ACTION_CALL, Uri.fromParts("tel", vmNumber, null)); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(intent); } else { missingVoicemailDialog = new AlertDialog.Builder(getActivity()).setTitle(R.string.gsm) .setMessage(R.string.no_voice_mail_configured) .setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { if (missingVoicemailDialog != null) { missingVoicemailDialog.hide(); } } }).create(); // When the dialog is up, completely hide the in-call UI // underneath (which is in a partially-constructed state). missingVoicemailDialog.getWindow().addFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND); missingVoicemailDialog.show(); } } // TODO : manage others ?... for now, no way to do so cause no vm stored }
From source file:edu.umbc.cs.ebiquity.mithril.parserapp.contentparsers.contacts.ContactDetailFragment.java
/** * Builds a phone number LinearLayout based on phone number info from the Contacts Provider. * Each phone number gets its own LinearLayout object; for example, if the contact * has three phone numbers, then 3 LinearLayouts are generated. * * @param addressType From/* w w w . ja va 2 s.c om*/ * {@link android.provider.ContactsContract.CommonDataKinds.StructuredPostal#TYPE} * @param addressTypeLabel From * {@link android.provider.ContactsContract.CommonDataKinds.StructuredPostal#LABEL} * @param address From * {@link android.provider.ContactsContract.CommonDataKinds.StructuredPostal#FORMATTED_ADDRESS} * @return A LinearLayout to add to the contact details layout, * populated with the provided phone details. */ private LinearLayout buildPhoneLayout(String phoneNumber, int phoneType) { // Inflates the phone number layout final LinearLayout phoneLayout = (LinearLayout) LayoutInflater.from(getActivity()) .inflate(R.layout.contact_phone_item, mPhoneLayout, false); // Gets handles to the view objects in the layout final TextView headerTextView = (TextView) phoneLayout.findViewById(R.id.contact_phone_header); final TextView phoneTextView = (TextView) phoneLayout.findViewById(R.id.contact_phone_item); final ImageButton dialNumberButton = (ImageButton) phoneLayout.findViewById(R.id.button_call_number); // If there's no phone number for the contact, shows the empty view and message, and hides the // header and button. if (phoneNumber == null && phoneType == 0) { headerTextView.setText(""); dialNumberButton.setVisibility(View.GONE); phoneTextView.setText(R.string.no_address); } else { headerTextView.setText("Phone Number"); phoneTextView.setText(phoneNumber); // add PhoneStateListener PhoneCallListener phoneListener = new PhoneCallListener(); TelephonyManager telephonyManager = (TelephonyManager) getActivity() .getSystemService(Context.TELEPHONY_SERVICE); telephonyManager.listen(phoneListener, PhoneStateListener.LISTEN_CALL_STATE); // Defines an onClickListener object for the call number button dialNumberButton.setOnClickListener(new View.OnClickListener() { // Defines what to do when users click the address button @Override public void onClick(View view) { Intent dialIntent = null; if (!phoneTextView.equals("")) { Uri number = Uri.parse("tel:" + phoneTextView.getText()); // Log.v(ParserApplication.getDebugTag(), "Calling the number: "+number.toString()); dialIntent = new Intent(Intent.ACTION_CALL, number); startActivity(dialIntent); } // A PackageManager instance is needed to verify that there's a default app // that handles ACTION_VIEW and a geo Uri. final PackageManager packageManager = getActivity().getPackageManager(); // Checks for an activity that can handle this intent. Preferred in this // case over Intent.createChooser() as it will still let the user choose // a default (or use a previously set default) for geo Uris. if (packageManager.resolveActivity(dialIntent, PackageManager.MATCH_DEFAULT_ONLY) != null) { startActivity(dialIntent); } else { // If no default is found, displays a message that no activity can handle // the view button. Toast.makeText(getActivity(), R.string.no_intent_found, Toast.LENGTH_SHORT).show(); } } }); } return phoneLayout; }
From source file:com.fututel.ui.dialpad.DialerFragment.java
public void placeVMCall() { Long accountToUse = SipProfile.INVALID_ID; SipProfile acc = null;/*from w ww. j a v a2 s . c o m*/ acc = accountChooserButton.getSelectedAccount(); if (acc != null) { accountToUse = acc.id; } if (accountToUse >= 0) { SipProfile vmAcc = SipProfile.getProfileFromDbId(getActivity(), acc.id, new String[] { SipProfile.FIELD_VOICE_MAIL_NBR }); if (!TextUtils.isEmpty(vmAcc.vm_nbr)) { // Account already have a VM number try { service.makeCall(vmAcc.vm_nbr, (int) acc.id); } catch (RemoteException e) { Log.e(THIS_FILE, "Service can't be called to make the call"); } } else { // Account has no VM number, propose to create one final long editedAccId = acc.id; LayoutInflater factory = LayoutInflater.from(getActivity()); final View textEntryView = factory.inflate(R.layout.alert_dialog_text_entry, null); missingVoicemailDialog = new AlertDialog.Builder(getActivity()).setTitle(acc.display_name) .setView(textEntryView) .setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { if (missingVoicemailDialog != null) { TextView tf = (TextView) missingVoicemailDialog.findViewById(R.id.vmfield); if (tf != null) { String vmNumber = tf.getText().toString(); if (!TextUtils.isEmpty(vmNumber)) { ContentValues cv = new ContentValues(); cv.put(SipProfile.FIELD_VOICE_MAIL_NBR, vmNumber); int updated = getActivity().getContentResolver() .update(ContentUris.withAppendedId( SipProfile.ACCOUNT_ID_URI_BASE, editedAccId), cv, null, null); Log.d(THIS_FILE, "Updated accounts " + updated); } } missingVoicemailDialog.hide(); } } }).setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { if (missingVoicemailDialog != null) { missingVoicemailDialog.hide(); } } }).create(); // When the dialog is up, completely hide the in-call UI // underneath (which is in a partially-constructed state). missingVoicemailDialog.getWindow().addFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND); missingVoicemailDialog.show(); } } else if (accountToUse == CallHandlerPlugin.getAccountIdForCallHandler(getActivity(), (new ComponentName(getActivity(), com.fututel.plugins.telephony.CallHandler.class) .flattenToString()))) { // Case gsm voice mail TelephonyManager tm = (TelephonyManager) getActivity().getSystemService(Context.TELEPHONY_SERVICE); String vmNumber = tm.getVoiceMailNumber(); if (!TextUtils.isEmpty(vmNumber)) { if (service != null) { try { service.ignoreNextOutgoingCallFor(vmNumber); } catch (RemoteException e) { Log.e(THIS_FILE, "Not possible to ignore next"); } } Intent intent = new Intent(Intent.ACTION_CALL, Uri.fromParts("tel", vmNumber, null)); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(intent); } else { missingVoicemailDialog = new AlertDialog.Builder(getActivity()).setTitle(R.string.gsm) .setMessage(R.string.no_voice_mail_configured) .setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { if (missingVoicemailDialog != null) { missingVoicemailDialog.hide(); } } }).create(); // When the dialog is up, completely hide the in-call UI // underneath (which is in a partially-constructed state). missingVoicemailDialog.getWindow().addFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND); missingVoicemailDialog.show(); } } // TODO : manage others ?... for now, no way to do so cause no vm stored }
From source file:com.anp.bdmt.MainActivity.java
public void mOnClick(View view) { switch (view.getId()) { // case R.id.main_sale: // mPosition = 0; // mType = "W00"; // mIntent.putExtra("TYPE", mType); // mIntent.putExtra("lat", sLatitude); // mIntent.putExtra("lng", sLongitude); // mIntent.putExtra("distance", sDistance); ///* www .ja va 2s. co m*/ // startActivity(mIntent); // if (!mDialog.isShowing()) { // mDialog.show(); // } // break; case R.id.manual_location: startActivity(new Intent(this, MapActivity.class)); break; case R.id.location_name1: startActivity(new Intent(this, MapActivity.class)); break; case R.id.manual_distance: ManualDistanceDialog distanceDialog = new ManualDistanceDialog(this); distanceDialog.show(); distanceDialog.setOnDismissListener(new DialogInterface.OnDismissListener() { @Override public void onDismiss(DialogInterface dialog) { mManualDistance.setText(sDistance + "km\n"); } }); break; case R.id.main_life: new LifeDialog(this, mOnClickListener).show(); break; case R.id.btn_main_driver: startActivity(new Intent(Intent.ACTION_CALL, Uri.parse("tel:05041114111"))); break; // // // mIntent.putExtra("TYPE", mType); // // mIntent.putExtra("lat", sLatitude); // // mIntent.putExtra("lng", sLongitude); // // mIntent.putExtra("distance", sDistance); // // // startActivity(mIntent); // // if (!mDialog.isShowing()) { // // mDialog.show(); // // } // break; } }
From source file:com.canappi.connector.yp.yhere.CouponView.java
public void call(View view) { if (view.getId() == R.id.callButton) { //Open URL in a browser Object o = view.getTag(); int p = (Integer) o; String callPhone = phoneNumberArray.get(p); if (callPhone != null) { String phone = "tel:" + callPhone; Intent call = new Intent(Intent.ACTION_CALL, Uri.parse(phone)); startActivity(call);//from w w w. java 2 s .co m } //TODO Implement Action //End of Action Implementation //TODO implement call action } }
From source file:dynamite.zafroshops.app.MainActivity.java
@Override public boolean onOptionsItemSelected(final MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); switch (id) { case R.id.action_settings: return true; case R.id.new_zop_add: addZopFragment.setVisibility();/*from w w w . jav a 2 s. c o m*/ FullMobileZop newZop = addZopFragment.getFullMobileZop(); ArrayList<MobileOpeningHour> moh; ArrayList<MobileZopService> ms; if (NewZopOpenings != null) { moh = new ArrayList(); for (int i = 0; i < NewZopOpenings.size(); i++) { moh.addAll(NewZopOpenings.get(i).Hours); } newZop.OpeningHours = moh; } if (NewZopServices != null) { ms = new ArrayList(); for (int i = 0; i < NewZopServices.size(); i++) { MobileZopService mzs = new MobileZopService(); mzs.Service = NewZopServices.get(i); ms.add(mzs); } newZop.Services = ms; } if (addZopFragment.ValidateNewZop(newZop)) { addZopFragment.setMessage(); addZopFragment.setVisibility(); if (PushHandler.ids == null) { PushHandler.ids = new ArrayList<>(); } PushHandler.ids.add(newZop.Name); ListenableFuture<FullMobileZop> result = MainActivity.MobileClient.invokeApi("mobileZop", newZop, FullMobileZop.class); Futures.addCallback(result, new FutureCallback<FullMobileZop>() { @Override public void onSuccess(FullMobileZop result) { SimpleDialogFragment dialog = new SimpleDialogFragment(); Bundle args = new Bundle(); if (result == null) { args.putString(SimpleDialogFragment.DIALOG_MESSAGE, getString(R.string.new_zop_failed) + "\n" + getString(R.string.new_zop_check_location)); } else if (result.id.compareTo("-1") == 0) { args.putString(SimpleDialogFragment.DIALOG_MESSAGE, getString(R.string.new_zop_failed) + "\n" + result.Name); } else { PushHandler.ids.add(result.id); args.putString(SimpleDialogFragment.DIALOG_MESSAGE, getString(R.string.new_zop_success)); NewZopOpenings.clear(); NewZopServices.clear(); addZopFragment.clearForm(null); } addZopFragment.resetVisibility(); dialog.setArguments(args); dialog.show(getSupportFragmentManager(), "new_zop_success"); } @Override public void onFailure(@NonNull Throwable t) { SimpleDialogFragment dialog = new SimpleDialogFragment(); Bundle args = new Bundle(); addZopFragment.resetVisibility(); args.putString(SimpleDialogFragment.DIALOG_MESSAGE, getString(R.string.new_zop_failed)); dialog.setArguments(args); dialog.show(getSupportFragmentManager(), "new_zop_failed"); } }); } else { addZopFragment.resetVisibility(); addZopFragment.setMessage(); } break; case R.id.menu_zop_review: if (currentZop != null) { ReviewDialogFragment dialog = new ReviewDialogFragment(); Bundle args = new Bundle(); args.putString(ReviewDialogFragment.DIALOG_ZOP_ID, zopID); dialog.setArguments(args); dialog.show(getSupportFragmentManager(), "review"); } break; case R.id.menu_zop_drive_to: if (currentZop != null && currentZop.Location != null && currentZop.Location.Latitude != null) { Uri uri = Uri.parse(String.format(Locale.US, "google.navigation:q=%f,%f", currentZop.Location.Latitude, currentZop.Location.Longitude)); Intent mapIntent = new Intent(Intent.ACTION_VIEW, uri); mapIntent.setPackage("com.google.android.apps.maps"); if (mapIntent.resolveActivity(getPackageManager()) != null) { startActivity(mapIntent); } } break; case R.id.menu_zop_call: Intent callIntent = new Intent(Intent.ACTION_CALL); if (currentZop != null && currentZop.CountryPhoneCode != null && currentZop.PhoneNumber != null && !currentZop.PhoneNumber.trim().equals("")) { callIntent.setData(Uri.parse("tel:" + currentZop.CountryPhoneCode + currentZop.PhoneNumber)); startActivity(callIntent); } break; case R.id.menu_location_refresh: getLocation(true); getAddress(true); break; case R.id.menu_zop_refresh: refresh(); break; case R.id.menu_zops_refresh: getLocation(true); getAddress(true); nextMenu(AllZopsFragment.newInstance(position, true), false, 1); break; } return super.onOptionsItemSelected(item); }