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;
21 import android.app.Activity;
22 import android.content.Intent;
23 import android.os.Bundle;
24 import android.view.View;
25 import android.view.Window;
26 import android.widget.*;
28 import org.altusmetrum.altoslib_14.*;
30 public class MapTypeActivity extends Activity {
31 private Button hybrid;
32 private Button satellite;
33 private Button roadmap;
34 private Button terrain;
35 private int selected_type;
37 public static final String EXTRA_MAP_TYPE = "map_type";
39 private void done(int type) {
41 Intent intent = new Intent();
42 intent.putExtra(EXTRA_MAP_TYPE, type);
43 setResult(Activity.RESULT_OK, intent);
47 public void selectType(View view) {
48 AltosDebug.debug("selectType %s", view.toString());
50 done(AltosMap.maptype_hybrid);
51 if (view == satellite)
52 done(AltosMap.maptype_satellite);
54 done(AltosMap.maptype_roadmap);
56 done(AltosMap.maptype_terrain);
60 protected void onCreate(Bundle savedInstanceState) {
61 setTheme(AltosDroid.dialog_themes[AltosDroidPreferences.font_size()]);
62 super.onCreate(savedInstanceState);
65 setContentView(R.layout.map_type);
67 hybrid = (Button) findViewById(R.id.map_type_hybrid);
68 satellite = (Button) findViewById(R.id.map_type_satellite);
69 roadmap = (Button) findViewById(R.id.map_type_roadmap);
70 terrain = (Button) findViewById(R.id.map_type_terrain);
72 // Set result CANCELED incase the user backs out
73 setResult(Activity.RESULT_CANCELED);