Skip to content

Commit

Permalink
load user location after user logs in
Browse files Browse the repository at this point in the history
  • Loading branch information
bennsimon committed Jul 5, 2021
1 parent e6a34c5 commit 0369455
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 22 deletions.
2 changes: 1 addition & 1 deletion opensrp-eusm/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ dependencies {
}

// implementation(project(':opensrp-tasking')) {
implementation('org.smartregister:opensrp-client-tasking:0.0.3-v14-EUSM-SNAPSHOT') {
implementation('org.smartregister:opensrp-client-tasking:0.0.3-v17-EUSM-SNAPSHOT') {
transitive = true
exclude group: 'org.smartregister', module: 'opensrp-client-core'
exclude group: 'com.ibm.fhir', module: 'fhir-model'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package org.smartregister.eusm.activity;

import android.content.Intent;
import android.graphics.Color;
import android.location.Location;
import android.os.Bundle;
import android.view.Gravity;
Expand All @@ -22,8 +21,6 @@
import com.mapbox.geojson.Feature;
import com.mapbox.geojson.FeatureCollection;
import com.mapbox.mapboxsdk.geometry.LatLng;
import com.mapbox.mapboxsdk.location.LocationComponent;
import com.mapbox.mapboxsdk.location.LocationComponentOptions;
import com.mapbox.mapboxsdk.maps.MapboxMap;

import org.apache.commons.lang3.StringUtils;
Expand Down Expand Up @@ -75,15 +72,7 @@ public void onMapReady(@NonNull MapboxMap mapboxMap) {

@Override
public void positionMyLocationAndLayerSwitcher() {
// if (myLocationButton != null) {
// FrameLayout.LayoutParams myLocationButtonParams = (FrameLayout.LayoutParams) myLocationButton.getLayoutParams();
// myLocationButtonParams.gravity = Gravity.TOP | Gravity.END;
// myLocationButtonParams.topMargin = 30;
// myLocationButtonParams.rightMargin = 35;
// myLocationButtonParams.height = 150;
// myLocationButtonParams.width = 150;
// myLocationButton.setLayoutParams(myLocationButtonParams);
// }
// Do nothing
}

@Override
Expand Down Expand Up @@ -134,8 +123,7 @@ public void openCardView(CardDetails cardDetails) {
imgServicePointType.setColorFilter(ContextCompat.getColor(getApplicationContext(), taskStatusColor));
}

// imgServicePointType.setAlpha(0.9F);

// imgServicePointType.setAlpha(0.9F);
Button viewInventoryView = eusmCardView.findViewById(R.id.btn_view_inventory);
viewInventoryView.setTag(R.id.card_detail, eusmCardDetail);
viewInventoryView.setOnClickListener(this);
Expand Down Expand Up @@ -210,4 +198,12 @@ public Location getUserCurrentLocation() {
return null;
}
}

@Override
public void requestUserLocation() {
kujakuMapView.setWarmGps(true, getString(R.string.location_service_disabled), getString(R.string.location_services_disabled_spray), () -> {
myLocationButton.performClick();
});
hasRequestedLocation = true;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,16 @@
import org.smartregister.tasking.contract.TaskingMapActivityContract;
import org.smartregister.tasking.layer.DigitalGlobeLayer;
import org.smartregister.tasking.layer.MapBoxLayer;
import org.smartregister.tasking.model.BaseLayerSwitchModel;
import org.smartregister.tasking.model.BaseTaskDetails;
import org.smartregister.tasking.model.CardDetails;
import org.smartregister.tasking.model.MapLayerSwitchModel;
import org.smartregister.tasking.model.FamilyCardDetails;
import org.smartregister.tasking.model.IRSVerificationCardDetails;
import org.smartregister.tasking.model.MosquitoHarvestCardDetails;
import org.smartregister.tasking.model.SprayCardDetails;
import org.smartregister.tasking.model.TaskDetails;
import org.smartregister.tasking.model.TaskFilterParams;
import org.smartregister.tasking.presenter.TaskingMapPresenter;
import org.smartregister.tasking.repository.TaskingMappingHelper;
import org.smartregister.tasking.util.ActivityConfiguration;
import org.smartregister.tasking.util.GeoJsonUtils;
Expand Down Expand Up @@ -525,17 +530,53 @@ public Pair<Double, Double> getMinMaxZoomMapDownloadPair() {
}

@Override
public List<MapLayerSwitchModel> getBaseLayers() {
public List<BaseLayerSwitchModel> getBaseLayers() {
return Arrays.asList(
MapLayerSwitchModel.builder().baseLayer(new DigitalGlobeLayer()).build(),
MapLayerSwitchModel.builder().baseLayer(new MapBoxLayer()).isDefault(true).build(),
MapLayerSwitchModel.builder().baseLayer(new StreetsBaseLayer(EusmApplication.getInstance().getBaseContext())).build(),
MapLayerSwitchModel.builder().baseLayer(new SatelliteStreetsLayer(EusmApplication.getInstance().getBaseContext())).build()
BaseLayerSwitchModel.builder().baseLayer(new DigitalGlobeLayer()).build(),
BaseLayerSwitchModel.builder().baseLayer(new MapBoxLayer()).isDefault(true).build(),
BaseLayerSwitchModel.builder().baseLayer(new StreetsBaseLayer(EusmApplication.getInstance().getBaseContext())).build(),
BaseLayerSwitchModel.builder().baseLayer(new SatelliteStreetsLayer(EusmApplication.getInstance().getBaseContext())).build()
);
}

@Override
public boolean showBaseLayerSwitcherPlugin() {
return true;
}

@Override
public void openStructureProfile(CommonPersonObjectClient commonPersonObjectClient, TaskingMapActivity taskingMapActivity, TaskingMapPresenter taskingMapPresenter) {
// Do nothing
}

@Override
public void openCardView(CardDetails cardDetails, TaskingMapActivity taskingMapActivity) {
// Do nothing
}

@Override
public void populateFamilyCard(FamilyCardDetails familyCardDetails, Activity activity) {
// Do nothing
}

@Override
public void populateAndOpenIRSVerificationCard(IRSVerificationCardDetails irsVerificationCardDetails, Activity activity) {
// Do nothing

}

@Override
public void populateAndOpenMosquitoHarvestCard(MosquitoHarvestCardDetails mosquitoHarvestCardDetails, Activity activity) {
// Do nothing
}

@Override
public void populateSprayCardTextViews(SprayCardDetails sprayCardDetails, Activity activity) {
// Do nothing
}

@Override
public String getStructureNamesSelect(String s) {
return null;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public void saveRecordGps(JSONObject form,
Location location = structureRepository.getLocationById(structureDetail.getStructureId());
location.setSyncStatus(BaseRepository.TYPE_Created);

JsonArray jsonArray = new JsonArray();
JsonArray jsonArray = new JsonArray(2);
jsonArray.add(latLngPair.second);
jsonArray.add(latLngPair.first);

Expand Down

0 comments on commit 0369455

Please sign in to comment.