Commit Graph

29 Commits

Author SHA1 Message Date
kyori19 eeb6c3c96b
Merge remote-tracking branch 'tuskyapp/develop'
# Conflicts:
#	app/build.gradle
#	app/src/main/java/com/keylesspalace/tusky/MainActivity.kt
#	app/src/main/java/com/keylesspalace/tusky/adapter/StatusBaseViewHolder.java
#	app/src/main/java/com/keylesspalace/tusky/adapter/StatusDetailedViewHolder.java
#	app/src/main/java/com/keylesspalace/tusky/components/account/AccountActivity.kt
#	app/src/main/java/com/keylesspalace/tusky/components/compose/ComposeActivity.kt
#	app/src/main/java/com/keylesspalace/tusky/components/compose/ComposeViewModel.kt
#	app/src/main/java/com/keylesspalace/tusky/components/compose/MediaUploader.kt
#	app/src/main/java/com/keylesspalace/tusky/components/search/SearchViewModel.kt
#	app/src/main/java/com/keylesspalace/tusky/components/timeline/TimelineFragment.kt
#	app/src/main/java/com/keylesspalace/tusky/components/timeline/viewmodel/TimelineViewModel.kt
#	app/src/main/java/com/keylesspalace/tusky/components/viewthread/ViewThreadFragment.kt
#	app/src/main/java/com/keylesspalace/tusky/db/TimelineStatusEntity.kt
#	app/src/main/java/com/keylesspalace/tusky/di/NetworkModule.kt
#	app/src/main/java/com/keylesspalace/tusky/fragment/SFragment.java
#	app/src/main/java/com/keylesspalace/tusky/service/SendStatusService.kt
#	app/src/main/java/com/keylesspalace/tusky/util/ThemeUtils.java
#	app/src/main/res/layout/item_status_detailed.xml
#	app/src/main/res/values-cy/strings.xml
#	app/src/main/res/values-de/strings.xml
#	app/src/main/res/values-es/strings.xml
#	app/src/main/res/values-fa/strings.xml
#	app/src/main/res/values-hu/strings.xml
#	app/src/main/res/values-it/strings.xml
#	app/src/main/res/values-ja/strings.xml
#	app/src/main/res/values-nb-rNO/strings.xml
#	app/src/main/res/values-oc/strings.xml
#	app/src/main/res/values-tr/strings.xml
#	app/src/main/res/values-zh-rCN/strings.xml
#	app/src/main/res/values/strings.xml
#	fastlane/metadata/android/sv/changelogs/74.txt
#	fastlane/metadata/android/tr/changelogs/58.txt
#	gradle/libs.versions.toml
2023-01-29 04:44:17 +09:00
Nik Clayton 9cf4882f41
Keep scroll position when loading missing statuses (#3000)
* Change "Load more" to load oldest statuses first in home timeline

Previous behaviour loaded missing statuses by using "since_id" and "max_id".
This loads the most recent N statuses, looking backwards from "max_id".

Change to load the oldest statuses first, assuming the user is scrolling
up through the timeline and will want to load statuses in reverse
chronological order.

* Scroll to the bottom of new entries added by "Load more"

- Remember the position of the "Load more" placeholder
- Check the position of inserted entries
- If they match, scroll to the bottom

* Change "Load more" to load oldest statuses first in home timeline

Previous behaviour loaded missing statuses by using "since_id" and "max_id".
This loads the most recent N statuses, looking backwards from "max_id".

Change to load the oldest statuses first, assuming the user is scrolling
up through the timeline and will want to load statuses in reverse
chronological order.

* Scroll to the bottom of new entries added by "Load more"

- Remember the position of the "Load more" placeholder
- Check the position of inserted entries
- If they match, scroll to the bottom

* Ensure the user can't have two simultaneous "Load more" coroutines

Having two simultanous coroutines would break the calculation used to figure
out which item in the list to scroll to after a "Load more" in the timeline.

Do this by:

- Creating a TimelineUiState and associated flow that tracks the "Load more"
  state
- Updating this in the (Cached|Network)TimelineViewModel
- Listening for changes to it in TimelineFragment, and notifying the adapter
- The adapter will disable any placeholder views while "Load more" is active

* Revert changes that loaded the oldest statuses instead of the newest

* Be more robust about locating the status to scroll to

Weirdness with the PagingData library meant that positionStart could still be
wrong after "Load more" was clicked.

Instead, remember the position of the "Load more" item and the ID of the
status immediately after it.

When new items are added, search for the remembered status at the position of
the "Load more" item. This is quick, testing at most LOAD_AT_ONCE items in
the adapter.

If the remembered status is not visible on screen then scroll to it.

* Lint

* Add a preference to specify the reading order

Default behaviour (oldest first) is for "load more" to load statuses and
stay at the oldest of the new statuses.

Alternative behaviour (if the user is reading from top to bottom) is to
stay at the newest of the new statuses.

* Move ReadingOrder enum construction logic in to the enum

* Jump to top if swipe/refresh while preferring newest-first order

* Show a circular progress spinner during "Load more" operations

Remove a dedicated view, and use an icon on the button instead.

Adjust the placeholder attributes and styles accordingly.

* Remove the "loadMoreActive" property

Complicates the code and doesn't really achieve the desired effect. If the
user wants to tap multiple "Load more" buttons they can.

* Update comments in TimelineFragment

* Respect the user's reading order preference if it changes

* Add developer tools

This is for functionality that makes it easier for developers to interact
with the app, or get it in to a known-state.

These features are for use by users, so are only visible in debug builds.

* Adjust how content is loaded based on preferred reading order

- Add the readingOrder to TimelineViewModel so derived classes can use it.
- Update the homeTimeline API to support the `minId` parameter and update
  calls in NetworkTimelineViewModel

In CachedTimelineViewModel:
- Set the bounds of the load to be the status IDs on either side of the
  placeholder ID (update TimelineDao with a new query for this)
- Load statuses using either minId or sinceId depending on the reading order
- Is there was no overlap then insert the new placeholder at the start/end
  of the list depending on reading order

* Lint

* Rename unused dialog parameter to _

* Update API arguments in tests

* Simplify ReadingOrder preference handling

* Fix bug with Placeholder and the "expanded" property

If a status is a Placeholder the "expanded" propery is used to indicate
whether or not it is loading.

replaceStatusRange() set this property based on the old value, and the user's
alwaysOpenSpoiler preference setting.

This shouldn't have been used if the status is a Placeholder, as it can lead
to incorrect loading states.

Fix this.

While I'm here, introduce an explicit computed property for whether a
TimelineStatusEntity is a placeholder, and use that for code clarity.

* Set the "Load more" button background to transparent

* Fix typo.

* Inline spec, update comment

* Revert 1480c6aa3ac5c0c2d362fb271f47ea2259ab14e2

Turns out the behaviour is not desired.

* Remove unnecessary Log call

* Extract function

* Change default to newest first
2023-01-13 19:26:24 +01:00
Levi Bard a6b6a40ba6
Add post editing capability (#2828)
* Add post editing capability

* Don't try to reprocess already uploaded attachments.
Fixes editing posts with existing media

* Don't mark post edits as modified until editing occurs

* Disable UI for things that can't be edited when editing a post

* Finally convert SFragment to kotlin

* Use api endpoint for fetching status source for editing

* Apply review feedback
2022-12-08 10:18:12 +01:00
kyori19 57aab71b0e
Merge remote-tracking branch 'tuskyapp/develop'
# Conflicts:
#	app/build.gradle
#	app/src/main/java/com/keylesspalace/tusky/SplashActivity.kt
#	app/src/main/java/com/keylesspalace/tusky/adapter/StatusDetailedViewHolder.java
#	app/src/main/java/com/keylesspalace/tusky/components/compose/ComposeViewModel.kt
#	app/src/main/java/com/keylesspalace/tusky/components/compose/MediaUploader.kt
#	app/src/main/java/com/keylesspalace/tusky/components/conversation/ConversationViewHolder.java
#	app/src/main/java/com/keylesspalace/tusky/components/search/SearchViewModel.kt
#	app/src/main/java/com/keylesspalace/tusky/components/timeline/TimelineTypeMappers.kt
#	app/src/main/java/com/keylesspalace/tusky/components/timeline/viewmodel/CachedTimelineViewModel.kt
#	app/src/main/res/layout/activity_main.xml
#	app/src/main/res/values-cs/strings.xml
#	app/src/main/res/values-de/strings.xml
#	app/src/main/res/values-fa/strings.xml
#	app/src/main/res/values-fr/strings.xml
#	app/src/main/res/values-hu/strings.xml
#	app/src/main/res/values-it/strings.xml
#	app/src/main/res/values-no-rNB/strings.xml
#	app/src/main/res/values-zh-rCN/strings.xml
2022-07-16 02:51:51 +09:00
Konrad Pozniak 434d345d01
remove unused member vars from TimelineFragment (#2561) 2022-05-29 19:23:08 +02:00
UlrichKu 2424dde9cc
Fire observable to update timestamps directly on resume (#2554) (#2555) 2022-05-27 18:43:10 +02:00
kyori19 95a1f5632b
Merge remote-tracking branch 'tuskyapp/develop' 2022-05-01 19:54:22 +09:00
Konrad Pozniak 7fd54e3b4f fix timeline refresh spinner finishing before updates are visible 2022-04-30 08:09:59 +02:00
kyori19 1228f645a6 Merge remote-tracking branch 'tuskyapp/develop' 2022-04-13 00:59:06 +09:00
Konrad Pozniak 15304440ef
fix "nothing here" flickering when starting Tusky (#2377) 2022-03-12 09:38:59 +01:00
Konrad Pozniak 55513e8e2b
Android 12 support, update AndroidX libraries (#2367)
* Android 12 support, update AndroidX libraries

* fix ktlint

* add Android 12 splash screen support

* fix comments in MainActivity

* remove deprecated Intent.ACTION_CLOSE_SYSTEM_DIALOGS

* delete TimelineViewModelTest

* fix notifications on Android 12

* improve splash screen

* handle pending intent flags in a dedicated function
2022-03-09 20:50:23 +01:00
kyori19 1abe28943c Merge remote-tracking branch 'tuskyapp/develop'
# Conflicts:
#	app/src/main/res/values-fr/strings.xml
#	app/src/main/res/values-pt-rBR/strings.xml
#	app/src/main/res/values-zh-rCN/strings.xml
#	fastlane/metadata/android/pt-BR/changelogs/58.txt
#	fastlane/metadata/android/pt-BR/changelogs/61.txt
#	fastlane/metadata/android/pt-BR/changelogs/72.txt
2022-03-08 08:03:21 +09:00
Konrad Pozniak 841373e947
fix various timeline related crashes (#2369)
* fix various timeline related crashes

* fix ktlint
2022-03-06 17:40:24 +01:00
kyori19 ba005c769b Merge remote-tracking branch 'tuskyapp/develop' 2022-03-04 17:51:25 +09:00
kyori19 8e49dd7329 Merge commit '643e012b11f20538fd17aa3ab888d8e739ebd0d0' 2022-03-04 16:29:48 +09:00
kyori19 4a8fa74f79 Merge commit '224161caf111a15887cbc8a419763e87fe69931d' 2022-03-04 00:37:23 +09:00
Konrad Pozniak c592dfef78
Don't use notifyDataSetChanged in TimelineFragment (#2334) 2022-02-25 18:57:40 +01:00
Konrad Pozniak 8dbf255617
get rid of deprecated onActivityCreated in TimelineFragment (#2326) 2022-02-25 18:56:58 +01:00
kyori19 84fff2cc6f Fix NotImplementedError on some activity 2022-02-08 16:55:24 +09:00
Konrad Pozniak d2d52da717
Fix crash in TimelineFragment (#2317) 2022-02-07 20:04:40 +01:00
kyori19 0e012208eb Fix streaming 2022-01-31 10:08:35 +09:00
kyori19 e78cdad22f Refactor streaming feature 2022-01-25 03:32:57 +09:00
Konrad Pozniak 643e012b11
Timeline paging (#2238)
* first setup

* network timeline paging / improvements

* rename classes / move to correct package

* remove unused class TimelineAdapter

* some code cleanup

* remove TimelineRepository, put mapper functions in TimelineTypeMappers.kt

* add db migration

* cleanup unused code

* bugfix

* make default timeline settings work again

* fix pinning statuses from timeline

* fix network timeline

* respect account settings in NetworkTimelineRemoteMediator

* respect account settings in NetworkTimelineRemoteMediator

* update license headers

* show error view when an error occurs

* cleanup some todos

* fix db migration

* fix changing mediaPreviewEnabled setting

* fix "load more" button appearing on top of timeline

* fix filtering and other bugs

* cleanup cache after 14 days

* fix TimelineDAOTest

* fix code formatting

* add NetworkTimeline unit tests

* add CachedTimeline unit tests

* fix code formatting

* move TimelineDaoTest to unit tests

* implement removeAllByInstance for CachedTimelineViewModel

* fix code formatting

* fix bug in TimelineDao.deleteAllFromInstance

* improve loading more statuses in NetworkTimelineViewModel

* improve loading more statuses in NetworkTimelineViewModel

* fix bug where empty state was shown too soon

* reload top of cached timeline on app start

* improve CachedTimelineRemoteMediator and Tests

* improve cached timeline tests

* fix some more todos

* implement TimelineFragment.removeItem

* fix ListStatusAccessibilityDelegate

* fix crash in NetworkTimelineViewModel.loadMore

* fix default state of collapsible statuses

* fix default state of collapsible statuses -tests

* fix showing/hiding media in the timeline

* get rid of some not-null assertion operators in TimelineTypeMappers

* fix tests

* error handling in CachedTimelineViewModel.loadMore

* keep local status state when refreshing cached statuses

* keep local status state when refreshing network timeline statuses

* show placeholder loading state in cached timeline

* better comments, some code cleanup

* add TimelineViewModelTest, improve code, fix bug

* fix ktlint

* fix voting in boosted polls

* code improvement
2022-01-11 19:00:29 +01:00
Konrad Pozniak 0ae3a2ed2a
fix confirmFavourites default (#2282) 2021-12-29 13:44:00 +01:00
Colin Kinloch c37ccbb6e8
Add confirmation for favourite and bookmark actions (#2245)
* Add confirmation for favourite and bookmark actions

* Favourite confirmation american spelling and default values

* Remove bookmarking confirmation

* Update app/src/main/java/com/keylesspalace/tusky/fragment/NotificationsFragment.java

Co-authored-by: Konrad Pozniak <connyduck@users.noreply.github.com>

Co-authored-by: Konrad Pozniak <connyduck@users.noreply.github.com>
2021-10-04 07:48:44 +02:00
kyori19 76cd8f6c06 Fix tab resetting behaviour 2021-07-26 00:10:48 +09:00
kyori19 2005b32dfa Merge remote-tracking branch 'tuskyapp/develop' 2021-07-03 23:59:57 +09:00
Konrad Pozniak 16ffcca748
add ktlint plugin to project and apply default code style (#2209)
* add ktlint plugin to project and apply default code style

* some manual adjustments, fix wildcard imports

* update CONTRIBUTING.md

* fix formatting
2021-06-28 21:13:24 +02:00
Ivan Kupalov 44a5b42cac
Timeline refactor (#2175)
* Move Timeline files into their own package

* Introduce TimelineViewModel, add coroutines

* Simplify StatusViewData

* Handle timeilne fetch errors

* Rework filters, fix ViewThreadFragment

* Fix NotificationsFragment

* Simplify Notifications and Thread, handle pin

* Redo loading in TimelineViewModel

* Improve error handling in TimelineViewModel

* Rewrite actions in TimelineViewModel

* Apply feedback after timeline factoring review

* Handle initial failure in timeline correctly
2021-06-11 20:15:40 +02:00