Animation for Aizy appearence. Blue preview popup window

Change-Id: I857f50d5e11382b7e2dcb8c024a96c2d7a6e086b
diff --git a/res/anim/aizy_preview_popup_enter.xml b/res/anim/aizy_preview_popup_enter.xml
new file mode 100644
index 0000000..194a3a3
--- /dev/null
+++ b/res/anim/aizy_preview_popup_enter.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+** Copyright 2010, The Android Open Source Project
+**
+** Licensed under the Apache License, Version 2.0 (the "License");
+** you may not use this file except in compliance with the License.
+** You may obtain a copy of the License at
+**
+**     http://www.apache.org/licenses/LICENSE-2.0
+**
+** Unless required by applicable law or agreed to in writing, software
+** distributed under the License is distributed on an "AS IS" BASIS,
+** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+** See the License for the specific language governing permissions and
+** limitations under the License.
+*/
+-->
+
+<set xmlns:android="http://schemas.android.com/apk/res/android"
+    android:interpolator="@android:anim/accelerate_interpolator">
+	<alpha android:fromAlpha="0.0" android:toAlpha="1.0"
+            android:duration="@android:integer/config_shortAnimTime" />
+</set>
diff --git a/res/anim/aizy_preview_popup_exit.xml b/res/anim/aizy_preview_popup_exit.xml
new file mode 100644
index 0000000..ed5cda8
--- /dev/null
+++ b/res/anim/aizy_preview_popup_exit.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+** Copyright 2010, The Android Open Source Project
+**
+** Licensed under the Apache License, Version 2.0 (the "License");
+** you may not use this file except in compliance with the License.
+** You may obtain a copy of the License at
+**
+**     http://www.apache.org/licenses/LICENSE-2.0
+**
+** Unless required by applicable law or agreed to in writing, software
+** distributed under the License is distributed on an "AS IS" BASIS,
+** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+** See the License for the specific language governing permissions and
+** limitations under the License.
+*/
+-->
+
+<set xmlns:android="http://schemas.android.com/apk/res/android"
+    android:interpolator="@android:anim/accelerate_interpolator">
+	<alpha android:fromAlpha="1.0" android:toAlpha="0.0"
+            android:duration="@android:integer/config_longAnimTime" />
+</set>
diff --git a/res/anim/search_bar_enter.xml b/res/anim/search_bar_enter.xml
index f0ee241..19bbbba 100644
--- a/res/anim/search_bar_enter.xml
+++ b/res/anim/search_bar_enter.xml
@@ -19,8 +19,6 @@
 
 <set xmlns:android="http://schemas.android.com/apk/res/android"
     android:interpolator="@android:anim/decelerate_interpolator">
-	<translate android:fromYDelta="-32" android:toYDelta="0"
-            android:duration="@android:integer/config_shortAnimTime"/>
 	<alpha android:fromAlpha="0.0" android:toAlpha="1.0"
             android:duration="@android:integer/config_shortAnimTime" />
 </set>
diff --git a/res/drawable-hdpi/aizy_label.9.png b/res/drawable-hdpi/aizy_label.9.png
new file mode 100644
index 0000000..1599037
--- /dev/null
+++ b/res/drawable-hdpi/aizy_label.9.png
Binary files differ
diff --git a/res/drawable-hdpi/temp_aizy_bottom.png b/res/drawable-hdpi/temp_aizy_bottom.png
deleted file mode 100644
index 1f3d332..0000000
--- a/res/drawable-hdpi/temp_aizy_bottom.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi/aizy_label.9.png b/res/drawable-mdpi/aizy_label.9.png
new file mode 100644
index 0000000..695b000
--- /dev/null
+++ b/res/drawable-mdpi/aizy_label.9.png
Binary files differ
diff --git a/res/drawable-mdpi/temp_aizy_bottom.png b/res/drawable-mdpi/temp_aizy_bottom.png
deleted file mode 100644
index 1f3d332..0000000
--- a/res/drawable-mdpi/temp_aizy_bottom.png
+++ /dev/null
Binary files differ
diff --git a/res/layout/aizy_popup_window.xml b/res/layout/aizy_popup_window.xml
index 5e83766..4b3668f 100644
--- a/res/layout/aizy_popup_window.xml
+++ b/res/layout/aizy_popup_window.xml
@@ -14,20 +14,12 @@
      limitations under the License.
 -->
 
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    android:orientation="vertical"
-    android:layout_width="wrap_content"
-    android:layout_height="wrap_content"
-    android:background="@drawable/temp_aizy_bottom"
-    >
-
-    <TextView
-        android:layout_width="fill_parent"
-        android:layout_height="wrap_content"
-        android:id="@+id/caption"
-        android:width="75dip"
-        android:textSize="70sp"
-        android:paddingLeft="20dip"
-        android:gravity="center" />
-
-</LinearLayout>
\ No newline at end of file
+<TextView xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="@dimen/aizy_preview_width"
+    android:layout_height="@dimen/aizy_preview_height"
+    android:background="@drawable/aizy_label"
+    android:paddingTop="0dip"
+    android:id="@+id/caption"
+    android:textSize="55sp"
+    android:gravity="center"
+    android:textColor="#ffffffff" />
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index 84fd21f..832987e 100644
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -32,8 +32,8 @@
 
     <!-- Size of the text in the aizy visual scroll control -->
     <dimen name="aizy_text_size">13dip</dimen>
-    <dimen name="aizy_preview_width">130dip</dimen>
-    <dimen name="aizy_preview_height">115dip</dimen>
+    <dimen name="aizy_preview_width">80dip</dimen>
+    <dimen name="aizy_preview_height">80dip</dimen>
     
     <!-- Padding of the rounded plus/minus buttons in the editor (the minus button is created
     in code) -->
diff --git a/res/values/styles.xml b/res/values/styles.xml
index 55cd698..e0ac68e 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -96,6 +96,11 @@
         <item name="android:windowExitAnimation">@anim/search_bar_exit</item>
     </style>
 
+    <style name="AizyPreviewPopupAnimation"> 
+        <item name="android:windowEnterAnimation">@anim/aizy_preview_popup_enter</item> 
+        <item name="android:windowExitAnimation">@anim/aizy_preview_popup_exit</item> 
+    </style> 
+
     <style name="DummyAnimation">
         <item name="android:windowExitAnimation">@anim/dummy_animation</item>
     </style>
diff --git a/src/com/android/contacts/list/ContactListAizyView.java b/src/com/android/contacts/list/ContactListAizyView.java
index 69a10cf..5e36543 100644
--- a/src/com/android/contacts/list/ContactListAizyView.java
+++ b/src/com/android/contacts/list/ContactListAizyView.java
@@ -47,6 +47,8 @@
 
     private Listener mListener;
     private float mPosition;
+
+    private int mPreviewPosition;
     private PopupWindow mPreviewPopupWindow;
     private TextView mPreviewPopupTextView;
     private boolean mPreviewPopupVisible;
@@ -77,6 +79,7 @@
         mPreviewPopupWindow = new PopupWindow(
                 inflater.inflate(R.layout.aizy_popup_window, null, false),
                 mResourceValues.getPreviewWidth(), mResourceValues.getPreviewHeight());
+        mPreviewPopupWindow.setAnimationStyle(R.style.AizyPreviewPopupAnimation);
         mPreviewPopupTextView =
                 (TextView) mPreviewPopupWindow.getContentView().findViewById(R.id.caption);
     }
@@ -124,7 +127,9 @@
         final int previewX = mWindowOffset[0] + getWidth();
         final int previewY = (int) event.getY() + mWindowOffset[1]
                 - mPreviewPopupWindow.getHeight() / 2;
-        final boolean previewPopupVisible = event.getActionMasked() == MotionEvent.ACTION_MOVE;
+        final boolean previewPopupVisible =
+            event.getActionMasked() == MotionEvent.ACTION_MOVE ||
+            event.getActionMasked() == MotionEvent.ACTION_DOWN;
         if (previewPopupVisible != mPreviewPopupVisible) {
             if (previewPopupVisible) {
                 mPreviewPopupWindow.showAtLocation(this, Gravity.LEFT | Gravity.TOP,
@@ -147,6 +152,7 @@
         }
 
         if (mListener != null) mListener.onScroll(position);
+        mPreviewPosition = position;
 
         super.onTouchEvent(event);
         return true;
@@ -175,7 +181,12 @@
         final Drawable knob = mResourceValues.getKnobDrawable();
         final int w = knob.getIntrinsicWidth();
         final int h = knob.getIntrinsicWidth();
-        final float y = mPosition * yFactor;
+        final float y;
+//        if (mPreviewPopupWindow.) {
+//            y = mPreviewPosition * yFactor;
+//        } else {
+            y = mPosition * yFactor;
+//        }
         knob.setBounds(
                 (int) (centerX - w / 2.0f), (int) (y - h / 2.0f),
                 (int) (centerX + w / 2.0f), (int) (y + h / 2.0f));