Search in sources :

Example 1 with ESM_PAM

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

the class TestESM method testESMS.

private void testESMS(Context context) {
    ESMFactory factory = new ESMFactory();
    try {
        ESM_Freetext esmFreetext = new ESM_Freetext();
        esmFreetext.setTitle("Freetext").setTrigger("test").setReplaceQueue(true).setSubmitButton("OK").setInstructions("Freetext ESM");
        ESM_Checkbox esmCheckbox = new ESM_Checkbox();
        esmCheckbox.addCheck("Check 1").addCheck("Check 2").addCheck("Other").setTitle("Checkbox").setTrigger("test").setSubmitButton("OK").setInstructions("Checkbox ESM");
        ESM_Likert esmLikert = new ESM_Likert();
        esmLikert.setLikertMax(7).setLikertMaxLabel("Great").setLikertMinLabel("Poor").setLikertStep(1).setTitle("Likert 3").setInstructions("Likert ESM").setTrigger("test").setSubmitButton("OK");
        ESM_QuickAnswer esmQuickAnswer = new ESM_QuickAnswer();
        esmQuickAnswer.addQuickAnswer("Yes").addQuickAnswer("No").setTrigger("test").setInstructions("Quick Answers ESM");
        ESM_Radio esmRadio = new ESM_Radio();
        esmRadio.addRadio("Radio 1").addRadio("Radio 2").setTitle("Radios").setInstructions("Radios ESM").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").setSubmitButton("OK");
        ESM_DateTime esmDate = new ESM_DateTime();
        esmDate.setTitle("Date and Time").setTrigger("AWARE Test").setInstructions("Specify date and time").setSubmitButton("OK");
        ESM_PAM esmPAM = new ESM_PAM();
        esmPAM.setTitle("PAM").setInstructions("Pick the closest to how you feel right now.").setSubmitButton("OK").setTrigger("AWARE Test").setAppIntegration("fourtwentystudy://");
        factory.addESM(esmFreetext);
        factory.addESM(esmCheckbox);
        factory.addESM(esmLikert);
        factory.addESM(esmQuickAnswer);
        factory.addESM(esmRadio);
        factory.addESM(esmScale);
        factory.addESM(esmPAM);
        factory.addESM(esmDate);
        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_DateTime(com.aware.ui.esms.ESM_DateTime) ESM_QuickAnswer(com.aware.ui.esms.ESM_QuickAnswer) ESM_Scale(com.aware.ui.esms.ESM_Scale) ESM_PAM(com.aware.ui.esms.ESM_PAM) 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)

Example 2 with ESM_PAM

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

the class TestESM method testPAM.

private void testPAM(Context context) {
    ESMFactory factory = new ESMFactory();
    try {
        ESM_PAM q1 = new ESM_PAM();
        q1.setTitle("PAM").setInstructions("Pick the closest to how you feel right now.").setSubmitButton("OK").setNotificationTimeout(10).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_PAM(com.aware.ui.esms.ESM_PAM) JSONException(org.json.JSONException)

Example 3 with ESM_PAM

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

the class TestScheduler method testESMTrigger.

private void testESMTrigger(Context c) {
    try {
        ESM_PAM esmPAM = new ESM_PAM();
        esmPAM.setTitle("PAM").setInstructions("Pick the closest to how you feel right now.").setSubmitButton("OK").setNotificationTimeout(10).setTrigger("AWARE Test");
        ESMFactory factory = new ESMFactory();
        factory.addESM(esmPAM);
        Scheduler.Schedule contextual = new Scheduler.Schedule("test_contextual");
        contextual.addContext(Screen.ACTION_AWARE_SCREEN_ON);
        contextual.setActionType(Scheduler.ACTION_TYPE_BROADCAST);
        contextual.setActionIntentAction(ESM.ACTION_AWARE_QUEUE_ESM);
        contextual.addActionExtra(ESM.EXTRA_ESM, factory.build());
        Scheduler.saveSchedule(c, contextual);
    } catch (JSONException e) {
        e.printStackTrace();
    }
}
Also used : ESMFactory(com.aware.ui.esms.ESMFactory) ESM_PAM(com.aware.ui.esms.ESM_PAM) Scheduler(com.aware.utils.Scheduler) JSONException(org.json.JSONException)

Example 4 with ESM_PAM

use of com.aware.ui.esms.ESM_PAM 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)

Aggregations

ESMFactory (com.aware.ui.esms.ESMFactory)4 ESM_PAM (com.aware.ui.esms.ESM_PAM)4 JSONException (org.json.JSONException)4 ESM_QuickAnswer (com.aware.ui.esms.ESM_QuickAnswer)2 ESM_Radio (com.aware.ui.esms.ESM_Radio)2 ESM_Checkbox (com.aware.ui.esms.ESM_Checkbox)1 ESM_DateTime (com.aware.ui.esms.ESM_DateTime)1 ESM_Freetext (com.aware.ui.esms.ESM_Freetext)1 ESM_Likert (com.aware.ui.esms.ESM_Likert)1 ESM_Scale (com.aware.ui.esms.ESM_Scale)1 Scheduler (com.aware.utils.Scheduler)1