package android.langue.furansugo;

import android.app.SearchManager;
import android.content.Intent;
import android.langue.furansugo.dic.Dictionnaire;
import android.os.Bundle;
import android.widget.ListView;

public class DicActivity extends FuransugoActivity {
	private ListView listView;
	private Dictionnaire dic;
	@Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.dic);
        
        dic = new Dictionnaire(getResources().openRawResource(R.raw.japonais));
        
        listView = (ListView) findViewById(R.id.listView1);
        
        Intent intent = getIntent();
        if (Intent.ACTION_SEARCH.equals(intent.getAction())) {
          String query = intent.getStringExtra(SearchManager.QUERY);
          search(query);
        }
        
    }
	private void search(String query) {
		MotAdapteur adapter = new MotAdapteur(getBaseContext(), dic.chercher(query));
		listView.setAdapter(adapter);
	}
}
