mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-11-05 09:13:55 +01:00
Compare commits
No commits in common. "a6b0ecc0b210cb11f0dc40b41acc23d8ff0785c0" and "09638b0c9ba2816c79bb7ecaf5e294931b85b7bf" have entirely different histories.
a6b0ecc0b2
...
09638b0c9b
3 changed files with 6 additions and 21 deletions
|
|
@ -18,17 +18,6 @@ public class ViewPagerAdapter extends FragmentPagerAdapter {
|
||||||
super(manager);
|
super(manager);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructs a ViewPagerAdapter with a specified Fragment Manager and Fragment resume behavior.
|
|
||||||
*
|
|
||||||
* @param manager The FragmentManager
|
|
||||||
* @param behavior An integer which represents the behavior of non visible fragments. See
|
|
||||||
* FragmentPagerAdapter.java for options.
|
|
||||||
*/
|
|
||||||
public ViewPagerAdapter(FragmentManager manager, int behavior) {
|
|
||||||
super(manager, behavior);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This method returns the fragment of the viewpager at a particular position
|
* This method returns the fragment of the viewpager at a particular position
|
||||||
* @param position
|
* @param position
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,6 @@ import android.view.ViewGroup;
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.fragment.app.Fragment;
|
import androidx.fragment.app.Fragment;
|
||||||
import androidx.fragment.app.FragmentPagerAdapter;
|
|
||||||
import androidx.viewpager.widget.ViewPager.OnPageChangeListener;
|
import androidx.viewpager.widget.ViewPager.OnPageChangeListener;
|
||||||
import fr.free.nrw.commons.R;
|
import fr.free.nrw.commons.R;
|
||||||
import fr.free.nrw.commons.ViewPagerAdapter;
|
import fr.free.nrw.commons.ViewPagerAdapter;
|
||||||
|
|
@ -70,9 +69,7 @@ public class ExploreFragment extends CommonsDaggerSupportFragment {
|
||||||
loadNearbyMapData();
|
loadNearbyMapData();
|
||||||
binding = FragmentExploreBinding.inflate(inflater, container, false);
|
binding = FragmentExploreBinding.inflate(inflater, container, false);
|
||||||
|
|
||||||
viewPagerAdapter = new ViewPagerAdapter(getChildFragmentManager(),
|
viewPagerAdapter = new ViewPagerAdapter(getChildFragmentManager());
|
||||||
FragmentPagerAdapter.BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT);
|
|
||||||
|
|
||||||
binding.viewPager.setAdapter(viewPagerAdapter);
|
binding.viewPager.setAdapter(viewPagerAdapter);
|
||||||
binding.viewPager.setId(R.id.viewPager);
|
binding.viewPager.setId(R.id.viewPager);
|
||||||
binding.tabLayout.setupWithViewPager(binding.viewPager);
|
binding.tabLayout.setupWithViewPager(binding.viewPager);
|
||||||
|
|
|
||||||
|
|
@ -221,6 +221,7 @@ public class ExploreMapFragment extends CommonsDaggerSupportFragment
|
||||||
binding.mapView.getController().setZoom(ZOOM_LEVEL);
|
binding.mapView.getController().setZoom(ZOOM_LEVEL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
performMapReadyActions();
|
||||||
|
|
||||||
binding.mapView.getOverlays().add(new MapEventsOverlay(new MapEventsReceiver() {
|
binding.mapView.getOverlays().add(new MapEventsOverlay(new MapEventsReceiver() {
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -340,12 +341,7 @@ public class ExploreMapFragment extends CommonsDaggerSupportFragment
|
||||||
!locationPermissionsHelper.checkLocationPermission(getActivity())) {
|
!locationPermissionsHelper.checkLocationPermission(getActivity())) {
|
||||||
isPermissionDenied = true;
|
isPermissionDenied = true;
|
||||||
}
|
}
|
||||||
|
lastKnownLocation = MapUtils.getDefaultLatLng();
|
||||||
lastKnownLocation = getLastLocation();
|
|
||||||
|
|
||||||
if (lastKnownLocation == null) {
|
|
||||||
lastKnownLocation = MapUtils.getDefaultLatLng();
|
|
||||||
}
|
|
||||||
|
|
||||||
// if we came from 'Show in Explore' in Nearby, load Nearby map center and zoom
|
// if we came from 'Show in Explore' in Nearby, load Nearby map center and zoom
|
||||||
if (isCameFromNearbyMap()) {
|
if (isCameFromNearbyMap()) {
|
||||||
|
|
@ -966,6 +962,9 @@ public class ExploreMapFragment extends CommonsDaggerSupportFragment
|
||||||
-0.07483536015053005, 1f);
|
-0.07483536015053005, 1f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (!isCameFromNearbyMap()) {
|
||||||
|
moveCameraToPosition(new GeoPoint(latLnge.getLatitude(), latLnge.getLongitude()));
|
||||||
|
}
|
||||||
return latLnge;
|
return latLnge;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue