Merge remote-tracking branch 'mjb/altosdroid'
[fw/altos] / altosdroid / src / org / altusmetrum / AltosDroid / TabMap.java
1 /*
2  * Copyright © 2013 Mike Beattie <mike@ethernal.org>
3  *
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.
7  *
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.
12  *
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.
16  */
17
18 package org.altusmetrum.AltosDroid;
19
20 import org.altusmetrum.altoslib_1.AltosState;
21
22 import com.google.android.gms.maps.GoogleMap;
23
24 import android.app.Activity;
25 import android.os.Bundle;
26 import android.support.v4.app.Fragment;
27 import android.support.v4.app.FragmentTransaction;
28 import android.view.LayoutInflater;
29 import android.view.View;
30 import android.view.ViewGroup;
31
32 public class TabMap extends Fragment implements AltosDroidTab {
33         AltosDroid mAltosDroid;
34
35         private GoogleMap mMap;
36
37
38         @Override
39         public void onAttach(Activity activity) {
40                 super.onAttach(activity);
41                 mAltosDroid = (AltosDroid) activity;
42                 mAltosDroid.registerTab(this);
43         }
44
45         @Override
46         public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
47                 View v = inflater.inflate(R.layout.tab_map, container, false);
48                 return v;
49         }
50
51         @Override
52         public void onDestroyView() {
53                 super.onDestroyView();
54
55                 mAltosDroid.unregisterTab(this);
56                 mAltosDroid = null;
57
58                 //Fragment fragment = (getFragmentManager().findFragmentById(R.id.map));
59                 //FragmentTransaction ft = getActivity().getSupportFragmentManager().beginTransaction();
60                 //ft.remove(fragment);
61                 //ft.commit();
62         }
63
64         public void update_ui(AltosState state) {
65 //              mRangeView.setText(String.format("%6.0f m", state.range));
66 //              if (state.from_pad != null)
67 //                      mBearingView.setText(String.format("%3.0f°", state.from_pad.bearing));
68 //              mLatitudeView.setText(pos(state.gps.lat, "N", "S"));
69 //              mLongitudeView.setText(pos(state.gps.lon, "W", "E"));
70         }
71
72 }