mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-27 12:53:55 +01:00
Search this area buttons are added but button function does not work and button visibility is problematic
This commit is contained in:
parent
20941585ff
commit
6011cc7dac
5 changed files with 55 additions and 7 deletions
|
|
@ -14,6 +14,7 @@ import android.view.View;
|
|||
import android.view.ViewGroup;
|
||||
import android.view.animation.Animation;
|
||||
import android.view.animation.AnimationUtils;
|
||||
import android.widget.Button;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.ProgressBar;
|
||||
|
|
@ -136,6 +137,12 @@ public class NearbyTestLayersFragment extends CommonsDaggerSupportFragment imple
|
|||
@BindView(R.id.icon)
|
||||
ImageView icon;
|
||||
|
||||
@BindView(R.id.search_this_area_button)
|
||||
Button searchThisAreaButton;
|
||||
|
||||
@BindView(R.id.search_this_area_button_progress_bar)
|
||||
ProgressBar searchThisAreaButtonProgressBar;
|
||||
|
||||
@Inject
|
||||
LocationServiceManager locationManager;
|
||||
|
||||
|
|
@ -337,6 +344,11 @@ public class NearbyTestLayersFragment extends CommonsDaggerSupportFragment imple
|
|||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addOnCameraMoveListener(MapboxMap.OnCameraMoveListener onCameraMoveListener) {
|
||||
mapFragment.getMapboxMap().addOnCameraMoveListener(onCameraMoveListener);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setListFragmentExpanded() {
|
||||
|
||||
|
|
@ -448,17 +460,25 @@ public class NearbyTestLayersFragment extends CommonsDaggerSupportFragment imple
|
|||
|
||||
@Override
|
||||
public void addSearchThisAreaButtonAction() {
|
||||
|
||||
searchThisAreaButton.setOnClickListener(nearbyParentFragmentPresenter.onSearchThisAreaClicked());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSearchThisAreaButtonVisibility(boolean isVisible) {
|
||||
|
||||
if (isVisible) {
|
||||
searchThisAreaButton.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
searchThisAreaButton.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSearchThisAreaProgressVisibility(boolean isVisible) {
|
||||
|
||||
if (isVisible) {
|
||||
searchThisAreaButtonProgressBar.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
searchThisAreaButtonProgressBar.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -461,7 +461,8 @@ public class SupportMapFragment extends CommonsDaggerSupportFragment
|
|||
|
||||
@Override
|
||||
public LatLng getCameraTarget() {
|
||||
return null;
|
||||
return LocationUtils
|
||||
.mapBoxLatLngToCommonsLatLng(mapboxMap.getCameraPosition().target);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -20,9 +20,7 @@ public interface NearbyParentFragmentContract {
|
|||
void listOptionMenuItemClicked();
|
||||
void populatePlaces(LatLng curlatLng, LatLng searchLatLng);
|
||||
boolean isBottomSheetExpanded();
|
||||
void addSearchThisAreaButtonAction();
|
||||
void setSearchThisAreaButtonVisibility(boolean isVisible);
|
||||
void setSearchThisAreaProgressVisibility(boolean isVisible);
|
||||
|
||||
void checkPermissionsAndPerformAction(Runnable runnable);
|
||||
void resumeFragment();
|
||||
void displayLoginSkippedWarning();
|
||||
|
|
@ -33,6 +31,11 @@ public interface NearbyParentFragmentContract {
|
|||
void initViewPositions();
|
||||
void hideBottomSheet();
|
||||
void displayBottomSheetWithInfo(Marker marker);
|
||||
|
||||
void addOnCameraMoveListener(MapboxMap.OnCameraMoveListener onCameraMoveListener);
|
||||
void addSearchThisAreaButtonAction();
|
||||
void setSearchThisAreaButtonVisibility(boolean isVisible);
|
||||
void setSearchThisAreaProgressVisibility(boolean isVisible);
|
||||
}
|
||||
|
||||
interface UserActions {
|
||||
|
|
@ -43,6 +46,8 @@ public interface NearbyParentFragmentContract {
|
|||
void lockNearby(boolean isNearbyLocked);
|
||||
MapboxMap.OnCameraMoveListener onCameraMove(MapboxMap mapboxMap);
|
||||
void setActionListeners(JsonKvStore applicationKvStore);
|
||||
|
||||
MapboxMap.OnCameraMoveListener onCameraMove(LatLng cameraTarget);
|
||||
}
|
||||
|
||||
interface ViewsAreReadyCallback {
|
||||
|
|
|
|||
|
|
@ -365,6 +365,11 @@ public class NearbyParentFragment extends CommonsDaggerSupportFragment
|
|||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addOnCameraMoveListener(MapboxMap.OnCameraMoveListener onCameraMoveListener) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isNetworkConnectionEstablished() {
|
||||
return NetworkUtils.isInternetConnectionEstablished(getActivity());
|
||||
|
|
|
|||
|
|
@ -118,6 +118,8 @@ public class NearbyParentFragmentPresenter
|
|||
//nearbyParentFragmentView.addNetworkBroadcastReceiver();
|
||||
//nearbyMapFragmentView.setupMapView(null);
|
||||
//nearbyOperationsInitialized();
|
||||
this.nearbyParentFragmentView.addSearchThisAreaButtonAction();
|
||||
this.nearbyParentFragmentView.addOnCameraMoveListener(onCameraMove(getCameraTarget()));
|
||||
initializeMapOperations();
|
||||
}
|
||||
|
||||
|
|
@ -175,6 +177,21 @@ public class NearbyParentFragmentPresenter
|
|||
|
||||
}
|
||||
|
||||
public MapboxMap.OnCameraMoveListener onCameraMove(LatLng cameraTarget) {
|
||||
|
||||
return new MapboxMap.OnCameraMoveListener() {
|
||||
@Override
|
||||
public void onCameraMove() {
|
||||
// If our nearby markers are calculated at least once
|
||||
if (NearbyController.currentLocation != null) {
|
||||
if (nearbyParentFragmentView.isNetworkConnectionEstablished()) {
|
||||
nearbyParentFragmentView.setSearchThisAreaButtonVisibility(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public void markerUnselected() {
|
||||
nearbyParentFragmentView.hideBottomSheet();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue