Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions catroid/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ android {
buildConfigField "boolean", "FEATURE_USER_REPORTERS_ENABLED", "true"
buildConfigField "boolean", "FEATURE_MULTIPLAYER_VARIABLES_ENABLED", "true"
buildConfigField "boolean", "FEATURE_TESTBRICK_ENABLED", "true"
buildConfigField "boolean", "FEATURE_AI_ASSIST_ENABLED", "false"
buildConfigField "boolean", "FEATURE_AI_ASSIST_ENABLED", "true"
resValue "string", "FEATURE_EMBROIDERY_PREFERENCES_ENABLED", "false"
resValue "string", "FEATURE_PHIRO_PREFERENCES_ENABLED", "false"
resValue "string", "FEATURE_MINDSTORMS_PREFERENCES_ENABLED", "false"
Expand Down Expand Up @@ -222,7 +222,7 @@ android {
debug {
buildConfigField "boolean", "USE_ANDROID_LOCALES_FOR_SCREENSHOTS", useAndroidLocales()
resValue "string", "DEBUG_MODE", "true"
buildConfigField "boolean", "FEATURE_AI_ASSIST_ENABLED", "false"
buildConfigField "boolean", "FEATURE_AI_ASSIST_ENABLED", "true"
signingConfig = signingConfigs.debug
enableAndroidTestCoverage = true
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
import static org.catrobat.catroid.common.SharedPreferenceKeys.ACCESSIBILITY_PROFILE_PREFERENCE_KEY;
import static org.catrobat.catroid.common.SharedPreferenceKeys.DEVICE_LANGUAGE;
import static org.catrobat.catroid.common.SharedPreferenceKeys.LANGUAGE_TAGS;
import static org.catrobat.catroid.ui.settingsfragments.SettingsFragment.SETTINGS_AI_TUTOR_ENABLED;
import static org.catrobat.catroid.ui.settingsfragments.SettingsFragment.SETTINGS_CAST_GLOBALLY_ENABLED;
import static org.catrobat.catroid.ui.settingsfragments.SettingsFragment.SETTINGS_CRASH_REPORTS;
import static org.catrobat.catroid.ui.settingsfragments.SettingsFragment.SETTINGS_MINDSTORMS_EV3_BRICKS_CHECKBOX_PREFERENCE;
Expand Down Expand Up @@ -123,7 +124,7 @@ public class SettingsFragmentTest {
SETTINGS_CAST_GLOBALLY_ENABLED, SETTINGS_SHOW_AI_SPEECH_RECOGNITION_SENSORS,
SETTINGS_SHOW_AI_SPEECH_SYNTHETIZATION_SENSORS,
SETTINGS_SHOW_AI_FACE_DETECTION_SENSORS, SETTINGS_SHOW_AI_POSE_DETECTION_SENSORS,
SETTINGS_SHOW_AI_TEXT_RECOGNITION_SENSORS));
SETTINGS_SHOW_AI_TEXT_RECOGNITION_SENSORS, SETTINGS_AI_TUTOR_ENABLED));
private Map<String, Boolean> initialSettings = new HashMap<>();
private Matcher<Intent> expectedBrowserIntent;

Expand Down Expand Up @@ -194,6 +195,7 @@ public void basicSettingsTest() {
checkPreference(R.string.preference_title_enable_crash_reports, SETTINGS_CRASH_REPORTS);
checkPreference(R.string.preference_title_cast_feature_globally_enabled, SETTINGS_CAST_GLOBALLY_ENABLED);
checkPreference(R.string.preference_title_multiplayer_variables_enabled, SETTINGS_MULTIPLAYER_VARIABLES_ENABLED);
checkPreference(R.string.preference_title_ai_tutor, SETTINGS_AI_TUTOR_ENABLED);
}

@Category({Cat.AppUi.class, Level.Functional.class, Cat.Quarantine.class})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,8 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle sa
View view = View.inflate(getActivity(), R.layout.fragment_script, null);
listView = view.findViewById(android.R.id.list);
int bottomListPadding;
if (BuildConfig.FEATURE_AI_ASSIST_ENABLED) {
if (BuildConfig.FEATURE_AI_ASSIST_ENABLED
&& SettingsFragment.isAiTutorSharedPreferenceEnabled(getContext())) {
bottomListPadding = (int) (ScreenValues.currentScreenResolution.getHeight() / 2.5);
} else {
bottomListPadding = ScreenValues.currentScreenResolution.getHeight() / 3;
Expand Down Expand Up @@ -391,7 +392,8 @@ public void onResume() {
BottomBar.showPlayButton(getActivity());
BottomBar.showAddButton(getActivity());

if (BuildConfig.FEATURE_AI_ASSIST_ENABLED) {
if (BuildConfig.FEATURE_AI_ASSIST_ENABLED
&& SettingsFragment.isAiTutorSharedPreferenceEnabled(getContext())) {
BottomBar.showAiAssistButton(getActivity());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ public class SettingsFragment extends PreferenceFragment {
public static final String SETTINGS_SHOW_AI_POSE_DETECTION_SENSORS = "setting_ai_pose_detection";
public static final String SETTINGS_SHOW_AI_TEXT_RECOGNITION_SENSORS = "setting_ai_text_recognition";
public static final String SETTINGS_SHOW_AI_OBJECT_DETECTION_SENSORS = "setting_ai_object_detection";
public static final String SETTINGS_AI_TUTOR_ENABLED = "setting_ai_tutor";

public static final String SETTINGS_MULTIPLAYER_VARIABLES_ENABLED = "setting_multiplayer_variables_enabled";
public static final String SETTINGS_SHOW_HINTS = "setting_enable_hints";
Expand Down Expand Up @@ -196,6 +197,13 @@ public void onCreate(Bundle savedInstanceState) {
screen.removePreference(nfcPreference);
}

if (!BuildConfig.FEATURE_AI_ASSIST_ENABLED) {
CheckBoxPreference aiTutorPreference =
(CheckBoxPreference) findPreference(SETTINGS_AI_TUTOR_ENABLED);
aiTutorPreference.setEnabled(false);
screen.removePreference(aiTutorPreference);
}

if (!BuildConfig.FEATURE_MULTIPLAYER_VARIABLES_ENABLED) {
CheckBoxPreference multiplayerPreference =
(CheckBoxPreference) findPreference(SETTINGS_MULTIPLAYER_VARIABLES_ENABLED);
Expand Down Expand Up @@ -400,6 +408,10 @@ public static void setAIObjectDetectionPreferenceEnabled(Context context, boolea
.apply();
}

public static boolean isAiTutorSharedPreferenceEnabled(Context context) {
return getBooleanSharedPreference(false, SETTINGS_AI_TUTOR_ENABLED, context);
}

public static boolean isArduinoSharedPreferenceEnabled(Context context) {
return getBooleanSharedPreference(false, SETTINGS_SHOW_ARDUINO_BRICKS, context);
}
Expand Down
3 changes: 3 additions & 0 deletions catroid/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,9 @@
<string formatted="false" name="preference_title_ai_object_recognition">Object recognition</string>
<string formatted="false" name="preference_description_ai_object_recognition">Enable object recognition and tracking sensors</string>

<string formatted="false" name="preference_title_ai_tutor">AI Tutor extension</string>
<string formatted="false" name="preference_description_ai_tutor">Enable the AI Tutor assistant in the script editor</string>

<string formatted="false" name="preference_title_accessibility">Accessibility</string>
<string formatted="false" name="preference_description_accessibility">Change the app\'s appearance</string>
<string formatted="false" name="preference_title_accessibility_profiles">Accessibility profiles</string>
Expand Down
6 changes: 6 additions & 0 deletions catroid/src/main/res/xml/preferences.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,12 @@
android:summary="@string/preference_description_ai"
android:title="@string/preference_title_ai" />

<CheckBoxPreference
android:defaultValue="false"
android:key="setting_ai_tutor"
android:summary="@string/preference_description_ai_tutor"
android:title="@string/preference_title_ai_tutor" />

<CheckBoxPreference
android:defaultValue="false"
android:key="setting_multiplayer_variables_enabled"
Expand Down
Loading