Updates to previous commint
This commit is contained in:
parent
c8718f8a42
commit
d22bec3f6e
1 changed files with 24 additions and 6 deletions
|
@ -59,6 +59,8 @@ public class DashFavoritesFragment extends DashBaseFragment implements OsmAndLoc
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -72,14 +74,29 @@ public class DashFavoritesFragment extends DashBaseFragment implements OsmAndLoc
|
||||||
@Override
|
@Override
|
||||||
public void onResume() {
|
public void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
getLocationProvider().addLocationListener(this);
|
if (getMyApplication().getFavorites().getFavouritePoints().size() > 0) {
|
||||||
getLocationProvider().addCompassListener(this);
|
registerListeners();
|
||||||
location = getLocationProvider().getLastKnownLocation();
|
if(!getMyApplication().getSettings().isLastKnownMapLocation()) {
|
||||||
updateLocation(location);
|
// show first time when application ran
|
||||||
|
location = getMyApplication().getLocationProvider().getFirstTimeRunDefaultLocation();
|
||||||
|
} else {
|
||||||
|
location = getLocationProvider().getLastKnownLocation();
|
||||||
|
}
|
||||||
|
updateLocation(location);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
setupFavorites();
|
setupFavorites();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void registerListeners() {
|
||||||
|
getLocationProvider().addLocationListener(this);
|
||||||
|
getLocationProvider().addCompassListener(this);
|
||||||
|
getLocationProvider().registerOrUnregisterCompassListener(true);
|
||||||
|
getLocationProvider().resumeAllUpdates();
|
||||||
|
}
|
||||||
|
|
||||||
private void setupFavorites(){
|
private void setupFavorites(){
|
||||||
View mainView = getView();
|
View mainView = getView();
|
||||||
final FavouritesDbHelper helper = getMyApplication().getFavorites();
|
final FavouritesDbHelper helper = getMyApplication().getFavorites();
|
||||||
|
@ -120,9 +137,8 @@ public class DashFavoritesFragment extends DashBaseFragment implements OsmAndLoc
|
||||||
if(location != null){
|
if(location != null){
|
||||||
direction.setVisibility(View.VISIBLE);
|
direction.setVisibility(View.VISIBLE);
|
||||||
updateArrow(point, direction);
|
updateArrow(point, direction);
|
||||||
arrows.add(direction);
|
|
||||||
}
|
}
|
||||||
|
arrows.add(direction);
|
||||||
name.setText(point.getName());
|
name.setText(point.getName());
|
||||||
icon.setImageDrawable(FavoriteImageDrawable.getOrCreate(getActivity(), point.getColor()));
|
icon.setImageDrawable(FavoriteImageDrawable.getOrCreate(getActivity(), point.getColor()));
|
||||||
LatLon lastKnownMapLocation = getMyApplication().getSettings().getLastKnownMapLocation();
|
LatLon lastKnownMapLocation = getMyApplication().getSettings().getLastKnownMapLocation();
|
||||||
|
@ -157,7 +173,9 @@ public class DashFavoritesFragment extends DashBaseFragment implements OsmAndLoc
|
||||||
if (location == null) {
|
if (location == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for(int i =0; i<arrows.size(); i++){
|
for(int i =0; i<arrows.size(); i++){
|
||||||
|
arrows.get(i).setVisibility(View.VISIBLE);
|
||||||
updateArrow(points.get(i), arrows.get(i));
|
updateArrow(points.get(i), arrows.get(i));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue