Skip to content

Commit

Permalink
Revert removal of instances and move camera to member's position on m…
Browse files Browse the repository at this point in the history
…ap load
  • Loading branch information
timothydillan committed Feb 24, 2021
1 parent 5f26b7e commit 5476f60
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 13 deletions.
4 changes: 4 additions & 0 deletions app/src/main/java/com/timothydillan/circles/MapsFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,10 @@ public void onCircleReady(ArrayList<User> members) {
locationUtil.initializeMarkers(members);
userUtil.registerListener(MapsFragment.this);
setUpCircleSpinner();
// When the markers have been initialized,
LatLng memberPosition = new LatLng(UserUtil.getInstance().getCurrentUser().getLatitude(), UserUtil.getInstance().getCurrentUser().getLongitude());
// move the map to the position of the current member's marker.
mMap.animateCamera(CameraUpdateFactory.newLatLngZoom(memberPosition, 16.0f));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -254,9 +254,6 @@ private void startActivity(Item itemList, int position) {
}

private void signOut() {
// We need to unregister the listener before we remove the CircleUtil instance.
CircleUtil.getInstance().unregisterListener(this);

// Stop all services.
requireContext().stopService(new Intent(requireContext(), LocationService.class));
requireContext().stopService(new Intent(requireContext(), CrashService.class));
Expand All @@ -269,17 +266,12 @@ private void signOut() {
userUtil.reset();
circleUtil.reset();
LocationUtil.resetMap();
CircleUtil.removeInstance();
UserUtil.removeInstance();

// Redirect back to Sign up activity.
goToSignUpActivity();
}

private void deleteAccount() {
// We need to unregister the listener before we remove the CircleUtil instance.
CircleUtil.getInstance().unregisterListener(this);

// Stop all services.
requireContext().stopService(new Intent(requireContext(), LocationService.class));
requireContext().stopService(new Intent(requireContext(), CrashService.class));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,6 @@ public void initializeMarkers(ArrayList<User> circleMembers) {
membersLocation.put(circleMember, memberMarker);
}

// We'll also animate/move the camera to the current user with a zoom of 15
map.animateCamera(CameraUpdateFactory.newLatLngZoom(membersLocation.get(UserUtil.getInstance().getCurrentUser()).getPosition(), 15.0f));

// after we're done with adding each marker, we should try and update the avatar of the user to their profile picture.
updateAvatars();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -655,9 +655,7 @@ public void deleteAccount() {
HealthUtil.removeInstance();
LocationUtil.resetMap();
CircleUtil.getInstance().reset();
CircleUtil.removeInstance();
FirebaseUtil.deleteAccount();
instance = null;
}

public interface UsersListener {
Expand Down

0 comments on commit 5476f60

Please sign in to comment.