-
-
Notifications
You must be signed in to change notification settings - Fork 34
bug/ADFA-4854: Filter bar invisible #1592
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
e7849d3
fix(ADFA-4854): Show filter bar when filtered result is empty
dara-abijo-adfa a644466
feat(ADFA-4854): Disable log actions when log is empty
dara-abijo-adfa e89b9e8
feat(ADFA-4854): Show info when search or filter result is empty
dara-abijo-adfa ccd8775
fix(ADFA-4854): Fix rotation bug with active no-match filter
dara-abijo-adfa 5774bba
fix(ADFA-4854): Guard fragment attachment
dara-abijo-adfa 8ac281c
fix(ADFA-4854): Address code review comments
dara-abijo-adfa de8b6a3
format(ADFA-4854): Apply spotless
dara-abijo-adfa 393b799
fix(ADFA-4854): Resolve additional issues
dara-abijo-adfa cd9d772
fix(ADFA-4854): Implement a separate source-empty signal
dara-abijo-adfa d8da1cd
Merge branch 'stage' into bug/ADFA-4854-filter-bar-invisible
dara-abijo-adfa File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
app/src/main/java/com/itsaky/androidide/fragments/output/FilterNoMatchTracker.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| /* | ||
| * This file is part of AndroidIDE. | ||
| * | ||
| * AndroidIDE is free software: you can redistribute it and/or modify | ||
| * it under the terms of the GNU General Public License as published by | ||
| * the Free Software Foundation, either version 3 of the License, or | ||
| * (at your option) any later version. | ||
| * | ||
| * AndroidIDE is distributed in the hope that it will be useful, | ||
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| * GNU General Public License for more details. | ||
| * | ||
| * You should have received a copy of the GNU General Public License | ||
| * along with AndroidIDE. If not, see <https://www.gnu.org/licenses/>. | ||
| */ | ||
|
|
||
| package com.itsaky.androidide.fragments.output | ||
|
|
||
| /** | ||
| * Decides when a filtered re-render deserves a "no matches" flash: only on a fresh | ||
| * transition into no-matches for a non-empty source, never on the initial render. | ||
| */ | ||
| class FilterNoMatchTracker { | ||
| private var hasRendered = false | ||
| private var wasLastFilteredResultEmpty = false | ||
|
|
||
| fun reset() { | ||
| hasRendered = false | ||
| wasLastFilteredResultEmpty = false | ||
| } | ||
|
|
||
| /** Marks the initial render (e.g. window restore after rotation) without ever flashing. */ | ||
| fun prime(isFilteredEmpty: Boolean) { | ||
| hasRendered = true | ||
| wasLastFilteredResultEmpty = isFilteredEmpty | ||
| } | ||
|
|
||
| /** Records a full re-render; returns `true` when it newly transitioned to "no matches". */ | ||
| fun onRender( | ||
| isSourceEmpty: Boolean, | ||
| isFilteredEmpty: Boolean, | ||
| ): Boolean { | ||
| if (!hasRendered) { | ||
| prime(isFilteredEmpty) | ||
| return false | ||
| } | ||
| if (!isSourceEmpty && isFilteredEmpty) { | ||
| val shouldFlash = !wasLastFilteredResultEmpty | ||
| wasLastFilteredResultEmpty = true | ||
| return shouldFlash | ||
| } | ||
| wasLastFilteredResultEmpty = false | ||
| return false | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.