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
e1ab8187
Unverified
Commit
e1ab8187
authored
Mar 10, 2020
by
Bart Mathijssen
Committed by
GitHub
Mar 10, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use onBackPressed instead of onKeyDown (#1943)
parent
3e94ebc7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
21 deletions
+9
-21
appinventor/components/src/com/google/appinventor/components/runtime/Form.java
...s/src/com/google/appinventor/components/runtime/Form.java
+5
-13
appinventor/components/src/com/google/appinventor/components/runtime/ListPickerActivity.java
...le/appinventor/components/runtime/ListPickerActivity.java
+4
-8
No files found.
appinventor/components/src/com/google/appinventor/components/runtime/Form.java
View file @
e1ab8187
...
...
@@ -560,22 +560,14 @@ public class Form extends AppInventorCompatActivity
/*
* Here we override the hardware back button, just to make sure
* that the closing screen animation is applied. (In API level
* 5, we can simply override the onBackPressed method rather
* than bothering with onKeyDown)
* that the closing screen animation is applied.
*/
@Override
public
boolean
onKeyDown
(
int
keyCode
,
KeyEvent
event
)
{
if
(
keyCode
==
KeyEvent
.
KEYCODE_BACK
)
{
if
(!
BackPressed
())
{
boolean
handled
=
super
.
onKeyDown
(
keyCode
,
event
);
AnimationUtil
.
ApplyCloseScreenAnimation
(
this
,
closeAnimType
);
return
handled
;
}
else
{
return
true
;
}
public
void
onBackPressed
()
{
if
(!
BackPressed
())
{
AnimationUtil
.
ApplyCloseScreenAnimation
(
this
,
closeAnimType
);
}
return
super
.
onKeyDown
(
keyCode
,
event
);
super
.
onBackPressed
(
);
}
@SimpleEvent
(
description
=
"Device back button pressed."
)
...
...
appinventor/components/src/com/google/appinventor/components/runtime/ListPickerActivity.java
View file @
e1ab8187
...
...
@@ -157,15 +157,11 @@ public class ListPickerActivity extends AppInventorCompatActivity implements Ada
}
// Capture the hardware back button to make sure the screen animation
// still applies.
(In API level 5, we can override onBackPressed instead)
// still applies.
@Override
public
boolean
onKeyDown
(
int
keyCode
,
KeyEvent
event
)
{
if
(
keyCode
==
KeyEvent
.
KEYCODE_BACK
)
{
boolean
handled
=
super
.
onKeyDown
(
keyCode
,
event
);
AnimationUtil
.
ApplyCloseScreenAnimation
(
this
,
closeAnim
);
return
handled
;
}
return
super
.
onKeyDown
(
keyCode
,
event
);
public
void
onBackPressed
()
{
AnimationUtil
.
ApplyCloseScreenAnimation
(
this
,
closeAnim
);
super
.
onBackPressed
();
}
...
...
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