summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorerfanian <erfanian@google.com>2018-06-05 14:54:02 -0700
committerCopybara-Service <copybara-piper@google.com>2018-06-05 15:10:17 -0700
commit50ba08e56682700007a818e96790a1a1f4385518 (patch)
treef73b6c3b8a67f3d8c6b74b39d34ddf79c9a7a559
parent875c43fa97d11043e6d6c82d1851921a5a00c5f2 (diff)
Update a few interfaces.
Bug: 73773964 Test: unit PiperOrigin-RevId: 199362698 Change-Id: I4b0ab4a3c07ad8fa206753c4826b42037b8a06be
-rw-r--r--java/com/android/incallui/answer/impl/AnswerFragment.java40
-rw-r--r--java/com/android/incallui/answer/impl/res/drawable/shape_chip_drawable.xml44
-rw-r--r--java/com/android/incallui/answer/impl/res/layout/fragment_incoming_call.xml18
-rw-r--r--java/com/android/incallui/answer/impl/res/values/strings.xml2
-rw-r--r--java/com/android/incallui/speakeasy/Annotations.java12
-rw-r--r--java/com/android/incallui/speakeasy/SpeakEasyComponent.java7
-rw-r--r--java/com/android/incallui/speakeasy/StubSpeakEasyModule.java10
7 files changed, 26 insertions, 107 deletions
diff --git a/java/com/android/incallui/answer/impl/AnswerFragment.java b/java/com/android/incallui/answer/impl/AnswerFragment.java
index 18e0e9864..8d8b08791 100644
--- a/java/com/android/incallui/answer/impl/AnswerFragment.java
+++ b/java/com/android/incallui/answer/impl/AnswerFragment.java
@@ -50,7 +50,6 @@ import android.view.accessibility.AccessibilityNodeInfo;
import android.view.accessibility.AccessibilityNodeInfo.AccessibilityAction;
import android.widget.ImageView;
import android.widget.LinearLayout;
-import android.widget.TextView;
import com.android.dialer.common.Assert;
import com.android.dialer.common.FragmentUtils;
import com.android.dialer.common.LogUtil;
@@ -84,8 +83,7 @@ import com.android.incallui.incalluilock.InCallUiLock;
import com.android.incallui.maps.MapsComponent;
import com.android.incallui.sessiondata.AvatarPresenter;
import com.android.incallui.sessiondata.MultimediaFragment;
-import com.android.incallui.speakeasy.Annotations.SpeakEasyIcon;
-import com.android.incallui.speakeasy.Annotations.SpeakEasyText;
+import com.android.incallui.speakeasy.Annotations.SpeakEasyChipResourceId;
import com.android.incallui.speakeasy.SpeakEasyComponent;
import com.android.incallui.util.AccessibilityUtil;
import com.android.incallui.video.protocol.VideoCallScreen;
@@ -148,10 +146,8 @@ public class AnswerFragment extends Fragment
private View importanceBadge;
private SwipeButtonView secondaryButton;
private SwipeButtonView answerAndReleaseButton;
- private LinearLayout chipLayout;
- private ImageView chipIcon;
- private TextView chipText;
private AffordanceHolderLayout affordanceHolderLayout;
+ private LinearLayout chipContainer;
// Use these flags to prevent user from clicking accept/reject buttons multiple times.
// We use separate flags because in some rare cases accepting a call may fail to join the room,
// and then user is stuck in the incoming call view until it times out. Two flags at least give
@@ -467,22 +463,23 @@ public class AnswerFragment extends Fragment
/** Initialize chip buttons */
private void initChips() {
+
if (!allowSpeakEasy()) {
- chipLayout.setVisibility(View.GONE);
+ chipContainer.setVisibility(View.GONE);
return;
}
- chipLayout.setVisibility(View.VISIBLE);
- chipLayout.setOnClickListener(this::performSpeakEasy);
-
- @SpeakEasyIcon
- Optional<Integer> alternativeIcon = SpeakEasyComponent.get(getContext()).speakEasyIcon();
- @SpeakEasyText
- Optional<Integer> alternativeText = SpeakEasyComponent.get(getContext()).speakEasyText();
- if (alternativeIcon.isPresent() && alternativeText.isPresent()) {
- chipIcon.setImageDrawable(getContext().getDrawable(alternativeIcon.get()));
- chipText.setText(alternativeText.get());
- // The button needs to override normal swipe up/down behavior.
- chipLayout.bringToFront();
+ chipContainer.setVisibility(View.VISIBLE);
+
+ @SpeakEasyChipResourceId
+ Optional<Integer> chipLayoutOptional = SpeakEasyComponent.get(getContext()).speakEasyChip();
+ if (chipLayoutOptional.isPresent()) {
+
+ LinearLayout chipLayout =
+ (LinearLayout) getLayoutInflater().inflate(chipLayoutOptional.get(), null);
+
+ chipLayout.setOnClickListener(this::performSpeakEasy);
+
+ chipContainer.addView(chipLayout);
}
}
@@ -721,13 +718,12 @@ public class AnswerFragment extends Fragment
View view = inflater.inflate(R.layout.fragment_incoming_call, container, false);
secondaryButton = (SwipeButtonView) view.findViewById(R.id.incoming_secondary_button);
answerAndReleaseButton = (SwipeButtonView) view.findViewById(R.id.incoming_secondary_button2);
- chipLayout = view.findViewById(R.id.incall_data_container_chip_container);
- chipIcon = view.findViewById(R.id.incall_data_container_chip_icon);
- chipText = view.findViewById(R.id.incall_data_container_chip_text);
affordanceHolderLayout = (AffordanceHolderLayout) view.findViewById(R.id.incoming_container);
affordanceHolderLayout.setAffordanceCallback(affordanceCallback);
+ chipContainer = view.findViewById(R.id.incall_data_container_chip_container);
+
importanceBadge = view.findViewById(R.id.incall_important_call_badge);
importanceBadge
.getViewTreeObserver()
diff --git a/java/com/android/incallui/answer/impl/res/drawable/shape_chip_drawable.xml b/java/com/android/incallui/answer/impl/res/drawable/shape_chip_drawable.xml
deleted file mode 100644
index adb153f6d..000000000
--- a/java/com/android/incallui/answer/impl/res/drawable/shape_chip_drawable.xml
+++ /dev/null
@@ -1,44 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- ~ Copyright (C) 2018 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
- -->
-<ripple xmlns:android="http://schemas.android.com/apk/res/android"
- android:color="#DADCE0">
- <item android:id="@android:id/mask">
- <shape xmlns:android="http://schemas.android.com/apk/res/android">
- <solid android:color="?android:attr/colorBackground"/>
- <padding
- android:bottom="9dp"
- android:left="8dp"
- android:right="8dp"
- android:top="9dp"/>
- <corners android:radius="40dp"/>
- </shape>
- </item>
- <item>
- <shape xmlns:android="http://schemas.android.com/apk/res/android">
- <solid android:color="#FFFFFF"/>
- <stroke
- android:width="1dp"
- android:color="#DADCE0"/>
- <padding
- android:bottom="9dp"
- android:left="8dp"
- android:right="8dp"
- android:top="9dp"/>
- <corners android:radius="40dp"/>
- </shape>
- </item>
-</ripple>
diff --git a/java/com/android/incallui/answer/impl/res/layout/fragment_incoming_call.xml b/java/com/android/incallui/answer/impl/res/layout/fragment_incoming_call.xml
index 944d290b1..1672bf984 100644
--- a/java/com/android/incallui/answer/impl/res/layout/fragment_incoming_call.xml
+++ b/java/com/android/incallui/answer/impl/res/layout/fragment_incoming_call.xml
@@ -157,26 +157,8 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal|bottom"
- android:background="@drawable/shape_chip_drawable"
- android:clickable="true"
android:orientation="horizontal"
android:visibility="gone">
- <ImageView
- android:id="@+id/incall_data_container_chip_icon"
- android:layout_width="20dp"
- android:layout_height="20dp"
- android:src="@drawable/quantum_ic_rtt_vd_theme_24"
- android:tint="#1A73E8"/>
- <TextView
- android:id="@+id/incall_data_container_chip_text"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_marginStart="8dp"
- android:layout_marginEnd="8dp"
- android:fontFamily="sans-serif-medium"
- android:text="@string/speakeasy_secondary_button_hint"
- android:textColor="@color/dialer_primary_text_color"
- android:textSize="14sp"/>
</LinearLayout>
</FrameLayout>
diff --git a/java/com/android/incallui/answer/impl/res/values/strings.xml b/java/com/android/incallui/answer/impl/res/values/strings.xml
index 61400bdc8..2bc9ca09f 100644
--- a/java/com/android/incallui/answer/impl/res/values/strings.xml
+++ b/java/com/android/incallui/answer/impl/res/values/strings.xml
@@ -40,6 +40,4 @@
<string description="The message announced to accessibility assistance on incoming call."
name="a11y_incoming_call_swipe_gesture_prompt">Two finger swipe up to answer. Two finger swipe down to decline.</string>
<string name="call_incoming_important">Important</string>
-
- <string name="speakeasy_secondary_button_hint" translatable="false">Answer as RTT</string>
</resources>
diff --git a/java/com/android/incallui/speakeasy/Annotations.java b/java/com/android/incallui/speakeasy/Annotations.java
index 5d513fc9b..4128532c3 100644
--- a/java/com/android/incallui/speakeasy/Annotations.java
+++ b/java/com/android/incallui/speakeasy/Annotations.java
@@ -21,14 +21,6 @@ import javax.inject.Qualifier;
/** Annotations for Speakeasy providers. */
public final class Annotations {
- /** A Speakeasy icon */
- @Qualifier
- public @interface SpeakEasyIcon {}
-
- /** Speakeasy text */
- @Qualifier
- public @interface SpeakEasyText {}
-
/** A Speakeasy settings fragment */
@Qualifier
public @interface SpeakEasySettingsFragment {}
@@ -36,4 +28,8 @@ public final class Annotations {
/** A Speakeasy settings object */
@Qualifier
public @interface SpeakEasySettingsObject {}
+
+ /** A Speakeasy chip */
+ @Qualifier
+ public @interface SpeakEasyChipResourceId {}
}
diff --git a/java/com/android/incallui/speakeasy/SpeakEasyComponent.java b/java/com/android/incallui/speakeasy/SpeakEasyComponent.java
index ab6438077..19e25edbe 100644
--- a/java/com/android/incallui/speakeasy/SpeakEasyComponent.java
+++ b/java/com/android/incallui/speakeasy/SpeakEasyComponent.java
@@ -19,10 +19,9 @@ package com.android.incallui.speakeasy;
import android.content.Context;
import android.preference.PreferenceFragment;
import com.android.dialer.inject.HasRootComponent;
-import com.android.incallui.speakeasy.Annotations.SpeakEasyIcon;
+import com.android.incallui.speakeasy.Annotations.SpeakEasyChipResourceId;
import com.android.incallui.speakeasy.Annotations.SpeakEasySettingsFragment;
import com.android.incallui.speakeasy.Annotations.SpeakEasySettingsObject;
-import com.android.incallui.speakeasy.Annotations.SpeakEasyText;
import com.google.common.base.Optional;
import dagger.Subcomponent;
@@ -37,9 +36,7 @@ public abstract class SpeakEasyComponent {
public abstract @SpeakEasySettingsObject Optional<Object> speakEasySettingsObject();
- public abstract @SpeakEasyIcon Optional<Integer> speakEasyIcon();
-
- public abstract @SpeakEasyText Optional<Integer> speakEasyText();
+ public abstract @SpeakEasyChipResourceId Optional<Integer> speakEasyChip();
public static SpeakEasyComponent get(Context context) {
return ((SpeakEasyComponent.HasComponent)
diff --git a/java/com/android/incallui/speakeasy/StubSpeakEasyModule.java b/java/com/android/incallui/speakeasy/StubSpeakEasyModule.java
index e844ad348..87d407d32 100644
--- a/java/com/android/incallui/speakeasy/StubSpeakEasyModule.java
+++ b/java/com/android/incallui/speakeasy/StubSpeakEasyModule.java
@@ -19,10 +19,9 @@ package com.android.incallui.speakeasy;
import android.preference.PreferenceFragment;
import com.android.dialer.inject.DialerVariant;
import com.android.dialer.inject.InstallIn;
-import com.android.incallui.speakeasy.Annotations.SpeakEasyIcon;
+import com.android.incallui.speakeasy.Annotations.SpeakEasyChipResourceId;
import com.android.incallui.speakeasy.Annotations.SpeakEasySettingsFragment;
import com.android.incallui.speakeasy.Annotations.SpeakEasySettingsObject;
-import com.android.incallui.speakeasy.Annotations.SpeakEasyText;
import com.google.common.base.Optional;
import dagger.Binds;
import dagger.Module;
@@ -48,12 +47,7 @@ public abstract class StubSpeakEasyModule {
}
@Provides
- static @SpeakEasyIcon Optional<Integer> provideSpeakEasyIcon() {
- return Optional.absent();
- }
-
- @Provides
- static @SpeakEasyText Optional<Integer> provideSpeakEasyText() {
+ static @SpeakEasyChipResourceId Optional<Integer> provideSpeakEasyChip() {
return Optional.absent();
}
}