Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F98967939
TestSelectionActivity.java
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Sat, Jan 18, 02:58
Size
7 KB
Mime Type
text/x-java
Expires
Mon, Jan 20, 02:58 (2 d)
Engine
blob
Format
Raw Data
Handle
23676146
Attached To
R3229 Genome Privacy - SHCS App
TestSelectionActivity.java
View Options
package
ch.epfl.pharma
;
//import java.util.ArrayList;
//import java.util.HashMap;
//import java.util.Map;
//
//import ch.epfl.pharma.widget.HeaderListAdapter;
import
java.io.File
;
import
java.util.LinkedList
;
import
utils.ClientProperties
;
import
ch.epfl.pharma.database.DatabaseHelper
;
import
ch.epfl.pharma.framework.Test
;
import
framework.MedUnit
;
import
android.app.Activity
;
import
android.content.Intent
;
//import android.os.Bundle;
//import android.util.Log;
//import android.view.LayoutInflater;
//import android.view.Menu;
//import android.view.MenuItem;
//import android.view.View;
//import android.view.ViewGroup;
//import android.widget.AdapterView;
//import android.widget.ArrayAdapter;
//import android.widget.BaseAdapter;
//import android.widget.CheckBox;
//import android.widget.ListView;
//import android.widget.TextView;
//import android.widget.Toast;
import
android.os.Bundle
;
public
class
TestSelectionActivity
extends
Activity
{
private
DatabaseHelper
mDbHelper
;
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
Intent
intent
=
getIntent
();
long
patientId
=
intent
.
getLongExtra
(
ManagePatientsActivity
.
EXTRA_PATIENT_ID
,
0
L
);
// instantiate new database handler
String
dbName
=
getResources
().
getString
(
R
.
string
.
database_name
);
mDbHelper
=
new
DatabaseHelper
(
this
,
dbName
);
mDbHelper
.
openDatabase
();
// fetch available tests
LinkedList
<
Test
>
tests
=
mDbHelper
.
getTests
();
// display list of tests
ClientProperties
props
=
getClientProperties
();
MedUnit
medUnit
=
new
MedUnit
(
props
,
0
);
// TODO: display list of tests as checkboxes
// run test
}
private
ClientProperties
getClientProperties
()
{
String
ipSpu
=
getResources
().
getString
(
R
.
string
.
ip_server
);
int
portSpu
=
getResources
().
getInteger
(
R
.
integer
.
port_server
);
String
reverseTableName
=
getResources
().
getString
(
R
.
string
.
reverse_table_name
);
File
reverseTableLoc
=
new
File
(
getFilesDir
(),
reverseTableName
);
int
shiftVal
=
getResources
().
getInteger
(
R
.
integer
.
shift_val
);
int
precision
=
getResources
().
getInteger
(
R
.
integer
.
precision
);
ClientProperties
props
=
new
ClientProperties
(
ipSpu
,
portSpu
,
reverseTableLoc
,
shiftVal
,
precision
);
return
props
;
}
// private final static String TAG = TestSelectionActivity.class.getName();
//
// public final static String ITEM_TITLE = "title";
// public final static String ITEM_CAPTION = "caption";
//
// // section headers
// private final String[] days = new String[] {"Mon", "Tue", "Wed", "Thur", "Fri"};
//
// // menu ListView
// private ListView addJournalEntryItem;
//
// // Adapter for ListView contents
// private HeaderListAdapter adapter;
//
// // ListView contents
// private ListView journalListView;
//
// public Map<String, String> createItem(String title, String caption) {
// Map<String, String> item = new HashMap<String, String>();
// item.put(ITEM_TITLE, title);
// item.put(ITEM_CAPTION, caption);
// return item;
// }
//
// @Override
// protected void onCreate(Bundle savedInstanceState) {
// super.onCreate(savedInstanceState);
// setContentView(R.layout.activity_test_selection);
//
// final ArrayAdapter<String> journalEntryAdapter = new ArrayAdapter<String>(this, R.layout.add_journalentry_menuitem, new String[]{"Add Journal Entry"});
//
// // AddJournalEntryItem
// addJournalEntryItem = (ListView) this.findViewById(R.id.add_journalentry_menuitem);
// addJournalEntryItem.setAdapter(journalEntryAdapter);
// addJournalEntryItem.setOnItemClickListener(new AdapterView.OnItemClickListener()
// {
// @Override
// public void onItemClick(AdapterView<?> parent, View view, int position, long duration)
// {
// String item = journalEntryAdapter.getItem(position);
// Log.d(TAG, item);
// }
// });
//
// // Create the ListView Adapter
// adapter = new HeaderListAdapter(this);
//
// // Add Sections
// for (int i = 0; i < days.length; i++)
// {
// ArrayList<CategoryList> categoryLists = new ArrayList<CategoryList>();
// for(int j = 0; j < 10; j++)
// {
// CategoryList categoryList = new CategoryList();
// categoryList.setSelected(false);
// categoryList.setTitle(days[i] + j);
// categoryLists.add(categoryList);
// }
// ChildBaseAdpater baseAdpater = new ChildBaseAdpater(categoryLists);
// adapter.addSection(days[i], baseAdpater);
// }
//
// // Get a reference to the ListView holder
// journalListView = (ListView) this.findViewById(R.id.list_journal);
//
// // Set the adapter on the ListView holder
// journalListView.setAdapter(adapter);
//
// // Listen for Click events
// journalListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
// @Override
// public void onItemClick(AdapterView<?> parent, View view, int position, long duration)
// {
// String item = (String) adapter.getItem(position);
// Toast.makeText(getApplicationContext(), item, Toast.LENGTH_SHORT).show();
// }
// });
// }
//
//// @Override
//// public void refreshSection(String sectionName) {
//// if(adapter.sections.get(sectionName) != null) {
//// ((ChildBaseAdpater)(adapter.sections.get(sectionName))).checkCompleteSection();
//// adapter.notifyDataSetChanged();
//// }
//// }
//
// @Override
// public boolean onCreateOptionsMenu(Menu menu) {
// // Inflate the menu; this adds items to the action bar if it is present.
// getMenuInflater().inflate(R.menu.test_selection, menu);
// return true;
// }
//
// @Override
// public boolean onOptionsItemSelected(MenuItem item) {
// // Handle action bar item clicks here. The action bar will
// // automatically handle clicks on the Home/Up button, so long
// // as you specify a parent activity in AndroidManifest.xml.
// int id = item.getItemId();
// if (id == R.id.action_settings) {
// return true;
// }
// return super.onOptionsItemSelected(item);
// }
//
// private class ChildBaseAdpater extends BaseAdapter {
//
// ArrayList<CategoryList> list = null;
// ChildBaseAdpater( ArrayList<CategoryList> categoryLists) {
// this.list = categoryLists;
// }
//
// @Override
// public int getCount() {
// return list.size();
// }
//
// @Override
// public Object getItem(int position) {
// return null;
// }
//
// @Override
// public long getItemId(int position) {
// return 0;
// }
//
// @Override
// public View getView(int position, View convertView, ViewGroup parent) {
// ViewHolder viewHolder = null;
// if (null == convertView)
// {
// viewHolder = new ViewHolder();
// LayoutInflater inflater = (LayoutInflater) getSystemService(LAYOUT_INFLATER_SERVICE);
// convertView = inflater.inflate(R.layout.item_child_test_selection, null);
// viewHolder.checkBox = (CheckBox) convertView.findViewById(R.id.checkbox_item_test_selection);
// viewHolder.textView = (TextView) convertView.findViewById(R.id.label_item_test_selection);
// convertView.setTag(viewHolder);
// }
// else
// viewHolder = (ViewHolder) convertView.getTag();
//
// viewHolder.checkBox.setChecked(list.get(position).isSelected());
// viewHolder.textView.setText(list.get(position).getTitle());
//
// return convertView;
// }
//
// private class ViewHolder
// {
// CheckBox checkBox;
// TextView textView;
// }
// private void checkCompleteSection()
// {
// for(CategoryList categoryList : this.list)
// categoryList.setSelected(true);
// }
// }
//
// private class CategoryList {
// private boolean selected;
// private String title;
//
// public CategoryList() {
// this.selected = false;
// }
//
// public boolean isSelected() {
// return selected;
// }
//
// public void setSelected(boolean selected) {
// this.selected = selected;
// }
//
// public String getTitle() {
// return title;
// }
//
// public void setTitle(String title) {
// this.title = title;
// }
//
// }
}
Event Timeline
Log In to Comment