mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-27 12:53:55 +01:00
Fix conflicts
This commit is contained in:
commit
aeaafa465f
3 changed files with 21 additions and 56 deletions
|
|
@ -9,9 +9,7 @@ import android.support.annotation.NonNull;
|
||||||
import android.support.design.widget.BottomSheetBehavior;
|
import android.support.design.widget.BottomSheetBehavior;
|
||||||
|
|
||||||
import android.support.v4.app.FragmentTransaction;
|
import android.support.v4.app.FragmentTransaction;
|
||||||
import android.support.v4.widget.SwipeRefreshLayout;
|
|
||||||
import android.support.v7.app.AlertDialog;
|
import android.support.v7.app.AlertDialog;
|
||||||
import android.util.Log;
|
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
import android.view.MenuInflater;
|
import android.view.MenuInflater;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
|
|
@ -29,17 +27,19 @@ import javax.inject.Inject;
|
||||||
|
|
||||||
import butterknife.BindView;
|
import butterknife.BindView;
|
||||||
import butterknife.ButterKnife;
|
import butterknife.ButterKnife;
|
||||||
|
|
||||||
import fr.free.nrw.commons.R;
|
import fr.free.nrw.commons.R;
|
||||||
import fr.free.nrw.commons.location.LatLng;
|
import fr.free.nrw.commons.location.LatLng;
|
||||||
import fr.free.nrw.commons.location.LocationServiceManager;
|
import fr.free.nrw.commons.location.LocationServiceManager;
|
||||||
import fr.free.nrw.commons.location.LocationUpdateListener;
|
import fr.free.nrw.commons.location.LocationUpdateListener;
|
||||||
import fr.free.nrw.commons.theme.NavigationBaseActivity;
|
import fr.free.nrw.commons.theme.NavigationBaseActivity;
|
||||||
import fr.free.nrw.commons.utils.UriSerializer;
|
import fr.free.nrw.commons.utils.UriSerializer;
|
||||||
import fr.free.nrw.commons.utils.ViewUtil;
|
|
||||||
import io.reactivex.Observable;
|
import io.reactivex.Observable;
|
||||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||||
import io.reactivex.disposables.Disposable;
|
import io.reactivex.disposables.Disposable;
|
||||||
import io.reactivex.schedulers.Schedulers;
|
import io.reactivex.schedulers.Schedulers;
|
||||||
|
|
||||||
import timber.log.Timber;
|
import timber.log.Timber;
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -73,7 +73,6 @@ public class NearbyActivity extends NavigationBaseActivity implements LocationUp
|
||||||
private static final String TAG_RETAINED_MAP_FRAGMENT = NearbyMapFragment.class.getSimpleName();
|
private static final String TAG_RETAINED_MAP_FRAGMENT = NearbyMapFragment.class.getSimpleName();
|
||||||
private static final String TAG_RETAINED_LIST_FRAGMENT = NearbyListFragment.class.getSimpleName();
|
private static final String TAG_RETAINED_LIST_FRAGMENT = NearbyListFragment.class.getSimpleName();
|
||||||
|
|
||||||
@BindView(R.id.swipe_container) SwipeRefreshLayout swipeLayout;
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
|
@ -95,13 +94,6 @@ public class NearbyActivity extends NavigationBaseActivity implements LocationUp
|
||||||
private void initBottomSheetBehaviour() {
|
private void initBottomSheetBehaviour() {
|
||||||
|
|
||||||
transparentView.setAlpha(0);
|
transparentView.setAlpha(0);
|
||||||
swipeLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
|
|
||||||
@Override
|
|
||||||
public void onRefresh() {
|
|
||||||
lockNearbyView(false);
|
|
||||||
refreshView(false, LocationServiceManager.LocationChangeType.LOCATION_SIGNIFICANTLY_CHANGED);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
bottomSheet.getLayoutParams().height = getWindowManager()
|
bottomSheet.getLayoutParams().height = getWindowManager()
|
||||||
.getDefaultDisplay().getHeight() / 16 * 9;
|
.getDefaultDisplay().getHeight() / 16 * 9;
|
||||||
|
|
@ -137,11 +129,6 @@ public class NearbyActivity extends NavigationBaseActivity implements LocationUp
|
||||||
public boolean onOptionsItemSelected(MenuItem item) {
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||||||
// Handle item selection
|
// Handle item selection
|
||||||
switch (item.getItemId()) {
|
switch (item.getItemId()) {
|
||||||
case R.id.action_refresh:
|
|
||||||
lockNearbyView(false);
|
|
||||||
refreshView(true,
|
|
||||||
LocationServiceManager.LocationChangeType.LOCATION_SIGNIFICANTLY_CHANGED);
|
|
||||||
return true;
|
|
||||||
case R.id.action_display_list:
|
case R.id.action_display_list:
|
||||||
bottomSheetBehaviorForDetails.setState(BottomSheetBehavior.STATE_HIDDEN);
|
bottomSheetBehaviorForDetails.setState(BottomSheetBehavior.STATE_HIDDEN);
|
||||||
bottomSheetBehavior.setState(BottomSheetBehavior.STATE_EXPANDED);
|
bottomSheetBehavior.setState(BottomSheetBehavior.STATE_EXPANDED);
|
||||||
|
|
@ -162,8 +149,7 @@ public class NearbyActivity extends NavigationBaseActivity implements LocationUp
|
||||||
switch (requestCode) {
|
switch (requestCode) {
|
||||||
case LOCATION_REQUEST: {
|
case LOCATION_REQUEST: {
|
||||||
if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
|
if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
|
||||||
refreshView(false,
|
refreshView(LocationServiceManager.LocationChangeType.LOCATION_SIGNIFICANTLY_CHANGED);
|
||||||
LocationServiceManager.LocationChangeType.LOCATION_SIGNIFICANTLY_CHANGED);
|
|
||||||
} else {
|
} else {
|
||||||
//If permission not granted, go to page that says Nearby Places cannot be displayed
|
//If permission not granted, go to page that says Nearby Places cannot be displayed
|
||||||
hideProgressBar();
|
hideProgressBar();
|
||||||
|
|
@ -218,8 +204,7 @@ public class NearbyActivity extends NavigationBaseActivity implements LocationUp
|
||||||
private void checkLocationPermission() {
|
private void checkLocationPermission() {
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||||
if (locationManager.isLocationPermissionGranted()) {
|
if (locationManager.isLocationPermissionGranted()) {
|
||||||
refreshView(false,
|
refreshView(LocationServiceManager.LocationChangeType.LOCATION_SIGNIFICANTLY_CHANGED);
|
||||||
LocationServiceManager.LocationChangeType.LOCATION_SIGNIFICANTLY_CHANGED);
|
|
||||||
} else {
|
} else {
|
||||||
// Should we show an explanation?
|
// Should we show an explanation?
|
||||||
if (locationManager.isPermissionExplanationRequired(this)) {
|
if (locationManager.isPermissionExplanationRequired(this)) {
|
||||||
|
|
@ -245,8 +230,7 @@ public class NearbyActivity extends NavigationBaseActivity implements LocationUp
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
refreshView(false,
|
refreshView(LocationServiceManager.LocationChangeType.LOCATION_SIGNIFICANTLY_CHANGED);
|
||||||
LocationServiceManager.LocationChangeType.LOCATION_SIGNIFICANTLY_CHANGED);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -255,8 +239,7 @@ public class NearbyActivity extends NavigationBaseActivity implements LocationUp
|
||||||
super.onActivityResult(requestCode, resultCode, data);
|
super.onActivityResult(requestCode, resultCode, data);
|
||||||
if (requestCode == 1) {
|
if (requestCode == 1) {
|
||||||
Timber.d("User is back from Settings page");
|
Timber.d("User is back from Settings page");
|
||||||
refreshView(false,
|
refreshView(LocationServiceManager.LocationChangeType.LOCATION_SIGNIFICANTLY_CHANGED);
|
||||||
LocationServiceManager.LocationChangeType.LOCATION_SIGNIFICANTLY_CHANGED);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -307,12 +290,9 @@ public class NearbyActivity extends NavigationBaseActivity implements LocationUp
|
||||||
/**
|
/**
|
||||||
* This method should be the single point to load/refresh nearby places
|
* This method should be the single point to load/refresh nearby places
|
||||||
*
|
*
|
||||||
* @param isHardRefresh
|
|
||||||
* @param locationChangeType defines if location shanged significantly or slightly
|
* @param locationChangeType defines if location shanged significantly or slightly
|
||||||
*/
|
*/
|
||||||
private void refreshView(boolean isHardRefresh,
|
private void refreshView(LocationServiceManager.LocationChangeType locationChangeType) {
|
||||||
LocationServiceManager.LocationChangeType locationChangeType) {
|
|
||||||
|
|
||||||
if (lockNearbyView) {
|
if (lockNearbyView) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -320,9 +300,7 @@ public class NearbyActivity extends NavigationBaseActivity implements LocationUp
|
||||||
LatLng lastLocation = locationManager.getLastLocation();
|
LatLng lastLocation = locationManager.getLastLocation();
|
||||||
|
|
||||||
if (curLatLang != null && curLatLang.equals(lastLocation)) { //refresh view only if location has changed
|
if (curLatLang != null && curLatLang.equals(lastLocation)) { //refresh view only if location has changed
|
||||||
if (isHardRefresh) {
|
|
||||||
ViewUtil.showLongToast(this, R.string.nearby_location_has_not_changed);
|
|
||||||
}
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
curLatLang = lastLocation;
|
curLatLang = lastLocation;
|
||||||
|
|
@ -508,14 +486,12 @@ public class NearbyActivity extends NavigationBaseActivity implements LocationUp
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onLocationChangedSignificantly(LatLng latLng) {
|
public void onLocationChangedSignificantly(LatLng latLng) {
|
||||||
refreshView(false,
|
refreshView(LocationServiceManager.LocationChangeType.LOCATION_SIGNIFICANTLY_CHANGED);
|
||||||
LocationServiceManager.LocationChangeType.LOCATION_SIGNIFICANTLY_CHANGED);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onLocationChangedSlightly(LatLng latLng) {
|
public void onLocationChangedSlightly(LatLng latLng) {
|
||||||
refreshView(false,
|
refreshView(LocationServiceManager.LocationChangeType.LOCATION_SLIGHTLY_CHANGED);
|
||||||
LocationServiceManager.LocationChangeType.LOCATION_SLIGHTLY_CHANGED);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void prepareViewsForSheetPosition(int bottomSheetState) {
|
public void prepareViewsForSheetPosition(int bottomSheetState) {
|
||||||
|
|
|
||||||
|
|
@ -26,19 +26,16 @@
|
||||||
android:layout_below="@id/toolbar"
|
android:layout_below="@id/toolbar"
|
||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
android:orientation="horizontal">
|
android:orientation="horizontal">
|
||||||
|
|
||||||
<ProgressBar
|
<ProgressBar
|
||||||
android:id="@+id/progressBar"
|
android:id="@+id/progressBar"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content" />
|
android:layout_height="wrap_content" />
|
||||||
<android.support.v4.widget.SwipeRefreshLayout
|
|
||||||
android:id="@+id/swipe_container"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent">
|
|
||||||
<FrameLayout
|
<FrameLayout
|
||||||
android:id="@+id/container"
|
android:id="@+id/container"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent" />
|
android:layout_height="match_parent" />
|
||||||
</android.support.v4.widget.SwipeRefreshLayout>
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
<android.support.design.widget.FloatingActionButton
|
<android.support.design.widget.FloatingActionButton
|
||||||
android:id="@+id/fab_list"
|
android:id="@+id/fab_list"
|
||||||
|
|
|
||||||
|
|
@ -10,12 +10,4 @@
|
||||||
app:showAsAction="ifRoom"
|
app:showAsAction="ifRoom"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<item
|
|
||||||
android:id="@+id/action_refresh"
|
|
||||||
android:title="@string/refresh_button"
|
|
||||||
android:icon="@drawable/ic_refresh_white_24dp"
|
|
||||||
android:orderInCategory="1"
|
|
||||||
app:showAsAction="ifRoom"
|
|
||||||
/>
|
|
||||||
|
|
||||||
</menu>
|
</menu>
|
||||||
Loading…
Add table
Add a link
Reference in a new issue