diff --git a/.gitignore b/.gitignore
index 97396c08c03..ee255a2aff1 100644
--- a/.gitignore
+++ b/.gitignore
@@ -60,7 +60,6 @@ __pycache__
#api-keys
catroid/google-services.json
-catroid/fabric.properties
#Crowdin folder
crowdin/
diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml
index c6558a4568c..612319a820f 100644
--- a/.idea/codeStyles/Project.xml
+++ b/.idea/codeStyles/Project.xml
@@ -8,9 +8,6 @@
-
-
-
@@ -73,9 +70,6 @@
-
-
-
@@ -100,7 +94,6 @@
-
diff --git a/CHANGELOG.md b/CHANGELOG.md
deleted file mode 100644
index 83015d74bc0..00000000000
--- a/CHANGELOG.md
+++ /dev/null
@@ -1,118 +0,0 @@
-Changelog
-=========
-
-version 0.9.9
------------------
-- new saving strategy: no corrupted projects anymore
-- performance improvements
- * broadcast/wait
-- general bugfixes
- * error messages from server
- * harmonize UI
- * special characters in project name
- * length of really short sounds
-
-version 0.9.8
------------------
-- bugfixes
-- remove unfinished translations
-
-version 0.9.7
------------------
-- fix crashes on Android 4.4 when importing images and sound
-- fixes a bug where some math functions didn't work correctly
-- open websites in-app
-- stage: fix broadcast behavior
-- stage: hiding objects outside, when not in stretch-mode
-- stage: correctly show projects with different aspect ratio
-- stage: correctly taking automatic screenshots during longer sessions
-- many smaller bugfixes and user experience improvements
-
-version 0.9.6
------------------
-- fix a bug where some projects could not be loaded
-
-version 0.9.5
------------------
-- improved "new object" workflow
-- tutorial and help
-- correct download link for Pocket Paint
-- bugfixes
-
-version 0.9.4
------------------
-- older programs should be openable again
-- alert dialog style
-- improved usability
-- bugfixes
-
-version 0.9.3
------------------
-- dialog redesign
-- improved usability
-- bugfixes
-
-version 0.9.2
------------------
-- fixed: copying a brick sometimes crashed the app
-
-version 0.9.1
------------------
-- Catrobat program's version will be updated now before the upload
-
-Public beta release 0.7 (2012-10-06)
------------------
-- UI: Redesign. Now using fragments, ActionBarSherlock for Pre-ICS devices. This was done as part of a Google Summer of Code 2012 project by our GSoC student [https://github.com/atermenji Artur Termenji]. Many thanks to him.
-- Fix: Better handling of the brick list. Added correct behaviour for nested loops.
-- Enhancement: Better performance in the Stage.
-- Enhancement: Upload and download of projects is now done in background, with notifications.
-- New: A new XML format for the Catrobat programs was introduced. '''Note:''' this means that all projects done with versions prior to 0.7.0 are not compatible with this release!
-- Many, many, many bugfixes. :)
-
-Public beta release 0.6 (2012-3-10)
------------------
-- Short version: Lots and lots of new stuff ;-) Please try it out!
-- Among others: Support for Lego Mindstorms robots, bricks galore (motion: place at, set x to, set y to, change x by, change y by, if on edge bounce, move n steps, turn left/right n degrees, point in direction, point towards, glide s seconds to x y, go back n layers, go to front; looks: switch to costume, next costume, sit size to, change size by, hide, show, set ghost effect to n%, change ghost effect by n, set brightness to n%, change brightness by, clear graphic effects; sound: play sound, stop all sounds, set volume to n%, change volume by, speak; control: when project starts, when tapped, wait s seconds, when I receive ABC as a message, broadcast ABC, broadcast ABC and wait, note, forever, repeat n times), a completely new design, our own sound recorder (some tablets do not have one preinstalled), better manual handling of bricks, and many more, e.g., auto scaling to different device resolutions with or without aspect ratio preservation, or a "report as inappropriate" button for uploaded projects. There are also many things behind the scene, e.g., new languages in all projects.
-
-Alpha release 0.5 (2011-4)
------------------
-- This was a refactoring-only release for internal use only.
-
-Alpha release 0.4 (2010-12-27)
------------------
-- new bricks: [come to front]
, [go back x layers]
, and [if touched do]
([http://blog.catroid.org/2011/01/multitouch-piano-project.html multitouch subject to phone capabilities])
-- coordinates range now from -1000 to +1000 in both X and Y directions, 1000 being the border and (0,0) in the center of the screen
-- website that hosts catroid project files: http://www.catroid.org/ (several demo projects there)
-- upload projects to http://www.catroid.org/ from inside catroid
-- extract, edit, and execute projects downloaded from http://www.catroid.org/
-- paintroid, a new paint editor:
- * allows to draw new pictures and edit old ones
- * save as ...
- * allows to pinch-zoom up to pixel level
- * allows to color whole areas or pixels to any color
- * colors can be chosen from a color in the picture or using a color chooser gadget
- * allows to set areas or pixels to transparent to delete unwanted background in costumes
- * many unit, functional, and regressions tests
-- [http://www.youtube.com/watch?v=WTppqL6Q4Y4&hd=1 demo video]
-
-Alpha release 0.3 (2010-09-20)
------------------
-- special background object (stage)
-- new brick: [scale to x %]
-- [http://www.youtube.com/watch?v=VZBCTjxD7Eo&feature=player_embedded tutorial]
-- [http://www.youtube.com/watch?v=vOv8Eli0cVs&feature=player_embedded demo video]
-
-Alpha release 0.2 (2010-08-09)
------------------
-- new bricks: [goto x y]
, [hide]
, and [show]
-- multiple sprites
-- save/load project file on SD card
-- transparent backgrounds in costumes
-- English/German according to phone language
-
-Alpha release 0.1 (2010-07-21)
------------------
-- one sprite only
-- German only
-- supported bricks: [set costume]
, [wait]
, and [play sound]
-- [http://www.youtube.com/watch?v=7AfwpKOhsos&feature=player_embedded demo video (in German)]
diff --git a/Jenkinsfile b/Jenkinsfile
index 01ca2dc3b20..9d38455b645 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -1,12 +1,23 @@
#!groovy
class DockerParameters {
- def image = 'catrobat/catrobat-android'
- def imageLabel = 'stable'
+ def fileName = 'Dockerfile.jenkins'
+
+ // 'docker build' would normally copy the whole build-dir to the container, changing the
+ // docker build directory avoids that overhead
+ def dir = 'docker'
+
+ // Pass the uid and the gid of the current user (jenkins-user) to the Dockerfile, so a
+ // corresponding user can be added. This is needed to provide the jenkins user inside
+ // the container for the ssh-agent to work.
+ // Another way would be to simply map the passwd file, but would spoil additional information
+ // Also hand in the group id of kvm to allow using /dev/kvm.
+ def buildArgs = '--build-arg USER_ID=$(id -u) --build-arg GROUP_ID=$(id -g) --build-arg KVM_GROUP_ID=$(getent group kvm | cut -d: -f3)'
+
def args = '--device /dev/kvm:/dev/kvm -v /var/local/container_shared/gradle_cache/$EXECUTOR_NUMBER:/home/user/.gradle -m=14G'
def label = 'LimitedEmulator'
}
-
+
def d = new DockerParameters()
def junitAndCoverage(String jacocoReportDir, String jacocoReportXml, String coverageName) {
@@ -77,11 +88,12 @@ pipeline {
parallel {
stage('1') {
agent {
- docker {
- image useDockerLabelParameter(d.image, d.imageLabel)
+ dockerfile {
+ filename d.fileName
+ dir d.dir
+ additionalBuildArgs d.buildArgs
args d.args
label useDebugLabelParameter(d.label)
- alwaysPull true
}
}
@@ -222,18 +234,19 @@ pipeline {
stage('2') {
agent {
- docker {
- image useDockerLabelParameter(d.image, d.imageLabel)
+ dockerfile {
+ filename d.fileName
+ dir d.dir
+ additionalBuildArgs d.buildArgs
args d.args
label useDebugLabelParameter(d.label)
- alwaysPull true
}
}
stages {
stage('Pull Request Suite') {
steps {
- catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') {
+ catchError(buildResult: 'FAILURE' ,stageResult: 'FAILURE') {
sh '''./gradlew copyAndroidNatives -PenableCoverage -PlogcatFile=pull_request_suite_logcat.txt -Pemulator=android28 \
startEmulator createCatroidDebugAndroidTestCoverageReport \
-Pandroid.testInstrumentationRunnerArguments.class=org.catrobat.catroid.testsuites.UiEspressoPullRequestTriggerSuite'''
@@ -253,12 +266,6 @@ pipeline {
}
post {
- always {
- node('master') {
- unstash 'logParserRules'
- step([$class: 'LogParserPublisher', failBuildOnError: true, projectRulePath: 'buildScripts/log_parser_rules', unstableOnWarning: true, useProjectRule: true])
- }
- }
changed {
node('master') {
notifyChat()
diff --git a/Jenkinsfile.baseDocker b/Jenkinsfile.baseDocker
index efc3d3163bc..4e5f9f2482b 100644
--- a/Jenkinsfile.baseDocker
+++ b/Jenkinsfile.baseDocker
@@ -10,13 +10,7 @@ pipeline {
DOCKER_DIR = 'docker'
DOCKER_REPO = "catrobat"
}
-
- parameters {
- booleanParam name: 'TAG_STABLE', defaultValue: false, description: 'When selected image will be tagged stable'
- booleanParam name: 'TAG_TESTING', defaultValue: true, description: 'When selected image will be tagged testing'
- string name: 'IMAGE_NAME', defaultValue: 'catrobat-android', description: 'Name for docker image to build'
- }
-
+
options {
timeout(time: 2, unit: 'HOURS')
timestamps()
diff --git a/Jenkinsfile.releaseAPK b/Jenkinsfile.releaseAPK
index 9326a48ccde..0baea16e60d 100644
--- a/Jenkinsfile.releaseAPK
+++ b/Jenkinsfile.releaseAPK
@@ -37,9 +37,6 @@ pipeline {
-PsigningKeystorePassword=$signingKeystorePassword \
-PsigningKeyAlias=$signingKeyAlias \
-PsigningKeyPassword=$signingKeyPassword \
- -PfirebaseApiKey=$firebaseApiKey \
- -PfabricApiKey=$fabricApiKey \
- -PfabricApiSecret=$fabricApiSecret
'''
} else if (env.flavor == 'Playground') {
sh '''
@@ -49,9 +46,6 @@ pipeline {
-PsigningKeystorePassword=$signingKeystorePassword \
-PsigningKeyAlias=$signingKeyAlias \
-PsigningKeyPassword=$signingKeyPassword \
- -PfirebaseApiKey=$firebaseApiKey \
- -PfabricApiKey=$fabricApiKey \
- -PfabricApiSecret=$fabricApiSecret \
-Pplayground=true
'''
} else {
@@ -62,9 +56,6 @@ pipeline {
-PsigningKeystorePassword=$signingKeystorePassword \
-PsigningKeyAlias=$signingKeyAlias \
-PsigningKeyPassword=$signingKeyPassword \
- -PfirebaseApiKey=$firebaseApiKey \
- -PfabricApiKey=$fabricApiKey \
- -PfabricApiSecret=$fabricApiSecret
'''
}
}
diff --git a/README.md b/README.md
index 342a44bf1dc..ea7e414f4cc 100644
--- a/README.md
+++ b/README.md
@@ -1,15 +1,15 @@
# Catroid #
-Catroid, also known as **Pocket Code**, is an on-device visual programming system for Android devices.
+**Catroid** is a visual coding IDE and interpreter for Android for the Catrobat programming language.
**Catrobat** is a visual programming language and a set of creativity tools for smartphones.
-Catrobat programs can be written by using Catrobat's Android and iOS apps.
+Catrobat projects can be created using Catrobat's Android apps available on [Google Play](https://catrob.at/gp) and iPhone apps available on [Apple's app store](https://catrob.at/ca).
-For more information [oriented towards developers], check out our [developers page](https://developer.catrobat.org/).
+For more information oriented towards developers, check out our [developers page](https://developer.catrobat.org/).
# Issues #
-For reporting issues use our [JIRA Bugtracking System](https://jira.catrob.at/secure/CreateIssue.jspa?pid=10402&issuetype=1). Before that, please browse our currently open issues [here](https://jira.catrob.at/secure/IssueNavigator.jspa?reset=true&jqlQuery=project+%3D+CAT+AND+resolution+%3D+Unresolved+ORDER+BY+priority+DESC%2C+key+DESC&mode=hide).
+For reporting issues use our [JIRA Bugtracking System](https://jira.catrob.at/secure/CreateIssue.jspa?pid=11800&issuetype=1). Before that, please browse our currently open issues [here](https://jira.catrob.at/secure/IssueNavigator.jspa?reset=true&jqlQuery=project+%3D+CATROID+AND+resolution+%3D+Unresolved+ORDER+BY+priority+DESC%2C+key+DESC&mode=hide).
# Contributing #
@@ -27,12 +27,9 @@ Also make sure to read our guidelines for [creating a pull request](https://gith
# Resources and links #
* [Google Play Store Download](https://catrob.at/gp)
* [Community website with sample programs](https://share.catrob.at/)
-* [Installation Instructions](https://github.com/Catrobat/Catroid/wiki/Installation-Instructions)
-* [Frequently Asked Questions](https://github.com/Catrobat/Catroid/wiki/Frequently-Asked-Questions)
-* [Credits](https://developer.catrobat.org/credits)
+* [Frequently Asked Questions](https://github.com/Catrobat/Catroid/wiki/Frequently-Asked-Questions-(Developers))
+* [Credits](https://catrob.at/credits)
* [Statistics on OpenHub](https://www.openhub.net/p/catrobat/)
-* [Twitter](https://twitter.com/Catroid)
-* [Google+](https://plus.google.com/u/0/+CatrobatOrgAdmin/posts)
* [Our Google group](https://groups.google.com/forum/?fromgroups#!forum/catrobat)
# License #
diff --git a/catroid/build.gradle b/catroid/build.gradle
index 278cc36bc2c..efd7c775823 100644
--- a/catroid/build.gradle
+++ b/catroid/build.gradle
@@ -23,12 +23,10 @@
buildscript {
repositories {
- maven { url 'https://maven.fabric.io/public' }
google()
jcenter()
}
dependencies {
- classpath 'io.fabric.tools:gradle:1.31.0'
classpath 'com.google.gms:google-services:4.3.2'
}
}
@@ -40,28 +38,26 @@ plugins {
repositories {
mavenLocal()
maven { url "https://jitpack.io" }
- maven { url 'https://maven.fabric.io/public' }
}
ext {
appId = 'org.catrobat.catroid'
appName = '@string/app_name'
manifestAppName = '@string/app_name'
- manifestAppIcon = '@drawable/ic_launcher'
+ manifestAppIcon = '@mipmap/ic_launcher'
projectVersion = "0.9"
gdxVersion = "1.9.10"
mockitoVersion = "2.8.47"
espressoVersion = "3.1.0"
- paintroidVersion = "2.5.1"
+ paintroidVersion = "2.5.2"
playServicesVersion = "17.0.0"
- cameraXVersion = "1.0.0-beta06"
+ cameraXVersion = "1.0.0-beta07"
}
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
-apply plugin: 'io.fabric'
apply plugin: 'jacoco-android'
apply from: 'gradle/code_quality_tasks.gradle'
@@ -108,21 +104,10 @@ ext.copyGoogleServicesFile = { flavorName, flavorId ->
into "src/$flavorName"
filter { line ->
line.replaceAll('@appId@', flavorId)
- .replaceAll('@apiKey@', getProperty('firebaseApiKey', '@apiKey@'))
}
}
}
-copy {
- from "fabric-template.properties"
- rename { "fabric.properties" }
- into "."
- filter { line ->
- line.replaceAll('@fabricApiKey@', getProperty('fabricApiKey', "0123456789012345678901234567890123456789"))
- .replaceAll('@fabricApiSecret@', getProperty('fabricApiSecret', "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef"))
- }
-}
-
jacoco.toolVersion = "0.8.1"
jacocoAndroidUnitTestReport {
@@ -132,16 +117,16 @@ jacocoAndroidUnitTestReport {
}
android {
- compileSdkVersion 28
+ compileSdkVersion 29
defaultConfig {
minSdkVersion 21
- targetSdkVersion 28
+ targetSdkVersion 29
applicationId appId
testInstrumentationRunner 'org.catrobat.catroid.runner.UiTestApplicationRunner'
- versionCode 79
- versionName "0.9.74"
+ versionCode 80
+ versionName "0.9.75"
println "VersionCode is $versionCode"
println "VersionName is $versionName"
multiDexEnabled true
@@ -159,7 +144,6 @@ android {
buildConfigField "String", "PROJECT_NAME", "\"No Standalone Project\""
buildConfigField "String", "START_PROJECT", "\"No Starting Project\""
- buildConfigField "boolean", "CRASHLYTICS_CRASH_REPORT_ENABLED", "true"
buildConfigField "boolean", "USE_ANDROID_LOCALES_FOR_SCREENSHOTS", "false"
buildConfigField "boolean", "FEATURE_APK_GENERATOR_ENABLED", "false"
@@ -256,7 +240,6 @@ android {
debug {
buildConfigField "boolean", "USE_ANDROID_LOCALES_FOR_SCREENSHOTS", useAndroidLocales()
resValue "string", "DEBUG_MODE", "true"
- ext.enableCrashlytics = false
testCoverageEnabled = rootProject.hasProperty('enableCoverage')
signingConfig signingConfigs.debug
}
@@ -310,7 +293,6 @@ android {
buildConfigField "String", "START_PROJECT", "\"$projectId\""
buildConfigField "String", "PROJECT_NAME", "\"$appName\""
buildConfigField "boolean", "FEATURE_APK_GENERATOR_ENABLED", "true"
- buildConfigField "boolean", "CRASHLYTICS_CRASH_REPORT_ENABLED", "false"
}
}
@@ -353,7 +335,7 @@ dependencies {
// Kotlin
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
- implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.2'
+ implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.8'
// Support libraries
implementation 'androidx.appcompat:appcompat:1.1.0'
@@ -410,11 +392,11 @@ dependencies {
// CameraX
implementation "androidx.camera:camera-camera2:$cameraXVersion"
- implementation "androidx.camera:camera-lifecycle:$cameraXVersion"
- implementation 'androidx.camera:camera-view:1.0.0-alpha13'
+ implementation "androidx.camera:camera-lifecycle:${cameraXVersion}"
// ML Kit
implementation 'com.google.android.gms:play-services-mlkit-face-detection:16.0.0'
+ implementation 'com.google.android.gms:play-services-mlkit-text-recognition:16.1.0'
// libGDX
implementation "com.badlogicgames.gdx:gdx:$gdxVersion"
@@ -437,10 +419,6 @@ dependencies {
}
androidTestImplementation "androidx.test.espresso:espresso-web:$espressoVersion"
- implementation ('com.crashlytics.sdk.android:crashlytics:2.6.8@aar') {
- transitive = true
- }
-
testImplementation 'junit:junit:4.12'
testImplementation "org.mockito:mockito-core:$mockitoVersion"
testImplementation 'org.hamcrest:hamcrest-library:1.3'
diff --git a/catroid/config/lint-baseline.xml b/catroid/config/lint-baseline.xml
index ebe60c19ed3..265236dd3ff 100644
--- a/catroid/config/lint-baseline.xml
+++ b/catroid/config/lint-baseline.xml
@@ -1,7 +1,7 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/catroid/src/createAtSchool/res/drawable-xhdpi/ic_launcher.png b/catroid/src/createAtSchool/res/drawable-xhdpi/ic_launcher.png
deleted file mode 100644
index 7c30366bfef..00000000000
Binary files a/catroid/src/createAtSchool/res/drawable-xhdpi/ic_launcher.png and /dev/null differ
diff --git a/catroid/src/createAtSchool/res/drawable-xxhdpi/ic_launcher.png b/catroid/src/createAtSchool/res/drawable-xxhdpi/ic_launcher.png
deleted file mode 100644
index fce6419b585..00000000000
Binary files a/catroid/src/createAtSchool/res/drawable-xxhdpi/ic_launcher.png and /dev/null differ
diff --git a/catroid/src/main/res/drawable/ic_main_menu_programs.xml b/catroid/src/createAtSchool/res/drawable/ic_launcher_background.xml
similarity index 68%
rename from catroid/src/main/res/drawable/ic_main_menu_programs.xml
rename to catroid/src/createAtSchool/res/drawable/ic_launcher_background.xml
index 8d152552864..94c58580b2a 100644
--- a/catroid/src/main/res/drawable/ic_main_menu_programs.xml
+++ b/catroid/src/createAtSchool/res/drawable/ic_launcher_background.xml
@@ -21,10 +21,17 @@
~ along with this program. If not, see .
-->
-
-
-
-
+
+
+
+
diff --git a/catroid/src/createAtSchool/res/mipmap-anydpi-v26/ic_launcher.xml b/catroid/src/createAtSchool/res/mipmap-anydpi-v26/ic_launcher.xml
new file mode 100644
index 00000000000..f17186771e3
--- /dev/null
+++ b/catroid/src/createAtSchool/res/mipmap-anydpi-v26/ic_launcher.xml
@@ -0,0 +1,28 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/catroid/src/createAtSchool/res/mipmap-anydpi-v26/ic_launcher_round.xml b/catroid/src/createAtSchool/res/mipmap-anydpi-v26/ic_launcher_round.xml
new file mode 100644
index 00000000000..f17186771e3
--- /dev/null
+++ b/catroid/src/createAtSchool/res/mipmap-anydpi-v26/ic_launcher_round.xml
@@ -0,0 +1,28 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/catroid/src/createAtSchool/res/mipmap-hdpi/ic_launcher.png b/catroid/src/createAtSchool/res/mipmap-hdpi/ic_launcher.png
new file mode 100644
index 00000000000..28d128bd154
Binary files /dev/null and b/catroid/src/createAtSchool/res/mipmap-hdpi/ic_launcher.png differ
diff --git a/catroid/src/createAtSchool/res/mipmap-hdpi/ic_launcher_round.png b/catroid/src/createAtSchool/res/mipmap-hdpi/ic_launcher_round.png
new file mode 100644
index 00000000000..d3dbb9b11bc
Binary files /dev/null and b/catroid/src/createAtSchool/res/mipmap-hdpi/ic_launcher_round.png differ
diff --git a/catroid/src/createAtSchool/res/mipmap-mdpi/ic_launcher.png b/catroid/src/createAtSchool/res/mipmap-mdpi/ic_launcher.png
new file mode 100644
index 00000000000..34281a2d792
Binary files /dev/null and b/catroid/src/createAtSchool/res/mipmap-mdpi/ic_launcher.png differ
diff --git a/catroid/src/createAtSchool/res/mipmap-mdpi/ic_launcher_round.png b/catroid/src/createAtSchool/res/mipmap-mdpi/ic_launcher_round.png
new file mode 100644
index 00000000000..38263868fed
Binary files /dev/null and b/catroid/src/createAtSchool/res/mipmap-mdpi/ic_launcher_round.png differ
diff --git a/catroid/src/createAtSchool/res/mipmap-xhdpi/ic_launcher.png b/catroid/src/createAtSchool/res/mipmap-xhdpi/ic_launcher.png
new file mode 100644
index 00000000000..7349336e70a
Binary files /dev/null and b/catroid/src/createAtSchool/res/mipmap-xhdpi/ic_launcher.png differ
diff --git a/catroid/src/createAtSchool/res/mipmap-xhdpi/ic_launcher_round.png b/catroid/src/createAtSchool/res/mipmap-xhdpi/ic_launcher_round.png
new file mode 100644
index 00000000000..07b7ea26f02
Binary files /dev/null and b/catroid/src/createAtSchool/res/mipmap-xhdpi/ic_launcher_round.png differ
diff --git a/catroid/src/createAtSchool/res/mipmap-xxhdpi/ic_launcher.png b/catroid/src/createAtSchool/res/mipmap-xxhdpi/ic_launcher.png
new file mode 100644
index 00000000000..51580839ba3
Binary files /dev/null and b/catroid/src/createAtSchool/res/mipmap-xxhdpi/ic_launcher.png differ
diff --git a/catroid/src/createAtSchool/res/mipmap-xxhdpi/ic_launcher_round.png b/catroid/src/createAtSchool/res/mipmap-xxhdpi/ic_launcher_round.png
new file mode 100644
index 00000000000..b4f25c463b6
Binary files /dev/null and b/catroid/src/createAtSchool/res/mipmap-xxhdpi/ic_launcher_round.png differ
diff --git a/catroid/src/createAtSchool/res/mipmap-xxxhdpi/ic_launcher.png b/catroid/src/createAtSchool/res/mipmap-xxxhdpi/ic_launcher.png
new file mode 100644
index 00000000000..3f39e56ca09
Binary files /dev/null and b/catroid/src/createAtSchool/res/mipmap-xxxhdpi/ic_launcher.png differ
diff --git a/catroid/src/createAtSchool/res/mipmap-xxxhdpi/ic_launcher_round.png b/catroid/src/createAtSchool/res/mipmap-xxxhdpi/ic_launcher_round.png
new file mode 100644
index 00000000000..91ceb806d10
Binary files /dev/null and b/catroid/src/createAtSchool/res/mipmap-xxxhdpi/ic_launcher_round.png differ
diff --git a/catroid/src/embroideryDesigner/res/drawable-hdpi/ic_launcher.png b/catroid/src/embroideryDesigner/res/drawable-hdpi/ic_launcher.png
deleted file mode 100644
index fdcc527d44e..00000000000
Binary files a/catroid/src/embroideryDesigner/res/drawable-hdpi/ic_launcher.png and /dev/null differ
diff --git a/catroid/src/embroideryDesigner/res/drawable-ldpi/ic_launcher.png b/catroid/src/embroideryDesigner/res/drawable-ldpi/ic_launcher.png
deleted file mode 100644
index 4e9dcf3ecc0..00000000000
Binary files a/catroid/src/embroideryDesigner/res/drawable-ldpi/ic_launcher.png and /dev/null differ
diff --git a/catroid/src/embroideryDesigner/res/drawable-mdpi/ic_launcher.png b/catroid/src/embroideryDesigner/res/drawable-mdpi/ic_launcher.png
deleted file mode 100644
index 95e4837e998..00000000000
Binary files a/catroid/src/embroideryDesigner/res/drawable-mdpi/ic_launcher.png and /dev/null differ
diff --git a/catroid/src/embroideryDesigner/res/drawable-v24/ic_launcher_background.xml b/catroid/src/embroideryDesigner/res/drawable-v24/ic_launcher_background.xml
new file mode 100644
index 00000000000..7a794558d6a
--- /dev/null
+++ b/catroid/src/embroideryDesigner/res/drawable-v24/ic_launcher_background.xml
@@ -0,0 +1,63 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/catroid/src/embroideryDesigner/res/drawable-xhdpi/ic_launcher.png b/catroid/src/embroideryDesigner/res/drawable-xhdpi/ic_launcher.png
deleted file mode 100644
index a5d56e6028d..00000000000
Binary files a/catroid/src/embroideryDesigner/res/drawable-xhdpi/ic_launcher.png and /dev/null differ
diff --git a/catroid/src/embroideryDesigner/res/drawable-xxhdpi/ic_launcher.png b/catroid/src/embroideryDesigner/res/drawable-xxhdpi/ic_launcher.png
deleted file mode 100644
index 4d7f923a31c..00000000000
Binary files a/catroid/src/embroideryDesigner/res/drawable-xxhdpi/ic_launcher.png and /dev/null differ
diff --git a/catroid/src/embroideryDesigner/res/drawable/ic_launcher_foreground.xml b/catroid/src/embroideryDesigner/res/drawable/ic_launcher_foreground.xml
new file mode 100644
index 00000000000..34c426bc6b4
--- /dev/null
+++ b/catroid/src/embroideryDesigner/res/drawable/ic_launcher_foreground.xml
@@ -0,0 +1,211 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/catroid/src/embroideryDesigner/res/mipmap-anydpi-v26/ic_launcher.xml b/catroid/src/embroideryDesigner/res/mipmap-anydpi-v26/ic_launcher.xml
new file mode 100644
index 00000000000..f17186771e3
--- /dev/null
+++ b/catroid/src/embroideryDesigner/res/mipmap-anydpi-v26/ic_launcher.xml
@@ -0,0 +1,28 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/catroid/src/embroideryDesigner/res/mipmap-anydpi-v26/ic_launcher_round.xml b/catroid/src/embroideryDesigner/res/mipmap-anydpi-v26/ic_launcher_round.xml
new file mode 100644
index 00000000000..f17186771e3
--- /dev/null
+++ b/catroid/src/embroideryDesigner/res/mipmap-anydpi-v26/ic_launcher_round.xml
@@ -0,0 +1,28 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/catroid/src/embroideryDesigner/res/mipmap-hdpi/ic_launcher.png b/catroid/src/embroideryDesigner/res/mipmap-hdpi/ic_launcher.png
new file mode 100644
index 00000000000..eb67bf27f2d
Binary files /dev/null and b/catroid/src/embroideryDesigner/res/mipmap-hdpi/ic_launcher.png differ
diff --git a/catroid/src/embroideryDesigner/res/mipmap-hdpi/ic_launcher_round.png b/catroid/src/embroideryDesigner/res/mipmap-hdpi/ic_launcher_round.png
new file mode 100644
index 00000000000..a15e9dea32c
Binary files /dev/null and b/catroid/src/embroideryDesigner/res/mipmap-hdpi/ic_launcher_round.png differ
diff --git a/catroid/src/embroideryDesigner/res/mipmap-mdpi/ic_launcher.png b/catroid/src/embroideryDesigner/res/mipmap-mdpi/ic_launcher.png
new file mode 100644
index 00000000000..2f0576277ca
Binary files /dev/null and b/catroid/src/embroideryDesigner/res/mipmap-mdpi/ic_launcher.png differ
diff --git a/catroid/src/embroideryDesigner/res/mipmap-mdpi/ic_launcher_round.png b/catroid/src/embroideryDesigner/res/mipmap-mdpi/ic_launcher_round.png
new file mode 100644
index 00000000000..43efb1cc157
Binary files /dev/null and b/catroid/src/embroideryDesigner/res/mipmap-mdpi/ic_launcher_round.png differ
diff --git a/catroid/src/embroideryDesigner/res/mipmap-xhdpi/ic_launcher.png b/catroid/src/embroideryDesigner/res/mipmap-xhdpi/ic_launcher.png
new file mode 100644
index 00000000000..46b11a5160c
Binary files /dev/null and b/catroid/src/embroideryDesigner/res/mipmap-xhdpi/ic_launcher.png differ
diff --git a/catroid/src/embroideryDesigner/res/mipmap-xhdpi/ic_launcher_round.png b/catroid/src/embroideryDesigner/res/mipmap-xhdpi/ic_launcher_round.png
new file mode 100644
index 00000000000..2650b3b8a08
Binary files /dev/null and b/catroid/src/embroideryDesigner/res/mipmap-xhdpi/ic_launcher_round.png differ
diff --git a/catroid/src/embroideryDesigner/res/mipmap-xxhdpi/ic_launcher.png b/catroid/src/embroideryDesigner/res/mipmap-xxhdpi/ic_launcher.png
new file mode 100644
index 00000000000..fd6cfb2c7c8
Binary files /dev/null and b/catroid/src/embroideryDesigner/res/mipmap-xxhdpi/ic_launcher.png differ
diff --git a/catroid/src/embroideryDesigner/res/mipmap-xxhdpi/ic_launcher_round.png b/catroid/src/embroideryDesigner/res/mipmap-xxhdpi/ic_launcher_round.png
new file mode 100644
index 00000000000..afaaef2350a
Binary files /dev/null and b/catroid/src/embroideryDesigner/res/mipmap-xxhdpi/ic_launcher_round.png differ
diff --git a/catroid/src/embroideryDesigner/res/mipmap-xxxhdpi/ic_launcher.png b/catroid/src/embroideryDesigner/res/mipmap-xxxhdpi/ic_launcher.png
new file mode 100644
index 00000000000..892195efd9a
Binary files /dev/null and b/catroid/src/embroideryDesigner/res/mipmap-xxxhdpi/ic_launcher.png differ
diff --git a/catroid/src/embroideryDesigner/res/mipmap-xxxhdpi/ic_launcher_round.png b/catroid/src/embroideryDesigner/res/mipmap-xxxhdpi/ic_launcher_round.png
new file mode 100644
index 00000000000..a57a77d6694
Binary files /dev/null and b/catroid/src/embroideryDesigner/res/mipmap-xxxhdpi/ic_launcher_round.png differ
diff --git a/catroid/src/embroideryDesigner/res/values/colors.xml b/catroid/src/embroideryDesigner/res/values/colors.xml
index 8f525b1265f..01e480613a2 100644
--- a/catroid/src/embroideryDesigner/res/values/colors.xml
+++ b/catroid/src/embroideryDesigner/res/values/colors.xml
@@ -25,11 +25,8 @@
#20103B
- @color/solid_white
- @color/solid_white
- @color/solid_white
@color/accent
@color/accent
@@ -46,7 +43,11 @@
#390B52
- #390B52
+ #380F50
+ #392858
+ @color/solid_white
+ #390B52
+ #8D60D6
#380F50
#F9F9F9
diff --git a/catroid/src/lunaAndCat/res/drawable-hdpi/ic_launcher.png b/catroid/src/lunaAndCat/res/drawable-hdpi/ic_launcher.png
deleted file mode 100644
index db769b8e9a4..00000000000
Binary files a/catroid/src/lunaAndCat/res/drawable-hdpi/ic_launcher.png and /dev/null differ
diff --git a/catroid/src/lunaAndCat/res/drawable-hdpi/ic_main_menu_community.png b/catroid/src/lunaAndCat/res/drawable-hdpi/ic_main_menu_community.png
deleted file mode 100644
index 0dd767781d0..00000000000
Binary files a/catroid/src/lunaAndCat/res/drawable-hdpi/ic_main_menu_community.png and /dev/null differ
diff --git a/catroid/src/lunaAndCat/res/drawable-hdpi/ic_main_menu_continue.png b/catroid/src/lunaAndCat/res/drawable-hdpi/ic_main_menu_continue.png
deleted file mode 100644
index 782ca91ebd3..00000000000
Binary files a/catroid/src/lunaAndCat/res/drawable-hdpi/ic_main_menu_continue.png and /dev/null differ
diff --git a/catroid/src/lunaAndCat/res/drawable-hdpi/ic_main_menu_help.png b/catroid/src/lunaAndCat/res/drawable-hdpi/ic_main_menu_help.png
deleted file mode 100644
index ed528c12038..00000000000
Binary files a/catroid/src/lunaAndCat/res/drawable-hdpi/ic_main_menu_help.png and /dev/null differ
diff --git a/catroid/src/lunaAndCat/res/drawable-hdpi/ic_main_menu_new.png b/catroid/src/lunaAndCat/res/drawable-hdpi/ic_main_menu_new.png
deleted file mode 100644
index 457ef995a8d..00000000000
Binary files a/catroid/src/lunaAndCat/res/drawable-hdpi/ic_main_menu_new.png and /dev/null differ
diff --git a/catroid/src/lunaAndCat/res/drawable-hdpi/ic_main_menu_programs.png b/catroid/src/lunaAndCat/res/drawable-hdpi/ic_main_menu_programs.png
deleted file mode 100644
index de4d6e9ae94..00000000000
Binary files a/catroid/src/lunaAndCat/res/drawable-hdpi/ic_main_menu_programs.png and /dev/null differ
diff --git a/catroid/src/lunaAndCat/res/drawable-hdpi/ic_main_menu_upload.png b/catroid/src/lunaAndCat/res/drawable-hdpi/ic_main_menu_upload.png
deleted file mode 100644
index ef29f82b65f..00000000000
Binary files a/catroid/src/lunaAndCat/res/drawable-hdpi/ic_main_menu_upload.png and /dev/null differ
diff --git a/catroid/src/lunaAndCat/res/drawable-ldpi/ic_launcher.png b/catroid/src/lunaAndCat/res/drawable-ldpi/ic_launcher.png
deleted file mode 100644
index 7d91ebe0201..00000000000
Binary files a/catroid/src/lunaAndCat/res/drawable-ldpi/ic_launcher.png and /dev/null differ
diff --git a/catroid/src/lunaAndCat/res/drawable-ldrtl-hdpi/ic_main_menu_continue.png b/catroid/src/lunaAndCat/res/drawable-ldrtl-hdpi/ic_main_menu_continue.png
deleted file mode 100644
index 3a11551e660..00000000000
Binary files a/catroid/src/lunaAndCat/res/drawable-ldrtl-hdpi/ic_main_menu_continue.png and /dev/null differ
diff --git a/catroid/src/lunaAndCat/res/drawable-ldrtl-hdpi/ic_main_menu_help.png b/catroid/src/lunaAndCat/res/drawable-ldrtl-hdpi/ic_main_menu_help.png
deleted file mode 100644
index 778ee39a888..00000000000
Binary files a/catroid/src/lunaAndCat/res/drawable-ldrtl-hdpi/ic_main_menu_help.png and /dev/null differ
diff --git a/catroid/src/lunaAndCat/res/drawable-ldrtl-mdpi/ic_main_menu_continue.png b/catroid/src/lunaAndCat/res/drawable-ldrtl-mdpi/ic_main_menu_continue.png
deleted file mode 100644
index 0de7bed8848..00000000000
Binary files a/catroid/src/lunaAndCat/res/drawable-ldrtl-mdpi/ic_main_menu_continue.png and /dev/null differ
diff --git a/catroid/src/lunaAndCat/res/drawable-ldrtl-mdpi/ic_main_menu_help.png b/catroid/src/lunaAndCat/res/drawable-ldrtl-mdpi/ic_main_menu_help.png
deleted file mode 100644
index 8721630909f..00000000000
Binary files a/catroid/src/lunaAndCat/res/drawable-ldrtl-mdpi/ic_main_menu_help.png and /dev/null differ
diff --git a/catroid/src/lunaAndCat/res/drawable-ldrtl-xhdpi/ic_main_menu_continue.png b/catroid/src/lunaAndCat/res/drawable-ldrtl-xhdpi/ic_main_menu_continue.png
deleted file mode 100644
index 9cbaf40df4a..00000000000
Binary files a/catroid/src/lunaAndCat/res/drawable-ldrtl-xhdpi/ic_main_menu_continue.png and /dev/null differ
diff --git a/catroid/src/lunaAndCat/res/drawable-ldrtl-xhdpi/ic_main_menu_help.png b/catroid/src/lunaAndCat/res/drawable-ldrtl-xhdpi/ic_main_menu_help.png
deleted file mode 100644
index 78b86eea075..00000000000
Binary files a/catroid/src/lunaAndCat/res/drawable-ldrtl-xhdpi/ic_main_menu_help.png and /dev/null differ
diff --git a/catroid/src/lunaAndCat/res/drawable-mdpi/ic_launcher.png b/catroid/src/lunaAndCat/res/drawable-mdpi/ic_launcher.png
deleted file mode 100644
index 8f777e2fa5e..00000000000
Binary files a/catroid/src/lunaAndCat/res/drawable-mdpi/ic_launcher.png and /dev/null differ
diff --git a/catroid/src/lunaAndCat/res/drawable-mdpi/ic_main_menu_community.png b/catroid/src/lunaAndCat/res/drawable-mdpi/ic_main_menu_community.png
deleted file mode 100644
index 5c66b512241..00000000000
Binary files a/catroid/src/lunaAndCat/res/drawable-mdpi/ic_main_menu_community.png and /dev/null differ
diff --git a/catroid/src/lunaAndCat/res/drawable-mdpi/ic_main_menu_continue.png b/catroid/src/lunaAndCat/res/drawable-mdpi/ic_main_menu_continue.png
deleted file mode 100644
index 9893347596c..00000000000
Binary files a/catroid/src/lunaAndCat/res/drawable-mdpi/ic_main_menu_continue.png and /dev/null differ
diff --git a/catroid/src/lunaAndCat/res/drawable-mdpi/ic_main_menu_help.png b/catroid/src/lunaAndCat/res/drawable-mdpi/ic_main_menu_help.png
deleted file mode 100644
index 5fa9f8668ca..00000000000
Binary files a/catroid/src/lunaAndCat/res/drawable-mdpi/ic_main_menu_help.png and /dev/null differ
diff --git a/catroid/src/lunaAndCat/res/drawable-mdpi/ic_main_menu_new.png b/catroid/src/lunaAndCat/res/drawable-mdpi/ic_main_menu_new.png
deleted file mode 100644
index ff2b576cce5..00000000000
Binary files a/catroid/src/lunaAndCat/res/drawable-mdpi/ic_main_menu_new.png and /dev/null differ
diff --git a/catroid/src/lunaAndCat/res/drawable-mdpi/ic_main_menu_programs.png b/catroid/src/lunaAndCat/res/drawable-mdpi/ic_main_menu_programs.png
deleted file mode 100644
index 63c1977e255..00000000000
Binary files a/catroid/src/lunaAndCat/res/drawable-mdpi/ic_main_menu_programs.png and /dev/null differ
diff --git a/catroid/src/lunaAndCat/res/drawable-mdpi/ic_main_menu_upload.png b/catroid/src/lunaAndCat/res/drawable-mdpi/ic_main_menu_upload.png
deleted file mode 100644
index 542cb915ea0..00000000000
Binary files a/catroid/src/lunaAndCat/res/drawable-mdpi/ic_main_menu_upload.png and /dev/null differ
diff --git a/catroid/src/lunaAndCat/res/drawable-xhdpi/ic_launcher.png b/catroid/src/lunaAndCat/res/drawable-xhdpi/ic_launcher.png
deleted file mode 100644
index ec905a166fe..00000000000
Binary files a/catroid/src/lunaAndCat/res/drawable-xhdpi/ic_launcher.png and /dev/null differ
diff --git a/catroid/src/lunaAndCat/res/drawable-xhdpi/ic_main_menu_community.png b/catroid/src/lunaAndCat/res/drawable-xhdpi/ic_main_menu_community.png
deleted file mode 100644
index e4315d7340a..00000000000
Binary files a/catroid/src/lunaAndCat/res/drawable-xhdpi/ic_main_menu_community.png and /dev/null differ
diff --git a/catroid/src/lunaAndCat/res/drawable-xhdpi/ic_main_menu_continue.png b/catroid/src/lunaAndCat/res/drawable-xhdpi/ic_main_menu_continue.png
deleted file mode 100644
index fab61471d78..00000000000
Binary files a/catroid/src/lunaAndCat/res/drawable-xhdpi/ic_main_menu_continue.png and /dev/null differ
diff --git a/catroid/src/lunaAndCat/res/drawable-xhdpi/ic_main_menu_help.png b/catroid/src/lunaAndCat/res/drawable-xhdpi/ic_main_menu_help.png
deleted file mode 100644
index 9f12796a52e..00000000000
Binary files a/catroid/src/lunaAndCat/res/drawable-xhdpi/ic_main_menu_help.png and /dev/null differ
diff --git a/catroid/src/lunaAndCat/res/drawable-xhdpi/ic_main_menu_new.png b/catroid/src/lunaAndCat/res/drawable-xhdpi/ic_main_menu_new.png
deleted file mode 100644
index 82b565327fa..00000000000
Binary files a/catroid/src/lunaAndCat/res/drawable-xhdpi/ic_main_menu_new.png and /dev/null differ
diff --git a/catroid/src/lunaAndCat/res/drawable-xhdpi/ic_main_menu_programs.png b/catroid/src/lunaAndCat/res/drawable-xhdpi/ic_main_menu_programs.png
deleted file mode 100644
index f351bd1f965..00000000000
Binary files a/catroid/src/lunaAndCat/res/drawable-xhdpi/ic_main_menu_programs.png and /dev/null differ
diff --git a/catroid/src/lunaAndCat/res/drawable-xhdpi/ic_main_menu_upload.png b/catroid/src/lunaAndCat/res/drawable-xhdpi/ic_main_menu_upload.png
deleted file mode 100644
index 2a0c8cf8db1..00000000000
Binary files a/catroid/src/lunaAndCat/res/drawable-xhdpi/ic_main_menu_upload.png and /dev/null differ
diff --git a/catroid/src/lunaAndCat/res/drawable-xxhdpi/ic_launcher.png b/catroid/src/lunaAndCat/res/drawable-xxhdpi/ic_launcher.png
deleted file mode 100644
index 5b489c83322..00000000000
Binary files a/catroid/src/lunaAndCat/res/drawable-xxhdpi/ic_launcher.png and /dev/null differ
diff --git a/catroid/src/lunaAndCat/res/drawable/ic_launcher_background.xml b/catroid/src/lunaAndCat/res/drawable/ic_launcher_background.xml
new file mode 100644
index 00000000000..a40f75469f0
--- /dev/null
+++ b/catroid/src/lunaAndCat/res/drawable/ic_launcher_background.xml
@@ -0,0 +1,37 @@
+
+
+
+
+
+
+
diff --git a/catroid/src/lunaAndCat/res/drawable/ic_launcher_foreground.xml b/catroid/src/lunaAndCat/res/drawable/ic_launcher_foreground.xml
new file mode 100644
index 00000000000..5c693f5818a
--- /dev/null
+++ b/catroid/src/lunaAndCat/res/drawable/ic_launcher_foreground.xml
@@ -0,0 +1,141 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/catroid/src/lunaAndCat/res/mipmap-anydpi-v26/ic_launcher.xml b/catroid/src/lunaAndCat/res/mipmap-anydpi-v26/ic_launcher.xml
new file mode 100644
index 00000000000..f17186771e3
--- /dev/null
+++ b/catroid/src/lunaAndCat/res/mipmap-anydpi-v26/ic_launcher.xml
@@ -0,0 +1,28 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/catroid/src/lunaAndCat/res/mipmap-anydpi-v26/ic_launcher_round.xml b/catroid/src/lunaAndCat/res/mipmap-anydpi-v26/ic_launcher_round.xml
new file mode 100644
index 00000000000..f17186771e3
--- /dev/null
+++ b/catroid/src/lunaAndCat/res/mipmap-anydpi-v26/ic_launcher_round.xml
@@ -0,0 +1,28 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/catroid/src/lunaAndCat/res/mipmap-hdpi/ic_launcher.png b/catroid/src/lunaAndCat/res/mipmap-hdpi/ic_launcher.png
new file mode 100644
index 00000000000..7593e5ce0cd
Binary files /dev/null and b/catroid/src/lunaAndCat/res/mipmap-hdpi/ic_launcher.png differ
diff --git a/catroid/src/lunaAndCat/res/mipmap-hdpi/ic_launcher_round.png b/catroid/src/lunaAndCat/res/mipmap-hdpi/ic_launcher_round.png
new file mode 100644
index 00000000000..dc7d6f8ef15
Binary files /dev/null and b/catroid/src/lunaAndCat/res/mipmap-hdpi/ic_launcher_round.png differ
diff --git a/catroid/src/lunaAndCat/res/mipmap-mdpi/ic_launcher.png b/catroid/src/lunaAndCat/res/mipmap-mdpi/ic_launcher.png
new file mode 100644
index 00000000000..b505f8c94c3
Binary files /dev/null and b/catroid/src/lunaAndCat/res/mipmap-mdpi/ic_launcher.png differ
diff --git a/catroid/src/lunaAndCat/res/mipmap-mdpi/ic_launcher_round.png b/catroid/src/lunaAndCat/res/mipmap-mdpi/ic_launcher_round.png
new file mode 100644
index 00000000000..23dbc3004ca
Binary files /dev/null and b/catroid/src/lunaAndCat/res/mipmap-mdpi/ic_launcher_round.png differ
diff --git a/catroid/src/lunaAndCat/res/mipmap-xhdpi/ic_launcher.png b/catroid/src/lunaAndCat/res/mipmap-xhdpi/ic_launcher.png
new file mode 100644
index 00000000000..55be9e1583c
Binary files /dev/null and b/catroid/src/lunaAndCat/res/mipmap-xhdpi/ic_launcher.png differ
diff --git a/catroid/src/lunaAndCat/res/mipmap-xhdpi/ic_launcher_round.png b/catroid/src/lunaAndCat/res/mipmap-xhdpi/ic_launcher_round.png
new file mode 100644
index 00000000000..1a460ae36c3
Binary files /dev/null and b/catroid/src/lunaAndCat/res/mipmap-xhdpi/ic_launcher_round.png differ
diff --git a/catroid/src/lunaAndCat/res/mipmap-xxhdpi/ic_launcher.png b/catroid/src/lunaAndCat/res/mipmap-xxhdpi/ic_launcher.png
new file mode 100644
index 00000000000..1ac80a089db
Binary files /dev/null and b/catroid/src/lunaAndCat/res/mipmap-xxhdpi/ic_launcher.png differ
diff --git a/catroid/src/lunaAndCat/res/mipmap-xxhdpi/ic_launcher_round.png b/catroid/src/lunaAndCat/res/mipmap-xxhdpi/ic_launcher_round.png
new file mode 100644
index 00000000000..15fe9412020
Binary files /dev/null and b/catroid/src/lunaAndCat/res/mipmap-xxhdpi/ic_launcher_round.png differ
diff --git a/catroid/src/lunaAndCat/res/mipmap-xxxhdpi/ic_launcher.png b/catroid/src/lunaAndCat/res/mipmap-xxxhdpi/ic_launcher.png
new file mode 100644
index 00000000000..6863558219f
Binary files /dev/null and b/catroid/src/lunaAndCat/res/mipmap-xxxhdpi/ic_launcher.png differ
diff --git a/catroid/src/lunaAndCat/res/mipmap-xxxhdpi/ic_launcher_round.png b/catroid/src/lunaAndCat/res/mipmap-xxxhdpi/ic_launcher_round.png
new file mode 100644
index 00000000000..318ef29780c
Binary files /dev/null and b/catroid/src/lunaAndCat/res/mipmap-xxxhdpi/ic_launcher_round.png differ
diff --git a/catroid/src/lunaAndCat/res/values/colors.xml b/catroid/src/lunaAndCat/res/values/colors.xml
index b51fd284b06..a521048581a 100644
--- a/catroid/src/lunaAndCat/res/values/colors.xml
+++ b/catroid/src/lunaAndCat/res/values/colors.xml
@@ -28,8 +28,7 @@
@color/accent
- #D19FC1
- @color/solid_white
+ @color/accent
@color/accent
@color/accent
@@ -44,6 +43,10 @@
#33B5E5
+ #392757
+ #392858
+ @color/solid_white
+ #392757
#200E3D
#C8A2CA
#EAB7D5
diff --git a/catroid/src/main/AndroidManifest.xml b/catroid/src/main/AndroidManifest.xml
index 7ebd6b9b56a..8c427243937 100644
--- a/catroid/src/main/AndroidManifest.xml
+++ b/catroid/src/main/AndroidManifest.xml
@@ -91,6 +91,7 @@
android:label="${appName}"
android:theme="@style/Catroid"
android:supportsRtl="true"
+ android:requestLegacyExternalStorage="true"
tools:replace="android:label,android:allowBackup"
android:usesCleartextTraffic="true">
diff --git a/catroid/src/main/java/org/catrobat/catroid/CatroidApplication.java b/catroid/src/main/java/org/catrobat/catroid/CatroidApplication.java
index bea4ca68aac..5f26f4b543f 100644
--- a/catroid/src/main/java/org/catrobat/catroid/CatroidApplication.java
+++ b/catroid/src/main/java/org/catrobat/catroid/CatroidApplication.java
@@ -36,7 +36,7 @@
import org.catrobat.catroid.dagger.AppComponent;
import org.catrobat.catroid.dagger.CatroidModule;
import org.catrobat.catroid.dagger.DaggerAppComponent;
-import org.catrobat.catroid.utils.CrashReporter;
+import org.catrobat.catroid.utils.Utils;
import java.util.Locale;
@@ -65,7 +65,7 @@ public class CatroidApplication extends Application implements HasActivityInject
DispatchingAndroidInjector dispatchingActivityInjector;
protected AppComponent appComponents;
- @TargetApi(28)
+ @TargetApi(29)
@Override
public void onCreate() {
super.onCreate();
@@ -79,7 +79,7 @@ public void onCreate() {
.build());
}
- CrashReporter.initialize(this);
+ Utils.fetchSpeechRecognitionSupportedLanguages(this);
context = getApplicationContext();
@@ -87,7 +87,7 @@ public void onCreate() {
appComponents.initializeEagerSingletons();
appComponents.inject(this);
- defaultSystemLanguage = Locale.getDefault().getLanguage();
+ defaultSystemLanguage = Locale.getDefault().toLanguageTag();
googleAnalytics = GoogleAnalytics.getInstance(this);
googleAnalytics.setDryRun(BuildConfig.DEBUG);
diff --git a/catroid/src/main/java/org/catrobat/catroid/ProjectManager.java b/catroid/src/main/java/org/catrobat/catroid/ProjectManager.java
index 24e1bd3b5a4..d9da1605f13 100644
--- a/catroid/src/main/java/org/catrobat/catroid/ProjectManager.java
+++ b/catroid/src/main/java/org/catrobat/catroid/ProjectManager.java
@@ -26,7 +26,6 @@
import android.util.Log;
import org.catrobat.catroid.common.DefaultProjectHandler;
-import org.catrobat.catroid.common.DefaultProjectHandler.ProjectCreatorType;
import org.catrobat.catroid.common.LookData;
import org.catrobat.catroid.common.ScreenModes;
import org.catrobat.catroid.common.SoundInfo;
@@ -41,7 +40,6 @@
import org.catrobat.catroid.content.backwardcompatibility.BrickTreeBuilder;
import org.catrobat.catroid.content.bricks.ArduinoSendPWMValueBrick;
import org.catrobat.catroid.content.bricks.Brick;
-import org.catrobat.catroid.content.bricks.Brick.BrickField;
import org.catrobat.catroid.content.bricks.FormulaBrick;
import org.catrobat.catroid.content.bricks.SetPenColorBrick;
import org.catrobat.catroid.dagger.EagerSingleton;
@@ -81,6 +79,10 @@ public final class ProjectManager implements EagerSingleton {
private Context applicationContext;
+ public Context getApplicationContext() {
+ return applicationContext;
+ }
+
public ProjectManager(Context applicationContext) {
if (instance != null) {
throw new RuntimeException("ProjectManager should be instantiated only once");
@@ -123,33 +125,33 @@ public void loadProject(File projectDir, Context context) throws ProjectExceptio
restorePreviousProject(previousProject);
throw new OutdatedVersionProjectException(context.getString(R.string.error_outdated_version));
}
- if (project.getCatrobatLanguageVersion() < 0.9f && project.getCatrobatLanguageVersion() != 0.8f) {
+ if (project.getCatrobatLanguageVersion() < 0.9 && project.getCatrobatLanguageVersion() != 0.8) {
restorePreviousProject(previousProject);
throw new CompatibilityProjectException(context.getString(R.string.error_project_compatibility));
}
- if (project.getCatrobatLanguageVersion() <= 0.91f) {
+ if (project.getCatrobatLanguageVersion() <= 0.91) {
project.setScreenMode(ScreenModes.STRETCH);
}
- if (project.getCatrobatLanguageVersion() <= 0.992f) {
+ if (project.getCatrobatLanguageVersion() <= 0.992) {
ProjectManager.updateCollisionFormulasTo993(project);
}
- if (project.getCatrobatLanguageVersion() <= 0.993f) {
+ if (project.getCatrobatLanguageVersion() <= 0.993) {
ProjectManager.updateSetPenColorFormulasTo994(project);
}
- if (project.getCatrobatLanguageVersion() <= 0.994f) {
+ if (project.getCatrobatLanguageVersion() <= 0.994) {
ProjectManager.updateArduinoValuesTo995(project);
}
- if (project.getCatrobatLanguageVersion() <= 0.995f) {
+ if (project.getCatrobatLanguageVersion() <= 0.995) {
ProjectManager.updateCollisionScriptsTo996(project);
}
- if (project.getCatrobatLanguageVersion() <= 0.999f) {
+ if (project.getCatrobatLanguageVersion() <= 0.999) {
ProjectManager.makeShallowCopiesDeepAgain(project);
}
- if (project.getCatrobatLanguageVersion() <= 0.9993f) {
+ if (project.getCatrobatLanguageVersion() <= 0.9993) {
ProjectManager.updateScriptsToTreeStructure(project);
}
- if (project.getCatrobatLanguageVersion() <= 0.99992f) {
+ if (project.getCatrobatLanguageVersion() <= 0.99992) {
removePermissionsFile(project);
}
project.setCatrobatLanguageVersion(CURRENT_CATROBAT_LANGUAGE_VERSION);
@@ -333,9 +335,9 @@ public static void updateSetPenColorFormulasTo994(Project project) {
for (Brick brick : script.getBrickList()) {
if (brick instanceof SetPenColorBrick) {
SetPenColorBrick spcBrick = (SetPenColorBrick) brick;
- spcBrick.replaceFormulaBrickField(BrickField.PHIRO_LIGHT_RED, BrickField.PEN_COLOR_RED);
- spcBrick.replaceFormulaBrickField(BrickField.PHIRO_LIGHT_GREEN, BrickField.PEN_COLOR_GREEN);
- spcBrick.replaceFormulaBrickField(BrickField.PHIRO_LIGHT_BLUE, BrickField.PEN_COLOR_BLUE);
+ spcBrick.replaceFormulaBrickField(Brick.BrickField.PHIRO_LIGHT_RED, Brick.BrickField.PEN_COLOR_RED);
+ spcBrick.replaceFormulaBrickField(Brick.BrickField.PHIRO_LIGHT_GREEN, Brick.BrickField.PEN_COLOR_GREEN);
+ spcBrick.replaceFormulaBrickField(Brick.BrickField.PHIRO_LIGHT_BLUE, Brick.BrickField.PEN_COLOR_BLUE);
}
}
}
@@ -423,7 +425,7 @@ public boolean initializeDefaultProject(Context context) {
}
}
- @SuppressWarnings({"unused"})
+ @SuppressWarnings("unused")
public void createNewEmptyProject(String name, boolean landscapeMode, boolean castEnabled) throws IOException {
createNewEmptyProject(name, applicationContext, landscapeMode, castEnabled);
}
@@ -439,16 +441,16 @@ public void createNewEmptyProject(String name, Context context, boolean landscap
currentlyPlayingScene = currentlyEditedScene;
}
- @SuppressWarnings({"unused"})
- public void createNewExampleProject(String name, ProjectCreatorType projectCreatorType, boolean landscapeMode) throws IOException {
+ @SuppressWarnings("unused")
+ public void createNewExampleProject(String name, DefaultProjectHandler.ProjectCreatorType projectCreatorType, boolean landscapeMode) throws IOException {
createNewExampleProject(name, applicationContext, projectCreatorType, landscapeMode);
}
/**
- * @deprecated use {@link #createNewExampleProject(String, ProjectCreatorType, boolean)} ()} without Context instead.
+ * @deprecated use {@link #createNewExampleProject(String, DefaultProjectHandler.ProjectCreatorType, boolean)} ()} without Context instead.
*/
@Deprecated
- public void createNewExampleProject(String name, Context context, ProjectCreatorType projectCreatorType, boolean landscapeMode) throws IOException {
+ public void createNewExampleProject(String name, Context context, DefaultProjectHandler.ProjectCreatorType projectCreatorType, boolean landscapeMode) throws IOException {
DefaultProjectHandler.getInstance().setDefaultProjectCreator(projectCreatorType);
project = DefaultProjectHandler.createAndSaveDefaultProject(name, context, landscapeMode);
currentSprite = null;
diff --git a/catroid/src/main/java/org/catrobat/catroid/camera/CameraManager.kt b/catroid/src/main/java/org/catrobat/catroid/camera/CameraManager.kt
index 7068e3bf565..c984dd2f356 100644
--- a/catroid/src/main/java/org/catrobat/catroid/camera/CameraManager.kt
+++ b/catroid/src/main/java/org/catrobat/catroid/camera/CameraManager.kt
@@ -25,14 +25,15 @@ package org.catrobat.catroid.camera
import android.content.pm.PackageManager
import android.util.Log
import android.view.View
-import android.view.ViewGroup
+import android.view.ViewGroup.LayoutParams.MATCH_PARENT
+import android.widget.FrameLayout
+import androidx.annotation.UiThread
import androidx.camera.core.Camera
import androidx.camera.core.CameraSelector
import androidx.camera.core.ImageAnalysis
import androidx.camera.core.Preview
import androidx.camera.core.UseCase
import androidx.camera.lifecycle.ProcessCameraProvider
-import androidx.camera.view.PreviewView
import androidx.lifecycle.Lifecycle
import androidx.lifecycle.LifecycleOwner
import androidx.lifecycle.LifecycleRegistry
@@ -45,9 +46,8 @@ import java.util.concurrent.Executors
class CameraManager(private val stageActivity: StageActivity) : LifecycleOwner {
private val cameraProvider = ProcessCameraProvider.getInstance(stageActivity).get()
private val lifecycle = LifecycleRegistry(this)
- private val previewView = PreviewView(stageActivity).also {
- it.scaleType = PreviewView.ScaleType.FILL_CENTER
- it.visibility = View.INVISIBLE
+ private val previewView = PreviewView(stageActivity).apply {
+ visibility = View.INVISIBLE
}
private val previewUseCase = Preview.Builder().build()
@@ -67,6 +67,9 @@ class CameraManager(private val stageActivity: StageActivity) : LifecycleOwner {
var faceDetectionOn = false
private set
+ var textDetectionOn = false
+ private set
+
var flashOn = false
private set
@@ -76,10 +79,10 @@ class CameraManager(private val stageActivity: StageActivity) : LifecycleOwner {
init {
if (hasFrontCamera || hasBackCamera) {
- stageActivity.addContentView(previewView, ViewGroup.LayoutParams(
- ViewGroup.LayoutParams.MATCH_PARENT,
- ViewGroup.LayoutParams.MATCH_PARENT
- ))
+ stageActivity.addContentView(
+ previewView,
+ FrameLayout.LayoutParams(MATCH_PARENT, MATCH_PARENT)
+ )
}
defaultCameraSelector = if (hasFrontCamera) {
@@ -103,6 +106,7 @@ class CameraManager(private val stageActivity: StageActivity) : LifecycleOwner {
flashOn = false
previewVisible = false
faceDetectionOn = false
+ textDetectionOn = false
unbindPreview()
switchToDefaultCamera()
}
@@ -149,6 +153,7 @@ class CameraManager(private val stageActivity: StageActivity) : LifecycleOwner {
}
if (cameraProvider.isBound(analysisUseCase)) {
bindFaceDetector()
+ bindTextDetector()
}
return true
}
@@ -216,6 +221,15 @@ class CameraManager(private val stageActivity: StageActivity) : LifecycleOwner {
return true
}
+ @Synchronized
+ fun startTextDetection(): Boolean {
+ if (textDetectionOn.not()) {
+ textDetectionOn = true
+ bindTextDetector()
+ }
+ return true
+ }
+
private fun bindPreview(): Boolean {
previewView.visibility = View.VISIBLE
return bindUseCase(previewUseCase).also {
@@ -226,6 +240,7 @@ class CameraManager(private val stageActivity: StageActivity) : LifecycleOwner {
}
}
+ @UiThread
private fun unbindPreview() {
cameraProvider.unbind(previewUseCase)
if (cameraProvider.isBound(analysisUseCase).not()) {
@@ -233,10 +248,16 @@ class CameraManager(private val stageActivity: StageActivity) : LifecycleOwner {
}
}
+ @UiThread
private fun bindFaceDetector() = bindUseCase(analysisUseCase).also {
analysisUseCase.setAnalyzer(Executors.newSingleThreadExecutor(), FaceDetector)
}
+ private fun bindTextDetector() = bindUseCase(analysisUseCase).also {
+ analysisUseCase.setAnalyzer(Executors.newSingleThreadExecutor(), TextDetector)
+ }
+
+ @UiThread
private fun bindUseCase(useCase: UseCase): Boolean {
if (cameraProvider.isBound(useCase)) {
cameraProvider.unbind(useCase)
diff --git a/catroid/src/main/java/org/catrobat/catroid/camera/PreviewView.kt b/catroid/src/main/java/org/catrobat/catroid/camera/PreviewView.kt
new file mode 100644
index 00000000000..db08f82016e
--- /dev/null
+++ b/catroid/src/main/java/org/catrobat/catroid/camera/PreviewView.kt
@@ -0,0 +1,77 @@
+/*
+ * Catroid: An on-device visual programming system for Android devices
+ * Copyright (C) 2010-2020 The Catrobat Team
+ * ()
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * An additional term exception under section 7 of the GNU Affero
+ * General Public License, version 3, is available at
+ * http://developer.catrobat.org/license_additional_term
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+package org.catrobat.catroid.camera
+
+import android.content.Context
+import android.os.Build
+import android.view.SurfaceView
+import android.widget.FrameLayout
+import androidx.camera.core.Preview.SurfaceProvider
+import androidx.core.util.Consumer
+import java.util.concurrent.Executors
+import kotlin.math.roundToInt
+
+class PreviewView(context: Context) : FrameLayout(context) {
+ private val surfaceView = SurfaceView(context)
+
+ init {
+ addView(surfaceView)
+ }
+
+ fun createSurfaceProvider() = SurfaceProvider { request ->
+ with(request.resolution) {
+ surfaceView.holder.setFixedSize(width, height)
+ scaleView(width, height)
+ }
+ request.provideSurface(
+ surfaceView.holder.surface,
+ Executors.newSingleThreadExecutor(),
+ Consumer { }
+ )
+ }
+
+ private fun scaleView(imageWidth: Int, imageHeight: Int) {
+ val imageAspectRatio = imageHeight.toFloat() / imageWidth
+ val screenAspectRatio = this.width.toFloat() / this.height
+
+ if (screenAspectRatio < 1) { // portrait mode
+ val scalingFactor = imageAspectRatio / screenAspectRatio
+ if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) {
+ val scaledWidth = (imageWidth * scalingFactor).roundToInt()
+ surfaceView.layoutParams = LayoutParams(scaledWidth, imageHeight)
+ } else if (Build.VERSION.SDK_INT == Build.VERSION_CODES.M) {
+ surfaceView.layoutParams.width = (this.width * scalingFactor).roundToInt()
+ }
+ surfaceView.scaleX = scalingFactor
+ } else { // landscape mode
+ val scalingFactor = imageAspectRatio * screenAspectRatio
+ if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) {
+ val scaledHeight = (imageHeight * scalingFactor).roundToInt()
+ surfaceView.layoutParams = LayoutParams(imageWidth, scaledHeight)
+ } else if (Build.VERSION.SDK_INT == Build.VERSION_CODES.M) {
+ surfaceView.layoutParams.height = (this.height * scalingFactor).roundToInt()
+ }
+ surfaceView.scaleY = scalingFactor
+ }
+ }
+}
diff --git a/catroid/src/main/java/org/catrobat/catroid/camera/TextDetector.kt b/catroid/src/main/java/org/catrobat/catroid/camera/TextDetector.kt
new file mode 100644
index 00000000000..8ab70bdc442
--- /dev/null
+++ b/catroid/src/main/java/org/catrobat/catroid/camera/TextDetector.kt
@@ -0,0 +1,105 @@
+/*
+ * Catroid: An on-device visual programming system for Android devices
+ * Copyright (C) 2010-2020 The Catrobat Team
+ * ()
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * An additional term exception under section 7 of the GNU Affero
+ * General Public License, version 3, is available at
+ * http://developer.catrobat.org/license_additional_term
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+
+package org.catrobat.catroid.camera
+
+import android.util.Log
+import androidx.annotation.VisibleForTesting
+import androidx.camera.core.ExperimentalGetImage
+import androidx.camera.core.ImageAnalysis
+import androidx.camera.core.ImageProxy
+import com.google.mlkit.vision.common.InputImage
+import com.google.mlkit.vision.text.TextRecognition
+import com.google.mlkit.vision.text.Text
+import org.catrobat.catroid.R
+import org.catrobat.catroid.formulaeditor.SensorCustomEvent
+import org.catrobat.catroid.formulaeditor.SensorCustomEventListener
+import org.catrobat.catroid.formulaeditor.Sensors
+import org.catrobat.catroid.stage.StageActivity
+import org.catrobat.catroid.utils.TextBlockUtil
+
+object TextDetector : ImageAnalysis.Analyzer {
+ private val detectionClient = TextRecognition.getClient()
+ private val sensorListeners = mutableSetOf()
+
+ @JvmStatic
+ fun addListener(listener: SensorCustomEventListener) {
+ sensorListeners.add(listener)
+ }
+
+ @JvmStatic
+ fun removeListener(listener: SensorCustomEventListener) {
+ sensorListeners.remove(listener)
+ }
+
+ @ExperimentalGetImage
+ override fun analyze(imageProxy: ImageProxy) {
+ imageProxy.image?.let { mediaImage ->
+ val image = InputImage.fromMediaImage(
+ mediaImage,
+ imageProxy.imageInfo.rotationDegrees
+ )
+
+ detectionClient.process(image)
+ .addOnSuccessListener { text ->
+ updateSensorValues(text, mediaImage.width, mediaImage.height)
+ imageProxy.close()
+ }
+ .addOnFailureListener { e ->
+ val context = StageActivity.activeStageActivity.get()
+ StageActivity.messageHandler.obtainMessage(
+ StageActivity.SHOW_TOAST,
+ arrayListOf(context?.getString(R.string.camera_error_text_detection))
+ ).sendToTarget()
+ Log.e(javaClass.simpleName, "Could not analyze image.", e)
+ }
+ }
+ }
+
+ private fun updateSensorValues(text: Text, imageWidth: Int, imageHeight: Int) {
+ val detected = text.textBlocks.isEmpty().not()
+ if (detected) {
+ translateTextToSensorValues(text, imageWidth, imageHeight)
+ }
+ }
+
+ private fun translateTextToSensorValues(text: Text, imageWidth: Int, imageHeight: Int) {
+ val textFromCamera = text.text
+
+ val textBlocksNumber = text.textBlocks.size
+
+ TextBlockUtil.setTextBlocks(text.textBlocks, imageWidth, imageHeight)
+
+ onTextDetected(textFromCamera, textBlocksNumber)
+ }
+
+ @VisibleForTesting(otherwise = VisibleForTesting.PRIVATE)
+ fun onTextDetected(text: String, size: Int) {
+ sensorListeners.forEach {
+ it.onCustomSensorChanged(
+ SensorCustomEvent(Sensors.TEXT_FROM_CAMERA, arrayOf(text)))
+ it.onCustomSensorChanged(
+ SensorCustomEvent(Sensors.TEXT_BLOCKS_NUMBER, floatArrayOf(size.toFloat())))
+ }
+ }
+}
diff --git a/catroid/src/main/java/org/catrobat/catroid/common/Constants.java b/catroid/src/main/java/org/catrobat/catroid/common/Constants.java
index fc48ba77963..84ac02a9e28 100644
--- a/catroid/src/main/java/org/catrobat/catroid/common/Constants.java
+++ b/catroid/src/main/java/org/catrobat/catroid/common/Constants.java
@@ -39,7 +39,7 @@
public final class Constants {
- public static final float CURRENT_CATROBAT_LANGUAGE_VERSION = 0.999999f;
+ public static final double CURRENT_CATROBAT_LANGUAGE_VERSION = 0.99999991;
public static final String REMOTE_DISPLAY_APP_ID = "CEBB9229";
public static final int CAST_CONNECTION_TIMEOUT = 5000; //in milliseconds
@@ -116,14 +116,14 @@ public final class Constants {
// Default "flavor" in the web which equals "pocketcode"
public static final String BASE_APP_URL_HTTPS = MAIN_URL_HTTPS + "/app/";
- public static final String SHARE_PROGRAM_URL = BASE_URL_HTTPS + "/program/";
+ public static final String SHARE_PROJECT_URL = BASE_URL_HTTPS + "/project/";
public static final String CATROBAT_ABOUT_URL = "https://www.catrobat.org/";
public static final String ABOUT_POCKETCODE_LICENSE_URL = "https://catrob.at/licenses";
public static final String WEB_REQUEST_WIKI_URL = "https://catrob.at/webbricks";
public static final String CATROBAT_TERMS_OF_USE_URL = BASE_URL_HTTPS + "termsOfUse";
- public static final String CATROBAT_HELP_URL = BASE_URL_HTTPS + "help";
+ public static final String CATROBAT_HELP_URL = "https://catrob.at/help";
public static final String CATROBAT_TOKEN_LOGIN_URL = BASE_URL_HTTPS + "tokenlogin?username=";
public static final String CATROBAT_DELETE_ACCOUNT_URL = BASE_URL_HTTPS + "profile/edit";
@@ -277,6 +277,8 @@ public final class Constants {
public static final int UPLOAD_IMAGE_SCALE_WIDTH = 480;
public static final int UPLOAD_IMAGE_SCALE_HEIGHT = 480;
+ public static final int TEXT_FROM_CAMERA_SENSOR_HASHCODE = 1613638780;
+
//Services + Notifications
public static final int UPDATE_DOWNLOAD_PROGRESS = 101;
public static final int UPDATE_DOWNLOAD_ERROR = 105;
diff --git a/catroid/src/main/java/org/catrobat/catroid/common/LookData.java b/catroid/src/main/java/org/catrobat/catroid/common/LookData.java
index 1bf7470fd34..ed46a7744a5 100644
--- a/catroid/src/main/java/org/catrobat/catroid/common/LookData.java
+++ b/catroid/src/main/java/org/catrobat/catroid/common/LookData.java
@@ -37,7 +37,6 @@
import org.catrobat.catroid.content.bricks.Brick;
import org.catrobat.catroid.io.StorageOperations;
import org.catrobat.catroid.sensing.CollisionInformation;
-import org.catrobat.catroid.utils.CrashReporter;
import org.catrobat.catroid.utils.ImageEditing;
import java.io.File;
@@ -179,7 +178,6 @@ public Pixmap getPixmap() {
}
} catch (NullPointerException nullPointerException) {
Log.e(TAG, Log.getStackTraceString(nullPointerException));
- CrashReporter.logException(nullPointerException);
}
}
return pixmap;
diff --git a/catroid/src/main/java/org/catrobat/catroid/common/NfcTagData.java b/catroid/src/main/java/org/catrobat/catroid/common/NfcTagData.java
index 1261b24bebb..2566a4c7c07 100644
--- a/catroid/src/main/java/org/catrobat/catroid/common/NfcTagData.java
+++ b/catroid/src/main/java/org/catrobat/catroid/common/NfcTagData.java
@@ -23,6 +23,9 @@
package org.catrobat.catroid.common;
import java.io.Serializable;
+import java.util.Objects;
+
+import androidx.annotation.Nullable;
public class NfcTagData implements Cloneable, Comparable, Nameable, Serializable {
private static final long serialVersionUID = 1L;
@@ -68,4 +71,18 @@ public int compareTo(NfcTagData nfcTagData) {
public String toString() {
return name;
}
+
+ @Override
+ public boolean equals(@Nullable Object obj) {
+ if (obj instanceof NfcTagData) {
+ NfcTagData nfcTagData = (NfcTagData) obj;
+ return uid.equals(nfcTagData.getNfcTagUid());
+ }
+ return false;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(name, uid);
+ }
}
diff --git a/catroid/src/main/java/org/catrobat/catroid/common/ProjectData.java b/catroid/src/main/java/org/catrobat/catroid/common/ProjectData.java
index 26ed27af535..183d6530673 100644
--- a/catroid/src/main/java/org/catrobat/catroid/common/ProjectData.java
+++ b/catroid/src/main/java/org/catrobat/catroid/common/ProjectData.java
@@ -36,10 +36,10 @@ public class ProjectData implements Nameable, Serializable {
private String name;
private File directory;
- private float languageVersion;
+ private double languageVersion;
private boolean hasScenes;
- public ProjectData(String name, File directory, float languageVersion, boolean hasScenes) {
+ public ProjectData(String name, File directory, double languageVersion, boolean hasScenes) {
this.name = name;
this.directory = directory;
this.languageVersion = languageVersion;
@@ -54,7 +54,7 @@ public void setName(String name) {
throw new RuntimeException("Do not set the project name through this. TODO: refactor nameable interface.");
}
- public float getLanguageVersion() {
+ public double getLanguageVersion() {
return languageVersion;
}
diff --git a/catroid/src/main/java/org/catrobat/catroid/common/SharedPreferenceKeys.java b/catroid/src/main/java/org/catrobat/catroid/common/SharedPreferenceKeys.java
index 937cfa2238b..ed35a89c0e0 100644
--- a/catroid/src/main/java/org/catrobat/catroid/common/SharedPreferenceKeys.java
+++ b/catroid/src/main/java/org/catrobat/catroid/common/SharedPreferenceKeys.java
@@ -34,11 +34,12 @@ private SharedPreferenceKeys() {
public static final String DEVICE_LANGUAGE = "deviceLanguage";
public static final String LANGUAGE_TAG_KEY = "applicationLanguage";
- public static final String[] LANGUAGE_CODE = {DEVICE_LANGUAGE, "az", "in", "bs", "ca", "cs", "sr-rCS",
- "sr-rSP", "da", "de", "en-rAU", "en-rCA", "en-rGB", "en", "es", "el", "fr", "gl", "hr", "it",
- "sw", "hu", "mk", "ms", "nl", "no", "pl", "pt-rBR", "pt", "ru", "ro", "sq", "sl", "sk",
- "sv", "vi", "tr", "uk", "bg", "ml", "ta", "kn", "te", "th", "gu", "hi", "ja", "ko", "lt", "zh-rCN",
- "zh-rTW", "ar", "ur", "fa", "ps", "sd", "iw"};
+ public static final String[] LANGUAGE_TAGS = {DEVICE_LANGUAGE, "af", "az", "ms", "bs", "ca",
+ "da", "de", "en-AU", "en-CA", "en-GB", "en", "es", "fr", "gl", "ha", "hr", "ig", "id",
+ "it", "sw", "lt", "hu", "nl", "no", "pl", "pt-BR", "pt", "ro", "sq", "sk", "sl", "fi",
+ "sv", "vi", "tw", "tr", "cs", "el", "bg", "mk", "ru", "sr-CS", "sr", "sr-SP", "uk",
+ "kk", "he", "ur", "ar", "sd", "fa", "ps", "hi", "bn", "gu", "ta", "te", "kn", "ml",
+ "si", "th", "zh-CN", "zh-TW", "ja", "ko"};
public static final String SHOW_DETAILS_LOOKS_PREFERENCE_KEY = "showDetailsLookList";
public static final String SHOW_DETAILS_PROJECTS_PREFERENCE_KEY = "showDetailsProjectList";
diff --git a/catroid/src/main/java/org/catrobat/catroid/common/SoundInfo.java b/catroid/src/main/java/org/catrobat/catroid/common/SoundInfo.java
index 357cf487028..0a1f0f084a8 100644
--- a/catroid/src/main/java/org/catrobat/catroid/common/SoundInfo.java
+++ b/catroid/src/main/java/org/catrobat/catroid/common/SoundInfo.java
@@ -44,6 +44,8 @@ public class SoundInfo implements Cloneable, Nameable, Serializable {
private transient File file;
+ boolean midiFile;
+
public SoundInfo() {
}
@@ -51,6 +53,14 @@ public SoundInfo(String name, @NonNull File file) {
this.name = name;
this.file = file;
fileName = file.getName();
+ midiFile = false;
+ }
+
+ public SoundInfo(String name, @NonNull File file, boolean midiFile) {
+ this.name = name;
+ this.file = file;
+ fileName = file.getName();
+ this.midiFile = midiFile;
}
public String getName() {
@@ -78,6 +88,10 @@ public void setFile(File file) {
fileName = file.getName();
}
+ public boolean isMidiFile() {
+ return midiFile;
+ }
+
@SuppressWarnings("MethodDoesntCallSuperMethod")
@Override
public SoundInfo clone() {
diff --git a/catroid/src/main/java/org/catrobat/catroid/common/ThreadScheduler.java b/catroid/src/main/java/org/catrobat/catroid/common/ThreadScheduler.java
index 444e0c92e91..c494b625d1c 100644
--- a/catroid/src/main/java/org/catrobat/catroid/common/ThreadScheduler.java
+++ b/catroid/src/main/java/org/catrobat/catroid/common/ThreadScheduler.java
@@ -28,7 +28,8 @@
import com.badlogic.gdx.utils.Array;
import org.catrobat.catroid.content.Script;
-import org.catrobat.catroid.content.actions.EventThread;
+import org.catrobat.catroid.content.actions.ScriptSequenceAction;
+import org.catrobat.catroid.content.actions.ScriptSequenceActionWithWaiter;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
@@ -45,7 +46,7 @@ public class ThreadScheduler {
public static final int RUNNING = 0;
public static final int SUSPENDED = 1;
- private Array startQueue = new Array<>();
+ private Array startQueue = new Array<>();
private Array stopQueue = new Array<>();
private Actor actor;
@SchedulerState
@@ -63,7 +64,7 @@ public void tick(float delta) {
}
private void startThreadsInStartQueue() {
- for (EventThread thread : startQueue) {
+ for (ScriptSequenceAction thread : startQueue) {
thread.restart();
actor.addAction(thread);
}
@@ -82,24 +83,26 @@ private void runThreadsForOneTick(Array actions, float delta) {
private void stopThreadsInStopQueue(Array actions) {
actions.removeAll(stopQueue, true);
for (Action action : stopQueue) {
- if (action instanceof EventThread) {
- ((EventThread) action).notifyWaiter();
+ if (action instanceof ScriptSequenceActionWithWaiter) {
+ ((ScriptSequenceActionWithWaiter) action).notifyWaiter();
}
}
stopQueue.clear();
}
- public void startThread(EventThread threadToBeStarted) {
- removeThreadsWithEqualScriptFromStartQueue(threadToBeStarted);
- startQueue.add(threadToBeStarted);
+ public void startThread(ScriptSequenceAction sequenceAction) {
+ removeThreadsWithEqualScriptFromStartQueue(sequenceAction);
+ startQueue.add(sequenceAction);
}
- private void removeThreadsWithEqualScriptFromStartQueue(EventThread threadToBeStarted) {
- Iterator iterator = startQueue.iterator();
+ private void removeThreadsWithEqualScriptFromStartQueue(ScriptSequenceAction sequenceAction) {
+ Iterator iterator = startQueue.iterator();
while (iterator.hasNext()) {
- EventThread action = iterator.next();
- if (action.getScript() == threadToBeStarted.getScript()) {
- action.notifyWaiter();
+ ScriptSequenceAction action = iterator.next();
+ if (action.getScript() == sequenceAction.getScript()) {
+ if (action instanceof ScriptSequenceActionWithWaiter) {
+ ((ScriptSequenceActionWithWaiter) action).notifyWaiter();
+ }
iterator.remove();
}
}
@@ -107,7 +110,7 @@ private void removeThreadsWithEqualScriptFromStartQueue(EventThread threadToBeSt
public void stopThreadsWithScript(Script script) {
for (Action action : actor.getActions()) {
- if (action instanceof EventThread && ((EventThread) action).getScript() == script) {
+ if (action instanceof ScriptSequenceAction && ((ScriptSequenceAction) action).getScript() == script) {
stopQueue.add(action);
}
}
diff --git a/catroid/src/main/java/org/catrobat/catroid/common/defaultprojectcreators/JumpingSumoProjectCreator.java b/catroid/src/main/java/org/catrobat/catroid/common/defaultprojectcreators/JumpingSumoProjectCreator.java
index 1e4368bd13b..8eb740555ea 100644
--- a/catroid/src/main/java/org/catrobat/catroid/common/defaultprojectcreators/JumpingSumoProjectCreator.java
+++ b/catroid/src/main/java/org/catrobat/catroid/common/defaultprojectcreators/JumpingSumoProjectCreator.java
@@ -31,7 +31,6 @@
import org.catrobat.catroid.content.Project;
import org.catrobat.catroid.content.Scene;
import org.catrobat.catroid.content.Script;
-import org.catrobat.catroid.content.SingleSprite;
import org.catrobat.catroid.content.Sprite;
import org.catrobat.catroid.content.StartScript;
import org.catrobat.catroid.content.WhenScript;
@@ -125,7 +124,7 @@ public Project createDefaultProject(String name, Context context, boolean landsc
imageFileName,
backgroundImageScaleFactor);
- Sprite sprite = spriteFactory.newInstance(SingleSprite.class.getSimpleName(), backgroundName);
+ Sprite sprite = spriteFactory.newInstance(Sprite.class.getSimpleName(), backgroundName);
LookData backgroundLookData = new LookData(backgroundName, backgroundFile);
sprite.getLookList().add(backgroundLookData);
diff --git a/catroid/src/main/java/org/catrobat/catroid/content/ActionFactory.java b/catroid/src/main/java/org/catrobat/catroid/content/ActionFactory.java
index eb3f9d916f4..9200091d024 100644
--- a/catroid/src/main/java/org/catrobat/catroid/content/ActionFactory.java
+++ b/catroid/src/main/java/org/catrobat/catroid/content/ActionFactory.java
@@ -39,6 +39,7 @@
import org.catrobat.catroid.content.actions.AskSpeechAction;
import org.catrobat.catroid.content.actions.AssertEqualsAction;
import org.catrobat.catroid.content.actions.AssertUserListAction;
+import org.catrobat.catroid.content.actions.BroadcastAction;
import org.catrobat.catroid.content.actions.CameraBrickAction;
import org.catrobat.catroid.content.actions.ChangeBrightnessByNAction;
import org.catrobat.catroid.content.actions.ChangeColorByNAction;
@@ -72,9 +73,9 @@
import org.catrobat.catroid.content.actions.DroneTurnRightAction;
import org.catrobat.catroid.content.actions.DroneTurnRightWithMagnetometerAction;
import org.catrobat.catroid.content.actions.EventAction;
-import org.catrobat.catroid.content.actions.EventThread;
import org.catrobat.catroid.content.actions.FinishStageAction;
import org.catrobat.catroid.content.actions.FlashAction;
+import org.catrobat.catroid.content.actions.ForItemInUserListAction;
import org.catrobat.catroid.content.actions.ForVariableFromToAction;
import org.catrobat.catroid.content.actions.GoNStepsBackAction;
import org.catrobat.catroid.content.actions.GoToOtherSpritePositionAction;
@@ -105,9 +106,8 @@
import org.catrobat.catroid.content.actions.LegoNxtPlayToneAction;
import org.catrobat.catroid.content.actions.LookRequestAction;
import org.catrobat.catroid.content.actions.MoveNStepsAction;
-import org.catrobat.catroid.content.actions.NextLookAction;
-import org.catrobat.catroid.content.actions.NotifyEventWaiterAction;
import org.catrobat.catroid.content.actions.ParameterizedAssertAction;
+import org.catrobat.catroid.content.actions.PauseForBeatsAction;
import org.catrobat.catroid.content.actions.PenDownAction;
import org.catrobat.catroid.content.actions.PenUpAction;
import org.catrobat.catroid.content.actions.PhiroMotorMoveBackwardAction;
@@ -119,7 +119,6 @@
import org.catrobat.catroid.content.actions.PlaySoundAction;
import org.catrobat.catroid.content.actions.PointInDirectionAction;
import org.catrobat.catroid.content.actions.PointToAction;
-import org.catrobat.catroid.content.actions.PreviousLookAction;
import org.catrobat.catroid.content.actions.RaspiIfLogicAction;
import org.catrobat.catroid.content.actions.RaspiPwmAction;
import org.catrobat.catroid.content.actions.RaspiSendDigitalValueAction;
@@ -134,17 +133,20 @@
import org.catrobat.catroid.content.actions.SceneStartAction;
import org.catrobat.catroid.content.actions.SceneTransitionAction;
import org.catrobat.catroid.content.actions.ScriptSequenceAction;
-import org.catrobat.catroid.content.actions.SetBackgroundLookAction;
-import org.catrobat.catroid.content.actions.SetBackgroundLookByIndexAction;
import org.catrobat.catroid.content.actions.SetBrightnessAction;
import org.catrobat.catroid.content.actions.SetColorAction;
+import org.catrobat.catroid.content.actions.SetInstrumentAction;
+import org.catrobat.catroid.content.actions.SetListeningLanguageAction;
import org.catrobat.catroid.content.actions.SetLookAction;
import org.catrobat.catroid.content.actions.SetLookByIndexAction;
+import org.catrobat.catroid.content.actions.SetNextLookAction;
import org.catrobat.catroid.content.actions.SetNfcTagAction;
import org.catrobat.catroid.content.actions.SetPenColorAction;
import org.catrobat.catroid.content.actions.SetPenSizeAction;
+import org.catrobat.catroid.content.actions.SetPreviousLookAction;
import org.catrobat.catroid.content.actions.SetRotationStyleAction;
import org.catrobat.catroid.content.actions.SetSizeToAction;
+import org.catrobat.catroid.content.actions.SetTempoAction;
import org.catrobat.catroid.content.actions.SetTextAction;
import org.catrobat.catroid.content.actions.SetTransparencyAction;
import org.catrobat.catroid.content.actions.SetVariableAction;
@@ -156,6 +158,7 @@
import org.catrobat.catroid.content.actions.ShowTextColorSizeAlignmentAction;
import org.catrobat.catroid.content.actions.SpeakAction;
import org.catrobat.catroid.content.actions.StampAction;
+import org.catrobat.catroid.content.actions.StartListeningAction;
import org.catrobat.catroid.content.actions.StitchAction;
import org.catrobat.catroid.content.actions.StopAllScriptsAction;
import org.catrobat.catroid.content.actions.StopAllSoundsAction;
@@ -176,6 +179,7 @@
import org.catrobat.catroid.content.actions.WaitTillIdleAction;
import org.catrobat.catroid.content.actions.WaitUntilAction;
import org.catrobat.catroid.content.actions.WebRequestAction;
+import org.catrobat.catroid.content.actions.WriteEmbroideryToFileAction;
import org.catrobat.catroid.content.actions.WriteListOnDeviceAction;
import org.catrobat.catroid.content.actions.WriteVariableOnDeviceAction;
import org.catrobat.catroid.content.actions.WriteVariableToFileAction;
@@ -196,8 +200,7 @@
import org.catrobat.catroid.content.bricks.PhiroMotorStopBrick;
import org.catrobat.catroid.content.bricks.PhiroPlayToneBrick;
import org.catrobat.catroid.content.bricks.PhiroRGBLightBrick;
-import org.catrobat.catroid.content.eventids.BroadcastEventId;
-import org.catrobat.catroid.content.eventids.EventId;
+import org.catrobat.catroid.content.bricks.brickspinner.PickableMusicalInstrument;
import org.catrobat.catroid.formulaeditor.Formula;
import org.catrobat.catroid.formulaeditor.UserList;
import org.catrobat.catroid.formulaeditor.UserVariable;
@@ -209,24 +212,10 @@
public class ActionFactory extends Actions {
- public EventAction createBroadcastAction(String broadcastMessage, @EventWrapper.WaitMode int waitMode) {
- BroadcastEventId id = new BroadcastEventId(broadcastMessage);
- return createEventAction(id, waitMode);
- }
-
- private EventAction createEventAction(EventId eventId, @EventWrapper.WaitMode int waitMode) {
- EventWrapper event = new EventWrapper(eventId, waitMode);
- Project currentProject = ProjectManager.getInstance().getCurrentProject();
- EventAction action = Actions.action(EventAction.class);
- action.setEvent(event);
- action.setReceivingSprites(currentProject.getSpriteListWithClones());
- return action;
- }
-
- public Action createNotifyEventWaiterAction(Sprite sprite, EventWrapper event) {
- NotifyEventWaiterAction action = Actions.action(NotifyEventWaiterAction.class);
- action.setEvent(event);
- action.setSprite(sprite);
+ public EventAction createBroadcastAction(String broadcastMessage, boolean wait) {
+ BroadcastAction action = action(BroadcastAction.class);
+ action.setBroadcastMessage(broadcastMessage);
+ action.setWait(wait);
return action;
}
@@ -557,12 +546,6 @@ public Action createStampAction(Sprite sprite) {
return action;
}
- public Action createNextLookAction(Sprite sprite) {
- NextLookAction action = Actions.action(NextLookAction.class);
- action.setSprite(sprite);
- return action;
- }
-
public Action createPlaySoundAction(Sprite sprite, SoundInfo sound) {
PlaySoundAction action = Actions.action(PlaySoundAction.class);
action.setSprite(sprite);
@@ -624,60 +607,51 @@ public Action createSetTransparencyAction(Sprite sprite, Formula transparency) {
return action;
}
- public Action createSetLookAction(Sprite sprite, LookData lookData, @EventWrapper.WaitMode int waitMode) {
- return createSetLookEventAction((SetLookAction) createSetLookAction(sprite, lookData), waitMode);
+ public Action createSetLookAction(Sprite sprite, LookData lookData) {
+ return createSetLookAction(sprite, lookData, false);
}
- public Action createSetLookAction(Sprite sprite, LookData lookData) {
+ public Action createSetLookAction(Sprite sprite, LookData lookData, boolean wait) {
SetLookAction action = Actions.action(SetLookAction.class);
action.setSprite(sprite);
action.setLookData(lookData);
+ action.setWait(wait);
return action;
}
- private Action createSetLookEventAction(SetLookAction action, @EventWrapper.WaitMode int waitMode) {
- Project currentProject = ProjectManager.getInstance().getCurrentProject();
- action.setWaitMode(waitMode);
- action.setReceivingSprites(currentProject.getSpriteListWithClones());
+ public Action createSetLookByIndexAction(Sprite sprite, Formula formula) {
+ SetLookByIndexAction action = Actions.action(SetLookByIndexAction.class);
+ action.setSprite(sprite);
+ action.setFormula(formula);
return action;
}
- public Action createSetBackgroundLookAction(LookData lookData, @EventWrapper.WaitMode int waitMode) {
- return createSetBackgroundLookEventAction((SetBackgroundLookAction) createSetBackgroundLookAction(lookData), waitMode);
- }
-
- public Action createSetBackgroundLookAction(LookData lookData) {
- SetBackgroundLookAction action = Actions.action(SetBackgroundLookAction.class);
+ public Action createSetBackgroundAction(LookData lookData, boolean wait) {
+ SetLookAction action = Actions.action(SetLookAction.class);
+ action.setSprite(ProjectManager.getInstance().getCurrentlyPlayingScene().getBackgroundSprite());
action.setLookData(lookData);
+ action.setWait(wait);
return action;
}
- private Action createSetBackgroundLookEventAction(SetBackgroundLookAction action, @EventWrapper.WaitMode int waitMode) {
- Project currentProject = ProjectManager.getInstance().getCurrentProject();
- action.setWaitMode(waitMode);
- action.setReceivingSprites(currentProject.getSpriteListWithClones());
- return action;
- }
-
- public Action createSetLookByIndexAction(Sprite sprite, Formula formula, @EventWrapper.WaitMode int waitMode) {
- return createSetLookEventAction((SetLookAction) createSetLookByIndexAction(sprite, formula), waitMode);
- }
-
- public Action createSetLookByIndexAction(Sprite sprite, Formula formula) {
+ public Action createSetBackgroundByIndexAction(Sprite sprite, Formula formula, boolean wait) {
SetLookByIndexAction action = Actions.action(SetLookByIndexAction.class);
- action.setSprite(sprite);
+ action.setSprite(ProjectManager.getInstance().getCurrentlyPlayingScene().getBackgroundSprite());
+ action.setScopeSprite(sprite);
action.setFormula(formula);
+ action.setWait(wait);
return action;
}
- public Action createSetBackgroundLookByIndexAction(Sprite scopeSprite, Formula formula, @EventWrapper.WaitMode int waitMode) {
- return createSetBackgroundLookEventAction((SetBackgroundLookAction) createSetBackgroundLookByIndexAction(scopeSprite, formula), waitMode);
+ public Action createSetNextLookAction(Sprite sprite) {
+ SetNextLookAction action = Actions.action(SetNextLookAction.class);
+ action.setSprite(sprite);
+ return action;
}
- public Action createSetBackgroundLookByIndexAction(Sprite scopeSprite, Formula formula) {
- SetBackgroundLookByIndexAction action = Actions.action(SetBackgroundLookByIndexAction.class);
- action.setScopeSprite(scopeSprite);
- action.setFormula(formula);
+ public Action createSetPreviousLookAction(Sprite sprite) {
+ SetPreviousLookAction action = action(SetPreviousLookAction.class);
+ action.setSprite(sprite);
return action;
}
@@ -727,6 +701,26 @@ public Action createStopAllSoundsAction() {
return Actions.action(StopAllSoundsAction.class);
}
+ public Action createPauseForBeatsAction(Sprite sprite, Formula beats) {
+ PauseForBeatsAction action = action(PauseForBeatsAction.class);
+ action.setSprite(sprite);
+ action.setBeats(beats);
+ return action;
+ }
+
+ public Action createSetInstrumentAction(PickableMusicalInstrument instrument) {
+ SetInstrumentAction action = action(SetInstrumentAction.class);
+ action.setInstrument(instrument);
+ return action;
+ }
+
+ public Action createSetTempoAction(Sprite sprite, Formula tempo) {
+ SetTempoAction action = action(SetTempoAction.class);
+ action.setSprite(sprite);
+ action.setTempo(tempo);
+ return action;
+ }
+
public Action createTurnLeftAction(Sprite sprite, Formula degrees) {
TurnLeftAction action = Actions.action(TurnLeftAction.class);
action.setSprite(sprite);
@@ -841,15 +835,17 @@ public Action createThinkSayForBubbleAction(Sprite sprite, Formula text, int typ
return action;
}
- public Action createSceneTransitionAction(String sceneName) {
+ public Action createSceneTransitionAction(String sceneName, Sprite sprite) {
SceneTransitionAction action = action(SceneTransitionAction.class);
action.setScene(sceneName);
+ action.setSprite(sprite);
return action;
}
- public Action createSceneStartAction(String sceneName) {
+ public Action createSceneStartAction(String sceneName, Sprite sprite) {
SceneStartAction action = action(SceneStartAction.class);
action.setScene(sceneName);
+ action.setSprite(sprite);
return action;
}
@@ -880,6 +876,15 @@ public Action createForVariableFromToAction(Sprite sprite, UserVariable controlV
return action;
}
+ public Action createForItemInUserListAction(UserList userList,
+ UserVariable userVariable, Action repeatedAction) {
+ ForItemInUserListAction action = Actions.action(ForItemInUserListAction.class);
+ action.setAction(repeatedAction);
+ action.setUserList(userList);
+ action.setCurrentItemVariable(userVariable);
+ return action;
+ }
+
public Action createWaitUntilAction(Sprite sprite, Formula condition) {
WaitUntilAction action = Actions.action(WaitUntilAction.class);
action.setSprite(sprite);
@@ -904,7 +909,7 @@ public Action createDelayAction(Sprite sprite, Formula delay) {
public Action createForeverAction(Sprite sprite, ScriptSequenceAction foreverSequence) {
RepeatAction action = Actions.action(RepeatAction.class);
- action.setIsForeverRepeat(true);
+ action.setForeverRepeat(true);
action.setAction(foreverSequence);
action.setSprite(sprite);
return action;
@@ -944,12 +949,16 @@ public static Action createStopRunningStitchAction(Sprite sprite) {
return action;
}
- public static Action eventSequence(Script script) {
- return new ScriptSequenceAction(script);
+ public Action createWriteEmbroideryToFileAction(Sprite sprite, Formula fileName) {
+ WriteEmbroideryToFileAction action = Actions.action(WriteEmbroideryToFileAction.class);
+ action.setSprite(sprite);
+ action.setFormula(fileName);
+
+ return action;
}
- public static Action createEventThread(Script script) {
- return new EventThread(script);
+ public static Action createScriptSequenceAction(Script script) {
+ return new ScriptSequenceAction(script);
}
public Action createSetBounceFactorAction(Sprite sprite, Formula bounceFactor) {
@@ -1266,13 +1275,7 @@ public Action createRaspiIfLogicActionAction(Sprite sprite, Formula pinNumber, A
return action;
}
- public Action createPreviousLookAction(Sprite sprite) {
- PreviousLookAction action = action(PreviousLookAction.class);
- action.setSprite(sprite);
- return action;
- }
-
- public Action createStopScriptAction(int spinnerSelection, Script currentScript) {
+ public Action createStopScriptAction(int spinnerSelection, Script currentScript, Sprite sprite) {
switch (spinnerSelection) {
case BrickValues.STOP_THIS_SCRIPT:
StopThisScriptAction stopThisScriptAction = Actions.action(StopThisScriptAction.class);
@@ -1281,6 +1284,7 @@ public Action createStopScriptAction(int spinnerSelection, Script currentScript)
case BrickValues.STOP_OTHER_SCRIPTS:
StopOtherScriptsAction stopOtherScriptsAction = Actions.action(StopOtherScriptsAction.class);
stopOtherScriptsAction.setCurrentScript(currentScript);
+ stopOtherScriptsAction.setSprite(sprite);
return stopOtherScriptsAction;
default:
return Actions.action(StopAllScriptsAction.class);
@@ -1353,8 +1357,18 @@ public Action createFinishStageAction(boolean silent) {
public Action createTapAtAction(Sprite sprite, Formula x, Formula y) {
TapAtAction action = Actions.action(TapAtAction.class);
- action.setPosition(x, y);
action.setSprite(sprite);
+ action.setStartX(x);
+ action.setStartY(y);
+ return action;
+ }
+
+ public Action createTapForAction(Sprite sprite, Formula x, Formula y, Formula duration) {
+ TapAtAction action = Actions.action(TapAtAction.class);
+ action.setSprite(sprite);
+ action.setDurationFormula(duration);
+ action.setStartX(x);
+ action.setStartY(y);
return action;
}
@@ -1424,4 +1438,16 @@ public Action createLookRequestAction(Sprite sprite, Formula variableFormula) {
action.setFormula(variableFormula);
return action;
}
+
+ public Action createStartListeningAction(UserVariable userVariable) {
+ StartListeningAction action = Actions.action(StartListeningAction.class);
+ action.setUserVariable(userVariable);
+ return action;
+ }
+
+ public Action createSetListeningLanguageAction(String listeningLanguageTag) {
+ SetListeningLanguageAction action = action(SetListeningLanguageAction.class);
+ action.listeningLanguageTag = listeningLanguageTag;
+ return action;
+ }
}
diff --git a/catroid/src/main/java/org/catrobat/catroid/content/ConditionScriptTrigger.java b/catroid/src/main/java/org/catrobat/catroid/content/ConditionScriptTrigger.java
index df881f7c668..69db6563346 100644
--- a/catroid/src/main/java/org/catrobat/catroid/content/ConditionScriptTrigger.java
+++ b/catroid/src/main/java/org/catrobat/catroid/content/ConditionScriptTrigger.java
@@ -67,7 +67,7 @@ void evaluateAndTriggerActions(Sprite sprite) {
private void triggerScript(Sprite sprite) {
if (status == TRIGGER_NOW) {
- EventWrapper eventWrapper = new EventWrapper(new WhenConditionEventId(formula), EventWrapper.NO_WAIT);
+ EventWrapper eventWrapper = new EventWrapper(new WhenConditionEventId(formula), false);
sprite.look.fire(eventWrapper);
status = ALREADY_TRIGGERED;
}
diff --git a/catroid/src/main/java/org/catrobat/catroid/content/EventWrapper.java b/catroid/src/main/java/org/catrobat/catroid/content/EventWrapper.java
deleted file mode 100644
index dd5333585fe..00000000000
--- a/catroid/src/main/java/org/catrobat/catroid/content/EventWrapper.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Catroid: An on-device visual programming system for Android devices
- * Copyright (C) 2010-2018 The Catrobat Team
- * ()
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * An additional term exception under section 7 of the GNU Affero
- * General Public License, version 3, is available at
- * http://developer.catrobat.org/license_additional_term
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-package org.catrobat.catroid.content;
-
-import com.badlogic.gdx.scenes.scene2d.Event;
-
-import org.catrobat.catroid.content.eventids.EventId;
-
-import java.lang.annotation.Retention;
-import java.util.ArrayList;
-import java.util.List;
-
-import androidx.annotation.IntDef;
-
-import static java.lang.annotation.RetentionPolicy.SOURCE;
-
-public class EventWrapper extends Event {
- @Retention(SOURCE)
- @IntDef({WAIT, NO_WAIT})
- public @interface WaitMode {
- }
-
- public static final int WAIT = 0;
- public static final int NO_WAIT = 1;
-
- @WaitMode
- final int waitMode;
- final EventId eventId;
- private List spritesToWaitFor;
-
- public EventWrapper(EventId eventId, @WaitMode int waitMode) {
- this.eventId = eventId;
- this.waitMode = waitMode;
- if (waitMode == WAIT) {
- spritesToWaitFor = new ArrayList<>();
- }
- }
-
- public void notify(Sprite sprite) {
- spritesToWaitFor.remove(sprite);
- }
-
- void addSpriteToWaitFor(Sprite sprite) {
- spritesToWaitFor.add(sprite);
- }
-
- public List getSpritesToWaitFor() {
- return spritesToWaitFor;
- }
-}
diff --git a/catroid/src/main/java/org/catrobat/catroid/utils/CrashlyticsCrashReporter.java b/catroid/src/main/java/org/catrobat/catroid/content/EventWrapper.kt
similarity index 61%
rename from catroid/src/main/java/org/catrobat/catroid/utils/CrashlyticsCrashReporter.java
rename to catroid/src/main/java/org/catrobat/catroid/content/EventWrapper.kt
index 26c1eba90ff..08c476255a3 100644
--- a/catroid/src/main/java/org/catrobat/catroid/utils/CrashlyticsCrashReporter.java
+++ b/catroid/src/main/java/org/catrobat/catroid/content/EventWrapper.kt
@@ -20,29 +20,21 @@
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see .
*/
+package org.catrobat.catroid.content
-package org.catrobat.catroid.utils;
+import com.badlogic.gdx.scenes.scene2d.Event
+import org.catrobat.catroid.content.eventids.EventId
-import android.content.Context;
+class EventWrapper(internal val eventId: EventId, private val wait: Boolean) : Event() {
+ private val spriteWaitList = mutableSetOf()
-import com.crashlytics.android.Crashlytics;
-import com.crashlytics.android.core.CrashlyticsCore;
+ fun notify(sprite: Sprite) {
+ spriteWaitList.remove(sprite)
+ }
-import org.catrobat.catroid.BuildConfig;
+ internal fun addSpriteToWaitList(sprite: Sprite) = wait.also {
+ if (it) spriteWaitList.add(sprite)
+ }
-import io.fabric.sdk.android.Fabric;
-
-class CrashlyticsCrashReporter implements CrashReporterInterface {
-
- public void initialize(Context context) {
-
- Crashlytics crashlyticsKit = new Crashlytics.Builder()
- .core(new CrashlyticsCore.Builder().disabled(BuildConfig.DEBUG).build())
- .build();
- Fabric.with(context, crashlyticsKit);
- }
-
- public void logException(Throwable exception) {
- Crashlytics.logException(exception);
- }
+ fun isWaitingForSprite() = spriteWaitList.isNotEmpty()
}
diff --git a/catroid/src/main/java/org/catrobat/catroid/content/EventWrapperListener.java b/catroid/src/main/java/org/catrobat/catroid/content/EventWrapperListener.java
deleted file mode 100644
index a5b3f2efe05..00000000000
--- a/catroid/src/main/java/org/catrobat/catroid/content/EventWrapperListener.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Catroid: An on-device visual programming system for Android devices
- * Copyright (C) 2010-2018 The Catrobat Team
- * ()
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * An additional term exception under section 7 of the GNU Affero
- * General Public License, version 3, is available at
- * http://developer.catrobat.org/license_additional_term
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-package org.catrobat.catroid.content;
-
-import com.badlogic.gdx.scenes.scene2d.Event;
-import com.badlogic.gdx.scenes.scene2d.EventListener;
-
-import org.catrobat.catroid.content.actions.EventThread;
-
-import java.util.Collection;
-
-public class EventWrapperListener implements EventListener {
-
- private final Look look;
-
- EventWrapperListener(Look look) {
- this.look = look;
- }
-
- @Override
- public boolean handle(Event event) {
- if (event instanceof EventWrapper) {
- handleEvent((EventWrapper) event);
- return true;
- }
- return false;
- }
-
- private void handleEvent(EventWrapper event) {
- Collection threads = look.sprite.getIdToEventThreadMap().get(event.eventId);
- for (EventThread threadToBeStarted : threads) {
- if (event.waitMode == EventWrapper.WAIT) {
- event.addSpriteToWaitFor(look.sprite);
- threadToBeStarted = new EventThread(threadToBeStarted, look.sprite, event);
- // Copy original thread because it has a different NotifyWaiterAction
- }
- look.stopThreadWithScript(threadToBeStarted.getScript());
- look.startThread(threadToBeStarted);
- }
- }
-}
diff --git a/catroid/src/main/java/org/catrobat/catroid/content/EventWrapperListener.kt b/catroid/src/main/java/org/catrobat/catroid/content/EventWrapperListener.kt
new file mode 100644
index 00000000000..4d6086b0016
--- /dev/null
+++ b/catroid/src/main/java/org/catrobat/catroid/content/EventWrapperListener.kt
@@ -0,0 +1,49 @@
+/*
+ * Catroid: An on-device visual programming system for Android devices
+ * Copyright (C) 2010-2018 The Catrobat Team
+ * ()
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * An additional term exception under section 7 of the GNU Affero
+ * General Public License, version 3, is available at
+ * http://developer.catrobat.org/license_additional_term
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+package org.catrobat.catroid.content
+
+import com.badlogic.gdx.scenes.scene2d.Event
+import com.badlogic.gdx.scenes.scene2d.EventListener
+import org.catrobat.catroid.content.actions.ScriptSequenceActionWithWaiter
+
+class EventWrapperListener internal constructor(private val look: Look) : EventListener {
+
+ override fun handle(event: Event) =
+ if (event is EventWrapper) {
+ handleEvent(event)
+ true
+ } else false
+
+ private fun handleEvent(event: EventWrapper) {
+ with(look) {
+ sprite.idToEventThreadMap[event.eventId].forEach { sequenceAction ->
+ stopThreadWithScript(sequenceAction.script)
+ if (event.addSpriteToWaitList(sprite)) {
+ startThread(ScriptSequenceActionWithWaiter(sequenceAction, event, sprite))
+ } else {
+ startThread(sequenceAction)
+ }
+ }
+ }
+ }
+}
diff --git a/catroid/src/main/java/org/catrobat/catroid/content/GroupItemSprite.java b/catroid/src/main/java/org/catrobat/catroid/content/GroupItemSprite.java
index 165c1fba995..919050e6674 100644
--- a/catroid/src/main/java/org/catrobat/catroid/content/GroupItemSprite.java
+++ b/catroid/src/main/java/org/catrobat/catroid/content/GroupItemSprite.java
@@ -26,7 +26,7 @@ public class GroupItemSprite extends Sprite {
private static final long serialVersionUID = 1L;
- public transient boolean collapsed = true;
+ private transient boolean collapsed = true;
public GroupItemSprite() {
super();
@@ -35,4 +35,12 @@ public GroupItemSprite() {
public GroupItemSprite(String name) {
super(name);
}
+
+ public void setCollapsed(boolean collapsed) {
+ this.collapsed = collapsed;
+ }
+
+ public boolean isCollapsed() {
+ return collapsed;
+ }
}
diff --git a/catroid/src/main/java/org/catrobat/catroid/content/GroupSprite.java b/catroid/src/main/java/org/catrobat/catroid/content/GroupSprite.java
index b67fa2366f0..31c15cbf0d6 100644
--- a/catroid/src/main/java/org/catrobat/catroid/content/GroupSprite.java
+++ b/catroid/src/main/java/org/catrobat/catroid/content/GroupSprite.java
@@ -60,17 +60,21 @@ public List getGroupItems() {
return groupItems;
}
- public boolean getCollapsed() {
+ public boolean isCollapsed() {
return collapsed;
}
public void setCollapsed(boolean collapsed) {
this.collapsed = collapsed;
for (GroupItemSprite item : getGroupItems()) {
- item.collapsed = collapsed;
+ item.setCollapsed(collapsed);
}
}
+ public int getNumberOfItems() {
+ return getGroupItems().size();
+ }
+
public static List getSpritesFromGroupWithGroupName(String groupName, List sprites) {
List result = new ArrayList<>();
int position = 0;
diff --git a/catroid/src/main/java/org/catrobat/catroid/content/Look.java b/catroid/src/main/java/org/catrobat/catroid/content/Look.java
index 037893501f9..ae65e7fc89f 100644
--- a/catroid/src/main/java/org/catrobat/catroid/content/Look.java
+++ b/catroid/src/main/java/org/catrobat/catroid/content/Look.java
@@ -43,7 +43,8 @@
import org.catrobat.catroid.common.DroneVideoLookData;
import org.catrobat.catroid.common.LookData;
import org.catrobat.catroid.common.ThreadScheduler;
-import org.catrobat.catroid.content.actions.EventThread;
+import org.catrobat.catroid.content.actions.ScriptSequenceAction;
+import org.catrobat.catroid.content.actions.ScriptSequenceActionWithWaiter;
import org.catrobat.catroid.content.eventids.EventId;
import org.catrobat.catroid.sensing.CollisionInformation;
import org.catrobat.catroid.utils.TouchUtil;
@@ -66,6 +67,7 @@ public class Look extends Image {
public static final float DEGREE_UI_OFFSET = 90.0f;
private static final float COLOR_SCALE = 200.0f;
private boolean lookVisible = true;
+ private boolean simultaneousMovementXY = false;
protected LookData lookData;
protected Sprite sprite;
protected float alpha = 1f;
@@ -158,7 +160,7 @@ public boolean doTouchDown(float x, float y, int pointer) {
if (x >= 0 && x < getWidth() && y >= 0 && y < getHeight()
&& ((pixmap != null && ((pixmap.getPixel((int) x, (int) y) & 0x000000FF) > 10)))) {
- EventWrapper event = new EventWrapper(new EventId(EventId.TAP), EventWrapper.NO_WAIT);
+ EventWrapper event = new EventWrapper(new EventId(EventId.TAP), false);
sprite.look.fire(event);
return true;
}
@@ -200,9 +202,19 @@ public void act(float delta) {
}
}
- public void startThread(EventThread threadToBeStarted) {
+ @Override
+ protected void positionChanged() {
+ if (sprite != null && sprite.penConfiguration != null && sprite.penConfiguration.isPenDown()
+ && !simultaneousMovementXY) {
+ float x = getXInUserInterfaceDimensionUnit();
+ float y = getYInUserInterfaceDimensionUnit();
+ sprite.penConfiguration.addPosition(new PointF(x, y));
+ }
+ }
+
+ public void startThread(ScriptSequenceAction sequenceAction) {
if (scheduler != null) {
- scheduler.startThread(threadToBeStarted);
+ scheduler.startThread(sequenceAction);
}
}
@@ -315,10 +327,16 @@ public float getYVelocityInUserInterfaceDimensionUnit() {
}
public void setPositionInUserInterfaceDimensionUnit(float x, float y) {
+ adjustSimultaneousMovementXY(x, y);
setXInUserInterfaceDimensionUnit(x);
+ adjustSimultaneousMovementXY(this.getX(), y);
setYInUserInterfaceDimensionUnit(y);
}
+ private void adjustSimultaneousMovementXY(float x, float y) {
+ simultaneousMovementXY = x != this.getX() && y != this.getY();
+ }
+
public void changeXInUserInterfaceDimensionUnit(float changeX) {
setX(getX() + changeX);
}
@@ -641,8 +659,8 @@ public Polygon[] getCurrentCollisionPolygon() {
void notifyAllWaiters() {
for (Action action : getActions()) {
- if (action instanceof EventThread) {
- ((EventThread) action).notifyWaiter();
+ if (action instanceof ScriptSequenceActionWithWaiter) {
+ ((ScriptSequenceActionWithWaiter) action).notifyWaiter();
}
}
}
diff --git a/catroid/src/main/java/org/catrobat/catroid/content/PenConfiguration.java b/catroid/src/main/java/org/catrobat/catroid/content/PenConfiguration.java
new file mode 100644
index 00000000000..b6d9ce95ded
--- /dev/null
+++ b/catroid/src/main/java/org/catrobat/catroid/content/PenConfiguration.java
@@ -0,0 +1,125 @@
+/*
+ * Catroid: An on-device visual programming system for Android devices
+ * Copyright (C) 2010-2020 The Catrobat Team
+ * ()
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * An additional term exception under section 7 of the GNU Affero
+ * General Public License, version 3, is available at
+ * http://developer.catrobat.org/license_additional_term
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+
+package org.catrobat.catroid.content;
+
+import android.graphics.PointF;
+
+import com.badlogic.gdx.graphics.Color;
+import com.badlogic.gdx.graphics.glutils.ShapeRenderer;
+import com.badlogic.gdx.utils.Queue;
+
+import org.catrobat.catroid.common.BrickValues;
+import org.catrobat.catroid.stage.StageActivity;
+
+public class PenConfiguration {
+
+ private Queue> positions = new Queue<>();
+ private boolean penDown = false;
+ private double penSize = BrickValues.PEN_SIZE;
+ private PenColor penColor = new PenColor(0, 0, 1, 1);
+ private boolean stamp = false;
+ private int queuesToFinish = 0;
+
+ public PenConfiguration() {
+ }
+
+ public void drawLinesForSprite(Float screenRatio) {
+
+ ShapeRenderer renderer = StageActivity.stageListener.shapeRenderer;
+ renderer.setColor(new Color(penColor.r, penColor.g, penColor.b, penColor.a));
+ renderer.begin(ShapeRenderer.ShapeType.Filled);
+
+ while (currentQueueHasJobToHandle()) {
+ drawLine(screenRatio, renderer);
+ updateQueues();
+ }
+
+ renderer.end();
+ }
+
+ private boolean currentQueueHasJobToHandle() {
+ return !positions.isEmpty() && (positions.first().size > 1 || queuesToFinish > 0);
+ }
+
+ private void drawLine(Float screenRatio, ShapeRenderer renderer) {
+
+ PointF currentPosition = positions.first().removeFirst();
+ PointF nextPosition = positions.first().first();
+
+ if (currentPosition.x != nextPosition.x || currentPosition.y != nextPosition.y) {
+ Float penSize = (float) this.penSize * screenRatio;
+ renderer.circle(currentPosition.x, currentPosition.y, penSize / 2);
+ renderer.rectLine(currentPosition.x, currentPosition.y, nextPosition.x, nextPosition.y,
+ penSize);
+ renderer.circle(nextPosition.x, nextPosition.y, penSize / 2);
+ }
+ }
+
+ private void updateQueues() {
+ if (queuesToFinish > 0 && positions.first().size <= 1) {
+ positions.removeFirst();
+ queuesToFinish--;
+ }
+ }
+
+ public void addQueue() {
+ positions.addLast(new Queue<>());
+ }
+
+ public void addPosition(PointF position) {
+ positions.last().addLast(position);
+ }
+
+ public void incrementQueuesToFinish() {
+ queuesToFinish++;
+ }
+
+ public void setPenDown(boolean penDown) {
+ this.penDown = penDown;
+ }
+
+ public boolean isPenDown() {
+ return penDown;
+ }
+
+ public void setPenSize(double penSize) {
+ this.penSize = penSize;
+ }
+
+ public void setPenColor(PenColor penColor) {
+ this.penColor = penColor;
+ }
+
+ public void setStamp(boolean stamp) {
+ this.stamp = stamp;
+ }
+
+ public boolean hasStamp() {
+ return stamp;
+ }
+
+ public Queue> getPositions() {
+ return positions;
+ }
+}
diff --git a/catroid/src/main/java/org/catrobat/catroid/content/Project.java b/catroid/src/main/java/org/catrobat/catroid/content/Project.java
index 192f6b70e18..2181fa32c61 100644
--- a/catroid/src/main/java/org/catrobat/catroid/content/Project.java
+++ b/catroid/src/main/java/org/catrobat/catroid/content/Project.java
@@ -51,6 +51,7 @@
import static org.catrobat.catroid.common.Constants.Z_INDEX_BACKGROUND;
import static org.catrobat.catroid.common.FlavoredConstants.DEFAULT_ROOT_DIRECTORY;
+import static org.catrobat.catroid.utils.Utils.SPEECH_RECOGNITION_SUPPORTED_LANGUAGES;
@XStreamAlias("program")
@XStreamFieldKeyOrder({
@@ -288,6 +289,14 @@ public void setDescription(String description) {
xmlHeader.setDescription(description);
}
+ public String getNotesAndCredits() {
+ return xmlHeader.getNotesAndCredits();
+ }
+
+ public void setNotesAndCredits(String notesAndCredits) {
+ xmlHeader.setNotesAndCredits(notesAndCredits);
+ }
+
public ScreenModes getScreenMode() {
return xmlHeader.getScreenMode();
}
@@ -296,7 +305,7 @@ public void setScreenMode(ScreenModes screenMode) {
xmlHeader.setScreenMode(screenMode);
}
- public float getCatrobatLanguageVersion() {
+ public double getCatrobatLanguageVersion() {
return xmlHeader.getCatrobatLanguageVersion();
}
@@ -333,7 +342,7 @@ public Brick.ResourcesSet getRequiredResources() {
return resourcesSet;
}
- public void setCatrobatLanguageVersion(float catrobatLanguageVersion) {
+ public void setCatrobatLanguageVersion(double catrobatLanguageVersion) {
xmlHeader.setCatrobatLanguageVersion(catrobatLanguageVersion);
}
@@ -395,4 +404,23 @@ public void deselectElements(List> elements) {
scene.deselectElements(elements);
}
}
+
+ public void setListeningLanguageTag() {
+ if (xmlHeader.getListeningLanguageTag().isEmpty()
+ && !SPEECH_RECOGNITION_SUPPORTED_LANGUAGES.isEmpty()) {
+ // first item represents the default speech recognition language
+ xmlHeader.setListeningLanguageTag(SPEECH_RECOGNITION_SUPPORTED_LANGUAGES.get(0));
+ }
+ }
+
+ public boolean isGlobalVariable(UserData> item) {
+ return getUserVariables().contains(item) || getUserLists().contains(item)
+ || getMultiplayerVariables().contains(item);
+ }
+
+ public void checkForInvisibleSprites() {
+ for (Scene scene : sceneList) {
+ scene.checkForInvisibleSprites();
+ }
+ }
}
diff --git a/catroid/src/main/java/org/catrobat/catroid/content/Scene.java b/catroid/src/main/java/org/catrobat/catroid/content/Scene.java
index 2c1ee7b6f68..45f1b8197a6 100644
--- a/catroid/src/main/java/org/catrobat/catroid/content/Scene.java
+++ b/catroid/src/main/java/org/catrobat/catroid/content/Scene.java
@@ -24,6 +24,7 @@
import com.thoughtworks.xstream.annotations.XStreamAlias;
+import org.catrobat.catroid.ProjectManager;
import org.catrobat.catroid.common.Nameable;
import org.catrobat.catroid.content.bricks.Brick;
import org.catrobat.catroid.content.bricks.BroadcastMessageBrick;
@@ -172,8 +173,12 @@ public Set getBroadcastMessagesInUse() {
}
public void updateUserDataReferences(String oldName, String newName, UserData> item) {
- for (Sprite sprite : spriteList) {
- sprite.updateUserDataReferences(oldName, newName, item);
+ if (ProjectManager.getInstance().getCurrentProject().isGlobalVariable(item)) {
+ for (Sprite sprite : spriteList) {
+ sprite.updateUserDataReferences(oldName, newName, item);
+ }
+ } else {
+ ProjectManager.getInstance().getCurrentSprite().updateUserDataReferences(oldName, newName, item);
}
}
@@ -182,4 +187,24 @@ public void deselectElements(List> elements) {
sprite.deselectElements(elements);
}
}
+
+ public void checkForInvisibleSprites() {
+ for (Sprite sprite : spriteList) {
+ if (sprite instanceof GroupItemSprite && isInvisibleSprite(spriteList.indexOf(sprite))) {
+ sprite.setConvertToSprite(true);
+ Sprite convertedSprite = sprite.convert();
+ spriteList.set(spriteList.indexOf(sprite), convertedSprite);
+ }
+ }
+ }
+
+ private boolean isInvisibleSprite(int index) {
+ for (int spriteIndex = index - 1; spriteIndex > 0; spriteIndex--) {
+ Sprite currentSprite = spriteList.get(spriteIndex);
+ if (!(currentSprite instanceof GroupItemSprite)) {
+ return !(currentSprite instanceof GroupSprite);
+ }
+ }
+ return true;
+ }
}
diff --git a/catroid/src/main/java/org/catrobat/catroid/content/Sprite.java b/catroid/src/main/java/org/catrobat/catroid/content/Sprite.java
index a1c5f487267..e0142c4521e 100644
--- a/catroid/src/main/java/org/catrobat/catroid/content/Sprite.java
+++ b/catroid/src/main/java/org/catrobat/catroid/content/Sprite.java
@@ -23,22 +23,22 @@
package org.catrobat.catroid.content;
import android.content.Context;
-import android.graphics.PointF;
import android.util.Log;
+import com.badlogic.gdx.scenes.scene2d.Stage;
import com.google.common.collect.LinkedHashMultimap;
import com.google.common.collect.Multimap;
import com.thoughtworks.xstream.annotations.XStreamAsAttribute;
import org.catrobat.catroid.CatroidApplication;
import org.catrobat.catroid.ProjectManager;
-import org.catrobat.catroid.common.BrickValues;
+import org.catrobat.catroid.R;
import org.catrobat.catroid.common.Constants;
import org.catrobat.catroid.common.LookData;
import org.catrobat.catroid.common.Nameable;
import org.catrobat.catroid.common.NfcTagData;
import org.catrobat.catroid.common.SoundInfo;
-import org.catrobat.catroid.content.actions.EventThread;
+import org.catrobat.catroid.content.actions.ScriptSequenceAction;
import org.catrobat.catroid.content.bricks.Brick;
import org.catrobat.catroid.content.bricks.FormulaBrick;
import org.catrobat.catroid.content.bricks.PlaySoundBrick;
@@ -53,9 +53,11 @@
import org.catrobat.catroid.io.XStreamFieldKeyOrder;
import org.catrobat.catroid.physics.PhysicsLook;
import org.catrobat.catroid.physics.PhysicsWorld;
+import org.catrobat.catroid.stage.StageActivity;
import java.io.Serializable;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
@@ -71,6 +73,7 @@
"userLists",
"userDefinedBrickList"
})
+
public class Sprite implements Cloneable, Nameable, Serializable {
private static final long serialVersionUID = 1L;
@@ -80,10 +83,11 @@ public class Sprite implements Cloneable, Nameable, Serializable {
public transient Look look = new Look(this);
public transient PenConfiguration penConfiguration = new PenConfiguration();
public transient RunningStitch runningStitch = new RunningStitch();
- private transient boolean convertToSingleSprite = false;
+ private transient boolean convertToSprite = false;
private transient boolean convertToGroupItemSprite = false;
- private transient Multimap idToEventThreadMap = LinkedHashMultimap.create();
+ private transient Multimap idToEventThreadMap = LinkedHashMultimap.create();
private transient Set conditionScriptTriggers = new HashSet<>();
+ private transient List usedTouchPointer = new ArrayList<>();
@XStreamAsAttribute
private String name;
@@ -100,6 +104,8 @@ public class Sprite implements Cloneable, Nameable, Serializable {
public transient boolean isClone = false;
public transient Sprite myOriginal = null;
+ public transient boolean movedByStepsBrick = false;
+
public Sprite() {
}
@@ -293,14 +299,14 @@ public void initializeEventThreads(@EventId.EventType int startType) {
for (Script script : scriptList) {
createThreadAndAddToEventMap(script);
}
- look.fire(new EventWrapper(new EventId(startType), EventWrapper.NO_WAIT));
+ look.fire(new EventWrapper(new EventId(startType), false));
}
private void createThreadAndAddToEventMap(Script script) {
if (script.isCommentedOut()) {
return;
}
- idToEventThreadMap.put(script.createEventId(this), createEventThread(script));
+ idToEventThreadMap.put(script.createEventId(this), createSequenceAction(script));
}
public ActionFactory getActionFactory() {
@@ -314,8 +320,8 @@ public void setActionFactory(ActionFactory actionFactory) {
public Sprite convert() {
Sprite convertedSprite;
- if (convertToSingleSprite) {
- convertedSprite = new SingleSprite(name);
+ if (convertToSprite) {
+ convertedSprite = new Sprite(name);
} else if (convertToGroupItemSprite) {
convertedSprite = new GroupItemSprite(name);
} else {
@@ -340,8 +346,8 @@ public Sprite convert() {
return convertedSprite;
}
- private EventThread createEventThread(Script script) {
- EventThread sequence = (EventThread) ActionFactory.createEventThread(script);
+ private ScriptSequenceAction createSequenceAction(Script script) {
+ ScriptSequenceAction sequence = (ScriptSequenceAction) ActionFactory.createScriptSequenceAction(script);
script.run(this, sequence);
return sequence;
}
@@ -516,25 +522,17 @@ public void deselectElements(List> elements) {
}
}
- public class PenConfiguration {
- public boolean penDown = false;
- public double penSize = BrickValues.PEN_SIZE;
- public PenColor penColor = new PenColor(0, 0, 1, 1);
- public PointF previousPoint = null;
- public boolean stamp = false;
- }
-
public boolean toBeConverted() {
- return convertToSingleSprite || convertToGroupItemSprite;
+ return convertToSprite || convertToGroupItemSprite;
}
- public void setConvertToSingleSprite(boolean convertToSingleSprite) {
+ public void setConvertToSprite(boolean convertToSprite) {
this.convertToGroupItemSprite = false;
- this.convertToSingleSprite = convertToSingleSprite;
+ this.convertToSprite = convertToSprite;
}
public void setConvertToGroupItemSprite(boolean convertToGroupItemSprite) {
- this.convertToSingleSprite = false;
+ this.convertToSprite = false;
this.convertToGroupItemSprite = convertToGroupItemSprite;
}
@@ -542,7 +540,35 @@ public boolean isBackgroundSprite() {
return look.getZIndex() == Constants.Z_INDEX_BACKGROUND;
}
- public Multimap getIdToEventThreadMap() {
+ public boolean isBackgroundSprite(Context context) {
+ return name.equals(context.getString(R.string.background));
+ }
+
+ public Multimap getIdToEventThreadMap() {
return idToEventThreadMap;
}
+
+ public int getUnusedPointer() {
+ int result = 0;
+ while (result < 20 && usedTouchPointer.contains(result)) {
+ ++result;
+ }
+ usedTouchPointer.add(result);
+
+ return result;
+ }
+
+ public void releaseUsedPointer(int position) {
+ usedTouchPointer.removeAll(Collections.singleton(position));
+ }
+
+ public void releaseAllPointers() {
+ if (StageActivity.stageListener != null) {
+ Stage stage = StageActivity.stageListener.getStage();
+ for (int pointer : usedTouchPointer) {
+ stage.touchUp(0, 0, pointer, 0);
+ }
+ }
+ usedTouchPointer.clear();
+ }
}
diff --git a/catroid/src/main/java/org/catrobat/catroid/content/WhenBackgroundChangesScript.java b/catroid/src/main/java/org/catrobat/catroid/content/WhenBackgroundChangesScript.java
index 0c065bc2907..9894f620e1f 100644
--- a/catroid/src/main/java/org/catrobat/catroid/content/WhenBackgroundChangesScript.java
+++ b/catroid/src/main/java/org/catrobat/catroid/content/WhenBackgroundChangesScript.java
@@ -27,7 +27,7 @@
import org.catrobat.catroid.content.bricks.ScriptBrick;
import org.catrobat.catroid.content.bricks.WhenBackgroundChangesBrick;
import org.catrobat.catroid.content.eventids.EventId;
-import org.catrobat.catroid.content.eventids.SetBackgroundEventId;
+import org.catrobat.catroid.content.eventids.SetLookEventId;
public class WhenBackgroundChangesScript extends Script {
@@ -54,6 +54,6 @@ public void setLook(LookData look) {
@Override
public EventId createEventId(Sprite sprite) {
Sprite background = ProjectManager.getInstance().getCurrentlyPlayingScene().getBackgroundSprite();
- return new SetBackgroundEventId(background, look);
+ return new SetLookEventId(background, look);
}
}
diff --git a/catroid/src/main/java/org/catrobat/catroid/content/XmlHeader.java b/catroid/src/main/java/org/catrobat/catroid/content/XmlHeader.java
index 3530e98d0cb..de48da14041 100644
--- a/catroid/src/main/java/org/catrobat/catroid/content/XmlHeader.java
+++ b/catroid/src/main/java/org/catrobat/catroid/content/XmlHeader.java
@@ -37,6 +37,7 @@ public class XmlHeader implements Serializable {
private String programName;
private String description;
+ private String notesAndCredits;
@XStreamAlias("screenWidth")
public int virtualScreenWidth = 0;
@@ -45,11 +46,12 @@ public class XmlHeader implements Serializable {
public ScreenModes screenMode = ScreenModes.STRETCH;
- private float catrobatLanguageVersion;
+ private double catrobatLanguageVersion;
private boolean landscapeMode;
private boolean isCastProject = false;
@SuppressWarnings("unused")
public boolean scenesEnabled = true;
+ private String listeningLanguageTag = "";
//==============================================================================================
// mutable fields only used by Catroweb (share.catrob.at website) so far
@@ -136,6 +138,10 @@ public String getDescription() {
return description;
}
+ public String getNotesAndCredits() {
+ return notesAndCredits;
+ }
+
public String getUserHandle() {
return userHandle;
}
@@ -144,11 +150,15 @@ public void setDescription(String description) {
this.description = description;
}
- public float getCatrobatLanguageVersion() {
+ public void setNotesAndCredits(String notesAndCredits) {
+ this.notesAndCredits = notesAndCredits;
+ }
+
+ public double getCatrobatLanguageVersion() {
return catrobatLanguageVersion;
}
- public void setCatrobatLanguageVersion(float catrobatLanguageVersion) {
+ public void setCatrobatLanguageVersion(double catrobatLanguageVersion) {
this.catrobatLanguageVersion = catrobatLanguageVersion;
}
@@ -251,4 +261,12 @@ public String getApplicationBuildType() {
public void setApplicationBuildType(String applicationBuildType) {
this.applicationBuildType = applicationBuildType;
}
+
+ public String getListeningLanguageTag() {
+ return listeningLanguageTag;
+ }
+
+ public void setListeningLanguageTag(String listeningLanguageTag) {
+ this.listeningLanguageTag = listeningLanguageTag;
+ }
}
diff --git a/catroid/src/main/java/org/catrobat/catroid/content/actions/AskSpeechAction.java b/catroid/src/main/java/org/catrobat/catroid/content/actions/AskSpeechAction.java
deleted file mode 100644
index 47daceb537a..00000000000
--- a/catroid/src/main/java/org/catrobat/catroid/content/actions/AskSpeechAction.java
+++ /dev/null
@@ -1,147 +0,0 @@
-/*
- * Catroid: An on-device visual programming system for Android devices
- * Copyright (C) 2010-2018 The Catrobat Team
- * ()
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * An additional term exception under section 7 of the GNU Affero
- * General Public License, version 3, is available at
- * http://developer.catrobat.org/license_additional_term
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-package org.catrobat.catroid.content.actions;
-
-import android.app.Activity;
-import android.content.Intent;
-import android.os.Message;
-import android.speech.RecognizerIntent;
-import android.util.Log;
-
-import com.badlogic.gdx.scenes.scene2d.Action;
-
-import org.catrobat.catroid.content.Sprite;
-import org.catrobat.catroid.formulaeditor.Formula;
-import org.catrobat.catroid.formulaeditor.InterpretationException;
-import org.catrobat.catroid.formulaeditor.UserVariable;
-import org.catrobat.catroid.stage.StageActivity;
-
-import java.util.ArrayList;
-
-public class AskSpeechAction extends Action implements StageActivity.IntentListener {
-
- private static final String TAG = "AskSpeechAction";
- private Sprite sprite;
- private Formula questionFormula;
- private UserVariable answerVariable;
-
- private boolean questionAsked = false;
- private boolean answerReceived = false;
-
- private void askQuestion() {
- if (StageActivity.messageHandler == null) {
- return;
- }
- ArrayList