Fix duty hours

This commit is contained in:
Mieszko Wrzeszczyński 2018-12-16 22:45:44 +01:00
parent e7a2ecf86a
commit 9d82261be9
4 changed files with 8 additions and 23 deletions

View File

@ -23,6 +23,7 @@ public class StartupActivity extends AppCompatActivity {
if (PrefUtils.isLoggedIn(getApplicationContext())){ if (PrefUtils.isLoggedIn(getApplicationContext())){
Intent startupIntent = new Intent(this, MapActivity.class); Intent startupIntent = new Intent(this, MapActivity.class);
PrefUtils.storeLocale(getApplicationContext(),PrefUtils.getLocale(getApplicationContext()));
startupIntent.putExtra(currentLang, PrefUtils.getLocale(getApplicationContext())); startupIntent.putExtra(currentLang, PrefUtils.getLocale(getApplicationContext()));
startupIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP); startupIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(startupIntent); startActivity(startupIntent);

View File

@ -95,7 +95,7 @@ public class DutyHourViewModel {
} }
public String getSummary() { public String getSummary() {
return this.getDay() + " " + this.getStart() + " " + this.getEnd(); return this.getDay() + ": " + this.getStart() + " - " + this.getEnd();
} }

View File

@ -1,25 +1,18 @@
package com.uam.wmi.findmytutor.utils; package com.uam.wmi.findmytutor.utils;
import android.support.annotation.NonNull;
import com.google.gson.GsonBuilder;
import com.mapbox.geojson.BoundingBox;
import com.mapbox.geojson.Feature; import com.mapbox.geojson.Feature;
import com.mapbox.geojson.FeatureCollection; import com.mapbox.geojson.FeatureCollection;
import com.mapbox.geojson.Geometry;
import com.mapbox.geojson.Point; import com.mapbox.geojson.Point;
import com.mapbox.geojson.Polygon; import com.mapbox.geojson.Polygon;
import com.mapbox.geojson.gson.BoundingBoxDeserializer; import com.mapbox.turf.TurfClassification;
import com.mapbox.geojson.gson.GeoJsonAdapterFactory;
import com.mapbox.geojson.gson.GeometryDeserializer;
import com.mapbox.geojson.gson.PointDeserializer;
import com.mapbox.turf.TurfJoins; import com.mapbox.turf.TurfJoins;
import com.mapbox.turf.TurfMeasurement;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Objects; import java.util.Objects;
; ;import static com.mapbox.geojson.FeatureCollection.fromJson;
public class ApproximatedLocalization { public class ApproximatedLocalization {
private FeatureCollection buildingSchema = null; private FeatureCollection buildingSchema = null;
@ -28,17 +21,6 @@ public class ApproximatedLocalization {
buildingSchema = fromJson(buildingObject); buildingSchema = fromJson(buildingObject);
} }
private FeatureCollection fromJson(@NonNull String json) {
GsonBuilder gson = new GsonBuilder();
gson.registerTypeAdapterFactory(GeoJsonAdapterFactory.create());
gson.registerTypeAdapter(Point.class, new PointDeserializer());
gson.registerTypeAdapter(Geometry.class, new GeometryDeserializer());
gson.registerTypeAdapter(BoundingBox.class, new BoundingBoxDeserializer());
return gson.create().fromJson(json, FeatureCollection.class);
}
public String getNameOfBuildingPart(Point point) { public String getNameOfBuildingPart(Point point) {
for (Feature feature : Objects.requireNonNull(buildingSchema.features())) { for (Feature feature : Objects.requireNonNull(buildingSchema.features())) {
@ -56,7 +38,9 @@ public class ApproximatedLocalization {
for (Feature feature : Objects.requireNonNull(buildingSchema.features())) { for (Feature feature : Objects.requireNonNull(buildingSchema.features())) {
String partName = feature.getStringProperty("name"); String partName = feature.getStringProperty("name");
if (buildingPart != null && buildingPart.equals(partName)) { if (buildingPart != null && buildingPart.equals(partName)) {
Double longitude = feature.getNumberProperty("longitude").doubleValue(); Double longitude = feature.getNumberProperty("longitude").doubleValue();
Double latitude = feature.getNumberProperty("latitude").doubleValue(); Double latitude = feature.getNumberProperty("latitude").doubleValue();

View File

@ -280,7 +280,7 @@
<string name="info_icon_sharing_tab_p3_level_exact"><b>exact</b> - localization displayed on a map, based on GPS</string> <string name="info_icon_sharing_tab_p3_level_exact"><b>exact</b> - localization displayed on a map, based on GPS</string>
<string name="info_icon_sharing_tab_p3_level_approximate"><b>approximated</b> - approximated localization based on GPS</string> <string name="info_icon_sharing_tab_p3_level_approximate"><b>approximated</b> - approximated localization based on GPS</string>
<string name="info_icon_sharing_tab_p3_level_manual"><b>manual</b> - sharing from manually picked point</string> <string name="info_icon_sharing_tab_p3_level_manual"><b>manual</b> - sharing from manually picked point</string>
<string name="info_icon_sharing_tab_p3_level_presence"><b>presence only</ b> - sharing only information whether you are present on the faculty or not, without sharing your localization</string> <string name="info_icon_sharing_tab_p3_level_presence"><b>presence only</b> - sharing only information whether you are present on the faculty or not, without sharing your localization</string>
<string name="info_icon_sharing_tab_p4">Each level, except from manual, will be automatically turned on when entering, and turn off when leaving the faculty. You only need to make sure that sharing is on, and the localization will be shared only when on the faculty.</string> <string name="info_icon_sharing_tab_p4">Each level, except from manual, will be automatically turned on when entering, and turn off when leaving the faculty. You only need to make sure that sharing is on, and the localization will be shared only when on the faculty.</string>
<string name="info_icon_sharing_tab_p5">Sharing can be turned off at any time with the switch.</string> <string name="info_icon_sharing_tab_p5">Sharing can be turned off at any time with the switch.</string>
<string name="info_icon_sharing_tab_p6">Additionally, you can add descriptive status to your localization (visible for users after clicking on a marker).</string> <string name="info_icon_sharing_tab_p6">Additionally, you can add descriptive status to your localization (visible for users after clicking on a marker).</string>