Commit c2ddc809 authored by Evan W. Patton's avatar Evan W. Patton Committed by Jeffrey Schiller

Upgrade formally to DeviceDefault theme as default

Change-Id: Iaa638a74b3e992caf05ef7376de5ff7aab57ab6f
parent 953886cd
......@@ -1183,6 +1183,19 @@ public final class YoungAndroidFormUpgrader {
// The DefaultFileScope property was added.
srcCompVersion = 30;
}
if (srcCompVersion < 31) {
// The default theme was switched to DeviceDefault
if (componentProperties.containsKey("Theme")) {
String value = ((ClientJsonString)componentProperties.get("Theme")).getString();
if (value.equals("AppTheme.Light.DarkActionBar")) {
// AppTheme.Light.DarkActionBar is now the default theme, so we can remove it
componentProperties.remove("Theme");
}
} else {
// Previously, projects were Classic by default, so we need to reflect this.
componentProperties.put("Theme", new ClientJsonString("Classic"));
}
}
return srcCompVersion;
}
......
......@@ -3013,7 +3013,11 @@ Blockly.Versioning.AllUpgradeMaps =
// For FORM_COMPONENT_VERSION 30:
// - DefaultFileScope designer property was added
30: "noUpgrade"
30: "noUpgrade",
// For FORM_COMPONENT_VERSION 31:
// - The default theme was changed in the designer. No block changes required.
31: "noUpgrade"
}, // End Screen
......
......@@ -586,7 +586,9 @@ public class YaVersion {
// For YOUNG_ANDROID_VERSION 225:
// - LISTVIEW_COMPONENT_VERSION was incremented to 7
// - WEB_COMPONENT_VERSION was incremented to 9
public static final int YOUNG_ANDROID_VERSION = 225;
// For YOUNG_ANDROID_VERSION 226:
// - FORM_COMPONENT_VERSION was incremented to 31
public static final int YOUNG_ANDROID_VERSION = 226;
// ............................... Blocks Language Version Number ...............................
......@@ -1018,7 +1020,9 @@ public class YaVersion {
// - Adds Permission dropdown block.
// For FORM_COMPONENT_VERSION 30:
// - Add DefaultFileScope designer property.
public static final int FORM_COMPONENT_VERSION = 30;
// For FORM_COMPONENT_VERSION 31:
// - The default theme was changed to Device Default.
public static final int FORM_COMPONENT_VERSION = 31;
// For FUSIONTABLESCONTROL_COMPONENT_VERSION 2:
// - The Fusiontables API was migrated from SQL to V1
......
......@@ -415,7 +415,7 @@ public class Form extends AppInventorCompatActivity
}
}
private void defaultPropertyValues() {
protected void defaultPropertyValues() {
if (isRepl()) {
ActionBar(actionBarEnabled);
} else {
......@@ -437,7 +437,6 @@ public class Form extends AppInventorCompatActivity
AccentColor(DEFAULT_ACCENT_COLOR);
PrimaryColor(DEFAULT_PRIMARY_COLOR);
PrimaryColorDark(DEFAULT_PRIMARY_COLOR_DARK);
Theme(ComponentConstants.DEFAULT_THEME);
BackgroundColor(Component.COLOR_DEFAULT);
OpenScreenAnimationAbstract(ScreenAnimation.Default);
CloseScreenAnimationAbstract(ScreenAnimation.Default);
......
......@@ -166,6 +166,16 @@ public class ReplForm extends Form {
}
}
@Override
protected void defaultPropertyValues() {
super.defaultPropertyValues();
// Previously this was set in the {@link Form#defaultPropertyValues()}. However, in compiled
// apps we do not want to reset the theme since it is provided in the AndroidManifest.xml.
// In the companion though we do want to reset the theme in case we are switching from a project
// with a different theme than the default one to one that uses the default.
Theme(ComponentConstants.DEFAULT_THEME);
}
@Override
protected void onResume() {
super.onResume();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment