Unverified Commit a0c0b6d0 authored by Evan W. Patton's avatar Evan W. Patton Committed by GitHub

Add Platform and PlatformVersion properties to Screen (#2038)

* Add Platform and PlatformVersion properties to Screen

Change-Id: I29297997707d8172ef6492585053e8d9907dae57

* Updated YOUNG_ANDROID_VERSION to 198
Co-authored-by: default avatarellelili2025 <58433071+ellelili2025@users.noreply.github.com>
parent de1c0af9
......@@ -1018,6 +1018,11 @@ public final class YoungAndroidFormUpgrader {
srcCompVersion = 26;
}
if (srcCompVersion < 27) {
// Platform and PlatformVersion blocks were added.
srcCompVersion = 27;
}
return srcCompVersion;
}
......
......@@ -2326,7 +2326,11 @@ Blockly.Versioning.AllUpgradeMaps =
// For FORM_COMPONENT_VERISON 26:
// - ShowListsAsJson default value changed from False to True
26: "noUpgrade"
26: "noUpgrade",
// For FORM_COMPONENT_VERSION 27:
// - Platform and PlatformVersion read-only blocks were added
27: "noUpgrade"
}, // End Screen
......
......@@ -493,10 +493,12 @@ public class YaVersion {
// - WEB_COMPONENT_VERSION was incremented to 7
// For YOUNG_ANDROID_VERSION 198:
// - IMAGE_COMPONENT_VERSION was incremented to 4
// For YOUNG_ANDROID)_VERSION 199:
// For YOUNG_ANDROID_VERSION 199:
// - BLOCKS_LANGUAGE_VERSION was incremented to 29
// For YOUNG_ANDROID_VERSION 200:
// - FORM_COMPONENT_VERSION was incremented to 27.
public static final int YOUNG_ANDROID_VERSION = 198;
public static final int YOUNG_ANDROID_VERSION = 200;
// ............................... Blocks Language Version Number ...............................
......@@ -850,7 +852,9 @@ public class YaVersion {
// - Sizing default value changed from Fixed to Responsive
// For FORM_COMPONENT_VERSION 26:
// - Updated the default value of ShowListsAsJson from false -> true
public static final int FORM_COMPONENT_VERSION = 26;
// For FORM_COMPONENT_VERSION 27:
// - Added the Platform and PlatformVersion read-only blocks
public static final int FORM_COMPONENT_VERSION = 27;
// For FUSIONTABLESCONTROL_COMPONENT_VERSION 2:
// - The Fusiontables API was migrated from SQL to V1
......
// -*- mode: java; c-basic-offset: 2; -*-
// Copyright 2009-2011 Google, All Rights reserved
// Copyright 2011-2019 MIT, All rights reserved
// Copyright 2011-2020 MIT, All rights reserved
// Released under the Apache License, Version 2.0
// http://www.apache.org/licenses/LICENSE-2.0
......@@ -1971,6 +1971,31 @@ public class Form extends AppInventorCompatActivity
// project properties file
}
/**
* Gets the name of the underlying platform running the app. Currently, this is the text
* "Android". Other platforms may be supported in the future.
*
* @return The platform running the app
*/
@SimpleProperty(description = "The platform the app is running on, for example \"Android\" or "
+ "\"iOS\".")
public String Platform() {
return "Android";
}
/**
* Gets the version number of the platform running the app. This is typically a dotted version
* number, such as 10.0. Any value can be returned, however, so you should take care to handle
* unexpected data. If the platform version is unavailable, the empty text will be returned.
*
* @return The version of the platform running the app
*/
@SimpleProperty(description = "The dotted version number of the platform, such as 4.2.2 or 10.0. "
+ "This is platform specific and there is no guarantee that it has a particular format.")
public String PlatformVersion() {
return Build.VERSION.RELEASE;
}
/**
* Display a new form.
*
......
......@@ -901,6 +901,13 @@ Valid values for the month field are 1-12 and 1-31 for the day field.</dd>
<dt id="Screen.OpenScreenAnimation" class="text"><em>OpenScreenAnimation</em></dt>
<dd>The animation for switching to another screen. Valid options are <code class="highlighter-rouge">default</code>, <code class="highlighter-rouge">fade</code>, <code class="highlighter-rouge">zoom</code>,
<code class="highlighter-rouge">slidehorizontal</code>, <code class="highlighter-rouge">slidevertical</code>, and <code class="highlighter-rouge">none</code>.</dd>
<dt id="Screen.Platform" class="text ro bo"><em>Platform</em></dt>
<dd>Gets the name of the underlying platform running the app. Currently, this is the text
“Android”. Other platforms may be supported in the future.</dd>
<dt id="Screen.PlatformVersion" class="text ro bo"><em>PlatformVersion</em></dt>
<dd>Gets the version number of the platform running the app. This is typically a dotted version
number, such as 10.0. Any value can be returned, however, so you should take care to handle
unexpected data. If the platform version is unavailable, the empty text will be returned.</dd>
<dt id="Screen.PrimaryColor" class="color do"><em>PrimaryColor</em></dt>
<dd>This is the primary color used as part of the Android theme, including coloring the <code class="highlighter-rouge">Screen</code>’s
title bar.</dd>
......
......@@ -982,6 +982,15 @@ Top-level component containing all other components in the program.
: The animation for switching to another screen. Valid options are `default`, `fade`, `zoom`,
`slidehorizontal`, `slidevertical`, and `none`.
{:id="Screen.Platform" .text .ro .bo} *Platform*
: Gets the name of the underlying platform running the app. Currently, this is the text
"Android". Other platforms may be supported in the future.
{:id="Screen.PlatformVersion" .text .ro .bo} *PlatformVersion*
: Gets the version number of the platform running the app. This is typically a dotted version
number, such as 10.0. Any value can be returned, however, so you should take care to handle
unexpected data. If the platform version is unavailable, the empty text will be returned.
{:id="Screen.PrimaryColor" .color .do} *PrimaryColor*
: This is the primary color used as part of the Android theme, including coloring the `Screen`'s
title bar.
......
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