diff options
author | Andrew Dolgov <[email protected]> | 2013-05-28 12:55:21 +0400 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2013-05-28 12:55:21 +0400 |
commit | 216eecc96a916568b3db5c5bb9a9083789cd262b (patch) | |
tree | 6c2d8b2ea1a047684edd7bb5f57037f1ca955ead | |
parent | ab4480c6f5f1e772ee2f24bd09457d95d4608365 (diff) |
add fancy animations for headlines list
-rw-r--r-- | res/anim/headline_item.xml | 14 | ||||
-rw-r--r-- | res/anim/layout_headline.xml | 5 | ||||
-rw-r--r-- | res/layout/headlines_fragment.xml | 46 | ||||
-rw-r--r-- | src/org/fox/ttrss/HeadlinesFragment.java | 25 | ||||
-rw-r--r-- | src/org/fox/ttrss/offline/OfflineHeadlinesFragment.java | 24 |
5 files changed, 102 insertions, 12 deletions
diff --git a/res/anim/headline_item.xml b/res/anim/headline_item.xml new file mode 100644 index 00000000..dbb60d23 --- /dev/null +++ b/res/anim/headline_item.xml @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="utf-8"?>
+<set xmlns:android="http://schemas.android.com/apk/res/android" android:interpolator="@android:anim/accelerate_interpolator">
+ <alpha
+ android:fromAlpha="0"
+ android:toAlpha="1"
+ android:duration="250"
+ />
+ <translate
+ android:fromXDelta="100%p"
+ android:toXDelta="0"
+ android:duration="250"
+ />
+</set>
+
diff --git a/res/anim/layout_headline.xml b/res/anim/layout_headline.xml new file mode 100644 index 00000000..07b84d11 --- /dev/null +++ b/res/anim/layout_headline.xml @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="utf-8"?>
+<layoutAnimation xmlns:android="http://schemas.android.com/apk/res/android"
+ android:delay="20%"
+ android:animation="@anim/headline_item"
+/>
\ No newline at end of file diff --git a/res/layout/headlines_fragment.xml b/res/layout/headlines_fragment.xml index 787a8c8d..58fa6694 100644 --- a/res/layout/headlines_fragment.xml +++ b/res/layout/headlines_fragment.xml @@ -1,17 +1,39 @@ -<?xml version="1.0" encoding="utf-8" ?>
-
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
+<?xml version="1.0" encoding="utf-8"?>
+<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/headlines_fragment"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:paddingLeft="5dp" >
- - <ListView android:layout_height="match_parent" android:layout_width="match_parent" android:id="@+id/headlines"></ListView> - <LinearLayout android:id="@+id/loading_container" android:gravity="center" android:layout_height="match_parent" android:layout_width="match_parent">
- <TextView android:layout_width="wrap_content" android:textAppearance="?android:attr/textAppearanceLarge" android:id="@+id/loading_message" android:layout_height="wrap_content" ></TextView>
+
+ <ListView
+ android:id="@+id/headlines"
+ android:layout_width="match_parent"
+ android:layoutAnimation="@anim/layout_headline"
+ android:layout_height="match_parent" >
+ </ListView>
+
+ <LinearLayout
+ android:id="@+id/loading_container"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:gravity="center" >
+
+ <TextView
+ android:id="@+id/loading_message"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:textAppearance="?android:attr/textAppearanceLarge" >
+ </TextView>
</LinearLayout>
- <TextView android:id="@+id/no_headlines"
- android:visibility="invisible"
- android:layout_gravity="center"
- android:textAppearance="?android:attr/textAppearanceLarge" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/no_headlines"></TextView>
-
- </FrameLayout>
+
+ <TextView
+ android:id="@+id/no_headlines"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center"
+ android:text="@string/no_headlines"
+ android:textAppearance="?android:attr/textAppearanceLarge"
+ android:visibility="invisible" >
+ </TextView>
+
+</FrameLayout>
\ No newline at end of file diff --git a/src/org/fox/ttrss/HeadlinesFragment.java b/src/org/fox/ttrss/HeadlinesFragment.java index 7befaf9a..6ad805cc 100644 --- a/src/org/fox/ttrss/HeadlinesFragment.java +++ b/src/org/fox/ttrss/HeadlinesFragment.java @@ -34,6 +34,11 @@ import android.view.MenuItem; import android.view.View; import android.view.View.OnClickListener; import android.view.ViewGroup; +import android.view.animation.AlphaAnimation; +import android.view.animation.Animation; +import android.view.animation.AnimationSet; +import android.view.animation.LayoutAnimationController; +import android.view.animation.TranslateAnimation; import android.widget.AbsListView; import android.widget.AbsListView.OnScrollListener; import android.widget.AdapterView; @@ -267,6 +272,26 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener, ListView list = (ListView)view.findViewById(R.id.headlines); m_adapter = new ArticleListAdapter(getActivity(), R.layout.headlines_row, (ArrayList<Article>)m_articles); + + /* if (!m_activity.isCompatMode()) { + AnimationSet set = new AnimationSet(true); + + Animation animation = new AlphaAnimation(0.0f, 1.0f); + animation.setDuration(500); + set.addAnimation(animation); + + animation = new TranslateAnimation( + Animation.RELATIVE_TO_SELF, 50.0f,Animation.RELATIVE_TO_SELF, 0.0f, + Animation.RELATIVE_TO_SELF, 0.0f,Animation.RELATIVE_TO_SELF, 0.0f + ); + animation.setDuration(1000); + set.addAnimation(animation); + + LayoutAnimationController controller = new LayoutAnimationController(set, 0.5f); + + list.setLayoutAnimation(controller); + } */ + list.setAdapter(m_adapter); list.setOnItemClickListener(this); list.setOnScrollListener(this); diff --git a/src/org/fox/ttrss/offline/OfflineHeadlinesFragment.java b/src/org/fox/ttrss/offline/OfflineHeadlinesFragment.java index e89d01f4..242d7a16 100644 --- a/src/org/fox/ttrss/offline/OfflineHeadlinesFragment.java +++ b/src/org/fox/ttrss/offline/OfflineHeadlinesFragment.java @@ -33,6 +33,11 @@ import android.view.LayoutInflater; import android.view.MenuItem; import android.view.View; import android.view.View.OnClickListener; +import android.view.animation.AlphaAnimation; +import android.view.animation.Animation; +import android.view.animation.AnimationSet; +import android.view.animation.LayoutAnimationController; +import android.view.animation.TranslateAnimation; import android.view.ViewGroup; import android.widget.AdapterView; import android.widget.AdapterView.AdapterContextMenuInfo; @@ -279,6 +284,25 @@ public class OfflineHeadlinesFragment extends Fragment implements OnItemClickLis m_adapter = new ArticleListAdapter(getActivity(), R.layout.headlines_row, m_cursor, new String[] { "title" }, new int[] { R.id.title }, 0); + /* if (!m_activity.isCompatMode()) { + AnimationSet set = new AnimationSet(true); + + Animation animation = new AlphaAnimation(0.0f, 1.0f); + animation.setDuration(500); + set.addAnimation(animation); + + animation = new TranslateAnimation( + Animation.RELATIVE_TO_SELF, 50.0f,Animation.RELATIVE_TO_SELF, 0.0f, + Animation.RELATIVE_TO_SELF, 0.0f,Animation.RELATIVE_TO_SELF, 0.0f + ); + animation.setDuration(1000); + set.addAnimation(animation); + + LayoutAnimationController controller = new LayoutAnimationController(set, 0.5f); + + list.setLayoutAnimation(controller); + } */ + list.setAdapter(m_adapter); list.setOnItemClickListener(this); list.setEmptyView(view.findViewById(R.id.no_headlines)); |