summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYorke Lee <yorkelee@google.com>2013-08-30 16:01:38 -0700
committerYorke Lee <yorkelee@google.com>2013-08-30 16:43:44 -0700
commit2b58ea3fb35d4aef5615c8249ff100789b59d8e3 (patch)
treebe9e89052f0341ca942ad978ce1b9d5bea0042c9
parent38c5d6ae2be2ff7468c1714d44bc8f9156f18b89 (diff)
Enable reject via text
Toggle reject via text option in glowpad based on the call's capability. Bug: 10424370 Change-Id: I5c36e83bc36923b093021c2a5cfd0c6aad3eb0b2
-rw-r--r--InCallUI/res/layout/answer_fragment.xml6
-rw-r--r--InCallUI/src/com/android/incallui/AnswerFragment.java32
-rw-r--r--InCallUI/src/com/android/incallui/AnswerPresenter.java7
3 files changed, 34 insertions, 11 deletions
diff --git a/InCallUI/res/layout/answer_fragment.xml b/InCallUI/res/layout/answer_fragment.xml
index 05e83de61..d62a8d55a 100644
--- a/InCallUI/res/layout/answer_fragment.xml
+++ b/InCallUI/res/layout/answer_fragment.xml
@@ -27,9 +27,9 @@
android:background="@android:color/black"
android:visibility="gone"
- dc:targetDrawables="@array/incoming_call_widget_2way_targets"
- dc:targetDescriptions="@array/incoming_call_widget_2way_target_descriptions"
- dc:directionDescriptions="@array/incoming_call_widget_2way_direction_descriptions"
+ dc:targetDrawables="@array/incoming_call_widget_3way_targets"
+ dc:targetDescriptions="@array/incoming_call_widget_3way_target_descriptions"
+ dc:directionDescriptions="@array/incoming_call_widget_3way_direction_descriptions"
dc:handleDrawable="@drawable/ic_in_call_touch_handle"
dc:outerRingDrawable="@*android:drawable/ic_lockscreen_outerring"
dc:outerRadius="@dimen/glowpadview_target_placement_radius"
diff --git a/InCallUI/src/com/android/incallui/AnswerFragment.java b/InCallUI/src/com/android/incallui/AnswerFragment.java
index e105289b2..2429dac96 100644
--- a/InCallUI/src/com/android/incallui/AnswerFragment.java
+++ b/InCallUI/src/com/android/incallui/AnswerFragment.java
@@ -47,6 +47,8 @@ public class AnswerFragment extends BaseFragment<AnswerPresenter, AnswerPresente
private ArrayAdapter<String> mTextResponsesAdapter = null;
+ private GlowPadWrapper mGlowpad;
+
public AnswerFragment() {
}
@@ -63,12 +65,12 @@ public class AnswerFragment extends BaseFragment<AnswerPresenter, AnswerPresente
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
- final GlowPadWrapper glowPad = (GlowPadWrapper) inflater.inflate(R.layout.answer_fragment,
+ mGlowpad = (GlowPadWrapper) inflater.inflate(R.layout.answer_fragment,
container, false);
- glowPad.setAnswerListener(this);
+ mGlowpad.setAnswerListener(this);
- return glowPad;
+ return mGlowpad;
}
@Override
@@ -78,7 +80,29 @@ public class AnswerFragment extends BaseFragment<AnswerPresenter, AnswerPresente
@Override
public void showTextButton(boolean show) {
- // TODO(klp) Hide the text button when the call does not support reject by text.
+ final int targetResourceId = show
+ ? R.array.incoming_call_widget_3way_targets
+ : R.array.incoming_call_widget_2way_targets;
+
+ if (targetResourceId != mGlowpad.getTargetResourceId()) {
+ if (show) {
+ // Answer, Decline, and Respond via SMS.
+ mGlowpad.setTargetResources(targetResourceId);
+ mGlowpad.setTargetDescriptionsResourceId(
+ R.array.incoming_call_widget_3way_target_descriptions);
+ mGlowpad.setDirectionDescriptionsResourceId(
+ R.array.incoming_call_widget_3way_direction_descriptions);
+ } else {
+ // Answer or Decline.
+ mGlowpad.setTargetResources(targetResourceId);
+ mGlowpad.setTargetDescriptionsResourceId(
+ R.array.incoming_call_widget_2way_target_descriptions);
+ mGlowpad.setDirectionDescriptionsResourceId(
+ R.array.incoming_call_widget_2way_direction_descriptions);
+ }
+
+ mGlowpad.reset(false);
+ }
}
@Override
diff --git a/InCallUI/src/com/android/incallui/AnswerPresenter.java b/InCallUI/src/com/android/incallui/AnswerPresenter.java
index 76a7b563e..3dc751f89 100644
--- a/InCallUI/src/com/android/incallui/AnswerPresenter.java
+++ b/InCallUI/src/com/android/incallui/AnswerPresenter.java
@@ -73,7 +73,7 @@ public class AnswerPresenter extends Presenter<AnswerPresenter.AnswerUi>
call.getCallId());
getUi().showAnswerUi(true);
- if (textMsgs != null) {
+ if (call.can(Call.Capabilities.RESPOND_VIA_TEXT) && textMsgs != null) {
getUi().showTextButton(true);
getUi().configureMessageDialogue(textMsgs);
} else {
@@ -115,14 +115,13 @@ public class AnswerPresenter extends Presenter<AnswerPresenter.AnswerUi>
}
public void onText() {
- // No-op for now. b/10424370
- // getUi().showMessageDialogue();
+ getUi().showMessageDialogue();
}
public void rejectCallWithMessage(String message) {
Log.d(this, "sendTextToDefaultActivity()...");
- CallCommandClient.getInstance().rejectCall(mCallId, true, message);
getUi().dismissPopup();
+ CallCommandClient.getInstance().rejectCall(mCallId, true, message);
}
interface AnswerUi extends Ui {