Fixed the refresh combined with the progressBar.

This commit is contained in:
Niels Zwemmer
2017-06-29 15:20:40 +02:00
parent 9d016b8c65
commit 6258c2a91a

View File

@@ -1,6 +1,7 @@
package nl.myhyvesbookplus.tagram; package nl.myhyvesbookplus.tagram;
import android.app.Fragment; import android.app.Fragment;
import android.app.ProgressDialog;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler; import android.os.Handler;
import android.support.v4.widget.SwipeRefreshLayout; import android.support.v4.widget.SwipeRefreshLayout;
@@ -26,11 +27,13 @@ public class TimelineFragment extends Fragment {
public TimelineFragment() {} public TimelineFragment() {}
/** /**
* Overridden onCreate which also starts a progress dialog for the posts being downloaded.
* @param savedInstanceState The standard return of the onCreate method. * @param savedInstanceState The standard return of the onCreate method.
*/ */
@Override @Override
public void onCreate(Bundle savedInstanceState) { public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
// progressDialog = ProgressDialog.show(getActivity(), getString(R.string.please_wait), getString(R.string.downloading_posts), false, false);
} }
/** /**
@@ -48,12 +51,12 @@ public class TimelineFragment extends Fragment {
public View onCreateView(LayoutInflater inflater, ViewGroup container, public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) { Bundle savedInstanceState) {
View timeLineInflater = inflater.inflate(R.layout.fragment_timeline, container, false); View timeLineInflater = inflater.inflate(R.layout.fragment_timeline, container, false);
progressBar = (ProgressBar) timeLineInflater.findViewById(R.id.progressbar_timeline);
progressBar.setVisibility(View.VISIBLE);
listView = (ListView) timeLineInflater.findViewById(R.id.list); listView = (ListView) timeLineInflater.findViewById(R.id.list);
final SwipeRefreshLayout swipeView = (SwipeRefreshLayout) timeLineInflater.findViewById(R.id.swipe); final SwipeRefreshLayout swipeView = (SwipeRefreshLayout) timeLineInflater.findViewById(R.id.swipe);
progressBar = (ProgressBar) timeLineInflater.findViewById(R.id.progressbar_timeline);
progressBar.setVisibility(View.VISIBLE);
swipeView.setEnabled(false); swipeView.setEnabled(false);
downloadClass = new DownloadClass(getActivity()); downloadClass = new DownloadClass(getActivity());
downloadClass.getPostsFromServer(); downloadClass.getPostsFromServer();