Search in sources :

Example 1 with NumberButton

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

the class FlipButtonActivity 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) {
            NumberButton button;
            if (convertView == null) {
                final Context context = parent.getContext();
                button = new NumberButton(context, position);
                button.setTextSize(context.getResources().getDimension(R.dimen.textSize));
            } else {
                button = (NumberButton) convertView;
                button.setNumber(position);
            }
            return button;
        }
    });
    setContentView(flipView);
}
Also used : Context(android.content.Context) ViewGroup(android.view.ViewGroup) FlipViewController(com.aphidmobile.flip.FlipViewController) NumberButton(com.aphidmobile.flip.demo.views.NumberButton) BaseAdapter(android.widget.BaseAdapter) View(android.view.View)

Aggregations

Context (android.content.Context)1 View (android.view.View)1 ViewGroup (android.view.ViewGroup)1 BaseAdapter (android.widget.BaseAdapter)1 FlipViewController (com.aphidmobile.flip.FlipViewController)1 NumberButton (com.aphidmobile.flip.demo.views.NumberButton)1