Skip to content

Commit d71bf1a

Browse files
committed
CATROID-528 Embroidery flavor
1 parent faad61c commit d71bf1a

File tree

45 files changed

+447
-73
lines changed

Some content is hidden

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

45 files changed

+447
-73
lines changed

Jenkinsfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def webTestUrlParameter() {
3434

3535
def allFlavoursParameters() {
3636
return env.BUILD_ALL_FLAVOURS?.toBoolean() ? 'assembleCreateAtSchoolDebug ' +
37-
'assembleLunaAndCatDebug assemblePhiroDebug assembleArduinoDebug' : ''
37+
'assembleLunaAndCatDebug assemblePhiroDebug assembleEmbroideryDesignerDebug' : ''
3838
}
3939

4040
def useDebugLabelParameter(defaultLabel) {

Jenkinsfile.releaseAPK

+1-1
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,8 @@ pipeline {
9696
sh '''
9797
fastlane android upload_APK_Catroid
9898
fastlane android upload_APK_CreateAtSchool
99+
fastlane android upload_APK_EmbroideryDesigner
99100
fastlane android upload_APK_LunaAndCat
100-
fastlane android upload_APK_Arduino
101101
fastlane android upload_APK_Phiro
102102
'''
103103
} else {

catroid/build.gradle

+6-8
Original file line numberDiff line numberDiff line change
@@ -180,9 +180,8 @@ android {
180180
buildConfigField "boolean", "FEATURE_WEBREQUEST_BRICK_ENABLED", "true"
181181
buildConfigField "boolean", "FEATURE_MULTIPLAYER_VARIABLES_ENABLED", "true"
182182
buildConfigField "boolean", "FEATURE_TESTBRICK_ENABLED", "true"
183-
resValue "string", "FEATURE_ARDUINO_PREFERENCES_ENABLED", "false"
183+
resValue "string", "FEATURE_EMBROIDERY_PREFERENCES_ENABLED", "false"
184184
resValue "string", "FEATURE_PHIRO_PREFERENCES_ENABLED", "false"
185-
resValue "string", "FEATURE_RASPI_PREFERENCES_ENABLED", "false"
186185
resValue "string", "SNACKBAR_HINTS_ENABLED", "false"
187186
resValue "string", "DEBUG_MODE", "false"
188187
}
@@ -290,18 +289,17 @@ android {
290289
createAtSchool {
291290
applicationIdSuffix '.createatschool'
292291
}
292+
embroideryDesigner {
293+
applicationIdSuffix '.embroiderydesigner'
294+
resValue "string", "FEATURE_EMBROIDERY_PREFERENCES_ENABLED", "true"
295+
}
293296
lunaAndCat {
294297
applicationIdSuffix '.lunaandcat'
295298
}
296299
phiro {
297300
applicationIdSuffix '.phiro'
298301
resValue "string", "FEATURE_PHIRO_PREFERENCES_ENABLED", "true"
299302
}
300-
arduino {
301-
applicationIdSuffix '.arduino'
302-
resValue "string", "FEATURE_ARDUINO_PREFERENCES_ENABLED", "true"
303-
resValue "string", "FEATURE_RASPI_PREFERENCES_ENABLED", "true"
304-
}
305303
standalone {
306304
if (!project.hasProperty('packageName')) {
307305
applicationIdSuffix '.standalone'
@@ -405,9 +403,9 @@ dependencies {
405403
// Pocket Paint
406404
catroidImplementation "org.catrobat.paintroid:paintroid:$paintroidVersion"
407405
createAtSchoolImplementation "org.catrobat.paintroid:paintroid:$paintroidVersion"
406+
embroideryDesignerImplementation "org.catrobat.paintroid:paintroid:$paintroidVersion"
408407
lunaAndCatImplementation "org.catrobat.paintroid:paintroid:$paintroidVersion"
409408
phiroImplementation "org.catrobat.paintroid:paintroid:$paintroidVersion"
410-
arduinoImplementation "org.catrobat.paintroid:paintroid:$paintroidVersion"
411409
implementation "org.catrobat.paintroid:colorpicker:$paintroidVersion"
412410

413411
// CameraX
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/*
2+
* Catroid: An on-device visual programming system for Android devices
3+
* Copyright (C) 2010-2018 The Catrobat Team
4+
* (<http://developer.catrobat.org/credits>)
5+
*
6+
* This program is free software: you can redistribute it and/or modify
7+
* it under the terms of the GNU Affero General Public License as
8+
* published by the Free Software Foundation, either version 3 of the
9+
* License, or (at your option) any later version.
10+
*
11+
* An additional term exception under section 7 of the GNU Affero
12+
* General Public License, version 3, is available at
13+
* http://developer.catrobat.org/license_additional_term
14+
*
15+
* This program is distributed in the hope that it will be useful,
16+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
17+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18+
* GNU Affero General Public License for more details.
19+
*
20+
* You should have received a copy of the GNU Affero General Public License
21+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
22+
*/
23+
24+
package org.catrobat.catroid.common.defaultprojectcreators;
25+
26+
public class DefaultExampleProject extends DefaultProjectCreator {
27+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/*
2+
* Catroid: An on-device visual programming system for Android devices
3+
* Copyright (C) 2010-2018 The Catrobat Team
4+
* (<http://developer.catrobat.org/credits>)
5+
*
6+
* This program is free software: you can redistribute it and/or modify
7+
* it under the terms of the GNU Affero General Public License as
8+
* published by the Free Software Foundation, either version 3 of the
9+
* License, or (at your option) any later version.
10+
*
11+
* An additional term exception under section 7 of the GNU Affero
12+
* General Public License, version 3, is available at
13+
* http://developer.catrobat.org/license_additional_term
14+
*
15+
* This program is distributed in the hope that it will be useful,
16+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
17+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18+
* GNU Affero General Public License for more details.
19+
*
20+
* You should have received a copy of the GNU Affero General Public License
21+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
22+
*/
23+
24+
package org.catrobat.catroid.common.defaultprojectcreators;
25+
26+
public class DefaultExampleProject extends DefaultProjectCreator {
27+
}

catroid/src/arduino/java/org/catrobat/catroid/common/FlavoredConstants.java catroid/src/embroideryDesigner/java/org/catrobat/catroid/common/FlavoredConstants.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@
3333

3434
public final class FlavoredConstants {
3535
// Web:
36-
public static final String BASE_URL_HTTPS = MAIN_URL_HTTPS + "/arduino/";
36+
public static final String BASE_URL_HTTPS = MAIN_URL_HTTPS + "/embroidery/";
3737

38-
public static final String POCKET_CODE_EXTERNAL_STORAGE_FOLDER_NAME = "Arduino";
38+
public static final String POCKET_CODE_EXTERNAL_STORAGE_FOLDER_NAME = "EmbroideryDesigner";
3939

4040
public static final File DEFAULT_ROOT_DIRECTORY = CatroidApplication.getAppContext().getFilesDir();
4141

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,177 @@
1+
/*
2+
* Catroid: An on-device visual programming system for Android devices
3+
* Copyright (C) 2010-2018 The Catrobat Team
4+
* (<http://developer.catrobat.org/credits>)
5+
*
6+
* This program is free software: you can redistribute it and/or modify
7+
* it under the terms of the GNU Affero General Public License as
8+
* published by the Free Software Foundation, either version 3 of the
9+
* License, or (at your option) any later version.
10+
*
11+
* An additional term exception under section 7 of the GNU Affero
12+
* General Public License, version 3, is available at
13+
* http://developer.catrobat.org/license_additional_term
14+
*
15+
* This program is distributed in the hope that it will be useful,
16+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
17+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18+
* GNU Affero General Public License for more details.
19+
*
20+
* You should have received a copy of the GNU Affero General Public License
21+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
22+
*/
23+
24+
package org.catrobat.catroid.common.defaultprojectcreators;
25+
26+
import android.content.Context;
27+
import android.graphics.BitmapFactory;
28+
29+
import org.catrobat.catroid.R;
30+
import org.catrobat.catroid.common.LookData;
31+
import org.catrobat.catroid.content.Project;
32+
import org.catrobat.catroid.content.Scene;
33+
import org.catrobat.catroid.content.Script;
34+
import org.catrobat.catroid.content.Sprite;
35+
import org.catrobat.catroid.content.StartScript;
36+
import org.catrobat.catroid.content.bricks.MoveNStepsBrick;
37+
import org.catrobat.catroid.content.bricks.RepeatBrick;
38+
import org.catrobat.catroid.content.bricks.SetVariableBrick;
39+
import org.catrobat.catroid.content.bricks.TurnRightBrick;
40+
import org.catrobat.catroid.content.bricks.ZigZagStitchBrick;
41+
import org.catrobat.catroid.formulaeditor.Formula;
42+
import org.catrobat.catroid.formulaeditor.FormulaElement;
43+
import org.catrobat.catroid.formulaeditor.Operators;
44+
import org.catrobat.catroid.formulaeditor.UserVariable;
45+
import org.catrobat.catroid.io.ResourceImporter;
46+
import org.catrobat.catroid.io.XstreamSerializer;
47+
import org.catrobat.catroid.utils.ImageEditing;
48+
49+
import java.io.File;
50+
import java.io.FileNotFoundException;
51+
import java.io.IOException;
52+
53+
import static org.catrobat.catroid.common.Constants.DEFAULT_IMAGE_EXTENSION;
54+
import static org.catrobat.catroid.common.Constants.IMAGE_DIRECTORY_NAME;
55+
import static org.catrobat.catroid.common.ScreenValues.SCREEN_HEIGHT;
56+
import static org.catrobat.catroid.common.ScreenValues.SCREEN_WIDTH;
57+
import static org.catrobat.catroid.stage.StageListener.SCREENSHOT_AUTOMATIC_FILE_NAME;
58+
59+
public class DefaultExampleProject extends DefaultProjectCreator {
60+
public DefaultExampleProject() {
61+
defaultProjectNameResourceId = R.string.default_project_name;
62+
}
63+
64+
@Override
65+
public Project createDefaultProject(String name, Context context, boolean landscapeMode) throws IOException {
66+
Project project = new Project(context, name, landscapeMode);
67+
68+
if (project.getDirectory().exists()) {
69+
throw new IOException("Cannot create new project at "
70+
+ project.getDirectory().getAbsolutePath()
71+
+ ", directory already exists.");
72+
}
73+
74+
XstreamSerializer.getInstance().saveProject(project);
75+
76+
if (!project.getDirectory().isDirectory()) {
77+
throw new FileNotFoundException("Cannot create project at " + project.getDirectory().getAbsolutePath());
78+
}
79+
80+
int needleDrawableId;
81+
int backgroundDrawableId;
82+
int screenshotDrawableId;
83+
84+
if (landscapeMode) {
85+
backgroundDrawableId = R.drawable.default_project_background_landscape;
86+
needleDrawableId = R.drawable.default_project_needle;
87+
screenshotDrawableId = R.drawable.default_project_screenshot_landscape;
88+
} else {
89+
backgroundDrawableId = R.drawable.default_project_background_portrait;
90+
needleDrawableId = R.drawable.default_project_needle;
91+
screenshotDrawableId = R.drawable.default_project_screenshot;
92+
}
93+
94+
BitmapFactory.Options options = new BitmapFactory.Options();
95+
options.inJustDecodeBounds = true;
96+
BitmapFactory.decodeResource(context.getResources(), backgroundDrawableId, options);
97+
98+
backgroundImageScaleFactor = ImageEditing.calculateScaleFactor(
99+
options.outWidth,
100+
options.outHeight,
101+
SCREEN_WIDTH,
102+
SCREEN_HEIGHT);
103+
104+
Scene scene = project.getDefaultScene();
105+
106+
File imageDir = new File(scene.getDirectory(), IMAGE_DIRECTORY_NAME);
107+
108+
String imageFileName = "img" + DEFAULT_IMAGE_EXTENSION;
109+
110+
File needleFile1 = ResourceImporter.createImageFileFromResourcesInDirectory(context.getResources(),
111+
needleDrawableId,
112+
imageDir,
113+
imageFileName,
114+
backgroundImageScaleFactor);
115+
116+
ResourceImporter.createImageFileFromResourcesInDirectory(context.getResources(),
117+
screenshotDrawableId,
118+
scene.getDirectory(),
119+
SCREENSHOT_AUTOMATIC_FILE_NAME,
120+
1);
121+
122+
Sprite needle = new Sprite(context.getString(R.string.default_project_needle_name));
123+
124+
scene.addSprite(needle);
125+
126+
needle.getLookList()
127+
.add(new LookData(context.getString(R.string.default_project_needle_name), needleFile1));
128+
129+
Script script = new StartScript();
130+
131+
UserVariable variableOuterLoop = new UserVariable(context.getString(R.string.default_project_outer_loop));
132+
UserVariable variableInnerLoop = new UserVariable(context.getString(R.string.default_project_inner_loop));
133+
134+
needle.addUserVariable(variableInnerLoop);
135+
needle.addUserVariable(variableOuterLoop);
136+
137+
script.addBrick(new SetVariableBrick(new Formula(8), variableInnerLoop));
138+
script.addBrick(new SetVariableBrick(new Formula(8), variableOuterLoop));
139+
script.addBrick(new ZigZagStitchBrick(new Formula(2), new Formula(10)));
140+
141+
Formula repeatUntilFormulaOuterLoop = new Formula(1);
142+
repeatUntilFormulaOuterLoop.setRoot(new FormulaElement(FormulaElement.ElementType.USER_VARIABLE, variableOuterLoop.getName(),
143+
null));
144+
145+
RepeatBrick outerLoopRepeat = new RepeatBrick(repeatUntilFormulaOuterLoop);
146+
147+
Formula repeatUntilFormulaInnerLoop = new Formula(1);
148+
repeatUntilFormulaInnerLoop.setRoot(new FormulaElement(FormulaElement.ElementType.USER_VARIABLE,
149+
variableInnerLoop.getName(),
150+
null));
151+
152+
RepeatBrick innerLoopRepeat = new RepeatBrick(repeatUntilFormulaInnerLoop);
153+
innerLoopRepeat.addBrick(new MoveNStepsBrick(new Formula(100)));
154+
155+
FormulaElement innerLoopFormula = new FormulaElement(FormulaElement.ElementType.OPERATOR,
156+
Operators.DIVIDE.name(), null,
157+
new FormulaElement(FormulaElement.ElementType.NUMBER, String.valueOf(360), null),
158+
new FormulaElement(FormulaElement.ElementType.USER_VARIABLE, variableInnerLoop.getName(),
159+
null));
160+
161+
innerLoopRepeat.addBrick(new TurnRightBrick(new Formula(innerLoopFormula)));
162+
163+
outerLoopRepeat.addBrick(innerLoopRepeat);
164+
FormulaElement outerLoopFormula = new FormulaElement(FormulaElement.ElementType.OPERATOR,
165+
Operators.DIVIDE.name(), null,
166+
new FormulaElement(FormulaElement.ElementType.NUMBER, String.valueOf(360), null),
167+
new FormulaElement(FormulaElement.ElementType.USER_VARIABLE, variableOuterLoop.getName(),
168+
null));
169+
outerLoopRepeat.addBrick(new TurnRightBrick(new Formula(outerLoopFormula)));
170+
171+
script.addBrick(outerLoopRepeat);
172+
needle.addScript(script);
173+
174+
XstreamSerializer.getInstance().saveProject(project);
175+
return project;
176+
}
177+
}
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!--
3+
~ Catroid: An on-device visual programming system for Android devices
4+
~ Copyright (C) 2010-2018 The Catrobat Team
5+
~ (<http://developer.catrobat.org/credits>)
6+
~
7+
~ This program is free software: you can redistribute it and/or modify
8+
~ it under the terms of the GNU Affero General Public License as
9+
~ published by the Free Software Foundation, either version 3 of the
10+
~ License, or (at your option) any later version.
11+
~
12+
~ An additional term exception under section 7 of the GNU Affero
13+
~ General Public License, version 3, is available at
14+
~ http://developer.catrobat.org/license_additional_term
15+
~
16+
~ This program is distributed in the hope that it will be useful,
17+
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
18+
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19+
~ GNU Affero General Public License for more details.
20+
~
21+
~ You should have received a copy of the GNU Affero General Public License
22+
~ along with this program. If not, see <http://www.gnu.org/licenses/>.
23+
-->
24+
<resources>
25+
26+
<!-- Toolbar and Bottombar Colors -->
27+
<color name="toolbar_background">#20103B</color>
28+
<color name="toolbar_icons">@color/solid_white</color>
29+
30+
<!-- Text Colors -->
31+
<color name="toolbar_title">@color/solid_white</color>
32+
<color name="vh_headline">@color/solid_white</color>
33+
<color name="vh_item_title">@color/accent</color>
34+
<color name="vh_item_details">@color/accent</color>
35+
36+
<!-- Backgrounds -->
37+
<color name="app_background">#380F50</color>
38+
<color name="button_background">#392757</color>
39+
<color name="button_bottom_bar">#392757</color>
40+
<color name="button_border_top">@color/accent</color>
41+
42+
<!-- Accent Colors -->
43+
<color name="accent">@color/solid_white</color>
44+
<color name="project_icons">@color/solid_white</color>
45+
<color name="brick_field_highlight">#33B5E5</color>
46+
47+
<!-- Formula Editor Colors -->
48+
<color name="formula_editor_category_text">#390B52</color>
49+
<color name="formula_editor_ok_button">#390B52</color>
50+
<color name="formula_editor_ok_button_pressed">#380F50</color>
51+
<color name="formula_editor_ok_text">#F9F9F9</color>
52+
53+
</resources>

catroid/src/arduino/res/values/strings.xml catroid/src/embroideryDesigner/res/values/strings.xml

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,5 @@
2323
-->
2424

2525
<resources>
26-
<string name="app_name">Pocket Code for Arduino</string>
27-
</resources>
26+
<string name="app_name">Embroidery Designer</string>
27+
</resources>

0 commit comments

Comments
 (0)