package com.quemb.qmbform.view;

import com.quemb.qmbform.R;
import com.quemb.qmbform.descriptor.RowDescriptor;

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

/**
 * Created by tonimoeckel on 15.07.14.
 */
public class FormTitleFieldCell extends FormBaseCell {
    private TextView mTextView;

    public FormTitleFieldCell(Context context,
                              RowDescriptor rowDescriptor) {
        super(context, rowDescriptor);
    }

    @Override
    protected void init() {
        super.init();
        mTextView = (TextView) findViewById(R.id.textView);
        mTextView.setTextColor(R.attr.editTextColor);
        mTextView.setTextAppearance(getContext(), R.style.Base_TextAppearance_AppCompat_Body2);
    }

    @Override
    protected int getResource() {
        return R.layout.text_field_cell;
    }

    @Override
    protected void update() {
        String title = getFormItemDescriptor().getTitle();
        mTextView.setText(title);
        mTextView.setVisibility(title == null ? GONE : VISIBLE);


        if (getRowDescriptor().getDisabled()) {
            getRowDescriptor().setOnFormRowClickListener(null);
            mTextView.setTextColor(getResources().getColor(R.color.form_cell_disabled));
        }
    }

    public TextView getTextView() {
        return mTextView;
    }
}

@@ -584,24 +584,25 @@
 tView);%0A
+%0A
         
 mTextVie
@@ -597,147 +597,94 @@
     
-mTextView.setTextColor(R.attr.editTextColor);%0A        mTextView.setTextAppearance(getContext(), R.style.Base_TextAppearance_AppCompat_Body2
+setStyleId(mTextView, CellDescriptor.APPEARANCE_TEXT_LABEL, CellDescriptor.COLOR_LABEL
 );%0A 
@@ -1101,16 +1101,17 @@
 (null);%0A
+%0A
         
@@ -1110,34 +1110,24 @@
             
-mTextView.
 setTextColor
@@ -1131,59 +1131,54 @@
 lor(
-getResources().getColor(R.color.form_cell_disabled)
+mTextView, CellDescriptor.COLOR_LABEL_DISABLED
 );%0A 

Set title style and disabled color