From 6981e3e852864ccf5de9c3077382d237a0c9b8cc Mon Sep 17 00:00:00 2001 From: Shriram Ganesh Date: Fri, 15 Feb 2013 12:01:51 -0800 Subject: IMS: Dialer app changes for IMS IMS Conference URI UI changes 1. Add a new button for initiating conference URI call in the Dial screen. 2. Send a intent for the conference call with a extra to indicate the call type as conference CRs-Fixed: 455241 Enable visibility of digits container for adding call 1. When a call is active, the user goes to home screen and presses the phone button and then chooses add call. The recipients box is not visible as the visibility of digits container is is not VISIBLE. In this change, the visibility of digits container is set to VISBILE. CRs-Fixed: 486790 Change-Id: Ibdf138eb0f32fed68c3bdc4e6d3f99cea68608b1 --- res/drawable-hdpi/ic_add_group_holo_dark.png | Bin 0 -> 2230 bytes res/drawable-hdpi/ic_dialpad_holo_dark.png | Bin 0 -> 1389 bytes res/drawable-ldrtl-hdpi/ic_add_group_holo_dark.png | Bin 0 -> 6870 bytes res/drawable-ldrtl-mdpi/ic_add_group_holo_dark.png | Bin 0 -> 5697 bytes .../ic_add_group_holo_dark.png | Bin 0 -> 8294 bytes res/drawable-mdpi/ic_add_group_holo_dark.png | Bin 0 -> 1441 bytes res/drawable-mdpi/ic_dialpad_holo_dark.png | Bin 0 -> 1095 bytes res/drawable-xhdpi/ic_add_group_holo_dark.png | Bin 0 -> 3181 bytes res/drawable-xhdpi/ic_dialpad_holo_dark.png | Bin 0 -> 1439 bytes res/layout-land/dialpad_fragment.xml | 50 +++++++- res/layout/dialpad_fragment.xml | 59 ++++++++- res/values/strings.xml | 2 + .../android/dialer/dialpad/DialpadFragment.java | 140 +++++++++++++++++++-- 13 files changed, 235 insertions(+), 16 deletions(-) create mode 100644 res/drawable-hdpi/ic_add_group_holo_dark.png create mode 100755 res/drawable-hdpi/ic_dialpad_holo_dark.png create mode 100644 res/drawable-ldrtl-hdpi/ic_add_group_holo_dark.png create mode 100644 res/drawable-ldrtl-mdpi/ic_add_group_holo_dark.png create mode 100644 res/drawable-ldrtl-xhdpi/ic_add_group_holo_dark.png create mode 100644 res/drawable-mdpi/ic_add_group_holo_dark.png create mode 100755 res/drawable-mdpi/ic_dialpad_holo_dark.png create mode 100644 res/drawable-xhdpi/ic_add_group_holo_dark.png create mode 100755 res/drawable-xhdpi/ic_dialpad_holo_dark.png diff --git a/res/drawable-hdpi/ic_add_group_holo_dark.png b/res/drawable-hdpi/ic_add_group_holo_dark.png new file mode 100644 index 000000000..6d46ccffb Binary files /dev/null and b/res/drawable-hdpi/ic_add_group_holo_dark.png differ diff --git a/res/drawable-hdpi/ic_dialpad_holo_dark.png b/res/drawable-hdpi/ic_dialpad_holo_dark.png new file mode 100755 index 000000000..a0ab6c453 Binary files /dev/null and b/res/drawable-hdpi/ic_dialpad_holo_dark.png differ diff --git a/res/drawable-ldrtl-hdpi/ic_add_group_holo_dark.png b/res/drawable-ldrtl-hdpi/ic_add_group_holo_dark.png new file mode 100644 index 000000000..54f247ad1 Binary files /dev/null and b/res/drawable-ldrtl-hdpi/ic_add_group_holo_dark.png differ diff --git a/res/drawable-ldrtl-mdpi/ic_add_group_holo_dark.png b/res/drawable-ldrtl-mdpi/ic_add_group_holo_dark.png new file mode 100644 index 000000000..a984b568b Binary files /dev/null and b/res/drawable-ldrtl-mdpi/ic_add_group_holo_dark.png differ diff --git a/res/drawable-ldrtl-xhdpi/ic_add_group_holo_dark.png b/res/drawable-ldrtl-xhdpi/ic_add_group_holo_dark.png new file mode 100644 index 000000000..3688e466b Binary files /dev/null and b/res/drawable-ldrtl-xhdpi/ic_add_group_holo_dark.png differ diff --git a/res/drawable-mdpi/ic_add_group_holo_dark.png b/res/drawable-mdpi/ic_add_group_holo_dark.png new file mode 100644 index 000000000..a676ab886 Binary files /dev/null and b/res/drawable-mdpi/ic_add_group_holo_dark.png differ diff --git a/res/drawable-mdpi/ic_dialpad_holo_dark.png b/res/drawable-mdpi/ic_dialpad_holo_dark.png new file mode 100755 index 000000000..b57fcf344 Binary files /dev/null and b/res/drawable-mdpi/ic_dialpad_holo_dark.png differ diff --git a/res/drawable-xhdpi/ic_add_group_holo_dark.png b/res/drawable-xhdpi/ic_add_group_holo_dark.png new file mode 100644 index 000000000..85924aba4 Binary files /dev/null and b/res/drawable-xhdpi/ic_add_group_holo_dark.png differ diff --git a/res/drawable-xhdpi/ic_dialpad_holo_dark.png b/res/drawable-xhdpi/ic_dialpad_holo_dark.png new file mode 100755 index 000000000..f9a002c79 Binary files /dev/null and b/res/drawable-xhdpi/ic_dialpad_holo_dark.png differ diff --git a/res/layout-land/dialpad_fragment.xml b/res/layout-land/dialpad_fragment.xml index 658a03b7b..0215342ae 100644 --- a/res/layout-land/dialpad_fragment.xml +++ b/res/layout-land/dialpad_fragment.xml @@ -57,6 +57,25 @@ android:contentDescription="@string/description_delete_button" android:src="@drawable/ic_dial_action_delete" /> + + + + + - + + - + + + + diff --git a/res/layout/dialpad_fragment.xml b/res/layout/dialpad_fragment.xml index f3bd2a213..fe11c31aa 100644 --- a/res/layout/dialpad_fragment.xml +++ b/res/layout/dialpad_fragment.xml @@ -55,6 +55,24 @@ android:background="?android:attr/selectableItemBackground" android:contentDescription="@string/description_delete_button" android:src="@drawable/ic_dial_action_delete" /> + + + + + + - + - + + + + Re-enable the People application to use this feature. + Dial conference + 1111:to;sip:abby@example.com:bcc;sip:bill@example.com:cc; diff --git a/src/com/android/dialer/dialpad/DialpadFragment.java b/src/com/android/dialer/dialpad/DialpadFragment.java index 5f70312ff..b54084e4c 100644 --- a/src/com/android/dialer/dialpad/DialpadFragment.java +++ b/src/com/android/dialer/dialpad/DialpadFragment.java @@ -66,6 +66,7 @@ import android.widget.AbsListView; import android.widget.AdapterView; import android.widget.BaseAdapter; import android.widget.EditText; +import android.widget.ImageButton; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.ListView; @@ -90,6 +91,7 @@ import com.android.phone.common.HapticFeedback; import com.google.common.annotations.VisibleForTesting; import java.util.List; +import com.android.internal.telephony.TelephonyProperties; /** * Fragment that displays a twelve-key phone dialpad. @@ -128,6 +130,9 @@ public class DialpadFragment extends Fragment private View mDigitsContainer; private EditText mDigits; + private EditText mRecipients; + private View mDialpadStub; + /** Remembers if we need to clear digits field when the screen is completely gone. */ private boolean mClearDigitsOnStop; @@ -145,6 +150,7 @@ public class DialpadFragment extends Fragment private View mDialButtonContainer; private View mDialButton; + private ImageButton mDialConferenceButton; private ListView mDialpadChooser; private DialpadChooserAdapter mDialpadChooserAdapter; @@ -197,6 +203,9 @@ public class DialpadFragment extends Fragment private static final String EXTRA_SEND_EMPTY_FLASH = "com.android.phone.extra.SEND_EMPTY_FLASH"; + private static final String EXTRA_DIAL_CONFERENCE_URI = + "com.android.phone.extra.DIAL_CONFERENCE_URI"; + private String mCurrentCountryIso; private final PhoneStateListener mPhoneStateListener = new PhoneStateListener() { @@ -214,11 +223,24 @@ public class DialpadFragment extends Fragment // Note there's a race condition in the UI here: the // dialpad chooser could conceivably disappear (on its // own) at the exact moment the user was trying to select - // one of the choices, which would be confusing. (But at + // one of the choices, which would be confusing. (But at // least that's better than leaving the dialpad chooser // onscreen, but useless...) showDialpadChooser(false); } + + if (state == TelephonyManager.CALL_STATE_IDLE) { + // No existing calls, conference can be originated. + // Note that when there is on going call, add call should not show dial + // conference button since normal dialpad should be used. + // Check if ImsPhone is created, if so enable the conference button. + if (SystemProperties.getBoolean( + TelephonyProperties.CALLS_ON_IMS_ENABLED_PROPERTY, false)) { + // Note, phone app still need to check if UI option to "Use Ims Always" + // is checked upon receiving dial request. + mDialConferenceButton.setVisibility(View.VISIBLE); + } + } } }; @@ -322,6 +344,16 @@ public class DialpadFragment extends Fragment mDigits.setOnLongClickListener(this); mDigits.addTextChangedListener(this); PhoneNumberFormatter.setPhoneNumberFormattingTextWatcher(getActivity(), mDigits); + + mRecipients = (EditText) fragmentView.findViewById(R.id.recipients); + if (null != mRecipients) { + mRecipients.setVisibility(View.GONE); + mRecipients.addTextChangedListener(this); + } + + mDialpadStub = fragmentView.findViewById(R.id.dialpadStub); + if (null != mDialpadStub) mDialpadStub.setVisibility(View.GONE); + // Check for the presence of the keypad View oneButton = fragmentView.findViewById(R.id.one); if (oneButton != null) { @@ -349,6 +381,20 @@ public class DialpadFragment extends Fragment mDialButton = null; } + mDialConferenceButton = (ImageButton) fragmentView.findViewById(R.id.dialConferenceButton); + if(SystemProperties.getBoolean( + TelephonyProperties.CALLS_ON_IMS_ENABLED_PROPERTY, false)) { + if (mDialConferenceButton != null) { + mDialConferenceButton.setOnClickListener(this); + mDialConferenceButton.setOnLongClickListener(this); + } + } + else{ + if (mDialConferenceButton != null) { + mDialConferenceButton.setVisibility(View.GONE); + } + } + mDelete = fragmentView.findViewById(R.id.deleteButton); if (mDelete != null) { mDelete.setOnClickListener(this); @@ -489,6 +535,9 @@ public class DialpadFragment extends Fragment } } + } else { + // for add call, show normal dialpad without dial conference button. + mDialConferenceButton.setVisibility(View.GONE); } showDialpadChooser(needToShowDialpadChooser); @@ -909,6 +958,10 @@ public class DialpadFragment extends Fragment } return; } + case R.id.dialConferenceButton: { + dialConferenceButtonPressed(); + return; + } default: { Log.wtf(TAG, "Unexpected onClick() event from: " + view); return; @@ -1093,11 +1146,20 @@ public class DialpadFragment extends Fragment * case described above). */ public void dialButtonPressed() { - if (isDigitsEmpty()) { // No number entered. + boolean isDigitsShown = mDigits.isShown(); + final String number = (isDigitsShown) ? mDigits.getText().toString() : + mRecipients.getText().toString().trim(); + + if (isDigitsShown && isDigitsEmpty()) { // No number entered. handleDialButtonClickWithEmptyDigits(); + } else if (!isDigitsShown && number.isEmpty()) { + // mRecipients must be empty + // TODO add support for conference URI in last number dialed + // use ErrorDialogFragment instead? also see android.app.AlertDialog + android.widget.Toast.makeText(getActivity(), + "Error: Cannot dial. Please provide conference recipients.", + android.widget.Toast.LENGTH_SHORT).show(); } else { - final String number = mDigits.getText().toString(); - // "persist.radio.otaspdial" is a temporary hack needed for one carrier's automated // test equipment. // TODO: clean it up. @@ -1113,11 +1175,19 @@ public class DialpadFragment extends Fragment } // Clear the digits just in case. - mDigits.getText().clear(); + if (isDigitsShown) { + mDigits.getText().clear(); + } else { + mRecipients.getText().clear(); + } } else { final Intent intent = CallUtil.getCallIntent(number, (getActivity() instanceof DialtactsActivity ? ((DialtactsActivity) getActivity()).getCallOrigin() : null)); + if (!isDigitsShown) { + // must be dial conference add extra + intent.putExtra(EXTRA_DIAL_CONFERENCE_URI, true); + } startActivity(intent); mClearDigitsOnStop = true; getActivity().finish(); @@ -1130,6 +1200,13 @@ public class DialpadFragment extends Fragment ((DialtactsActivity) getActivity()).getCallOrigin() : null; } + public void dialConferenceButtonPressed() { + // show dial conference screen if it is not shown + // If it is already shown, show normal dial screen + boolean show = (mRecipients != null) ? !mRecipients.isShown() : false; + showDialConference(show); + } + private void handleDialButtonClickWithEmptyDigits() { if (phoneIsCdma() && phoneIsOffhook()) { // This is really CDMA specific. On GSM is it possible @@ -1258,7 +1335,10 @@ public class DialpadFragment extends Fragment } else { // mDigits is not enclosed by the container. Make the digits field itself gone. mDigits.setVisibility(View.GONE); + if (mDelete != null) mDelete.setVisibility(View.GONE); + if (mRecipients != null) mRecipients.setVisibility(View.GONE); } + if (mDialpadStub != null) mDialpadStub.setVisibility(View.GONE); if (mDialpad != null) mDialpad.setVisibility(View.GONE); if (mDialButtonContainer != null) mDialButtonContainer.setVisibility(View.GONE); @@ -1272,14 +1352,45 @@ public class DialpadFragment extends Fragment mDialpadChooser.setAdapter(mDialpadChooserAdapter); } else { // Log.i(TAG, "Displaying normal Dialer UI."); + showDialConference(false); + if (mDialButtonContainer != null) mDialButtonContainer.setVisibility(View.VISIBLE); + mDialpadChooser.setVisibility(View.GONE); + } + } + + private void showDialConference(boolean enabled) { + // Check if onCreateView() is already called by checking one of View objects. + if (!isLayoutReady()) { + return; + } + Log.d(TAG, "showDialConference " + enabled); + + //change the image of the button + if (enabled) { + if (mRecipients != null) mRecipients.setVisibility(View.VISIBLE); + if (mDialpadStub != null) mDialpadStub.setVisibility(View.VISIBLE); + if (mDigits != null) mDigits.setVisibility(View.GONE); + if (mDelete != null) mDelete.setVisibility(View.GONE); + if (mDialpad != null) mDialpad.setVisibility(View.GONE); + // dial conference view is shown, so button should show dialpad image. + // Pressing the button again will return to normal dialpad view + if(mDialConferenceButton != null) { + mDialConferenceButton.setImageResource(R.drawable.ic_dialpad_holo_dark); + } + } else { if (mDigitsContainer != null) { mDigitsContainer.setVisibility(View.VISIBLE); - } else { - mDigits.setVisibility(View.VISIBLE); } + if (mRecipients != null) mRecipients.setVisibility(View.GONE); + if (mDialpadStub != null) mDialpadStub.setVisibility(View.GONE); + if (mDigits != null) mDigits.setVisibility(View.VISIBLE); + if (mDelete != null) mDelete.setVisibility(View.VISIBLE); if (mDialpad != null) mDialpad.setVisibility(View.VISIBLE); - if (mDialButtonContainer != null) mDialButtonContainer.setVisibility(View.VISIBLE); - mDialpadChooser.setVisibility(View.GONE); + // normal dialpad view is shown, so button should show dial conference image. + // Pressing the button again will show dial conference view + if(mDialConferenceButton != null) { + mDialConferenceButton.setImageResource(R.drawable.ic_add_group_holo_dark); + } } } @@ -1570,8 +1681,15 @@ public class DialpadFragment extends Fragment // Enable the Dial button if some digits have // been entered, or if there is a last dialed number // that could be redialed. - mDialButton.setEnabled(digitsNotEmpty || - !TextUtils.isEmpty(mLastNumberDialed)); + if(mRecipients.getVisibility() != View.VISIBLE) { + mDialButton.setEnabled(digitsNotEmpty || + !TextUtils.isEmpty(mLastNumberDialed)); + } + else { + mDialButton.setEnabled(digitsNotEmpty || + !TextUtils.isEmpty(mLastNumberDialed) || + mRecipients.getText().length() > 0); + } } } mDelete.setEnabled(digitsNotEmpty); -- cgit v1.2.3