Skip to content

Commit 33dd024

Browse files
ADFA-4887: clear the pending auto-hide runnable in onDestroy
Make hideHandler/hideRunnable fields and removeCallbacks in onDestroy so a pending nav-bar hide doesn't retain the activity (via bottomNav/btnHandle) after it's gone.
1 parent e6c0c24 commit 33dd024

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

‎controller/app/src/main/java/org/iiab/controller/PortalActivity.java‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@ public class PortalActivity extends AppCompatActivity {
7171
private org.iiab.controller.redesign.FqrController fqr; // ADFA-4879: FQR maps (only on /maps/)
7272
private static final long AUTO_HIDE_MS = 4000L; // ADFA-4887: nav-bar auto-hide after inactivity
7373
private boolean fullscreenOn = false; // ADFA-4887: Home button toggles fullscreen
74+
private Handler hideHandler; // ADFA-4887: nav-bar auto-hide (cleared in onDestroy)
75+
private Runnable hideRunnable;
7476
// pdf.js builds advertised by /pdfjs/manifest.json (loaded off the main thread).
7577
// Empty until loaded / when the box serves none -> PDFs fall back to download.
7678
private volatile List<PdfViewerBuild> pdfViewerBuilds = Collections.emptyList();
@@ -111,9 +113,9 @@ protected void onCreate(Bundle savedInstanceState) {
111113
});
112114
btnHandle.setVisibility(View.GONE);
113115

114-
Handler hideHandler = new Handler(Looper.getMainLooper());
116+
hideHandler = new Handler(Looper.getMainLooper());
115117

116-
Runnable hideRunnable = () -> {
118+
hideRunnable = () -> {
117119
bottomNav.animate().translationY(bottomNav.getHeight()).setDuration(250);
118120
btnHandle.setVisibility(View.VISIBLE);
119121
btnHandle.animate().alpha(1f).setDuration(150);
@@ -408,6 +410,7 @@ protected void onDestroy() {
408410
// ADFA-4879: stop FQR polling + drop its overlay/dialog so we don't leak the activity.
409411
// The durable server job (if any) keeps running and shows up on the next /maps/ reload.
410412
if (fqr != null) fqr.detach();
413+
if (hideHandler != null && hideRunnable != null) hideHandler.removeCallbacks(hideRunnable); // ADFA-4887
411414
super.onDestroy();
412415
}
413416

0 commit comments

Comments
 (0)