Page MenuHomec4science

RequestPending.java
No OneTemporary

File Metadata

Created
Sat, Jan 18, 04:32

RequestPending.java

This document is not UTF8. It was detected as ISO-8859-1 (Latin 1) and converted to UTF8 for display.
package com.example.genomicprivacy;
import java.util.ArrayList;
import FrameWork.RequestPatient;
import android.app.Fragment;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.os.AsyncTask;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ListView;
/**
* @author Serrano Kevin
* @author Weber Jeremy
*
*/
public class RequestPending extends Fragment {
/**
* View for show all the pending's request
*/
private ListView listPending;
/**
* List of all the pending's request
*/
private ArrayList<String> waitingRequest = new ArrayList<String>();
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// TODO Auto-generated method stub
View view = inflater.inflate(R.layout.fragment_request_pending,
container, false);
listPending = (ListView) view.findViewById(R.id.listViewRequestPending);
new GetRequestPending().execute();
return view;
}
/**
* Asynchronous task for retrieve from the server all the pending's request
*
* @author Serrano Kevin
* @author Weber Jeremy
*
*/
public class GetRequestPending extends
AsyncTask<Void, Void, ArrayList<String>> {
private ArrayList<RequestPatient> allRequest = new ArrayList<RequestPatient>();
@Override
protected ArrayList<String> doInBackground(Void... params) {
// TODO Auto-generated method stub
allRequest = ContextApp.getMu().checkNewRequest();
for (int i = 0; i < allRequest.size(); i++) {
if (allRequest.get(i).getFlag() == 0) {
waitingRequest.add(" • "+allRequest.get(i).getNameTest()+"\n Patient ID: "
+ allRequest.get(i).getId_p());
}
}
return waitingRequest;
}
@Override
protected void onPostExecute(ArrayList<String> waitingRequest) {
// TODO Auto-generated method stub
super.onPostExecute(waitingRequest);
listPending.setAdapter(new ArrayAdapter<String>(ContextApp
.getContext(), R.layout.listitem, waitingRequest));
listPending.setDivider(new ColorDrawable(Color.BLACK));
listPending.setDividerHeight(10);
}
}
}

Event Timeline