修改为语音信箱直接拨出
时间:10-02
整理:3721RD
点击:
[DESCRIPTION]
点击状态栏中语音信箱,弹出提示框,选择OK后,直接拨出号码,而不进入拨号界面。
[SOLUTION]
在VoicemailDialog.java中的onCLIck()方法中修改
将
case R.id.button_ok:
Log.d(TAG, "onClick() intent" + mIntent);
String number = mIntent.getStringExtra("voicemail_number");
Log.d(TAG, "onClick() number" + number);
//Uri numberUri = Uri.parse("voicemail:x");
Uri numberUri = Uri.fROMParts("voicemail", number, null);
Intent intentToDialer = new Intent(Intent.ACTION_DIAL, numberUri);
startActivity(intentToDialer);
try {
Thread.sleep(SLEEPTIME);
} catch (InterruptedException e) {
Log.d(TAG, "onClick() InterruptedException");
}
if (TextUtils.isEmpty(number)) {
String unkonwnVoicemail =
getResources().getString(R.string.notification_voicemail_no_vm_number);
Toast.makeText(PhoneGlobals.getInstance(), unkonwnVoicemail, Toast.LENGTH_LONG).show();
}
finish();
break;
修改为:
case R.id.button_ok:
Log.d(TAG, "onClick() intent" + mIntent);
String number = mIntent.getStringExtra("voicemail_number");
Log.d(TAG, "onClick() number" + number);
if (TextUtils.isEmpty(number)) {
String unkonwnVoicemail =
getResources().getString(R.string.notification_voicemail_no_vm_number);
Toast.makeText(PhoneGlobals.getInstance(), unkonwnVoicemail, Toast.LENGTH_LONG).show();
}else{
Uri uri = Uri.fromParts("tel", number, null);
Intent newIntent = new Intent(Intent.ACTION_CALL, uri);
number = PhoneUtils.specialNumberTransfer(number);
newIntent.putExtra(Constants.EXTRA_ACTUAL_NUMBER_TO_DIAL, number);
newIntent.putExtra(Constants.EXTRA_SLOT_ID, mIntent.getIntExtra(GeminiConstants.SLOT_ID_KEY, 0), 0));
PhoneGlobals.getInstance().callController.placeCall(newIntent);
try {
Thread.sleep(SLEEPTIME);
} catch (InterruptedException e) {
Log.d(TAG, "onClick() InterruptedException");
}
}
finish();
break;
点击状态栏中语音信箱,弹出提示框,选择OK后,直接拨出号码,而不进入拨号界面。
[SOLUTION]
在VoicemailDialog.java中的onCLIck()方法中修改
将
case R.id.button_ok:
Log.d(TAG, "onClick() intent" + mIntent);
String number = mIntent.getStringExtra("voicemail_number");
Log.d(TAG, "onClick() number" + number);
//Uri numberUri = Uri.parse("voicemail:x");
Uri numberUri = Uri.fROMParts("voicemail", number, null);
Intent intentToDialer = new Intent(Intent.ACTION_DIAL, numberUri);
startActivity(intentToDialer);
try {
Thread.sleep(SLEEPTIME);
} catch (InterruptedException e) {
Log.d(TAG, "onClick() InterruptedException");
}
if (TextUtils.isEmpty(number)) {
String unkonwnVoicemail =
getResources().getString(R.string.notification_voicemail_no_vm_number);
Toast.makeText(PhoneGlobals.getInstance(), unkonwnVoicemail, Toast.LENGTH_LONG).show();
}
finish();
break;
修改为:
case R.id.button_ok:
Log.d(TAG, "onClick() intent" + mIntent);
String number = mIntent.getStringExtra("voicemail_number");
Log.d(TAG, "onClick() number" + number);
if (TextUtils.isEmpty(number)) {
String unkonwnVoicemail =
getResources().getString(R.string.notification_voicemail_no_vm_number);
Toast.makeText(PhoneGlobals.getInstance(), unkonwnVoicemail, Toast.LENGTH_LONG).show();
}else{
Uri uri = Uri.fromParts("tel", number, null);
Intent newIntent = new Intent(Intent.ACTION_CALL, uri);
number = PhoneUtils.specialNumberTransfer(number);
newIntent.putExtra(Constants.EXTRA_ACTUAL_NUMBER_TO_DIAL, number);
newIntent.putExtra(Constants.EXTRA_SLOT_ID, mIntent.getIntExtra(GeminiConstants.SLOT_ID_KEY, 0), 0));
PhoneGlobals.getInstance().callController.placeCall(newIntent);
try {
Thread.sleep(SLEEPTIME);
} catch (InterruptedException e) {
Log.d(TAG, "onClick() InterruptedException");
}
}
finish();
break;