blob: 2f9ac3f752585a48754c25092ce85d4725367256 [file] [log] [blame]
alision9f7a6ec2013-05-24 16:26:26 -04001package com.savoirfairelinux.sflphone.adapters;
2
3import android.content.Context;
4import android.view.LayoutInflater;
5import android.view.View;
6import android.view.ViewGroup;
7import android.widget.BaseAdapter;
8import android.widget.TextView;
9
10import com.savoirfairelinux.sflphone.R;
11
12public class MenuAdapter extends BaseAdapter{
13
14 private static final String TAG = MenuAdapter.class.getSimpleName();
15 private Context mContext;
16 String categories[];
17
18 public MenuAdapter(Context c, String[] cat) {
19 mContext = c;
20 categories = cat;
21 }
22
23 @Override
24 public View getView(int pos, View convertView, ViewGroup parent) {
25 View v = convertView;
26
27 LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
28 if (v == null) {
29 v = inflater.inflate(R.layout.item_menu, null);
30 }
31
32 ((TextView) v.findViewById(R.id.menu_title_categorie)).setText(categories[pos]);
33
34 return v;
35 }
36
37 @Override
38 public int getCount() {
39 return categories.length;
40 }
41
42 @Override
43 public String getItem(int pos) {
44 return categories[pos];
45 }
46
47 @Override
48 public long getItemId(int arg0) {
49 return 0;
50 }
51
52
53}