Skip to content

Commit 5ab2458

Browse files
committed
Fixed Android bug
1 parent e93f6bb commit 5ab2458

File tree

2 files changed

+19
-6
lines changed

2 files changed

+19
-6
lines changed

js/timer.js

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -296,9 +296,11 @@ function timer(seconds) { //counts time, takes seconds
296296
}, 1000);
297297
}
298298

299-
window.onresize = function() {
300-
resizeScreen();
301-
};
299+
if (os !== "Android") {
300+
window.onresize = function() {
301+
resizeScreen();
302+
};
303+
}
302304

303305
function resizeScreen() {
304306
let scaleVal = window.innerHeight / 600;
@@ -1033,6 +1035,17 @@ txtCustom.addEventListener("keyup", function(e) {
10331035
hideKeyboard(txtCustom);
10341036
});
10351037

1038+
if (os === "Android") {
1039+
txtSpeaker.addEventListener("onfocus", function() {
1040+
let y = document.getElementById("playControl").getBoundingClientRect().y;
1041+
document.body.marginTop = `-${y}px`;
1042+
});
1043+
1044+
txtSpeaker.addEventListener("onblur", function() {
1045+
document.body.marginTop = '0px';
1046+
});
1047+
}
1048+
10361049
txtSpeaker.addEventListener("keyup", function(e) {
10371050
if (e.key === 13)
10381051
hideKeyboard(txtSpeaker);
@@ -1351,8 +1364,6 @@ tickAll.addEventListener('change', (event) => {
13511364
}, 1000);
13521365
})();
13531366

1354-
resizeScreen();
1355-
13561367
function hideKeyboard(element) {
13571368
element.readOnly = true;
13581369
setTimeout(function() {
@@ -1396,4 +1407,6 @@ window.addEventListener('DOMContentLoaded', (event) => {
13961407
if (window.innerHeight > window.innerWidth * 2 && window.matchMedia("(orientation: portrait)").matches) {
13971408
document.querySelector('#innerPlayContainer').classList.add("longPhonePortrait");
13981409
}
1410+
1411+
resizeScreen();
13991412
});

0 commit comments

Comments
 (0)