Commit Graph

48 Commits

Author SHA1 Message Date
mcclure 3ca8a0b549
Use specific term "image" in error UI, not "attachment" (#2592)
The new message for the crop feature, "The attachment could not be edited.", turned out to be awkward in some languages (French) where according to the translator it would be better to more specifically say "The image could not be edited." (as currently we can only edit images). Patch replaces error_media_edit_failed with a error_image_edit_failed and deletes the existing error_media_edit_failed-s.
2022-06-21 22:14:11 +02:00
mcclure 00c139190e
Ability to crop images attached to posts (#2531)
* First attachment crop attempt: Can crop in place, but does not delete/replace on server so has no effect

* Attachment crop feature works

* ktlint fixes on attachment crop patch

* Upgrade Android-Image-Cropper to 4.2.1

* An error message should be displayed if attachment cropping fails and it is not because the user intentionally cancelled.

* Remove 2 of the 3 "state passing" variables by using MediaUtils

* Cropper should use content uri (MIME type bearing) and setOutputCompressFormat so that PNGs reach the server safely.

* Change to crop requested by Conny: Store inflight cropImageItemOld in view model

* Change to crop requested by Conny: Sort cropImage with the other contracts

* ktlint fixes on attachment crop patch (again)
2022-05-22 21:01:14 +02:00
Konrad Pozniak cec8f6dd65
modernize autocomplete (#2510)
* modernize autocomplete

* use @WorkerThread annotation
2022-05-17 19:55:37 +02:00
Konrad Pozniak beaed6b875
Fix crash when saving redrafted media to drafts (#2502)
* fix crash when saving draft from redraft

* fix crash when saving draft from redraft

* replace ... with …
2022-05-09 19:39:43 +02:00
Konrad Pozniak 444e7365c9
fix race condition where multiple uploaded media can get same internal id (#2479)
* fix race condition where multiple uploaded media can get same internal id

* atomically update media stateflow

* atomically update media stateflow
2022-05-03 19:12:35 +02:00
Guntbert Reiter 9a8dfaa744
Remove code to check the server version (#2469)
solves #2439
2022-04-29 18:35:25 +02:00
Konrad Pozniak d2bfceae7b
refactor compose & announcements to coroutines (#2446)
* refactor compose & announcements to coroutines

* fix code formatting

* add javadoc to InstanceInfoRepository

* fix comments in ImageDownsizer

* remove unused Either extensions

* add explicit return type for InstanceInfoRepository.getEmojis

* make ComposeViewModel.pickMedia return Result

* cleanup code in ImageDownsizer
2022-04-21 18:46:21 +02:00
Konrad Pozniak c47804997c
Improve handling of shared media (#2388)
* support file:// uris

* support subjects on image shares

* improve code

* improve code

* improve code
2022-03-28 18:39:05 +02:00
Levi Bard bbd818084d
When calculating post length, count all urls as being of the reserved character count, even if they're shorter. (#2404)
Addresses #2399
2022-03-24 19:52:18 +01:00
Konrad Pozniak d9931e3d2c
Rename Toots to Posts (#2396)
* rename toots -> posts in strings

* extract tusky_compose_post_quicksetting_label string

* rename toot -> status in code
2022-03-20 20:21:42 +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
Levi Bard 7114575497
Instance configuration: the easy parts (#2341)
* Add data model for instance configuration

* Support instance.configuration.statuses.max_characters

* Support instance.configuration.statuses.characters_reserved_per_url

* Support instance.configuration.polls.max_options and max_characters_per_option

* Pacify ktlint

* Support instance-configured poll durations

* Fixup versions for migration after rebase
2022-03-01 19:43:36 +01: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
Konrad Pozniak ca5c455881
update AndroidX, use ActivityResultContracts (#2170)
* update AndroidX, use ActivityResultContracts

* make allowMultiple setable in PickMediaFiles

* add license headers to PickMediaFiles
2021-05-22 17:50:08 +02:00
Konrad Pozniak 6c37cc770c
remove SavedToots (#2141)
* remove SavedToots

* fix tests
2021-05-16 19:17:56 +02:00
Konrad Pozniak f293670c14
migrating to ViewBinding part 6: the final cleanup (#2117) 2021-03-21 12:42:28 +01:00
Konrad Pozniak 0b86f58139
convert some regular strings to plural strings (#2100)
* convert some regular strings to plural strings

* convert hint_describe_for_visually_impaired from string to plurals

* fix ukrainian strings
2021-03-07 19:43:25 +01:00
Konrad Pozniak ff69a2ad0d
migrating to ViewBinding part 2: Activities (#2093) 2021-03-07 19:05:51 +01:00
Konrad Pozniak 13392258f6
upgrade Material Design lib and use their new time picker (#2077) 2021-02-23 20:29:02 +01:00
Alibek Omarov 9580870445
Animated emoji support (#2064)
* Animated emoji support

* Try to query preference only once

* Revert to using SpannableStringBuilder
2021-02-06 08:14:51 +01:00
Konrad Pozniak 483beaa957
move onOptionsItemSelected to BaseActivity (#2059)
* move onOptionsItemSelected to BaseActivity

* revert change in ComposeActivity
2021-01-31 20:27:02 +01:00
lenchan139 0275504a05
Move compose content's EditText cursor to first when shared content parsed in ComposeActivity (#2030)
* multiple media upload support

* multiple media upload support

* multiple media upload support

* remove  typing

* Update app/src/main/res/values/strings.xml

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

* remove magic number on string.xml and add to activity.

* move edittext cursor to first when shareBody parsed in ComposeActivity

Co-authored-by: Konrad Pozniak <connyduck@users.noreply.github.com>
2021-01-26 16:38:03 +01:00
Konrad Pozniak 940d6d395a
Drafts v2 (#2032)
* cleanup warnings, reorganize some code

* move ComposeAutoCompleteAdapter to compose package

* composeOptions doesn't need to be a class member

* add DraftsActivity and DraftsViewModel

* drafts

* remove unnecessary Unit in ComposeViewModel

* add schema/25.json

* fix db migration

* drafts

* cleanup code

* fix compose activity rotation bug

* fix media descriptions getting lost when restoring a draft

* improve deleting drafts

* fix ComposeActivityTest

* improve draft layout for almost empty drafts

* reformat code

* show toast when opening reply to deleted toot

* improve item_draft layout
2021-01-21 18:57:09 +01:00
lenchan139 f7a630c1d8
multiple media upload support (#2029)
* multiple media upload support

* multiple media upload support

* multiple media upload support

* remove  typing

* Update app/src/main/res/values/strings.xml

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

* remove magic number on string.xml and add to activity.

Co-authored-by: Konrad Pozniak <connyduck@users.noreply.github.com>
2020-12-30 17:36:00 +01:00
Konrad Pozniak 9cdf486ceb
remove ThemeUtils.getTintedDrawable (#2015) 2020-12-09 19:08:16 +01:00
kyori19 fef4b8b07f
[needs help] Support announcements (#1977)
* Implement announcements activity

* Update reactions without api access

* Add badge style

* Use emptyList() as default parameter

* Simplify newIntent

* Use List instead of Array

* Remove unneeded ConstraintLayout

* Add lineSpacingMultiplier

* Fix wording

* Apply material design's default chip style

* Dismiss announcements automatically
2020-11-18 21:12:27 +01:00
Levi Bard d7e47caef3
Add tests for compose activity initial state changes (#1972) 2020-10-28 18:43:11 +01:00
Garrit Franke af44b25c29
Delete scheduled post after editing (#1947)
* Delete scheduled post after editing

This ensures that editing a scheduled toot will not duplicate it.

Fixes #1924

* Fix scheduled toot editing

* Convert isEditingScheduledToot to property

* Replace MediatorLiveData with combineLiveData

* Remove dead code

* Fix observer emission

* Fix "Finish media upload" appearing for split second
2020-10-25 18:41:11 +01:00
Konrad Pozniak 6d27d822ca
update Kotlin to 1.4.10 and fix some warnigs (#1963) 2020-10-25 18:36:00 +01:00
Vignesh Kumar 3b67f339b1
Change characters left color to red when negative (#1952)
* Change characters left color to red when negative

* Use val for the integers, optimize variable assignment

* Added tusky_red color

* remove extra line typo

* make characters left bold

* change red hue

* fix typo
2020-10-13 18:30:06 +02:00
Levi Bard e237639adc
Save draft when redrafting a post (#1744) 2020-10-02 18:32:46 +02:00
Konrad Pozniak 836b7f3f76
don't create a CW when sharing text to Tusky (#1836) 2020-06-21 18:25:17 +02:00
Sylvia van Os 386d197851
Fix content warning state being lost after screen rotation (#1756)
* Restore compose options after rotation

* Fix in ViewModel instead

* Move showContentWarning change into ViewModel
2020-04-18 15:06:24 +02:00
Konrad Pozniak f3d05f82f9
fix toot sending twice when using a hardware keyboard (#1758) 2020-04-18 13:45:19 +02:00
Konrad Pozniak 2cf1e366b8
convert MainActivity to Kotlin and upgrade MaterialDrawer to version 8 (#1748)
* convert MainActivity to Kotlin

* migrate to MaterialDrawer 8

* fix drawer styles

* revert removing BezelImageView and material_drawer_header override

* fix tests

* add lost comment back to material_drawer_header.xml

* add tools:parentTag to material_drawer_header.xml

* use when instead of if in MainActivity

* fix statusbar color over the drawer

* cleanup drawer item creation

* tint secondary drawer items as well

* remove unnecessary ids

* fix header text color in the light theme

* improve header text contrast
2020-04-15 18:57:53 +02:00
Levi Bard dd8abad8ca
When a plaintext share contains EXTRA_TEXT and a distinct EXTRA_SUBJECT, use EXTRA_SUBJECT as the content warning for the shared status (#1712) 2020-02-26 20:41:02 +01:00
Konrad Pozniak d9c802982e
Upgrade deps (#1708)
* upgrade Dagger

* upgrade AndroidX Lifecycle

* upgrade AndroidX Fragment

* upgrade Room, Retrofit, AndroidX core, Material components

* fix report fragments not sharing viewmodels
2020-02-25 19:49:41 +01:00
Levi Bard 80e0c55b67
Warn when scheduling a post within 5 minutes (#1698)
* Warn when scheduling a post within 5 minutes

* Fix NPE when scheduled post time isn't set

* Use AlertDialog with option to cancel instead of Toast when a post isn't scheduled far enough in advance

* Move schedule validation warning to scheduling bottom sheet

* Fix scheduling error display when sending after an initially-valid scheduling time has become invalid
2020-02-25 18:33:24 +01:00
Konrad Pozniak aba36ca6f8
Compose activity fixes (#1707)
* cleanup media keyboard code

* fix crash in ComposeActivity when rotating phone while taking photo

* fix poll button in ComposeActivity being invisible when disabled
2020-02-24 22:02:59 +01:00
Konrad Pozniak 6d48811767
fix crash when inserting custom emojis at the start of the compose field (#1706) 2020-02-21 22:08:41 +01:00
Levi Bard 9a173f0234
Delete draft when sending its status completes. (#1704)
Fixes #1700
2020-02-19 21:10:22 +01:00
Konrad Pozniak 8767d2ed3d
Theme refactoring (#1656)
* Theme refactoring

* disable the automatic tinting of surfaces with elevation in dark mode

* make the media warning visible again with the dark theme

* fix nav bar on api 27+

* use correct color for all media warnings
2020-01-30 21:37:28 +01:00
Konrad Pozniak 29ef92edd3
fix overlapping icons in ComposeActivity (#1661) 2020-01-30 21:17:37 +01:00
Levi Bard 9dccd06a06 Add support for uploading audio attachments (#1630)
* Add support for audio attachments.
Partially addresses #1337

* Register Tusky as a target for audio sharing

* Use icon with textColorTertiary for audio preview
2020-01-16 19:05:52 +01:00
Ivan Kupalov 32fd7b18ce Add space before emojo code in editor when needed, fix #1616 (#1632) 2020-01-13 15:21:40 +01:00
Levi Bard c9a28b47c1 Compose activity: When selection is nonempty and a "special character" button is pressed, decorate all selected word starts (#1523)
* ComposeActivity: When selection is nonempty and a "special character" button is pressed, decorate all selected word starts
Closes #1417

* ComposeActivity: Tests for word break prepend logic
2020-01-13 15:21:17 +01:00
Levi Bard 6a2c9bdbe4 Don't drop content warning when replying (#1631) 2020-01-13 15:18:55 +01:00
Ivan Kupalov 8770fbe986 ComposeActivity refactor (#1541)
* Convert ComposeActivity to Kotlin

* More ComposeActivity cleanups

* Move ComposeActivity to it's own package

* Remove ComposeActivity.IntentBuilder

* Re-do part of the media downsizing/uploading

* Add sending of status to ViewModel, draft media descriptions

* Allow uploading video, update description after uploading

* Enable camera, enable upload cancelling

* Cleanup of ComposeActivity

* Extract CaptionDialog, extract ComposeActivity methods

* Fix handling of redrafted media

* Add initial state and media uploading out of Activity

* Change ComposeOptions.mentionedUsernames to be Set rather than List

We probably don't want repeated usernames when we are writing a post
and Set provides such guarantee for free plus it tells it to the
callers. The only disadvantage is lack of order but it shouldn't be a
problem.

* Add combineOptionalLiveData. Add docs.

It it useful for nullable LiveData's. I think we cannot differentiate
between value not being set and value being null so I just added the
variant without null check.

* Add poll support to Compose.

* cleanup code

* move more classes into compose package

* cleanup code

* fix button behavior

* add error handling for media upload

* add caching for instance data again

* merge develop

* fix scheduled toots

* delete unused string

* cleanup ComposeActivity

* fix restoring media from drafts

* make media upload code a little bit clearer

* cleanup autocomplete search code

* avoid duplicate object creation in SavedTootActivity

* perf: avoid unnecessary work when initializing ComposeActivity

* add license header to new files

* use small toot button on bigger displays

* fix ComposeActivityTest

* fix bad merge

* use Singles.zip instead of Single.zip
2019-12-19 19:09:40 +01:00