mirror of
https://github.com/MatomoCamp/matomocamp-companion-android.git
synced 2024-09-19 16:13:46 +02:00
Added on-site navigation button in maps screen
This commit is contained in:
parent
2e90602ba8
commit
702e3b7583
4 changed files with 32 additions and 1 deletions
|
@ -1,5 +1,6 @@
|
|||
package be.digitalia.fosdem.fragments;
|
||||
|
||||
import android.content.ActivityNotFoundException;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
|
@ -19,6 +20,7 @@ public class MapFragment extends Fragment {
|
|||
|
||||
private static final double DESTINATION_LATITUDE = 50.812375;
|
||||
private static final double DESTINATION_LONGITUDE = 4.380734;
|
||||
private static final String LOCAL_NAVIGATION_URI = "http://nav.fosdem.org/";
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
|
@ -42,6 +44,9 @@ public class MapFragment extends Fragment {
|
|||
case R.id.directions:
|
||||
launchDirections();
|
||||
return true;
|
||||
case R.id.navigation:
|
||||
launchLocalNavigation();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -54,6 +59,17 @@ public class MapFragment extends Fragment {
|
|||
|
||||
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(uri));
|
||||
|
||||
startActivity(intent);
|
||||
try {
|
||||
startActivity(intent);
|
||||
} catch (ActivityNotFoundException ignore) {
|
||||
}
|
||||
}
|
||||
|
||||
private void launchLocalNavigation() {
|
||||
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(LOCAL_NAVIGATION_URI));
|
||||
try {
|
||||
startActivity(intent);
|
||||
} catch (ActivityNotFoundException ignore) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
9
app/src/main/res/drawable/ic_navigation_white_24dp.xml
Normal file
9
app/src/main/res/drawable/ic_navigation_white_24dp.xml
Normal file
|
@ -0,0 +1,9 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24.0"
|
||||
android:viewportHeight="24.0">
|
||||
<path
|
||||
android:fillColor="#FFFFFFFF"
|
||||
android:pathData="M12,2L4.5,20.29l0.71,0.71L12,18l6.79,3 0.71,-0.71z"/>
|
||||
</vector>
|
|
@ -7,5 +7,10 @@
|
|||
android:icon="@drawable/ic_directions_white_24dp"
|
||||
android:title="@string/directions"
|
||||
app:showAsAction="ifRoom"/>
|
||||
<item
|
||||
android:id="@+id/navigation"
|
||||
android:icon="@drawable/ic_navigation_white_24dp"
|
||||
android:title="@string/navigation"
|
||||
app:showAsAction="ifRoom"/>
|
||||
|
||||
</menu>
|
|
@ -119,6 +119,7 @@
|
|||
<!-- Others -->
|
||||
<string name="room_map">Room map</string>
|
||||
<string name="directions">Directions to ULB</string>
|
||||
<string name="navigation">On-site navigation</string>
|
||||
<string name="no_data">No data available.</string>
|
||||
<string name="about">About</string>
|
||||
<string name="about_text">Programmed by <a href="http://www.digitalia.be/">Christophe Beyls</a>.
|
||||
|
|
Loading…
Reference in a new issue