Created
October 9, 2016 03:14
-
-
Save Abdelsattar/64122a63ae3bc87f23856fc0e826c449 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class CheckBoxHolder extends TreeNode.BaseNodeViewHolder<CheckBoxHolder.IconTreeItem> { | |
boolean isChild; | |
public CheckBoxHolder(Context context, boolean isChild) { | |
super(context); | |
this.isChild = isChild; | |
} | |
@Override | |
public View getView() { | |
return super.getView(); | |
} | |
@Override | |
public View createNodeView(final TreeNode node, IconTreeItem value) { | |
final LayoutInflater inflater = LayoutInflater.from(context); | |
final View view = inflater.inflate(R.layout.tree_node_checkbox, null, false); | |
TextView tvValue = (TextView) view.findViewById(R.id.text); | |
final CheckBox checkBox = (CheckBox) view.findViewById(R.id.checkbox); | |
tvValue.setText(value.text); | |
checkBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { | |
@Override | |
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { | |
if (isChecked){ | |
// give me error on getTreeView | |
//node.getTreeView().expand(node) ; | |
} | |
} | |
}); | |
RelativeLayout relativeLayout = (RelativeLayout) view.findViewById(R.id.rel_layout); | |
if (!isChild) | |
relativeLayout.setBackgroundColor(context.getResources().getColor(R.color.grey)); | |
return view; | |
} | |
public static class IconTreeItem { | |
public int icon; | |
public String text; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment