package com.usai.redant.CommonEditor.CommonEditor;

import android.content.Context;
import android.view.View;
import android.widget.TextView;

import com.usai.redant.redantmobile.R;

import org.json.JSONObject;



public class CommonEditorSectionHeaderHolder extends CommonEditorCellHolder {

    public TextView title_lb;
    public TextView control_btn;
    public Boolean show;


    public CommonEditorSectionHeaderHolder(Context context, View view) {
        super(context, view);


        title_lb = (TextView) view.findViewById(R.id.title_lb);
        control_btn = (TextView) view.findViewById(R.id.header_control_btn);
        setShow(true);
        hideControlBtn(true);
//
//        control_btn.setOnClickListener(new View.OnClickListener() {
//            @Override
//            public void onClick(View v) {
//                setShow(!show);
//                if (sectionShow != null) {
//                    sectionShow.sectionShow(group,show);
//                }
//            }
//        });
    }


    public void setShow(boolean show) {
        this.show = show;

        if (show == true) {
            control_btn.setText("Hide");
        } else {
            control_btn.setText("Show");
        }

    }

    public void hideControlBtn(boolean hide) {
        if (hide == true) {
            control_btn.setVisibility(View.INVISIBLE);
        } else {
            control_btn.setVisibility(View.VISIBLE);
        }
    }

    public void clickSectionHeader(boolean expand) {
        setShow(expand);
    }


    @Override
    public void setItem(JSONObject item_json, boolean readonly, View view) {
        super.setItem(item_json, readonly, view);
    }
}
