add fancy animations for headlines list
This commit is contained in:
parent
ab4480c6f5
commit
216eecc96a
14
res/anim/headline_item.xml
Normal file
14
res/anim/headline_item.xml
Normal file
@ -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>
|
||||
|
5
res/anim/layout_headline.xml
Normal file
5
res/anim/layout_headline.xml
Normal file
@ -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"
|
||||
/>
|
@ -5,13 +5,35 @@
|
||||
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"
|
||||
|
||||
<TextView
|
||||
android:id="@+id/no_headlines"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
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>
|
||||
android:text="@string/no_headlines"
|
||||
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||
android:visibility="invisible" >
|
||||
</TextView>
|
||||
|
||||
</FrameLayout>
|
@ -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);
|
||||
|
@ -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));
|
||||
|
Loading…
Reference in New Issue
Block a user