-
-
Notifications
You must be signed in to change notification settings - Fork 0
🎨 Palette: Improve compose FAB long-press accessibility discoverability #119
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
Closed
+63
−0
Closed
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
454bcb1
Initial plan
Copilot 55ac829
feat: add tooltip text for timeline compose FAB
Copilot 036a68c
chore: plan follow-up for fab accessibility feedback
Copilot 6d382a8
fix: label compose fab long-click accessibility action
Copilot 778998b
style: format fab accessibility action conditionals
Copilot acf9ad5
fix: refresh fab accessibility action label on shown
Copilot 89e27bb
fix: guard fab accessibility refresh on shown
Copilot 3ba705f
Update mastodon/src/main/java/de/icod/techidon/fragments/BaseStatusLi…
dlukt 0efef58
Update mastodon/src/main/java/de/icod/techidon/fragments/HomeTabFragm…
dlukt b354662
Update mastodon/src/main/java/de/icod/techidon/fragments/HomeTabFragm…
dlukt 688a383
fix: keep fab long-click listener attached
Copilot 7ef238d
Update mastodon/src/main/java/de/icod/techidon/fragments/BaseStatusLi…
dlukt 8e15173
Update mastodon/src/main/java/de/icod/techidon/fragments/HomeTabFragm…
dlukt 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
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -33,6 +33,8 @@ | |||||||||||||||||||||||||||||||||||||
| import android.widget.Toolbar; | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| import androidx.annotation.NonNull; | ||||||||||||||||||||||||||||||||||||||
| import androidx.core.view.ViewCompat; | ||||||||||||||||||||||||||||||||||||||
| import androidx.core.view.accessibility.AccessibilityNodeInfoCompat; | ||||||||||||||||||||||||||||||||||||||
| import androidx.recyclerview.widget.RecyclerView; | ||||||||||||||||||||||||||||||||||||||
| import androidx.viewpager2.widget.ViewPager2; | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
|
|
@@ -148,6 +150,7 @@ public View onCreateContentView(LayoutInflater inflater, ViewGroup container, Bu | |||||||||||||||||||||||||||||||||||||
| fab = view.findViewById(R.id.fab); | ||||||||||||||||||||||||||||||||||||||
| fab.setOnClickListener(this::onFabClick); | ||||||||||||||||||||||||||||||||||||||
| fab.setOnLongClickListener(this::onFabLongClick); | ||||||||||||||||||||||||||||||||||||||
| updateFabLongClickAccessibilityAction(); | ||||||||||||||||||||||||||||||||||||||
| pager = new ViewPager2(getContext()); | ||||||||||||||||||||||||||||||||||||||
| toolbarFrame = (FrameLayout) LayoutInflater.from(getContext()).inflate(R.layout.home_toolbar, getToolbar(), false); | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
|
|
@@ -686,10 +689,37 @@ public void onDestroyView(){ | |||||||||||||||||||||||||||||||||||||
| @Override | ||||||||||||||||||||||||||||||||||||||
| protected void onShown() { | ||||||||||||||||||||||||||||||||||||||
| super.onShown(); | ||||||||||||||||||||||||||||||||||||||
| if (fab != null) { | ||||||||||||||||||||||||||||||||||||||
| updateFabLongClickAccessibilityAction(); | ||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||
| Object timelines = AccountSessionManager.get(accountID).getLocalPreferences().timelines; | ||||||||||||||||||||||||||||||||||||||
| if (timelines != null && timelinesList!= timelines) UiUtils.restartApp(); | ||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| private void updateFabLongClickAccessibilityAction() { | ||||||||||||||||||||||||||||||||||||||
| if (fab == null) | ||||||||||||||||||||||||||||||||||||||
| return; | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| boolean multipleAccounts = AccountSessionManager.getInstance().getLoggedInAccounts().size() > 1; | ||||||||||||||||||||||||||||||||||||||
| fab.setLongClickable(multipleAccounts); | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| if (multipleAccounts) { | ||||||||||||||||||||||||||||||||||||||
| ViewCompat.replaceAccessibilityAction( | ||||||||||||||||||||||||||||||||||||||
| fab, | ||||||||||||||||||||||||||||||||||||||
| AccessibilityNodeInfoCompat.AccessibilityActionCompat.ACTION_LONG_CLICK, | ||||||||||||||||||||||||||||||||||||||
| getString(R.string.choose_account), | ||||||||||||||||||||||||||||||||||||||
| null | ||||||||||||||||||||||||||||||||||||||
| ); | ||||||||||||||||||||||||||||||||||||||
| } else { | ||||||||||||||||||||||||||||||||||||||
| ViewCompat.replaceAccessibilityAction( | ||||||||||||||||||||||||||||||||||||||
| fab, | ||||||||||||||||||||||||||||||||||||||
| AccessibilityNodeInfoCompat.AccessibilityActionCompat.ACTION_LONG_CLICK, | ||||||||||||||||||||||||||||||||||||||
| null, | ||||||||||||||||||||||||||||||||||||||
| null | ||||||||||||||||||||||||||||||||||||||
| ); | ||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+704
to
+720
|
||||||||||||||||||||||||||||||||||||||
| fab.setLongClickable(multipleAccounts); | |
| if (multipleAccounts) { | |
| ViewCompat.replaceAccessibilityAction( | |
| fab, | |
| AccessibilityNodeInfoCompat.AccessibilityActionCompat.ACTION_LONG_CLICK, | |
| getString(R.string.manage_accounts), | |
| null | |
| ); | |
| } else { | |
| ViewCompat.replaceAccessibilityAction( | |
| fab, | |
| AccessibilityNodeInfoCompat.AccessibilityActionCompat.ACTION_LONG_CLICK, | |
| null, | |
| null | |
| ); | |
| } | |
| UiUtils.updateLongClickActionLabel(fab, multipleAccounts, R.string.manage_accounts); |
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updateFabLongClickAccessibilityAction()duplicates the same logic now present inHomeTabFragment(and partially in other views). To reduce the chance of future drift (e.g., label/resource changes), consider extracting this into a shared helper (e.g., inUiUtils) that takes the target view and label resource.