Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
appinventor-sources
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
xpstem
appinventor-sources
Commits
108f4eb6
Commit
108f4eb6
authored
Feb 07, 2024
by
Gordon Lu
Committed by
Susan Rati Lane
Feb 09, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed FontSize bugs of CheckBox and Switch
parent
79c49d35
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
44 additions
and
1 deletion
+44
-1
appinventor/appengine/src/com/google/appinventor/client/editor/simple/components/MockCheckBox.java
...nventor/client/editor/simple/components/MockCheckBox.java
+15
-0
appinventor/appengine/src/com/google/appinventor/client/editor/simple/components/MockSwitch.java
...pinventor/client/editor/simple/components/MockSwitch.java
+10
-1
appinventor/appengine/src/com/google/appinventor/client/editor/simple/components/MockToggleBase.java
...entor/client/editor/simple/components/MockToggleBase.java
+19
-0
No files found.
appinventor/appengine/src/com/google/appinventor/client/editor/simple/components/MockCheckBox.java
View file @
108f4eb6
...
@@ -7,6 +7,7 @@
...
@@ -7,6 +7,7 @@
package
com.google.appinventor.client.editor.simple.components
;
package
com.google.appinventor.client.editor.simple.components
;
import
com.google.appinventor.client.editor.simple.SimpleEditor
;
import
com.google.appinventor.client.editor.simple.SimpleEditor
;
import
com.google.appinventor.client.editor.youngandroid.YaFormEditor
;
import
com.google.appinventor.client.editor.simple.components.utils.SVGPanel
;
import
com.google.appinventor.client.editor.simple.components.utils.SVGPanel
;
import
com.google.gwt.user.client.ui.HasHorizontalAlignment
;
import
com.google.gwt.user.client.ui.HasHorizontalAlignment
;
import
com.google.gwt.user.client.ui.HorizontalPanel
;
import
com.google.gwt.user.client.ui.HorizontalPanel
;
...
@@ -141,6 +142,20 @@ public final class MockCheckBox extends MockToggleBase<HorizontalPanel> {
...
@@ -141,6 +142,20 @@ public final class MockCheckBox extends MockToggleBase<HorizontalPanel> {
paintCheckBox
(
checked
);
paintCheckBox
(
checked
);
}
}
@Override
protected
void
setFontSizeProperty
(
String
text
)
{
MockForm
form
=
((
YaFormEditor
)
editor
).
getForm
();
if
(
Float
.
parseFloat
(
text
)
==
FONT_DEFAULT_SIZE
&&
form
!=
null
&&
form
.
getPropertyValue
(
"BigDefaultText"
).
equals
(
"True"
))
{
MockComponentsUtil
.
setWidgetFontSize
(
toggleWidget
.
getWidget
(
1
),
"24"
);
}
else
{
MockComponentsUtil
.
setWidgetFontSize
(
toggleWidget
.
getWidget
(
1
),
text
);
}
updatePreferredSize
();
}
@Override
@Override
public
void
onPropertyChange
(
String
propertyName
,
String
newValue
)
{
public
void
onPropertyChange
(
String
propertyName
,
String
newValue
)
{
super
.
onPropertyChange
(
propertyName
,
newValue
);
super
.
onPropertyChange
(
propertyName
,
newValue
);
...
...
appinventor/appengine/src/com/google/appinventor/client/editor/simple/components/MockSwitch.java
View file @
108f4eb6
...
@@ -6,6 +6,7 @@
...
@@ -6,6 +6,7 @@
package
com.google.appinventor.client.editor.simple.components
;
package
com.google.appinventor.client.editor.simple.components
;
import
com.google.appinventor.client.editor.simple.SimpleEditor
;
import
com.google.appinventor.client.editor.simple.SimpleEditor
;
import
com.google.appinventor.client.editor.youngandroid.YaFormEditor
;
import
com.google.appinventor.client.editor.simple.components.utils.SVGPanel
;
import
com.google.appinventor.client.editor.simple.components.utils.SVGPanel
;
import
com.google.gwt.user.client.DOM
;
import
com.google.gwt.user.client.DOM
;
import
com.google.gwt.user.client.ui.HasHorizontalAlignment
;
import
com.google.gwt.user.client.ui.HasHorizontalAlignment
;
...
@@ -157,7 +158,15 @@ public final class MockSwitch extends MockToggleBase<HorizontalPanel> {
...
@@ -157,7 +158,15 @@ public final class MockSwitch extends MockToggleBase<HorizontalPanel> {
@Override
@Override
protected
void
setFontSizeProperty
(
String
text
)
{
protected
void
setFontSizeProperty
(
String
text
)
{
MockComponentsUtil
.
setWidgetFontSize
(
toggleWidget
.
getWidget
(
0
),
text
);
MockForm
form
=
((
YaFormEditor
)
editor
).
getForm
();
if
(
Float
.
parseFloat
(
text
)
==
FONT_DEFAULT_SIZE
&&
form
!=
null
&&
form
.
getPropertyValue
(
"BigDefaultText"
).
equals
(
"True"
))
{
MockComponentsUtil
.
setWidgetFontSize
(
toggleWidget
.
getWidget
(
0
),
"24"
);
}
else
{
MockComponentsUtil
.
setWidgetFontSize
(
toggleWidget
.
getWidget
(
0
),
text
);
}
updatePreferredSize
();
updatePreferredSize
();
}
}
...
...
appinventor/appengine/src/com/google/appinventor/client/editor/simple/components/MockToggleBase.java
View file @
108f4eb6
...
@@ -30,6 +30,18 @@ abstract class MockToggleBase<T extends Widget> extends MockWrapper implements F
...
@@ -30,6 +30,18 @@ abstract class MockToggleBase<T extends Widget> extends MockWrapper implements F
super
(
editor
,
type
,
icon
);
super
(
editor
,
type
,
icon
);
}
}
@Override
protected
void
onAttach
()
{
super
.
onAttach
();
((
YaFormEditor
)
editor
).
getForm
().
addFormChangeListener
(
this
);
}
@Override
protected
void
onDetach
()
{
super
.
onDetach
();
((
YaFormEditor
)
editor
).
getForm
().
removeFormChangeListener
(
this
);
}
protected
final
Widget
createClonedWidget
()
{
protected
final
Widget
createClonedWidget
()
{
// We override updatePreferredSize directly, so this shouldn't be called.
// We override updatePreferredSize directly, so this shouldn't be called.
throw
new
UnsupportedOperationException
();
throw
new
UnsupportedOperationException
();
...
@@ -46,6 +58,12 @@ abstract class MockToggleBase<T extends Widget> extends MockWrapper implements F
...
@@ -46,6 +58,12 @@ abstract class MockToggleBase<T extends Widget> extends MockWrapper implements F
int
hint
=
super
.
getHeightHint
();
int
hint
=
super
.
getHeightHint
();
if
(
hint
==
MockVisibleComponent
.
LENGTH_PREFERRED
)
{
if
(
hint
==
MockVisibleComponent
.
LENGTH_PREFERRED
)
{
float
height
=
Float
.
parseFloat
(
getPropertyValue
(
MockVisibleComponent
.
PROPERTY_NAME_FONTSIZE
));
float
height
=
Float
.
parseFloat
(
getPropertyValue
(
MockVisibleComponent
.
PROPERTY_NAME_FONTSIZE
));
MockForm
form
=
((
YaFormEditor
)
editor
).
getForm
();
if
(
height
==
FONT_DEFAULT_SIZE
&&
form
!=
null
&&
form
.
getPropertyValue
(
"BigDefaultText"
).
equals
(
"True"
))
{
return
24
;
}
return
Math
.
round
(
height
);
return
Math
.
round
(
height
);
}
else
{
}
else
{
return
hint
;
return
hint
;
...
@@ -169,6 +187,7 @@ abstract class MockToggleBase<T extends Widget> extends MockWrapper implements F
...
@@ -169,6 +187,7 @@ abstract class MockToggleBase<T extends Widget> extends MockWrapper implements F
public
void
onComponentPropertyChanged
(
MockComponent
component
,
String
propertyName
,
String
propertyValue
)
{
public
void
onComponentPropertyChanged
(
MockComponent
component
,
String
propertyName
,
String
propertyValue
)
{
if
(
component
.
getType
().
equals
(
MockForm
.
TYPE
)
&&
propertyName
.
equals
(
"BigDefaultText"
))
{
if
(
component
.
getType
().
equals
(
MockForm
.
TYPE
)
&&
propertyName
.
equals
(
"BigDefaultText"
))
{
setFontSizeProperty
(
getPropertyValue
(
PROPERTY_NAME_FONTSIZE
));
setFontSizeProperty
(
getPropertyValue
(
PROPERTY_NAME_FONTSIZE
));
updatePreferredSize
();
refreshForm
();
refreshForm
();
}
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment