/*
Copyright (C) 2009  Ludwig M Brinckmann <ludwigbrinckmann@gmail.com>

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.

*/
package com.yunnanexplorer.android.gps.openmoko;


import android.content.Intent;
import android.os.Bundle;
import android.preference.EditTextPreference;
import android.preference.PreferenceActivity;
import android.text.method.DigitsKeyListener;
import android.view.Menu;
import android.view.MenuItem;



public class UbloxSettings extends PreferenceActivity {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		addPreferencesFromResource(R.xml.preferences);

		((EditTextPreference)findPreference("latitude")).getEditText().setKeyListener(new DigitsKeyListener(true, true));
		((EditTextPreference)findPreference("longitude")).getEditText().setKeyListener(new DigitsKeyListener(true, true));
		((EditTextPreference)findPreference("accuracy")).getEditText().setKeyListener(new DigitsKeyListener());
		
	}	
	
	@Override 
	public boolean onCreateOptionsMenu(Menu menu) { 
		boolean supRetVal = super.onCreateOptionsMenu(menu);
			menu.add(0, 0, 0, getString(R.string.menu_help)); 
		return supRetVal; 
	} 

	@Override 
	public boolean onOptionsItemSelected(MenuItem item) {
		Intent intent;
		switch (item.getItemId()) { 
		case 0: 
			intent = new Intent("com.yunnanexplorer.android.gps.openmoko.UBLOX_HELP");
			startActivity(intent);			
			return true;    				
		}
		return false; 
	}
}
