Amit Tumkur February 2016

Implement openAphid Flip animation(flipboard) for scrollable grid screen

Hi everyone i am stuck with a problem in implementing the flipboard app page fold animation. I am using openaphid/android-flip library for this. I am able to implement animations successfully for a screen which displays list of items using gridview, this library shows fold animation for screen having adapters only, showing fold animation for individual item of adapter. Now i want to show this animation for a single screen either fragment or activity and this is possible since this animation is implemented in "Havells mCatalogue app". If anyone has worked with this library animation and knows how to implement animation for a screen showing several items in a gridview please let me know how to work on this thing. I am adding photos for reference of this animation from the app. And here's the link for animation library

https://github.com/openaphid/android-flipimage 1[![][1]]2

Answers


Amit Tumkur February 2016

Well i was able to implement the required function by inflating a fragment which shows a gridview with adapter inside getView method of one adapter class that extends base adapter. But since flip couldn't flip next items of this fragment having grid view, i needed to go for different technique. i.e i had to create hard coded screens and define hard coded count for adapter which i used to set it to flip view controller and inside get view method of this adapter depending on position i load different xml and accordingly instantiate views. I know this is very bad technique and exhaustive but for now this is the only solution i found.

Here's my codes

FragmentLoaderAdapterFragment.java

public class FragmentLoaderAdapterFragment extends Fragment {

private FlipViewController flipView;

public FragmentLoaderAdapterFragment() {
}

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    flipView = new FlipViewController(inflater.getContext());
    flipView.setAdapter(new SingleFragmentDisplayAdapter());

    return flipView;

}

@Override
public void onResume() {
    super.onResume();
    flipView.onResume();
}

@Override
public void onPause() {
    super.onPause();
    flipView.onPause();
}

@Override
public void onDestroy() {
    super.onDestroy();
    flipView = null;
}

private class SingleFragmentDisplayAdapter extends BaseAdapter {


    public SingleFragmentDisplayAdapter() {
    }

    @Override
    public int getCount() {
        return 2;
    }

    @Override
    public Object getItem(int i) {
        return i;
    }

    @Override
    public long getItemId(int i) {
        return i;
    }

    @Override
    public View getView(int i, View view, ViewGroup viewGroup) {
        if (i==0){
            view = View.inflate(getActivity(),R.layout.fragment_consumer_products,null);
            LinearLayout cableLinearLayout = (LinearLayout) view.findViewByI 

Post Status

Asked in February 2016
Viewed 1,719 times
Voted 6
Answered 1 times

Search




Leave an answer