forked from upstream-mirrors/OpenTracks
Clean up all the layouts.
Utilize styles when possible.
This commit is contained in:
@@ -144,7 +144,7 @@ public class TrackDetailActivity extends FragmentActivity {
|
||||
trackDataHub = ((MyTracksApplication) getApplication()).getTrackDataHub();
|
||||
trackRecordingServiceConnection = new TrackRecordingServiceConnection(this, null);
|
||||
|
||||
mapViewContainer = getLayoutInflater().inflate(R.layout.mytracks_layout, null);
|
||||
mapViewContainer = getLayoutInflater().inflate(R.layout.map, null);
|
||||
tabHost = (TabHost) findViewById(android.R.id.tabhost);
|
||||
tabHost.setup();
|
||||
tabManager = new TabManager(this, tabHost, R.id.realtabcontent);
|
||||
|
||||
@@ -42,7 +42,6 @@ import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.ViewGroup.LayoutParams;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.ZoomControls;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -77,7 +76,6 @@ public class ChartFragment extends Fragment implements TrackDataListener {
|
||||
|
||||
// UI elements
|
||||
private ChartView chartView;
|
||||
private LinearLayout busyPane;
|
||||
private ZoomControls zoomControls;
|
||||
|
||||
/**
|
||||
@@ -91,7 +89,6 @@ public class ChartFragment extends Fragment implements TrackDataListener {
|
||||
return;
|
||||
}
|
||||
|
||||
busyPane.setVisibility(View.GONE);
|
||||
zoomControls.setIsZoomInEnabled(chartView.canZoomIn());
|
||||
zoomControls.setIsZoomOutEnabled(chartView.canZoomOut());
|
||||
chartView.setShowPointer(isRecording());
|
||||
@@ -113,9 +110,8 @@ public class ChartFragment extends Fragment implements TrackDataListener {
|
||||
@Override
|
||||
public View onCreateView(
|
||||
LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
View view = inflater.inflate(R.layout.mytracks_charts, container, false);
|
||||
busyPane = (LinearLayout) view.findViewById(R.id.elevation_busypane);
|
||||
zoomControls = (ZoomControls) view.findViewById(R.id.elevation_zoom);
|
||||
View view = inflater.inflate(R.layout.chart, container, false);
|
||||
zoomControls = (ZoomControls) view.findViewById(R.id.chart_zoom_controls);
|
||||
zoomControls.setOnZoomInClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
@@ -134,7 +130,7 @@ public class ChartFragment extends Fragment implements TrackDataListener {
|
||||
@Override
|
||||
public void onStart() {
|
||||
super.onStart();
|
||||
ViewGroup layout = (ViewGroup) getActivity().findViewById(R.id.elevation_chart);
|
||||
ViewGroup layout = (ViewGroup) getActivity().findViewById(R.id.chart_view_layout);
|
||||
LayoutParams layoutParams = new LayoutParams(LayoutParams.MATCH_PARENT,
|
||||
LayoutParams.MATCH_PARENT);
|
||||
layout.addView(chartView, layoutParams);
|
||||
@@ -156,7 +152,7 @@ public class ChartFragment extends Fragment implements TrackDataListener {
|
||||
@Override
|
||||
public void onStop() {
|
||||
super.onStop();
|
||||
ViewGroup layout = (ViewGroup) getActivity().findViewById(R.id.elevation_chart);
|
||||
ViewGroup layout = (ViewGroup) getActivity().findViewById(R.id.chart_view_layout);
|
||||
layout.removeView(chartView);
|
||||
}
|
||||
|
||||
@@ -229,12 +225,7 @@ public class ChartFragment extends Fragment implements TrackDataListener {
|
||||
|
||||
@Override
|
||||
public void onSelectedTrackChanged(Track track, boolean isRecording) {
|
||||
getActivity().runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
busyPane.setVisibility(View.VISIBLE);
|
||||
}
|
||||
});
|
||||
// We don't care.
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -43,8 +43,6 @@ import android.view.LayoutInflater;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
@@ -85,11 +83,8 @@ public class MapFragment extends Fragment
|
||||
// UI elements
|
||||
private View mapViewContainer;
|
||||
private MapOverlay mapOverlay;
|
||||
private RelativeLayout screen;
|
||||
private MapView mapView;
|
||||
private LinearLayout messagePane;
|
||||
private TextView messageText;
|
||||
private LinearLayout busyPane;
|
||||
private TextView messageTextView;
|
||||
|
||||
@Override
|
||||
public View onCreateView(
|
||||
@@ -98,15 +93,12 @@ public class MapFragment extends Fragment
|
||||
|
||||
mapOverlay = new MapOverlay(getActivity());
|
||||
|
||||
screen = (RelativeLayout) mapViewContainer.findViewById(R.id.screen);
|
||||
mapView = (MapView) mapViewContainer.findViewById(R.id.map);
|
||||
mapView = (MapView) mapViewContainer.findViewById(R.id.map_view);
|
||||
mapView.requestFocus();
|
||||
mapView.setOnTouchListener(this);
|
||||
mapView.setBuiltInZoomControls(true);
|
||||
mapView.getOverlays().add(mapOverlay);
|
||||
messagePane = (LinearLayout) mapViewContainer.findViewById(R.id.messagepane);
|
||||
messageText = (TextView) mapViewContainer.findViewById(R.id.messagetext);
|
||||
busyPane = (LinearLayout) mapViewContainer.findViewById(R.id.busypane);
|
||||
messageTextView = (TextView) mapViewContainer.findViewById(R.id.map_message);
|
||||
|
||||
return mapViewContainer;
|
||||
}
|
||||
@@ -238,7 +230,7 @@ public class MapFragment extends Fragment
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (v == messagePane) {
|
||||
if (v == messageTextView) {
|
||||
Intent intent = new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS);
|
||||
startActivity(intent);
|
||||
}
|
||||
@@ -270,21 +262,20 @@ public class MapFragment extends Fragment
|
||||
@Override
|
||||
public void run() {
|
||||
if (messageId != -1) {
|
||||
messageText.setText(messageId);
|
||||
messagePane.setVisibility(View.VISIBLE);
|
||||
messageTextView.setText(messageId);
|
||||
messageTextView.setVisibility(View.VISIBLE);
|
||||
|
||||
if (isGpsDisabled) {
|
||||
Toast.makeText(getActivity(), R.string.gps_not_found, Toast.LENGTH_LONG).show();
|
||||
|
||||
// Click to show the location source settings
|
||||
messagePane.setOnClickListener(MapFragment.this);
|
||||
messageTextView.setOnClickListener(MapFragment.this);
|
||||
} else {
|
||||
messagePane.setOnClickListener(null);
|
||||
messageTextView.setOnClickListener(null);
|
||||
}
|
||||
} else {
|
||||
messagePane.setVisibility(View.GONE);
|
||||
messageTextView.setVisibility(View.GONE);
|
||||
}
|
||||
screen.requestLayout();
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -310,9 +301,7 @@ public class MapFragment extends Fragment
|
||||
boolean hasTrack = track != null;
|
||||
mapOverlay.setTrackDrawingEnabled(hasTrack);
|
||||
|
||||
if (hasTrack) {
|
||||
busyPane.setVisibility(View.VISIBLE);
|
||||
|
||||
if (hasTrack) {
|
||||
synchronized (this) {
|
||||
/*
|
||||
* Synchronize to prevent race condition in changing markerTrackId
|
||||
@@ -322,7 +311,6 @@ public class MapFragment extends Fragment
|
||||
updateMap(track);
|
||||
}
|
||||
mapOverlay.setShowEndMarker(!isRecording);
|
||||
busyPane.setVisibility(View.GONE);
|
||||
}
|
||||
mapView.invalidate();
|
||||
}
|
||||
|
||||
@@ -68,11 +68,11 @@ public class ChooseMapActivity extends Activity {
|
||||
}
|
||||
MapsMapMetadata mapData = getItem(position).getMapData();
|
||||
|
||||
TextView title = (TextView) convertView.findViewById(R.id.choose_map_list_item_title);
|
||||
TextView title = (TextView) convertView.findViewById(R.id.choose_map_item_title);
|
||||
title.setText(mapData.getTitle());
|
||||
|
||||
TextView description = (TextView) convertView.findViewById(
|
||||
R.id.choose_map_list_item_description);
|
||||
R.id.choose_map_item_description);
|
||||
String descriptionText = mapData.getDescription();
|
||||
if (descriptionText == null || descriptionText.equals("")) {
|
||||
description.setVisibility(View.GONE);
|
||||
@@ -82,7 +82,7 @@ public class ChooseMapActivity extends Activity {
|
||||
}
|
||||
|
||||
TextView searchStatus = (TextView) convertView.findViewById(
|
||||
R.id.choose_map_list_item_search_status);
|
||||
R.id.choose_map_item_search_status);
|
||||
searchStatus.setTextColor(mapData.getSearchable() ? Color.RED : Color.GREEN);
|
||||
searchStatus.setText(mapData.getSearchable() ? R.string.maps_list_public_label
|
||||
: R.string.maps_list_unlisted_label);
|
||||
|
||||
Reference in New Issue
Block a user