mirror of https://github.com/tuskyapp/Tusky.git
Tree:
43ae0bb455
develop
expired-auth
green-version-code-always-increase
hide-bots-in-timelines
main
poll-dialog-dismiss
prefs
preview-improvements
renovate/androidx.fragment
renovate/glide.animation.plugin
renovate/gradle-8.x
renovate/image.cropper
renovate/major-unified.push
renovate/org.jlleitschuh.gradle.ktlint-12.x
renovate/unified.push
rfc-issue-triage
simple-sse-2
unified-push-upgrade
view-update-on-tl-cache
v1.0.0
v1.0.0-alpha.1
v1.0.0-alpha.2
v1.0.0-alpha.3
v1.0.0-alpha.4
v1.0.0-alpha.5
v1.0.0-alpha.6
v1.0.0-alpha.7
v1.0.0-alpha.8
v1.0.1
v1.0.2
v1.0.3
v1.1.0
v1.1.1
v1.1.2
v1.1.3
v1.1.4
v1.1.4-beta.1
v1.1.4-beta.3
v1.1.4-beta.4
v1.1.4-beta.5
v1.1.4-beta.6
v1.1.4-beta.7
v1.2.0
v1.2.1
v1.3.0
v1.3.1
v1.4.0
v1.4.1
v1.5.0
v1.5.1
v1.5.2
v1.6.0
v1.6.1
v1.7.0
v1.8.0
v10.0
v10.0-beta.1
v11.0
v11.0-beta.1
v12.0
v12.0-beta.1
v12.1
v13.0
v13.0-beta.1
v13.1
v14.0
v14.0-beta.1
v15.0
v15.0-beta.1
v15.1
v16.0
v16.0-beta.1
v16.0-beta.2
v16.0-beta.3
v17.0
v17.0-beta.1
v18.0
v18.0-beta.1
v19.0
v19.0-beta.1
v19.0-beta.2
v2.0
v2.0-beta.1
v2.0-beta.2
v2.1
v2.2
v2.3
v20.0
v20.0-beta.1
v20.0-beta.2
v21.0
v21.0-beta.1
v21.0-beta.2
v22.0
v22.0-beta.1
v22.0-beta.2
v22.0-beta.3
v22.0-beta.4
v22.0-beta.5
v22.0-beta.6
v22.0-beta.7
v23.0
v23.0-beta.1
v23.0-beta.2
v24.0
v24.0-beta.1
v24.1
v24.1-beta.1
v25.0
v25.0-beta.1
v25.1
v25.2
v26.0
v26.0-beta.1
v26.1
v26.2
v27.0
v27.0-beta.1
v27.1
v27.2
v28.0
v28.0-beta.1
v29.0
v29.0-beta.1
v3.0
v3.0-beta.1
v3.0-beta.2
v3.1
v4.0
v4.0-beta.1
v4.1
v5.0
v5.0-beta.1
v5.1
v5.2
v6.0
v6.0-beta.1
v6.1
v7.0
v7.0-beta.1
v7.1
v8.0
v8.0-beta.1
v8.1
v9.0
v9.0-beta.1
v9.1
${ noResults }
11 Commits (43ae0bb4556392393a3d759ce42a93f3a003e83a)
| Author | SHA1 | Message | Date |
|---|---|---|---|
|
|
351e0b3cfc
|
update lint config, fix some warnings (#5094)
|
11 months ago |
|
|
ccd9fe9534
|
fix(deps): update kotlin (#4774)
This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [com.google.devtools.ksp](https://goo.gle/ksp) ([source](https://redirect.github.com/google/ksp)) | `2.0.21-1.0.28` -> `2.1.0-1.0.29` | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | | org.jetbrains.kotlin.plugin.parcelize | `2.0.21` -> `2.1.0` | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | | org.jetbrains.kotlin.android | `2.0.21` -> `2.1.0` | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | | [org.jetbrains.kotlinx:kotlinx-coroutines-test](https://redirect.github.com/Kotlin/kotlinx.coroutines) | `1.9.0` -> `1.10.1` | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | | [org.jetbrains.kotlinx:kotlinx-coroutines-android](https://redirect.github.com/Kotlin/kotlinx.coroutines) | `1.9.0` -> `1.10.1` | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes <details> <summary>google/ksp (com.google.devtools.ksp)</summary> ### [`v2.1.0-1.0.29`](https://redirect.github.com/google/ksp/releases/tag/2.1.0-1.0.29) [Compare Source](https://redirect.github.com/google/ksp/compare/2.1.0-1.0.28...2.1.0-1.0.29) ##### Updates - KSP2: Sanitize dots to underscores in suffixes of internals by [@​ting-yuan](https://redirect.github.com/ting-yuan) in [https://github.com/google/ksp/pull/2229](https://redirect.github.com/google/ksp/pull/2229) - KSP2: clean up legacy incremental code by [@​ting-yuan](https://redirect.github.com/ting-yuan) in [https://github.com/google/ksp/pull/2231](https://redirect.github.com/google/ksp/pull/2231) ##### Contributors Thanks to everyone who reported bugs and participated in discussions! ### [`v2.1.0-1.0.28`](https://redirect.github.com/google/ksp/releases/tag/2.1.0-1.0.28) [Compare Source](https://redirect.github.com/google/ksp/compare/2.0.21-1.0.28...2.1.0-1.0.28) ##### What's Changed - Bump Kotlin to 2.1.0 by [@​mkmuir0](https://redirect.github.com/mkmuir0) in [https://github.com/google/ksp/pull/2235](https://redirect.github.com/google/ksp/pull/2235) - Update intellij to 233.13135.128 by [@​ting-yuan](https://redirect.github.com/ting-yuan) in [https://github.com/google/ksp/pull/2238](https://redirect.github.com/google/ksp/pull/2238) **Full Changelog**: https://github.com/google/ksp/compare/2.1.0-RC2-1.0.28...2.1.0-1.0.28 </details> <details> <summary>Kotlin/kotlinx.coroutines (org.jetbrains.kotlinx:kotlinx-coroutines-test)</summary> ### [`v1.10.1`](https://redirect.github.com/Kotlin/kotlinx.coroutines/blob/HEAD/CHANGES.md#Version-1101) [Compare Source](https://redirect.github.com/Kotlin/kotlinx.coroutines/compare/1.10.0...1.10.1) - Fixed binary incompatibility introduced for non-JVM targets in [#​4261](https://redirect.github.com/Kotlin/kotlinx.coroutines/issues/4261) ([#​4309](https://redirect.github.com/Kotlin/kotlinx.coroutines/issues/4309)). ### [`v1.10.0`](https://redirect.github.com/Kotlin/kotlinx.coroutines/blob/HEAD/CHANGES.md#Version-1100) [Compare Source](https://redirect.github.com/Kotlin/kotlinx.coroutines/compare/1.9.0...1.10.0) - Kotlin was updated to 2.1.0 ([#​4284](https://redirect.github.com/Kotlin/kotlinx.coroutines/issues/4284)). - Introduced `Flow.any`, `Flow.all`, and `Flow.none` ([#​4212](https://redirect.github.com/Kotlin/kotlinx.coroutines/issues/4212)). Thanks, [@​CLOVIS-AI](https://redirect.github.com/CLOVIS-AI)! - Reorganized `kotlinx-coroutines-debug` and `kotlinx-coroutines-core` code to avoid a split package between the two artifacts ([#​4247](https://redirect.github.com/Kotlin/kotlinx.coroutines/issues/4247)). Note that directly referencing `kotlinx.coroutines.debug.AgentPremain` must now be replaced with `kotlinx.coroutines.debug.internal.AgentPremain`. Thanks, [@​sellmair](https://redirect.github.com/sellmair)! - No longer shade byte-buddy in `kotlinx-coroutines-debug`, reducing the artifact size and simplifying the build configuration of client code. Thanks, [@​sellmair](https://redirect.github.com/sellmair)! - Fixed `NullPointerException` when using Java-deserialized `kotlinx-coroutines-core` exceptions ([#​4291](https://redirect.github.com/Kotlin/kotlinx.coroutines/issues/4291)). Thanks, [@​AlexRiedler](https://redirect.github.com/AlexRiedler)! - Properly report exceptions thrown by `CoroutineDispatcher.dispatch` instead of raising internal errors ([#​4091](https://redirect.github.com/Kotlin/kotlinx.coroutines/issues/4091)). Thanks, [@​zuevmaxim](https://redirect.github.com/zuevmaxim)! - Fixed a bug that delayed scheduling of a `Dispatchers.Default` or `Dispatchers.IO` task after a `yield()` in rare scenarios ([#​4248](https://redirect.github.com/Kotlin/kotlinx.coroutines/issues/4248)). - Fixed a bug that prevented the `main()` coroutine on Wasm/WASI from executing after a `delay()` call in some scenarios ([#​4239](https://redirect.github.com/Kotlin/kotlinx.coroutines/issues/4239)). - Fixed scheduling of `runBlocking` tasks on Kotlin/Native that arrive after the `runBlocking` block was exited ([#​4245](https://redirect.github.com/Kotlin/kotlinx.coroutines/issues/4245)). - Fixed some terminal `Flow` operators sometimes resuming without taking cancellation into account ([#​4254](https://redirect.github.com/Kotlin/kotlinx.coroutines/issues/4254)). Thanks, [@​jxdabc](https://redirect.github.com/jxdabc)! - Fixed a bug on the JVM that caused coroutine-bound `ThreadLocal` values not to get cleaned when using non-`CoroutineDispatcher` continuation interceptors ([#​4296](https://redirect.github.com/Kotlin/kotlinx.coroutines/issues/4296)). - Small tweaks, fixes, and documentation improvements. </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 👻 **Immortal**: This PR will be recreated if closed unmerged. Get [config help](https://redirect.github.com/renovatebot/renovate/discussions) if that's undesired. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR was generated by [Mend Renovate](https://mend.io/renovate/). View the [repository job log](https://developer.mend.io/github/tuskyapp/Tusky). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOS4xOS4wIiwidXBkYXRlZEluVmVyIjoiMzkuOTIuMCIsInRhcmdldEJyYW5jaCI6ImRldmVsb3AiLCJsYWJlbHMiOltdfQ==--> --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Conny Duck <git@connyduck.at> Co-authored-by: Konrad Pozniak <connyduck@users.noreply.github.com> |
1 year ago |
|
|
6249b53718
|
Fix some warnings & recreate lint-baseline.xml (#4278)
|
2 years ago |
|
|
26d963dda9 |
Make linting failures opt-in instead of opt-out
|
3 years ago |
|
|
30be3ce1f0
|
Use lint version 8.1.0 to fix erroneous warning about forEach (#3903)
Android lint was erroneously warning that the forEach construct in Kotlin required API 24+, which is incorrect, see https://issuetracker.google.com/issues/185418482. Work around that by forcing the Android lint version to 8.1.0. This triggered some additional checks, which have been ignored, and a new baseline. |
3 years ago |
|
|
2a04edc69b
|
Set OldTargetApi to a warning (#3836)
`OldTargetApi` default behaviour is to warn (https://googlesamples.github.io/android-custom-lint-rules/checks/OldTargetApi.md.html) Set it back to that, so that CI runs on runners with newer versions of the SDK installed do not fail. |
3 years ago |
|
|
c29a7dfe03
|
Convert lint "Typos" errors to warnings (#3811)
The typo database that lint uses may be incorrect, and it's unclear how to add or remove entries to it. |
3 years ago |
|
|
c154aaa17d
|
Ignore LogConditional issues (#3615)
Logs are stripped in release builds, this is an unnecessary lint |
3 years ago |
|
|
f1b3faf85f
|
Show the follower's bio/note in a "followed you" notification (#3281)
This makes the notification view for a follow request contain more info about the new follower, and makes the layout (of their name / username) consistent with other notifications that show names/usernames. |
3 years ago |
|
|
168be9223d
|
Disable lint checks for unused resource IDs (#3557)
* Disable lint checks for unused resource IDs The check doesn't catch some instances where resources are used through viewbinding, and has too many false positives to be useful. * Regenerate lint baseline Delete the existing file, then regenerated with `.\gradlew lintBlueDebug -Dlint.baselines.continue=true` |
3 years ago |
|
|
3ff8f73246
|
Enforce lint cleanliness when building (#3363)
* Enforce lint cleanliness when building The volume of lintable issues is growing. To stem the tide: 1. Add `app/lint-baseline.xml`, which contains the current set of lint issues. Any issue appearing here will not cause the build to fail. 2. Move lint configuration settings in to `lint.xml`. 3. Update the lint configuration so that any issue (i.e., any issue not in lint-baseline.xml) causes a build failure. 4. Add the lint tasks as depedency when assembling an APK, to ensure the lint checks are run. * lint: Convert launcher images to webp * Move lint.xml location * Don't lint when assembling * Update baseline |
3 years ago |
|
|
4d401c7878
|
Convert NotificationsFragment and related code to Kotlin, use the Paging library (#3159)
* Unmodified output from "Convert Java to Kotlin" on NotificationsFragment.java * Bare minimum changes to get this to compile and run - Use `lateinit` for `eventhub`, `adapter`, `preferences`, and `scrolllistener` - Removed override for accountManager, it can be used from the superclass - Add `?.` where non-nullity could not (yet) be guaranteed - Remove `?` from type lists where non-nullity is guaranteed - Explicitly convert lists to mutable where necessary - Delete unused function `findReplyPosition` * Remove all unnecessary non-null (!!) assertions The previous change meant some values are no longer nullable. Remove the non-null assertions. * Lint ListStatusAccessibilityDelegate call - Remove redundant constructor - Move block outside of `()` * Use `let` when handling compose button visibility on scroll * Replace a `requireNonNull` with `!!` * Remove redundant return values * Remove or rename unused lambda parameters * Remove unnecessary type parameters * Remove unnecessary null checks * Replace cascading-if statement with `when` * Simplify calculation of `topId` * Use more appropriate list properties and methods - Access the last value with `.last()` - Access the last index with `.lastIndex` - Replace logical-chain with `asRightOrNull` and `?.` - `.isNotEmpty()`, not `!...isEmpty()` * Inline unnecessary variable * Use PrefKeys constants instead of bare strings * Use `requireContext()` instead of `context!!` * Replace deprecated `onActivityCreated()` with `onViewCreated()` * Remove unnecessary variable setting * Replace `size == 0` check with `isEmpty()` * Format with ktlint, no functionality changes * Convert NotifcationsAdapter to Kotlin Does not compile, this is the unchanged output of the "Convert to Kotlin" function * Minimum changes to get NotificationsAdapter to compile * Remove unnecessary visibility modifiers * Use `isNotEmpty()` * Remove unused lambda parameters * Convert cascading-if to `when` * Simplifiy assignment op * Use explicit argument names with `copy()` * Use `.firstOrNull()` instead of `if` * Mark as lateinit to avoid unnecessary null checks * Format with ktlint, whitespace changes only * Bare minimum necessary to demonstrate paging in notifications Create `NotificationsPagingSource`. This uses a new `notifications2()` API call, which will exist until all the code has been adapted. Instead of using placeholders, Create `NotificationsPagingAdapter` (will replace `NotificationsAdapater`) to consume this data. Expose the paging source view a new `NotificationsViewModel` `flow`, and submit new pages to the adapter as they are available in `NotificationsFragment`. Comment out any other code in `NotificationsFragment` that deals with loading data from the network. This will be updated as necessary, either here, or in the view model. Lots of functionality is missing, including: - Different views for different notification types - Starting at the remembered notification position - Interacting with notifications - Adjusting the UI state to match the loading state These will be added incrementally. * Migrate StatusNotificationViewHolder impl. to NotificationsPagingAdapter With this change `NotificationsPagingAdapter` shows notifications about a status correctly. - Introduce a `ViewHolder` abstract class that all Notification view holders derive from. Modify the fallback view holder to use this. - Implement `StatusNotificationViewHolder`. Much of the code is from the existing implementation in the `NotificationAdapater`. - The original code split the code that binds values to views between the adapter's `bindViewHolder` method and the view holder's methods. In this code, all of the binding code is in the view holder, in a `bind` method. This is called by the adapter's `bindViewHolder` method. This keeps all the binding logic in the view holder, where it belongs. - The new `StatusNotificationViewHolder` uses view binding to access its views instead of `findViewById`. - Logically, information about whether to show sensitive media, or open content warnings should be part of the `StatusDisplayOptions`. So add those as fields, and populate them appropriately. This affects code outside notification handling, which will be adjusted later. * Note some TODOs to complete before the PR is finished * Extract StatusNotificationViewHolder to a new file * Add TODO for NotificationViewData.Concrete * Convert the adapter to take NotificationViewData.Concrete * Add a view holder for regular status notifications * Migrate Follow and FollowRequest notifications * Migrate report notifications * Convert onViewThread to use the adapter data * Convert onViewMedia to use the adapter data * Convert onMore to use the adapter data * Convert onReply to use the adapter data * Convert NotificationViewData to Kotlin * Re-implement the reblog functionality - Move reblogging in to the view model - Update the UI via the adapter's `snapshot()` and `notifyItemChanged()` methods * Re-implement the favourite functionality Same approach as reblog * Re-implement the bookmark functionality Same approach as reblog * Add TODO re StatusActionListener interface * Add TODO re event handling * Re-implementing the voting functionality * Re-implement viewing hidden content - Hidden media - Content behind a content warning * Add a TODO re pinning * Re-implement "Show more" / "Show less" * Delete unused updateStatus() function * Comment out the scroll listener for the moment * Re-implement applying filters to notifications Introduce `NotificationsRepository`, to provide access to the notifications stream. When changing the filters the flow is as follows: - User clicks "Apply" in the fragment. - Fragment calls `viewModel.accept()` with a `UiAction.ApplyFilter` (new class). - View model maintains a private flow of incoming UI actions. The new action is emitted to that flow. - In view model, `notificationFilter` waits for `.ApplyFilter` actions, and ensures the filter is saved, then emits it. - In view model, `pagingDataFlow` waits for new items from `notificationsFilter` and fetches the notifications from the repository in response. The repository provides `Notification`, so the model maps them to `NotificationViewData.Concrete` for display by the adapter. - In view model the UI state also waits for new items from `notificationsFilter` and emits a new `UiState` every time the filter is changed. When opening the fragment for the first time: - All of the above machinery, but `notificationFilter` also fetches the filter from the active account and emits that first. This triggers the first fetch and the first update of `uiState`. Also: - Add TODOs for functionality that is not implemented yet - Delete a lot of dead code from NotificationsFragment * Include important preference values in `uiState` Listen to the flow of eventHub events, filtered to preference changes that are relevant to the notification view. When preferences change (or when the view model starts), fetch the current values, and include them in `uiState`. Remove preference handling from `NotificationsFragment`, and just use the values from `uiState`. Adjust how the `useAbsoluteTime` preference is handled. The previous code loaded new content (via a diffutil) in to the adapter, which would trigger a re-binding of the timestamp. As the adapter content is immutable, the new code simply triggers a re-binding of the views that are currently visible on screen. * Update UI in response to different load states Notifications can be loaded at the top and bottom of the timeline. Add a new layout to show the progress of these loads, and any errors that can occur. Catch network errors in `NotificationsPagingSource` and convert to `LoadState.Error`. Add a header/footer to the notifications list to show the load state. Collect the load state from the adapter, use this to drive the visibility of different views. * Save and restore the last read notification ID Use this when fetching notifications, to centre the list around the notification that was last read. * Call notifyItemRangeChanged with the correct parameters * Don't try and save list position if there are no items in the list * Show/hide the "Nothing to see" view appropriately * Update comments * Handle the case where the notification key no longer exists * Re-implement support for showMediaPreview and other settings * Re-implement "hide FAB when scrolling" preference * Delete dead code * Delete Notifications Adapater and Placeholder types * Remove NotificationViewData.Concrete subclass Now there's no Placeholder, everything is a NotificationViewData. * Improve how notification pages are loaded if the first notification is missing or filtered * Re-implement clear notifications, show errors * s/default/from/ * Add missing headers * Don't process bookmarking via EventHub - Initiating a bookmark is triggered by the fragment sending a StatusUiAction.Bookmark - View model receives this, makes API call, waits for response, emits either a success or failure state - Fragment collects success/failure states, updates the UI accordingly * Don't process favourites via EventHub * Don't process reblog via EventHub * Don't process poll votes with EventHub This removes EventHub from the fragment * Respond to follow requests via the view model * Docs and cleanup * Typo and editing pass * Minor edits for clarity * Remove newline in diagram * Reorder sequence diagram * s/authorize/accept/ * s/pagingDataFlow/pagingData/ * Add brief KDoc * Try and fetch a full first page of notifications * Call the API method `notifications` again * Log UI errors at the point of handling * Remove unused variable * Replace String.format() with interpolation * Convert NotificationViewData to data class * Rename copy() to make(), to avoid confusion with default copy() method * Lint * Update app/src/main/res/layout/simple_list_item_1.xml * Update app/src/main/java/com/keylesspalace/tusky/components/notifications/NotificationsPagingAdapter.kt * Update app/src/main/java/com/keylesspalace/tusky/components/notifications/NotificationsViewModel.kt * Update app/src/main/java/com/keylesspalace/tusky/fragment/NotificationsFragment.kt * Update app/src/main/java/com/keylesspalace/tusky/viewdata/NotificationViewData.kt * Initial NotificationsViewModel tests * Add missing import * More tests, some cleanup * Comments, re-order some code * Set StateRestorationPolicy.PREVENT_WHEN_EMPTY * Mark clearNotifications() as "suspend" * Catch exceptions from clearNotifications and emit * Update TODOs with explanations * Ensure initial fetch uses a null ID * Stop/start collecting pagingData based on the lifecycle * Don't hide the list while refreshing * Refresh notifications on mutes and blocks * Update tests now clearNotifications is a suspend fun * Add "Refresh" menu to NotificationsFragment * Use account.name over account.displayName * Update app/src/main/java/com/keylesspalace/tusky/fragment/NotificationsFragment.kt Co-authored-by: Konrad Pozniak <connyduck@users.noreply.github.com> * Mark layoutmanager as lateinit * Mark layoutmanager as lateinit * Refactor generating UI text * Add Copyright header * Correctly apply notification filters * Show follow request header in notifications * Wait for follow request actions to complete, so the reqeuest is sent * Remove duplicate copyright header * Revert copyright change in unmodified file * Null check response body * Move NotificationsFragment to component.notifications * Use viewlifecycleowner.lifecyclescope * Show notification filter as a dialog rather than a popup window The popup window: - Is inconsistent UI - Requires a custom layout - Didn't play nicely with viewbinding * Refresh adapter on block/mute * Scroll up slightly when new content is loaded * Restore progressbar * Lint * Update app/src/main/res/layout/simple_list_item_1.xml --------- Co-authored-by: Konrad Pozniak <connyduck@users.noreply.github.com> |
3 years ago |
|
|
1b6108ca94
|
Add "Refresh" accessibility menu (#3121)
* Add "Refresh" accessibility menu to TimelineFragment Per https://developer.android.com/reference/androidx/swiperefreshlayout/widget/SwipeRefreshLayout the layout does not provide accessibility events, and a menu item should be provided as an alternative method for refreshing the content. In `TimelineFragment`: - Implement the `MenuProvider` interface so it can populate the action bar menu in activities that host the fragment - Create a "Refresh" menu item, and refresh the state when it is selected `MainActivity` has to change how the menu is created, so that fragments can add items to it. In `MainActivity`: - Call `setSupportActionBar` so `mainToolbar` participates in menus - Implement the `MenuProvider` interface, and move menu creation there - Set the title via supportActionBar * Never show the refresh item as a menubar action Per guidelines in https://developer.android.com/develop/ui/views/touch-and-input/swipe/add-swipe-interface#AddRefreshAction * Add "Refresh" menu item for AccountMediaFragment Also, fix the colour of the refresh progress indicator * Implement "Refresh" for AnnouncementsActivity * Add "Refresh" menu for ConversationsFragment * Keep the tabs adapter over the life of the viewpager Make `tabs` `var` instead of `val` in `MainPagerAdapter` so it can be updated when tabs change. Then detach the `tabLayoutMediator`, update the tabs, and call `notifyItemRangeChanged` in `setupTabs()`. This fixes a bug (not sure if it's this code, or in ViewPager2) where assigning a new adapter to the view pager seemed to result in a leak of one or more fragments. This wasn't user-visible, but it's a leak, and it becomes user-visible when fragments want to display menus. This also fixes two other bugs: 1. Be on the left-most tab. Scroll down a bit. Then modify the tabs at "Account preferences > tabs", but keep the left-most tab as-is. Then go back to MainActivity. Your reading position in the left-most tab has been jumped to the top. 2. Be on any non-left-most tab. Then modify the tab list by reordering tabs (adding/removing tabs is also OK). Then go back to MainActivity. Your tab selection has been overridden, and the left-most tab has been selected. Because the fragments are not destroyed unnecessarily your reading position is retained. And it remembers the tab you had selected, and as long as that tab is still present you will be returned to it, even if it's changed position in the list. Fixes https://github.com/tuskyapp/Tusky/issues/3251 * Add "Refresh" menu for ScheduledStatusActivity * Lint * Add "Refresh" menu for SearchFragment / SearchActivity * Explicitly set the searchview width Using "collapseActionView" requires the user to press "Back" twice to exit the activity, which is not acceptable. * Move toolbar handling in to ViewThreadActivity Previous code had the toolbar in the fragment's layout. Refactor to make consistent with other activities, and move the toolbar in to the activity layout. Implement MenuProvider in ViewThreadFragment to adjust the menu in the activity. * Add "Refresh" menu to ViewThreadFragment * Implement "Refresh" for ViewEditsFragment * Lint * Add "Refresh" menu to ReportStatusesFragment * Add "Refresh" menu to NotificationsFragment * Rename menu resource files Be consistent with the layout resource files, which have an activity/fragment prefix, then the lower_snake_case name of the activity or fragment it's for. * Only enable refresh menu if swiptorefresh is enabled Some timelines don't have swipetorefresh enabled (e.g., those shown on AccountActivity). In those cases don't add the refresh menu, rely on the hosting activity to provide it. Update AccountActivity to provide the refresh menu item. |
3 years ago |