summaryrefslogtreecommitdiffstats
path: root/src/com/android/dialer/dialpad/DialpadFragment.java
diff options
context:
space:
mode:
authorqqzhou <qqzhou@codeaurora.org>2014-07-30 16:38:15 +0800
committerXiaojing Zhang <zhangx@codeaurora.org>2014-11-04 20:35:36 -0800
commitea6871e340f986e506814f9354e805dd0bb24981 (patch)
treeb8e18b19c8dce78fcb13347935348e8bcf843db7 /src/com/android/dialer/dialpad/DialpadFragment.java
parent107cfb041eaa05d5516f74a84f4b0d1377111f64 (diff)
downloadandroid_packages_apps_Dialer-ea6871e340f986e506814f9354e805dd0bb24981.tar.gz
android_packages_apps_Dialer-ea6871e340f986e506814f9354e805dd0bb24981.tar.bz2
android_packages_apps_Dialer-ea6871e340f986e506814f9354e805dd0bb24981.zip
Dialer: support IP call for msim.
- add IP call in options menu in call detail activity. - add IP call in overflow popup menu in dialpad fragment. Change-Id: I47e4fc6eea031fcdfffa34f61da3e90f489e55a2
Diffstat (limited to 'src/com/android/dialer/dialpad/DialpadFragment.java')
-rw-r--r--src/com/android/dialer/dialpad/DialpadFragment.java60
1 files changed, 60 insertions, 0 deletions
diff --git a/src/com/android/dialer/dialpad/DialpadFragment.java b/src/com/android/dialer/dialpad/DialpadFragment.java
index cdc1c9f79..d3ffad4a1 100644
--- a/src/com/android/dialer/dialpad/DialpadFragment.java
+++ b/src/com/android/dialer/dialpad/DialpadFragment.java
@@ -70,6 +70,7 @@ import android.widget.TextView;
import com.android.contacts.common.CallUtil;
import com.android.contacts.common.ContactsUtils;
import com.android.contacts.common.GeoUtil;
+import com.android.contacts.common.MoreContactUtils;
import com.android.contacts.common.util.PhoneNumberFormatter;
import com.android.contacts.common.util.StopWatch;
import com.android.contacts.common.widget.FloatingActionButtonController;
@@ -81,6 +82,7 @@ import com.android.dialer.SpeedDialListActivity;
import com.android.dialer.SpeedDialUtils;
import com.android.dialer.util.DialerUtils;
import com.android.dialerbind.analytics.AnalyticsFragment;
+import com.android.internal.telephony.PhoneConstants;
import com.android.internal.telephony.TelephonyProperties;
import com.android.phone.common.CallLogAsync;
import com.android.phone.common.HapticFeedback;
@@ -103,6 +105,8 @@ public class DialpadFragment extends AnalyticsFragment
DialpadKeyButton.OnPressedListener {
private static final String TAG = DialpadFragment.class.getSimpleName();
+ private Context mContext;
+
/**
* This interface allows the DialpadFragment to tell its hosting Activity when and when not
* to display the "dial" button. While this is logically part of the DialpadFragment, the
@@ -903,6 +907,27 @@ public class DialpadFragment extends AnalyticsFragment
final MenuItem sendMessage = menu.findItem(R.id.menu_send_message);
sendMessage.setVisible(mSmsPackageComponentName != null);
+ final MenuItem ipCallBySlot1 = menu.findItem(R.id.menu_ip_call_by_slot1);
+ final MenuItem ipCallBySlot2 = menu.findItem(R.id.menu_ip_call_by_slot2);
+ if (MoreContactUtils.isMultiSimEnable(mContext, PhoneConstants.SUB1)) {
+ String sub1Name = MoreContactUtils.getMultiSimAliasesName(
+ mContext, PhoneConstants.SUB1);
+ ipCallBySlot1.setTitle(mContext.getString(
+ com.android.contacts.common.R.string.ip_call_by_slot, sub1Name));
+ ipCallBySlot1.setVisible(true);
+ } else {
+ ipCallBySlot1.setVisible(false);
+ }
+ if (MoreContactUtils.isMultiSimEnable(mContext, PhoneConstants.SUB2)) {
+ String sub2Name = MoreContactUtils.getMultiSimAliasesName(
+ mContext, PhoneConstants.SUB2);
+ ipCallBySlot2.setTitle(mContext.getString(
+ com.android.contacts.common.R.string.ip_call_by_slot, sub2Name));
+ ipCallBySlot2.setVisible(true);
+ } else {
+ ipCallBySlot2.setVisible(false);
+ }
+
boolean enable = !isDigitsEmpty();
for (int i = 0; i < menu.size(); i++) {
menu.getItem(i).setEnabled(enable);
@@ -1103,6 +1128,35 @@ public class DialpadFragment extends AnalyticsFragment
return false;
}
+ @Override
+ public void onAttach(Activity activity) {
+ super.onAttach(activity);
+ mContext = activity;
+ }
+
+ private void ipCallBySlot(int subscription) {
+ String prefix = MoreContactUtils.getIPCallPrefix(mContext, subscription);
+ if (!TextUtils.isEmpty(prefix)) {
+ ComponentName serviceName =
+ new ComponentName("com.android.phone",
+ "com.android.services.telephony.TelephonyConnectionService");
+ PhoneAccountHandle account = new PhoneAccountHandle(serviceName,
+ String.valueOf(subscription));
+ Intent callIntent = new Intent(CallUtil.getCallIntent(
+ prefix + "" + getValidDialNumber(), account));
+ startActivity(callIntent);
+ } else {
+ MoreContactUtils.showNoIPNumberDialog(mContext, subscription);
+ }
+ }
+
+ private String getValidDialNumber() {
+ if (mDigits != null)
+ return mDigits.getText().toString();
+ else
+ return "";
+ }
+
/**
* Remove the digit just before the current position. This can be used if we want to replace
* the previous digit or cancel previously entered character.
@@ -1597,6 +1651,12 @@ public class DialpadFragment extends AnalyticsFragment
DialerUtils.startActivityWithErrorToast(getActivity(), smsIntent);
return true;
}
+ case R.id.menu_ip_call_by_slot1:
+ ipCallBySlot(PhoneConstants.SUB1);
+ return true;
+ case R.id.menu_ip_call_by_slot2:
+ ipCallBySlot(PhoneConstants.SUB2);
+ return true;
default:
return false;
}