forked from commons-app/apps-android-commons
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
maskara
committed
May 12, 2017
1 parent
784b51e
commit 6118b57
Showing
6 changed files
with
120 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
83 changes: 83 additions & 0 deletions
83
app/src/main/java/fr/free/nrw/commons/nearby/NearbyMapFragment.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
package fr.free.nrw.commons.nearby; | ||
|
||
import android.app.Fragment; | ||
import android.os.Bundle; | ||
import android.view.LayoutInflater; | ||
import android.view.View; | ||
import android.view.ViewGroup; | ||
|
||
import com.mapbox.mapboxsdk.Mapbox; | ||
import com.mapbox.mapboxsdk.maps.MapView; | ||
import com.mapbox.mapboxsdk.maps.MapboxMap; | ||
import com.mapbox.mapboxsdk.maps.OnMapReadyCallback; | ||
import com.mapbox.services.android.telemetry.MapboxTelemetry; | ||
|
||
import butterknife.BindView; | ||
import butterknife.ButterKnife; | ||
import fr.free.nrw.commons.R; | ||
|
||
public class NearbyMapFragment extends android.support.v4.app.Fragment { | ||
@BindView(R.id.mapview) MapView mapView; | ||
|
||
public NearbyMapFragment() { | ||
|
||
} | ||
|
||
@Override | ||
public void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
|
||
Mapbox.getInstance(getActivity(), | ||
getString(R.string.mapbox_commons_app_token)); | ||
MapboxTelemetry.getInstance().setTelemetryEnabled(false); | ||
} | ||
|
||
@Override | ||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { | ||
View view = inflater.inflate(R.layout.fragment_nearby_map, container, false); | ||
ButterKnife.bind(this, view); | ||
|
||
mapView.onCreate(savedInstanceState); | ||
|
||
setHasOptionsMenu(false); | ||
|
||
mapView.getMapAsync(new OnMapReadyCallback() { | ||
@Override | ||
public void onMapReady(MapboxMap mapboxMap) { | ||
|
||
} | ||
}); | ||
|
||
return view; | ||
} | ||
|
||
@Override | ||
public void onStart() { | ||
mapView.onStart(); | ||
super.onStart(); | ||
} | ||
|
||
@Override | ||
public void onPause() { | ||
mapView.onPause(); | ||
super.onPause(); | ||
} | ||
|
||
@Override | ||
public void onResume() { | ||
mapView.onResume(); | ||
super.onResume(); | ||
} | ||
|
||
@Override | ||
public void onStop() { | ||
mapView.onStop(); | ||
super.onStop(); | ||
} | ||
|
||
@Override | ||
public void onDestroyView() { | ||
mapView.onDestroy(); | ||
super.onDestroyView(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:mapbox="http://schemas.android.com/tools" | ||
android:orientation="vertical" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent"> | ||
|
||
<com.mapbox.mapboxsdk.maps.MapView | ||
android:id="@+id/mapview" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
mapbox:mapbox_cameraZoom="11" | ||
mapbox:mapbox_cameraTargetLat="50.0755" | ||
mapbox:mapbox_cameraTargetLng="14.4378" | ||
mapbox:mapbox_styleUrl="@string/style_mapbox_streets" /> | ||
</LinearLayout> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters