Search in sources :

Example 11 with ESMFactory

use of com.aware.ui.esms.ESMFactory in project aware-client by denzilferreira.

the class TestESM method testESMDate.

private void testESMDate(Context context) {
    try {
        ESMFactory factory = new ESMFactory();
        ESM_Date date = new ESM_Date();
        date.setTitle("ESM: Date");
        date.setInstructions("On which day did this occur?");
        date.setSubmitButton("OK");
        // don't use calendar view, use date picker
        date.setCalendar(false);
        factory.addESM(date);
        ESM.queueESM(context, factory.build());
    } catch (JSONException e) {
        e.printStackTrace();
    }
}
Also used : ESMFactory(com.aware.ui.esms.ESMFactory) ESM_Date(com.aware.ui.esms.ESM_Date) JSONException(org.json.JSONException)

Example 12 with ESMFactory

use of com.aware.ui.esms.ESMFactory in project aware-client by denzilferreira.

the class TestESM method testDateTime.

private void testDateTime(Context context) {
    ESMFactory factory = new ESMFactory();
    try {
        ESM_DateTime q1 = new ESM_DateTime();
        q1.setTitle("Date and time").setInstructions("When did this happen?").setSubmitButton("OK").setTrigger("AWARE Test");
        factory.addESM(q1);
        ESM.queueESM(context, factory.build());
    } catch (JSONException e) {
        e.printStackTrace();
    }
}
Also used : ESMFactory(com.aware.ui.esms.ESMFactory) ESM_DateTime(com.aware.ui.esms.ESM_DateTime) JSONException(org.json.JSONException)

Example 13 with ESMFactory

use of com.aware.ui.esms.ESMFactory in project aware-client by denzilferreira.

the class TestESM method testFlow.

private void testFlow(Context context) {
    ESMFactory factory = new ESMFactory();
    try {
        ESM_PAM q1 = new ESM_PAM();
        q1.setTitle("Your mood").setInstructions("Choose the closest to how you feel right now.").setSubmitButton("Thanks!");
        ESM_Radio q2 = new ESM_Radio();
        q2.addRadio("Eating").addRadio("Working").addRadio("Not alone").setTitle("Why is that?").setSubmitButton("Thanks!");
        ESM_QuickAnswer q0 = new ESM_QuickAnswer();
        q0.addQuickAnswer("Yes").addQuickAnswer("No").setTitle("Is this a good time to answer?").addFlow("Yes", q1.build()).addFlow("No", q2.build());
        factory.addESM(q0);
        ESM.queueESM(context, factory.build());
    } catch (JSONException e) {
        e.printStackTrace();
    }
}
Also used : ESMFactory(com.aware.ui.esms.ESMFactory) ESM_PAM(com.aware.ui.esms.ESM_PAM) ESM_QuickAnswer(com.aware.ui.esms.ESM_QuickAnswer) JSONException(org.json.JSONException) ESM_Radio(com.aware.ui.esms.ESM_Radio)

Example 14 with ESMFactory

use of com.aware.ui.esms.ESMFactory in project aware-client by denzilferreira.

the class TestESM method testTimeoutQueue.

private void testTimeoutQueue(Context context) {
    ESMFactory factory = new ESMFactory();
    try {
        ESM_Freetext esmFreetext = new ESM_Freetext();
        esmFreetext.setTitle("Freetext").setTrigger("test").setExpirationThreshold(0).setNotificationTimeout(10).setSubmitButton("OK").setInstructions("Freetext ESM");
        ESM_Checkbox esmCheckbox = new ESM_Checkbox();
        esmCheckbox.addCheck("Check 1").addCheck("Check 2").addCheck("Other").setTitle("Checkbox").setTrigger("test").setExpirationThreshold(0).setNotificationTimeout(10).setSubmitButton("OK").setInstructions("Checkbox ESM");
        ESM_Likert esmLikert = new ESM_Likert();
        esmLikert.setLikertMax(5).setLikertMaxLabel("Great").setLikertMinLabel("Poor").setLikertStep(1).setTitle("Likert").setInstructions("Likert ESM").setTrigger("test").setExpirationThreshold(0).setNotificationTimeout(10).setSubmitButton("OK");
        ESM_QuickAnswer esmQuickAnswer = new ESM_QuickAnswer();
        esmQuickAnswer.addQuickAnswer("Yes").addQuickAnswer("No").setTrigger("test").setExpirationThreshold(0).setNotificationTimeout(10).setInstructions("Quick Answers ESM");
        ESM_Radio esmRadio = new ESM_Radio();
        esmRadio.addRadio("Radio 1").addRadio("Radio 2").setTitle("Radios").setInstructions("Radios ESM").setExpirationThreshold(0).setNotificationTimeout(10).setSubmitButton("OK");
        ESM_Scale esmScale = new ESM_Scale();
        esmScale.setScaleMax(100).setScaleMin(0).setScaleStart(50).setScaleMaxLabel("Perfect").setScaleMinLabel("Poor").setScaleStep(10).setTitle("Scale").setInstructions("Scale ESM").setExpirationThreshold(0).setNotificationTimeout(10).setSubmitButton("OK");
        factory.addESM(esmFreetext);
        factory.addESM(esmCheckbox);
        factory.addESM(esmLikert);
        factory.addESM(esmQuickAnswer);
        factory.addESM(esmRadio);
        factory.addESM(esmScale);
        ESM.queueESM(context, factory.build());
    } catch (JSONException e) {
        e.printStackTrace();
    }
}
Also used : ESMFactory(com.aware.ui.esms.ESMFactory) ESM_Freetext(com.aware.ui.esms.ESM_Freetext) ESM_QuickAnswer(com.aware.ui.esms.ESM_QuickAnswer) ESM_Scale(com.aware.ui.esms.ESM_Scale) ESM_Likert(com.aware.ui.esms.ESM_Likert) JSONException(org.json.JSONException) ESM_Checkbox(com.aware.ui.esms.ESM_Checkbox) ESM_Radio(com.aware.ui.esms.ESM_Radio)

Aggregations

ESMFactory (com.aware.ui.esms.ESMFactory)14 JSONException (org.json.JSONException)14 ESM_Radio (com.aware.ui.esms.ESM_Radio)5 ESM_Checkbox (com.aware.ui.esms.ESM_Checkbox)4 ESM_PAM (com.aware.ui.esms.ESM_PAM)4 ESM_QuickAnswer (com.aware.ui.esms.ESM_QuickAnswer)4 ESM_Freetext (com.aware.ui.esms.ESM_Freetext)3 ESM_Likert (com.aware.ui.esms.ESM_Likert)3 ESM_Scale (com.aware.ui.esms.ESM_Scale)3 Cursor (android.database.Cursor)2 ESM_DateTime (com.aware.ui.esms.ESM_DateTime)2 ESM_Number (com.aware.ui.esms.ESM_Number)2 ESM_Question (com.aware.ui.esms.ESM_Question)2 JSONObject (org.json.JSONObject)2 PendingIntent (android.app.PendingIntent)1 ESM_Date (com.aware.ui.esms.ESM_Date)1 ESM_Web (com.aware.ui.esms.ESM_Web)1 Scheduler (com.aware.utils.Scheduler)1 JSONArray (org.json.JSONArray)1