For some reason the listview is not animating, only the textviews are. I have a feeling it has to do with the LayoutInflater but I am not sure. This is where I define the JazzyListView and its animation:
public class RssFragment extends Fragment implements AdapterView.OnItemClickListener {
private ProgressBar progressBar;
private View view;
private View view2;
private JazzyListView listView;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setRetainInstance(true);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
if (view == null) {
view = inflater.inflate(R.layout.fragment_layout,container, false);
progressBar = (ProgressBar) view.findViewById(R.id.progressBar);
listView= (JazzyListView) view.findViewById(R.id.listView);
listView.setOnItemClickListener(this);
startService();
} else {
}
return view;
}
private void startService() {
Intent intent = new Intent(getActivity(), RssService.class);
intent.putExtra(RssService.RECEIVER, resultReceiver);
getActivity().startService(intent);
}
private final ResultReceiver resultReceiver = new ResultReceiver(new Handler()) {
@SuppressWarnings("unchecked")
@Override
protected void onReceiveResult(int resultCode, Bundle resultData) {
List<RssItem> items = (List<RssItem>) resultData.getSerializable(RssService.ITEMS);
if (items != null) {
RssAdapter adapter = new RssAdapter(getActivity(), items);
listView.setAdapter(adapter);
} else {
Toast.makeText(getActivity(), "The RSS feed is unable to be downloaded at this time",
Toast.LENGTH_LONG).show();
}
progressBar.setVisibility(View.GONE);
listView.setTransitionEffect(JazzyHelper.GROW);
listView.setVisibility(View.VISIBLE);
};
};
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
RssAdapter adapter = (RssAdapter) parent.getAdapter();
RssItem item = (RssItem) adapter.getItem(position);
Intent intent = new Intent(Intent.ACTION_VIEW);
startActivity(intent);
}
}
Here is my layout:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:baselineAligned="false">
<ImageView
android:layout_width="fill_parent"
android:layout_height="50dp"
android:id="@+id/imageView"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:background="#ff090eae" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="KGHS"
android:id="@+id/button"
android:layout_alignBottom="@+id/imageView"
android:layout_centerHorizontal="true" />
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/imageButton"
android:layout_alignBottom="@+id/imageView"
android:layout_alignParentRight="true"
/>
<ProgressBar
android:id="@+id/progressBar"
style="?android:attr/progressBarStyleLarge"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true" />
<com.twotoasters.jazzylistview.JazzyListView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/listView"
android:divider="#b5b5b5"
app:effect= "grow"
android:dividerHeight="10dp"
android:layout_below="@+id/searchView"
android:layout_marginBottom="60dp"/>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/imageView2"
android:layout_below="@id/imageView"
android:layout_centerHorizontal="true" />
<SearchView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/searchView"
android:layout_below="@+id/imageView"
/>
<ImageView
android:layout_width="fill_parent"
android:layout_height="60dp"
android:id="@+id/imageView3"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:background="#ffdedede" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="EVENTS"
android:id="@+id/button2"
android:layout_alignBottom="@+id/imageView3"
android:layout_toLeftOf="@+id/button3"
android:layout_toStartOf="@+id/button3"
android:layout_centerHorizontal="true"/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="STAFF"
android:id="@+id/button3"
android:layout_centerHorizontal="true"
android:layout_alignParentBottom="true"
android:layout_toRightOf="@+id/button"
android:layout_toEndOf="@+id/button" />
</RelativeLayout>
As I mentioned before the textviews (the textviews are in a different xml by themselves) are animating but the actual listview is not. I already tried changing the fragment to an activity in order to rid the view/layout inflater. Not sure what else to try.
[edit 1] Is this Android SDK animation? This is an image from the JazzyListView library sample application... I was under the impression the jazzylistview animated the listview as well, otherwise what is the point???
Animation of
JazzyListView
animates its items but not itself. If you want to animate aJazzyListView
, then you have to use animations provided byAndroid SDK
, I am afraid.