PageRenderTime 16ms CodeModel.GetById 11ms app.highlight 2ms RepoModel.GetById 2ms app.codeStats 0ms

/config/src/com/google/marvin/config/EyesFreeConfig.java

http://eyes-free.googlecode.com/
Java | 49 lines | 37 code | 11 blank | 1 comment | 0 complexity | add7d287bbeabf08350f4f2ced837f72 MD5 | raw file
 1package com.google.marvin.config;
 2
 3import java.util.ArrayList;
 4
 5import android.app.Activity;
 6import android.content.Intent;
 7import android.net.Uri;
 8import android.os.Bundle;
 9import android.view.View;
10import android.view.View.OnClickListener;
11import android.widget.AdapterView;
12import android.widget.ListView;
13import android.widget.AdapterView.OnItemClickListener;
14
15public class EyesFreeConfig extends Activity {
16  
17  private ListView appList; 
18  private AppListAdapter appListAdapter; 
19  
20  
21    /** Called when the activity is first created. */
22    @Override
23    public void onCreate(Bundle savedInstanceState) {
24        super.onCreate(savedInstanceState);
25        appList = new ListView(this);
26        appListAdapter = new AppListAdapter(this, getAppsList());
27        appList.setAdapter(appListAdapter);        
28        appList.setOnItemClickListener(new OnItemClickListener(){
29          public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long rowId) {
30            String packageName = appListAdapter.getPackageName((int) rowId);
31            Uri marketUri = Uri.parse("market://search?q=pname:" + packageName);
32            Intent marketIntent = new Intent(Intent.ACTION_VIEW, marketUri);
33            startActivity(marketIntent);
34          }   
35        });        
36        setContentView(appList);
37    }
38    
39    
40    private ArrayList<AppDesc> getAppsList(){
41      ArrayList<AppDesc> apps = new ArrayList<AppDesc>();
42      AppDesc testApp = new AppDesc("com.google.tts", "TTS Lib", "This is the text to speech library.");
43      apps.add(testApp);
44      return apps;
45    }
46    
47    
48    
49}