Skip to content

Commit 7de46f0

Browse files
Fix Actionbar hiding
Signed-off-by: Keith Conger <keith.conger@blackboxembedded.com>
1 parent 828c4ad commit 7de46f0

1 file changed

Lines changed: 22 additions & 13 deletions

File tree

app/src/main/java/com/blackboxembedded/WunderLINQ/MainActivity.java

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -584,11 +584,16 @@ public void onPictureInPictureModeChanged(boolean isInPIPMode) {
584584
if (isInPIPMode) {
585585
inPIP = true;
586586
//Hide your clickable components
587-
getSupportActionBar().hide();
587+
if (getSupportActionBar() != null) {
588+
getSupportActionBar().hide();
589+
}
588590
} else {
589591
inPIP = false;
590592
//Show your clickable components
591-
getSupportActionBar().show();
593+
if (getSupportActionBar() != null) {
594+
getSupportActionBar().show();
595+
}
596+
startTimer();
592597
}
593598
gridChange(true);
594599
updateDisplay();
@@ -911,26 +916,30 @@ public static boolean isAccessibilityServiceEnabled(Context context, Class<?> ac
911916
//start timer function
912917
void startTimer() {
913918
if (sharedPrefs.getBoolean("prefHideNavBar", false)) {
914-
if (!timerRunning) {
915-
cTimer = new CountDownTimer(10000, 1000) {
916-
public void onTick(long millisUntilFinished) {
917-
}
919+
cancelTimer();
920+
cTimer = new CountDownTimer(10000, 1000) {
921+
public void onTick(long millisUntilFinished) {
922+
}
918923

919-
public void onFinish() {
924+
public void onFinish() {
925+
if (getSupportActionBar() != null) {
920926
getSupportActionBar().hide();
921-
timerRunning = false;
922927
}
923-
};
924-
timerRunning = true;
925-
cTimer.start();
926-
}
928+
timerRunning = false;
929+
}
930+
};
931+
timerRunning = true;
932+
cTimer.start();
927933
}
928934
}
929935

930936
//cancel timer
931937
void cancelTimer() {
932-
if(cTimer!=null)
938+
if (cTimer != null) {
933939
cTimer.cancel();
940+
cTimer = null;
941+
}
942+
timerRunning = false;
934943
}
935944

936945
//Go to next screen

0 commit comments

Comments
 (0)