diff options
author | Kamaljeet Maini <kmaini@cyngn.com> | 2016-04-06 10:23:26 -0700 |
---|---|---|
committer | Gerrit Code Review <gerrit@cyanogenmod.org> | 2016-04-07 12:01:21 -0700 |
commit | d69ce6c2a65c3d451dfb5837678221e56fef1880 (patch) | |
tree | ea8db94b75bf3b692c6112904b360ced0772ed9f | |
parent | 90413335f2b2ebb864fab518bceeb8b1f308c7b2 (diff) | |
download | android_packages_apps_InCallUI-d69ce6c2a65c3d451dfb5837678221e56fef1880.tar.gz android_packages_apps_InCallUI-d69ce6c2a65c3d451dfb5837678221e56fef1880.tar.bz2 android_packages_apps_InCallUI-d69ce6c2a65c3d451dfb5837678221e56fef1880.zip |
Port call transfer feature from DialerNext to AOSP Dialercm-13-before-ambientsdk
Change-Id: I088b2cc8ce7c55f527d086f5827eac59cc3ca6c8
Issue-Id: CYNGNOS-1010
-rw-r--r-- | res/drawable-hdpi/ic_shuffle_white_24dp.png | bin | 0 -> 300 bytes | |||
-rw-r--r-- | res/drawable-mdpi/ic_shuffle_white_24dp.png | bin | 0 -> 217 bytes | |||
-rw-r--r-- | res/drawable-xhdpi/ic_shuffle_white_24dp.png | bin | 0 -> 310 bytes | |||
-rw-r--r-- | res/drawable-xxhdpi/ic_shuffle_white_24dp.png | bin | 0 -> 486 bytes | |||
-rw-r--r-- | res/drawable-xxxhdpi/ic_shuffle_white_24dp.png | bin | 0 -> 517 bytes | |||
-rw-r--r-- | res/drawable/btn_transfer_call.xml | 32 | ||||
-rw-r--r-- | res/layout/call_button_fragment.xml | 6 | ||||
-rw-r--r-- | res/values/cm_strings.xml | 1 | ||||
-rw-r--r-- | src/com/android/incallui/CallButtonFragment.java | 12 | ||||
-rw-r--r-- | src/com/android/incallui/CallButtonPresenter.java | 12 | ||||
-rw-r--r-- | src/com/android/incallui/TelecomAdapter.java | 9 |
11 files changed, 71 insertions, 1 deletions
diff --git a/res/drawable-hdpi/ic_shuffle_white_24dp.png b/res/drawable-hdpi/ic_shuffle_white_24dp.png Binary files differnew file mode 100644 index 00000000..ab55a83f --- /dev/null +++ b/res/drawable-hdpi/ic_shuffle_white_24dp.png diff --git a/res/drawable-mdpi/ic_shuffle_white_24dp.png b/res/drawable-mdpi/ic_shuffle_white_24dp.png Binary files differnew file mode 100644 index 00000000..d13a258a --- /dev/null +++ b/res/drawable-mdpi/ic_shuffle_white_24dp.png diff --git a/res/drawable-xhdpi/ic_shuffle_white_24dp.png b/res/drawable-xhdpi/ic_shuffle_white_24dp.png Binary files differnew file mode 100644 index 00000000..66c15ce6 --- /dev/null +++ b/res/drawable-xhdpi/ic_shuffle_white_24dp.png diff --git a/res/drawable-xxhdpi/ic_shuffle_white_24dp.png b/res/drawable-xxhdpi/ic_shuffle_white_24dp.png Binary files differnew file mode 100644 index 00000000..dc8e5341 --- /dev/null +++ b/res/drawable-xxhdpi/ic_shuffle_white_24dp.png diff --git a/res/drawable-xxxhdpi/ic_shuffle_white_24dp.png b/res/drawable-xxxhdpi/ic_shuffle_white_24dp.png Binary files differnew file mode 100644 index 00000000..e24dfa3b --- /dev/null +++ b/res/drawable-xxxhdpi/ic_shuffle_white_24dp.png diff --git a/res/drawable/btn_transfer_call.xml b/res/drawable/btn_transfer_call.xml new file mode 100644 index 00000000..38d35f1b --- /dev/null +++ b/res/drawable/btn_transfer_call.xml @@ -0,0 +1,32 @@ +<?xml version="1.0" encoding="utf-8"?> + +<!-- + ~ Copyright (C) 2016 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 + --> + +<layer-list xmlns:android="http://schemas.android.com/apk/res/android"> + + <item + android:id="@+id/backgroundItem" + android:drawable="@drawable/btn_background" /> + + <item> + <bitmap + android:src="@drawable/ic_shuffle_white_24dp" + android:gravity="center" + android:tint="@color/selectable_icon_tint" /> + </item> + +</layer-list> diff --git a/res/layout/call_button_fragment.xml b/res/layout/call_button_fragment.xml index e40d47e2..1842d88b 100644 --- a/res/layout/call_button_fragment.xml +++ b/res/layout/call_button_fragment.xml @@ -158,6 +158,12 @@ android:contentDescription="@string/onscreenCallRecordText" android:visibility="gone" /> + <ImageButton android:id="@+id/transferCall" + style="@style/InCallButton" + android:background="@drawable/btn_transfer_call" + android:contentDescription="@string/onscreenTransferCall" + android:visibility="gone" /> + <!-- "Overflow" --> <ImageButton android:id="@+id/overflowButton" style="@style/InCallButton" diff --git a/res/values/cm_strings.xml b/res/values/cm_strings.xml index e486a4c5..29c74c16 100644 --- a/res/values/cm_strings.xml +++ b/res/values/cm_strings.xml @@ -43,4 +43,5 @@ <string name="recording_time_text">Recording</string> <string name="recording_warning_title">Enable call recording?</string> <string name="recording_warning_text">Notice: You are responsible for compliance with any laws, regulations and rules that apply to the use of call recording functionality and the use or distribution of those recordings.</string> + <string name="onscreenTransferCall">Transfer call</string> </resources> diff --git a/src/com/android/incallui/CallButtonFragment.java b/src/com/android/incallui/CallButtonFragment.java index 35f0fc17..34eca3cc 100644 --- a/src/com/android/incallui/CallButtonFragment.java +++ b/src/com/android/incallui/CallButtonFragment.java @@ -77,7 +77,8 @@ public class CallButtonFragment public static final int BUTTON_PAUSE_VIDEO = 9; public static final int BUTTON_MANAGE_VIDEO_CONFERENCE = 10; public static final int BUTTON_RECORD_CALL = 11; - public static final int BUTTON_COUNT = 12; + public static final int BUTTON_TRANSFER_CALL = 12; + public static final int BUTTON_COUNT = 13; } private SparseIntArray mButtonVisibilityMap = new SparseIntArray(BUTTON_COUNT); @@ -96,6 +97,7 @@ public class CallButtonFragment private ImageButton mOverflowButton; private ImageButton mManageVideoCallConferenceButton; private ImageButton mAddParticipantButton; + private ImageButton mTransferCallButton; private PopupMenu mAudioModePopup; private boolean mAudioModePopupVisible; @@ -161,6 +163,8 @@ public class CallButtonFragment mCallRecordButton.setOnClickListener(this); mAddParticipantButton = (ImageButton) parent.findViewById(R.id.addParticipant); mAddParticipantButton.setOnClickListener(this); + mTransferCallButton = (ImageButton) parent.findViewById(R.id.transferCall); + mTransferCallButton.setOnClickListener(this); mOverflowButton = (ImageButton) parent.findViewById(R.id.overflowButton); mOverflowButton.setOnClickListener(this); mManageVideoCallConferenceButton = (ImageButton) parent.findViewById( @@ -242,6 +246,8 @@ public class CallButtonFragment case R.id.manageVideoCallConferenceButton: onManageVideoCallConferenceClicked(); break; + case R.id.transferCall: + getPresenter().transferCallClicked(); default: Log.wtf(this, "onClick: unexpected"); return; @@ -280,6 +286,7 @@ public class CallButtonFragment mChangeToVideoButton, mAddCallButton, mMergeButton, + mTransferCallButton, mOverflowButton }; @@ -375,6 +382,7 @@ public class CallButtonFragment mOverflowButton.setEnabled(isEnabled); mManageVideoCallConferenceButton.setEnabled(isEnabled); mAddParticipantButton.setEnabled(isEnabled); + mTransferCallButton.setEnabled(isEnabled); } @Override @@ -416,6 +424,8 @@ public class CallButtonFragment return mManageVideoCallConferenceButton; case BUTTON_RECORD_CALL: return mCallRecordButton; + case BUTTON_TRANSFER_CALL: + return mTransferCallButton; default: Log.w(this, "Invalid button id"); return null; diff --git a/src/com/android/incallui/CallButtonPresenter.java b/src/com/android/incallui/CallButtonPresenter.java index ce3f27d4..1e9380d6 100644 --- a/src/com/android/incallui/CallButtonPresenter.java +++ b/src/com/android/incallui/CallButtonPresenter.java @@ -231,6 +231,15 @@ public class CallButtonPresenter extends Presenter<CallButtonPresenter.CallButto } } + public void transferCallClicked() { + if (mCall == null) { + return; + } + + Log.i(this, "transferring call : " + mCall); + TelecomAdapter.getInstance().transferCall(mCall.getId()); + } + public void swapClicked() { if (mCall == null) { return; @@ -463,6 +472,8 @@ public class CallButtonPresenter extends Presenter<CallButtonPresenter.CallButto final CallRecorder recorder = CallRecorder.getInstance(); boolean showCallRecordOption = recorder.isEnabled() && !isVideo && call.getState() == Call.State.ACTIVE; + final boolean showTransferCall = call.can( + android.telecom.Call.Details.CAPABILITY_SUPPORTS_TRANSFER); ui.showButton(BUTTON_AUDIO, true); ui.showButton(BUTTON_SWAP, showSwap); @@ -476,6 +487,7 @@ public class CallButtonPresenter extends Presenter<CallButtonPresenter.CallButto ui.showButton(BUTTON_DIALPAD, !isVideo || useExt); ui.showButton(BUTTON_MERGE, showMerge); ui.showButton(BUTTON_RECORD_CALL, showCallRecordOption); + ui.showButton(BUTTON_TRANSFER_CALL, showTransferCall); ui.enableAddParticipant(showAddParticipant); ui.updateButtonStates(); diff --git a/src/com/android/incallui/TelecomAdapter.java b/src/com/android/incallui/TelecomAdapter.java index 14ce7c8d..5de28f5f 100644 --- a/src/com/android/incallui/TelecomAdapter.java +++ b/src/com/android/incallui/TelecomAdapter.java @@ -95,6 +95,15 @@ final class TelecomAdapter implements InCallServiceListener { } } + void transferCall(String callId) { + android.telecom.Call call = getTelecommCallById(callId); + if (call != null) { + call.transferCall(); + } else { + Log.e(this, "error transferCall, call not in call list " + callId); + } + } + void unholdCall(String callId) { android.telecom.Call call = getTelecommCallById(callId); if (call != null) { |