diff options
author | Yorke Lee <yorkelee@google.com> | 2014-08-19 23:37:16 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2014-08-16 03:51:48 +0000 |
commit | 68aa63b48a33e461576e40a6dcd937fe846122e1 (patch) | |
tree | 8694d0eb7e460fcc7beec1ac9d085db68b7c2769 /src | |
parent | 857603964e936e1f0717b0d8bd0289e2b4c0c1cb (diff) | |
parent | f42ea913f3569e0bef2ae18404b29610f368cc77 (diff) |
Merge "Expand transcription view when call log item clicked" into lmp-dev
Diffstat (limited to 'src')
-rw-r--r-- | src/com/android/dialer/calllog/CallLogAdapter.java | 21 | ||||
-rw-r--r-- | src/com/android/dialer/calllog/CallLogFragment.java | 19 |
2 files changed, 22 insertions, 18 deletions
diff --git a/src/com/android/dialer/calllog/CallLogAdapter.java b/src/com/android/dialer/calllog/CallLogAdapter.java index 64b10553c..b12bbec4a 100644 --- a/src/com/android/dialer/calllog/CallLogAdapter.java +++ b/src/com/android/dialer/calllog/CallLogAdapter.java @@ -16,7 +16,6 @@ package com.android.dialer.calllog; -import android.content.ComponentName; import android.content.ContentValues; import android.content.Context; import android.content.Intent; @@ -29,9 +28,7 @@ import android.os.Message; import android.provider.CallLog.Calls; import android.provider.ContactsContract.PhoneLookup; import android.telecomm.PhoneAccountHandle; -import android.telecomm.TelecommManager; import android.text.TextUtils; -import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.View.AccessibilityDelegate; @@ -39,7 +36,6 @@ import android.view.ViewGroup; import android.view.ViewStub; import android.view.ViewTreeObserver; import android.view.accessibility.AccessibilityEvent; -import android.view.accessibility.AccessibilityRecord; import android.widget.ImageView; import android.widget.TextView; import android.widget.Toast; @@ -66,6 +62,8 @@ import java.util.LinkedList; public class CallLogAdapter extends GroupingListAdapter implements ViewTreeObserver.OnPreDrawListener, CallLogGroupBuilder.GroupCreator { + private static final int VOICEMAIL_TRANSCRIPTION_MAX_LINES = 10; + /** The enumeration of {@link android.os.AsyncTask} objects used in this class. */ public enum Tasks { REMOVE_CALL_LOG_ENTRIES, @@ -887,6 +885,7 @@ public class CallLogAdapter extends GroupingListAdapter private void expandOrCollapseActions(CallLogListItemView callLogItem, boolean isExpanded) { final CallLogListItemViews views = (CallLogListItemViews)callLogItem.getTag(); + expandVoicemailTranscriptionView(views, isExpanded); if (isExpanded) { // Inflate the view stub if necessary, and wire up the event handlers. inflateActionViewStub(callLogItem); @@ -909,6 +908,20 @@ public class CallLogAdapter extends GroupingListAdapter } } + public static void expandVoicemailTranscriptionView(CallLogListItemViews views, + boolean isExpanded) { + if (views.callType != Calls.VOICEMAIL_TYPE) { + return; + } + + final TextView view = views.phoneCallDetailsViews.voicemailTranscriptionView; + if (TextUtils.isEmpty(view.getText())) { + return; + } + view.setMaxLines(isExpanded ? VOICEMAIL_TRANSCRIPTION_MAX_LINES : 1); + view.setSingleLine(!isExpanded); + } + /** * Configures the action buttons in the expandable actions ViewStub. The ViewStub is not * inflated during initial binding, so click handlers, tags and accessibility text must be set diff --git a/src/com/android/dialer/calllog/CallLogFragment.java b/src/com/android/dialer/calllog/CallLogFragment.java index ded65ed64..b75e1c62d 100644 --- a/src/com/android/dialer/calllog/CallLogFragment.java +++ b/src/com/android/dialer/calllog/CallLogFragment.java @@ -17,8 +17,8 @@ package com.android.dialer.calllog; import android.animation.Animator; +import android.animation.AnimatorListenerAdapter; import android.animation.ValueAnimator; -import android.animation.Animator.AnimatorListener; import android.app.Activity; import android.app.DialogFragment; import android.app.KeyguardManager; @@ -26,28 +26,24 @@ import android.content.Context; import android.content.Intent; import android.database.ContentObserver; import android.database.Cursor; -import android.graphics.Outline; -import android.net.Uri; import android.os.Bundle; import android.os.Handler; import android.provider.CallLog; import android.provider.CallLog.Calls; import android.provider.ContactsContract; import android.provider.VoicemailContract.Status; +import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.view.ViewTreeObserver; import android.view.View.OnClickListener; import android.view.ViewGroup.LayoutParams; -import android.widget.ImageView; import android.widget.ListView; import android.widget.TextView; import com.android.common.io.MoreCloseables; -import com.android.contacts.common.CallUtil; import com.android.contacts.common.GeoUtil; -import com.android.contacts.common.util.PhoneNumberHelper; import com.android.contacts.common.util.ViewUtil; import com.android.dialer.R; import com.android.dialer.list.ListsFragment.HostInterface; @@ -574,6 +570,7 @@ public class CallLogFragment extends AnalyticsListFragment if (!isExpand) { viewHolder.actionsView.setVisibility(View.VISIBLE); } + CallLogAdapter.expandVoicemailTranscriptionView(viewHolder, !isExpand); // Set up the fade effect for the action buttons. if (isExpand) { @@ -612,7 +609,7 @@ public class CallLogFragment extends AnalyticsListFragment } }); // Set everything to their final values when the animation's done. - animator.addListener(new AnimatorListener() { + animator.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { view.getLayoutParams().height = LayoutParams.WRAP_CONTENT; @@ -625,14 +622,8 @@ public class CallLogFragment extends AnalyticsListFragment // is defaulting to the value (0) at the start of the expand animation. viewHolder.actionsView.setAlpha(1); } + CallLogAdapter.expandVoicemailTranscriptionView(viewHolder, isExpand); } - - @Override - public void onAnimationCancel(Animator animation) { } - @Override - public void onAnimationRepeat(Animator animation) { } - @Override - public void onAnimationStart(Animator animation) { } }); animator.setDuration(mExpandCollapseDuration); |