mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-26 12:23:58 +01:00
Nearby: make list resize and display message when empty (#3746)
* Nearby: make list resize and display message when empty * refactored and renamed for clarity * refactoring and simplifying based on comments * refactoring and simplifying based on comments * removing vertical orientation
This commit is contained in:
parent
fbd057b87e
commit
7084fd2535
3 changed files with 22 additions and 3 deletions
|
|
@ -154,6 +154,7 @@ public class NearbyParentFragment extends CommonsDaggerSupportFragment
|
||||||
MapView mapView;
|
MapView mapView;
|
||||||
@BindView(R.id.rv_nearby_list)
|
@BindView(R.id.rv_nearby_list)
|
||||||
RecyclerView rvNearbyList;
|
RecyclerView rvNearbyList;
|
||||||
|
@BindView(R.id.no_results_message) TextView noResultsView;
|
||||||
|
|
||||||
@Inject LocationServiceManager locationManager;
|
@Inject LocationServiceManager locationManager;
|
||||||
@Inject NearbyController nearbyController;
|
@Inject NearbyController nearbyController;
|
||||||
|
|
@ -626,6 +627,7 @@ public class NearbyParentFragment extends CommonsDaggerSupportFragment
|
||||||
@Override
|
@Override
|
||||||
public void updateListFragment(List<Place> placeList) {
|
public void updateListFragment(List<Place> placeList) {
|
||||||
adapterFactory.updateAdapterData(placeList, (RVRendererAdapter<Place>) rvNearbyList.getAdapter());
|
adapterFactory.updateAdapterData(placeList, (RVRendererAdapter<Place>) rvNearbyList.getAdapter());
|
||||||
|
noResultsView.setVisibility(placeList.size() <= 0 ? View.VISIBLE : View.GONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void clearNearbyList() {
|
public void clearNearbyList() {
|
||||||
|
|
@ -634,6 +636,7 @@ public class NearbyParentFragment extends CommonsDaggerSupportFragment
|
||||||
|
|
||||||
public void updateNearbyList() {
|
public void updateNearbyList() {
|
||||||
adapterFactory.update((RVRendererAdapter<Place>) rvNearbyList.getAdapter());
|
adapterFactory.update((RVRendererAdapter<Place>) rvNearbyList.getAdapter());
|
||||||
|
noResultsView.setVisibility(rvNearbyList.getAdapter().getItemCount() <= 0 ? View.VISIBLE : View.GONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addPlaceToNearbyList(Place place) {
|
public void addPlaceToNearbyList(Place place) {
|
||||||
|
|
|
||||||
|
|
@ -3,14 +3,29 @@
|
||||||
android:id="@+id/bottom_sheet"
|
android:id="@+id/bottom_sheet"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:orientation="vertical"
|
android:gravity="bottom"
|
||||||
app:behavior_hideable="true"
|
app:behavior_hideable="true"
|
||||||
android:visibility="visible"
|
android:visibility="visible"
|
||||||
app:layout_behavior="@string/bottom_sheet_behavior"
|
app:layout_behavior="@string/bottom_sheet_behavior"
|
||||||
android:background="@android:color/white">
|
android:background="@android:color/transparent">
|
||||||
|
|
||||||
|
<RelativeLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:background="@android:color/white">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/no_results_message"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:padding="50dp"
|
||||||
|
android:layout_centerInParent="true"
|
||||||
|
android:visibility="gone"
|
||||||
|
android:text="@string/nearby_no_results"/>
|
||||||
|
|
||||||
<androidx.recyclerview.widget.RecyclerView
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
android:id="@+id/rv_nearby_list"
|
android:id="@+id/rv_nearby_list"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent" />
|
android:layout_height="wrap_content"/>
|
||||||
|
</RelativeLayout>
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|
|
||||||
|
|
@ -628,5 +628,6 @@ Upload your first media by tapping on the add button.</string>
|
||||||
<string name="ask_to_turn_location_on">Turn on location?</string>
|
<string name="ask_to_turn_location_on">Turn on location?</string>
|
||||||
<string name="nearby_needs_location">Nearby needs location enabled to work properly</string>
|
<string name="nearby_needs_location">Nearby needs location enabled to work properly</string>
|
||||||
<string name="use_location_from_similar_image">Did you shoot these two pictures at the same place? Do you want to use the latitude/longitude of the picture on the right?</string>
|
<string name="use_location_from_similar_image">Did you shoot these two pictures at the same place? Do you want to use the latitude/longitude of the picture on the right?</string>
|
||||||
|
<string name="nearby_no_results">No places found, try changing your search criteria.</string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue