Merge "Fix fragment position in dialpad fade-out."
diff --git a/res/layout/call_log_fragment.xml b/res/layout/call_log_fragment.xml
index 5cddbe7..7b6aa28 100644
--- a/res/layout/call_log_fragment.xml
+++ b/res/layout/call_log_fragment.xml
@@ -68,6 +68,7 @@
android:layout_height="match_parent"
android:fadingEdge="none"
android:scrollbarStyle="outsideOverlay"
+ android:background="@color/background_dialer_list_items"
android:divider="@null"
android:nestedScrollingEnabled="true"
android:clipChildren="false"
diff --git a/res/layout/call_log_list_item.xml b/res/layout/call_log_list_item.xml
index ff6b7ba..9182bd7 100644
--- a/res/layout/call_log_list_item.xml
+++ b/res/layout/call_log_list_item.xml
@@ -19,6 +19,7 @@
class="com.android.dialer.calllog.CallLogListItemView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
+ android:paddingBottom="@dimen/call_log_outer_margin"
android:id="@+id/call_log_list_item"
android:orientation="vertical"
android:clipChildren="false"
@@ -40,6 +41,7 @@
information and the secondary action (call details / play voicemail). -->
<LinearLayout
android:id="@+id/call_log_row"
+ android:background="@color/background_dialer_list_items"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:baselineAligned="false"
@@ -53,7 +55,9 @@
android:background="@drawable/call_log_background"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:padding="@dimen/call_log_outer_margin"
+ android:paddingLeft="@dimen/call_log_outer_margin"
+ android:paddingRight="@dimen/call_log_outer_margin"
+ android:paddingTop="@dimen/call_log_outer_margin"
android:orientation="horizontal"
android:gravity="center_vertical"
android:focusable="true"
@@ -136,5 +140,4 @@
android:layout="@layout/call_log_list_item_extra"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
-
</view>
diff --git a/res/values/animation_constants.xml b/res/values/animation_constants.xml
index 4e4bc36..7863060 100644
--- a/res/values/animation_constants.xml
+++ b/res/values/animation_constants.xml
@@ -27,4 +27,16 @@
<dimen name="min_swipe">0dip</dimen>
<dimen name="min_vert">10dip</dimen>
<dimen name="min_lock">20dip</dimen>
+
+ <!-- Expand/collapse of call log entry duration. -->
+ <integer name="call_log_expand_collapse_duration">200</integer>
+
+ <!-- Start delay for the fade in of the call log actions. -->
+ <integer name="call_log_actions_fade_start">150</integer>
+
+ <!-- Duration of the fade in of the call log actions. -->
+ <integer name="call_log_actions_fade_in_duration">200</integer>
+
+ <!-- Duration of the fade out of the call log actions. -->
+ <integer name="call_log_actions_fade_out_duration">20</integer>
</resources>
diff --git a/src/com/android/dialer/DialtactsActivity.java b/src/com/android/dialer/DialtactsActivity.java
index ef1db39..6fdf549 100644
--- a/src/com/android/dialer/DialtactsActivity.java
+++ b/src/com/android/dialer/DialtactsActivity.java
@@ -167,7 +167,6 @@
private boolean mInRegularSearch;
private boolean mClearSearchOnPause;
private boolean mIsDialpadShown;
- private boolean mIsExitingSearch;
/**
* The position of the currently selected tab in the attached {@link ListsFragment}.
@@ -261,13 +260,15 @@
Log.d(TAG, "onTextChange for mSearchView called with new query: " + newText);
}
- // Show search result with non-empty text. Show a bare list otherwise.
- final boolean sameSearchMode = (mIsDialpadShown && mInDialpadSearch) ||
- (!mIsDialpadShown && mInRegularSearch);
- if (!sameSearchMode) {
- // call enterSearchUi only if we are switching search modes, or entering
- // search ui for the first time
- enterSearchUi(mIsDialpadShown, mSearchQuery);
+ // Show search fragment only when the query string is changed to non-empty text.
+ if (!TextUtils.isEmpty(newText)) {
+ // Call enterSearchUi only if we are switching search modes, or showing a search
+ // fragment for the first time.
+ final boolean sameSearchMode = (mIsDialpadShown && mInDialpadSearch) ||
+ (!mIsDialpadShown && mInRegularSearch);
+ if (!sameSearchMode) {
+ enterSearchUi(mIsDialpadShown, mSearchQuery);
+ }
}
if (mIsDialpadShown && mSmartDialSearchFragment != null) {
@@ -762,7 +763,7 @@
* Shows the search fragment
*/
private void enterSearchUi(boolean smartDialSearch, String query) {
- if (getFragmentManager().isDestroyed() || mIsExitingSearch) {
+ if (getFragmentManager().isDestroyed()) {
// Weird race condition where fragment is doing work after the activity is destroyed
// due to talkback being on (b/10209937). Just return since we can't do any
// constructive here.
@@ -820,8 +821,6 @@
return;
}
- mIsExitingSearch = true;
-
mSearchView.setText(null);
mDialpadFragment.clearDialpad();
setNotInSearchUi();
@@ -838,8 +837,6 @@
transaction.commit();
mListsFragment.getView().animate().alpha(1).withLayer();
-
- mIsExitingSearch = false;
}
/** Returns an Intent to launch Call Settings screen */
diff --git a/src/com/android/dialer/calllog/CallLogFragment.java b/src/com/android/dialer/calllog/CallLogFragment.java
index 2b2d43c..6caa25c 100644
--- a/src/com/android/dialer/calllog/CallLogFragment.java
+++ b/src/com/android/dialer/calllog/CallLogFragment.java
@@ -17,6 +17,8 @@
package com.android.dialer.calllog;
import android.animation.Animator;
+import android.animation.AnimatorSet;
+import android.animation.ArgbEvaluator;
import android.animation.ValueAnimator;
import android.animation.Animator.AnimatorListener;
import android.app.Activity;
@@ -541,9 +543,33 @@
if (!isExpand) {
viewHolder.actionsView.setVisibility(View.VISIBLE);
}
+
+ // Set up the fade effect for the action buttons.
+ if (isExpand) {
+ int fadeDuration = getResources().getInteger(
+ R.integer.call_log_actions_fade_in_duration);
+ int startDelay = getResources().getInteger(
+ R.integer.call_log_actions_fade_start);
+ // Start the fade in after the expansion has partly completed, otherwise it
+ // will be mostly over before the expansion completes.
+ viewHolder.actionsView.setAlpha(0f);
+ viewHolder.actionsView.animate()
+ .alpha(1f)
+ .setStartDelay(startDelay)
+ .setDuration(fadeDuration)
+ .start();
+ } else {
+ int fadeDuration = getResources().getInteger(
+ R.integer.call_log_actions_fade_out_duration);
+ viewHolder.actionsView.setAlpha(1f);
+ viewHolder.actionsView.animate()
+ .alpha(0f)
+ .setDuration(fadeDuration)
+ .start();
+ }
view.requestLayout();
- // Set up the animator to animate the expansion.
+ // Set up the animator to animate the expansion and shadow depth.
ValueAnimator animator = isExpand ? ValueAnimator.ofFloat(0f, 1f)
: ValueAnimator.ofFloat(1f, 0f);
@@ -555,7 +581,8 @@
// For each value from 0 to 1, animate the various parts of the layout.
view.getLayoutParams().height =
(int) (value * distance + baseHeight);
- view.setElevation(mExpandedItemElevation * value);
+ viewHolder.callLogEntryView
+ .setElevation(mExpandedItemElevation * value);
view.requestLayout();
}
});
@@ -564,6 +591,7 @@
@Override
public void onAnimationEnd(Animator animation) {
view.getLayoutParams().height = LayoutParams.WRAP_CONTENT;
+
if (!isExpand) {
viewHolder.actionsView.setVisibility(View.GONE);
}
@@ -576,6 +604,11 @@
@Override
public void onAnimationStart(Animator animation) { }
});
+
+ final int expandCollapseDuration = getResources().getInteger(
+ R.integer.call_log_expand_collapse_duration);
+
+ animator.setDuration(expandCollapseDuration);
animator.start();
// Return false so this draw does not occur to prevent the final frame from