Page MenuHomec4science

RequestRefused.java
No OneTemporary

File Metadata

Created
Tue, Jan 7, 00:19

RequestRefused.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 RequestRefused extends Fragment {
/**
* View for show all the refused's request
*/
private ListView listRefused;
/**
* List of all the refused's request
*/
private ArrayList<String> refusedRequest = 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_refused,
container, false);
listRefused = (ListView) view.findViewById(R.id.listViewRequestRefused);
new GetRequestRefused().execute();
return view;
}
/**
* Asynchronous task for retrieve from the server all the refused's request
* @author Serrano Kevin
* @author Weber Jeremy
*
*/
public class GetRequestRefused 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() == 2) {
refusedRequest.add(" • "+ allRequest.get(i).getNameTest() + "\n Patient ID: "
+ allRequest.get(i).getId_r());
}
}
return refusedRequest;
}
@Override
protected void onPostExecute(ArrayList<String> refusedRequest) {
// TODO Auto-generated method stub
super.onPostExecute(refusedRequest);
if (refusedRequest.isEmpty()) {
refusedRequest.add("No refused request yet!");
}
listRefused.setAdapter(new ArrayAdapter<String>(ContextApp
.getContext(), R.layout.listitem, refusedRequest));
listRefused.setDivider(new ColorDrawable(Color.BLACK));
listRefused.setDividerHeight(10);
}
}
}

Event Timeline