Skip to content

Fix issue #1332 : Contribution Image auto/manual refresh if fetching fails #1375

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 30, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,6 @@ protected void onCreate(Bundle savedInstanceState) {
if(!BuildConfig.FLAVOR.equalsIgnoreCase("beta")){
setUploadCount();
}

}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v4.content.ContextCompat;
import android.support.v4.widget.SwipeRefreshLayout;
import android.support.v7.app.AlertDialog;
import android.view.LayoutInflater;
import android.view.Menu;
Expand Down Expand Up @@ -47,6 +48,8 @@ public class ContributionsListFragment extends CommonsDaggerSupportFragment {
TextView waitingMessage;
@BindView(R.id.loadingContributionsProgressBar)
ProgressBar progressBar;
@BindView(R.id.swipeRefreshLayout)
SwipeRefreshLayout swipeRefreshLayout;

@Inject
@Named("prefs")
Expand All @@ -64,6 +67,13 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle sa
ButterKnife.bind(this, v);

contributionsList.setOnItemClickListener((AdapterView.OnItemClickListener) getActivity());
swipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
@Override
public void onRefresh() {
((ContributionsListAdapter)contributionsList.getAdapter()).notifyDataSetChanged();
swipeRefreshLayout.setRefreshing(false);
}
});
if (savedInstanceState != null) {
Timber.d("Scrolling to %d", savedInstanceState.getInt("grid-position"));
contributionsList.setSelection(savedInstanceState.getInt("grid-position"));
Expand Down
7 changes: 6 additions & 1 deletion app/src/main/res/layout/fragment_contributions.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@
android:id="@+id/loadingContributionsProgressBar"
/>

<android.support.v4.widget.SwipeRefreshLayout
android:id="@+id/swipeRefreshLayout"
android:layout_width="match_parent"
android:layout_height="match_parent">

<GridView
android:id="@+id/contributionsList"
android:layout_height="match_parent"
Expand All @@ -35,5 +40,5 @@
android:fadingEdge="none"
android:fastScrollEnabled="true"
/>

</android.support.v4.widget.SwipeRefreshLayout>
</RelativeLayout>