Search in sources :

Example 1 with NumberTextView

use of com.aphidmobile.flip.demo.views.NumberTextView in project android-flip by openaphid.

the class FlipTextViewActivity method onCreate.

/**
   * Called when the activity is first created.
   */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setTitle(R.string.activity_title);
    flipView = new FlipViewController(this);
    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;
        }
    });
    setContentView(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)

Example 2 with NumberTextView

use of com.aphidmobile.flip.demo.views.NumberTextView in project android-flip by openaphid.

the class FlipTextViewXmlActivity method onCreate.

/**
   * Called when the activity is first created.
   */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setTitle(R.string.activity_title);
    setContentView(R.layout.xml_layout);
    flipView = (FlipViewController) findViewById(R.id.flipView);
    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;
        }
    });
}
Also used : Context(android.content.Context) ViewGroup(android.view.ViewGroup) NumberTextView(com.aphidmobile.flip.demo.views.NumberTextView) BaseAdapter(android.widget.BaseAdapter) NumberTextView(com.aphidmobile.flip.demo.views.NumberTextView) View(android.view.View)

Example 3 with NumberTextView

use of com.aphidmobile.flip.demo.views.NumberTextView 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

Context (android.content.Context)3 View (android.view.View)3 ViewGroup (android.view.ViewGroup)3 BaseAdapter (android.widget.BaseAdapter)3 NumberTextView (com.aphidmobile.flip.demo.views.NumberTextView)3 FlipViewController (com.aphidmobile.flip.FlipViewController)2