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.ViewGroup;
|
||||||
import android.view.animation.Animation;
|
import android.view.animation.Animation;
|
||||||
import android.view.animation.AnimationUtils;
|
import android.view.animation.AnimationUtils;
|
||||||
|
import android.widget.Button;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
import android.widget.ProgressBar;
|
import android.widget.ProgressBar;
|
||||||
|
|
@ -136,6 +137,12 @@ public class NearbyTestLayersFragment extends CommonsDaggerSupportFragment imple
|
||||||
@BindView(R.id.icon)
|
@BindView(R.id.icon)
|
||||||
ImageView icon;
|
ImageView icon;
|
||||||
|
|
||||||
|
@BindView(R.id.search_this_area_button)
|
||||||
|
Button searchThisAreaButton;
|
||||||
|
|
||||||
|
@BindView(R.id.search_this_area_button_progress_bar)
|
||||||
|
ProgressBar searchThisAreaButtonProgressBar;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
LocationServiceManager locationManager;
|
LocationServiceManager locationManager;
|
||||||
|
|
||||||
|
|
@ -337,6 +344,11 @@ public class NearbyTestLayersFragment extends CommonsDaggerSupportFragment imple
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addOnCameraMoveListener(MapboxMap.OnCameraMoveListener onCameraMoveListener) {
|
||||||
|
mapFragment.getMapboxMap().addOnCameraMoveListener(onCameraMoveListener);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setListFragmentExpanded() {
|
public void setListFragmentExpanded() {
|
||||||
|
|
||||||
|
|
@ -448,17 +460,25 @@ public class NearbyTestLayersFragment extends CommonsDaggerSupportFragment imple
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addSearchThisAreaButtonAction() {
|
public void addSearchThisAreaButtonAction() {
|
||||||
|
searchThisAreaButton.setOnClickListener(nearbyParentFragmentPresenter.onSearchThisAreaClicked());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setSearchThisAreaButtonVisibility(boolean isVisible) {
|
public void setSearchThisAreaButtonVisibility(boolean isVisible) {
|
||||||
|
if (isVisible) {
|
||||||
|
searchThisAreaButton.setVisibility(View.VISIBLE);
|
||||||
|
} else {
|
||||||
|
searchThisAreaButton.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setSearchThisAreaProgressVisibility(boolean isVisible) {
|
public void setSearchThisAreaProgressVisibility(boolean isVisible) {
|
||||||
|
if (isVisible) {
|
||||||
|
searchThisAreaButtonProgressBar.setVisibility(View.VISIBLE);
|
||||||
|
} else {
|
||||||
|
searchThisAreaButtonProgressBar.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -461,7 +461,8 @@ public class SupportMapFragment extends CommonsDaggerSupportFragment
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public LatLng getCameraTarget() {
|
public LatLng getCameraTarget() {
|
||||||
return null;
|
return LocationUtils
|
||||||
|
.mapBoxLatLngToCommonsLatLng(mapboxMap.getCameraPosition().target);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -20,9 +20,7 @@ public interface NearbyParentFragmentContract {
|
||||||
void listOptionMenuItemClicked();
|
void listOptionMenuItemClicked();
|
||||||
void populatePlaces(LatLng curlatLng, LatLng searchLatLng);
|
void populatePlaces(LatLng curlatLng, LatLng searchLatLng);
|
||||||
boolean isBottomSheetExpanded();
|
boolean isBottomSheetExpanded();
|
||||||
void addSearchThisAreaButtonAction();
|
|
||||||
void setSearchThisAreaButtonVisibility(boolean isVisible);
|
|
||||||
void setSearchThisAreaProgressVisibility(boolean isVisible);
|
|
||||||
void checkPermissionsAndPerformAction(Runnable runnable);
|
void checkPermissionsAndPerformAction(Runnable runnable);
|
||||||
void resumeFragment();
|
void resumeFragment();
|
||||||
void displayLoginSkippedWarning();
|
void displayLoginSkippedWarning();
|
||||||
|
|
@ -33,6 +31,11 @@ public interface NearbyParentFragmentContract {
|
||||||
void initViewPositions();
|
void initViewPositions();
|
||||||
void hideBottomSheet();
|
void hideBottomSheet();
|
||||||
void displayBottomSheetWithInfo(Marker marker);
|
void displayBottomSheetWithInfo(Marker marker);
|
||||||
|
|
||||||
|
void addOnCameraMoveListener(MapboxMap.OnCameraMoveListener onCameraMoveListener);
|
||||||
|
void addSearchThisAreaButtonAction();
|
||||||
|
void setSearchThisAreaButtonVisibility(boolean isVisible);
|
||||||
|
void setSearchThisAreaProgressVisibility(boolean isVisible);
|
||||||
}
|
}
|
||||||
|
|
||||||
interface UserActions {
|
interface UserActions {
|
||||||
|
|
@ -43,6 +46,8 @@ public interface NearbyParentFragmentContract {
|
||||||
void lockNearby(boolean isNearbyLocked);
|
void lockNearby(boolean isNearbyLocked);
|
||||||
MapboxMap.OnCameraMoveListener onCameraMove(MapboxMap mapboxMap);
|
MapboxMap.OnCameraMoveListener onCameraMove(MapboxMap mapboxMap);
|
||||||
void setActionListeners(JsonKvStore applicationKvStore);
|
void setActionListeners(JsonKvStore applicationKvStore);
|
||||||
|
|
||||||
|
MapboxMap.OnCameraMoveListener onCameraMove(LatLng cameraTarget);
|
||||||
}
|
}
|
||||||
|
|
||||||
interface ViewsAreReadyCallback {
|
interface ViewsAreReadyCallback {
|
||||||
|
|
|
||||||
|
|
@ -365,6 +365,11 @@ public class NearbyParentFragment extends CommonsDaggerSupportFragment
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addOnCameraMoveListener(MapboxMap.OnCameraMoveListener onCameraMoveListener) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isNetworkConnectionEstablished() {
|
public boolean isNetworkConnectionEstablished() {
|
||||||
return NetworkUtils.isInternetConnectionEstablished(getActivity());
|
return NetworkUtils.isInternetConnectionEstablished(getActivity());
|
||||||
|
|
|
||||||
|
|
@ -118,6 +118,8 @@ public class NearbyParentFragmentPresenter
|
||||||
//nearbyParentFragmentView.addNetworkBroadcastReceiver();
|
//nearbyParentFragmentView.addNetworkBroadcastReceiver();
|
||||||
//nearbyMapFragmentView.setupMapView(null);
|
//nearbyMapFragmentView.setupMapView(null);
|
||||||
//nearbyOperationsInitialized();
|
//nearbyOperationsInitialized();
|
||||||
|
this.nearbyParentFragmentView.addSearchThisAreaButtonAction();
|
||||||
|
this.nearbyParentFragmentView.addOnCameraMoveListener(onCameraMove(getCameraTarget()));
|
||||||
initializeMapOperations();
|
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() {
|
public void markerUnselected() {
|
||||||
nearbyParentFragmentView.hideBottomSheet();
|
nearbyParentFragmentView.hideBottomSheet();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue