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; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * General Public License for more details.
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
19 package org.altusmetrum.AltosDroid;
22 import org.altusmetrum.AltosDroid.R;
24 import android.app.Activity;
25 import android.bluetooth.BluetoothAdapter;
26 import android.bluetooth.BluetoothDevice;
27 import android.content.BroadcastReceiver;
28 import android.content.Context;
29 import android.content.Intent;
30 import android.content.IntentFilter;
31 import android.os.Bundle;
32 import android.view.View;
33 import android.view.Window;
34 import android.view.View.OnClickListener;
35 import android.widget.*;
36 import android.widget.AdapterView.*;
38 import org.altusmetrum.altoslib_11.*;
40 public class MapTypeActivity extends Activity {
41 private Button hybrid;
42 private Button satellite;
43 private Button roadmap;
44 private Button terrain;
45 private int selected_type;
47 public static final String EXTRA_MAP_TYPE = "map_type";
49 private void done(int type) {
51 Intent intent = new Intent();
52 intent.putExtra(EXTRA_MAP_TYPE, type);
53 setResult(Activity.RESULT_OK, intent);
57 public void selectType(View view) {
58 AltosDebug.debug("selectType %s", view.toString());
60 done(AltosMap.maptype_hybrid);
61 if (view == satellite)
62 done(AltosMap.maptype_satellite);
64 done(AltosMap.maptype_roadmap);
66 done(AltosMap.maptype_terrain);
70 protected void onCreate(Bundle savedInstanceState) {
71 super.onCreate(savedInstanceState);
74 requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
75 setContentView(R.layout.map_type);
77 hybrid = (Button) findViewById(R.id.map_type_hybrid);
78 satellite = (Button) findViewById(R.id.map_type_satellite);
79 roadmap = (Button) findViewById(R.id.map_type_roadmap);
80 terrain = (Button) findViewById(R.id.map_type_terrain);
82 // Set result CANCELED incase the user backs out
83 setResult(Activity.RESULT_CANCELED);