mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-27 04:43:54 +01:00
parent
a26b62f51b
commit
9d55c1e8d7
2 changed files with 15 additions and 6 deletions
|
|
@ -269,9 +269,16 @@ public class MainActivity extends AuthenticatedActivity implements FragmentManag
|
|||
finish();
|
||||
}
|
||||
} else if (getSupportFragmentManager().findFragmentByTag(nearbyFragmentTag) != null && !isContributionsFragmentVisible) {
|
||||
// Meas that nearby fragment is visible (not contributions fragment)
|
||||
// Set current item to contributions activity instead of closing the activity
|
||||
// Means that nearby fragment is visible (not contributions fragment)
|
||||
NearbyFragment nearbyFragment = (NearbyFragment) contributionsActivityPagerAdapter.getItem(1);
|
||||
|
||||
if(nearbyFragment.isBottomSheetExpanded()) {
|
||||
// Back should first hide the bottom sheet if it is expanded
|
||||
nearbyFragment.listOptionMenuItemClicked();
|
||||
} else {
|
||||
// Otherwise go back to contributions fragment
|
||||
viewPager.setCurrentItem(0);
|
||||
}
|
||||
} else {
|
||||
super.onBackPressed();
|
||||
}
|
||||
|
|
@ -347,7 +354,7 @@ public class MainActivity extends AuthenticatedActivity implements FragmentManag
|
|||
return true;
|
||||
case R.id.list_sheet:
|
||||
if (contributionsActivityPagerAdapter.getItem(1) != null) {
|
||||
((NearbyFragment)contributionsActivityPagerAdapter.getItem(1)).listOptionMenuIteClicked();
|
||||
((NearbyFragment)contributionsActivityPagerAdapter.getItem(1)).listOptionMenuItemClicked();
|
||||
}
|
||||
return true;
|
||||
default:
|
||||
|
|
|
|||
|
|
@ -132,14 +132,13 @@ public class NearbyFragment extends CommonsDaggerSupportFragment
|
|||
/**
|
||||
* Hide or expand bottom sheet according to states of all sheets
|
||||
*/
|
||||
public void listOptionMenuIteClicked() {
|
||||
public void listOptionMenuItemClicked() {
|
||||
if(bottomSheetBehavior.getState()==BottomSheetBehavior.STATE_COLLAPSED || bottomSheetBehavior.getState()==BottomSheetBehavior.STATE_HIDDEN){
|
||||
bottomSheetBehaviorForDetails.setState(BottomSheetBehavior.STATE_HIDDEN);
|
||||
bottomSheetBehavior.setState(BottomSheetBehavior.STATE_EXPANDED);
|
||||
}else if(bottomSheetBehavior.getState()==BottomSheetBehavior.STATE_EXPANDED){
|
||||
bottomSheetBehavior.setState(BottomSheetBehavior.STATE_COLLAPSED);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -822,6 +821,9 @@ public class NearbyFragment extends CommonsDaggerSupportFragment
|
|||
locationManager.unregisterLocationManager();
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isBottomSheetExpanded() { return bottomSheetBehavior.getState() == BottomSheetBehavior.STATE_EXPANDED;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue