File tree Expand file tree Collapse file tree 2 files changed +15
-5
lines changed
java/fr/free/nrw/commons/nearby Expand file tree Collapse file tree 2 files changed +15
-5
lines changed Original file line number Diff line number Diff line change 1010import android .support .annotation .NonNull ;
1111import android .support .v4 .app .Fragment ;
1212import android .support .v4 .app .FragmentTransaction ;
13+ import android .support .v4 .widget .SwipeRefreshLayout ;
1314import android .support .v7 .app .AlertDialog ;
1415import android .view .Menu ;
1516import android .view .MenuInflater ;
@@ -60,7 +61,7 @@ public class NearbyActivity extends NavigationBaseActivity implements LocationUp
6061 private NearbyActivityMode viewMode ;
6162 private Disposable placesDisposable ;
6263 private boolean lockNearbyView ; //Determines if the nearby places needs to be refreshed
63-
64+ @ BindView ( R . id . swipe_container ) SwipeRefreshLayout swipeLayout ;
6465 @ Override
6566 protected void onCreate (Bundle savedInstanceState ) {
6667 super .onCreate (savedInstanceState );
@@ -70,6 +71,13 @@ protected void onCreate(Bundle savedInstanceState) {
7071 bundle = new Bundle ();
7172 initDrawer ();
7273 initViewState ();
74+ swipeLayout .setOnRefreshListener (new SwipeRefreshLayout .OnRefreshListener () {
75+ @ Override
76+ public void onRefresh () {
77+ lockNearbyView (false );
78+ refreshView (true );
79+ }
80+ });
7381 }
7482
7583 private void initViewState () {
@@ -309,7 +317,7 @@ private void populatePlaces(List<Place> placeList) {
309317 } else {
310318 setListFragment ();
311319 }
312-
320+ swipeLayout . setRefreshing ( false );
313321 hideProgressBar ();
314322 }
315323
Original file line number Diff line number Diff line change 2121 android : orientation =" horizontal"
2222 android : gravity =" center_vertical"
2323 android : layout_below =" @id/toolbar" >
24-
2524 <ProgressBar
2625 android : id =" @+id/progressBar"
2726 android : layout_width =" match_parent"
2827 android : layout_height =" wrap_content" />
29-
28+ <android .support.v4.widget.SwipeRefreshLayout
29+ android : id =" @+id/swipe_container"
30+ android : layout_width =" match_parent"
31+ android : layout_height =" match_parent" >
3032 <FrameLayout
3133 android : id =" @+id/container"
3234 android : layout_width =" match_parent"
3335 android : layout_height =" match_parent" />
34-
36+ </ android .support.v4.widget.SwipeRefreshLayout>
3537 </LinearLayout >
3638 </RelativeLayout >
3739
You can’t perform that action at this time.
0 commit comments