diff options
-rw-r--r-- | res/drawable-hdpi/ic_add_group_holo_dark.png | bin | 0 -> 2230 bytes | |||
-rwxr-xr-x | res/drawable-hdpi/ic_dialpad_holo_dark.png | bin | 0 -> 1389 bytes | |||
-rw-r--r-- | res/drawable-ldrtl-hdpi/ic_add_group_holo_dark.png | bin | 0 -> 6870 bytes | |||
-rw-r--r-- | res/drawable-ldrtl-mdpi/ic_add_group_holo_dark.png | bin | 0 -> 5697 bytes | |||
-rw-r--r-- | res/drawable-ldrtl-xhdpi/ic_add_group_holo_dark.png | bin | 0 -> 8294 bytes | |||
-rw-r--r-- | res/drawable-mdpi/ic_add_group_holo_dark.png | bin | 0 -> 1441 bytes | |||
-rwxr-xr-x | res/drawable-mdpi/ic_dialpad_holo_dark.png | bin | 0 -> 1095 bytes | |||
-rw-r--r-- | res/drawable-xhdpi/ic_add_group_holo_dark.png | bin | 0 -> 3181 bytes | |||
-rwxr-xr-x | res/drawable-xhdpi/ic_dialpad_holo_dark.png | bin | 0 -> 1439 bytes | |||
-rw-r--r-- | res/layout-land/dialpad_fragment.xml | 50 | ||||
-rw-r--r-- | res/layout/dialpad_fragment.xml | 59 | ||||
-rw-r--r-- | res/values/strings.xml | 2 | ||||
-rw-r--r-- | src/com/android/dialer/dialpad/DialpadFragment.java | 140 |
13 files changed, 235 insertions, 16 deletions
diff --git a/res/drawable-hdpi/ic_add_group_holo_dark.png b/res/drawable-hdpi/ic_add_group_holo_dark.png Binary files differnew file mode 100644 index 000000000..6d46ccffb --- /dev/null +++ b/res/drawable-hdpi/ic_add_group_holo_dark.png diff --git a/res/drawable-hdpi/ic_dialpad_holo_dark.png b/res/drawable-hdpi/ic_dialpad_holo_dark.png Binary files differnew file mode 100755 index 000000000..a0ab6c453 --- /dev/null +++ b/res/drawable-hdpi/ic_dialpad_holo_dark.png diff --git a/res/drawable-ldrtl-hdpi/ic_add_group_holo_dark.png b/res/drawable-ldrtl-hdpi/ic_add_group_holo_dark.png Binary files differnew file mode 100644 index 000000000..54f247ad1 --- /dev/null +++ b/res/drawable-ldrtl-hdpi/ic_add_group_holo_dark.png diff --git a/res/drawable-ldrtl-mdpi/ic_add_group_holo_dark.png b/res/drawable-ldrtl-mdpi/ic_add_group_holo_dark.png Binary files differnew file mode 100644 index 000000000..a984b568b --- /dev/null +++ b/res/drawable-ldrtl-mdpi/ic_add_group_holo_dark.png diff --git a/res/drawable-ldrtl-xhdpi/ic_add_group_holo_dark.png b/res/drawable-ldrtl-xhdpi/ic_add_group_holo_dark.png Binary files differnew file mode 100644 index 000000000..3688e466b --- /dev/null +++ b/res/drawable-ldrtl-xhdpi/ic_add_group_holo_dark.png diff --git a/res/drawable-mdpi/ic_add_group_holo_dark.png b/res/drawable-mdpi/ic_add_group_holo_dark.png Binary files differnew file mode 100644 index 000000000..a676ab886 --- /dev/null +++ b/res/drawable-mdpi/ic_add_group_holo_dark.png diff --git a/res/drawable-mdpi/ic_dialpad_holo_dark.png b/res/drawable-mdpi/ic_dialpad_holo_dark.png Binary files differnew file mode 100755 index 000000000..b57fcf344 --- /dev/null +++ b/res/drawable-mdpi/ic_dialpad_holo_dark.png diff --git a/res/drawable-xhdpi/ic_add_group_holo_dark.png b/res/drawable-xhdpi/ic_add_group_holo_dark.png Binary files differnew file mode 100644 index 000000000..85924aba4 --- /dev/null +++ b/res/drawable-xhdpi/ic_add_group_holo_dark.png diff --git a/res/drawable-xhdpi/ic_dialpad_holo_dark.png b/res/drawable-xhdpi/ic_dialpad_holo_dark.png Binary files differnew file mode 100755 index 000000000..f9a002c79 --- /dev/null +++ b/res/drawable-xhdpi/ic_dialpad_holo_dark.png 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" /> + <!-- recipients replaces digits and deleteButton when + dial conference controls are made visible. --> + <EditText + android:id="@+id/recipients" + android:layout_width="0dip" + android:layout_weight="1" + android:layout_height="match_parent" + android:layout_gravity="center" + android:layout_marginLeft="8dip" + android:autoText="true" + android:textSize="16sp" + android:hint="@string/to_hint" + android:minHeight="48dip" + android:maxLines="3" + android:maxLength="2000" + android:textColor="?android:attr/textColorPrimary" + android:background="@android:color/transparent"/> + + </LinearLayout> <!-- "Dialpad chooser" UI, shown only when the user brings up the @@ -70,17 +89,32 @@ <!-- Keypad section --> <include layout="@layout/dialpad" /> + <View + android:id="@+id/dialpadStub" + android:layout_width="match_parent" + android:layout_height="0px" + android:layout_weight="@integer/dialpad_layout_weight_dialpad" + android:layout_gravity="center_horizontal" + android:layout_marginTop="@dimen/dialpad_vertical_margin" + android:paddingLeft="5dip" + android:paddingRight="5dip" + android:paddingBottom="10dip" + android:background="@drawable/dialpad_background"/> </LinearLayout> <View android:layout_width="@dimen/dialpad_center_margin" android:layout_height="match_parent" android:background="#66000000"/> - <RelativeLayout + <TableLayout android:id="@+id/dialButtonContainer" android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="2" android:background="@drawable/dialpad_background"> + + <TableRow + android:layout_height="match_parent" + android:layout_weight="1"> <View android:layout_width="match_parent" android:layout_height="@dimen/dialpad_button_margin" @@ -94,5 +128,17 @@ android:background="@drawable/btn_call" android:contentDescription="@string/description_dial_button" android:src="@drawable/ic_dial_action_call" /> - </RelativeLayout> + <!-- src for image for the button will be changed dynamically in the code. + See DialpadFragment.--> + <ImageButton + android:id="@+id/dialConferenceButton" + android:layout_width="match_parent" + android:layout_height="@dimen/call_button_height" + android:layout_alignParentBottom="true" + android:state_enabled="false" + android:background="@drawable/btn_call" + android:contentDescription="@string/dial_conference" + android:src="@drawable/ic_add_group_holo_dark" /> + </TableRow> + </TableLayout> </LinearLayout> 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" /> + + <!-- recipients replaces digits and deleteButton when + dial conference controls are made visible. --> + <EditText + android:id="@+id/recipients" + android:layout_width="0dip" + android:layout_weight="1" + android:layout_height="match_parent" + android:layout_gravity="center" + android:layout_marginLeft="8dip" + android:autoText="true" + android:textSize="16sp" + android:hint="@string/to_hint" + android:minHeight="48dip" + android:maxLines="3" + android:maxLength="2000" + android:textColor="?android:attr/textColorPrimary" + android:background="@android:color/transparent"/> </LinearLayout> <!-- Smart dial suggestion section. @@ -85,9 +103,27 @@ <include layout="@layout/dialpad" /> <View style="@style/DialpadHorizontalSeparator"/> + <!-- dialpadStub values are copied from dialpad.xml. dialpadStub replaces dialpad when + dial conference controls are made visible. --> + <View + android:id="@+id/dialpadStub" + android:layout_width="match_parent" + android:layout_height="0px" + android:layout_weight="@integer/dialpad_layout_weight_dialpad" + android:layout_gravity="center_horizontal" + android:layout_marginTop="@dimen/dialpad_vertical_margin" + android:paddingLeft="5dip" + android:paddingRight="5dip" + android:paddingBottom="10dip" + android:background="@drawable/dialpad_background"/> + + <View + android:layout_width="match_parent" + android:layout_height="@dimen/dialpad_vertical_margin" + android:background="#66000000"/> <!-- left and right paddings will be modified by the code. See DialpadFragment. --> - <FrameLayout + <TableLayout android:id="@+id/dialButtonContainer" android:layout_width="match_parent" android:layout_height="0px" @@ -95,17 +131,34 @@ android:layout_gravity="center_horizontal" android:background="@drawable/dialpad_background"> + <TableRow + android:layout_height="match_parent" + android:layout_weight="1"> <ImageButton android:id="@+id/dialButton" - android:layout_width="match_parent" + android:layout_width="0dip" android:layout_height="match_parent" + android:layout_weight="1" android:layout_gravity="center" android:state_enabled="false" android:background="@drawable/btn_call" android:contentDescription="@string/description_dial_button" android:src="@drawable/ic_dial_action_call" /> - </FrameLayout> + <!-- src for image for the button will be changed dynamically in the code. + See DialpadFragment.--> + <ImageButton + android:id="@+id/dialConferenceButton" + android:layout_width="0dip" + android:layout_height="match_parent" + android:layout_weight="1" + android:layout_gravity="center" + android:state_enabled="false" + android:background="@drawable/btn_call" + android:contentDescription="@string/description_dial_button" + android:src="@drawable/ic_add_group_holo_dark" /> + </TableRow> + </TableLayout> <!-- "Dialpad chooser" UI, shown only when the user brings up the Dialer while a call is already in progress. diff --git a/res/values/strings.xml b/res/values/strings.xml index 9bf0ee842..889ba4e8d 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -511,4 +511,6 @@ <!-- Message displayed when there is no application available to handle the add contact menu option. [CHAR LIMIT=NONE] --> <string name="add_contact_not_available">Re-enable the People application to use this feature.</string> + <string name="dial_conference">Dial conference</string> + <string name="to_hint">1111:to;sip:abby@example.com:bcc;sip:bill@example.com:cc;</string> </resources> 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); |