diff options
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, |