71 lines
1.7 KiB
Java
71 lines
1.7 KiB
Java
package com.openwide.android;
|
|
|
|
import android.content.Context;
|
|
import android.view.View;
|
|
import android.widget.CheckBox;
|
|
import android.widget.LinearLayout;
|
|
import android.widget.TextView;
|
|
|
|
public class ContactRow extends LinearLayout {
|
|
|
|
CheckBox mSelectedCheckBox;
|
|
TextView mNameTextView;
|
|
TextView mNumberView;
|
|
LinearLayout mInfoLayout;
|
|
Long mId;
|
|
|
|
public ContactRow(Context context) {
|
|
super(context);
|
|
|
|
mSelectedCheckBox = new CheckBox(context);
|
|
mInfoLayout = new LinearLayout(context);
|
|
|
|
mNameTextView = new TextView(context);
|
|
mNumberView = new TextView(context);
|
|
|
|
mNameTextView.setTextSize(30,0);
|
|
mNumberView.setTextSize(18,0);
|
|
|
|
|
|
mSelectedCheckBox.setText("");
|
|
mSelectedCheckBox.setFocusable(false);
|
|
|
|
|
|
this.addView(mSelectedCheckBox, new LayoutParams(LayoutParams.WRAP_CONTENT,
|
|
LayoutParams.FILL_PARENT));
|
|
mInfoLayout.setOrientation(LinearLayout.VERTICAL);
|
|
mInfoLayout.addView(mNameTextView, new LayoutParams(LayoutParams.FILL_PARENT,
|
|
LayoutParams.WRAP_CONTENT));
|
|
mInfoLayout.addView(mNumberView, new LayoutParams(LayoutParams.FILL_PARENT,
|
|
LayoutParams.WRAP_CONTENT));
|
|
|
|
this.addView(mInfoLayout, new LayoutParams(LayoutParams.WRAP_CONTENT,
|
|
LayoutParams.FILL_PARENT));
|
|
|
|
this.setOnClickListener(new OnClickListener() {
|
|
|
|
public void onClick(View v) {
|
|
mSelectedCheckBox.performClick();
|
|
|
|
}
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
public void display(String name, String number, boolean isSelected) {
|
|
mNameTextView.setText(name);
|
|
mNumberView.setText(number);
|
|
mSelectedCheckBox.setChecked(isSelected);
|
|
}
|
|
|
|
public void display(String name, String number, boolean isSelected, long id) {
|
|
display( name, number, isSelected);
|
|
mId = id;
|
|
|
|
}
|
|
|
|
|
|
}
|