Search in sources :

Example 1 with PrintView

use of com.github.johnkil.print.PrintView in project AndroidTreeView by bmelnychuk.

the class ArrowExpandSelectableHeaderHolder method createNodeView.

@Override
public View createNodeView(final TreeNode node, IconTreeItemHolder.IconTreeItem value) {
    final LayoutInflater inflater = LayoutInflater.from(context);
    final View view = inflater.inflate(R.layout.layout_selectable_header, null, false);
    tvValue = (TextView) view.findViewById(R.id.node_value);
    tvValue.setText(value.text);
    final PrintView iconView = (PrintView) view.findViewById(R.id.icon);
    iconView.setIconText(context.getResources().getString(value.icon));
    arrowView = (PrintView) view.findViewById(R.id.arrow_icon);
    arrowView.setPadding(20, 10, 10, 10);
    if (node.isLeaf()) {
        arrowView.setVisibility(View.GONE);
    }
    arrowView.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View view) {
            tView.toggleNode(node);
        }
    });
    nodeSelector = (CheckBox) view.findViewById(R.id.node_selector);
    nodeSelector.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {

        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            node.setSelected(isChecked);
            for (TreeNode n : node.getChildren()) {
                getTreeView().selectNode(n, isChecked);
            }
        }
    });
    nodeSelector.setChecked(node.isSelected());
    return view;
}
Also used : PrintView(com.github.johnkil.print.PrintView) TreeNode(com.unnamed.b.atv.model.TreeNode) LayoutInflater(android.view.LayoutInflater) TextView(android.widget.TextView) PrintView(com.github.johnkil.print.PrintView) View(android.view.View) CompoundButton(android.widget.CompoundButton)

Example 2 with PrintView

use of com.github.johnkil.print.PrintView in project AndroidTreeView by bmelnychuk.

the class HeaderHolder method createNodeView.

@Override
public View createNodeView(TreeNode node, IconTreeItemHolder.IconTreeItem value) {
    final LayoutInflater inflater = LayoutInflater.from(context);
    final View view = inflater.inflate(R.layout.layout_header_node, null, false);
    TextView tvValue = (TextView) view.findViewById(R.id.node_value);
    tvValue.setText(value.text);
    final PrintView iconView = (PrintView) view.findViewById(R.id.icon);
    iconView.setIconText(context.getResources().getString(value.icon));
    arrowView = (PrintView) view.findViewById(R.id.arrow_icon);
    if (node.isLeaf()) {
        arrowView.setVisibility(View.INVISIBLE);
    }
    return view;
}
Also used : PrintView(com.github.johnkil.print.PrintView) LayoutInflater(android.view.LayoutInflater) TextView(android.widget.TextView) TextView(android.widget.TextView) PrintView(com.github.johnkil.print.PrintView) View(android.view.View)

Example 3 with PrintView

use of com.github.johnkil.print.PrintView in project AndroidTreeView by bmelnychuk.

the class SelectableHeaderHolder method createNodeView.

@Override
public View createNodeView(final TreeNode node, IconTreeItemHolder.IconTreeItem value) {
    final LayoutInflater inflater = LayoutInflater.from(context);
    final View view = inflater.inflate(R.layout.layout_selectable_header, null, false);
    tvValue = (TextView) view.findViewById(R.id.node_value);
    tvValue.setText(value.text);
    final PrintView iconView = (PrintView) view.findViewById(R.id.icon);
    iconView.setIconText(context.getResources().getString(value.icon));
    arrowView = (PrintView) view.findViewById(R.id.arrow_icon);
    if (node.isLeaf()) {
        arrowView.setVisibility(View.GONE);
    }
    nodeSelector = (CheckBox) view.findViewById(R.id.node_selector);
    nodeSelector.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {

        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            node.setSelected(isChecked);
            for (TreeNode n : node.getChildren()) {
                getTreeView().selectNode(n, isChecked);
            }
        }
    });
    nodeSelector.setChecked(node.isSelected());
    return view;
}
Also used : PrintView(com.github.johnkil.print.PrintView) TreeNode(com.unnamed.b.atv.model.TreeNode) LayoutInflater(android.view.LayoutInflater) TextView(android.widget.TextView) PrintView(com.github.johnkil.print.PrintView) View(android.view.View) CompoundButton(android.widget.CompoundButton)

Example 4 with PrintView

use of com.github.johnkil.print.PrintView in project AndroidTreeView by bmelnychuk.

the class SocialViewHolder method createNodeView.

@Override
public View createNodeView(TreeNode node, SocialItem value) {
    final LayoutInflater inflater = LayoutInflater.from(context);
    final View view = inflater.inflate(R.layout.layout_social_node, null, false);
    final PrintView iconView = (PrintView) view.findViewById(R.id.icon);
    iconView.setIconText(context.getResources().getString(value.icon));
    TextView connectionsLabel = (TextView) view.findViewById(R.id.connections);
    Random r = new Random();
    connectionsLabel.setText(r.nextInt(150) + " connections");
    TextView userNameLabel = (TextView) view.findViewById(R.id.username);
    userNameLabel.setText(NAMES[r.nextInt(4)]);
    TextView sizeText = (TextView) view.findViewById(R.id.size);
    sizeText.setText(r.nextInt(10) + " items");
    return view;
}
Also used : Random(java.util.Random) PrintView(com.github.johnkil.print.PrintView) LayoutInflater(android.view.LayoutInflater) TextView(android.widget.TextView) TextView(android.widget.TextView) PrintView(com.github.johnkil.print.PrintView) View(android.view.View)

Example 5 with PrintView

use of com.github.johnkil.print.PrintView in project Print by johnkil.

the class MainActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    final PrintView iconView = (PrintView) findViewById(R.id.icon);
    final TextView sizeValue = (TextView) findViewById(R.id.size_value);
    SeekBar sizeBar = (SeekBar) findViewById(R.id.size_bar);
    sizeBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {

        @Override
        public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
            sizeValue.setText(getString(R.string.size_format, progress));
            iconView.setIconSizeDp(progress);
        }

        @Override
        public void onStartTrackingTouch(SeekBar seekBar) {
        }

        @Override
        public void onStopTrackingTouch(SeekBar seekBar) {
        }
    });
    sizeBar.setProgress(320);
    // enable states for icon.
    iconView.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
        // on click process
        }
    });
}
Also used : SeekBar(android.widget.SeekBar) PrintView(com.github.johnkil.print.PrintView) TextView(android.widget.TextView) TextView(android.widget.TextView) PrintView(com.github.johnkil.print.PrintView) View(android.view.View)

Aggregations

View (android.view.View)8 TextView (android.widget.TextView)8 PrintView (com.github.johnkil.print.PrintView)8 LayoutInflater (android.view.LayoutInflater)7 TreeNode (com.unnamed.b.atv.model.TreeNode)3 CompoundButton (android.widget.CompoundButton)2 Random (java.util.Random)2 SeekBar (android.widget.SeekBar)1