package com.airwriting.android.tests;
import java.util.Map;
import android.content.Context;
import android.graphics.Typeface;
import android.util.AttributeSet;
import android.util.Log;
import android.view.MotionEvent;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
/**
* adapted from plusminus by sommeralex <img src="http://www.anddev.org/images/smilies/wink.png" alt=";-)" title="Wink" />
*/
public class IconTextMenuView extends LinearLayout implements android.view.View.OnClickListener {
// ===========================================================
// Fields
// ===========================================================
;
private ImageView menuIcon = null;
private TextView menuText = null;
// ===========================================================
// Constructors
// ===========================================================
public IconTextMenuView(Context context) {
super(context);
}
@Override
public boolean onMotionEvent(MotionEvent event) {
performClick();
return super.onMotionEvent(event);
}
public IconTextMenuView(Context context, AttributeSet attrs,
Map inflateParams) {
super(context, attrs, inflateParams);
Log.i("IconTextMenuClicked", "icon created");
this.setOnClickListener(this);
/* Setup the ImageView that will show weather-icon. */
this.menuIcon = new ImageView(context);
this.menuIcon.setImageDrawable(getResources().getDrawable(
R.drawable.dunno));
/* Setup the textView that will show the temperature. */
this.menuText = new TextView(context);
this.menuText.setText("blabla");
this.menuText.setTextSize(8);
//this.menuText.setTypeface(Typeface
// .create("Tahoma", Typeface.BOLD));
/* Add child views to this object. */
this.addView(this.menuIcon, new LinearLayout.LayoutParams(
LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
this.addView(this.menuText, new LinearLayout.LayoutParams(
LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
}
public void onClick(View arg0) {
// TODO Auto-generated method stub
Log.i("IconTextMenuClicked", "clicked");
}
}