Search in sources :

Example 36 with Survey

use of org.eyeseetea.malariacare.data.database.model.Survey in project pictureapp by EyeSeeTea.

the class DynamicTabAdapterStrategy method initSurveys.

@Override
public void initSurveys(boolean readOnly) {
    if (readOnly) {
        Survey malariaSurvey = Session.getMalariaSurvey();
        Session.setStockSurvey(Survey.getStockSurveyWithEventDate(malariaSurvey.getEventDate()));
    }
}
Also used : Survey(org.eyeseetea.malariacare.data.database.model.Survey)

Example 37 with Survey

use of org.eyeseetea.malariacare.data.database.model.Survey in project pictureapp by EyeSeeTea.

the class DashboardActivityStrategy method beforeExit.

@Override
public boolean beforeExit(boolean isBackPressed) {
    Survey malariaSurvey = Session.getMalariaSurvey();
    boolean isMalariaBackPressed = beforeExitSurvey(isBackPressed, malariaSurvey);
    Survey stockSurvey = Session.getStockSurvey();
    boolean isStockBackPressed = beforeExitSurvey(isBackPressed, stockSurvey);
    if (!isMalariaBackPressed || !isStockBackPressed) {
        return false;
    }
    return isBackPressed;
}
Also used : Survey(org.eyeseetea.malariacare.data.database.model.Survey)

Example 38 with Survey

use of org.eyeseetea.malariacare.data.database.model.Survey in project pictureapp by EyeSeeTea.

the class DashboardActivityStrategy method newSurvey.

@Override
public void newSurvey(Activity activity) {
    Program myanmarProgram = Program.findByUID(activity.getString(R.string.malariaProgramUID));
    Program stockProgram = Program.findByUID(activity.getString(R.string.stockProgramUID));
    // Put new survey in session
    Survey survey = new Survey(null, myanmarProgram, Session.getUser());
    survey.save();
    Session.setMalariaSurvey(survey);
    Survey stockSurvey = new Survey(null, stockProgram, Session.getUser(), Constants.SURVEY_ISSUE);
    stockSurvey.setEventDate(//asociate the malaria survey to the stock survey
    survey.getEventDate());
    stockSurvey.save();
    Session.setStockSurvey(stockSurvey);
    prepareLocationListener(activity, survey);
}
Also used : Survey(org.eyeseetea.malariacare.data.database.model.Survey) Program(org.eyeseetea.malariacare.data.database.model.Program)

Example 39 with Survey

use of org.eyeseetea.malariacare.data.database.model.Survey in project pictureapp by EyeSeeTea.

the class HistoricReceiptBalanceAdapter method onBindViewHolder.

@Override
public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
    if (holder instanceof RowViewHolder) {
        RowViewHolder rowViewHolder = (RowViewHolder) holder;
        Survey survey = mSurveys.get(position - 1);
        putValuesToRow(rowViewHolder, survey);
    }
    if (holder instanceof HeaderViewHolder) {
        HeaderViewHolder headerViewHolder = (HeaderViewHolder) holder;
        putValuesToHeader(headerViewHolder);
    }
}
Also used : Survey(org.eyeseetea.malariacare.data.database.model.Survey)

Aggregations

Survey (org.eyeseetea.malariacare.data.database.model.Survey)39 Date (java.util.Date)8 Intent (android.content.Intent)7 Value (org.eyeseetea.malariacare.data.database.model.Value)6 ArrayList (java.util.ArrayList)4 Program (org.eyeseetea.malariacare.data.database.model.Program)3 Question (org.eyeseetea.malariacare.data.database.model.Question)3 Session.getMalariaSurvey (org.eyeseetea.malariacare.data.database.utils.Session.getMalariaSurvey)3 Option (org.eyeseetea.malariacare.data.database.model.Option)2 OrgUnit (org.eyeseetea.malariacare.data.database.model.OrgUnit)2 EventExtended (org.eyeseetea.malariacare.data.sync.importer.models.EventExtended)2 ImportSummaryErrorException (org.eyeseetea.malariacare.domain.exception.ImportSummaryErrorException)2 DialogInterface (android.content.DialogInterface)1 NonNull (android.support.annotation.NonNull)1 View (android.view.View)1 ListView (android.widget.ListView)1 TableRow (android.widget.TableRow)1 Calendar (java.util.Calendar)1 HashSet (java.util.HashSet)1 CompositeScore (org.eyeseetea.malariacare.data.database.model.CompositeScore)1