Android Open Source - clinicalguide Clinical Guide Activity






From Project

Back to project page clinicalguide.

License

The source code is released under:

Apache License

If you think the Android project clinicalguide listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package org.get.oxicam.clinicalguide;
/*from  www. j a  v  a 2  s. co  m*/
import java.io.File;

import org.ecemgroup.sharevitalsigns.library.ShareVitalSigns;
import org.get.oxicam.clinicalguide.ui.HomescreenFragment;
import org.get.oxicam.clinicalguide.ui.ListItemOnClickListener;
import org.get.oxicam.clinicalguide.xml.CGFormParser;
import org.get.oxicam.clinicalguide.xml.CGParser;
import org.get.oxicam.clinicalguide.xml.CGStatsParser;
import org.get.oxicam.clinicalguide.xml.data.User;

import android.content.Intent;
import android.os.Bundle;
import android.os.Environment;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.Toast;

public class ClinicalGuideActivity extends FragmentActivity {

       
    public static ShareVitalSigns sharevitals = new ShareVitalSigns(0);

    private CGParser mXmlParser;
    private CGFormParser mFormParser;
    private CGStatsParser mStatsParser;
  //  private ShareVitalSignResultsReceiver vitalSignReceiver;
    private User user;
    
    

    public void setXmlParser(CGParser xmlParser) {
  this.mXmlParser = xmlParser;
    }

    public User getUser() {
  return user;
    }

    private int mHomescreenId;
    private ListItemOnClickListener listItemListener;

    @Override
    public void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);

  mXmlParser = new CGParser(this);
  mFormParser = new CGFormParser(this);
  mStatsParser = new CGStatsParser(this);
  user = LoginActivity.getUser();

  getSupportFragmentManager().addOnBackStackChangedListener(
    new FragmentManager.OnBackStackChangedListener() {
        @Override
        public void onBackStackChanged() {
      int stackSize = getSupportFragmentManager()
        .getBackStackEntryCount();
      if (stackSize == 0) {
          // exit app
          finish();
      }
        }
    });

  mHomescreenId = setContent(new HomescreenFragment());
    }

    public CGParser getXmlParser() {
  return mXmlParser;
    }
    
    public CGFormParser getFormParser() {
  return mFormParser;
    }

    public CGStatsParser getStatsParser() {
  return mStatsParser; 
    }

    /**
     * Callback method that is called if a button in a ListView item is clicked.
     * Maybe a bit messy to have the listener method here instead of in the
     * corresponding fragment, but XML defined listener methods have to be in
     * the Activity.
     * 
     * @param v
     *            View that was clicked.
     */
    public void onListItemClick(View v) {
  if (listItemListener != null) {
      listItemListener.onListItemClick(v);
  }
    }

    /**
     * Displays a new Fragment. The previously displayed Fragment is added to
     * the back-stack. Fragments on the back-stack will show up again after
     * pressing the back button.
     * 
     * @param fragment
     *            The Fragment to display
     * @return The transaction ID.
     */
    public int setContent(Fragment fragment) {
  Log.d("Activity", "setContent: " + fragment.getClass().getName());

  if (fragment instanceof ListItemOnClickListener) {
      listItemListener = (ListItemOnClickListener) fragment;
  } else {
      listItemListener = null;
  }

  FragmentManager fm = getSupportFragmentManager();
  FragmentTransaction transaction = fm.beginTransaction();
  transaction.replace(android.R.id.content, fragment);
  transaction.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE);
  transaction.addToBackStack(null);
  return transaction.commit();
    }

    /**
     * Pops the entire fragment backstack to display the homescreen.
     */
    public void gotoHomescreen() {
  Log.d("Activity", "goto homescreen");
  FragmentManager fm = getSupportFragmentManager();
  fm.popBackStack(mHomescreenId, 0);
    }

    /**
     * Open a measurement app and request heart rate measurement.
     */
   /* public void measureHeartRate(ShareVitalSignsResultReceiver resultReceiver) {
      vitalSignReceiver = resultReceiver;
      startVitalSignAquisition(ShareVitalSigns.MEASURE_HR);

    }*/
    /**
     * Open a measurement app and request heart rate measurement.
     */
    /*public void measurePulseOx(ShareVitalSignsResultReceiver resultReceiver) {
      vitalSignReceiver = resultReceiver;
      startVitalSignAquisition(ShareVitalSigns.MEASURE_PO);

    }*/
    /**
     * Open a measurement app and request respiratory rate measurement.
     */
   /* public void measureRespiratoryRate(ShareVitalSignsResultReceiver resultReceiver) {
      vitalSignReceiver = resultReceiver;
      startVitalSignAquisition(ShareVitalSigns.MEASURE_RR);
        }*/

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
  getMenuInflater().inflate(R.menu.activity_clinical_guide_main, menu);
  return true;
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
  if (item.getItemId() == R.id.menu_home) {
      gotoHomescreen();
      return true;

  }
  return super.onOptionsItemSelected(item);
    }

    @Override
    public void onActivityResult(int requestCode, int resultCode, Intent data) {
  
      
    /*
     * To check and process the received data in the Intent, execute 
     * ShareVitals_get_results(int requestCode, int resultCode, Intent data) it will return "true" if 
     * the requested vital sign was obtained, "false" otherwise
     */
      if (sharevitals.getResults(requestCode, resultCode,  data)){ //process Intent data
        
          //Do something here if necessary
      
      } else {
        Toast.makeText(
                      this,
                      String.format("WARNING: No valid vital sign obtained"),
                      Toast.LENGTH_SHORT).show();
      }
    
      
      
    }


    /**
     * Returns the base directory for the xml
     * TODO use FileUtils function
     */
    public static File getClinicalGuideDirectory() {
  File f = new File(Environment.getExternalStorageDirectory()
    .getAbsolutePath() + "/ClinicalGuide");
  // create directory if it does not exist
  f.mkdirs();
  return f;
    }

    /*
    public interface VitalSignResultReceiver {
  public void onVitalSignResult(float vs1, float vs2);
    }*/
}




Java Source Code List

.PatientDetailsDataSource.java
org.get.oxicam.clinicalguide.ClinicalGuideActivity.java
org.get.oxicam.clinicalguide.FileUtils.java
org.get.oxicam.clinicalguide.LoginActivity.java
org.get.oxicam.clinicalguide.db.DatabaseHelper.java
org.get.oxicam.clinicalguide.db.Database.java
org.get.oxicam.clinicalguide.db.FollowupDataSource.java
org.get.oxicam.clinicalguide.db.FollowupDetails.java
org.get.oxicam.clinicalguide.db.FollowupSQLHelper.java
org.get.oxicam.clinicalguide.db.HistoryDetailsDataSource.java
org.get.oxicam.clinicalguide.db.HistoryDetailsSQLHelper.java
org.get.oxicam.clinicalguide.db.HistoryDetails.java
org.get.oxicam.clinicalguide.db.PatientDetailsSQLHelper.java
org.get.oxicam.clinicalguide.db.PatientDetails.java
org.get.oxicam.clinicalguide.db.RegistrationValidator.java
org.get.oxicam.clinicalguide.db.Validator.java
org.get.oxicam.clinicalguide.encryption.Encryption.java
org.get.oxicam.clinicalguide.ui.AnswersReviewFragment.java
org.get.oxicam.clinicalguide.ui.AssessmentDetailFragment.java
org.get.oxicam.clinicalguide.ui.ClassificationFragment.java
org.get.oxicam.clinicalguide.ui.ClassificationListItem.java
org.get.oxicam.clinicalguide.ui.DatePickerFragment.java
org.get.oxicam.clinicalguide.ui.ExportFragment.java
org.get.oxicam.clinicalguide.ui.ExportscreenListItem.java
org.get.oxicam.clinicalguide.ui.FollowUpFragment.java
org.get.oxicam.clinicalguide.ui.FormScreenFragment.java
org.get.oxicam.clinicalguide.ui.HomescreenFragment.java
org.get.oxicam.clinicalguide.ui.HomescreenListItem.java
org.get.oxicam.clinicalguide.ui.ListItemOnClickListener.java
org.get.oxicam.clinicalguide.ui.MainSymptomFragment.java
org.get.oxicam.clinicalguide.ui.MainSymptomListItem.java
org.get.oxicam.clinicalguide.ui.NumberTickerValueChangeListener.java
org.get.oxicam.clinicalguide.ui.NumberTicker.java
org.get.oxicam.clinicalguide.ui.PatientDetailsFragment.java
org.get.oxicam.clinicalguide.ui.PatientHistoryFragment.java
org.get.oxicam.clinicalguide.ui.PatientsFragment.java
org.get.oxicam.clinicalguide.ui.QuestionListItem.java
org.get.oxicam.clinicalguide.ui.QuestionnaireFragment.java
org.get.oxicam.clinicalguide.ui.StatScreenFragment.java
org.get.oxicam.clinicalguide.ui.SummaryScreenFragment.java
org.get.oxicam.clinicalguide.ui.TextViewCustomFont.java
org.get.oxicam.clinicalguide.ui.TreatmentConfirmationDialog.java
org.get.oxicam.clinicalguide.ui.TreatmentFragment.java
org.get.oxicam.clinicalguide.ui.TreatmentListItem.java
org.get.oxicam.clinicalguide.ui.ViewDetailScreenFragment.java
org.get.oxicam.clinicalguide.xml.CGFormParser.java
org.get.oxicam.clinicalguide.xml.CGParser.java
org.get.oxicam.clinicalguide.xml.CGStatsParser.java
org.get.oxicam.clinicalguide.xml.DateHelper.java
org.get.oxicam.clinicalguide.xml.FormGenerator.java
org.get.oxicam.clinicalguide.xml.ParserHelper.java
org.get.oxicam.clinicalguide.xml.StatsGenerator.java
org.get.oxicam.clinicalguide.xml.XMLHandler.java
org.get.oxicam.clinicalguide.xml.data.AbstractAnswer.java
org.get.oxicam.clinicalguide.xml.data.Annotation.java
org.get.oxicam.clinicalguide.xml.data.AnswerValidator.java
org.get.oxicam.clinicalguide.xml.data.Answer.java
org.get.oxicam.clinicalguide.xml.data.Assessment.java
org.get.oxicam.clinicalguide.xml.data.CombinedAnswer.java
org.get.oxicam.clinicalguide.xml.data.FollowUp.java
org.get.oxicam.clinicalguide.xml.data.FormQuery.java
org.get.oxicam.clinicalguide.xml.data.Info.java
org.get.oxicam.clinicalguide.xml.data.Option.java
org.get.oxicam.clinicalguide.xml.data.PatientAttribute.java
org.get.oxicam.clinicalguide.xml.data.Question.java
org.get.oxicam.clinicalguide.xml.data.Questionnaire.java
org.get.oxicam.clinicalguide.xml.data.SimpleAnswer.java
org.get.oxicam.clinicalguide.xml.data.Symptom.java
org.get.oxicam.clinicalguide.xml.data.TreatmentAction.java
org.get.oxicam.clinicalguide.xml.data.Treatment.java
org.get.oxicam.clinicalguide.xml.data.User.java
org.get.oxicam.clinicalguide.xml.forms.FormCell.java
org.get.oxicam.clinicalguide.xml.forms.FormColumn.java
org.get.oxicam.clinicalguide.xml.forms.FormDuration.java
org.get.oxicam.clinicalguide.xml.forms.Form.java
org.get.oxicam.clinicalguide.xml.query.QueryHelper.java
org.get.oxicam.clinicalguide.xml.query.QueryResultCell.java
org.get.oxicam.clinicalguide.xml.query.QueryResultRow.java
org.get.oxicam.clinicalguide.xml.query.QueryResultTable.java
org.get.oxicam.clinicalguide.xml.stats.AbstractStatsQuestion.java
org.get.oxicam.clinicalguide.xml.stats.StatsAnswerHolder.java
org.get.oxicam.clinicalguide.xml.stats.StatsColumnCompare.java
org.get.oxicam.clinicalguide.xml.stats.StatsComparatorOperator.java
org.get.oxicam.clinicalguide.xml.stats.StatsCompareConstraint.java
org.get.oxicam.clinicalguide.xml.stats.StatsConstraint.java
org.get.oxicam.clinicalguide.xml.stats.StatsQuestionAverage.java
org.get.oxicam.clinicalguide.xml.stats.StatsQuestionCount.java
org.get.oxicam.clinicalguide.xml.stats.StatsQuestionExtrema.java
org.get.oxicam.clinicalguide.xml.stats.StatsQuestionFactory.java
org.get.oxicam.clinicalguide.xml.stats.StatsQuestionList.java
org.get.oxicam.clinicalguide.xml.stats.StatsQuestionPercentage.java
org.get.oxicam.clinicalguide.xml.stats.StatsQuestionRatio.java
org.get.oxicam.clinicalguide.xml.stats.StatsSubject.java
org.get.oxicam.clinicalguide.xml.stats.StatsTimespan.java
org.get.oxicam.clinicalguide.xml.stats.Stats.java