• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 package jme3test.android;
2 
3 import android.content.Context;
4 import android.view.LayoutInflater;
5 import android.view.View;
6 import android.view.View.OnClickListener;
7 import android.view.ViewGroup;
8 import android.widget.BaseAdapter;
9 import android.widget.TextView;
10 import java.util.List;
11 
12 /**
13  * The view adapter which gets a list of LaunchEntries and displaqs them
14  * @author larynx
15  *
16  */
17 public class DemoLaunchAdapter extends BaseAdapter implements OnClickListener
18 {
19 
20     private Context context;
21 
22     private List<DemoLaunchEntry> listDemos;
23 
DemoLaunchAdapter(Context context, List<DemoLaunchEntry> listDemos)24     public DemoLaunchAdapter(Context context, List<DemoLaunchEntry> listDemos) {
25         this.context = context;
26         this.listDemos = listDemos;
27     }
28 
getCount()29     public int getCount() {
30         return listDemos.size();
31     }
32 
getItem(int position)33     public Object getItem(int position) {
34         return listDemos.get(position);
35     }
36 
getItemId(int position)37     public long getItemId(int position) {
38         return position;
39     }
40 
getView(int position, View convertView, ViewGroup viewGroup)41     public View getView(int position, View convertView, ViewGroup viewGroup) {
42         DemoLaunchEntry entry = listDemos.get(position);
43         if (convertView == null) {
44             LayoutInflater inflater = (LayoutInflater) context
45                     .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
46             convertView = inflater.inflate(R.layout.demo_row, null);
47         }
48         TextView tvDemoName = (TextView) convertView.findViewById(R.id.tvDemoName);
49         tvDemoName.setText(entry.getName());
50 
51         TextView tvDescription = (TextView) convertView.findViewById(R.id.tvDescription);
52         tvDescription.setText(entry.getDescription());
53 
54         return convertView;
55     }
56 
57     @Override
onClick(View view)58     public void onClick(View view) {
59         DemoLaunchEntry entry = (DemoLaunchEntry) view.getTag();
60 
61 
62 
63 
64     }
65 
showDialog(DemoLaunchEntry entry)66     private void showDialog(DemoLaunchEntry entry) {
67         // Create and show your dialog
68         // Depending on the Dialogs button clicks delete it or do nothing
69     }
70 
71 }
72 
73