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
4da346ef
Commit
4da346ef
authored
Jan 15, 2020
by
Evan W. Patton
Committed by
Jeffrey Schiller
Jan 24, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve app resizing on Chromebooks
Change-Id: I58de7133e0eb76d13353ed152c38137bbdb31a3d
parent
ec35256e
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
12 deletions
+14
-12
appinventor/buildserver/src/com/google/appinventor/buildserver/Compiler.java
...rver/src/com/google/appinventor/buildserver/Compiler.java
+3
-2
appinventor/components/src/com/google/appinventor/components/runtime/util/ScreenDensityUtil.java
...ppinventor/components/runtime/util/ScreenDensityUtil.java
+9
-9
appinventor/components/src/com/google/appinventor/components/runtime/util/SdkLevel.java
.../google/appinventor/components/runtime/util/SdkLevel.java
+2
-1
No files found.
appinventor/buildserver/src/com/google/appinventor/buildserver/Compiler.java
View file @
4da346ef
// -*- mode: java; c-basic-offset: 2; -*-
// -*- mode: java; c-basic-offset: 2; -*-
// Copyright 2009-2011 Google, All Rights reserved
// Copyright 2009-2011 Google, All Rights reserved
// Copyright 2011-20
19
MIT, All rights reserved
// Copyright 2011-20
20
MIT, All rights reserved
// Released under the Apache License, Version 2.0
// Released under the Apache License, Version 2.0
// http://www.apache.org/licenses/LICENSE-2.0
// http://www.apache.org/licenses/LICENSE-2.0
...
@@ -984,7 +984,8 @@ public final class Compiler {
...
@@ -984,7 +984,8 @@ public final class Compiler {
// The keyboard option prevents the app from stopping when a external (bluetooth)
// The keyboard option prevents the app from stopping when a external (bluetooth)
// keyboard is attached.
// keyboard is attached.
out
.
write
(
"android:configChanges=\"orientation|screenSize|keyboardHidden|keyboard\">\n"
);
out
.
write
(
"android:configChanges=\"orientation|screenSize|keyboardHidden|keyboard|"
+
"screenLayout|smallestScreenSize\">\n"
);
out
.
write
(
" <intent-filter>\n"
);
out
.
write
(
" <intent-filter>\n"
);
out
.
write
(
" <action android:name=\"android.intent.action.MAIN\" />\n"
);
out
.
write
(
" <action android:name=\"android.intent.action.MAIN\" />\n"
);
...
...
appinventor/components/src/com/google/appinventor/components/runtime/util/ScreenDensityUtil.java
View file @
4da346ef
// -*- mode: java; c-basic-offset: 2; -*-
// -*- mode: java; c-basic-offset: 2; -*-
// Copyright 2009-2015 Google, All Rights reserved
// Copyright 2009-2015 Google, All Rights reserved
// Copyright 2011-20
15
MIT, All rights reserved
// Copyright 2011-20
20
MIT, All rights reserved
// Released under the Apache License, Version 2.0
// Released under the Apache License, Version 2.0
// http://www.apache.org/licenses/LICENSE-2.0
// http://www.apache.org/licenses/LICENSE-2.0
...
@@ -13,7 +13,6 @@ import android.util.Log;
...
@@ -13,7 +13,6 @@ import android.util.Log;
import
android.view.Display
;
import
android.view.Display
;
import
android.view.WindowManager
;
import
android.view.WindowManager
;
import
java.lang.reflect.Field
;
import
java.lang.reflect.InvocationTargetException
;
import
java.lang.reflect.InvocationTargetException
;
import
java.lang.reflect.Method
;
import
java.lang.reflect.Method
;
...
@@ -75,12 +74,8 @@ public final class ScreenDensityUtil {
...
@@ -75,12 +74,8 @@ public final class ScreenDensityUtil {
float
sw
=
width
/(
float
)
newWidth
;
float
sw
=
width
/(
float
)
newWidth
;
float
sh
=
height
/(
float
)
newHeight
;
float
sh
=
height
/(
float
)
newHeight
;
float
scale
=
sw
<
sh
?
sw
:
sh
;
if
(
scale
<
1
)
{
scale
=
1
;
}
return
scale
;
return
Math
.
max
(
1
,
Math
.
min
(
Math
.
min
(
sw
,
sh
),
MAXIMUM_ASPECT_RATIO
))
;
}
}
/**
/**
...
@@ -90,14 +85,19 @@ public final class ScreenDensityUtil {
...
@@ -90,14 +85,19 @@ public final class ScreenDensityUtil {
* @param context context to get screen size of.
* @param context context to get screen size of.
* @param outSize Set to the real size of the display.
* @param outSize Set to the real size of the display.
*/
*/
p
ublic
static
void
getRawScreenDim
(
Context
context
,
Point
outSize
)
{
p
rivate
static
void
getRawScreenDim
(
Context
context
,
Point
outSize
)
{
final
DisplayMetrics
metrics
=
new
DisplayMetrics
();
final
DisplayMetrics
metrics
=
new
DisplayMetrics
();
final
WindowManager
wm
=
(
WindowManager
)
context
.
getSystemService
(
Context
.
WINDOW_SERVICE
);
final
WindowManager
wm
=
(
WindowManager
)
context
.
getSystemService
(
Context
.
WINDOW_SERVICE
);
Display
display
=
wm
.
getDefaultDisplay
();
Display
display
=
wm
.
getDefaultDisplay
();
int
sdkLevel
=
SdkLevel
.
getLevel
();
int
sdkLevel
=
SdkLevel
.
getLevel
();
if
(
sdkLevel
>=
SdkLevel
.
LEVEL_JELLYBEAN_MR1
)
{
if
(
sdkLevel
>=
SdkLevel
.
LEVEL_NOUGAT
)
{
// Needed for multi-window support
display
.
getMetrics
(
metrics
);
outSize
.
x
=
metrics
.
widthPixels
;
outSize
.
y
=
metrics
.
heightPixels
;
}
else
if
(
sdkLevel
>=
SdkLevel
.
LEVEL_JELLYBEAN_MR1
)
{
// On API level 17, a public method was added to get the actual sizes
// On API level 17, a public method was added to get the actual sizes
JellybeanUtil
.
getRealSize
(
display
,
outSize
);
JellybeanUtil
.
getRealSize
(
display
,
outSize
);
}
else
if
(
sdkLevel
>
SdkLevel
.
LEVEL_GINGERBREAD_MR1
){
}
else
if
(
sdkLevel
>
SdkLevel
.
LEVEL_GINGERBREAD_MR1
){
...
...
appinventor/components/src/com/google/appinventor/components/runtime/util/SdkLevel.java
View file @
4da346ef
// -*- mode: java; c-basic-offset: 2; -*-
// -*- mode: java; c-basic-offset: 2; -*-
// Copyright 2009-2011 Google, All Rights reserved
// Copyright 2009-2011 Google, All Rights reserved
// Copyright 2011-20
12
MIT, All rights reserved
// Copyright 2011-20
20
MIT, All rights reserved
// Released under the Apache License, Version 2.0
// Released under the Apache License, Version 2.0
// http://www.apache.org/licenses/LICENSE-2.0
// http://www.apache.org/licenses/LICENSE-2.0
...
@@ -34,6 +34,7 @@ public class SdkLevel {
...
@@ -34,6 +34,7 @@ public class SdkLevel {
public
static
final
int
LEVEL_KITKAT
=
19
;
// a.k.a. 4.4
public
static
final
int
LEVEL_KITKAT
=
19
;
// a.k.a. 4.4
public
static
final
int
LEVEL_LOLLIPOP
=
21
;
// a.k.a. 5.0
public
static
final
int
LEVEL_LOLLIPOP
=
21
;
// a.k.a. 5.0
public
static
final
int
LEVEL_MARSHMALLOW
=
23
;
// a.k.a. 6.0
public
static
final
int
LEVEL_MARSHMALLOW
=
23
;
// a.k.a. 6.0
public
static
final
int
LEVEL_NOUGAT
=
24
;
// a.k.a. 7.0
private
SdkLevel
()
{
private
SdkLevel
()
{
}
}
...
...
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