mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-27 04:43:54 +01:00
Remove show list FAB, since using multple fabs is not recommended. Use list button in menu instead
This commit is contained in:
parent
e70b8b2e6a
commit
8e8472800b
5 changed files with 20 additions and 31 deletions
|
|
@ -57,8 +57,6 @@ public class NearbyActivity extends NavigationBaseActivity implements LocationUp
|
||||||
LinearLayout bottomSheet;
|
LinearLayout bottomSheet;
|
||||||
@BindView(R.id.bottom_sheet_details)
|
@BindView(R.id.bottom_sheet_details)
|
||||||
LinearLayout bottomSheetDetails;
|
LinearLayout bottomSheetDetails;
|
||||||
@BindView(R.id.fab_list)
|
|
||||||
FloatingActionButton fabList;
|
|
||||||
@BindView(R.id.transparentView)
|
@BindView(R.id.transparentView)
|
||||||
View transparentView;
|
View transparentView;
|
||||||
|
|
||||||
|
|
@ -87,8 +85,6 @@ public class NearbyActivity extends NavigationBaseActivity implements LocationUp
|
||||||
bundle = new Bundle();
|
bundle = new Bundle();
|
||||||
|
|
||||||
initBottomSheetBehaviour();
|
initBottomSheetBehaviour();
|
||||||
initFabList();
|
|
||||||
|
|
||||||
initDrawer();
|
initDrawer();
|
||||||
swipeLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
|
swipeLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -138,16 +134,6 @@ public class NearbyActivity extends NavigationBaseActivity implements LocationUp
|
||||||
bottomSheetBehaviorForDetails.setState(BottomSheetBehavior.STATE_HIDDEN);
|
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
|
@Override
|
||||||
public boolean onCreateOptionsMenu(Menu menu) {
|
public boolean onCreateOptionsMenu(Menu menu) {
|
||||||
MenuInflater inflater = getMenuInflater();
|
MenuInflater inflater = getMenuInflater();
|
||||||
|
|
@ -164,6 +150,10 @@ public class NearbyActivity extends NavigationBaseActivity implements LocationUp
|
||||||
lockNearbyView(false);
|
lockNearbyView(false);
|
||||||
refreshView(true);
|
refreshView(true);
|
||||||
return true;
|
return true;
|
||||||
|
case R.id.action_display_list:
|
||||||
|
bottomSheetBehaviorForDetails.setState(BottomSheetBehavior.STATE_HIDDEN);
|
||||||
|
bottomSheetBehavior.setState(BottomSheetBehavior.STATE_EXPANDED);
|
||||||
|
return true;
|
||||||
default:
|
default:
|
||||||
return super.onOptionsItemSelected(item);
|
return super.onOptionsItemSelected(item);
|
||||||
}
|
}
|
||||||
|
|
@ -422,11 +412,6 @@ public class NearbyActivity extends NavigationBaseActivity implements LocationUp
|
||||||
}
|
}
|
||||||
|
|
||||||
public void prepareViewsForSheetPosition(int bottomSheetState) {
|
public void prepareViewsForSheetPosition(int bottomSheetState) {
|
||||||
if (bottomSheetState >= BottomSheetBehavior.STATE_COLLAPSED) {
|
// TODO
|
||||||
fabList.show();
|
|
||||||
}
|
|
||||||
else if (bottomSheetState == BottomSheetBehavior.STATE_EXPANDED) {
|
|
||||||
fabList.hide();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -56,7 +56,6 @@ public class NearbyMapFragment extends android.support.v4.app.Fragment {
|
||||||
private LinearLayout wikipediaButton;
|
private LinearLayout wikipediaButton;
|
||||||
private LinearLayout wikidataButton;
|
private LinearLayout wikidataButton;
|
||||||
private LinearLayout directionsButton;
|
private LinearLayout directionsButton;
|
||||||
private FloatingActionButton fabList;
|
|
||||||
private FloatingActionButton fabPlus;
|
private FloatingActionButton fabPlus;
|
||||||
private FloatingActionButton fabCamera;
|
private FloatingActionButton fabCamera;
|
||||||
private FloatingActionButton fabGallery;
|
private FloatingActionButton fabGallery;
|
||||||
|
|
@ -148,7 +147,6 @@ public class NearbyMapFragment extends android.support.v4.app.Fragment {
|
||||||
bottomSheetDetailsBehavior = BottomSheetBehavior.from(bottomSheetDetails);
|
bottomSheetDetailsBehavior = BottomSheetBehavior.from(bottomSheetDetails);
|
||||||
bottomSheetDetailsBehavior.setState(BottomSheetBehavior.STATE_HIDDEN);
|
bottomSheetDetailsBehavior.setState(BottomSheetBehavior.STATE_HIDDEN);
|
||||||
|
|
||||||
fabList = getActivity().findViewById(R.id.fab_list);
|
|
||||||
fabPlus = getActivity().findViewById(R.id.fab_plus);
|
fabPlus = getActivity().findViewById(R.id.fab_plus);
|
||||||
fabCamera = getActivity().findViewById(R.id.fab_camera);
|
fabCamera = getActivity().findViewById(R.id.fab_camera);
|
||||||
fabGallery = getActivity().findViewById(R.id.fab_galery);
|
fabGallery = getActivity().findViewById(R.id.fab_galery);
|
||||||
|
|
@ -311,21 +309,18 @@ public class NearbyMapFragment extends android.support.v4.app.Fragment {
|
||||||
|
|
||||||
switch (bottomSheetState) {
|
switch (bottomSheetState) {
|
||||||
case (BottomSheetBehavior.STATE_COLLAPSED):
|
case (BottomSheetBehavior.STATE_COLLAPSED):
|
||||||
if (!fabList.isShown()) fabList.show();
|
|
||||||
closeFabs(isFabOpen);
|
closeFabs(isFabOpen);
|
||||||
if (!fabPlus.isShown()) showFAB();
|
if (!fabPlus.isShown()) showFAB();
|
||||||
this.getView().requestFocus();
|
this.getView().requestFocus();
|
||||||
moreInfo.setVisibility(View.VISIBLE);
|
moreInfo.setVisibility(View.VISIBLE);
|
||||||
break;
|
break;
|
||||||
case (BottomSheetBehavior.STATE_EXPANDED):
|
case (BottomSheetBehavior.STATE_EXPANDED):
|
||||||
if (fabList.isShown()) fabList.hide();
|
|
||||||
this.getView().requestFocus();
|
this.getView().requestFocus();
|
||||||
moreInfo.setVisibility(View.VISIBLE);
|
moreInfo.setVisibility(View.VISIBLE);
|
||||||
break;
|
break;
|
||||||
case (BottomSheetBehavior.STATE_HIDDEN):
|
case (BottomSheetBehavior.STATE_HIDDEN):
|
||||||
transparentView.setClickable(false);
|
transparentView.setClickable(false);
|
||||||
transparentView.setAlpha(0);
|
transparentView.setAlpha(0);
|
||||||
if (!fabList.isShown()) fabList.show();
|
|
||||||
closeFabs(isFabOpen);
|
closeFabs(isFabOpen);
|
||||||
hideFAB();
|
hideFAB();
|
||||||
this.getView().requestFocus();
|
this.getView().requestFocus();
|
||||||
|
|
|
||||||
|
|
@ -20,12 +20,12 @@
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content" />
|
android:layout_height="wrap_content" />
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:orientation="horizontal"
|
android:layout_below="@id/toolbar"
|
||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
android:layout_below="@id/toolbar">
|
android:orientation="horizontal">
|
||||||
<ProgressBar
|
<ProgressBar
|
||||||
android:id="@+id/progressBar"
|
android:id="@+id/progressBar"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,14 @@
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
xmlns:tools="http://schemas.android.com/tools" tools:context=".MainActivity">
|
xmlns:tools="http://schemas.android.com/tools" tools:context=".MainActivity">
|
||||||
|
|
||||||
|
<item
|
||||||
|
android:id="@+id/action_display_list"
|
||||||
|
android:title="@string/display_list_button"
|
||||||
|
android:icon="@drawable/ic_list_white_24dp"
|
||||||
|
android:orderInCategory="1"
|
||||||
|
app:showAsAction="ifRoom"
|
||||||
|
/>
|
||||||
|
|
||||||
<item
|
<item
|
||||||
android:id="@+id/action_refresh"
|
android:id="@+id/action_refresh"
|
||||||
android:title="@string/refresh_button"
|
android:title="@string/refresh_button"
|
||||||
|
|
|
||||||
|
|
@ -53,6 +53,7 @@
|
||||||
<string name="categories_search_text_hint">Search categories</string>
|
<string name="categories_search_text_hint">Search categories</string>
|
||||||
<string name="menu_save_categories">Save</string>
|
<string name="menu_save_categories">Save</string>
|
||||||
<string name="refresh_button">Refresh</string>
|
<string name="refresh_button">Refresh</string>
|
||||||
|
<string name="display_list_button">List</string>
|
||||||
<string name="gps_disabled">GPS is disabled in your device. Would you like to enable it?</string>
|
<string name="gps_disabled">GPS is disabled in your device. Would you like to enable it?</string>
|
||||||
<string name="enable_gps">Enable GPS</string>
|
<string name="enable_gps">Enable GPS</string>
|
||||||
<string name="contributions_subtitle_zero">No uploads yet</string>
|
<string name="contributions_subtitle_zero">No uploads yet</string>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue