summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorYorke Lee <yorkelee@google.com>2014-03-03 14:03:08 -0800
committerYorke Lee <yorkelee@google.com>2014-03-03 14:34:44 -0800
commit94f490466f2b7f4d9d19c4628a56442ccf8a6adf (patch)
tree715138096555999df67e23b026c162dfed7254cd /src
parent735bc040c07b905266f7619b292bfa3bd638acd5 (diff)
Fix slight screen jank when sliding dialpad upwards
Apply the translation animation to mSearchAndRemoveViewContainer (which houses the entire searchbox and its margins), so that the translation takes into account the entire height of the searchbox as well as its margins. Also refactored hideSearchBar slightly to remove an unused codepath. Bug: 13284310 Change-Id: I7b8873154059f616d8a52c4a0239ea6be89c8efc
Diffstat (limited to 'src')
-rw-r--r--src/com/android/dialer/DialtactsActivity.java63
1 files changed, 31 insertions, 32 deletions
diff --git a/src/com/android/dialer/DialtactsActivity.java b/src/com/android/dialer/DialtactsActivity.java
index 4542137fc..c51035537 100644
--- a/src/com/android/dialer/DialtactsActivity.java
+++ b/src/com/android/dialer/DialtactsActivity.java
@@ -168,6 +168,9 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O
private boolean mFirstLaunch;
private View mSearchViewContainer;
private RemoveView mRemoveViewContainer;
+ // This view points to the Framelayout that houses both the search view and remove view
+ // containers.
+ private View mSearchAndRemoveViewContainer;
private View mSearchViewCloseButton;
private View mVoiceSearchButton;
private EditText mSearchView;
@@ -310,6 +313,7 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O
mFragmentsFrame = findViewById(R.id.dialtacts_frame);
mRemoveViewContainer = (RemoveView) findViewById(R.id.remove_view_container);
+ mSearchAndRemoveViewContainer = (View) findViewById(R.id.search_and_remove_view_container);
prepareSearchView();
if (UI.FILTER_CONTACTS_ACTION.equals(intent.getAction())
@@ -564,7 +568,7 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O
final AnimatorListener mHideListener = new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
- mSearchViewContainer.setVisibility(View.GONE);
+ mSearchAndRemoveViewContainer.setVisibility(View.GONE);
}
};
@@ -583,43 +587,38 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O
}
public void hideSearchBar() {
- hideSearchBar(true);
+ final int height = mSearchAndRemoveViewContainer.getHeight();
+ mSearchAndRemoveViewContainer.animate().cancel();
+ mSearchAndRemoveViewContainer.setAlpha(1);
+ mSearchAndRemoveViewContainer.setTranslationY(0);
+ mSearchAndRemoveViewContainer.animate().withLayer().alpha(0)
+ .translationY(-height).setDuration(200)
+ .setListener(mHideListener);
+
+ mFragmentsFrame.animate().withLayer()
+ .translationY(-height).setDuration(200).setListener(
+ new AnimatorListenerAdapter() {
+ @Override
+ public void onAnimationEnd(Animator animation) {
+ mFragmentsFrame.setTranslationY(0);
+ }
+ });
}
- public void hideSearchBar(boolean shiftView) {
- if (shiftView) {
- mSearchViewContainer.animate().cancel();
- mSearchViewContainer.setAlpha(1);
- mSearchViewContainer.setTranslationY(0);
- mSearchViewContainer.animate().withLayer().alpha(0).translationY(-mSearchView.getHeight())
- .setDuration(200).setListener(mHideListener);
-
- mFragmentsFrame.animate().withLayer()
- .translationY(-mSearchViewContainer.getHeight()).setDuration(200).setListener(
- new AnimatorListenerAdapter() {
+ public void showSearchBar() {
+ final int height = mSearchAndRemoveViewContainer.getHeight();
+ mSearchAndRemoveViewContainer.animate().cancel();
+ mSearchAndRemoveViewContainer.setAlpha(0);
+ mSearchAndRemoveViewContainer.setTranslationY(-height);
+ mSearchAndRemoveViewContainer.animate().withLayer().alpha(1).translationY(0)
+ .setDuration(200).setListener(new AnimatorListenerAdapter() {
@Override
- public void onAnimationEnd(Animator animation) {
- mFragmentsFrame.setTranslationY(0);
+ public void onAnimationStart(Animator animation) {
+ mSearchAndRemoveViewContainer.setVisibility(View.VISIBLE);
}
});
- } else {
- mSearchViewContainer.setTranslationY(-mSearchView.getHeight());
- }
- }
-
- public void showSearchBar() {
- mSearchViewContainer.animate().cancel();
- mSearchViewContainer.setAlpha(0);
- mSearchViewContainer.setTranslationY(-mSearchViewContainer.getHeight());
- mSearchViewContainer.animate().withLayer().alpha(1).translationY(0).setDuration(200)
- .setListener(new AnimatorListenerAdapter() {
- @Override
- public void onAnimationStart(Animator animation) {
- mSearchViewContainer.setVisibility(View.VISIBLE);
- }
- });
- mFragmentsFrame.setTranslationY(-mSearchViewContainer.getHeight());
+ mFragmentsFrame.setTranslationY(-height);
mFragmentsFrame.animate().withLayer().translationY(0).setDuration(200)
.setListener(
new AnimatorListenerAdapter() {