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/drawable/dialpad_background.xml | 19 | ||||
-rw-r--r-- | res/layout/dialpad_fragment.xml | 57 | ||||
-rw-r--r-- | res/values/strings.xml | 5 | ||||
-rw-r--r-- | src/com/android/dialer/dialpad/DialpadFragment.java | 176 |
13 files changed, 236 insertions, 21 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/drawable/dialpad_background.xml b/res/drawable/dialpad_background.xml new file mode 100644 index 000000000..0e31f5eac --- /dev/null +++ b/res/drawable/dialpad_background.xml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2011 The Android Open Source Project + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> + +<bitmap xmlns:android="http://schemas.android.com/apk/res/android" + android:src="@drawable/dial_background_texture" + android:tileMode="repeat" /> diff --git a/res/layout/dialpad_fragment.xml b/res/layout/dialpad_fragment.xml index dca9bad68..08cc97aca 100644 --- a/res/layout/dialpad_fragment.xml +++ b/res/layout/dialpad_fragment.xml @@ -71,6 +71,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_height="match_parent" + android:layout_gravity="center" + android:layout_marginLeft="8dip" + android:layout_weight="1" + android:autoText="true" + android:background="@android:color/transparent" + android:hint="@string/to_hint" + android:maxLength="2000" + android:maxLines="3" + android:minHeight="48dip" + android:textColor="?android:attr/textColorPrimary" + android:textSize="16sp" /> </LinearLayout> <!-- Keypad section --> @@ -78,13 +96,35 @@ <View style="@style/DialpadHorizontalSeparator"/> - <LinearLayout + <!-- 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_gravity="center_horizontal" + android:layout_marginTop="@dimen/dialpad_vertical_margin" + android:layout_weight="@integer/dialpad_layout_weight_dialpad" + android:background="@drawable/dialpad_background" + android:paddingBottom="10dip" + android:paddingLeft="5dip" + android:paddingRight="5dip" /> + + <View + android:layout_width="match_parent" + android:layout_height="@dimen/dialpad_vertical_margin" + android:background="#66000000" /> + + <TableLayout android:id="@+id/dialButtonContainer" android:layout_width="match_parent" android:layout_height="@dimen/fake_action_bar_height" android:layout_gravity="center_horizontal" android:background="@color/dialpad_call_button_color" android:layoutDirection="locale"> + <TableRow + android:layout_height="match_parent" + android:layout_weight="1"> <ImageButton android:id="@+id/call_history_on_dialpad_button" android:layout_height="match_parent" @@ -111,7 +151,20 @@ android:background="@drawable/btn_call" android:src="@drawable/ic_menu_overflow_lt" android:contentDescription="@string/action_menu_overflow_description" /> - </LinearLayout> + <!-- 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 55cdea4de..c151dafba 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -632,7 +632,6 @@ [CHAR LIMIT=NONE] --> <string name="contact_tooltip">Tap image to see all numbers or press and hold to reorder</string> - - <!-- Content description for dismiss button on badge. [CHAR LIMIT=NONE] --> - <string name="description_dismiss">Dismiss</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 6ddf99378..65b6a9d70 100644 --- a/src/com/android/dialer/dialpad/DialpadFragment.java +++ b/src/com/android/dialer/dialpad/DialpadFragment.java @@ -71,6 +71,7 @@ import android.view.ViewTreeObserver.OnPreDrawListener; 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; @@ -92,6 +93,7 @@ import com.android.dialer.database.DialerDatabaseHelper; import com.android.dialer.interactions.PhoneNumberInteraction; import com.android.dialer.util.OrientationUtil; import com.android.internal.telephony.ITelephony; +import com.android.internal.telephony.TelephonyProperties; import com.android.phone.common.CallLogAsync; import com.android.phone.common.HapticFeedback; import com.google.common.annotations.VisibleForTesting; @@ -204,6 +206,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; @@ -220,6 +225,7 @@ public class DialpadFragment extends Fragment private View mDialButtonContainer; private View mDialButton; + private ImageButton mDialConferenceButton; private ListView mDialpadChooser; private DialpadChooserAdapter mDialpadChooserAdapter; @@ -245,6 +251,10 @@ public class DialpadFragment extends Fragment /** Identifier for the "Add Call" intent extra. */ private static final String ADD_CALL_MODE_KEY = "add_call_mode"; + /** Identifier for the "Add Participant" intent extra. */ + private static final String ADD_PARTICIPANT_KEY = "add_participant"; + private boolean mAddParticipant = false; + /** * Identifier for intent extra for sending an empty Flash message for * CDMA networks. This message is used by the network to simulate a @@ -258,6 +268,9 @@ public class DialpadFragment extends Fragment private static final String EXTRA_SEND_EMPTY_FLASH = "com.android.phone.extra.SEND_EMPTY_FLASH"; + public static final String EXTRA_DIAL_CONFERENCE_URI = + "org.codeaurora.extra.DIAL_CONFERENCE_URI"; + private String mCurrentCountryIso; private final PhoneStateListener mPhoneStateListener = new PhoneStateListener() { @@ -275,11 +288,23 @@ 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 (isCallOnImsEnabled()) { + // Note, phone app still need to check if UI option to "Use Ims Always" + // is checked upon receiving dial request. + mDialConferenceButton.setVisibility(View.VISIBLE); + } + } } }; @@ -415,6 +440,18 @@ public class DialpadFragment extends Fragment mDigits.setOnLongClickListener(this); mDigits.addTextChangedListener(this); PhoneNumberFormatter.setPhoneNumberFormattingTextWatcher(getActivity(), mDigits); + + mRecipients = (EditText) fragmentView.findViewById(R.id.recipients); + if (mRecipients != null) { + mRecipients.setVisibility(View.GONE); + mRecipients.addTextChangedListener(this); + } + + mDialpadStub = fragmentView.findViewById(R.id.dialpadStub); + if (mDialpadStub != null) { + mDialpadStub.setVisibility(View.GONE); + } + // Check for the presence of the keypad View oneButton = fragmentView.findViewById(R.id.one); if (oneButton != null) { @@ -430,6 +467,18 @@ public class DialpadFragment extends Fragment mDialButton = null; } + mDialConferenceButton = (ImageButton) fragmentView.findViewById(R.id.dialConferenceButton); + if (isCallOnImsEnabled()) { + 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); @@ -604,11 +653,28 @@ public class DialpadFragment extends Fragment } } + } else { + mAddParticipant = intent.getBooleanExtra(ADD_PARTICIPANT_KEY, false); + if (isCallOnImsEnabled()) { + // for IMS AddParticipant feature add call, show normal + // dialpad with dial conference button. + mDialConferenceButton.setVisibility(View.VISIBLE); + } else { + // for add call, show normal dialpad without dial conference + // button. + mDialConferenceButton.setVisibility(View.GONE); + } } + Log.d(TAG, "mAddParticipant = " + mAddParticipant); showDialpadChooser(needToShowDialpadChooser); setStartedFromNewIntent(false); } + private boolean isCallOnImsEnabled() { + return (SystemProperties.getBoolean( + TelephonyProperties.CALLS_ON_IMS_ENABLED_PROPERTY, false)); + } + public void setStartedFromNewIntent(boolean value) { mStartedFromNewIntent = value; } @@ -1009,6 +1075,10 @@ public class DialpadFragment extends Fragment } return; } + case R.id.dialConferenceButton: { + dialConferenceButtonPressed(); + return; + } default: { Log.wtf(TAG, "Unexpected onClick() event from: " + view); return; @@ -1180,11 +1250,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. @@ -1200,11 +1279,20 @@ 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); + } + intent.putExtra(ADD_PARTICIPANT_KEY, mAddParticipant); startActivity(intent); hideAndClearDialpad(); } @@ -1220,6 +1308,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 @@ -1336,7 +1431,8 @@ public class DialpadFragment extends Fragment * of the regular Dialer UI */ private void showDialpadChooser(boolean enabled) { - // Check if onCreateView() is already called by checking one of View objects. + // Check if onCreateView() is already called by checking one of View + // objects. if (!isLayoutReady()) { return; } @@ -1346,33 +1442,75 @@ public class DialpadFragment extends Fragment if (mDigitsContainer != null) { mDigitsContainer.setVisibility(View.GONE); } else { - // mDigits is not enclosed by the container. Make the digits field itself gone. + // 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); mDialpadChooser.setVisibility(View.VISIBLE); // Instantiate the DialpadChooserAdapter and hook it up to the - // ListView. We do this only once. + // ListView. We do this only once. if (mDialpadChooserAdapter == null) { mDialpadChooserAdapter = new DialpadChooserAdapter(getActivity()); } mDialpadChooser.setAdapter(mDialpadChooserAdapter); } else { // Log.i(TAG, "Displaying normal Dialer UI."); - if (mDigitsContainer != null) { - mDigitsContainer.setVisibility(View.VISIBLE); - } else { - mDigits.setVisibility(View.VISIBLE); + showDialConference(false); + if (mDialButtonContainer != null) { + mDialButtonContainer.setVisibility(View.VISIBLE); } - if (mDialpad != null) mDialpad.setVisibility(View.VISIBLE); - 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); + + /* + * if enabled is true then pick child views that should be + * visible/invisible when dialpad is choosen from conference dial button + * if enabled is false then pick child views that should be + * visible/invisible when dialpad is choosen from other buttons + */ + + // viewable when choosen through conference button + int conferenceButtonVisibility = (enabled ? View.VISIBLE : View.GONE); + // not viewable when choosen through conference button + int nonConferenceButtonVisibility = (enabled ? View.GONE : View.VISIBLE); + + // change the image visibility of the button + if (mRecipients != null) mRecipients.setVisibility(conferenceButtonVisibility); + if (mDialpadStub != null) mDialpadStub.setVisibility(conferenceButtonVisibility); + if (mDigitsContainer != null) mDigitsContainer.setVisibility(nonConferenceButtonVisibility); + if (mDigits != null) mDigits.setVisibility(nonConferenceButtonVisibility); + if (mDelete != null) mDelete.setVisibility(nonConferenceButtonVisibility); + if (mDialpad != null) mDialpad.setVisibility(nonConferenceButtonVisibility); + if (mDialConferenceButton != null) { + /* + * If dial conference view is shown, button should show dialpad + * image. Pressing the button again will return to normal dialpad + * view. + * If normal dialpad view is shown, button should show dial + * conference image. Pressing the button again will show dial + * conference view + */ + mDialConferenceButton.setImageResource(enabled ? R.drawable.ic_dialpad_holo_dark + : R.drawable.ic_add_group_holo_dark); + } + } + /** * @return true if we're currently showing the "dialpad chooser" UI. */ @@ -1629,8 +1767,14 @@ 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); |