summaryrefslogtreecommitdiff
path: root/java/com/android/incallui/answer/impl/AnswerFragment.java
diff options
context:
space:
mode:
authorEric Erfanian <erfanian@google.com>2018-05-30 16:17:27 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2018-05-30 16:17:27 +0000
commit2c3d81eeac82472d06027bc65d661e16735c8608 (patch)
tree293aeb0012d8db8f3f4606a75a422cf4da328477 /java/com/android/incallui/answer/impl/AnswerFragment.java
parent4efd0ebf003e985e7cbe40d8ffd9f7ff227a9611 (diff)
parent152c3fd58f83a1882bcdc8bc55f46bbb8f3173c9 (diff)
Merge changes Ica13ee39,I5e0fedc8,I8e7efad0,I0ecc1f91,Iee1e658a, ...
* changes: Drop maps.impl from packages.mk Check if ID column is null before retrieving data from the smart dial database. Rename theme/private to theme/hidden. Some improvements to the answer fragment layouts. Better a11y for the bottom sheet. Fix a few UI bugs. Log IMS video call available state Better a11y for contact badge in the new call log. Use lookup key to determine the letter tile color Use Dialer Light Theme for SpeakEasyFragment Better a11y for new call log entries. Use Maps SDK lite mode instead of static API for emergency call. Updating locations where PrimaryInfo#setPhoto is used to also PrimaryInfo#setPhotoUri for new GlidePhotoManager implementation. As part of this addition, we also are cleaning the setPhoto(null) because this is not explicitly needed. Converted ThemeUtil into a DaggerModule. Delete AppCompatConstants Remove photo support in PhoneNumberService Began implementation of Dialer dark theme.
Diffstat (limited to 'java/com/android/incallui/answer/impl/AnswerFragment.java')
-rw-r--r--java/com/android/incallui/answer/impl/AnswerFragment.java56
1 files changed, 33 insertions, 23 deletions
diff --git a/java/com/android/incallui/answer/impl/AnswerFragment.java b/java/com/android/incallui/answer/impl/AnswerFragment.java
index d44a5daa2..18e0e9864 100644
--- a/java/com/android/incallui/answer/impl/AnswerFragment.java
+++ b/java/com/android/incallui/answer/impl/AnswerFragment.java
@@ -49,6 +49,8 @@ import android.view.accessibility.AccessibilityEvent;
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;
@@ -82,6 +84,8 @@ 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.SpeakEasyComponent;
import com.android.incallui.util.AccessibilityUtil;
import com.android.incallui.video.protocol.VideoCallScreen;
@@ -144,6 +148,9 @@ 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;
// 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,
@@ -195,17 +202,6 @@ public class AnswerFragment extends Fragment
public void performAction(AnswerFragment fragment) {
fragment.performAnswerAndRelease();
}
- },
-
- SPEAKEASY(
- R.drawable.quantum_ic_rtt_vd_theme_24,
- R.string.speakeasy_secondary_button_hint,
- R.string.speakeasy_secondary_button_hint,
- R.string.speakeasy_secondary_button_hint) {
- @Override
- public void performAction(AnswerFragment fragment) {
- fragment.performSpeakEasy();
- }
};
@DrawableRes public int icon;
@@ -232,8 +228,7 @@ public class AnswerFragment extends Fragment
}
}
- private void performSpeakEasy() {
- restoreAnswerAndReleaseButtonAnimation();
+ private void performSpeakEasy(View unused) {
answerScreenDelegate.onSpeakEasyCall();
buttonAcceptClicked = true;
}
@@ -457,16 +452,6 @@ public class AnswerFragment extends Fragment
if (allowAnswerAndRelease()) {
answerAndReleaseButton.setVisibility(View.VISIBLE);
answerScreenDelegate.onAnswerAndReleaseButtonEnabled();
- } else if (allowSpeakEasy()) {
- Optional<Integer> alternativeIcon = SpeakEasyComponent.get(getContext()).speakEasyIcon();
- if (alternativeIcon.isPresent()) {
- // TODO(erfanian): Replace enum hack when we have a dedicated button.
- SecondaryBehavior.SPEAKEASY.icon = alternativeIcon.get();
- }
- answerAndReleaseBehavior = SecondaryBehavior.SPEAKEASY;
- answerAndReleaseBehavior.applyToView(answerAndReleaseButton);
- answerAndReleaseButton.setVisibility(View.VISIBLE);
- answerScreenDelegate.onAnswerAndReleaseButtonEnabled();
} else {
answerAndReleaseButton.setVisibility(View.INVISIBLE);
answerScreenDelegate.onAnswerAndReleaseButtonDisabled();
@@ -480,6 +465,27 @@ public class AnswerFragment extends Fragment
});
}
+ /** Initialize chip buttons */
+ private void initChips() {
+ if (!allowSpeakEasy()) {
+ chipLayout.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();
+ }
+ }
+
@Override
public boolean allowAnswerAndRelease() {
return getArguments().getBoolean(ARG_ALLOW_ANSWER_AND_RELEASE);
@@ -715,6 +721,9 @@ 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);
@@ -755,6 +764,7 @@ public class AnswerFragment extends Fragment
.newAnswerScreenDelegate(this);
initSecondaryButton();
+ initChips();
int flags = View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION;
if (!isInMultiWindowMode