Skip to content

Commit

Permalink
#21 ButtonFormItem no longer inherits the default background.
Browse files Browse the repository at this point in the history
Removed duplicate module.
  • Loading branch information
jguerinet committed Nov 13, 2015
1 parent 837fd7b commit 060225e
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 14 deletions.
1 change: 0 additions & 1 deletion .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public class ButtonFormItem extends TextViewFormItem {
* @param listener The {@link View.OnClickListener}
*/
public ButtonFormItem(FormGenerator fg, View view, String text, View.OnClickListener listener){
super(fg, view, (Button)view.findViewById(R.id.fg_button), text);
super(fg, view, (Button)view.findViewById(R.id.fg_button), text, false);
mView.setOnClickListener(listener);
//Bold buttons
style(mFG.mBuilder.mDefaultTextTypeface, Typeface.BOLD);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public class EditTextFormItem extends TextViewFormItem {
* @param text The text
*/
public EditTextFormItem(FormGenerator fg, View view, String text){
super(fg, view, (EditText) view.findViewById(R.id.fg_input), text);
super(fg, view, (EditText) view.findViewById(R.id.fg_input), text, true);
mEditText = (EditText)mTextView;

//Set the right background
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,8 @@ public EditTextFormItem input(String text){
*/
public TextViewFormItem text(String text){
View view = mInflater.inflate(R.layout.fg_text, mContainer, false);
return new TextViewFormItem(this, view, (TextView)view.findViewById(R.id.fg_text), text);
return new TextViewFormItem(this, view, (TextView)view.findViewById(R.id.fg_text), text,
true);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,18 @@ abstract class FormItem extends LineItem{
/**
* Default Constructor
*
* @param fg The {@link FormGenerator} instance
* @param view The {@link View}
* @param fg The {@link FormGenerator} instance
* @param view The {@link View}
* @param background True if the default background should be applied, false otherwise
*/
public FormItem(FormGenerator fg, View view){
public FormItem(FormGenerator fg, View view, boolean background){
super(view.findViewById(R.id.fg_line), fg);
mView = view;

mFG.mContainer.addView(mView);

//Set the default background
if(mFG.mBuilder.mDefaultBackgroundId != null){
if(background && mFG.mBuilder.mDefaultBackgroundId != null){
background(mFG.mBuilder.mDefaultBackgroundId);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public class SwitchFormItem extends TextViewFormItem {
* @param text The text
*/
public SwitchFormItem(FormGenerator fg, View view, String text){
super(fg, view, (SwitchCompat)view.findViewById(R.id.fg_switch), text);
super(fg, view, (SwitchCompat)view.findViewById(R.id.fg_switch), text, true);
mSwitch = (SwitchCompat)mTextView;
//Set the switch typeface
mSwitch.setSwitchTypeface(mFG.mBuilder.mDefaultTextTypeface);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,15 @@ public class TextViewFormItem extends FormItem {
/**
* Default Constructor
*
* @param fg The {@link FormGenerator} instance
* @param view The {@link View}
*/
public TextViewFormItem(FormGenerator fg, View view, TextView textView, String text){
super(fg, view);
* @param fg The {@link FormGenerator} instance
* @param view The {@link View}
* @param textView The {@link TextView}
* @param text The text to use on the TextView
* @param background True if the default background should be applied, false otherwise
*/
public TextViewFormItem(FormGenerator fg, View view, TextView textView, String text,
boolean background){
super(fg, view, background);
mTextView = textView;
mView.setClickable(false);
mContext = mView.getContext();
Expand Down

0 comments on commit 060225e

Please sign in to comment.