mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-11-04 10:09:42 +00:00
Bugfixes, layout improvements, initial code for map
This commit is contained in:
1 parent
64fbf98944
commit
bb8533dfc6
11 files changed
+114
-56
No files matched your search
@@ -19,7 +19,7 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="50dp"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:background="@+color/black_transparent"
|
||||
android:background="@color/black_transparent"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true">
|
||||
|
||||
|
||||
@@ -37,6 +37,7 @@
|
||||
|
||||
<color name="black">#000000</color>
|
||||
<color name="black_transparent">#55000000</color>
|
||||
<color name="black_slightly_transparent">#D8000000</color>
|
||||
<color name="white">#FFFFFF</color>
|
||||
<color name="white_less_transparent">#CCFFFFFF</color>
|
||||
<color name="sap_green">#8AB54E</color>
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
android:minSdkVersion="14"
|
||||
android:targetSdkVersion="22" />
|
||||
|
||||
|
||||
<!-- <uses-permission android:name="android.permission.ACCESS_MOCK_LOCATION" /> -->
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
|
||||
@@ -15,9 +14,16 @@
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
|
||||
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
|
||||
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
|
||||
<uses-permission android:name="com.sap.sailing.android.tracking.app.permission.C2D_MESSAGE" />
|
||||
<uses-permission android:name="android.permission.CAMERA" />
|
||||
|
||||
<uses-feature
|
||||
android:glEsVersion="0x00020000"
|
||||
android:required="true" />
|
||||
|
||||
<uses-library
|
||||
android:name="com.google.android.maps"
|
||||
android:required="true" />
|
||||
|
||||
<application
|
||||
android:name="com.sap.sailing.android.shared.application.LoggableApplication"
|
||||
@@ -31,7 +37,7 @@
|
||||
android:value="@integer/google_play_services_version" />
|
||||
<meta-data
|
||||
android:name="com.google.android.maps.v2.API_KEY"
|
||||
android:value="@string/GoogleMapsKey"/>
|
||||
android:value="AIzaSyDH-Dwy5yFlyBa2-VUgiZ3qGGUO8M_0MPY" />
|
||||
|
||||
|
||||
<activity
|
||||
@@ -69,7 +75,7 @@
|
||||
|
||||
<activity
|
||||
android:name=".ui.activities.PositioningActivity"
|
||||
android:screenOrientation="unspecified">
|
||||
android:screenOrientation="portrait">
|
||||
|
||||
</activity>
|
||||
|
||||
|
||||
+29
-19
@@ -7,45 +7,55 @@
|
||||
android:paddingLeft="0dp"
|
||||
android:paddingRight="0dp">
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"
|
||||
android:background="@color/white">
|
||||
|
||||
<com.sap.sailing.android.shared.ui.customviews.OpenSansTextView
|
||||
android:id="@+id/mark_header"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_gravity="left"
|
||||
android:background="@color/black_transparent"
|
||||
android:gravity="center"
|
||||
android:background="@color/black_slightly_transparent"
|
||||
android:gravity="left"
|
||||
android:paddingBottom="7dp"
|
||||
android:paddingLeft="10dp"
|
||||
android:paddingTop="7dp"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="10sp" />
|
||||
android:textSize="14sp" />
|
||||
|
||||
<fragment
|
||||
<com.google.android.gms.maps.MapView
|
||||
android:id="@+id/map"
|
||||
android:name="com.google.android.gms.maps.MapFragment"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
|
||||
<!-- Begin of detailed mark information -->
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:paddingBottom="15dp"
|
||||
android:paddingBottom="10dp"
|
||||
android:paddingLeft="10dp"
|
||||
android:paddingRight="7dp"
|
||||
android:paddingTop="15dp" >
|
||||
android:paddingTop="10dp">
|
||||
|
||||
<com.sap.sailing.android.shared.ui.customviews.OpenSansTextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/signal_accuracy_indicator_view_description"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="16sp" />
|
||||
android:textSize="20sp" />
|
||||
|
||||
<!-- Empty view to right align the following element -->
|
||||
|
||||
@@ -60,7 +70,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:text=""
|
||||
android:textColor="@color/white"
|
||||
android:textSize="16sp"
|
||||
android:textSize="20sp"
|
||||
android:textStyle="bold" />
|
||||
</LinearLayout>
|
||||
|
||||
@@ -70,17 +80,17 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:paddingBottom="15dp"
|
||||
android:paddingBottom="10dp"
|
||||
android:paddingLeft="10dp"
|
||||
android:paddingRight="7dp"
|
||||
android:paddingTop="15dp" >
|
||||
android:paddingTop="10dp">
|
||||
|
||||
<com.sap.sailing.android.shared.ui.customviews.OpenSansTextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/longitude"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="16sp" />
|
||||
android:textSize="20sp" />
|
||||
|
||||
<!-- Empty view to right align the following element -->
|
||||
|
||||
@@ -95,7 +105,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:text=""
|
||||
android:textColor="@color/white"
|
||||
android:textSize="16sp" />
|
||||
android:textSize="20sp" />
|
||||
</LinearLayout>
|
||||
|
||||
<View style="@style/Divider" />
|
||||
@@ -104,17 +114,17 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:paddingBottom="15dp"
|
||||
android:paddingBottom="10dp"
|
||||
android:paddingLeft="10dp"
|
||||
android:paddingRight="7dp"
|
||||
android:paddingTop="15dp" >
|
||||
android:paddingTop="10dp">
|
||||
|
||||
<com.sap.sailing.android.shared.ui.customviews.OpenSansTextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/latitude"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="16sp" />
|
||||
android:textSize="20sp" />
|
||||
|
||||
<!-- Empty view to right align the following element -->
|
||||
|
||||
@@ -129,7 +139,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:text=""
|
||||
android:textColor="@color/white"
|
||||
android:textSize="16sp" />
|
||||
android:textSize="20sp" />
|
||||
</LinearLayout>
|
||||
|
||||
<View style="@style/Divider" />
|
||||
@@ -137,7 +147,7 @@
|
||||
<com.sap.sailing.android.shared.ui.customviews.OpenSansButton
|
||||
android:id="@+id/marker_set_position_button"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_height="80dp"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginRight="10dp"
|
||||
android:layout_marginTop="15dp"
|
||||
|
||||
+2
-2
@@ -12,7 +12,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="18dp"
|
||||
android:text="@string/course_type"
|
||||
android:textSize="18sp" />
|
||||
android:textSize="20sp" />
|
||||
|
||||
|
||||
<com.sap.sailing.android.shared.ui.customviews.OpenSansTextView
|
||||
@@ -20,7 +20,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="30dp"
|
||||
android:text="@string/marks"
|
||||
android:textSize="18sp" />
|
||||
android:textSize="20sp" />
|
||||
|
||||
<View style="@style/Divider" />
|
||||
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
android:layout_marginTop="15dp"
|
||||
android:paddingLeft="15dp"
|
||||
android:paddingRight="15dp"
|
||||
android:textSize="20sp"
|
||||
android:singleLine="true"
|
||||
android:textColor="@color/white" />
|
||||
|
||||
@@ -35,10 +36,11 @@
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_below="@+id/mark_name"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginTop="2dp"
|
||||
android:layout_marginBottom="15dp"
|
||||
android:paddingLeft="15dp"
|
||||
android:paddingRight="15dp"
|
||||
android:textSize="14sp"
|
||||
android:singleLine="true"
|
||||
android:textColor="@color/white" />
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
<string name="set_position">Position setzen</string>
|
||||
<string name="reset_position">Position zurücksetzen</string>
|
||||
<string name="getting_marks">Empfangen der Markierungen..</string>
|
||||
<string name="set">gesetzt</string>
|
||||
<string name="not_set">nicht gesetzt</string>
|
||||
<string name="set">Gesetzt</string>
|
||||
<string name="not_set">Nicht gesetzt</string>
|
||||
|
||||
</resources>
|
||||
+1
-1
@@ -34,7 +34,7 @@ public class MarkAdapter extends ResourceCursorAdapter {
|
||||
}
|
||||
else{
|
||||
setText = context.getString(R.string.set);
|
||||
String accuracy = " (" + markPings.get(0).getAccuracy() + ")";
|
||||
String accuracy = " (~ " + markPings.get(0).getAccuracy() + ")";
|
||||
setText += accuracy;
|
||||
}
|
||||
markName.setText(name);
|
||||
|
||||
+3
-3
@@ -31,11 +31,11 @@ public class PositioningActivity extends BaseActivity implements pingListener {
|
||||
getString(R.string.checkin_digest));
|
||||
List<MarkInfo> marks = DatabaseHelper.getInstance().getMarks(this,
|
||||
checkinDigest);
|
||||
leaderBoard = DatabaseHelper.getInstance().getLeaderboard(this,
|
||||
checkinDigest);
|
||||
setLeaderBoard(DatabaseHelper.getInstance().getLeaderboard(this,
|
||||
checkinDigest));
|
||||
for (MarkInfo mark : marks) {
|
||||
if (mark.getId().equals(markerID)) {
|
||||
markInfo = mark;
|
||||
setMarkInfo(mark);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
+1
@@ -52,6 +52,7 @@ public class RegattaActivity extends AbstractRegattaActivity{
|
||||
getSupportActionBar().setHomeButtonEnabled(true);
|
||||
toolbar.setNavigationIcon(R.drawable.sap_logo_64_sq);
|
||||
toolbar.setPadding(20, 0, 0, 0);
|
||||
toolbar.setBackgroundColor(getResources().getColor(R.color.colorPrimary));
|
||||
getSupportActionBar().setTitle(leaderboardName);
|
||||
}
|
||||
RegattaFragment regattaFragment = new RegattaFragment();
|
||||
|
||||
+60
-22
@@ -12,7 +12,11 @@ import android.view.View.OnClickListener;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.google.android.gms.maps.MapFragment;
|
||||
import com.google.android.gms.maps.CameraUpdateFactory;
|
||||
import com.google.android.gms.maps.GoogleMap;
|
||||
import com.google.android.gms.maps.MapView;
|
||||
import com.google.android.gms.maps.model.LatLng;
|
||||
import com.google.android.gms.maps.model.MarkerOptions;
|
||||
import com.sap.sailing.android.buoy.positioning.app.R;
|
||||
import com.sap.sailing.android.buoy.positioning.app.ui.activities.PositioningActivity;
|
||||
import com.sap.sailing.android.buoy.positioning.app.util.DatabaseHelper.GeneralDatabaseHelperException;
|
||||
@@ -26,13 +30,14 @@ import com.sap.sailing.android.ui.fragments.BaseFragment;
|
||||
|
||||
public class BuoyFragment extends BaseFragment implements LocationListener {
|
||||
private OpenSansTextView markHeaderTextView;
|
||||
private OpenSansTextView lattitudeTextView;
|
||||
private OpenSansTextView latitudeTextView;
|
||||
private OpenSansTextView longitudeTextView;
|
||||
private OpenSansTextView accuracyTextView;
|
||||
private OpenSansButton setPositionButton;
|
||||
private OpenSansButton resetPostionButton;
|
||||
private MapFragment mapFragment;
|
||||
private OpenSansButton resetPositionButton;
|
||||
private MapView mapView;
|
||||
private Location lastKnownLocation;
|
||||
private LatLng savedPosition;
|
||||
private LocationManager locationManager;
|
||||
private String locationProvider;
|
||||
private pingListener pingListener;
|
||||
@@ -44,27 +49,26 @@ public class BuoyFragment extends BaseFragment implements LocationListener {
|
||||
View view = inflater.inflate(R.layout.fragment_buoy_postion_detail,
|
||||
container, false);
|
||||
|
||||
mapFragment = (MapFragment) getActivity().getFragmentManager()
|
||||
.findFragmentById(R.id.map);
|
||||
mapView = (MapView) view.findViewById(R.id.map);
|
||||
|
||||
markHeaderTextView = (OpenSansTextView) view
|
||||
.findViewById(R.id.mark_header);
|
||||
lattitudeTextView = (OpenSansTextView) view
|
||||
latitudeTextView = (OpenSansTextView) view
|
||||
.findViewById(R.id.marker_gps_latitude);
|
||||
longitudeTextView = (OpenSansTextView) view
|
||||
.findViewById(R.id.marker_gps_longitude);
|
||||
accuracyTextView = (OpenSansTextView) view
|
||||
.findViewById(R.id.marker_gps_accuracy);
|
||||
Clicklistener clicklistener = new Clicklistener();
|
||||
ClickListener clickListener = new ClickListener();
|
||||
|
||||
setPositionButton = (OpenSansButton) view
|
||||
.findViewById(R.id.marker_set_position_button);
|
||||
setPositionButton.setOnClickListener(clicklistener);
|
||||
setPositionButton.setOnClickListener(clickListener);
|
||||
|
||||
resetPostionButton = (OpenSansButton) view
|
||||
resetPositionButton = (OpenSansButton) view
|
||||
.findViewById(R.id.marker_reset_position_button);
|
||||
resetPostionButton.setOnClickListener(clicklistener);
|
||||
resetPostionButton.setVisibility(View.GONE);
|
||||
resetPositionButton.setOnClickListener(clickListener);
|
||||
resetPositionButton.setVisibility(View.GONE);
|
||||
return view;
|
||||
}
|
||||
|
||||
@@ -72,10 +76,15 @@ public class BuoyFragment extends BaseFragment implements LocationListener {
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
initLocationProvider();
|
||||
lastKnownLocation = locationManager.getLastKnownLocation(LocationManager.GPS_PROVIDER);
|
||||
MarkInfo mark = ((PositioningActivity) getActivity()).getMarkInfo();
|
||||
if (mark != null) {
|
||||
markHeaderTextView.setText(mark.getName());
|
||||
setUpPingUI();
|
||||
//setUpMap();
|
||||
}
|
||||
if(lastKnownLocation != null) {
|
||||
//mapView.getMap().animateCamera(CameraUpdateFactory.newLatLng(new LatLng(lastKnownLocation.getLatitude(), lastKnownLocation.getLongitude())));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -83,7 +92,10 @@ public class BuoyFragment extends BaseFragment implements LocationListener {
|
||||
MarkPingInfo markPing = ((PositioningActivity) getActivity())
|
||||
.getMarkPing();
|
||||
if (markPing != null) {
|
||||
lattitudeTextView.setText(markPing.getLattitude());
|
||||
double savedLatitude = Double.parseDouble(markPing.getLattitude());
|
||||
double savedLongitude = Double.parseDouble(markPing.getLongitude());
|
||||
savedPosition = new LatLng(savedLatitude, savedLongitude);
|
||||
latitudeTextView.setText(markPing.getLattitude());
|
||||
longitudeTextView.setText(markPing.getLongitude());
|
||||
accuracyTextView.setText("~" + markPing.getAccuracy());
|
||||
}
|
||||
@@ -91,32 +103,58 @@ public class BuoyFragment extends BaseFragment implements LocationListener {
|
||||
|
||||
@Override
|
||||
public void onLocationChanged(Location location) {
|
||||
if(getActivity() instanceof PositioningActivity) {
|
||||
lastKnownLocation = location;
|
||||
//setUpMap();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStatusChanged(String provider, int status, Bundle extras) {
|
||||
if(getActivity() instanceof PositioningActivity) {
|
||||
initLocationProvider();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onProviderEnabled(String provider) {
|
||||
if(getActivity() instanceof PositioningActivity) {
|
||||
initLocationProvider();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onProviderDisabled(String provider) {
|
||||
if(getActivity() instanceof PositioningActivity) {
|
||||
initLocationProvider();
|
||||
}
|
||||
}
|
||||
|
||||
private void initLocationProvider() {
|
||||
locationManager = (LocationManager) getActivity().getSystemService(
|
||||
Context.LOCATION_SERVICE);
|
||||
locationManager.removeUpdates(this);
|
||||
locationProvider = locationManager
|
||||
.getBestProvider(new Criteria(), true);
|
||||
locationManager.requestLocationUpdates(locationProvider, 60000, 10,
|
||||
this);
|
||||
locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER,1000L,500.0f, this);
|
||||
}
|
||||
|
||||
public void setUpMap() {
|
||||
GoogleMap map = mapView.getMap();
|
||||
map.clear();
|
||||
if (savedPosition != null) {
|
||||
MarkerOptions savedLocactionOptions = new MarkerOptions();
|
||||
savedLocactionOptions.position(savedPosition);
|
||||
// mySelfOptions.visible(true);
|
||||
map.addMarker(savedLocactionOptions);
|
||||
}
|
||||
if(lastKnownLocation != null)
|
||||
{
|
||||
MarkerOptions mySelfOptions = new MarkerOptions();
|
||||
LatLng lastKnownLatLng = new LatLng(lastKnownLocation.getLatitude(), lastKnownLocation.getLongitude());
|
||||
mySelfOptions.position(lastKnownLatLng);
|
||||
// mySelfOptions.visible(true);
|
||||
map.addMarker(mySelfOptions);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void setPingListener(pingListener listener) {
|
||||
@@ -127,7 +165,7 @@ public class BuoyFragment extends BaseFragment implements LocationListener {
|
||||
public void updatePing();
|
||||
}
|
||||
|
||||
private class Clicklistener implements OnClickListener {
|
||||
private class ClickListener implements OnClickListener {
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
@@ -138,16 +176,16 @@ public class BuoyFragment extends BaseFragment implements LocationListener {
|
||||
if (lastKnownLocation != null) {
|
||||
MarkInfo mark = ((PositioningActivity) getActivity())
|
||||
.getMarkInfo();
|
||||
LeaderboardInfo leaderboard = ((PositioningActivity) getActivity())
|
||||
LeaderboardInfo leaderBoard = ((PositioningActivity) getActivity())
|
||||
.getLeaderBoard();
|
||||
helper.storePingInDatabase(getActivity(),
|
||||
lastKnownLocation, mark);
|
||||
helper.sendPingToServer(getActivity(),
|
||||
lastKnownLocation, leaderboard, mark);
|
||||
lastKnownLocation, leaderBoard, mark);
|
||||
savedPosition = new LatLng(lastKnownLocation.getLatitude(), lastKnownLocation.getLongitude());
|
||||
pingListener.updatePing();
|
||||
setUpPingUI();
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
Toast.makeText(getActivity(), "Location is not available yet", Toast.LENGTH_LONG).show();
|
||||
}
|
||||
} catch (GeneralDatabaseHelperException e) {
|
||||
|
||||
Reference in new issue
Block a user