@Test public void testCreateButton() { TestButtonItem item = new TestButtonItem(); final Button button = item.createButton(mParent); assertTrue("Default button should be enabled", button.isEnabled()); assertTrue("Default button text should be empty", TextUtils.isEmpty(button.getText())); }
protected Button createButton(ViewGroup parent) { if (mButton == null) { Context context = parent.getContext(); if (mTheme != 0) { context = new ContextThemeWrapper(context, mTheme); } mButton = createButton(context); mButton.setOnClickListener(this); } else { if (mButton.getParent() instanceof ViewGroup) { ((ViewGroup) mButton.getParent()).removeView(mButton); } } mButton.setEnabled(mEnabled); mButton.setText(mText); mButton.setId(getViewId()); return mButton; }
ButtonItem extends AbstractItem implements View.OnClickListener { protected Button createButton(ViewGroup parent) { if (mButton == null) { Context context = parent.getContext(); if (mTheme != 0) { context = new ContextThemeWrapper(context, mTheme); } mButton = createButton(context); mButton.setOnClickListener(this); } else { if (mButton.getParent() instanceof ViewGroup) { ((ViewGroup) mButton.getParent()).removeView(mButton); } } mButton.setEnabled(mEnabled); mButton.setText(mText); mButton.setId(getViewId()); return mButton; } }
ButtonItem extends AbstractItem implements View.OnClickListener { protected Button createButton(ViewGroup parent) { if (mButton == null) { Context context = parent.getContext(); if (mTheme != 0) { context = new ContextThemeWrapper(context, mTheme); } mButton = createButton(context); mButton.setOnClickListener(this); } else { if (mButton.getParent() instanceof ViewGroup) { ((ViewGroup) mButton.getParent()).removeView(mButton); } } mButton.setEnabled(mEnabled); mButton.setText(mText); mButton.setId(getViewId()); return mButton; } ButtonItem();  ButtonItem(Context context, AttributeSet attrs); }
ButtonItem extends AbstractItem implements View.OnClickListener { protected Button createButton(ViewGroup parent) { if (mButton == null) { Context context = parent.getContext(); if (mTheme != 0) { context = new ContextThemeWrapper(context, mTheme); } mButton = createButton(context); mButton.setOnClickListener(this); } else { if (mButton.getParent() instanceof ViewGroup) { ((ViewGroup) mButton.getParent()).removeView(mButton); } } mButton.setEnabled(mEnabled); mButton.setText(mText); mButton.setId(getViewId()); return mButton; } ButtonItem();  ButtonItem(Context context, AttributeSet attrs); void setOnClickListener(OnClickListener listener); void setText(CharSequence text); CharSequence getText(); void setTheme(int theme); int getTheme(); void setEnabled(boolean enabled); @Override int getCount(); @Override boolean isEnabled(); @Override int getLayoutResource(); @Override final void onBindView(View view); @Override void onClick(View v); }
ButtonItem extends AbstractItem implements View.OnClickListener { protected Button createButton(ViewGroup parent) { if (mButton == null) { Context context = parent.getContext(); if (mTheme != 0) { context = new ContextThemeWrapper(context, mTheme); } mButton = createButton(context); mButton.setOnClickListener(this); } else { if (mButton.getParent() instanceof ViewGroup) { ((ViewGroup) mButton.getParent()).removeView(mButton); } } mButton.setEnabled(mEnabled); mButton.setText(mText); mButton.setId(getViewId()); return mButton; } ButtonItem();  ButtonItem(Context context, AttributeSet attrs); void setOnClickListener(OnClickListener listener); void setText(CharSequence text); CharSequence getText(); void setTheme(int theme); int getTheme(); void setEnabled(boolean enabled); @Override int getCount(); @Override boolean isEnabled(); @Override int getLayoutResource(); @Override final void onBindView(View view); @Override void onClick(View v);  }