Search in sources :

Example 11 with FlipViewController

use of com.aphidmobile.flip.FlipViewController in project android-flip by openaphid.

the class FlipTextViewFragment method onCreateView.

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

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

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

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

        @Override
        public View getView(int position, View convertView, ViewGroup parent) {
            NumberTextView view;
            if (convertView == null) {
                final Context context = parent.getContext();
                view = new NumberTextView(context, position);
                view.setTextSize(context.getResources().getDimension(R.dimen.textSize));
            } else {
                view = (NumberTextView) convertView;
                view.setNumber(position);
            }
            return view;
        }
    });
    return flipView;
}
Also used : Context(android.content.Context) ViewGroup(android.view.ViewGroup) FlipViewController(com.aphidmobile.flip.FlipViewController) NumberTextView(com.aphidmobile.flip.demo.views.NumberTextView) BaseAdapter(android.widget.BaseAdapter) NumberTextView(com.aphidmobile.flip.demo.views.NumberTextView) View(android.view.View)

Aggregations

FlipViewController (com.aphidmobile.flip.FlipViewController)11 View (android.view.View)4 TravelAdapter (com.aphidmobile.flip.demo.adapter.TravelAdapter)4 Context (android.content.Context)3 ViewGroup (android.view.ViewGroup)3 BaseAdapter (android.widget.BaseAdapter)3 NumberTextView (com.aphidmobile.flip.demo.views.NumberTextView)2 GalleryFlipAdapter (com.aphidmobile.flip.demo.issue5.GalleryFlipAdapter)1 NumberButton (com.aphidmobile.flip.demo.views.NumberButton)1