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
254ae138
Commit
254ae138
authored
Dec 28, 2017
by
moliata
Committed by
Evan W. Patton
Feb 19, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added a click event to an image component
parent
b9d82d88
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
26 additions
and
2 deletions
+26
-2
appinventor/appengine/src/com/google/appinventor/client/youngandroid/YoungAndroidFormUpgrader.java
...nventor/client/youngandroid/YoungAndroidFormUpgrader.java
+5
-0
appinventor/blocklyeditor/src/versioning.js
appinventor/blocklyeditor/src/versioning.js
+4
-1
appinventor/components/src/com/google/appinventor/components/common/YaVersion.java
...c/com/google/appinventor/components/common/YaVersion.java
+3
-1
appinventor/components/src/com/google/appinventor/components/runtime/Image.java
.../src/com/google/appinventor/components/runtime/Image.java
+14
-0
No files found.
appinventor/appengine/src/com/google/appinventor/client/youngandroid/YoungAndroidFormUpgrader.java
View file @
254ae138
...
...
@@ -1076,6 +1076,11 @@ public final class YoungAndroidFormUpgrader {
// }
srcCompVersion
=
3
;
}
if
(
srcCompVersion
<
4
)
{
// The Click event was added.
// No properties need to be modified to upgrade to version 4.
srcCompVersion
=
4
;
}
return
srcCompVersion
;
}
...
...
appinventor/blocklyeditor/src/versioning.js
View file @
254ae138
...
...
@@ -1580,7 +1580,10 @@ Blockly.Versioning.AllUpgradeMaps =
2
:
"
noUpgrade
"
,
// Scaling property was added (but not in use yet)
3
:
"
noUpgrade
"
3
:
"
noUpgrade
"
,
// Click event was added
4
:
"
noUpgrade
"
},
// End Image upgraders
...
...
appinventor/components/src/com/google/appinventor/components/common/YaVersion.java
View file @
254ae138
...
...
@@ -874,7 +874,9 @@ public class YaVersion {
// - The RotationAngle property was added.
// For IMAGE_COMPONENT_VERSION 3:
// - Scaling Property added, but hidden for now
public
static
final
int
IMAGE_COMPONENT_VERSION
=
3
;
// For IMAGE_COMPONENT_VERSION 4:
// - The Click event was added.
public
static
final
int
IMAGE_COMPONENT_VERSION
=
4
;
// For IMAGEPICKER_COMPONENT_VERSION 2:
// - The Alignment property was renamed to TextAlignment.
...
...
appinventor/components/src/com/google/appinventor/components/runtime/Image.java
View file @
254ae138
...
...
@@ -17,6 +17,7 @@ import com.google.appinventor.components.annotations.UsesPermissions;
import
com.google.appinventor.components.common.ComponentCategory
;
import
com.google.appinventor.components.common.PropertyTypeConstants
;
import
com.google.appinventor.components.common.YaVersion
;
import
com.google.appinventor.components.runtime.EventDispatcher
;
import
com.google.appinventor.components.runtime.errors.IllegalArgumentError
;
import
com.google.appinventor.components.runtime.util.AnimationUtil
;
import
com.google.appinventor.components.runtime.util.ErrorMessages
;
...
...
@@ -28,6 +29,7 @@ import com.google.appinventor.components.runtime.util.ViewUtil;
import
android.graphics.drawable.Drawable
;
import
android.util.Log
;
import
android.view.View
;
import
android.view.View.OnClickListener
;
import
android.widget.ImageView
;
import
java.io.IOException
;
...
...
@@ -73,6 +75,13 @@ public final class Image extends AndroidViewComponent {
}
};
view
.
setFocusable
(
true
);
view
.
setClickable
(
true
);
view
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
v
)
{
Click
();
}
});
// Adds the component to its designated container
container
.
$add
(
this
);
...
...
@@ -83,6 +92,11 @@ public final class Image extends AndroidViewComponent {
return
view
;
}
@SimpleEvent
(
description
=
"An event that occurs when an image is clicked."
)
public
void
Click
()
{
EventDispatcher
.
dispatchEvent
(
this
,
"Click"
);
}
/**
* Returns the path of the image's picture.
*
...
...
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