-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathItemView.java
More file actions
62 lines (51 loc) · 1.56 KB
/
ItemView.java
File metadata and controls
62 lines (51 loc) · 1.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
package com.mollys.db;
import android.content.Context;
import android.view.View;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.TextView;
//THIS IS WHERE YOU INSTANTIATE THE VIEW THAT
//CORRESPONDS TO A PARTICULAR ITEM
//YOU DISPLAY THE ITEM AND ITS SUBITEMS HERE
public class ItemView extends LinearLayout {
private Context mContext;
private View mv;
//ONLY THESE THREE PARAMETERS ARE ACTUALLY NEEDED
public ItemView(Context context, Item it) {
super(context);
mContext=context;
this.setOrientation(VERTICAL);
if(it.getType().matches("TextView"))
{
TextView tv=new TextView(context);
tv.setText(it.getText());
tv.setBackgroundColor(it.getColor());
mv=tv;
}
else if(it.getType().matches("EditText"))
{
EditText ed=new EditText(context);
ed.setText(it.getText());
mv=ed;
}
// mv=new TextView(context);
// mTv.setText(it.getText());
// mTv.setBackgroundColor(Color.YELLOW);
// mTv.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 30);
// mTv.setOnClickListener(new ItemClickListener(mContext));
addView(mv);
}
private class ItemClickListener implements OnClickListener{
private int mwid;
private Context mContext;
public ItemClickListener(Context context)
{
mContext=context;
}
public void onClick(View v) {
// Intent clickInt=new Intent(mContext, stickm_ConfigureActivity.class);
// clickInt.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, mwid);
// startActivityForResult(clickInt,0);
}
}
}