summaryrefslogtreecommitdiff
path: root/java
diff options
context:
space:
mode:
authormdooley <mdooley@google.com>2017-09-05 13:11:03 -0700
committerEric Erfanian <erfanian@google.com>2017-09-11 10:58:31 -0700
commitb91261f1fd54fc9517b3e848fc18ca7d7edc0e26 (patch)
treea24b2ebd9bafb560d628b8bd9fe758b4a4848ab0 /java
parent9abbf7ff9b31dd3420fd2b304b63703b87d843f6 (diff)
Updating transcription UI to match latest mocks, part 1
-add branding 'Google is transcribing' -add branding 'Transcribed by Google' in-progress screenshot: https://drive.google.com/open?id=0B9o_KvtLkcuIdVVTX3BBZkNzV180alZPQ3EtR3gzRFNoamhV transcribed by screenshot: https://drive.google.com/open?id=0B9o_KvtLkcuISUdaRjBlUFpjYTBWWTg1STVHS0oyQmNiSUVR Bug: 37340510 Test: manual PiperOrigin-RevId: 167620447 Change-Id: I5526bebb6999cf77b0902ae50ca72e380538a6e7
Diffstat (limited to 'java')
-rw-r--r--java/com/android/dialer/app/calllog/CallLogListItemViewHolder.java25
-rw-r--r--java/com/android/dialer/app/calllog/PhoneCallDetailsHelper.java42
-rw-r--r--java/com/android/dialer/app/res/layout/call_log_list_item.xml18
-rw-r--r--java/com/android/dialer/app/res/values/strings.xml18
4 files changed, 65 insertions, 38 deletions
diff --git a/java/com/android/dialer/app/calllog/CallLogListItemViewHolder.java b/java/com/android/dialer/app/calllog/CallLogListItemViewHolder.java
index 60ed7dd09..ef6236bf0 100644
--- a/java/com/android/dialer/app/calllog/CallLogListItemViewHolder.java
+++ b/java/com/android/dialer/app/calllog/CallLogListItemViewHolder.java
@@ -781,19 +781,28 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder
View transcriptContainerView = phoneCallDetailsViews.transcriptionView;
TextView transcriptView = phoneCallDetailsViews.voicemailTranscriptionView;
TextView transcriptBrandingView = phoneCallDetailsViews.voicemailTranscriptionBrandingView;
- if (TextUtils.isEmpty(transcriptView.getText())) {
- Assert.checkArgument(TextUtils.isEmpty(transcriptBrandingView.getText()));
- }
- if (!isExpanded || TextUtils.isEmpty(transcriptView.getText())) {
+ if (!isExpanded) {
transcriptContainerView.setVisibility(View.GONE);
return;
}
- transcriptContainerView.setVisibility(View.VISIBLE);
- transcriptView.setVisibility(View.VISIBLE);
+
+ boolean show = false;
+ if (TextUtils.isEmpty(transcriptView.getText())) {
+ transcriptView.setVisibility(View.GONE);
+ } else {
+ transcriptView.setVisibility(View.VISIBLE);
+ show = true;
+ }
if (TextUtils.isEmpty(transcriptBrandingView.getText())) {
- phoneCallDetailsViews.voicemailTranscriptionBrandingView.setVisibility(View.GONE);
+ transcriptBrandingView.setVisibility(View.GONE);
} else {
- phoneCallDetailsViews.voicemailTranscriptionBrandingView.setVisibility(View.VISIBLE);
+ transcriptBrandingView.setVisibility(View.VISIBLE);
+ show = true;
+ }
+ if (show) {
+ transcriptContainerView.setVisibility(View.VISIBLE);
+ } else {
+ transcriptContainerView.setVisibility(View.GONE);
}
}
diff --git a/java/com/android/dialer/app/calllog/PhoneCallDetailsHelper.java b/java/com/android/dialer/app/calllog/PhoneCallDetailsHelper.java
index a6e8f10f0..189279edf 100644
--- a/java/com/android/dialer/app/calllog/PhoneCallDetailsHelper.java
+++ b/java/com/android/dialer/app/calllog/PhoneCallDetailsHelper.java
@@ -146,31 +146,41 @@ public class PhoneCallDetailsHelper {
if (isVoicemail) {
int relevantLinkTypes = Linkify.EMAIL_ADDRESSES | Linkify.PHONE_NUMBERS | Linkify.WEB_URLS;
views.voicemailTranscriptionView.setAutoLinkMask(relevantLinkTypes);
- boolean showTranscriptBranding = false;
+
+ String transcript = "";
+ String branding = "";
if (!TextUtils.isEmpty(details.transcription)) {
- views.voicemailTranscriptionView.setText(details.transcription);
+ transcript = details.transcription;
// Set the branding text if the voicemail was transcribed by google
// TODO(mdooley): the transcription state is only set by the google transcription code,
// but a better solution would be to check the SOURCE_PACKAGE
- showTranscriptBranding =
- details.transcriptionState == VoicemailCompat.TRANSCRIPTION_AVAILABLE;
+ if (details.transcriptionState == VoicemailCompat.TRANSCRIPTION_AVAILABLE) {
+ branding = mResources.getString(R.string.voicemail_transcription_branding_text);
+ }
} else {
- if (details.transcriptionState == VoicemailCompat.TRANSCRIPTION_IN_PROGRESS) {
- views.voicemailTranscriptionView.setText(
- mResources.getString(R.string.voicemail_transcription_in_progress));
- } else if (details.transcriptionState == VoicemailCompat.TRANSCRIPTION_FAILED) {
- views.voicemailTranscriptionView.setText(
- mResources.getString(R.string.voicemail_transcription_failed));
+ switch (details.transcriptionState) {
+ case VoicemailCompat.TRANSCRIPTION_IN_PROGRESS:
+ branding = mResources.getString(R.string.voicemail_transcription_in_progress);
+ break;
+ case VoicemailCompat.TRANSCRIPTION_FAILED_NO_SPEECH_DETECTED:
+ branding = mResources.getString(R.string.voicemail_transcription_failed_no_speech);
+ break;
+ case VoicemailCompat.TRANSCRIPTION_FAILED_LANGUAGE_NOT_SUPPORTED:
+ branding =
+ mResources.getString(
+ R.string.voicemail_transcription_failed_language_not_supported);
+ break;
+ case VoicemailCompat.TRANSCRIPTION_FAILED:
+ branding = mResources.getString(R.string.voicemail_transcription_failed);
+ break;
+ default:
+ break; // Fall through
}
}
- if (showTranscriptBranding) {
- views.voicemailTranscriptionBrandingView.setText(
- mResources.getString(R.string.voicemail_transcription_branding_text));
- } else {
- views.voicemailTranscriptionBrandingView.setText("");
- }
+ views.voicemailTranscriptionView.setText(transcript);
+ views.voicemailTranscriptionBrandingView.setText(branding);
}
// Bold if not read
diff --git a/java/com/android/dialer/app/res/layout/call_log_list_item.xml b/java/com/android/dialer/app/res/layout/call_log_list_item.xml
index e9679242f..2c248198d 100644
--- a/java/com/android/dialer/app/res/layout/call_log_list_item.xml
+++ b/java/com/android/dialer/app/res/layout/call_log_list_item.xml
@@ -157,15 +157,6 @@
android:orientation="vertical">
<TextView
- android:id="@+id/voicemail_transcription_branding"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:textColor="@color/call_log_voicemail_transcript_branding_color"
- android:textSize="@dimen/call_log_voicemail_transcription_text_size"
- android:paddingBottom="2dp"
- android:singleLine="true"/>
-
- <TextView
android:id="@+id/voicemail_transcription"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
@@ -175,6 +166,15 @@
android:singleLine="false"
android:maxLines="10"/>
+ <TextView
+ android:id="@+id/voicemail_transcription_branding"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:textColor="@color/call_log_voicemail_transcript_branding_color"
+ android:textSize="@dimen/call_log_voicemail_transcription_text_size"
+ android:paddingTop="2dp"
+ android:singleLine="true"/>
+
</LinearLayout>
</LinearLayout>
diff --git a/java/com/android/dialer/app/res/values/strings.xml b/java/com/android/dialer/app/res/values/strings.xml
index 50e717492..841eb9c9b 100644
--- a/java/com/android/dialer/app/res/values/strings.xml
+++ b/java/com/android/dialer/app/res/values/strings.xml
@@ -648,14 +648,22 @@
<!-- Label for setting that shows more information about the Phone app [CHAR LIMIT=30] -->
<string name="about_phone_label">About</string>
- <!-- Label indicating who provided the voicemail transcription [CHAR LIMIT=40] -->
+ <!-- Label indicating who provided the voicemail transcription [CHAR LIMIT=64] -->
<string name="voicemail_transcription_branding_text">Transcribed by Google</string>
- <!-- Label indicating that a voicemail transcription is in progress [CHAR LIMIT=40] -->
- <string name="voicemail_transcription_in_progress">Google is transcribing &#8230;</string>
+ <!-- Label indicating that a voicemail transcription is in progress [CHAR LIMIT=64] -->
+ <string name="voicemail_transcription_in_progress">Google is transcribing&#8230;</string>
- <!-- Label indicating that a voicemail transcription failed [CHAR LIMIT=40] -->
- <string name="voicemail_transcription_failed">Transcript not available</string>
+ <!-- Label indicating that a voicemail transcription failed [CHAR LIMIT=64] -->
+ <string name="voicemail_transcription_failed">Transcript not available.</string>
+
+ <!-- Label indicating that a voicemail transcription failed because it was in an
+ unsupported language [CHAR LIMIT=64] -->
+ <string name="voicemail_transcription_failed_language_not_supported">Transcript not available. Language not supported.</string>
+
+ <!-- Label indicating that a voicemail transcription failed because no speech was detected
+ [CHAR LIMIT=64] -->
+ <string name="voicemail_transcription_failed_no_speech">Transcript not available. No speech detected.</string>
<!-- Button text to prompt a user to open an sms conversation [CHAR LIMIT=NONE] -->
<string name="view_conversation">View</string>