mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-26 20:33:53 +01:00
Addition: Pull down to refresh in nearby activity (#1164)
* added pull down to refresh in nearby activity * Requested changes made
This commit is contained in:
parent
9aceaca95d
commit
a7a2b51ceb
2 changed files with 15 additions and 5 deletions
|
|
@ -10,6 +10,7 @@ import android.preference.PreferenceManager;
|
|||
import android.support.annotation.NonNull;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.support.v4.app.FragmentTransaction;
|
||||
import android.support.v4.widget.SwipeRefreshLayout;
|
||||
import android.support.v7.app.AlertDialog;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuInflater;
|
||||
|
|
@ -60,7 +61,7 @@ public class NearbyActivity extends NavigationBaseActivity implements LocationUp
|
|||
private NearbyActivityMode viewMode;
|
||||
private Disposable placesDisposable;
|
||||
private boolean lockNearbyView; //Determines if the nearby places needs to be refreshed
|
||||
|
||||
@BindView(R.id.swipe_container) SwipeRefreshLayout swipeLayout;
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
|
@ -70,6 +71,13 @@ public class NearbyActivity extends NavigationBaseActivity implements LocationUp
|
|||
bundle = new Bundle();
|
||||
initDrawer();
|
||||
initViewState();
|
||||
swipeLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
|
||||
@Override
|
||||
public void onRefresh() {
|
||||
lockNearbyView(false);
|
||||
refreshView(true);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void initViewState() {
|
||||
|
|
@ -309,7 +317,7 @@ public class NearbyActivity extends NavigationBaseActivity implements LocationUp
|
|||
} else {
|
||||
setListFragment();
|
||||
}
|
||||
|
||||
swipeLayout.setRefreshing(false);
|
||||
hideProgressBar();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -21,17 +21,19 @@
|
|||
android:orientation="horizontal"
|
||||
android:gravity="center_vertical"
|
||||
android:layout_below="@id/toolbar">
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/progressBar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<android.support.v4.widget.SwipeRefreshLayout
|
||||
android:id="@+id/swipe_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
<FrameLayout
|
||||
android:id="@+id/container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
</android.support.v4.widget.SwipeRefreshLayout>
|
||||
</LinearLayout>
|
||||
</RelativeLayout>
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue