Skip to content

Instantly share code, notes, and snippets.

@bhameyie
Created May 28, 2013 23:22
Show Gist options
  • Save bhameyie/5666895 to your computer and use it in GitHub Desktop.
Save bhameyie/5666895 to your computer and use it in GitHub Desktop.
Person control andoird
public class PersonControl : LinearLayout, IPersonView
{
private Activity m_context;
public PersonControl(Context context)
: base(context)
{
Init(context);
}
public PersonControl(Context context, IAttributeSet attrs)
: base(context, attrs)
{
Init(context);
}
private void Init(Context context)
{
m_context = (Activity)context;
Inflate(context, Resource.Layout.PersonControl, this);
}
public byte[] Image
{
set
{
m_context.RunOnUiThread(() =>
{
var bm = BitmapFactory.DecodeByteArray(value, 0, value.Length);
var imgView = FindViewById<ImageView>(Resource.Id.thumbnailImage);
imgView.SetScaleType(ImageView.ScaleType.FitCenter);
imgView.SetPadding(8, 8, 8, 8);
imgView.SetImageBitmap(bm);
});
}
}
public string LastName
{
set
{
var textView = FindViewById<TextView>(Resource.Id.lastName);
textView.Text = value;
}
}
public string FirstName
{
set
{
var textView = FindViewById<TextView>(Resource.Id.firstName);
textView.Text ="@"+ value;
}
}
public int Age
{
set
{
var textView = FindViewById<TextView>(Resource.Id.age);
textView.Text = string.Format(textView.Text,value);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment