2 * Copyright © 2015 Keith Packard <keithp@keithp.com>
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 2 of the License.
8 * This program is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * General Public License for more details.
13 * You should have received a copy of the GNU General Public License along
14 * with this program; if not, write to the Free Software Foundation, Inc.,
15 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
18 package org.altusmetrum.AltosDroid;
21 import org.altusmetrum.AltosDroid.R;
23 import android.app.Activity;
24 import android.bluetooth.BluetoothAdapter;
25 import android.bluetooth.BluetoothDevice;
26 import android.content.BroadcastReceiver;
27 import android.content.Context;
28 import android.content.Intent;
29 import android.content.IntentFilter;
30 import android.os.Bundle;
31 import android.view.View;
32 import android.view.Window;
33 import android.view.View.OnClickListener;
34 import android.widget.*;
35 import android.widget.AdapterView.*;
37 import org.altusmetrum.altoslib_7.*;
39 public class MapTypeActivity extends Activity {
40 private Button hybrid;
41 private Button satellite;
42 private Button roadmap;
43 private Button terrain;
44 private int selected_type;
46 public static final String EXTRA_MAP_TYPE = "map_type";
48 private void done(int type) {
50 Intent intent = new Intent();
51 intent.putExtra(EXTRA_MAP_TYPE, type);
52 setResult(Activity.RESULT_OK, intent);
56 public void selectType(View view) {
57 AltosDebug.debug("selectType %s", view.toString());
59 done(AltosMap.maptype_hybrid);
60 if (view == satellite)
61 done(AltosMap.maptype_satellite);
63 done(AltosMap.maptype_roadmap);
65 done(AltosMap.maptype_terrain);
69 protected void onCreate(Bundle savedInstanceState) {
70 super.onCreate(savedInstanceState);
73 requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
74 setContentView(R.layout.map_type);
76 hybrid = (Button) findViewById(R.id.map_type_hybrid);
77 satellite = (Button) findViewById(R.id.map_type_satellite);
78 roadmap = (Button) findViewById(R.id.map_type_roadmap);
79 terrain = (Button) findViewById(R.id.map_type_terrain);
81 // Set result CANCELED incase the user backs out
82 setResult(Activity.RESULT_CANCELED);