diff options
author | Yorke Lee <yorkelee@google.com> | 2013-08-30 09:56:17 -0700 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2013-08-30 09:56:17 -0700 |
commit | b6738dc5eafe7aed9ec786908c4f0f0064e891e9 (patch) | |
tree | 00bf6da6e8d9f141b921bdec5f3381f9e2857eb9 | |
parent | b859a351fed4b1b25d51918aa9c719d8436136ab (diff) | |
parent | 90995fcb6778a9cb6dc35be12aeb1a5d0dcbb5ae (diff) |
am 9240895e: Allow swapping calls by clicking on secondary call card
* commit '9240895e9df2fcae8f0baea707eb4d24c6e50997':
Allow swapping calls by clicking on secondary call card
4 files changed, 44 insertions, 1 deletions
diff --git a/InCallUI/res/drawable/clickable_dim_effect.xml b/InCallUI/res/drawable/clickable_dim_effect.xml new file mode 100644 index 000000000..e4b4f6fd6 --- /dev/null +++ b/InCallUI/res/drawable/clickable_dim_effect.xml @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2012 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. +--> + +<!-- Background drawable used with dim effect for secondary photo. --> +<selector xmlns:android="http://schemas.android.com/apk/res/android"> + + <item android:state_pressed="true" android:state_enabled="true" + android:drawable="@drawable/list_pressed_holo_dark" /> + <item android:drawable="@color/on_hold_dim_effect" /> + +</selector> diff --git a/InCallUI/res/layout/secondary_call_info.xml b/InCallUI/res/layout/secondary_call_info.xml index 546278f95..369763abf 100644 --- a/InCallUI/res/layout/secondary_call_info.xml +++ b/InCallUI/res/layout/secondary_call_info.xml @@ -31,7 +31,10 @@ android:scaleType="centerCrop" android:contentDescription="@string/onHold" /> - <!-- TODO(klp): Add clickable dim effect --> + <View android:id="@+id/dim_effect_for_secondary_photo" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:background="@drawable/clickable_dim_effect"/> <!-- Name (or the phone number, if we don't have a name to display). --> <TextView android:id="@+id/secondaryCallName" diff --git a/InCallUI/src/com/android/incallui/CallCardFragment.java b/InCallUI/src/com/android/incallui/CallCardFragment.java index 2c0204c15..d880b973a 100644 --- a/InCallUI/src/com/android/incallui/CallCardFragment.java +++ b/InCallUI/src/com/android/incallui/CallCardFragment.java @@ -26,6 +26,7 @@ import android.text.TextUtils; import android.view.Gravity; import android.view.LayoutInflater; import android.view.View; +import android.view.View.OnClickListener; import android.view.ViewGroup; import android.view.ViewStub; import android.widget.ImageView; @@ -56,6 +57,7 @@ public class CallCardFragment extends BaseFragment<CallCardPresenter, CallCardPr private ViewStub mSecondaryCallInfo; private TextView mSecondaryCallName; private ImageView mSecondaryPhoto; + private View mSecondaryPhotoOverlay; // Cached DisplayMetrics density. private float mDensity; @@ -437,5 +439,15 @@ public class CallCardFragment extends BaseFragment<CallCardPresenter, CallCardPr if (mSecondaryPhoto == null) { mSecondaryPhoto = (ImageView) getView().findViewById(R.id.secondaryCallPhoto); } + + if (mSecondaryPhotoOverlay == null) { + mSecondaryPhotoOverlay = getView().findViewById(R.id.dim_effect_for_secondary_photo); + mSecondaryPhotoOverlay.setOnClickListener(new OnClickListener() { + @Override + public void onClick(View v) { + getPresenter().secondaryPhotoClicked(); + } + }); + } } } diff --git a/InCallUI/src/com/android/incallui/CallCardPresenter.java b/InCallUI/src/com/android/incallui/CallCardPresenter.java index 5cb4219d4..f8343fea4 100644 --- a/InCallUI/src/com/android/incallui/CallCardPresenter.java +++ b/InCallUI/src/com/android/incallui/CallCardPresenter.java @@ -480,6 +480,10 @@ public class CallCardPresenter extends Presenter<CallCardPresenter.CallCardUi> mAudioModeProvider.addListener(this); } + public void secondaryPhotoClicked() { + CallCommandClient.getInstance().swap(); + } + public interface CallCardUi extends Ui { void setVisible(boolean on); void setPrimary(String number, String name, boolean nameIsNumber, String label, |