From 8e8472800b9bb2d997bf3529064a06e77d1255ae Mon Sep 17 00:00:00 2001 From: neslihanturan Date: Tue, 26 Dec 2017 01:14:12 +0300 Subject: [PATCH] Remove show list FAB, since using multple fabs is not recommended. Use list button in menu instead --- .../nrw/commons/nearby/NearbyActivity.java | 25 ++++--------------- .../nrw/commons/nearby/NearbyMapFragment.java | 5 ---- app/src/main/res/layout/activity_nearby.xml | 12 ++++----- app/src/main/res/menu/menu_nearby.xml | 8 ++++++ app/src/main/res/values/strings.xml | 1 + 5 files changed, 20 insertions(+), 31 deletions(-) diff --git a/app/src/main/java/fr/free/nrw/commons/nearby/NearbyActivity.java b/app/src/main/java/fr/free/nrw/commons/nearby/NearbyActivity.java index 8adf42962..6dff9ee4f 100644 --- a/app/src/main/java/fr/free/nrw/commons/nearby/NearbyActivity.java +++ b/app/src/main/java/fr/free/nrw/commons/nearby/NearbyActivity.java @@ -57,8 +57,6 @@ public class NearbyActivity extends NavigationBaseActivity implements LocationUp LinearLayout bottomSheet; @BindView(R.id.bottom_sheet_details) LinearLayout bottomSheetDetails; - @BindView(R.id.fab_list) - FloatingActionButton fabList; @BindView(R.id.transparentView) View transparentView; @@ -87,8 +85,6 @@ public class NearbyActivity extends NavigationBaseActivity implements LocationUp bundle = new Bundle(); initBottomSheetBehaviour(); - initFabList(); - initDrawer(); swipeLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() { @Override @@ -138,16 +134,6 @@ public class NearbyActivity extends NavigationBaseActivity implements LocationUp bottomSheetBehaviorForDetails.setState(BottomSheetBehavior.STATE_HIDDEN); } - private void initFabList() { - fabList.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View view) { - bottomSheetBehaviorForDetails.setState(BottomSheetBehavior.STATE_HIDDEN); - bottomSheetBehavior.setState(BottomSheetBehavior.STATE_EXPANDED); - } - }); - } - @Override public boolean onCreateOptionsMenu(Menu menu) { MenuInflater inflater = getMenuInflater(); @@ -164,6 +150,10 @@ public class NearbyActivity extends NavigationBaseActivity implements LocationUp lockNearbyView(false); refreshView(true); return true; + case R.id.action_display_list: + bottomSheetBehaviorForDetails.setState(BottomSheetBehavior.STATE_HIDDEN); + bottomSheetBehavior.setState(BottomSheetBehavior.STATE_EXPANDED); + return true; default: return super.onOptionsItemSelected(item); } @@ -422,11 +412,6 @@ public class NearbyActivity extends NavigationBaseActivity implements LocationUp } public void prepareViewsForSheetPosition(int bottomSheetState) { - if (bottomSheetState >= BottomSheetBehavior.STATE_COLLAPSED) { - fabList.show(); - } - else if (bottomSheetState == BottomSheetBehavior.STATE_EXPANDED) { - fabList.hide(); - } + // TODO } } diff --git a/app/src/main/java/fr/free/nrw/commons/nearby/NearbyMapFragment.java b/app/src/main/java/fr/free/nrw/commons/nearby/NearbyMapFragment.java index f9db8e0aa..3a65e3dc1 100644 --- a/app/src/main/java/fr/free/nrw/commons/nearby/NearbyMapFragment.java +++ b/app/src/main/java/fr/free/nrw/commons/nearby/NearbyMapFragment.java @@ -56,7 +56,6 @@ public class NearbyMapFragment extends android.support.v4.app.Fragment { private LinearLayout wikipediaButton; private LinearLayout wikidataButton; private LinearLayout directionsButton; - private FloatingActionButton fabList; private FloatingActionButton fabPlus; private FloatingActionButton fabCamera; private FloatingActionButton fabGallery; @@ -148,7 +147,6 @@ public class NearbyMapFragment extends android.support.v4.app.Fragment { bottomSheetDetailsBehavior = BottomSheetBehavior.from(bottomSheetDetails); bottomSheetDetailsBehavior.setState(BottomSheetBehavior.STATE_HIDDEN); - fabList = getActivity().findViewById(R.id.fab_list); fabPlus = getActivity().findViewById(R.id.fab_plus); fabCamera = getActivity().findViewById(R.id.fab_camera); fabGallery = getActivity().findViewById(R.id.fab_galery); @@ -311,21 +309,18 @@ public class NearbyMapFragment extends android.support.v4.app.Fragment { switch (bottomSheetState) { case (BottomSheetBehavior.STATE_COLLAPSED): - if (!fabList.isShown()) fabList.show(); closeFabs(isFabOpen); if (!fabPlus.isShown()) showFAB(); this.getView().requestFocus(); moreInfo.setVisibility(View.VISIBLE); break; case (BottomSheetBehavior.STATE_EXPANDED): - if (fabList.isShown()) fabList.hide(); this.getView().requestFocus(); moreInfo.setVisibility(View.VISIBLE); break; case (BottomSheetBehavior.STATE_HIDDEN): transparentView.setClickable(false); transparentView.setAlpha(0); - if (!fabList.isShown()) fabList.show(); closeFabs(isFabOpen); hideFAB(); this.getView().requestFocus(); diff --git a/app/src/main/res/layout/activity_nearby.xml b/app/src/main/res/layout/activity_nearby.xml index 60955e97f..225fa916c 100644 --- a/app/src/main/res/layout/activity_nearby.xml +++ b/app/src/main/res/layout/activity_nearby.xml @@ -20,12 +20,12 @@ android:layout_width="match_parent" android:layout_height="wrap_content" /> - + + + Search categories Save Refresh + List GPS is disabled in your device. Would you like to enable it? Enable GPS No uploads yet