From 0669f8a062e9a8743173e755e32efd136438cad6 Mon Sep 17 00:00:00 2001 From: Harsh Shandilya Date: Sun, 4 Jun 2023 02:18:13 +0530 Subject: fix: replace `Stack` with `ArrayDeque` in `SearchableRepositoryViewModel` --- app/lint-baseline.xml | 11 ----------- .../util/viewmodel/SearchableRepositoryViewModel.kt | 7 +++---- 2 files changed, 3 insertions(+), 15 deletions(-) diff --git a/app/lint-baseline.xml b/app/lint-baseline.xml index f6232d8e..de1f0a60 100644 --- a/app/lint-baseline.xml +++ b/app/lint-baseline.xml @@ -81,17 +81,6 @@ column="5"/> - - - - () + private val navigationStack = ArrayDeque() fun navigateTo( newDirectory: File = root, @@ -305,7 +304,7 @@ constructor( if (!newDirectory.exists()) return require(newDirectory.isDirectory) { "Can only navigate to a directory" } if (pushPreviousLocation) { - navigationStack.push(NavigationStackEntry(_currentDir.value, recyclerViewState)) + navigationStack.addFirst(NavigationStackEntry(_currentDir.value, recyclerViewState)) } searchActionFlow.update { makeSearchAction( @@ -330,7 +329,7 @@ constructor( */ fun navigateBack(): Parcelable? { if (!canNavigateBack) return null - val (oldDir, oldRecyclerViewState) = navigationStack.pop() + val (oldDir, oldRecyclerViewState) = navigationStack.removeFirst() navigateTo(oldDir, pushPreviousLocation = false) return oldRecyclerViewState } -- cgit v1.2.3