Skip to content

Commit ba2fab2

Browse files
authored
Merge pull request #81 from cientopolis/development
Development
2 parents a2cae33 + 21ee5b6 commit ba2fab2

161 files changed

Lines changed: 2780 additions & 591 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

SamplersConfig.json

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
"url" : "http://192.168.1.10/samplers/upload.php",
1212
"paramName" : "sample"
1313
},
14-
"googleMaps_API_KEY" : "AIzaSyBSdAX453WDiPJmPotF5akUQNQw_W_MzJ4"
14+
"googleMaps_API_KEY" : "AIzaSyBSdAX453WDiPJmPotF5akUQNQw_W_MzJ4",
15+
"mainHelpFileName" : "mainhelp.html"
1516
} ,
1617

1718
"workflow": {
@@ -27,7 +28,8 @@
2728
"id":2,
2829
"type" : "Location",
2930
"text" : "Please, positionate the sample on the map",
30-
"nextStepId": 3
31+
"nextStepId": 3,
32+
"helpFileName" : "locationhelp.html"
3133
},
3234
{
3335
"id":3,
@@ -85,7 +87,8 @@
8587
"id" : 5,
8688
"type" : "Photo",
8789
"text" : "Take a photo of your cat",
88-
"nextStepId": 6
90+
"nextStepId": 6,
91+
"helpFileName" : "photohelp.html"
8992
},
9093
{
9194
"id" : 6,
@@ -106,7 +109,13 @@
106109
"sampleText" : "your comments",
107110
"inputType" : "text",
108111
"maxLength" : 50,
109-
"optional" : true
112+
"optional" : true,
113+
"nextStepId": 9
114+
},
115+
{
116+
"id" : 9,
117+
"type" : "Sound",
118+
"text" : "Please, record the sound"
110119
}
111120
]
112121
}

build.gradle

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@
33
buildscript {
44
repositories {
55
jcenter()
6+
google()
67
}
78
dependencies {
8-
classpath 'com.android.tools.build:gradle:2.3.1'
9+
classpath 'com.android.tools.build:gradle:3.0.1'
910

1011
// NOTE: Do not place your application dependencies here; they belong
1112
// in the individual module build.gradle files
@@ -15,6 +16,7 @@ buildscript {
1516
allprojects {
1617
repositories {
1718
jcenter()
19+
google()
1820
}
1921
}
2022

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
#Tue Mar 07 17:09:25 GMT-03:00 2017
1+
#Wed Nov 08 00:46:13 GMT-03:00 2017
22
distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip

sampleApplication/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ apply plugin: 'com.android.application'
22

33
android {
44
compileSdkVersion 24
5-
buildToolsVersion '25.0.0'
5+
buildToolsVersion '26.0.2'
66

77
defaultConfig {
88
applicationId "org.cientopolis.sampleapplication"

sampleApplication/src/main/AndroidManifest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<activity
1212
android:name="MyMainSamplersActivity"
1313
android:label="@string/app_name"
14-
android:theme="@style/AppTheme">
14+
android:theme="@style/SamplersFrameworkAppTheme">
1515
<intent-filter>
1616
<action android:name="android.intent.action.MAIN" />
1717

sampleApplication/src/main/java/org/cientopolis/sampleapplication/MyMainSamplersActivity.java

Lines changed: 39 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,19 @@
22

33
import android.os.Bundle;
44

5-
import org.cientopolis.samplers.model.InformationStep;
6-
import org.cientopolis.samplers.model.InsertDateStep;
7-
import org.cientopolis.samplers.model.InsertTimeStep;
8-
import org.cientopolis.samplers.model.MultipleSelectStep;
9-
import org.cientopolis.samplers.model.PhotoStep;
10-
import org.cientopolis.samplers.model.SelectOneOption;
11-
import org.cientopolis.samplers.model.SelectOneStep;
12-
import org.cientopolis.samplers.model.MultipleSelectOption;
13-
import org.cientopolis.samplers.model.Step;
14-
import org.cientopolis.samplers.model.Workflow;
5+
import org.cientopolis.samplers.framework.information.InformationStep;
6+
import org.cientopolis.samplers.framework.insertDate.InsertDateStep;
7+
import org.cientopolis.samplers.framework.insertText.InsertTextStep;
8+
import org.cientopolis.samplers.framework.insertTime.InsertTimeStep;
9+
import org.cientopolis.samplers.framework.location.LocationStep;
10+
import org.cientopolis.samplers.framework.multipleSelect.MultipleSelectStep;
11+
import org.cientopolis.samplers.framework.photo.PhotoStep;
12+
import org.cientopolis.samplers.framework.selectOne.SelectOneOption;
13+
import org.cientopolis.samplers.framework.selectOne.SelectOneStep;
14+
import org.cientopolis.samplers.framework.multipleSelect.MultipleSelectOption;
15+
import org.cientopolis.samplers.framework.Step;
16+
import org.cientopolis.samplers.framework.Workflow;
17+
import org.cientopolis.samplers.framework.soundRecord.SoundRecordStep;
1518
import org.cientopolis.samplers.network.NetworkConfiguration;
1619
import org.cientopolis.samplers.ui.SamplersMainActivity;
1720

@@ -28,7 +31,7 @@ protected void onCreate(Bundle savedInstanceState) {
2831
super.onCreate(savedInstanceState);
2932

3033
// Set the network configuration
31-
NetworkConfiguration.setURL("http://192.168.1.10/samplers/upload.php");
34+
NetworkConfiguration.setURL("http://192.168.0.10/samplers/upload.php");
3235
NetworkConfiguration.setPARAM_NAME("sample");
3336

3437
lb_main_welcome_message.setText("Bienvenido a la Aplicacion de Prueba!");
@@ -47,39 +50,55 @@ protected Workflow getWorkflow() {
4750
workflow.addStep(new InsertTimeStep(101, "Seleccione la Hora de la muestra",102));
4851

4952
// Insert Date
50-
workflow.addStep(new InsertDateStep(102, "Seleccione la Fecha de la muestra",2));
53+
workflow.addStep(new InsertDateStep(102, "Seleccione la Fecha de la muestra",103));
54+
55+
// Sound
56+
workflow.addStep(new SoundRecordStep(103, "Grabe algo",2));
5157

5258
// SelectOneStep
5359
ArrayList<SelectOneOption> optionsToSelect2 = new ArrayList<SelectOneOption>();
54-
optionsToSelect2.add(new SelectOneOption(1,"SI", 5));
55-
optionsToSelect2.add(new SelectOneOption(2,"NO", 6));
60+
optionsToSelect2.add(new SelectOneOption(1,"SI", 3));
61+
optionsToSelect2.add(new SelectOneOption(2,"NO", 4));
5662
workflow.addStep(new SelectOneStep(2, optionsToSelect2, "¿Quiere sacar una foto?"));
5763

64+
// PhotoStep
65+
PhotoStep photoStep = new PhotoStep(3, "Saque una foto de su gato","",4);
66+
// set help resource
67+
photoStep.setHelpResourseId(R.raw.photohelp);
68+
workflow.addStep(photoStep);
69+
5870
// InsertTextStep
59-
//workflow.addStep(new InsertTextStep(3, "Escriba algo","cualquier cosa",50, InsertTextStep.InputType.TYPE_TEXT, true, 3));
71+
workflow.addStep(new InsertTextStep(4, "Escriba algo","cualquier cosa",50, InsertTextStep.InputType.TYPE_TEXT, true, 5));
6072

6173
// LocationStep
62-
//workflow.addStep(new LocationStep(4, "Seleccione la posicion de la muestra",4));
63-
64-
// PhotoStep
65-
workflow.addStep(new PhotoStep(5, "Instrucciones para mostrar","",6));
74+
workflow.addStep(new LocationStep(5, "Seleccione la posicion de la muestra",6));
6675

6776
// MultipleSelectStep
6877
ArrayList<MultipleSelectOption> optionsToSelect = new ArrayList<MultipleSelectOption>();
6978
optionsToSelect.add(new MultipleSelectOption(1,"Arboles"));
7079
optionsToSelect.add(new MultipleSelectOption(2,"Basura"));
7180
optionsToSelect.add(new MultipleSelectOption(3,"Arroyo"));
7281
optionsToSelect.add(new MultipleSelectOption(4,"Animales"));
73-
workflow.addStep(new MultipleSelectStep(6, optionsToSelect, "Seleccione si observa algo de esto",7));
82+
workflow.addStep(new MultipleSelectStep(6, optionsToSelect, "Seleccione si observa algo de esto",null));
83+
7484

85+
86+
/*
7587
// SelectOneStep
7688
optionsToSelect2 = new ArrayList<SelectOneOption>();
7789
optionsToSelect2.add(new SelectOneOption(1,"Opcion 1", null));
7890
optionsToSelect2.add(new SelectOneOption(2,"Opcion 2", null));
7991
optionsToSelect2.add(new SelectOneOption(3,"Opcion 3", null));
8092
optionsToSelect2.add(new SelectOneOption(4,"Opcion 4", null));
8193
workflow.addStep(new SelectOneStep(7, optionsToSelect2, "Seleccione solo uno"));
94+
*/
95+
8296

8397
return workflow;
8498
}
99+
100+
@Override
101+
protected Integer getMainHelpResourceId() {
102+
return R.raw.mainhelp;
103+
}
85104
}
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<title>Main Help</title>
5+
<meta charset="utf-8">
6+
<meta name="viewport" content="width=device-width, initial-scale=1">
7+
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
8+
9+
</head>
10+
<body>
11+
12+
<div class="jumbotron text-center">
13+
<h1>Main Help</h1>
14+
<p>You can use Bootstrap to build your HTML help pages too</p>
15+
</div>
16+
17+
<div class="container">
18+
<div class="row">
19+
<div class="col-sm-4">
20+
<h3>Help Title</h3>
21+
<p>This is an example of a html file for help.</p>
22+
</div>
23+
<div class="col-sm-4">
24+
<h3>Links</h3>
25+
<a href="https://www.google.com">https://www.google.com</a>
26+
<p>For links you should provide the full link with the http or https prefix like above. It will be opened in the default web browser application</p>
27+
</div>
28+
<div class="col-sm-4">
29+
<h3>JavaScript is not enabled</h3>
30+
<p>Due to the limitations of the basic WebView JavaScript is not enabled.</p>
31+
<p>See the <a href="https://developer.android.com/reference/android/webkit/WebView.html">Android documentation of the WebView</a> for details.</p>
32+
</div>
33+
</div>
34+
</div>
35+
36+
</body>
37+
</html>
38+
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<title>Photo Help</title>
5+
<meta charset="utf-8">
6+
<meta name="viewport" content="width=device-width, initial-scale=1">
7+
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
8+
9+
</head>
10+
<body>
11+
12+
<div class="jumbotron text-center">
13+
<h1>Photo Help</h1>
14+
<p>You can provide a diferent HTML file for each step</p>
15+
</div>
16+
17+
<div class="container">
18+
<div class="panel panel-primary">
19+
<div class="panel-heading">Photo indications</div>
20+
<div class="panel-body">Some indications to take the photo for the sample</div>
21+
</div>
22+
23+
24+
<div class="alert alert-info">
25+
<strong>Tip!</strong> Another tip to take the photo.
26+
</div>
27+
</div>
28+
29+
</body>
30+
</html>

samplers.gradle

Lines changed: 40 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ task samplers_config {
2323
// APPLICATION
2424
println json.application.title
2525
println json.application.welcomeMessage
26+
json.application.googleMaps_API_KEY
27+
println json.application.mainHelpFileName
2628
println json.application.networkConfiguration.url
2729
println json.application.networkConfiguration.paramName
2830

@@ -46,69 +48,93 @@ task samplers_config {
4648
def package_name = json.project.package_name
4749
def manifest_path = "app/src/main/"
4850
def strings_path = "app/src/main/res/values/"
51+
def raw_path = "app/src/main/res/raw/"
4952

5053
// Check if exists MAIN ACTIVITY
5154
File main_activity_file = new File(app_path+"MyMainSamplersActivity.java")
5255
if (!main_activity_file.exists()) {
5356

5457

55-
def class_generator = new org.cientopolis.samplers.SamplersClassGenerator(package_name, manifest_path, strings_path);
56-
58+
def class_generator = new org.cientopolis.samplers.SamplersClassGenerator(package_name, manifest_path, strings_path, raw_path);
59+
// Set Main Help
60+
if (json.application.mainHelpFileName != null) {
61+
class_generator.setMainHelpFileName(json.application.mainHelpFileName);
62+
}
5763

64+
// Set Google Maps API Key
5865
if (json.application.googleMaps_API_KEY != null) {
5966
class_generator.setGoogleMaps_API_KEY(json.application.googleMaps_API_KEY)
6067
println "Google maps API KEY added"
6168
} else
6269
println "No google maps API KEY found"
6370

6471
// Workflow
72+
def stepClassGenerator;
6573
json.workflow.steps.eachWithIndex { step, i ->
6674
switch (step.type) {
6775
case "Information":
68-
class_generator.addStep(new org.cientopolis.samplers.InformationStepClassGenerator(step.id, step.nextStepId, step.text))
76+
stepClassGenerator = new org.cientopolis.samplers.InformationStepClassGenerator(step.id, step.nextStepId, step.text)
6977
break
7078

7179
case "MultipleSelect":
72-
org.cientopolis.samplers.MultipleSelectStepClassGenerator stepMutipleSelect = new org.cientopolis.samplers.MultipleSelectStepClassGenerator(step.id, step.nextStepId, step.title)
80+
stepClassGenerator = new org.cientopolis.samplers.MultipleSelectStepClassGenerator(step.id, step.nextStepId, step.title)
7381

7482
step.options.each { option ->
75-
stepMutipleSelect.addOptionToSelect(option.id, option.text)
83+
stepClassGenerator.addOptionToSelect(option.id, option.text)
7684
}
7785

78-
class_generator.addStep(stepMutipleSelect)
7986
break
8087

8188
case "SelectOne":
82-
org.cientopolis.samplers.SelectOneStepClassGenerator stepSelectOne = new org.cientopolis.samplers.SelectOneStepClassGenerator(step.id, step.title)
89+
stepClassGenerator = new org.cientopolis.samplers.SelectOneStepClassGenerator(step.id, step.title)
8390

8491
step.options.each { option ->
85-
stepSelectOne.addOptionToSelect(option.id, option.text, option.nextStepId)
92+
stepClassGenerator.addOptionToSelect(option.id, option.text, option.nextStepId)
8693
}
8794

88-
class_generator.addStep(stepSelectOne)
8995
break
9096

9197
case "Photo":
9298
// TODO add functionality to overlay image
93-
class_generator.addStep(new org.cientopolis.samplers.PhotoStepClassGenerator(step.id, step.nextStepId, step.text, ""))
99+
stepClassGenerator = new org.cientopolis.samplers.PhotoStepClassGenerator(step.id, step.nextStepId, step.text, "")
94100
break
95101

96102
case "Location":
97-
class_generator.addStep(new org.cientopolis.samplers.LocationStepClassGenerator(step.id, step.nextStepId, step.text))
103+
stepClassGenerator = new org.cientopolis.samplers.LocationStepClassGenerator(step.id, step.nextStepId, step.text)
98104
break
99105

100106
case "InsertText":
101-
class_generator.addStep(new org.cientopolis.samplers.InsertTextStepClassGenerator(step.id, step.nextStepId, step.text, step.sampleText, step.maxLength, step.inputType, step.optional))
107+
stepClassGenerator = new org.cientopolis.samplers.InsertTextStepClassGenerator(step.id, step.nextStepId, step.text, step.sampleText, step.maxLength, step.inputType, step.optional)
102108
break
103109

104110
case "InsertDate":
105-
class_generator.addStep(new org.cientopolis.samplers.InsertDateStepClassGenerator(step.id, step.nextStepId, step.text))
111+
stepClassGenerator = new org.cientopolis.samplers.InsertDateStepClassGenerator(step.id, step.nextStepId, step.text)
106112
break
107113

108114
case "InsertTime":
109-
class_generator.addStep(new org.cientopolis.samplers.InsertTimeStepClassGenerator(step.id, step.nextStepId, step.text))
115+
stepClassGenerator = new org.cientopolis.samplers.InsertTimeStepClassGenerator(step.id, step.nextStepId, step.text)
116+
break
117+
118+
case "Sound":
119+
stepClassGenerator = new org.cientopolis.samplers.SoundRecordStepClassGenerator(step.id, step.nextStepId, step.text)
120+
break
121+
122+
default:
123+
stepClassGenerator = null;
110124
break
111125
}
126+
127+
if (stepClassGenerator != null) {
128+
// Set Help File
129+
if (step.helpFileName != null) {
130+
stepClassGenerator.setHelpFile(step.helpFileName)
131+
}
132+
133+
// Add the step
134+
class_generator.addStep(stepClassGenerator)
135+
}
136+
137+
112138
}
113139

114140
def activity_name = "MyMainSamplersActivity"

0 commit comments

Comments
 (0)