-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathad-baseadapter.sublime-snippet
51 lines (43 loc) · 1.24 KB
/
ad-baseadapter.sublime-snippet
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
<snippet>
<content><![CDATA[
public class ${1:Custom}Adapter extends BaseAdapter {
private Context context;
private LayoutInflater inflater;
public ${1:Custom}Adapter(Context context) {
this.context = context;
inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
}
@Override
public int getCount() {
// TODO: Stub
}
@Override
public Object getItem(int position) {
// TODO: Stub
}
@Override
public long getItemId(int position) {
// TODO: Stub
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
ViewHolder holder;
if (convertView == null) {
convertView = inflater.inflate(R.layout.${2:layout_name}, parent, false);
holder = new ViewHolder();
holder.text = (TextView) convertView.findViewById(R.id.text);
convertView.setTag(holder);
}
else {
holder = (ViewHolder) convertView.getTag();
}
return convertView;
}
private class ViewHolder {
public TextView text;
}
}
]]></content>
<tabTrigger>ad-baseadapter</tabTrigger>
<scope>source.java</scope>
</snippet>