adjust code to master

This commit is contained in:
Mieszko Wrzeszczyński 2018-11-28 09:37:38 +01:00
commit d7bc56f5f9
6 changed files with 8 additions and 153 deletions

View File

@ -151,12 +151,10 @@ public class LoginActivity extends AppCompatActivity {
}
private void loginProcess(String email, String password) {
ValidateUser user = new ValidateUser(email, password);
LdapUser fuser = new LdapUser(email,password,"tutor","tutor","mieszko","nocny","szmsdsdsdsdare@wmi.pl");
// disposable.add(ldapService.validate(user)
disposable.add(ldapService.fakeValidate(fuser)
disposable.add(ldapService.validate(user)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(this::handleResponse, this::handleError));

View File

@ -119,8 +119,10 @@ public class MapActivity extends BaseActivity
mHandler.postDelayed(mStatusChecker, mInterval);
}
};
selectLocationButton = findViewById(R.id.select_location_button);
removeLocationButton = findViewById(R.id.remove_location_button);
Mapbox.getInstance(this, getString(R.string.access_token));
@ -161,29 +163,8 @@ public class MapActivity extends BaseActivity
return true;
});
setToggleMapBoundsArea();
if (isTutor) {
setOnMapLongClickListener();
}
}
private void setToggleMapBoundsArea() {
mapUtils.setMapBoundsArea(getApplicationContext(), mapboxMap, mapView, true);
FloatingActionButton toggleBoundsAreaFab = findViewById(R.id.fab_toggle_bound_area);
toggleBoundsAreaFab.setOnClickListener(view -> {
if (toggleBoundsAreaFab.getTitle().equals("Bounds OFF")) {
toggleBoundsAreaFab.setTitle("Bounds ON");
mapUtils.setMapBoundsArea(getApplicationContext(), mapboxMap, mapView, false);
} else {
toggleBoundsAreaFab.setTitle("Bounds OFF");
mapUtils.setMapBoundsArea(getApplicationContext(), mapboxMap, mapView, true);
}
});
}
private void updateUserHashMap(String userId, Long markerId) {
disposable.add(userService.getUserById(userId)
@ -249,52 +230,6 @@ public class MapActivity extends BaseActivity
}
/* private void setOnMapLongClickListener() {
mapboxMap.addOnMapLongClickListener((LatLng latLng) -> {
selectLocationButton.setVisibility(View.VISIBLE);
removeLocationButton.setVisibility(View.GONE);
if (tmpLocalMarker == null) {
String sharingLevel = SharingLevel.MANUAL.toString();
Icon defaultIcon = getMapIcon(sharingLevel, myId);
MarkerOptions markerOptions = new MarkerOptions()
.setIcon(defaultIcon)
.position(latLng);
tmpLocalMarker = mapboxMap.addMarker(markerOptions);
MapMarker marker = new MapMarker(tmpLocalMarker, markerOptions, defaultIcon, sharingLevel);
markerHash.put(myId, marker);
updateUserHashMap(myId, marker.getMarker().getId());
} else {
ValueAnimator markerAnimator = ObjectAnimator.ofObject(tmpLocalMarker, "position",
new mapUtils.LatLngEvaluator(), tmpLocalMarker.getPosition(), latLng);
markerAnimator.setDuration(2000);
markerAnimator.start();
}
selectLocationButton.setOnClickListener((View view) -> {
if (tmpLocalMarker != null) {
try {
manualLocationUtils.showLocationDialog("Name the location", latLng);
startBackgroundLocalizationTask();
} catch (IllegalArgumentException e) {
Timber.e(String.valueOf(e));
}
selectLocationButton.setVisibility(View.GONE);
mapboxMap.removeMarker(tmpLocalMarker);
tmpLocalMarker = null;
}
});
});
}*/
private void setOnMapLongClickListener() {
mapboxMap.addOnMapLongClickListener((LatLng latLng) -> {

View File

@ -22,7 +22,7 @@ public class ApiClient {
private static Retrofit retrofit = null;
private static int REQUEST_TIMEOUT = 60;
private static OkHttpClient okHttpClient;
private static final String BASE_URL = "https://s416084.projektstudencki.pl/develop/";
private static final String BASE_URL = "https://s416084.projektstudencki.pl/master/";
public static Retrofit getClient(Context context) {

View File

@ -26,8 +26,8 @@ public class mapUtils {
// Boundires
private static final LatLngBounds WMI_BOUNDS = new LatLngBounds.Builder()
.include(new LatLng(52.467886048833094, 16.92912980245876))
.include(new LatLng(52.46548540224137, 16.925255680881094))
.include(new LatLng(52.46588041661952, 16.92543089389801))
.include(new LatLng(52.467824943492374, 16.928574442863464))
.build();
// Map Bounds Area
@ -38,45 +38,12 @@ public class mapUtils {
mapboxMap.setLatLngBoundsForCameraTarget(WMI_BOUNDS);
makeNewCamera(mapboxMap, 52.466799, 16.927002, 17, 0, 0, 4000);
mapboxMap.setMinZoomPreference(16); // TODO export to map config
drawBoundsArea(context, mapboxMap, mapView, check);
} else {
mapboxMap.setLatLngBoundsForCameraTarget(null);
mapboxMap.setMinZoomPreference(2);
drawBoundsArea(context, mapboxMap, mapView, check);
}
}
// TODO: remove b4 release
private static final PolygonOptions boundsArea = new PolygonOptions()
.add(WMI_BOUNDS.getNorthWest())
.add(WMI_BOUNDS.getNorthEast())
.add(WMI_BOUNDS.getSouthEast())
.add(WMI_BOUNDS.getSouthWest())
.alpha(0.1f)
.fillColor(Color.YELLOW);
// For adding and removing
private static Polygon polygon;
private static View crosshair;
private static void drawBoundsArea(Context context, MapboxMap mapboxMap, MapView mapView, Boolean check) {
if (check) {
// Visualise bounds area
// showBoundsArea
polygon = mapboxMap.addPolygon(boundsArea);
// showCrosshair
crosshair = new View(context);
crosshair.setLayoutParams(new FrameLayout.LayoutParams(15, 15, Gravity.CENTER));
crosshair.setBackgroundColor(Color.GREEN);
mapView.addView(crosshair);
} else {
mapboxMap.removePolygon(polygon);
mapView.removeView(crosshair);
}
}
public static void makeNewCamera(MapboxMap mapboxMap, double lat, double lon, int zoomParam, int bearingParam, int tiltParam, int duration) {
CameraPosition position = new CameraPosition.Builder()
.target(new LatLng(lat, lon)) // Sets the new camera position

View File

@ -58,47 +58,6 @@
app:fab_colorNormal="@color/mapboxGray"
app:pressedTranslationZ="12dp" />
<com.getbase.floatingactionbutton.FloatingActionsMenu
android:id="@+id/multiple_actions_parent_fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end|bottom"
android:layout_margin="16dp"
fab:fab_addButtonColorNormal="@color/mapboxRed"
fab:fab_addButtonColorPressed="@color/mapboxWhite"
fab:fab_addButtonPlusIconColor="@color/mapboxWhite"
fab:fab_labelStyle="@style/menu_labels_style"
tools:layout_editor_absoluteX="200dp"
tools:layout_editor_absoluteY="255dp">
<com.getbase.floatingactionbutton.FloatingActionButton
android:id="@+id/fab_toggle_hotels"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
fab:fab_colorNormal="@color/mapboxBlue"
fab:fab_colorPressed="@color/mapboxWhite"
fab:fab_size="mini"
fab:fab_title="@string/fab_title_hotels" />
<com.getbase.floatingactionbutton.FloatingActionButton
android:id="@+id/fab_toggle_parks"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
fab:fab_colorNormal="@color/mapboxGreen"
fab:fab_colorPressed="@color/mapboxWhite"
fab:fab_size="mini"
fab:fab_title="@string/fab_title_parks" />
<com.getbase.floatingactionbutton.FloatingActionButton
android:id="@+id/fab_toggle_bound_area"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
fab:fab_colorNormal="@color/mapboxRed"
fab:fab_colorPressed="@color/mapboxWhite"
fab:fab_size="mini"
fab:fab_title="@string/fab_title_bound_area" />
</com.getbase.floatingactionbutton.FloatingActionsMenu>
<Button
android:id="@+id/select_location_button"

View File

@ -4,10 +4,6 @@
android:layout_height="match_parent">
<PreferenceCategory android:title="@string/settings_category_general">
<SwitchPreference
android:defaultValue="true"
android:key="@string/key_notifications_enabled"
android:title="@string/title_notification" />
<ListPreference
android:defaultValue="0"