mirror of
https://github.com/ArcaneChat/android.git
synced 2026-07-03 14:05:24 +02:00
Compare commits
562 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 3441162de4 | |||
| b695015e8f | |||
| e50bf6ef95 | |||
| 3ca55ad986 | |||
| 40ff8268a8 | |||
| 2e7fac05ba | |||
| a42996892d | |||
| 3e926becba | |||
| a1eeb25dff | |||
| a1f4b64c4a | |||
| 5673b25e52 | |||
| f755add1d2 | |||
| 60dd8098c4 | |||
| 5823d04a20 | |||
| 3cdfa949e9 | |||
| b69eaddddf | |||
| 137b32303f | |||
| da87705fb8 | |||
| d808adeb39 | |||
| 2ca07c6ee9 | |||
| 9a05cd4646 | |||
| 85e16df79a | |||
| 2fd0bdf68b | |||
| 23a2d11944 | |||
| 02e515e531 | |||
| 6651d26a47 | |||
| 84df07dcd1 | |||
| d865b08aa1 | |||
| 220c855222 | |||
| de2fa484ef | |||
| f5c3b79a1d | |||
| 254f489d27 | |||
| 716d42c21a | |||
| 3f3bfa562f | |||
| a11ca07f4e | |||
| 575c275d39 | |||
| acf0d801ce | |||
| 14d810c319 | |||
| 5d7bca4538 | |||
| db48d7be5e | |||
| 234dd6d13e | |||
| 948f89f957 | |||
| b9c64626d1 | |||
| 469169b2f1 | |||
| 113a270407 | |||
| 2469324f65 | |||
| f1b5facc6a | |||
| b0260c352d | |||
| a5168ed1a5 | |||
| 4c9e7cc516 | |||
| 733b123c09 | |||
| dd2b484cdb | |||
| 1b4811e334 | |||
| d23ce67862 | |||
| b26f127fb0 | |||
| 359cebec8e | |||
| ce3bb860b8 | |||
| a1d8cffc85 | |||
| 0b4b11e7f3 | |||
| 50f3ab528d | |||
| a85dcead6b | |||
| 5b1b2a916c | |||
| 53b6adb0a5 | |||
| 0cd5a372d5 | |||
| 69fa2cb4ee | |||
| 52208d8653 | |||
| 3630606f52 | |||
| ac9aa2e6dd | |||
| f72ec65b79 | |||
| b3920d9bf3 | |||
| a828650a44 | |||
| a2c3163df8 | |||
| 15245fa85c | |||
| 28f3288d2a | |||
| 7b69a50623 | |||
| 790e45795c | |||
| 185d7ca4d3 | |||
| 383042d778 | |||
| d39a6f16aa | |||
| 7c9e879454 | |||
| bb283230f4 | |||
| 363d816a17 | |||
| 38e70d8640 | |||
| 652f2d0665 | |||
| 75b430b323 | |||
| 0491f93192 | |||
| 9a33ddbbc4 | |||
| e3e4b509e8 | |||
| 0e6bac1b2f | |||
| ebeb2c9443 | |||
| f00c0a16f1 | |||
| 1733529486 | |||
| a0cd2d0a7c | |||
| 8decc0176f | |||
| 2015a620d6 | |||
| 3e042ff2a2 | |||
| 0768ccb2fd | |||
| ff19d4dae3 | |||
| adc8652cad | |||
| 903e2e9084 | |||
| 2fcc37dddb | |||
| 42c588b51d | |||
| 0d4afae561 | |||
| 76e3422acd | |||
| 4ac2c61556 | |||
| ec0a7dc65c | |||
| fb5543f31c | |||
| a7d8c6af0b | |||
| 0a65209406 | |||
| a5d6150119 | |||
| d49e7ad60e | |||
| 989c3985ca | |||
| fb0f4bfc2b | |||
| e43e30b61a | |||
| 270a695da1 | |||
| d80fba84cf | |||
| e34cd917ea | |||
| 942770372c | |||
| b36477c160 | |||
| c39b16a8d9 | |||
| 0583a0582e | |||
| 4a5e563bda | |||
| f314809a06 | |||
| d561dcb6e6 | |||
| 6f88e49cac | |||
| 751fd56b4e | |||
| b37e7fc9bb | |||
| 5e61857384 | |||
| aee29ad821 | |||
| aad3db6f6a | |||
| 236d54557d | |||
| 27cb4328b2 | |||
| d91c81e0d4 | |||
| 6100589818 | |||
| 09b848f832 | |||
| 14825e97cc | |||
| 669d573345 | |||
| 4231b0282f | |||
| 43448e286b | |||
| ba6d2a3099 | |||
| 8f91e14049 | |||
| 0bf0d0c316 | |||
| b60fd2405a | |||
| a0d4bcc2ac | |||
| aaec546629 | |||
| 88d45ca86c | |||
| 8796e77cc0 | |||
| 07f05000b9 | |||
| 6beb57a2e7 | |||
| 75dc23c907 | |||
| a0d0f23548 | |||
| 136ab5ec01 | |||
| 8578ac67c6 | |||
| 53907bb44e | |||
| e71e67ec6a | |||
| a91e2dd591 | |||
| 1980c70bad | |||
| 97380cd16a | |||
| 01844469a0 | |||
| aace88ebfa | |||
| cb323ee444 | |||
| 4c35109b9b | |||
| efec8c45d9 | |||
| f450b14fa9 | |||
| 91b1155bd4 | |||
| 0917c9cd1d | |||
| 64510a419c | |||
| c01eab9b00 | |||
| 76a1fc4803 | |||
| 01e46c72cd | |||
| 957153e79e | |||
| c3d1b6814c | |||
| d0672865ce | |||
| 74ffbf48be | |||
| 06cb0ff325 | |||
| 5af70bc27c | |||
| 3240a25aef | |||
| 88688e6a81 | |||
| 081e2b23b1 | |||
| cc8e178e85 | |||
| 1411e7be15 | |||
| d5c2a8b9fa | |||
| 60b9085237 | |||
| 828f96a73d | |||
| 2b8cb0c495 | |||
| c0457803c7 | |||
| 3a8b40bfa0 | |||
| 8e8ade004c | |||
| bb7452918d | |||
| 3731884843 | |||
| 28f9eca5e4 | |||
| deda874741 | |||
| ed4ba18767 | |||
| edfbab06db | |||
| bdee370b7e | |||
| 27a4b7637d | |||
| de524cc9f5 | |||
| 274d9b0b8f | |||
| 7af947189b | |||
| ffce932eb9 | |||
| 3ecb5a4330 | |||
| 90cd8838f3 | |||
| ed5c7e549e | |||
| a036d892c5 | |||
| de1d3ef2bf | |||
| 57f58c5619 | |||
| fcf2b8c20a | |||
| ca1a16671a | |||
| 1c52ead6bc | |||
| a9e0f6c8c4 | |||
| 7d7d2acf76 | |||
| ed6e16581d | |||
| 083ecdde1a | |||
| 4e862134ee | |||
| 806574ff8d | |||
| d0571160c4 | |||
| 5a54cd4b8a | |||
| d1f163050c | |||
| 81041c8e89 | |||
| f3508787b8 | |||
| 6fec2424db | |||
| e991a209ea | |||
| 8a85c02aba | |||
| b9edf88093 | |||
| f01fa02082 | |||
| 5e495c4757 | |||
| dd21632e35 | |||
| 5c4898fff7 | |||
| c13a5e9b68 | |||
| 3a21f4a6c4 | |||
| c02aa85cab | |||
| 0e731a954c | |||
| 271ff3cbb8 | |||
| 5ebebc9c43 | |||
| 091a31d975 | |||
| a505f24aa0 | |||
| c58f2017f6 | |||
| dc6b32d389 | |||
| ca23b6e2c5 | |||
| c8a0d268f9 | |||
| 9110ed7c6c | |||
| ecf3330e4c | |||
| 6b3ce880c0 | |||
| 0bbc7677f6 | |||
| ee185d0f87 | |||
| 877ca293a0 | |||
| 809185769a | |||
| fac34140e9 | |||
| ec0fd48a1e | |||
| 0d6d08b911 | |||
| fd8fb3bd55 | |||
| 1faaab1f9c | |||
| 52b6346f08 | |||
| 036cc8a9fa | |||
| 5db22aa4ad | |||
| 2e1e804e8c | |||
| 78a865166c | |||
| 35c9a96c18 | |||
| 3b39ff6649 | |||
| 90722b5ac4 | |||
| 12e0ecf347 | |||
| da664bc881 | |||
| ce37da0084 | |||
| fb874d5359 | |||
| bdc86b0285 | |||
| a6d8386b08 | |||
| b69ca46485 | |||
| cb30257b83 | |||
| 9123210f69 | |||
| 630a259a5a | |||
| f0183064ed | |||
| 11bca87a47 | |||
| 3863b74fbd | |||
| 8216ce7d20 | |||
| a7a06ce26b | |||
| e9e4c01e54 | |||
| 47e2fa4a22 | |||
| 90fad460a6 | |||
| 929962c228 | |||
| a55edf0ba0 | |||
| e255926e10 | |||
| 21ed3e06e6 | |||
| 2ceffb283f | |||
| 2e52bacfba | |||
| 6c624e93b3 | |||
| ee5b2371e0 | |||
| 18297213f2 | |||
| 1373e46d04 | |||
| d7c6bac301 | |||
| b9e3a5454e | |||
| 3decd485ea | |||
| 285fcf3df3 | |||
| 0312960e93 | |||
| cfee7400c9 | |||
| e113fb0902 | |||
| deedd1acac | |||
| e1d912158d | |||
| 373e15b08a | |||
| e2bdb0bf13 | |||
| 19de16887c | |||
| 8609892116 | |||
| 76717b908d | |||
| c57ae9861f | |||
| 63a2899fdc | |||
| 2d86c5b10b | |||
| bd5ba8ebaf | |||
| 0e90ea1308 | |||
| ec05602bb1 | |||
| 2c55c93367 | |||
| b37a91cdd9 | |||
| 223c39d26a | |||
| 0a46073552 | |||
| 0325c9531f | |||
| c4ec5c6e1a | |||
| b00e35f341 | |||
| a935425e5d | |||
| 46fc46ee4f | |||
| d7fcf9433d | |||
| ec921e22e8 | |||
| 55bc139c72 | |||
| a5187ed1a2 | |||
| a79cbe9804 | |||
| dd9d10a991 | |||
| 3c78f6a82f | |||
| 4a30940d54 | |||
| 0c0e1a35e2 | |||
| 0fe4827214 | |||
| 80c8b7ef20 | |||
| 93a99cdd2c | |||
| 76dfa1fca5 | |||
| ba1c32fe05 | |||
| 1c77b0bf4e | |||
| 31331b958f | |||
| 80fc718ec8 | |||
| 823a1e2197 | |||
| 8fad2d0226 | |||
| ad69dc4ad4 | |||
| f8f89497a9 | |||
| 4272ac7619 | |||
| 3e5da102a5 | |||
| 51742716ec | |||
| fb7a106617 | |||
| c016c728d3 | |||
| b6c1d4b768 | |||
| 21cb85ce39 | |||
| fa9f13bba8 | |||
| 7feda6323a | |||
| 4cd02a673f | |||
| 22659c35fb | |||
| a6f89674b8 | |||
| 1bfdbfc00d | |||
| 73686ba57f | |||
| c44c78c87d | |||
| 371042029f | |||
| fa0f66bde2 | |||
| 843c5b548e | |||
| 06a3a6b285 | |||
| d2ac75d526 | |||
| 723b56b2d9 | |||
| 1910ccff83 | |||
| 11e676de2c | |||
| eb2c357868 | |||
| 4020b9c086 | |||
| be0670c592 | |||
| d1786bc9dc | |||
| 215b834da9 | |||
| 5e77be8dd0 | |||
| 913663743c | |||
| 95786d1268 | |||
| cfc69e483e | |||
| 73b59ed4bf | |||
| e8a996d1f3 | |||
| c04ba91b50 | |||
| d763be42a1 | |||
| 10d01b0d68 | |||
| 7699c5e63f | |||
| 78a033a221 | |||
| 7f23570160 | |||
| a9e1dd7e38 | |||
| 058f13f9d8 | |||
| 515fb92873 | |||
| abac76125c | |||
| 149df4e3d7 | |||
| 0a4796e959 | |||
| e79b6d9b1d | |||
| af471f4cf8 | |||
| 1c97c2e408 | |||
| 2c34aa83c3 | |||
| bf93a9e54b | |||
| c7c3990283 | |||
| e4454044f6 | |||
| f6ad0f2ee5 | |||
| 9abf23073d | |||
| 66253123ad | |||
| 920a683e9b | |||
| a0ce2b5dea | |||
| be1e1fa3c1 | |||
| 0a925f8f51 | |||
| 2db619e263 | |||
| e75e9410d6 | |||
| bbc09af77b | |||
| e3d3f13bef | |||
| affe4ca82e | |||
| 3b9a2e2d6d | |||
| dff6fedb67 | |||
| 9615a47f03 | |||
| 87ae709add | |||
| 80ecd1f697 | |||
| 481b5816b1 | |||
| 97da31ae2d | |||
| 48684bded4 | |||
| b191ad8b84 | |||
| 363fa04dca | |||
| e8c11aef6e | |||
| d0df88b113 | |||
| 477f3e638c | |||
| 478e093783 | |||
| a7c13e83c9 | |||
| e9e1db7773 | |||
| f1a2268712 | |||
| d28394d59e | |||
| aa5d6d289a | |||
| 36f56d557d | |||
| e8dcd05f79 | |||
| b29a50304c | |||
| 61355499f4 | |||
| 05fd267cb8 | |||
| 440e3d8a61 | |||
| ab82ed53e5 | |||
| 151c4426ec | |||
| 3c87751491 | |||
| 9f93cb8bd8 | |||
| 5bf9311371 | |||
| 45fede3a02 | |||
| addadf9634 | |||
| 520a7a6e9e | |||
| 65eb204ddc | |||
| 6eee460532 | |||
| c85fa85290 | |||
| 39324c6f73 | |||
| 9702286e59 | |||
| 512acd9fc3 | |||
| 930facc457 | |||
| 5a428458b5 | |||
| fa12c90f23 | |||
| 2e16ccb041 | |||
| df7dda0e96 | |||
| 28c86b4784 | |||
| 175a4ddf95 | |||
| e4b24b0d99 | |||
| 989fcd9564 | |||
| 4877ef1407 | |||
| c1487e3f74 | |||
| 6d4650bba9 | |||
| fb6f02696d | |||
| 8ed4abebb7 | |||
| f90de9c0de | |||
| 206d2a58d2 | |||
| 6001d2fb3a | |||
| 1ceab73dfe | |||
| dc38b949a8 | |||
| 96b740d4da | |||
| 1455f7849b | |||
| 7f14a4da90 | |||
| 0d04064969 | |||
| 37fbda3126 | |||
| 023e62fbd4 | |||
| b818007398 | |||
| 7c1bb82dd4 | |||
| e3a6fa4cac | |||
| 6e6aa88b3a | |||
| c266bd6eba | |||
| e383c2b79a | |||
| 56a5b23d98 | |||
| 10eb41aca7 | |||
| a0a50e3433 | |||
| 07449e9018 | |||
| 5027373b54 | |||
| 1d1e08fc15 | |||
| 6eabf32464 | |||
| acb4a2e5a0 | |||
| ba1b5211a2 | |||
| eb8d248fd9 | |||
| f248a86ce2 | |||
| 8e9b55958d | |||
| 6decd0ee76 | |||
| 16384c12c2 | |||
| 9be5c50e31 | |||
| 46421d8821 | |||
| 13cb356aef | |||
| b210b72460 | |||
| 6aa63f48e1 | |||
| eaba4a4ab7 | |||
| fbc61bce2a | |||
| 5c98e34966 | |||
| 9b461d372d | |||
| b57a81c7c2 | |||
| 7cf41805ec | |||
| 59efa059fd | |||
| e462d66746 | |||
| cd0c3f533a | |||
| 0027b17ef9 | |||
| 9ee5325f29 | |||
| ac433edcf8 | |||
| f71e7e58e1 | |||
| 4af1e9263a | |||
| 01d3a75faa | |||
| d015ab4e93 | |||
| abcf3600a6 | |||
| ac6c497721 | |||
| 2dafecc665 | |||
| 3a48f0a04a | |||
| 1caf3a8956 | |||
| ba1dd07b01 | |||
| 695a97276f | |||
| 0d50753754 | |||
| e357786980 | |||
| 54ab0ba860 | |||
| 44675fffe5 | |||
| e5c6fb0e50 | |||
| 82666fb5f0 | |||
| 9ab86ca310 | |||
| 7153b4c7be | |||
| e73f4f30cb | |||
| e365a20d6e | |||
| 4a9f9eefd2 | |||
| 2ff632bb87 | |||
| f5be0708be | |||
| 92908ab673 | |||
| c20f8699f3 | |||
| 81e60a3916 | |||
| 4f8e25a6c0 | |||
| 4038088c5f | |||
| bc972faf2a | |||
| 0720fec295 | |||
| fba37c7c12 | |||
| debaa48e58 | |||
| c4a63657cd | |||
| a723783c01 | |||
| 26a922e16a | |||
| 9a20d33d55 | |||
| 3abe9946d4 | |||
| dcf4857b6e | |||
| 701ae43bd6 | |||
| cb67d0a45b | |||
| 1684bc3acc | |||
| ee32ef2f09 | |||
| c9ed86a81a | |||
| 8421e85229 | |||
| 0b2eead1be | |||
| 0d30d4a4f3 | |||
| ac55638e46 | |||
| e57c45da71 | |||
| 4b93e2e57c | |||
| 2bab5a65f4 | |||
| 66f379f80b | |||
| 4a8749349f | |||
| 54fe2accb6 | |||
| ec21b57106 | |||
| 9e62523b6d | |||
| 2b69ba5716 | |||
| dadfecf8f3 |
@@ -0,0 +1,25 @@
|
||||
# Thank you for contributing to Delta Chat.
|
||||
|
||||
Delta Chat is divided in two parts: Android and [Core](https://github.com/deltachat/deltachat-core).
|
||||
|
||||
In short, the Android part is about the User Interface. The Interface is translated using [Transifex](https://www.transifex.com/delta-chat/delta-chat-android). The Core part is about handling the connection to the mail server and the chat or e-mail messages as well as providing secure communication by using [Autocrypt](https://autocrypt.org/en/latest/).
|
||||
|
||||
Delta Chat Core is used in the Android and in the [iOS](https://github.com/deltachat/deltachat-ios) version.
|
||||
|
||||
Please try to create your issue to the respective Issue tracker: Here, or in [Core](https://github.com/deltachat/deltachat-core/issues). Don't worry, if you are not sure. The issue will be handled anyway.
|
||||
|
||||
If you intend to create a **feature request** for Delta Chat, please check the exiting requests for
|
||||
* [Android](https://github.com/deltachat/deltachat-android/issues?q=is%3Aissue+label%3A%22feature+request%22+sort%3Aupdated-desc) and
|
||||
* [Core](https://github.com/deltachat/deltachat-core/issues?q=is%3Aissue+label%3A%22feature+request%22+sort%3Aupdated-desc)
|
||||
|
||||
first.
|
||||
|
||||
If you intend to send a **bug report** for Delta Chat, search for bugs (including closed) in
|
||||
* [Android](https://github.com/deltachat/deltachat-android/issues?&q=is%3Aissue) and
|
||||
* [Core](https://github.com/deltachat/deltachat-core/issues?&q=is%3Aissue)
|
||||
|
||||
A **bug** is a reproducable misbehaviour, when something happens but something else should happen instead.
|
||||
|
||||
Did you know there is a [Help](https://delta.chat/en/help) page for Delta Chat?
|
||||
|
||||
To ask questions, you are invited to join our IRC channel **#deltachat** on [Freenode](https://webchat.freenode.net/?uio=MTE9MjA16a&channels=%23deltachat).
|
||||
@@ -0,0 +1,34 @@
|
||||
_Please read the guidelines linked above, especially when you are a first time contributor. Remove this text and provide some basic informations below, if applicable. Remove template content that is not applicable._
|
||||
|
||||
**Delta Chat version**
|
||||
|
||||
See settings dialog …
|
||||
|
||||
**Expected behavior**
|
||||
|
||||
What is the expected output?
|
||||
|
||||
**Actual behavior**
|
||||
|
||||
What do you see instead?
|
||||
|
||||
**Steps to reproduce the problem**
|
||||
|
||||
1. …
|
||||
2. …
|
||||
|
||||
**Screen snapshots**
|
||||
|
||||
If applicable …
|
||||
|
||||
**Debug logs**
|
||||
|
||||
If applicable, debug logs can be copied from within the Delta Chat app:
|
||||
|
||||
Open the _Settings_ menu -> _About_ -> _version number|Info_.
|
||||
|
||||
Alternatively from the Android system log:
|
||||
|
||||
` adb logcat -v time -s DeltaChat `
|
||||
|
||||
This log contains private data (e.g. mail address, provider information) which shall be removed or anonymised prior to posting.
|
||||
@@ -9,3 +9,6 @@ libs/
|
||||
|
||||
# ignore private scripts and directories, eg. local2github.prv.sh
|
||||
*.prv*
|
||||
|
||||
# transifex temporary files
|
||||
tools/translations/
|
||||
|
||||
+192
@@ -1,5 +1,196 @@
|
||||
# Delta Chat Changelog
|
||||
|
||||
## v0.17.3
|
||||
2018-05-17
|
||||
|
||||
* Fix appearing system messages appearing twice
|
||||
* Fix: Use all gossipped verifications in verified groups
|
||||
* Update Basque, Polish, Russian and Ukrainian translations
|
||||
|
||||
## v0.17.2
|
||||
2018-05-15
|
||||
|
||||
* Fix problem with adding formerly uncontacted members to groups
|
||||
* Unblock manually blocked members when they are created manually as contact again
|
||||
|
||||
## v0.17.1
|
||||
2018-05-11
|
||||
|
||||
* Improve QR code scanning screens
|
||||
* Add a labs-option to disabled the new QR logo overlay
|
||||
* Update Russian translations
|
||||
|
||||
## v0.17.0
|
||||
2018-05-07
|
||||
|
||||
* Show shared chats in user profiles
|
||||
* If a contact has changed his encryption setups, this is shown as a system messages in the middle of the chat view
|
||||
* Show added group members, changed group titles etc. as system messages
|
||||
* Show direct buttons to create a new group or contact in the "New Chat" dialog
|
||||
* Improve "Add contact" dialog
|
||||
* Move subject and most chat metadata to the encrypted part following the "Memoryhole" proposal
|
||||
* Show read-timestamps in message info
|
||||
* Do not add contacts from Bcc to group-memberlist to avoid privacy leaks and to get a unique memberlist for all group-members
|
||||
* In a mail contains plaintext and encrypted parts, the whole mail is treated as not being encrypted correctly
|
||||
* Restructure settings and advanced settings
|
||||
* Fix problems with Office 365 and similar services
|
||||
* Fix a problem where incoming messages are shown as being sent by oneself
|
||||
* Experimental QR code scanning options can be enabled in the advanced settings
|
||||
* Update Albanian, Catalan, Dutch, French, German, Italian, Norwegian, Polish, Russian, Spanish, Turkish and Ukrainian translations
|
||||
* Add Basque translation
|
||||
* Add Chinese translation
|
||||
* Add Japanese translation
|
||||
|
||||
## v0.16.0
|
||||
2018-03-19
|
||||
|
||||
* Messages from normal clients to more than one recipient create an implicit "ad-hoc group"
|
||||
* Allow group creation though contact requests
|
||||
* Always display the _sending_ time in the chat list; the list itself is sorted by _receiving_ time and "Message info" shows both times now
|
||||
* If parts but the footnote are cut from mails, this is indicated "..."; use "Message info" to get the full text
|
||||
* Highlight the subject in the "Message info"
|
||||
* Autoconfigure prefers 'https' over 'http'
|
||||
* Bug fixes, eg. avoid freezes if the connection is lost
|
||||
* Update Russian, Tamil and Turkish translations
|
||||
|
||||
This version requires access to the camera for upcoming QR code scanning options which can be tested already in this version, see commit
|
||||
[74ffbf4](https://github.com/deltachat/deltachat-android/commit/74ffbf48befbb0416337673d73d9f2482728cac6).
|
||||
|
||||
## v0.15.0
|
||||
2018-02-27
|
||||
|
||||
* Render the waveform for voice messages
|
||||
* Fix problems with voice messages on various devices
|
||||
* Improve deletion of message that were moved around by another e-mail client
|
||||
* Really delete messages on the server, do not only mark them for deletion
|
||||
* Ignore subsequent keys or blocks in OpenPGP files
|
||||
* Leave incoming Autocrypt Setup Messages in the inbox so that any number of other e-mail-clients can process them
|
||||
* Avoid messages sent to the "Me" chat appearing twice in other e-mail clients
|
||||
* Update Albanian translation
|
||||
|
||||
## v0.14.0
|
||||
2018-02-20
|
||||
|
||||
* Evaluate gossiped keys
|
||||
* Option to transfer the Autocrypt Setup to another device or e-mail client
|
||||
* Accept Autocrypt Setup transferred from other devices or e-mail client
|
||||
* Send any data from device to device using the chat "Me - Messages I sent to myself"
|
||||
* Do not send messages when there is an access error
|
||||
* Request for contact permissions only once
|
||||
* Bug fixes
|
||||
* Update French and Turkish translations
|
||||
|
||||
## v0.13.0
|
||||
2018-01-18
|
||||
|
||||
* Reply encrypted if the sender has enabled encryption manually (esp. useful when chatting with clients as K-9 or Enigmail)
|
||||
* Update welcome screen graphics
|
||||
* Update Norwegian, Russian and Turkish translations
|
||||
|
||||
## v0.12.0
|
||||
2018-01-07
|
||||
|
||||
* Gossip keys of other group members in the encrypted payload (will also be evaluated in one of the next versions)
|
||||
* Use SHA-256 instead of SHA-1 in signatures
|
||||
* Make the permanent notification clickable
|
||||
* Update permanent notification after import
|
||||
* Fix rendering of system messages
|
||||
* Various bug fixes
|
||||
* Update Albanian, French, Italian, Norwegian, Polish, Russian and Turkish translations
|
||||
|
||||
## v0.11.4
|
||||
2017-12-17
|
||||
|
||||
* Add option to initiate Autocrypt Key Transfer
|
||||
* Connect after importing a backup
|
||||
* Reading memory hole headers
|
||||
* Add Albanian translation
|
||||
* Update German, Italian, Polish, Portuguese, Russian, Turkish and Ukrainian translations
|
||||
|
||||
## v0.10.0
|
||||
2017-11-29
|
||||
|
||||
* Fix usage of multiple private keys
|
||||
* Fix various memory leaks
|
||||
* Update English, Portuguese and Turkish translations
|
||||
|
||||
## v0.9.9
|
||||
2017-11-18
|
||||
|
||||
* Alternate include order for F-Droid
|
||||
* Add Serbian translation
|
||||
* Update Catalan, Dutch, English, French, German, Hungarian, Italian, Polish, Portuguese, Russian, Spanish, Tamil, Telugu and Ukrainian translations
|
||||
|
||||
## v0.9.8
|
||||
2017-11-15
|
||||
|
||||
* Fix a bug that avoids chat creation under some circumstances (bug introduced in 0.9.7)
|
||||
|
||||
## v0.9.7
|
||||
2017-11-14
|
||||
|
||||
* Archive chats or delete chats by a long press
|
||||
* Notify the user in the chatlist about contact requests of known users or of other Delta Chat clients
|
||||
* Show messages only for explicitly wanted chats
|
||||
* Show more detailed reasons about failed end-to-end-encryptions
|
||||
* Explicit option to leave a group
|
||||
* Do not show the padlock if end-to-end-encryption is disabled by the user
|
||||
* Also import images from a backup when using a different device with different paths
|
||||
* Add copy-to-clipboard function for "About / Info"
|
||||
* Rework Emoji-code
|
||||
* Add Norwegian Bokmål translation
|
||||
* Add Tamil translation
|
||||
* Add Turkish translation
|
||||
* Update Catalan, German, French, Italian, Korean, Dutch, Polish, Portuguese, Russian, Telugu and Ukrainian translations
|
||||
|
||||
## v0.9.6
|
||||
2017-10-18
|
||||
|
||||
* Support keys generated with multiple subkeys eg. from K-9
|
||||
* Show PDFs and other attachments with bad names
|
||||
* Bug fixes
|
||||
|
||||
## v0.9.5
|
||||
2017-10-08
|
||||
|
||||
* Backup export and import function
|
||||
* Query password before export
|
||||
* Move replies from normal E-Mail-Clients to the "Chats" folder
|
||||
* Improve helping MUAs on showing chat threads
|
||||
* Improve onboarding
|
||||
* Add URL to default footer
|
||||
* Test a different approach for battery saving in this release
|
||||
* Update French, Italian, German, Polish, Portuguese, Russian and Ukrainian translations
|
||||
|
||||
## v0.9.4
|
||||
2017-08-23
|
||||
|
||||
* Introduce an editable "Status" field that is shown eg. in email footers
|
||||
* Editable and synchronized group images
|
||||
* Show the subject of messages that cannot be decrypted
|
||||
* Do not send "Read receipts" when decryption fails
|
||||
* Do not request "Read receipts" from normal MUAs as there are too many MUAs responding with weird, non-standard formats
|
||||
* Deleting a chat always deletes all messages from the device permanently
|
||||
* Ignore messages from mailing lists
|
||||
* Do not spread the original authors name nor address on forwarding
|
||||
* Encrypt mails send to SMTP and to IMAP the same way
|
||||
* Improve showing HTML-mails
|
||||
* Cleanup Android code
|
||||
* Remove badge counter on app restart
|
||||
* Add Ukrainian translation
|
||||
* Add Telugu translation
|
||||
* Add Catalan translation
|
||||
* Update German, Spanish, French, Hungarian, Italian, Polish, Portuguese and Russian translations
|
||||
|
||||
## v0.9.3
|
||||
2017-07-13
|
||||
|
||||
* Introduce "Read receipts" and avoid social pressure to leave it activated
|
||||
* Improve encryption dialog in profile
|
||||
* Fix marking messages as "seen" when opening the contact requests
|
||||
* Ignore signature.asc files of signed-only messages
|
||||
* Update Polish, Portuguese and Russian translations
|
||||
|
||||
## v0.9.2
|
||||
2017-06-28
|
||||
|
||||
@@ -10,6 +201,7 @@
|
||||
* If end-to-end-encryption is available on sending time, guarantee the message not to be sent without end-to-end-encryption later
|
||||
* Show special characters in HTML-mails
|
||||
* Help MUAs on showing chat threads
|
||||
* Show attachments from multipart/alternative structures
|
||||
* Upgrade from Autocrypt Level 0 to Level 1; as the levels are not compatible, encryption on mixed setups does not happen
|
||||
* Update Polish, Portuguese, Spanish and French translations
|
||||
|
||||
|
||||
@@ -27,12 +27,14 @@ dependencies {
|
||||
compile 'com.android.support:appcompat-v7:25.3.1'
|
||||
compile 'com.googlecode.mp4parser:isoparser:1.0.6'
|
||||
compile 'com.amulyakhare:com.amulyakhare.textdrawable:1.0.1'
|
||||
compile 'com.google.zxing:core:3.3.0'
|
||||
compile 'com.journeyapps:zxing-android-embedded:3.4.0'
|
||||
compile fileTree(dir: "$buildDir/native-libs", include: 'native-libs.jar')
|
||||
}
|
||||
|
||||
android {
|
||||
compileSdkVersion 25
|
||||
buildToolsVersion '25.0.2'
|
||||
compileSdkVersion 25 // should be ...
|
||||
buildToolsVersion '25.0.2' // ... in sync unless you know exactly what you're doing
|
||||
|
||||
useLibrary 'org.apache.http.legacy'
|
||||
defaultConfig.applicationId = "com.b44t.messenger"
|
||||
@@ -48,7 +50,10 @@ android {
|
||||
|
||||
signingConfigs {
|
||||
debug {
|
||||
storeFile file("config/debug.keystore")
|
||||
def debugKeystore = file("config/debug.keystore")
|
||||
if (debugKeystore.exists()) {
|
||||
storeFile debugKeystore
|
||||
}
|
||||
}
|
||||
|
||||
release {
|
||||
@@ -76,13 +81,12 @@ android {
|
||||
}
|
||||
}
|
||||
|
||||
defaultConfig.versionCode = 41
|
||||
|
||||
sourceSets.main {
|
||||
jniLibs.srcDir 'libs'
|
||||
jni.srcDirs = [] //disable automatic ndk-build call
|
||||
}
|
||||
|
||||
flavorDimensions "none"
|
||||
productFlavors {
|
||||
/*
|
||||
x86 {
|
||||
@@ -105,19 +109,22 @@ android {
|
||||
}
|
||||
*/
|
||||
fat {
|
||||
versionCode = 3
|
||||
dimension "none"
|
||||
//versionCode = 3
|
||||
}
|
||||
}
|
||||
|
||||
applicationVariants.all { variant ->
|
||||
/*applicationVariants.all { variant ->
|
||||
def abiVersion = variant.productFlavors.get(0).versionCode
|
||||
variant.mergedFlavor.versionCode = defaultConfig.versionCode * 10 + abiVersion;
|
||||
}
|
||||
}*/
|
||||
|
||||
defaultConfig {
|
||||
minSdkVersion 14 // 14: Android 4.0 Ice Cream Sandwich 2011 (Telegram default), 21: Android 5.0 Lollipop 2014 (recommended for InstantRun)
|
||||
targetSdkVersion 25 // 25: Nougat. CAVE: Do NOT target "Andoid O" without checking the background tasks carefully, see https://developer.android.com/preview/behavior-changes.html#back-all . As long as we target "Nougat", everything works as expected even for "Andoid O" or later
|
||||
// in general, we should not change the target without reason; eg. after the switch to Nougat, the camera stops working (see https://inthecheesefactory.com/blog/how-to-share-access-to-file-with-fileprovider-on-android-nougat/en )
|
||||
versionName "0.9.2" // do NOT forget to increase defaultConfig.versionCode!
|
||||
|
||||
versionName "0.17.3" // do NOT forget to increase defaultConfig.versionCode!
|
||||
versionCode 520
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1311,6 +1311,7 @@ LOCAL_MODULE := sqlite
|
||||
LOCAL_CFLAGS := -w -std=c11 -Os -DNULL=0 -DSOCKLEN_T=socklen_t -DLOCALE_NOT_USED -D_LARGEFILE_SOURCE=1 -D_FILE_OFFSET_BITS=64
|
||||
LOCAL_CFLAGS += -DANDROID_NDK -DDISABLE_IMPORTGL -fno-strict-aliasing -fprefetch-loop-arrays -DAVOID_TABLES -DANDROID_TILE_BASED_DECODE -DANDROID_ARMV6_IDCT -DHAVE_STRCHRNUL=0
|
||||
LOCAL_CFLAGS += -DSQLITE_OMIT_LOAD_EXTENSION
|
||||
LOCAL_CFLAGS += -DSQLITE_MAX_MMAP_SIZE=0 -DSQLITE_OMIT_WAL # HACK: the defines are used to skip the pointer reference to mmap set in aSyscall[] - mmap seems to be a #define that cannot be used this way on Android - otherwise we get the error: 'mmap' undeclared here (not in a function)
|
||||
|
||||
LOCAL_SRC_FILES := \
|
||||
./messenger-backend/libs/sqlite/sqlite3.c
|
||||
@@ -1632,32 +1633,42 @@ LOCAL_SRC_FILES += \
|
||||
./messenger-backend/libs/netpgp/src/writer.c \
|
||||
./messenger-backend/src/mraheader.c \
|
||||
./messenger-backend/src/mrapeerstate.c \
|
||||
./messenger-backend/src/mrarray.c \
|
||||
./messenger-backend/src/mrchat.c \
|
||||
./messenger-backend/src/mrchatlist.c \
|
||||
./messenger-backend/src/mrcmdline.c \
|
||||
./messenger-backend/src/mrcontact.c \
|
||||
./messenger-backend/src/mrdehtml.c \
|
||||
./messenger-backend/src/mrhash.c \
|
||||
./messenger-backend/src/mrimap.c \
|
||||
./messenger-backend/src/mrjob.c \
|
||||
./messenger-backend/src/mrkey.c \
|
||||
./messenger-backend/src/mrkeyring.c \
|
||||
./messenger-backend/src/mrloginparam.c \
|
||||
./messenger-backend/src/mrlot.c \
|
||||
./messenger-backend/src/mrmailbox.c \
|
||||
./messenger-backend/src/mrmailbox_configure.c \
|
||||
./messenger-backend/src/mrmailbox_connect.c \
|
||||
./messenger-backend/src/mrmailbox_e2ee.c \
|
||||
./messenger-backend/src/mrmailbox_imex.c \
|
||||
./messenger-backend/src/mrmailbox_keyhistory.c \
|
||||
./messenger-backend/src/mrmailbox_log.c \
|
||||
./messenger-backend/src/mrmailbox_qr.c \
|
||||
./messenger-backend/src/mrmailbox_receive_imf.c \
|
||||
./messenger-backend/src/mrmailbox_securejoin.c \
|
||||
./messenger-backend/src/mrmimefactory.c \
|
||||
./messenger-backend/src/mrmimeparser.c \
|
||||
./messenger-backend/src/mrmsg.c \
|
||||
./messenger-backend/src/mrosnative.c \
|
||||
./messenger-backend/src/mrparam.c \
|
||||
./messenger-backend/src/mrpgp.c \
|
||||
./messenger-backend/src/mrpoortext.c \
|
||||
./messenger-backend/src/mrsaxparser.c \
|
||||
./messenger-backend/src/mrsimplify.c \
|
||||
./messenger-backend/src/mrsmtp.c \
|
||||
./messenger-backend/src/mrsqlite3.c \
|
||||
./messenger-backend/src/mrstock.c \
|
||||
./messenger-backend/src/mrtoken.c \
|
||||
./messenger-backend/src/mrtools.c \
|
||||
./messenger-backend/src/mruudecode.c \
|
||||
./messenger-backend/cmdline/cmdline.c \
|
||||
./mrwrapper.c
|
||||
|
||||
include $(BUILD_SHARED_LIBRARY)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
APP_PLATFORM := android-9
|
||||
APP_PLATFORM := android-14
|
||||
APP_ABI := armeabi armeabi-v7a x86
|
||||
NDK_TOOLCHAIN_VERSION := 4.9
|
||||
APP_STL := gnustl_static
|
||||
|
||||
@@ -403,7 +403,7 @@
|
||||
/* #undef STATIC_LDAPDB */
|
||||
|
||||
/* Link LOGIN Staticly */
|
||||
/* #undef STATIC_LOGIN */
|
||||
#define STATIC_LOGIN
|
||||
|
||||
/* Link NTLM Staticly */
|
||||
/* #undef STATIC_NTLM */
|
||||
|
||||
Submodule MessengerProj/jni/messenger-backend updated: aae712fcb8...178a6a2c01
+456
-240
File diff suppressed because it is too large
Load Diff
@@ -41,7 +41,7 @@
|
||||
<uses-permission android:name="android.permission.INSTALL_SHORTCUT" />
|
||||
<uses-permission android:name="com.android.launcher.permission.INSTALL_SHORTCUT" />
|
||||
<!-- <uses-permission android:name="com.android.launcher.permission.UNINSTALL_SHORTCUT" /> - required for AndroidUtilities.uninstallShortcut() -->
|
||||
<!-- <uses-permission android:name="android.permission.CAMERA" /> - also disabled in T'gram; we're using the camera via an intent only -->
|
||||
<uses-permission android:name="android.permission.CAMERA" /> <!-- needed for qr code scanning, not needed for taking photos (we're using an intent for this) -->
|
||||
|
||||
<application
|
||||
android:name=".ApplicationLoader"
|
||||
@@ -53,7 +53,7 @@
|
||||
android:supportsRtl="true">
|
||||
|
||||
<activity
|
||||
android:name="com.b44t.ui.LaunchActivity"
|
||||
android:name=".LaunchActivity"
|
||||
android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
|
||||
android:launchMode="singleTask"
|
||||
android:windowSoftInputMode="adjustPan">
|
||||
@@ -105,17 +105,24 @@
|
||||
<category android:name="android.intent.category.BROWSABLE"/>
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<!-- if used, add 'android:manageSpaceActivity="com.b44t.ui.ManageSpaceActivity"' to application-tag
|
||||
|
||||
<activity
|
||||
android:name="com.b44t.ui.ManageSpaceActivity"
|
||||
android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
|
||||
android:launchMode="singleTask"
|
||||
android:windowSoftInputMode="adjustPan">
|
||||
</activity> -->
|
||||
<activity
|
||||
android:name="com.b44t.ui.IntroActivity"
|
||||
android:name=".WelcomeActivity"
|
||||
android:configChanges="keyboard|keyboardHidden|orientation|screenSize">
|
||||
</activity>
|
||||
|
||||
<activity
|
||||
android:name=".QRshowActivity"
|
||||
android:theme="@style/Theme.MessengerProj.AppCompat"
|
||||
android:configChanges="keyboard|keyboardHidden|orientation|screenSize">
|
||||
</activity>
|
||||
|
||||
<activity
|
||||
android:name=".QRscanActivity"
|
||||
android:theme="@style/Theme.MessengerProj.AppCompat"
|
||||
android:configChanges="keyboard|keyboardHidden|orientation|screenSize">
|
||||
</activity>
|
||||
|
||||
<activity
|
||||
android:name="com.b44t.messenger.OpenChatReceiver"
|
||||
android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
|
||||
|
||||
+6
-37
@@ -21,14 +21,13 @@
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
package com.b44t.ui.ActionBar;
|
||||
package com.b44t.messenger.ActionBar;
|
||||
|
||||
import android.animation.Animator;
|
||||
import android.animation.AnimatorSet;
|
||||
import android.animation.ObjectAnimator;
|
||||
import android.content.Context;
|
||||
import android.content.res.Configuration;
|
||||
import android.graphics.Typeface;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Build;
|
||||
import android.view.Gravity;
|
||||
@@ -40,7 +39,7 @@ import android.widget.ImageView;
|
||||
import com.b44t.messenger.AndroidUtilities;
|
||||
import com.b44t.messenger.AnimatorListenerAdapterProxy;
|
||||
import com.b44t.messenger.ApplicationLoader;
|
||||
import com.b44t.ui.Components.LayoutHelper;
|
||||
import com.b44t.messenger.Components.LayoutHelper;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
@@ -72,7 +71,6 @@ public class ActionBar extends FrameLayout {
|
||||
private boolean interceptTouches = true;
|
||||
private AnimatorSet actionModeAnimation;
|
||||
|
||||
private boolean allowOverlayTitle;
|
||||
private CharSequence lastTitle;
|
||||
private boolean castShadows = true;
|
||||
|
||||
@@ -378,12 +376,6 @@ public class ActionBar extends FrameLayout {
|
||||
if (subtitleTextView != null) {
|
||||
subtitleTextView.setVisibility(visible ? INVISIBLE : VISIBLE);
|
||||
}
|
||||
if( backButtonImageView != null ) {
|
||||
Drawable drawable = backButtonImageView.getDrawable();
|
||||
if (drawable != null && drawable instanceof MenuDrawable) {
|
||||
((MenuDrawable) drawable).setRotation(visible ? 1 : 0, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void setInterceptTouches(boolean value) {
|
||||
@@ -435,12 +427,11 @@ public class ActionBar extends FrameLayout {
|
||||
int availableWidth = width - (menu != null ? menu.getMeasuredWidth() : 0) - AndroidUtilities.dp(16) - textLeft;
|
||||
|
||||
if (titleTextView != null && titleTextView.getVisibility() != GONE) {
|
||||
titleTextView.setTextSize(!AndroidUtilities.isTablet() && getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE ? 18 : 20);
|
||||
titleTextView.setTextSize(getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE ? 18 : 20);
|
||||
titleTextView.measure(MeasureSpec.makeMeasureSpec(availableWidth, MeasureSpec.AT_MOST), MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(24), MeasureSpec.AT_MOST));
|
||||
|
||||
}
|
||||
if (subtitleTextView != null && subtitleTextView.getVisibility() != GONE) {
|
||||
//subtitleTextView.setTextSize(!AndroidUtilities.isTablet() && getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE ? 14 : 16);
|
||||
subtitleTextView.measure(MeasureSpec.makeMeasureSpec(availableWidth, MeasureSpec.AT_MOST), MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(20), MeasureSpec.AT_MOST));
|
||||
}
|
||||
}
|
||||
@@ -475,14 +466,14 @@ public class ActionBar extends FrameLayout {
|
||||
if (titleTextView != null && titleTextView.getVisibility() != GONE) {
|
||||
int textTop;
|
||||
if (subtitleTextView != null && subtitleTextView.getVisibility() != GONE) {
|
||||
textTop = (getCurrentActionBarHeight() / 2 - titleTextView.getTextHeight()) / 2 + AndroidUtilities.dp(!AndroidUtilities.isTablet() && getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE ? 2 : 3);
|
||||
textTop = (getCurrentActionBarHeight() / 2 - titleTextView.getTextHeight()) / 2 + AndroidUtilities.dp(getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE ? 2 : 3);
|
||||
} else {
|
||||
textTop = (getCurrentActionBarHeight() - titleTextView.getTextHeight()) / 2;
|
||||
}
|
||||
titleTextView.layout(textLeft, additionalTop + textTop, textLeft + titleTextView.getMeasuredWidth(), additionalTop + textTop + titleTextView.getTextHeight());
|
||||
}
|
||||
if (subtitleTextView != null && subtitleTextView.getVisibility() != GONE) {
|
||||
int textTop = getCurrentActionBarHeight() / 2 + (getCurrentActionBarHeight() / 2 - subtitleTextView.getTextHeight()) / 2 - AndroidUtilities.dp(!AndroidUtilities.isTablet() && getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE ? 1 : 1);
|
||||
int textTop = getCurrentActionBarHeight() / 2 + (getCurrentActionBarHeight() / 2 - subtitleTextView.getTextHeight()) / 2 - AndroidUtilities.dp(getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE ? 1 : 1);
|
||||
subtitleTextView.layout(textLeft, additionalTop + textTop, textLeft + subtitleTextView.getMeasuredWidth(), additionalTop + textTop + subtitleTextView.getTextHeight());
|
||||
}
|
||||
|
||||
@@ -549,26 +540,6 @@ public class ActionBar extends FrameLayout {
|
||||
}
|
||||
}
|
||||
|
||||
public void setAllowOverlayTitle(boolean value) {
|
||||
allowOverlayTitle = value;
|
||||
}
|
||||
|
||||
public void setTitleOverlayText(String text) {
|
||||
/* EDIT BY MR
|
||||
if (!allowOverlayTitle || parentFragment.parentLayout == null) {
|
||||
return;
|
||||
}
|
||||
CharSequence textToSet = text != null ? text : lastTitle;
|
||||
if (textToSet != null && titleTextView == null) {
|
||||
createTitleTextView();
|
||||
}
|
||||
if (titleTextView != null) {
|
||||
titleTextView.setVisibility(textToSet != null && !isSearchFieldVisible ? VISIBLE : INVISIBLE);
|
||||
titleTextView.setText(textToSet);
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
public boolean isSearchFieldVisible() {
|
||||
return isSearchFieldVisible;
|
||||
}
|
||||
@@ -605,9 +576,7 @@ public class ActionBar extends FrameLayout {
|
||||
}
|
||||
|
||||
public static int getCurrentActionBarHeight() {
|
||||
if (AndroidUtilities.isTablet()) {
|
||||
return AndroidUtilities.dp(64);
|
||||
} else if (ApplicationLoader.applicationContext.getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) {
|
||||
if (ApplicationLoader.applicationContext.getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) {
|
||||
return AndroidUtilities.dp(48);
|
||||
} else {
|
||||
return AndroidUtilities.dp(56);
|
||||
+49
-208
@@ -21,7 +21,7 @@
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
package com.b44t.ui.ActionBar;
|
||||
package com.b44t.messenger.ActionBar;
|
||||
|
||||
import android.animation.Animator;
|
||||
import android.animation.AnimatorSet;
|
||||
@@ -49,7 +49,7 @@ import android.widget.LinearLayout;
|
||||
import com.b44t.messenger.AndroidUtilities;
|
||||
import com.b44t.messenger.R;
|
||||
import com.b44t.messenger.AnimatorListenerAdapterProxy;
|
||||
import com.b44t.ui.Components.LayoutHelper;
|
||||
import com.b44t.messenger.Components.LayoutHelper;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
@@ -60,7 +60,6 @@ public class ActionBarLayout extends FrameLayout {
|
||||
boolean needPresentFragment(BaseFragment fragment, boolean removeLast, boolean forceWithoutAnimation, ActionBarLayout layout);
|
||||
boolean needAddFragmentToStack(BaseFragment fragment, ActionBarLayout layout);
|
||||
boolean needCloseLastFragment(ActionBarLayout layout);
|
||||
void onRebuildAllFragments(ActionBarLayout layout);
|
||||
}
|
||||
|
||||
public class LinearLayoutContainer extends LinearLayout {
|
||||
@@ -131,7 +130,6 @@ public class ActionBarLayout extends FrameLayout {
|
||||
|
||||
private LinearLayoutContainer containerView;
|
||||
private LinearLayoutContainer containerViewBack;
|
||||
private DrawerLayoutContainer drawerLayoutContainer;
|
||||
private ActionBar currentActionBar;
|
||||
|
||||
private AnimatorSet currentAnimation;
|
||||
@@ -153,16 +151,12 @@ public class ActionBarLayout extends FrameLayout {
|
||||
private int startedTrackingPointerId;
|
||||
private Runnable onCloseAnimationEndRunnable;
|
||||
private Runnable onOpenAnimationEndRunnable;
|
||||
private boolean useAlphaAnimations;
|
||||
private View backgroundView;
|
||||
private boolean removeActionBarExtraHeight;
|
||||
private Runnable animationRunnable;
|
||||
|
||||
private float animationProgress = 0.0f;
|
||||
private long lastFrameTime;
|
||||
|
||||
private String titleOverlayText;
|
||||
|
||||
private ActionBarLayoutDelegate delegate = null;
|
||||
protected Activity parentActivity = null;
|
||||
|
||||
@@ -385,7 +379,6 @@ public class ActionBarLayout extends FrameLayout {
|
||||
lastFragment.actionBar.setOccupyStatusBar(false);
|
||||
}
|
||||
containerViewBack.addView(lastFragment.actionBar);
|
||||
lastFragment.actionBar.setTitleOverlayText(titleOverlayText);
|
||||
}
|
||||
containerViewBack.addView(fragmentView);
|
||||
ViewGroup.LayoutParams layoutParams = fragmentView.getLayoutParams();
|
||||
@@ -678,7 +671,6 @@ public class ActionBarLayout extends FrameLayout {
|
||||
parent.removeView(fragment.actionBar);
|
||||
}
|
||||
containerViewBack.addView(fragment.actionBar);
|
||||
fragment.actionBar.setTitleOverlayText(titleOverlayText);
|
||||
}
|
||||
|
||||
containerViewBack.addView(fragmentView);
|
||||
@@ -702,110 +694,56 @@ public class ActionBarLayout extends FrameLayout {
|
||||
bringChildToFront(containerView);
|
||||
if (!needAnimation) {
|
||||
presentFragmentInternalRemoveOld(removeLast, currentFragment);
|
||||
if (backgroundView != null) {
|
||||
backgroundView.setVisibility(VISIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
if (needAnimation) {
|
||||
if (useAlphaAnimations && fragmentsStack.size() == 1) {
|
||||
presentFragmentInternalRemoveOld(removeLast, currentFragment);
|
||||
|
||||
transitionAnimationStartTime = System.currentTimeMillis();
|
||||
transitionAnimationInProgress = true;
|
||||
onOpenAnimationEndRunnable = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
fragment.onTransitionAnimationEnd(true, false);
|
||||
fragment.onBecomeFullyVisible();
|
||||
}
|
||||
};
|
||||
ArrayList<Animator> animators = new ArrayList<>();
|
||||
animators.add(ObjectAnimator.ofFloat(this, "alpha", 0.0f, 1.0f));
|
||||
if (backgroundView != null) {
|
||||
backgroundView.setVisibility(VISIBLE);
|
||||
animators.add(ObjectAnimator.ofFloat(backgroundView, "alpha", 0.0f, 1.0f));
|
||||
}
|
||||
|
||||
fragment.onTransitionAnimationStart(true, false);
|
||||
currentAnimation = new AnimatorSet();
|
||||
currentAnimation.playTogether(animators);
|
||||
currentAnimation.setInterpolator(accelerateDecelerateInterpolator);
|
||||
currentAnimation.setDuration(200);
|
||||
currentAnimation.addListener(new AnimatorListenerAdapterProxy() {
|
||||
@Override
|
||||
public void onAnimationEnd(Animator animation) {
|
||||
onAnimationEndCheck(false);
|
||||
}
|
||||
});
|
||||
currentAnimation.start();
|
||||
} else {
|
||||
transitionAnimationStartTime = System.currentTimeMillis();
|
||||
transitionAnimationInProgress = true;
|
||||
onOpenAnimationEndRunnable = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (Build.VERSION.SDK_INT > 15) {
|
||||
containerView.setLayerType(LAYER_TYPE_NONE, null);
|
||||
containerViewBack.setLayerType(LAYER_TYPE_NONE, null);
|
||||
}
|
||||
presentFragmentInternalRemoveOld(removeLast, currentFragment);
|
||||
fragment.onTransitionAnimationEnd(true, false);
|
||||
fragment.onBecomeFullyVisible();
|
||||
containerView.setTranslationX(0);
|
||||
}
|
||||
};
|
||||
fragment.onTransitionAnimationStart(true, false);
|
||||
AnimatorSet animation = fragment.onCustomTransitionAnimation(true, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
onAnimationEndCheck(false);
|
||||
}
|
||||
});
|
||||
if (animation == null) {
|
||||
containerView.setAlpha(0.0f);
|
||||
containerView.setTranslationX(48.0f);
|
||||
if (containerView.isKeyboardVisible || containerViewBack.isKeyboardVisible) {
|
||||
waitingForKeyboardCloseRunnable = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (waitingForKeyboardCloseRunnable != this) {
|
||||
return;
|
||||
}
|
||||
startLayoutAnimation(true, true);
|
||||
}
|
||||
};
|
||||
AndroidUtilities.runOnUIThread(waitingForKeyboardCloseRunnable, 200);
|
||||
} else if (fragment.needDelayOpenAnimation()) {
|
||||
delayedOpenAnimationRunnable = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (delayedOpenAnimationRunnable != this) {
|
||||
return;
|
||||
}
|
||||
delayedOpenAnimationRunnable = null;
|
||||
startLayoutAnimation(true, true);
|
||||
}
|
||||
};
|
||||
AndroidUtilities.runOnUIThread(delayedOpenAnimationRunnable, 200);
|
||||
} else {
|
||||
startLayoutAnimation(true, true);
|
||||
}
|
||||
} else {
|
||||
transitionAnimationStartTime = System.currentTimeMillis();
|
||||
transitionAnimationInProgress = true;
|
||||
onOpenAnimationEndRunnable = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (Build.VERSION.SDK_INT > 15) {
|
||||
//containerView.setLayerType(LAYER_TYPE_HARDWARE, null);
|
||||
//containerViewBack.setLayerType(LAYER_TYPE_HARDWARE, null);
|
||||
containerView.setLayerType(LAYER_TYPE_NONE, null);
|
||||
containerViewBack.setLayerType(LAYER_TYPE_NONE, null);
|
||||
}
|
||||
containerView.setAlpha(1.0f);
|
||||
containerView.setTranslationX(0.0f);
|
||||
currentAnimation = animation;
|
||||
presentFragmentInternalRemoveOld(removeLast, currentFragment);
|
||||
fragment.onTransitionAnimationEnd(true, false);
|
||||
fragment.onBecomeFullyVisible();
|
||||
containerView.setTranslationX(0);
|
||||
}
|
||||
};
|
||||
fragment.onTransitionAnimationStart(true, false);
|
||||
{
|
||||
containerView.setAlpha(0.0f);
|
||||
containerView.setTranslationX(48.0f);
|
||||
if (containerView.isKeyboardVisible || containerViewBack.isKeyboardVisible) {
|
||||
waitingForKeyboardCloseRunnable = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (waitingForKeyboardCloseRunnable != this) {
|
||||
return;
|
||||
}
|
||||
startLayoutAnimation(true, true);
|
||||
}
|
||||
};
|
||||
AndroidUtilities.runOnUIThread(waitingForKeyboardCloseRunnable, 200);
|
||||
} else if (fragment.needDelayOpenAnimation()) {
|
||||
delayedOpenAnimationRunnable = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (delayedOpenAnimationRunnable != this) {
|
||||
return;
|
||||
}
|
||||
delayedOpenAnimationRunnable = null;
|
||||
startLayoutAnimation(true, true);
|
||||
}
|
||||
};
|
||||
AndroidUtilities.runOnUIThread(delayedOpenAnimationRunnable, 200);
|
||||
} else {
|
||||
startLayoutAnimation(true, true);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (backgroundView != null) {
|
||||
backgroundView.setAlpha(1.0f);
|
||||
backgroundView.setVisibility(VISIBLE);
|
||||
}
|
||||
fragment.onTransitionAnimationStart(true, false);
|
||||
fragment.onTransitionAnimationEnd(true, false);
|
||||
fragment.onBecomeFullyVisible();
|
||||
@@ -895,7 +833,6 @@ public class ActionBarLayout extends FrameLayout {
|
||||
parent.removeView(previousFragment.actionBar);
|
||||
}
|
||||
containerView.addView(previousFragment.actionBar);
|
||||
previousFragment.actionBar.setTitleOverlayText(titleOverlayText);
|
||||
}
|
||||
containerView.addView(fragmentView);
|
||||
ViewGroup.LayoutParams layoutParams = fragmentView.getLayoutParams();
|
||||
@@ -932,13 +869,8 @@ public class ActionBarLayout extends FrameLayout {
|
||||
previousFragmentFinal.onBecomeFullyVisible();
|
||||
}
|
||||
};
|
||||
AnimatorSet animation = currentFragment.onCustomTransitionAnimation(false, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
onAnimationEndCheck(false);
|
||||
}
|
||||
});
|
||||
if (animation == null) {
|
||||
|
||||
{
|
||||
if (containerView.isKeyboardVisible || containerViewBack.isKeyboardVisible) {
|
||||
waitingForKeyboardCloseRunnable = new Runnable() {
|
||||
@Override
|
||||
@@ -953,12 +885,6 @@ public class ActionBarLayout extends FrameLayout {
|
||||
} else {
|
||||
startLayoutAnimation(false, true);
|
||||
}
|
||||
} else {
|
||||
if (Build.VERSION.SDK_INT > 15) {
|
||||
//containerView.setLayerType(LAYER_TYPE_HARDWARE, null);
|
||||
//containerViewBack.setLayerType(LAYER_TYPE_HARDWARE, null);
|
||||
}
|
||||
currentAnimation = animation;
|
||||
}
|
||||
} else {
|
||||
currentFragment.onTransitionAnimationEnd(false, false);
|
||||
@@ -966,53 +892,8 @@ public class ActionBarLayout extends FrameLayout {
|
||||
previousFragment.onBecomeFullyVisible();
|
||||
}
|
||||
} else {
|
||||
if (useAlphaAnimations) {
|
||||
transitionAnimationStartTime = System.currentTimeMillis();
|
||||
transitionAnimationInProgress = true;
|
||||
|
||||
onCloseAnimationEndRunnable = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
removeFragmentFromStackInternal(currentFragment);
|
||||
setVisibility(GONE);
|
||||
if (backgroundView != null) {
|
||||
backgroundView.setVisibility(GONE);
|
||||
}
|
||||
if (drawerLayoutContainer != null) {
|
||||
drawerLayoutContainer.setAllowOpenDrawer(true, false);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
ArrayList<Animator> animators = new ArrayList<>();
|
||||
animators.add(ObjectAnimator.ofFloat(this, "alpha", 1.0f, 0.0f));
|
||||
if (backgroundView != null) {
|
||||
animators.add(ObjectAnimator.ofFloat(backgroundView, "alpha", 1.0f, 0.0f));
|
||||
}
|
||||
|
||||
currentAnimation = new AnimatorSet();
|
||||
currentAnimation.playTogether(animators);
|
||||
currentAnimation.setInterpolator(accelerateDecelerateInterpolator);
|
||||
currentAnimation.setDuration(200);
|
||||
currentAnimation.addListener(new AnimatorListenerAdapterProxy() {
|
||||
@Override
|
||||
public void onAnimationStart(Animator animation) {
|
||||
transitionAnimationStartTime = System.currentTimeMillis();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAnimationEnd(Animator animation) {
|
||||
onAnimationEndCheck(false);
|
||||
}
|
||||
});
|
||||
currentAnimation.start();
|
||||
} else {
|
||||
removeFragmentFromStackInternal(currentFragment);
|
||||
setVisibility(GONE);
|
||||
if (backgroundView != null) {
|
||||
backgroundView.setVisibility(GONE);
|
||||
}
|
||||
}
|
||||
removeFragmentFromStackInternal(currentFragment);
|
||||
setVisibility(GONE);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1056,7 +937,6 @@ public class ActionBarLayout extends FrameLayout {
|
||||
parent.removeView(previousFragment.actionBar);
|
||||
}
|
||||
containerView.addView(previousFragment.actionBar);
|
||||
previousFragment.actionBar.setTitleOverlayText(titleOverlayText);
|
||||
}
|
||||
containerView.addView(fragmentView);
|
||||
ViewGroup.LayoutParams layoutParams = fragmentView.getLayoutParams();
|
||||
@@ -1078,11 +958,7 @@ public class ActionBarLayout extends FrameLayout {
|
||||
}
|
||||
|
||||
public void removeFragmentFromStack(BaseFragment fragment) {
|
||||
if (useAlphaAnimations && fragmentsStack.size() == 1 && AndroidUtilities.isTablet()) {
|
||||
closeLastFragment(true);
|
||||
} else {
|
||||
removeFragmentFromStackInternal(fragment);
|
||||
}
|
||||
removeFragmentFromStackInternal(fragment);
|
||||
}
|
||||
|
||||
public void removeAllFragments() {
|
||||
@@ -1092,16 +968,6 @@ public class ActionBarLayout extends FrameLayout {
|
||||
}
|
||||
}
|
||||
|
||||
public void rebuildAllFragmentViews(boolean last) {
|
||||
for (int a = 0; a < fragmentsStack.size() - (last ? 0 : 1); a++) {
|
||||
fragmentsStack.get(a).clearViews();
|
||||
fragmentsStack.get(a).setParentLayout(this);
|
||||
}
|
||||
if (delegate != null) {
|
||||
delegate.onRebuildAllFragments(this);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean onKeyUp(int keyCode, KeyEvent event) {
|
||||
if (keyCode == KeyEvent.KEYCODE_MENU && !checkTransitionAnimation() && !startedTracking && currentActionBar != null) {
|
||||
currentActionBar.onMenuButtonPressed();
|
||||
@@ -1184,35 +1050,10 @@ public class ActionBarLayout extends FrameLayout {
|
||||
}
|
||||
}
|
||||
|
||||
public void setUseAlphaAnimations(boolean value) {
|
||||
useAlphaAnimations = value;
|
||||
}
|
||||
|
||||
public void setBackgroundView(View view) {
|
||||
backgroundView = view;
|
||||
}
|
||||
|
||||
public void setDrawerLayoutContainer(DrawerLayoutContainer layout) {
|
||||
drawerLayoutContainer = layout;
|
||||
}
|
||||
|
||||
public DrawerLayoutContainer getDrawerLayoutContainer() {
|
||||
return drawerLayoutContainer;
|
||||
}
|
||||
|
||||
public void setRemoveActionBarExtraHeight(boolean value) {
|
||||
removeActionBarExtraHeight = value;
|
||||
}
|
||||
|
||||
public void setTitleOverlayText(String text) {
|
||||
titleOverlayText = text;
|
||||
for (BaseFragment fragment : fragmentsStack) {
|
||||
if (fragment.actionBar != null) {
|
||||
fragment.actionBar.setTitleOverlayText(titleOverlayText);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasOverlappingRendering() {
|
||||
return false;
|
||||
+3
-2
@@ -21,7 +21,7 @@
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
package com.b44t.ui.ActionBar;
|
||||
package com.b44t.messenger.ActionBar;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.drawable.Drawable;
|
||||
@@ -32,7 +32,7 @@ import android.widget.Toast;
|
||||
import com.b44t.messenger.AndroidUtilities;
|
||||
import com.b44t.messenger.ApplicationLoader;
|
||||
import com.b44t.messenger.R;
|
||||
import com.b44t.ui.Components.LayoutHelper;
|
||||
import com.b44t.messenger.Components.LayoutHelper;
|
||||
|
||||
public class ActionBarMenu extends LinearLayout {
|
||||
|
||||
@@ -104,6 +104,7 @@ public class ActionBarMenu extends LinearLayout {
|
||||
case R.drawable.photo_tools: hint = ApplicationLoader.applicationContext.getString(R.string.EditImage); break;
|
||||
case R.drawable.ic_ab_search: hint = ApplicationLoader.applicationContext.getString(R.string.Search); break;
|
||||
case R.drawable.ic_ab_lock_screen: hint = ApplicationLoader.applicationContext.getString(R.string.Passcode); break;
|
||||
case R.drawable.ic_ab_qr: hint = ApplicationLoader.applicationContext.getString(R.string.QrScan); break;
|
||||
}
|
||||
if( hint != null ) {
|
||||
if( s_menuItemHint != null ) {
|
||||
+4
-21
@@ -21,7 +21,7 @@
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
package com.b44t.ui.ActionBar;
|
||||
package com.b44t.messenger.ActionBar;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Rect;
|
||||
@@ -47,9 +47,7 @@ import android.widget.TextView;
|
||||
import com.b44t.messenger.AndroidUtilities;
|
||||
import com.b44t.messenger.LocaleController;
|
||||
import com.b44t.messenger.R;
|
||||
import com.b44t.ui.Components.LayoutHelper;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import com.b44t.messenger.Components.LayoutHelper;
|
||||
|
||||
public class ActionBarMenuItem extends FrameLayout {
|
||||
|
||||
@@ -214,7 +212,7 @@ public class ActionBarMenuItem extends FrameLayout {
|
||||
subMenuOpenSide = side;
|
||||
}
|
||||
|
||||
public TextView addSubItem(int id, String text, int icon) {
|
||||
public TextView addSubItem(int id, String text) {
|
||||
if (popupLayout == null) {
|
||||
rect = new Rect();
|
||||
location = new int[2];
|
||||
@@ -251,15 +249,6 @@ public class ActionBarMenuItem extends FrameLayout {
|
||||
textView.setMinWidth(AndroidUtilities.dp(196));
|
||||
textView.setTag(id);
|
||||
textView.setText(text);
|
||||
if (icon != 0) {
|
||||
textView.setCompoundDrawablePadding(AndroidUtilities.dp(12));
|
||||
if (!LocaleController.isRTL) {
|
||||
textView.setCompoundDrawablesWithIntrinsicBounds(getResources().getDrawable(icon), null, null, null);
|
||||
} else {
|
||||
textView.setCompoundDrawablesWithIntrinsicBounds(null, null, getResources().getDrawable(icon), null);
|
||||
}
|
||||
}
|
||||
//popupLayout.setShowedFromBotton(showFromBottom);
|
||||
popupLayout.addView(textView);
|
||||
LinearLayout.LayoutParams layoutParams = (LinearLayout.LayoutParams) textView.getLayoutParams();
|
||||
layoutParams.gravity = Gravity.START;
|
||||
@@ -466,13 +455,7 @@ public class ActionBarMenuItem extends FrameLayout {
|
||||
}
|
||||
});
|
||||
|
||||
try {
|
||||
Field mCursorDrawableRes = TextView.class.getDeclaredField("mCursorDrawableRes");
|
||||
mCursorDrawableRes.setAccessible(true);
|
||||
mCursorDrawableRes.set(searchField, R.drawable.search_carret);
|
||||
} catch (Exception e) {
|
||||
//nothing to do
|
||||
}
|
||||
|
||||
searchField.setTextIsSelectable(false);
|
||||
if( applyHack ) {
|
||||
searchField.setOnFocusChangeListener(new View.OnFocusChangeListener() {
|
||||
+2
-2
@@ -23,7 +23,7 @@
|
||||
|
||||
//Thanks to https://github.com/JakeWharton/ActionBarSherlock/
|
||||
|
||||
package com.b44t.ui.ActionBar;
|
||||
package com.b44t.messenger.ActionBar;
|
||||
|
||||
import android.animation.Animator;
|
||||
import android.animation.AnimatorSet;
|
||||
@@ -44,7 +44,7 @@ import android.widget.ScrollView;
|
||||
|
||||
import com.b44t.messenger.AndroidUtilities;
|
||||
import com.b44t.messenger.R;
|
||||
import com.b44t.ui.Components.LayoutHelper;
|
||||
import com.b44t.messenger.Components.LayoutHelper;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.HashMap;
|
||||
+1
-1
@@ -21,7 +21,7 @@
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
package com.b44t.ui.ActionBar;
|
||||
package com.b44t.messenger.ActionBar;
|
||||
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Color;
|
||||
+2
-7
@@ -21,9 +21,8 @@
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
package com.b44t.ui.ActionBar;
|
||||
package com.b44t.messenger.ActionBar;
|
||||
|
||||
import android.animation.AnimatorSet;
|
||||
import android.app.Activity;
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
@@ -286,10 +285,6 @@ public class BaseFragment {
|
||||
|
||||
}
|
||||
|
||||
protected AnimatorSet onCustomTransitionAnimation(boolean isOpen, final Runnable callback) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public void onLowMemory() {
|
||||
|
||||
}
|
||||
@@ -312,7 +307,7 @@ public class BaseFragment {
|
||||
}
|
||||
try {
|
||||
visibleDialog = dialog;
|
||||
visibleDialog.setCanceledOnTouchOutside(true);
|
||||
//visibleDialog.setCanceledOnTouchOutside(true); -- we do overwrite this from time to time manually, eg. for showing the setup code. so, not all dialogs should be cancelled when touching outside!
|
||||
visibleDialog.setOnDismissListener(new DialogInterface.OnDismissListener() {
|
||||
@Override
|
||||
public void onDismiss(DialogInterface dialog) {
|
||||
+3
-7
@@ -21,7 +21,7 @@
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
package com.b44t.ui.ActionBar;
|
||||
package com.b44t.messenger.ActionBar;
|
||||
|
||||
import android.animation.Animator;
|
||||
import android.animation.AnimatorSet;
|
||||
@@ -60,7 +60,7 @@ import com.b44t.messenger.AndroidUtilities;
|
||||
import com.b44t.messenger.AnimatorListenerAdapterProxy;
|
||||
import com.b44t.messenger.LocaleController;
|
||||
import com.b44t.messenger.R;
|
||||
import com.b44t.ui.Components.LayoutHelper;
|
||||
import com.b44t.messenger.Components.LayoutHelper;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
@@ -307,11 +307,7 @@ public class BottomSheet extends Dialog {
|
||||
if (containerView != null) {
|
||||
if (!fullWidth) {
|
||||
int widthSpec;
|
||||
if (AndroidUtilities.isTablet()) {
|
||||
widthSpec = MeasureSpec.makeMeasureSpec((int) (Math.min(AndroidUtilities.displaySize.x, AndroidUtilities.displaySize.y) * 0.8f) + backgroundPaddingLeft * 2, MeasureSpec.EXACTLY);
|
||||
} else {
|
||||
widthSpec = MeasureSpec.makeMeasureSpec(isPortrait ? width + backgroundPaddingLeft * 2 : (int) Math.max(width * 0.8f, Math.min(AndroidUtilities.dp(480), width)) + backgroundPaddingLeft * 2, MeasureSpec.EXACTLY);
|
||||
}
|
||||
widthSpec = MeasureSpec.makeMeasureSpec(isPortrait ? width + backgroundPaddingLeft * 2 : (int) Math.max(width * 0.8f, Math.min(AndroidUtilities.dp(480), width)) + backgroundPaddingLeft * 2, MeasureSpec.EXACTLY);
|
||||
containerView.measure(widthSpec, MeasureSpec.makeMeasureSpec(height, MeasureSpec.AT_MOST));
|
||||
} else {
|
||||
containerView.measure(MeasureSpec.makeMeasureSpec(width + backgroundPaddingLeft * 2, MeasureSpec.EXACTLY), MeasureSpec.makeMeasureSpec(height, MeasureSpec.AT_MOST));
|
||||
+1
-1
@@ -21,7 +21,7 @@
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
package com.b44t.ui.ActionBar;
|
||||
package com.b44t.messenger.ActionBar;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Canvas;
|
||||
+11
-14
@@ -21,7 +21,7 @@
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
package com.b44t.ui.ActionBar;
|
||||
package com.b44t.messenger.ActionBar;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.ColorStateList;
|
||||
@@ -39,7 +39,7 @@ import android.os.Build;
|
||||
import com.b44t.messenger.AndroidUtilities;
|
||||
import com.b44t.messenger.ApplicationLoader;
|
||||
import com.b44t.messenger.R;
|
||||
import com.b44t.ui.Components.ChatAttachAlert;
|
||||
import com.b44t.messenger.Components.ChatAttachAlert;
|
||||
|
||||
public class Theme {
|
||||
|
||||
@@ -60,22 +60,17 @@ public class Theme {
|
||||
|
||||
public static final int ATTACH_SHEET_TEXT_COLOR = 0xff757575;
|
||||
|
||||
public static final int DIALOGS_TITLE_TEXT_COLOR = 0xff000000;
|
||||
public static final int DIALOGS_MESSAGE_TEXT_COLOR = 0xff8f8f8f;
|
||||
public static final int DIALOGS_NAME_TEXT_COLOR = 0xff555555;
|
||||
public static final int DIALOGS_SELF_TEXT_COLOR = 0xff00a60e; // from encrypted chat title: 0xff00a60e, alternative: 0xff3c912e
|
||||
public static final int DIALOGS_PRINTING_TEXT_COLOR = 0xff4d83b3;
|
||||
public static final int DIALOGS_DRAFT_TEXT_COLOR = 0xffdd4b39;
|
||||
public static final int CHATLIST_BACKGROUND_COLOR = 0xffffffff;
|
||||
public static final int CHATLIST_DEADDROP_BACKGROUND_COLOR = 0xffd3d3d3;
|
||||
public static final int CHATLIST_TITLE_TEXT_COLOR = 0xff000000;
|
||||
public static final int CHATLIST_MESSAGE_TEXT_COLOR = 0xff8f8f8f;
|
||||
public static final int CHATLIST_NAME_TEXT_COLOR = 0xff555555;
|
||||
public static final int CHATLIST_SELF_TEXT_COLOR = 0xff00a60e; // from encrypted chat title: 0xff00a60e, alternative: 0xff3c912e
|
||||
public static final int CHATLIST_DRAFT_TEXT_COLOR = 0xffdd4b39;
|
||||
|
||||
public static final int CHAT_BOTTOM_OVERLAY_TEXT_COLOR = 0xff7f7f7f;
|
||||
public static final int CHAT_EMPTY_VIEW_TEXT_COLOR = 0xffffffff;
|
||||
|
||||
public static final int STICKERS_SHEET_TITLE_TEXT_COLOR = 0xff212121;
|
||||
public static final int STICKERS_SHEET_SEND_TEXT_COLOR = 0xff3a8ccf;
|
||||
public static final int STICKERS_SHEET_ADD_TEXT_COLOR = 0xff3a8ccf;
|
||||
public static final int STICKERS_SHEET_CLOSE_TEXT_COLOR = 0xff3a8ccf;
|
||||
public static final int STICKERS_SHEET_REMOVE_TEXT_COLOR = 0xffcd5a5a;
|
||||
|
||||
public static final int MSG_SELECTED_BACKGROUND_COLOR = 0x6633b5e5;
|
||||
public static final int MSG_STICKER_NAME_TEXT_COLOR = 0xffffffff;
|
||||
public static final int MSG_IN_TIME_N_FWD_TEXT_COLOR = 0xff9ea7b0;
|
||||
@@ -96,6 +91,8 @@ public class Theme {
|
||||
public static final int MSG_AUDIO_SEEKBAR_DARK_COLOR = 0xFFf68751; // same color as in audio-icon, also used for the record-button
|
||||
public static final int MSG_AUDIO_SEEKBAR_LITE_COLOR = 0xFFfbc8af;
|
||||
|
||||
public static final int MSG_SYSTEM_CMD_COLOR = MSG_AUDIO_NAME_COLOR; // just the same color, there is no other dependency between system commands and audio messages
|
||||
|
||||
public static Drawable backgroundDrawableIn;
|
||||
public static Drawable backgroundDrawableInSelected;
|
||||
public static Drawable backgroundDrawableOut;
|
||||
@@ -51,6 +51,7 @@ import android.support.v4.content.FileProvider;
|
||||
import android.text.SpannableStringBuilder;
|
||||
import android.text.Spanned;
|
||||
import android.text.style.ForegroundColorSpan;
|
||||
import android.text.style.StyleSpan;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.util.Log;
|
||||
import android.util.StateSet;
|
||||
@@ -60,15 +61,11 @@ import android.view.View;
|
||||
import android.view.WindowManager;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
import android.webkit.MimeTypeMap;
|
||||
import android.widget.AbsListView;
|
||||
import android.widget.EdgeEffect;
|
||||
import android.widget.EditText;
|
||||
import android.widget.ListView;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.b44t.ui.Components.ForegroundDetector;
|
||||
import com.b44t.ui.Components.TypefaceSpan;
|
||||
import com.b44t.messenger.Components.ForegroundDetector;
|
||||
import com.b44t.messenger.Components.TypefaceSpan;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.File;
|
||||
@@ -83,9 +80,7 @@ import java.nio.channels.FileChannel;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.Hashtable;
|
||||
import java.util.Locale;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
public class AndroidUtilities {
|
||||
|
||||
@@ -98,35 +93,16 @@ public class AndroidUtilities {
|
||||
public static DisplayMetrics displayMetrics = new DisplayMetrics();
|
||||
public static int leftBaseline;
|
||||
public static boolean usingHardwareInput;
|
||||
private static Boolean isTablet = null;
|
||||
private static int adjustOwnerClassGuid = 0;
|
||||
|
||||
static {
|
||||
try {
|
||||
final String GOOD_IRI_CHAR = "a-zA-Z0-9\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF";
|
||||
final Pattern IP_ADDRESS = Pattern.compile(
|
||||
"((25[0-5]|2[0-4][0-9]|[0-1][0-9]{2}|[1-9][0-9]|[1-9])\\.(25[0-5]|2[0-4]"
|
||||
+ "[0-9]|[0-1][0-9]{2}|[1-9][0-9]|[1-9]|0)\\.(25[0-5]|2[0-4][0-9]|[0-1]"
|
||||
+ "[0-9]{2}|[1-9][0-9]|[1-9]|0)\\.(25[0-5]|2[0-4][0-9]|[0-1][0-9]{2}"
|
||||
+ "|[1-9][0-9]|[0-9]))");
|
||||
final String IRI = "[" + GOOD_IRI_CHAR + "]([" + GOOD_IRI_CHAR + "\\-]{0,61}[" + GOOD_IRI_CHAR + "]){0,1}";
|
||||
final String GOOD_GTLD_CHAR = "a-zA-Z\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF";
|
||||
final String GTLD = "[" + GOOD_GTLD_CHAR + "]{2,63}";
|
||||
final String HOST_NAME = "(" + IRI + "\\.)+" + GTLD;
|
||||
final Pattern DOMAIN_NAME = Pattern.compile("(" + HOST_NAME + "|" + IP_ADDRESS + ")");
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
static {
|
||||
density = ApplicationLoader.applicationContext.getResources().getDisplayMetrics().density;
|
||||
leftBaseline = isTablet() ? 80 : 72;
|
||||
leftBaseline = 72;
|
||||
checkDisplaySize();
|
||||
}
|
||||
|
||||
public static void requestAdjustResize(Activity activity, int classGuid) {
|
||||
if (activity == null || isTablet()) {
|
||||
if (activity == null) {
|
||||
return;
|
||||
}
|
||||
activity.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
|
||||
@@ -134,7 +110,7 @@ public class AndroidUtilities {
|
||||
}
|
||||
|
||||
public static void removeAdjustResize(Activity activity, int classGuid) {
|
||||
if (activity == null || isTablet()) {
|
||||
if (activity == null ) {
|
||||
return;
|
||||
}
|
||||
if (adjustOwnerClassGuid == classGuid) {
|
||||
@@ -330,43 +306,6 @@ public class AndroidUtilities {
|
||||
ApplicationLoader.applicationHandler.removeCallbacks(runnable);
|
||||
}
|
||||
|
||||
public static boolean isTablet() {
|
||||
/* -- we do not make any special for tablet or not. _If_ sth. like this is desired, check for an appropriate screen size.
|
||||
if (isTablet == null) {
|
||||
isTablet = ApplicationLoader.applicationContext.getResources().getBoolean(R.bool.isTablet);
|
||||
}
|
||||
return isTablet;
|
||||
*/
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean isSmallTablet() {
|
||||
/*
|
||||
float minSide = Math.min(displaySize.x, displaySize.y) / density;
|
||||
return minSide <= 700;
|
||||
*/
|
||||
return false;
|
||||
}
|
||||
|
||||
public static int getMinTabletSide() {
|
||||
if (!isSmallTablet()) {
|
||||
int smallSide = Math.min(displaySize.x, displaySize.y);
|
||||
int leftSide = smallSide * 35 / 100;
|
||||
if (leftSide < dp(320)) {
|
||||
leftSide = dp(320);
|
||||
}
|
||||
return smallSide - leftSide;
|
||||
} else {
|
||||
int smallSide = Math.min(displaySize.x, displaySize.y);
|
||||
int maxSide = Math.max(displaySize.x, displaySize.y);
|
||||
int leftSide = maxSide * 35 / 100;
|
||||
if (leftSide < dp(320)) {
|
||||
leftSide = dp(320);
|
||||
}
|
||||
return Math.min(smallSide, maxSide - leftSide);
|
||||
}
|
||||
}
|
||||
|
||||
public static int getPhotoSize() {
|
||||
if (photoSize == null) {
|
||||
if (Build.VERSION.SDK_INT >= 16) {
|
||||
@@ -378,19 +317,6 @@ public class AndroidUtilities {
|
||||
return photoSize;
|
||||
}
|
||||
|
||||
public static void clearCursorDrawable(EditText editText) {
|
||||
if (editText == null) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
Field mCursorDrawableRes = TextView.class.getDeclaredField("mCursorDrawableRes");
|
||||
mCursorDrawableRes.setAccessible(true);
|
||||
mCursorDrawableRes.setInt(editText, 0);
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private static Intent createShortcutIntent(int did, Bitmap bitmap) {
|
||||
Intent shortcutIntent = new Intent(ApplicationLoader.applicationContext, OpenChatReceiver.class);
|
||||
|
||||
@@ -509,59 +435,67 @@ public class AndroidUtilities {
|
||||
}
|
||||
}
|
||||
|
||||
public static final int FLAG_TAG_BR = 1;
|
||||
public static final int FLAG_TAG_BOLD = 2;
|
||||
public static final int FLAG_TAG_COLOR = 4;
|
||||
public static final int FLAG_TAG_ALL = FLAG_TAG_BR | FLAG_TAG_BOLD | FLAG_TAG_COLOR;
|
||||
|
||||
public static SpannableStringBuilder replaceTags(String str) {
|
||||
return replaceTags(str, FLAG_TAG_ALL);
|
||||
}
|
||||
|
||||
public static SpannableStringBuilder replaceTags(String str, int flag) {
|
||||
try {
|
||||
int start;
|
||||
int end;
|
||||
StringBuilder stringBuilder = new StringBuilder(str);
|
||||
if ((flag & FLAG_TAG_BR) != 0) {
|
||||
while ((start = stringBuilder.indexOf("<br>")) != -1) {
|
||||
stringBuilder.replace(start, start + 4, "\n");
|
||||
}
|
||||
while ((start = stringBuilder.indexOf("<br/>")) != -1) {
|
||||
stringBuilder.replace(start, start + 5, "\n");
|
||||
}
|
||||
|
||||
// breaks
|
||||
while ((start = stringBuilder.indexOf("<br>")) != -1) {
|
||||
stringBuilder.replace(start, start + 4, "\n");
|
||||
}
|
||||
while ((start = stringBuilder.indexOf("<br/>")) != -1) {
|
||||
stringBuilder.replace(start, start + 5, "\n");
|
||||
}
|
||||
|
||||
// bold
|
||||
ArrayList<Integer> bolds = new ArrayList<>();
|
||||
if ((flag & FLAG_TAG_BOLD) != 0) {
|
||||
while ((start = stringBuilder.indexOf("<b>")) != -1) {
|
||||
stringBuilder.replace(start, start + 3, "");
|
||||
end = stringBuilder.indexOf("</b>");
|
||||
if (end == -1) {
|
||||
end = stringBuilder.indexOf("<b>");
|
||||
}
|
||||
stringBuilder.replace(end, end + 4, "");
|
||||
bolds.add(start);
|
||||
bolds.add(end);
|
||||
while ((start = stringBuilder.indexOf("<b>")) != -1) {
|
||||
stringBuilder.replace(start, start + 3, "");
|
||||
end = stringBuilder.indexOf("</b>");
|
||||
if (end == -1) {
|
||||
end = stringBuilder.indexOf("<b>");
|
||||
}
|
||||
stringBuilder.replace(end, end + 4, "");
|
||||
bolds.add(start);
|
||||
bolds.add(end);
|
||||
}
|
||||
|
||||
// italics
|
||||
ArrayList<Integer> italics = new ArrayList<>();
|
||||
while ((start = stringBuilder.indexOf("<i>")) != -1) {
|
||||
stringBuilder.replace(start, start + 3, "");
|
||||
end = stringBuilder.indexOf("</i>");
|
||||
if (end == -1) {
|
||||
end = stringBuilder.indexOf("<i>");
|
||||
}
|
||||
stringBuilder.replace(end, end + 4, "");
|
||||
italics.add(start);
|
||||
italics.add(end);
|
||||
}
|
||||
|
||||
// color - used eg. by the message preview when following a mailto:-link
|
||||
ArrayList<Integer> colors = new ArrayList<>();
|
||||
if ((flag & FLAG_TAG_COLOR) != 0) { // used eg. by the message preview when following a mailto:-link
|
||||
while ((start = stringBuilder.indexOf("<c#")) != -1) {
|
||||
stringBuilder.replace(start, start + 2, "");
|
||||
end = stringBuilder.indexOf(">", start);
|
||||
int color = Color.parseColor(stringBuilder.substring(start, end));
|
||||
stringBuilder.replace(start, end + 1, "");
|
||||
end = stringBuilder.indexOf("</c>");
|
||||
stringBuilder.replace(end, end + 4, "");
|
||||
colors.add(start);
|
||||
colors.add(end);
|
||||
colors.add(color);
|
||||
}
|
||||
while ((start = stringBuilder.indexOf("<c#")) != -1) {
|
||||
stringBuilder.replace(start, start + 2, "");
|
||||
end = stringBuilder.indexOf(">", start);
|
||||
int color = Color.parseColor(stringBuilder.substring(start, end));
|
||||
stringBuilder.replace(start, end + 1, "");
|
||||
end = stringBuilder.indexOf("</c>");
|
||||
stringBuilder.replace(end, end + 4, "");
|
||||
colors.add(start);
|
||||
colors.add(end);
|
||||
colors.add(color);
|
||||
}
|
||||
|
||||
SpannableStringBuilder spannableStringBuilder = new SpannableStringBuilder(stringBuilder);
|
||||
for (int a = 0; a < bolds.size() / 2; a++) {
|
||||
spannableStringBuilder.setSpan(new TypefaceSpan(Typeface.DEFAULT_BOLD), bolds.get(a * 2), bolds.get(a * 2 + 1), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
}
|
||||
for (int a = 0; a < italics.size() / 2; a++) {
|
||||
spannableStringBuilder.setSpan(new StyleSpan(Typeface.ITALIC), italics.get(a * 2), italics.get(a * 2 + 1), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
}
|
||||
for (int a = 0; a < colors.size() / 3; a++) {
|
||||
spannableStringBuilder.setSpan(new ForegroundColorSpan(colors.get(a * 3 + 2)), colors.get(a * 3), colors.get(a * 3 + 1), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
}
|
||||
@@ -886,8 +820,8 @@ public class AndroidUtilities {
|
||||
public static void openForViewOrShare(Activity activity, int msg_id, String cmd)
|
||||
{
|
||||
MrMsg msg = MrMailbox.getMsg(msg_id);
|
||||
String path = msg.getParam('f', "");
|
||||
String mimeType = getMimetype(path, msg.getParam('m', "application/octet-stream"));
|
||||
String path = msg.getFile();
|
||||
String mimeType = getMimetype(path, msg.getFilemime());
|
||||
try {
|
||||
File file = new File(path);
|
||||
if( !file.exists() ) {
|
||||
@@ -958,8 +892,8 @@ public class AndroidUtilities {
|
||||
|
||||
MrMsg msg = MrMailbox.getMsg(msg_id);
|
||||
final int msg_type = msg.getType();
|
||||
String msg_file_path = msg.getParam('f', "");
|
||||
final String msg_mime = msg.getParam('m', "application/octet-stream");
|
||||
String msg_file_path = msg.getFile();
|
||||
final String msg_mime = msg.getFilemime();
|
||||
final String msg_file_name = msg.getFilename();
|
||||
final File sourceFile = new File(msg_file_path);
|
||||
if( !sourceFile.exists() ) {
|
||||
|
||||
@@ -24,9 +24,7 @@
|
||||
package com.b44t.messenger;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.AlarmManager;
|
||||
import android.app.Application;
|
||||
import android.app.PendingIntent;
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
@@ -40,11 +38,9 @@ import android.net.ConnectivityManager;
|
||||
import android.net.NetworkInfo;
|
||||
import android.os.Handler;
|
||||
import android.os.PowerManager;
|
||||
import android.os.SystemClock;
|
||||
import android.util.Log;
|
||||
|
||||
import com.b44t.ui.Components.ForegroundDetector;
|
||||
import com.b44t.ui.SettingsAdvActivity;
|
||||
import com.b44t.messenger.Components.ForegroundDetector;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
@@ -72,7 +68,7 @@ public class ApplicationLoader extends Application {
|
||||
}
|
||||
|
||||
public static int getServiceMessageColor() {
|
||||
return 0x44000000; // this color is used as a background for date headlines, empty chat hints and in the drawer
|
||||
return 0x44000000; // this color is used as a background for date headlines and empty chat hints
|
||||
}
|
||||
|
||||
public static void loadWallpaper() {
|
||||
@@ -182,7 +178,7 @@ public class ApplicationLoader extends Application {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
// track screen on/ff
|
||||
// track screen on/off
|
||||
try {
|
||||
final IntentFilter filter = new IntentFilter(Intent.ACTION_SCREEN_ON);
|
||||
filter.addAction(Intent.ACTION_SCREEN_OFF);
|
||||
@@ -207,9 +203,10 @@ public class ApplicationLoader extends Application {
|
||||
|
||||
// make sure, the notifications for the "deaddrop" dialog are muted by default
|
||||
SharedPreferences notificationPreferences = ApplicationLoader.applicationContext.getSharedPreferences("Notifications", Activity.MODE_PRIVATE);
|
||||
if( notificationPreferences.getInt("notify2_"+MrChat.MR_CHAT_ID_DEADDROP, 666)==666 ) {
|
||||
if( notificationPreferences.getInt("deaddrop_initialized", 0)!=1 ) {
|
||||
SharedPreferences.Editor editor = notificationPreferences.edit();
|
||||
editor.putInt("notify2_"+MrChat.MR_CHAT_ID_DEADDROP, 2);
|
||||
editor.putInt("deaddrop_initialized", 1);
|
||||
editor.apply();
|
||||
}
|
||||
|
||||
@@ -223,10 +220,11 @@ public class ApplicationLoader extends Application {
|
||||
|
||||
// create other default objects
|
||||
SharedPreferences mainPreferences = ApplicationLoader.applicationContext.getSharedPreferences("mainconfig", Activity.MODE_PRIVATE);
|
||||
fontSize = mainPreferences.getInt("msg_font_size", SettingsAdvActivity.defMsgFontSize());
|
||||
fontSize = mainPreferences.getInt("msg_font_size", SettingsAdvFragment.defMsgFontSize());
|
||||
|
||||
ImageLoader.getInstance();
|
||||
MediaController.getInstance();
|
||||
NotificationsController.getInstance(); // force instace creation which also does some init stuff
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+9
-22
@@ -20,7 +20,7 @@
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
package com.b44t.ui;
|
||||
package com.b44t.messenger;
|
||||
|
||||
import android.content.Context;
|
||||
import android.database.Cursor;
|
||||
@@ -32,24 +32,13 @@ import android.widget.AdapterView;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.ListView;
|
||||
|
||||
import com.b44t.messenger.AndroidUtilities;
|
||||
import com.b44t.messenger.LocaleController;
|
||||
import com.b44t.messenger.MediaController;
|
||||
import com.b44t.messenger.MessageObject;
|
||||
import com.b44t.messenger.MrContact;
|
||||
import com.b44t.messenger.NotificationCenter;
|
||||
import com.b44t.messenger.ApplicationLoader;
|
||||
import com.b44t.messenger.FileLoader;
|
||||
import com.b44t.messenger.R;
|
||||
import com.b44t.messenger.TLRPC;
|
||||
import com.b44t.messenger.Utilities;
|
||||
import com.b44t.ui.ActionBar.ActionBar;
|
||||
import com.b44t.ui.ActionBar.BaseFragment;
|
||||
import com.b44t.ui.Adapters.BaseFragmentAdapter;
|
||||
import com.b44t.ui.Cells.AudioCell;
|
||||
import com.b44t.ui.Components.EmptyTextProgressView;
|
||||
import com.b44t.ui.Components.LayoutHelper;
|
||||
import com.b44t.ui.Components.PickerBottomLayout;
|
||||
import com.b44t.messenger.ActionBar.ActionBar;
|
||||
import com.b44t.messenger.ActionBar.BaseFragment;
|
||||
import com.b44t.messenger.Components.BaseFragmentAdapter;
|
||||
import com.b44t.messenger.Cells.AudioCell;
|
||||
import com.b44t.messenger.Components.EmptyTextProgressView;
|
||||
import com.b44t.messenger.Components.LayoutHelper;
|
||||
import com.b44t.messenger.Components.PickerBottomLayout;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
@@ -96,7 +85,6 @@ public class AudioSelectActivity extends BaseFragment implements NotificationCen
|
||||
@Override
|
||||
public View createView(Context context) {
|
||||
actionBar.setBackButtonImage(R.drawable.ic_ab_back);
|
||||
actionBar.setAllowOverlayTitle(true);
|
||||
actionBar.setTitle(context.getString(R.string.AttachMusic));
|
||||
actionBar.setActionBarMenuOnItemClick(new ActionBar.ActionBarMenuOnItemClick() {
|
||||
@Override
|
||||
@@ -225,8 +213,7 @@ public class AudioSelectActivity extends BaseFragment implements NotificationCen
|
||||
TLRPC.TL_message message = new TLRPC.TL_message();
|
||||
message.out = true;
|
||||
message.id = id;
|
||||
message.to_id = new TLRPC.TL_peerUser();
|
||||
message.to_id.user_id = message.from_id = MrContact.MR_CONTACT_ID_SELF;
|
||||
message.from_id = MrContact.MR_CONTACT_ID_SELF;
|
||||
message.date = (int) (System.currentTimeMillis() / 1000);
|
||||
message.message = "-1";
|
||||
message.attachPath = audioEntry.path;
|
||||
@@ -38,7 +38,7 @@ public class AutoMessageHeardReceiver extends BroadcastReceiver {
|
||||
if (dialog_id == 0 || max_id == 0) {
|
||||
return;
|
||||
}
|
||||
MrMailbox.markseenChat((int)dialog_id);
|
||||
MrMailbox.marknoticedChat((int)dialog_id);
|
||||
NotificationsController.getInstance().removeSeenMessages();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ public class AutoMessageReplyReceiver extends BroadcastReceiver {
|
||||
return;
|
||||
}
|
||||
SendMessagesHelper.getInstance().sendMessageText(text.toString(), dialog_id, null);
|
||||
MrMailbox.markseenChat((int)dialog_id);
|
||||
MrMailbox.marknoticedChat((int)dialog_id);
|
||||
NotificationsController.getInstance().removeSeenMessages();
|
||||
}
|
||||
}
|
||||
|
||||
+9
-16
@@ -21,7 +21,7 @@
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
package com.b44t.ui;
|
||||
package com.b44t.messenger;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.content.Context;
|
||||
@@ -36,18 +36,12 @@ import android.widget.FrameLayout;
|
||||
import android.widget.ListView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.b44t.messenger.ApplicationLoader;
|
||||
import com.b44t.messenger.LocaleController;
|
||||
import com.b44t.messenger.MrContact;
|
||||
import com.b44t.messenger.MrMailbox;
|
||||
import com.b44t.messenger.NotificationCenter;
|
||||
import com.b44t.messenger.R;
|
||||
import com.b44t.ui.Adapters.BaseFragmentAdapter;
|
||||
import com.b44t.ui.Cells.UserCell;
|
||||
import com.b44t.ui.ActionBar.ActionBar;
|
||||
import com.b44t.ui.ActionBar.ActionBarMenu;
|
||||
import com.b44t.ui.ActionBar.BaseFragment;
|
||||
import com.b44t.ui.Components.LayoutHelper;
|
||||
import com.b44t.messenger.Components.BaseFragmentAdapter;
|
||||
import com.b44t.messenger.Cells.UserCell;
|
||||
import com.b44t.messenger.ActionBar.ActionBar;
|
||||
import com.b44t.messenger.ActionBar.ActionBarMenu;
|
||||
import com.b44t.messenger.ActionBar.BaseFragment;
|
||||
import com.b44t.messenger.Components.LayoutHelper;
|
||||
|
||||
public class BlockedUsersActivity extends BaseFragment implements NotificationCenter.NotificationCenterDelegate, ContactsActivity.ContactsActivityDelegate {
|
||||
|
||||
@@ -79,7 +73,6 @@ public class BlockedUsersActivity extends BaseFragment implements NotificationCe
|
||||
@Override
|
||||
public View createView(final Context context) {
|
||||
actionBar.setBackButtonImage(R.drawable.ic_ab_back);
|
||||
actionBar.setAllowOverlayTitle(true);
|
||||
actionBar.setTitle(ApplicationLoader.applicationContext.getString(R.string.BlockedContacts));
|
||||
actionBar.setActionBarMenuOnItemClick(new ActionBar.ActionBarMenuOnItemClick() {
|
||||
@Override
|
||||
@@ -243,11 +236,11 @@ public class BlockedUsersActivity extends BaseFragment implements NotificationCe
|
||||
@Override
|
||||
public View getView(int i, View view, ViewGroup viewGroup) {
|
||||
if (view == null) {
|
||||
view = new UserCell(mContext, 1, 0);
|
||||
view = new UserCell(mContext,0);
|
||||
}
|
||||
if (i>=0 && i<blockedUserIds.length) {
|
||||
MrContact mrContact = MrMailbox.getContact(blockedUserIds[i]);
|
||||
((UserCell) view).setData(mrContact, 0);
|
||||
((UserCell) view).setData(mrContact);
|
||||
}
|
||||
return view;
|
||||
}
|
||||
+3
-3
@@ -21,7 +21,7 @@
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
package com.b44t.ui.Cells;
|
||||
package com.b44t.messenger.Cells;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Paint;
|
||||
@@ -38,8 +38,8 @@ import com.b44t.messenger.LocaleController;
|
||||
import com.b44t.messenger.MediaController;
|
||||
import com.b44t.messenger.MessageObject;
|
||||
import com.b44t.messenger.R;
|
||||
import com.b44t.ui.Components.CheckBoxView;
|
||||
import com.b44t.ui.Components.LayoutHelper;
|
||||
import com.b44t.messenger.Components.CheckBoxView;
|
||||
import com.b44t.messenger.Components.LayoutHelper;
|
||||
|
||||
public class AudioCell extends FrameLayout {
|
||||
|
||||
+1
-1
@@ -21,7 +21,7 @@
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
package com.b44t.ui.Cells;
|
||||
package com.b44t.messenger.Cells;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.drawable.Drawable;
|
||||
+2
-2
@@ -21,7 +21,7 @@
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
package com.b44t.ui.Cells;
|
||||
package com.b44t.messenger.Cells;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Canvas;
|
||||
@@ -35,7 +35,7 @@ import android.view.MotionEvent;
|
||||
import com.b44t.messenger.AndroidUtilities;
|
||||
import com.b44t.messenger.ApplicationLoader;
|
||||
import com.b44t.messenger.MessageObject;
|
||||
import com.b44t.ui.ActionBar.Theme;
|
||||
import com.b44t.messenger.ActionBar.Theme;
|
||||
|
||||
public class ChatActionCell extends BaseCell {
|
||||
|
||||
+93
-179
@@ -21,7 +21,7 @@
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
package com.b44t.ui.Cells;
|
||||
package com.b44t.messenger.Cells;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
@@ -55,16 +55,16 @@ import com.b44t.messenger.MessageObject;
|
||||
import com.b44t.messenger.MrChat;
|
||||
import com.b44t.messenger.MrContact;
|
||||
import com.b44t.messenger.MrMailbox;
|
||||
import com.b44t.messenger.MrPoortext;
|
||||
import com.b44t.messenger.MrLot;
|
||||
import com.b44t.messenger.R;
|
||||
import com.b44t.messenger.TLRPC;
|
||||
import com.b44t.ui.Components.AvatarDrawable;
|
||||
import com.b44t.ui.Components.LinkPath;
|
||||
import com.b44t.ui.Components.SeekBar;
|
||||
import com.b44t.ui.Components.SeekBarWaveform;
|
||||
import com.b44t.ui.Components.StaticLayoutEx;
|
||||
import com.b44t.ui.ActionBar.Theme;
|
||||
import com.b44t.ui.PhotoViewer;
|
||||
import com.b44t.messenger.Components.AvatarDrawable;
|
||||
import com.b44t.messenger.Components.LinkPath;
|
||||
import com.b44t.messenger.Components.SeekBar;
|
||||
import com.b44t.messenger.Components.SeekBarWaveform;
|
||||
import com.b44t.messenger.Components.StaticLayoutEx;
|
||||
import com.b44t.messenger.ActionBar.Theme;
|
||||
import com.b44t.messenger.PhotoViewer;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Locale;
|
||||
@@ -75,6 +75,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||
|
||||
public interface ChatMessageCellDelegate {
|
||||
void didPressedUserAvatar(ChatMessageCell cell, TLRPC.User user);
|
||||
void didPressedSetupMessage(ChatMessageCell cell);
|
||||
void didLongPressed(ChatMessageCell cell);
|
||||
void didPressedUrl(MessageObject messageObject, ClickableSpan url, boolean longPress);
|
||||
void didPressedImage(ChatMessageCell cell);
|
||||
@@ -197,8 +198,6 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||
|
||||
private static TextPaint timePaint;
|
||||
private static TextPaint namePaint;
|
||||
private static TextPaint forwardNamePaint;
|
||||
private static TextPaint forward2NamePaint;
|
||||
|
||||
private int backgroundWidth = 100;
|
||||
|
||||
@@ -208,7 +207,8 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||
private ImageReceiver avatarImage;
|
||||
private AvatarDrawable avatarDrawable;
|
||||
private boolean avatarPressed;
|
||||
private boolean forwardNamePressed;
|
||||
|
||||
private boolean setupmessagePressed;
|
||||
|
||||
private boolean drawNewchatButton;
|
||||
private boolean newchatPressed;
|
||||
@@ -223,12 +223,11 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||
private boolean drawName;
|
||||
private boolean drawNameLayout;
|
||||
|
||||
private StaticLayout[] forwardedNameLayout = new StaticLayout[2];
|
||||
private boolean allowForwardedName;
|
||||
private static TextPaint forwardedNamePaint;
|
||||
private StaticLayout forwardedNameLayout;
|
||||
private int forwardedNameWidth;
|
||||
private boolean drawForwardedName;
|
||||
private int forwardNameX;
|
||||
private int forwardNameY;
|
||||
private float forwardNameOffsetX[] = new float[2];
|
||||
private float forwardedNameOffsetX;
|
||||
|
||||
private StaticLayout timeLayout;
|
||||
private int timeWidth; // includes timeEncrWidth
|
||||
@@ -238,11 +237,9 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||
private boolean drawTime = true;
|
||||
|
||||
private TLRPC.User currentUser;
|
||||
private final Object currentChat = null;
|
||||
private TLRPC.FileLocation currentPhoto;
|
||||
private String currentNameString;
|
||||
|
||||
private String currentForwardNameString;
|
||||
|
||||
private ChatMessageCellDelegate delegate;
|
||||
|
||||
@@ -287,12 +284,8 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||
namePaint.setTypeface(Typeface.DEFAULT_BOLD);
|
||||
namePaint.setTextSize(dp(14));
|
||||
|
||||
forwardNamePaint = new TextPaint(TextPaint.ANTI_ALIAS_FLAG);
|
||||
forwardNamePaint.setTextSize(dp(14));
|
||||
|
||||
forward2NamePaint = new TextPaint(TextPaint.ANTI_ALIAS_FLAG);
|
||||
forward2NamePaint.setTypeface(Typeface.DEFAULT_BOLD);
|
||||
forward2NamePaint.setTextSize(dp(14));
|
||||
forwardedNamePaint = new TextPaint(TextPaint.ANTI_ALIAS_FLAG);
|
||||
forwardedNamePaint.setTextSize(dp(14));
|
||||
}
|
||||
avatarImage = new ImageReceiver(this);
|
||||
avatarImage.setRoundRadius(dp(21));
|
||||
@@ -524,7 +517,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||
imagePressed = true;
|
||||
result = true;
|
||||
}
|
||||
} else if (currentMessageObject.type != MessageObject.MO_TYPE13_STICKER || currentMessageObject.getInputStickerSet() != null) {
|
||||
} else if (currentMessageObject.type != MessageObject.MO_TYPE13_STICKER ) {
|
||||
if (x >= photoImage.getImageX() && x <= photoImage.getImageX() + backgroundWidth && y >= photoImage.getImageY() && y <= photoImage.getImageY() + photoImage.getImageHeight()) {
|
||||
imagePressed = true;
|
||||
result = true;
|
||||
@@ -664,14 +657,15 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||
if (isAvatarVisible && avatarImage.isInsideImage(x, y)) {
|
||||
avatarPressed = true;
|
||||
result = true;
|
||||
} else if (drawForwardedName && forwardedNameLayout[0] != null && x >= forwardNameX && x <= forwardNameX + forwardedNameWidth && y >= forwardNameY && y <= forwardNameY + dp(32)) {
|
||||
forwardNamePressed = true;
|
||||
result = true;
|
||||
} else if (drawNewchatButton && x >= newchatStartX && x <= newchatStartX + dp(40) && y >= newchatStartY && y <= newchatStartY + dp(32)) {
|
||||
newchatPressed = true;
|
||||
result = true;
|
||||
invalidate();
|
||||
} else if( currentMessageObject.messageOwner.is_setup_message && currentBackgroundDrawable.getBounds().contains((int)x, (int)y) ) {
|
||||
setupmessagePressed = true;
|
||||
result = true;
|
||||
}
|
||||
|
||||
if (result) {
|
||||
startCheckLongPress();
|
||||
}
|
||||
@@ -696,14 +690,16 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||
avatarPressed = false;
|
||||
}
|
||||
}
|
||||
} else if (forwardNamePressed) {
|
||||
} else if(setupmessagePressed) {
|
||||
if (event.getAction() == MotionEvent.ACTION_UP) {
|
||||
forwardNamePressed = false;
|
||||
} else if (event.getAction() == MotionEvent.ACTION_CANCEL) {
|
||||
forwardNamePressed = false;
|
||||
setupmessagePressed = false;
|
||||
delegate.didPressedSetupMessage(this);
|
||||
}
|
||||
else if(event.getAction() == MotionEvent.ACTION_CANCEL) {
|
||||
setupmessagePressed = false;
|
||||
} else if (event.getAction() == MotionEvent.ACTION_MOVE) {
|
||||
if (!(x >= forwardNameX && x <= forwardNameX + forwardedNameWidth && y >= forwardNameY && y <= forwardNameY + dp(32))) {
|
||||
forwardNamePressed = false;
|
||||
if( !currentBackgroundDrawable.getBounds().contains((int)x, (int)y) ) {
|
||||
setupmessagePressed = false;
|
||||
}
|
||||
}
|
||||
} else if (newchatPressed) {
|
||||
@@ -867,7 +863,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||
}
|
||||
|
||||
private boolean isUserDataChanged() {
|
||||
if (currentMessageObject == null || currentUser == null && currentChat == null) {
|
||||
if (currentMessageObject == null || currentUser == null) {
|
||||
return false;
|
||||
}
|
||||
if (lastSendState != currentMessageObject.messageOwner.send_state) {
|
||||
@@ -878,12 +874,9 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||
}
|
||||
|
||||
TLRPC.User newUser = null;
|
||||
final TLRPC.Chat newChat = null;
|
||||
if (currentMessageObject.isFromUser()) {
|
||||
newUser = MrMailbox.getUser(currentMessageObject.messageOwner.from_id);
|
||||
} /*else if (currentMessageObject.messageOwner.post) {
|
||||
newChat = MessagesController.getInstance().getChat(currentMessageObject.messageOwner.to_id.channel_id);
|
||||
}*/
|
||||
}
|
||||
TLRPC.FileLocation newPhoto = null;
|
||||
|
||||
if (isAvatarVisible) {
|
||||
@@ -900,8 +893,6 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||
if (drawName && isGroupChat && !currentMessageObject.isOutOwner()) {
|
||||
if (newUser != null) {
|
||||
newNameString = "ErrName"; // use MrContact.getName(), if really needed
|
||||
} else if (newChat != null) {
|
||||
newNameString = newChat.title;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -909,10 +900,6 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||
return true;
|
||||
}
|
||||
|
||||
if (drawForwardedName) {
|
||||
newNameString = currentMessageObject.getForwardedName();
|
||||
return currentForwardNameString == null && newNameString != null || currentForwardNameString != null && newNameString == null || currentForwardNameString != null && newNameString != null && !currentForwardNameString.equals(newNameString);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1046,7 +1033,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||
|
||||
maxWidth = maxWidth - dp(86);
|
||||
|
||||
MrPoortext pt = MrMailbox.getMsg(messageObject.getId()).getMediainfo();
|
||||
MrLot pt = MrMailbox.getMsg(messageObject.getId()).getMediainfo();
|
||||
CharSequence stringFinal = TextUtils.ellipsize(pt.getText2(), audioTitlePaint, maxWidth, TextUtils.TruncateAt.MIDDLE);
|
||||
songLayout = new StaticLayout(stringFinal, audioTitlePaint, maxWidth, Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false);
|
||||
if (songLayout.getLineCount() > 0) {
|
||||
@@ -1083,12 +1070,12 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||
}
|
||||
int minutes = duration / 60;
|
||||
int seconds = duration - minutes * 60;
|
||||
String str = String.format("%d:%02d, %s", minutes, seconds, formatFileSize(documentAttach.size));
|
||||
if( MrMailbox.getMsg(messageObject.getId()).isIncreation()!=0 ) {
|
||||
str = ApplicationLoader.applicationContext.getString(R.string.OneMoment);
|
||||
String infoString = String.format("%d:%02d, %s", minutes, seconds, formatFileSize(documentAttach.size));
|
||||
if( MrMailbox.getMsg(messageObject.getId()).isIncreation() ) {
|
||||
infoString = ApplicationLoader.applicationContext.getString(R.string.OneMoment);
|
||||
}
|
||||
infoWidth = (int) Math.ceil(infoPaint.measureText(str));
|
||||
infoLayout = new StaticLayout(str, infoPaint, infoWidth, Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false);
|
||||
infoWidth = (int) Math.ceil(infoPaint.measureText(infoString));
|
||||
infoLayout = new StaticLayout(infoString, infoPaint, infoWidth, Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1103,30 +1090,24 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||
}
|
||||
docTitleLayout = StaticLayoutEx.createStaticLayout(name, docNamePaint, maxWidth, Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false, TextUtils.TruncateAt.MIDDLE, maxWidth, drawPhotoImage ? 2 : 1);
|
||||
docTitleOffsetX = Integer.MIN_VALUE;
|
||||
int width;
|
||||
if (docTitleLayout != null && docTitleLayout.getLineCount() > 0) {
|
||||
int maxLineWidth = 0;
|
||||
for (int a = 0; a < docTitleLayout.getLineCount(); a++) {
|
||||
maxLineWidth = Math.max(maxLineWidth, (int) Math.ceil(docTitleLayout.getLineWidth(a)));
|
||||
docTitleOffsetX = Math.max(docTitleOffsetX, (int) Math.ceil(-docTitleLayout.getLineLeft(a)));
|
||||
}
|
||||
width = Math.min(maxWidth, maxLineWidth);
|
||||
} else {
|
||||
width = maxWidth;
|
||||
docTitleOffsetX = 0;
|
||||
}
|
||||
|
||||
String str = formatFileSize(documentAttach.size) + " " + FileLoader.getDocumentExtension(documentAttach);
|
||||
infoWidth = Math.min(maxWidth - AndroidUtilities.dp(30), (int) Math.ceil(infoPaint.measureText(str)));
|
||||
CharSequence str2 = TextUtils.ellipsize(str, infoPaint, infoWidth, TextUtils.TruncateAt.END);
|
||||
try {
|
||||
if (infoWidth < 0) {
|
||||
infoWidth = dp(10);
|
||||
}
|
||||
infoLayout = new StaticLayout(str2, infoPaint, infoWidth, Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false);
|
||||
} catch (Exception e) {
|
||||
String infoString = formatFileSize(documentAttach.size) + " " + FileLoader.getDocumentExtension(documentAttach);
|
||||
infoWidth = Math.min(maxWidth - AndroidUtilities.dp(30), (int) Math.ceil(infoPaint.measureText(infoString)));
|
||||
CharSequence str2 = TextUtils.ellipsize(infoString, infoPaint, infoWidth, TextUtils.TruncateAt.END);
|
||||
|
||||
if (infoWidth < 0) {
|
||||
infoWidth = dp(10);
|
||||
}
|
||||
infoLayout = new StaticLayout(str2, infoPaint, infoWidth, Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false);
|
||||
|
||||
if (drawPhotoImage) {
|
||||
currentPhotoObject = FileLoader.getClosestPhotoSizeWithSize(messageObject.photoThumbs, getPhotoSize());
|
||||
@@ -1208,7 +1189,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||
}
|
||||
}
|
||||
|
||||
public void setMessageObject(MessageObject messageObject) {
|
||||
public void setMessageObject(MessageObject messageObject, boolean drawNewchatButton_) {
|
||||
boolean messageChanged = currentMessageObject != messageObject || messageObject.forceUpdate;
|
||||
boolean dataChanged = currentMessageObject == messageObject && isUserDataChanged();
|
||||
if (messageChanged || dataChanged || isPhotoDataChanged(messageObject)) {
|
||||
@@ -1219,9 +1200,8 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||
isCheckPressed = true;
|
||||
isAvatarVisible = false;
|
||||
wasLayout = false;
|
||||
drawNewchatButton = checkNeedDrawNewchatButton(messageObject);
|
||||
drawNewchatButton = drawNewchatButton_;
|
||||
currentUser = null;
|
||||
//currentChat = null;
|
||||
drawNameLayout = false;
|
||||
|
||||
resetPressedLink(-1);
|
||||
@@ -1243,7 +1223,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||
drawBackground = true;
|
||||
drawName = false;
|
||||
useSeekBarWaveform = false;
|
||||
drawForwardedName = false;
|
||||
allowForwardedName = false;
|
||||
mediaBackground = false;
|
||||
availableTimeWidth = 0;
|
||||
photoImage.setNeedsQualityThumb(false);
|
||||
@@ -1258,25 +1238,15 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||
}
|
||||
|
||||
if (messageObject.type == MessageObject.MO_TYPE0_TEXT) {
|
||||
drawForwardedName = true;
|
||||
allowForwardedName = true;
|
||||
|
||||
int maxWidth;
|
||||
if (isTablet()) {
|
||||
if (isGroupChat && !messageObject.isOutOwner() && messageObject.isFromUser()) {
|
||||
maxWidth = getMinTabletSide() - dp(122);
|
||||
drawName = true;
|
||||
} else {
|
||||
drawName = false;
|
||||
maxWidth = getMinTabletSide() - dp(80);
|
||||
}
|
||||
if (isGroupChat && !messageObject.isOutOwner() && messageObject.isFromUser()) {
|
||||
maxWidth = Math.min(displaySize.x, displaySize.y) - dp(122);
|
||||
drawName = true;
|
||||
} else {
|
||||
if (isGroupChat && !messageObject.isOutOwner() && messageObject.isFromUser()) {
|
||||
maxWidth = Math.min(displaySize.x, displaySize.y) - dp(122);
|
||||
drawName = true;
|
||||
} else {
|
||||
maxWidth = Math.min(displaySize.x, displaySize.y) - dp(80);
|
||||
drawName = false;
|
||||
}
|
||||
maxWidth = Math.min(displaySize.x, displaySize.y) - dp(80);
|
||||
drawName = false;
|
||||
}
|
||||
measureTime(messageObject);
|
||||
int timeMore = timeWidth + dp(6);
|
||||
@@ -1309,12 +1279,8 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||
photoImage.setImageBitmap((Drawable) null);
|
||||
calcBackgroundWidth(maxWidth, timeMore, maxChildWidth);
|
||||
} else if (messageObject.type == MessageObject.MO_TYPE2_VOICE) {
|
||||
drawForwardedName = true;
|
||||
if (isTablet()) {
|
||||
backgroundWidth = Math.min(getMinTabletSide() - dp(isGroupChat && messageObject.isFromUser() && !messageObject.isOutOwner() ? 102 : 50), dp(270));
|
||||
} else {
|
||||
backgroundWidth = Math.min(displaySize.x - dp(isGroupChat && messageObject.isFromUser() && !messageObject.isOutOwner() ? 102 : 50), dp(270));
|
||||
}
|
||||
allowForwardedName = true;
|
||||
backgroundWidth = Math.min(displaySize.x - dp(isGroupChat && messageObject.isFromUser() && !messageObject.isOutOwner() ? 102 : 50), dp(270));
|
||||
createDocumentLayout(backgroundWidth, messageObject);
|
||||
|
||||
setMessageObjectInternal(messageObject);
|
||||
@@ -1323,11 +1289,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||
|
||||
updateWaveform(true);
|
||||
} else if (messageObject.type == MessageObject.MO_TYPE14_MUSIC) {
|
||||
if (isTablet()) {
|
||||
backgroundWidth = Math.min(getMinTabletSide() - dp(isGroupChat && messageObject.isFromUser() && !messageObject.isOutOwner() ? 102 : 50), dp(270));
|
||||
} else {
|
||||
backgroundWidth = Math.min(displaySize.x - dp(isGroupChat && messageObject.isFromUser() && !messageObject.isOutOwner() ? 102 : 50), dp(270));
|
||||
}
|
||||
backgroundWidth = Math.min(displaySize.x - dp(isGroupChat && messageObject.isFromUser() && !messageObject.isOutOwner() ? 102 : 50), dp(270));
|
||||
|
||||
createDocumentLayout(backgroundWidth, messageObject);
|
||||
|
||||
@@ -1335,7 +1297,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||
|
||||
totalHeight = dp(80) + namesOffset;
|
||||
} else {
|
||||
drawForwardedName = messageObject.messageOwner.fwd_from != null && messageObject.type != MessageObject.MO_TYPE13_STICKER;
|
||||
allowForwardedName = messageObject.isForwarded() && messageObject.type != MessageObject.MO_TYPE13_STICKER;
|
||||
mediaBackground = messageObject.type != MessageObject.MO_TYPE9_FILE;
|
||||
drawImageButton = false; // we do not want the image button for images
|
||||
drawPhotoImage = true;
|
||||
@@ -1352,12 +1314,8 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||
|
||||
photoImage.setForcePreview(false);
|
||||
if (messageObject.type == MessageObject.MO_TYPE9_FILE) {
|
||||
if (isTablet()) {
|
||||
backgroundWidth = Math.min(getMinTabletSide() - dp(isGroupChat && messageObject.isFromUser() && !messageObject.isOutOwner() ? 102 : 50), dp(270));
|
||||
} else {
|
||||
backgroundWidth = Math.min(displaySize.x - dp(isGroupChat && messageObject.isFromUser() && !messageObject.isOutOwner() ? 102 : 50), dp(270));
|
||||
}
|
||||
if (checkNeedDrawNewchatButton(messageObject)) {
|
||||
backgroundWidth = Math.min(displaySize.x - dp(isGroupChat && messageObject.isFromUser() && !messageObject.isOutOwner() ? 102 : 50), dp(270));
|
||||
if (drawNewchatButton) {
|
||||
backgroundWidth -= dp(20);
|
||||
}
|
||||
int maxWidth = backgroundWidth - dp(86 + 52);
|
||||
@@ -1395,11 +1353,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||
}
|
||||
float maxHeight;
|
||||
float maxWidth;
|
||||
if (isTablet()) {
|
||||
maxHeight = maxWidth = getMinTabletSide() * 0.4f;
|
||||
} else {
|
||||
maxHeight = maxWidth = Math.min(displaySize.x, displaySize.y) * 0.5f;
|
||||
}
|
||||
maxHeight = maxWidth = Math.min(displaySize.x, displaySize.y) * 0.5f;
|
||||
if (photoWidth == 0) {
|
||||
photoHeight = (int) maxHeight;
|
||||
photoWidth = photoHeight + dp(100);
|
||||
@@ -1431,13 +1385,9 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||
}
|
||||
} else {
|
||||
int maxPhotoWidth;
|
||||
if (isTablet()) {
|
||||
maxPhotoWidth = photoWidth = (int) (getMinTabletSide() * 0.7f);
|
||||
} else {
|
||||
maxPhotoWidth = photoWidth = (int) (Math.min(displaySize.x, displaySize.y) * 0.7f);
|
||||
}
|
||||
maxPhotoWidth = photoWidth = (int) (Math.min(displaySize.x, displaySize.y) * 0.7f);
|
||||
photoHeight = photoWidth + dp(100);
|
||||
if (checkNeedDrawNewchatButton(messageObject)) {
|
||||
if (drawNewchatButton) {
|
||||
maxPhotoWidth -= dp(20);
|
||||
photoWidth -= dp(20);
|
||||
}
|
||||
@@ -1604,7 +1554,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||
}
|
||||
setMessageObjectInternal(messageObject);
|
||||
|
||||
if (drawForwardedName) {
|
||||
if (allowForwardedName) {
|
||||
namesOffset += dp(5);
|
||||
} else if (drawNameLayout && messageObject.messageOwner.reply_to_msg_id == 0) {
|
||||
namesOffset += dp(7);
|
||||
@@ -1879,7 +1829,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||
}
|
||||
else if (currentMessageObject.type == MessageObject.MO_TYPE1_PHOTO || documentAttachType == DOCUMENT_ATTACH_TYPE_VIDEO) {
|
||||
if (photoImage.getVisible()) {
|
||||
if (infoLayout != null && (buttonState == BS1_CLICK_TO_PAUSE || buttonState == BS0_CLICK_TO_PLAY || buttonState == BS3_NORMAL)) {
|
||||
if (infoLayout != null /*&& (buttonState == BS1_CLICK_TO_PAUSE || buttonState == BS0_CLICK_TO_PLAY || buttonState == BS3_NORMAL)*/) {
|
||||
infoPaint.setColor(Theme.MSG_MEDIA_INFO_TEXT_COLOR);
|
||||
setDrawableBounds(Theme.timeBackgroundDrawable, photoImage.getImageX() + dp(4), photoImage.getImageY() + dp(4), infoWidth + dp(8), dp(16.5f));
|
||||
Theme.timeBackgroundDrawable.draw(canvas);
|
||||
@@ -1975,18 +1925,10 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||
private int getMaxNameWidth() {
|
||||
if (documentAttachType == DOCUMENT_ATTACH_TYPE_STICKER) {
|
||||
int maxWidth;
|
||||
if (isTablet()) {
|
||||
if (isGroupChat && !currentMessageObject.isOutOwner() && currentMessageObject.isFromUser()) {
|
||||
maxWidth = getMinTabletSide() - dp(42);
|
||||
} else {
|
||||
maxWidth = getMinTabletSide();
|
||||
}
|
||||
if (isGroupChat && !currentMessageObject.isOutOwner() && currentMessageObject.isFromUser()) {
|
||||
maxWidth = Math.min(displaySize.x, displaySize.y) - dp(42);
|
||||
} else {
|
||||
if (isGroupChat && !currentMessageObject.isOutOwner() && currentMessageObject.isFromUser()) {
|
||||
maxWidth = Math.min(displaySize.x, displaySize.y) - dp(42);
|
||||
} else {
|
||||
maxWidth = Math.min(displaySize.x, displaySize.y);
|
||||
}
|
||||
maxWidth = Math.min(displaySize.x, displaySize.y);
|
||||
}
|
||||
return maxWidth - backgroundWidth - dp(57);
|
||||
}
|
||||
@@ -2085,10 +2027,10 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||
}
|
||||
|
||||
private void measureTime(MessageObject messageObject) {
|
||||
currentTimeString = LocaleController.getInstance().formatterDay.format((long) (messageObject.messageOwner.date) * 1000);
|
||||
currentTimeString = LocaleController.getInstance().getFormatterDay().format((long) (messageObject.messageOwner.date) * 1000);
|
||||
timeWidth = (int) Math.ceil(timePaint.measureText(currentTimeString));
|
||||
timeEncrWidth = 0;
|
||||
if( messageObject.messageOwner.e2ee ) {
|
||||
if( messageObject.messageOwner.show_padlock) {
|
||||
timeEncrWidth = Theme.encrOutDrawable.getIntrinsicWidth();
|
||||
timeWidth += timeEncrWidth;
|
||||
}
|
||||
@@ -2098,22 +2040,11 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||
return isPressed() && isCheckPressed || !isCheckPressed && isPressed || isHighlighted;
|
||||
}
|
||||
|
||||
private boolean checkNeedDrawNewchatButton(MessageObject messageObject) {
|
||||
if( messageObject.getDialogId()== MrChat.MR_CHAT_ID_DEADDROP) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private void setMessageObjectInternal(MessageObject messageObject) {
|
||||
|
||||
if (currentMessageObject.isFromUser()) {
|
||||
currentUser = MrMailbox.getUser(currentMessageObject.messageOwner.from_id);
|
||||
} /*else if (currentMessageObject.messageOwner.from_id < 0) {
|
||||
currentChat = MessagesController.getInstance().getChat(-currentMessageObject.messageOwner.from_id);
|
||||
} else if (currentMessageObject.messageOwner.post) {
|
||||
currentChat = MessagesController.getInstance().getChat(currentMessageObject.messageOwner.to_id.channel_id);
|
||||
}*/
|
||||
}
|
||||
|
||||
MrContact mrContact = null;
|
||||
String cname = "";
|
||||
@@ -2139,21 +2070,15 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||
nameWidth = dp(100);
|
||||
}
|
||||
|
||||
if (authorName) {
|
||||
if (currentUser != null) {
|
||||
currentNameString = cname;
|
||||
} /*else if (currentChat != null) {
|
||||
currentNameString = currentChat.title;
|
||||
} */ else {
|
||||
currentNameString = "DELETED";
|
||||
}
|
||||
if (currentUser != null) {
|
||||
currentNameString = cname;
|
||||
} else {
|
||||
currentNameString = "";
|
||||
currentNameString = "DELETED";
|
||||
}
|
||||
CharSequence nameStringFinal = TextUtils.ellipsize(currentNameString.replace('\n', ' '), namePaint, nameWidth, TextUtils.TruncateAt.END);
|
||||
try {
|
||||
nameLayout = new StaticLayout(nameStringFinal, namePaint, nameWidth + dp(2), Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false);
|
||||
if (nameLayout != null && nameLayout.getLineCount() > 0) {
|
||||
if (nameLayout.getLineCount() > 0) {
|
||||
nameWidth = (int) Math.ceil(nameLayout.getLineWidth(0));
|
||||
if (messageObject.type != MessageObject.MO_TYPE13_STICKER) {
|
||||
namesOffset += dp(19);
|
||||
@@ -2174,28 +2099,18 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||
nameWidth = 0;
|
||||
}
|
||||
|
||||
currentForwardNameString = null;
|
||||
forwardedNameLayout[0] = null;
|
||||
forwardedNameLayout[1] = null;
|
||||
forwardedNameLayout = null;
|
||||
forwardedNameWidth = 0;
|
||||
if( drawForwardedName && messageObject.isForwarded() && messageObject.messageOwner.fwd_from!=null )
|
||||
if( allowForwardedName && messageObject.isForwarded() )
|
||||
{
|
||||
currentForwardNameString = messageObject.messageOwner.fwd_from.m_name;
|
||||
|
||||
forwardedNameWidth = getMaxNameWidth();
|
||||
int fromWidth = (int) Math.ceil(forwardNamePaint.measureText(ApplicationLoader.applicationContext.getString(R.string.From) + " "));
|
||||
CharSequence name = TextUtils.ellipsize(currentForwardNameString.replace('\n', ' '), forward2NamePaint, forwardedNameWidth - fromWidth, TextUtils.TruncateAt.END);
|
||||
CharSequence lastLine;
|
||||
lastLine = replaceTags(String.format("%s <b>%s</b>", ApplicationLoader.applicationContext.getString(R.string.From), name));
|
||||
lastLine = TextUtils.ellipsize(lastLine, forwardNamePaint, forwardedNameWidth, TextUtils.TruncateAt.END);
|
||||
try {
|
||||
forwardedNameLayout[1] = new StaticLayout(lastLine, forwardNamePaint, forwardedNameWidth + dp(2), Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false);
|
||||
lastLine = TextUtils.ellipsize(replaceTags(ApplicationLoader.applicationContext.getString(R.string.ForwardedMessage)), forwardNamePaint, forwardedNameWidth, TextUtils.TruncateAt.END);
|
||||
forwardedNameLayout[0] = new StaticLayout(lastLine, forwardNamePaint, forwardedNameWidth + dp(2), Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false);
|
||||
forwardedNameWidth = Math.max((int) Math.ceil(forwardedNameLayout[0].getLineWidth(0)), (int) Math.ceil(forwardedNameLayout[1].getLineWidth(0)));
|
||||
forwardNameOffsetX[0] = forwardedNameLayout[0].getLineLeft(0);
|
||||
forwardNameOffsetX[1] = forwardedNameLayout[1].getLineLeft(0);
|
||||
namesOffset += dp(36);
|
||||
lastLine = TextUtils.ellipsize(replaceTags(ApplicationLoader.applicationContext.getString(R.string.ForwardedMessage)), forwardedNamePaint, forwardedNameWidth, TextUtils.TruncateAt.END);
|
||||
forwardedNameLayout = new StaticLayout(lastLine, forwardedNamePaint, forwardedNameWidth + dp(2), Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false);
|
||||
forwardedNameWidth = (int) Math.ceil(forwardedNameLayout.getLineWidth(0));
|
||||
forwardedNameOffsetX = forwardedNameLayout.getLineLeft(0);
|
||||
namesOffset += dp(18);
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
@@ -2301,24 +2216,23 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||
canvas.restore();
|
||||
}
|
||||
|
||||
if (drawForwardedName && forwardedNameLayout[0] != null && forwardedNameLayout[1] != null) {
|
||||
forwardNameY = dp(10 + (drawNameLayout ? 19 : 0));
|
||||
forwardNamePaint.setColor(Theme.MSG_IN_TIME_N_FWD_TEXT_COLOR);
|
||||
if (allowForwardedName && forwardedNameLayout != null ) {
|
||||
int forwardedNameX = 0;
|
||||
int forwardedNameY = dp(10 + (drawNameLayout ? 19 : 0));
|
||||
forwardedNamePaint.setColor(Theme.MSG_IN_TIME_N_FWD_TEXT_COLOR);
|
||||
if (currentMessageObject.isOutOwner()) {
|
||||
forwardNameX = currentBackgroundDrawable.getBounds().left + dp(11);
|
||||
forwardedNameX = currentBackgroundDrawable.getBounds().left + dp(11);
|
||||
} else {
|
||||
if (mediaBackground) {
|
||||
forwardNameX = currentBackgroundDrawable.getBounds().left + dp(11);
|
||||
forwardedNameX = currentBackgroundDrawable.getBounds().left + dp(11);
|
||||
} else {
|
||||
forwardNameX = currentBackgroundDrawable.getBounds().left + dp(17);
|
||||
forwardedNameX = currentBackgroundDrawable.getBounds().left + dp(17);
|
||||
}
|
||||
}
|
||||
for (int a = 0; a < 2; a++) {
|
||||
canvas.save();
|
||||
canvas.translate(forwardNameX - forwardNameOffsetX[a], forwardNameY + dp(16) * a);
|
||||
forwardedNameLayout[a].draw(canvas);
|
||||
canvas.restore();
|
||||
}
|
||||
canvas.save();
|
||||
canvas.translate(forwardedNameX - forwardedNameOffsetX, forwardedNameY);
|
||||
forwardedNameLayout.draw(canvas);
|
||||
canvas.restore();
|
||||
}
|
||||
|
||||
if (drawTime || !mediaBackground) {
|
||||
+3
-4
@@ -21,21 +21,20 @@
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
package com.b44t.ui.Cells;
|
||||
package com.b44t.messenger.Cells;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Typeface;
|
||||
import android.util.TypedValue;
|
||||
import android.view.Gravity;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.b44t.messenger.AndroidUtilities;
|
||||
import com.b44t.messenger.ApplicationLoader;
|
||||
import com.b44t.messenger.R;
|
||||
import com.b44t.ui.Components.LayoutHelper;
|
||||
import com.b44t.ui.ActionBar.Theme;
|
||||
import com.b44t.messenger.Components.LayoutHelper;
|
||||
import com.b44t.messenger.ActionBar.Theme;
|
||||
|
||||
public class ChatUnreadCell extends FrameLayout {
|
||||
|
||||
+205
-229
@@ -21,7 +21,7 @@
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
package com.b44t.ui.Cells;
|
||||
package com.b44t.messenger.Cells;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Canvas;
|
||||
@@ -39,26 +39,24 @@ import android.text.style.ForegroundColorSpan;
|
||||
import android.view.MotionEvent;
|
||||
|
||||
import com.b44t.messenger.AndroidUtilities;
|
||||
import com.b44t.messenger.ApplicationLoader;
|
||||
import com.b44t.messenger.ContactsController;
|
||||
import com.b44t.messenger.EmojiInputView;
|
||||
import com.b44t.messenger.LocaleController;
|
||||
import com.b44t.messenger.MessageObject;
|
||||
import com.b44t.messenger.MrChat;
|
||||
import com.b44t.messenger.MrLot;
|
||||
import com.b44t.messenger.MrMailbox;
|
||||
import com.b44t.messenger.MrMsg;
|
||||
import com.b44t.messenger.MrPoortext;
|
||||
import com.b44t.messenger.TLRPC;
|
||||
import com.b44t.messenger.Emoji;
|
||||
import com.b44t.messenger.R;
|
||||
import com.b44t.messenger.ImageReceiver;
|
||||
import com.b44t.ui.ActionBar.Theme;
|
||||
import com.b44t.ui.Components.AvatarDrawable;
|
||||
import com.b44t.messenger.ActionBar.Theme;
|
||||
import com.b44t.messenger.Components.AvatarDrawable;
|
||||
|
||||
|
||||
public class DialogCell extends BaseCell {
|
||||
public class ChatlistCell extends BaseCell {
|
||||
|
||||
private static TextPaint namePaint;
|
||||
private static TextPaint messagePaint;
|
||||
private static TextPaint messagePrintingPaint;
|
||||
private static TextPaint timePaint;
|
||||
private static TextPaint countPaint;
|
||||
|
||||
@@ -67,35 +65,29 @@ public class DialogCell extends BaseCell {
|
||||
private static Drawable clockDrawable;
|
||||
private static Drawable errorDrawable;
|
||||
private static Drawable countDrawable;
|
||||
private static Drawable countDrawableGrey;
|
||||
private static Drawable groupDrawable;
|
||||
private static Drawable muteDrawable;
|
||||
private static Drawable verifiedDrawable;
|
||||
private static Drawable closeDrawable;
|
||||
|
||||
private static Paint linePaint;
|
||||
private static Paint backPaint;
|
||||
|
||||
private long currentDialogId;
|
||||
private final boolean isDialogCell = true; // if it is no dialog cell, it is a search cell ...
|
||||
private long currentChatId;
|
||||
private int unreadCount;
|
||||
private int lastSendState;
|
||||
private boolean dialogMuted;
|
||||
private final MessageObject message = null;
|
||||
private int index;
|
||||
private boolean chatMuted;
|
||||
private boolean chatVerified;
|
||||
|
||||
private ImageReceiver avatarImage;
|
||||
private AvatarDrawable avatarDrawable;
|
||||
|
||||
private final Object user = null;
|
||||
private final Object chat = null;
|
||||
|
||||
public boolean useSeparator = false;
|
||||
|
||||
private int nameLeft;
|
||||
private StaticLayout nameLayout;
|
||||
private boolean drawNameGroup;
|
||||
private int nameMuteLeft;
|
||||
private boolean drawGroupIcon;
|
||||
private int nameVerifiedLeft;
|
||||
private int nameLockLeft;
|
||||
private int nameLockTop;
|
||||
private int muteLeft;
|
||||
|
||||
private int timeLeft;
|
||||
private int timeTop = AndroidUtilities.dp(17);
|
||||
@@ -122,37 +114,35 @@ public class DialogCell extends BaseCell {
|
||||
private int countWidth;
|
||||
private StaticLayout countLayout;
|
||||
|
||||
private int avatarTop = AndroidUtilities.dp(10);
|
||||
private boolean drawFlag; // draw a flag as eg. "Archived" below the time
|
||||
private int flagLeft;
|
||||
private int flagWidth;
|
||||
private StaticLayout flagLayout;
|
||||
|
||||
private boolean isSelected;
|
||||
private int avatarLeft;
|
||||
private int avatarTop = AndroidUtilities.dp(10);
|
||||
private int avatarWH = AndroidUtilities.dp(52);
|
||||
|
||||
private MrChat m_mrChat = new MrChat(0);
|
||||
private MrPoortext m_summary = new MrPoortext(0);
|
||||
private MrLot m_summary = new MrLot(0);
|
||||
private boolean m_showUnreadCount;
|
||||
|
||||
public DialogCell(Context context) {
|
||||
public ChatlistCell(Context context) {
|
||||
super(context);
|
||||
|
||||
if (namePaint == null) {
|
||||
namePaint = new TextPaint(TextPaint.ANTI_ALIAS_FLAG);
|
||||
namePaint.setTextSize(AndroidUtilities.dp(17));
|
||||
namePaint.setColor(Theme.DIALOGS_TITLE_TEXT_COLOR);
|
||||
namePaint.setColor(Theme.CHATLIST_TITLE_TEXT_COLOR);
|
||||
|
||||
messagePaint = new TextPaint(TextPaint.ANTI_ALIAS_FLAG);
|
||||
messagePaint.setTextSize(AndroidUtilities.dp(16));
|
||||
messagePaint.setColor(Theme.DIALOGS_MESSAGE_TEXT_COLOR);
|
||||
messagePaint.linkColor = Theme.DIALOGS_MESSAGE_TEXT_COLOR;
|
||||
messagePaint.setColor(Theme.CHATLIST_MESSAGE_TEXT_COLOR);
|
||||
messagePaint.linkColor = Theme.CHATLIST_MESSAGE_TEXT_COLOR;
|
||||
|
||||
linePaint = new Paint();
|
||||
linePaint.setColor(0xffdcdcdc);
|
||||
|
||||
backPaint = new Paint();
|
||||
backPaint.setColor(0x0f000000);
|
||||
|
||||
messagePrintingPaint = new TextPaint(TextPaint.ANTI_ALIAS_FLAG);
|
||||
messagePrintingPaint.setTextSize(AndroidUtilities.dp(16));
|
||||
messagePrintingPaint.setColor(Theme.DIALOGS_PRINTING_TEXT_COLOR);
|
||||
|
||||
timePaint = new TextPaint(TextPaint.ANTI_ALIAS_FLAG);
|
||||
timePaint.setTextSize(AndroidUtilities.dp(13));
|
||||
timePaint.setColor(0xff999999);
|
||||
@@ -167,34 +157,33 @@ public class DialogCell extends BaseCell {
|
||||
clockDrawable = getResources().getDrawable(R.drawable.msg_clock);
|
||||
errorDrawable = getResources().getDrawable(R.drawable.msg_warning);
|
||||
countDrawable = getResources().getDrawable(R.drawable.dialogs_badge);
|
||||
countDrawableGrey = getResources().getDrawable(R.drawable.dialogs_badge2);
|
||||
groupDrawable = getResources().getDrawable(R.drawable.list_group);
|
||||
muteDrawable = getResources().getDrawable(R.drawable.mute_grey);
|
||||
verifiedDrawable = getResources().getDrawable(R.drawable.verified);
|
||||
closeDrawable = getResources().getDrawable(R.drawable.ic_dismiss_deaddrop);
|
||||
}
|
||||
|
||||
setBackgroundResource(R.drawable.list_selector);
|
||||
|
||||
avatarImage = new ImageReceiver(this);
|
||||
avatarImage.setRoundRadius(AndroidUtilities.dp(26));
|
||||
avatarDrawable = new AvatarDrawable();
|
||||
}
|
||||
|
||||
public void setDialog(MrChat mrChat, MrPoortext mrSummary, int i, boolean showUnreadCount) { // called for the chats overview
|
||||
|
||||
public void setChat(MrChat mrChat, MrLot mrSummary, int i, boolean showUnreadCount) {
|
||||
m_mrChat = mrChat;
|
||||
m_summary = mrSummary;
|
||||
m_showUnreadCount = showUnreadCount;
|
||||
|
||||
currentDialogId = mrChat.getId();
|
||||
index = i;
|
||||
currentChatId = mrChat.getId();
|
||||
|
||||
if(currentChatId==MrChat.MR_CHAT_ID_DEADDROP) {
|
||||
setBackgroundColor(Theme.CHATLIST_DEADDROP_BACKGROUND_COLOR);
|
||||
}
|
||||
else {
|
||||
setBackgroundResource(R.drawable.list_selector);
|
||||
}
|
||||
|
||||
update(0);
|
||||
}
|
||||
|
||||
public long getDialogId() {
|
||||
return currentDialogId;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow();
|
||||
@@ -214,7 +203,7 @@ public class DialogCell extends BaseCell {
|
||||
|
||||
@Override
|
||||
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
|
||||
if (currentDialogId == 0) {
|
||||
if (currentChatId == 0) {
|
||||
super.onLayout(changed, left, top, right, bottom);
|
||||
return;
|
||||
}
|
||||
@@ -223,6 +212,7 @@ public class DialogCell extends BaseCell {
|
||||
}
|
||||
}
|
||||
|
||||
static public boolean deaddropClosePressed;
|
||||
@Override
|
||||
public boolean onTouchEvent(MotionEvent event) {
|
||||
if (Build.VERSION.SDK_INT >= 21 && getBackground() != null) {
|
||||
@@ -230,102 +220,86 @@ public class DialogCell extends BaseCell {
|
||||
getBackground().setHotspot(event.getX(), event.getY());
|
||||
}
|
||||
}
|
||||
|
||||
if( currentChatId==MrChat.MR_CHAT_ID_DEADDROP ) {
|
||||
if (event.getAction() == MotionEvent.ACTION_DOWN) {
|
||||
float x = event.getX();
|
||||
deaddropClosePressed = (x < avatarLeft + avatarWH);
|
||||
}
|
||||
}
|
||||
|
||||
return super.onTouchEvent(event);
|
||||
}
|
||||
|
||||
public void buildLayout() {
|
||||
String nameString = "";
|
||||
String timeString = "";
|
||||
String countString = null;
|
||||
CharSequence messageString = "";
|
||||
//CharSequence printingString = null;
|
||||
/* EDIT BY MR -- we currently do not support stuff as "ist just typing", "uploads an images" etc.
|
||||
if (isDialogCell) {
|
||||
printingString = MessagesController.getInstance().printingStrings.get(currentDialogId);
|
||||
}
|
||||
*/
|
||||
TextPaint currentNamePaint = namePaint;
|
||||
TextPaint currentMessagePaint = messagePaint;
|
||||
boolean checkMessage = true;
|
||||
|
||||
drawNameGroup = false;
|
||||
drawGroupIcon = false;
|
||||
|
||||
{
|
||||
if (m_mrChat.getType()==MrChat.MR_CHAT_GROUP) { // EDIT BY MR
|
||||
//if (chat.id < 0 || ChatObject.isChannel(chat) && !chat.megagroup) {
|
||||
// drawNameBroadcast = true;
|
||||
// nameLockTop = AndroidUtilities.dp(16.5f);
|
||||
//} else {
|
||||
drawNameGroup = true;
|
||||
nameLockTop = AndroidUtilities.dp(17.5f);
|
||||
//}
|
||||
if (m_mrChat.isGroup() && currentChatId!=MrChat.MR_CHAT_ID_DEADDROP) {
|
||||
drawGroupIcon = true;
|
||||
nameLockTop = AndroidUtilities.dp(17.5f);
|
||||
|
||||
if (!LocaleController.isRTL) {
|
||||
nameLockLeft = AndroidUtilities.dp(AndroidUtilities.leftBaseline);
|
||||
nameLeft = AndroidUtilities.dp(AndroidUtilities.leftBaseline + 4) + (groupDrawable.getIntrinsicWidth());
|
||||
} else {
|
||||
nameLockLeft = getMeasuredWidth() - AndroidUtilities.dp(AndroidUtilities.leftBaseline) - (groupDrawable.getIntrinsicWidth());
|
||||
nameLeft = AndroidUtilities.dp(14);
|
||||
}
|
||||
if (!LocaleController.isRTL) {
|
||||
nameLockLeft = AndroidUtilities.dp(AndroidUtilities.leftBaseline);
|
||||
nameLeft = AndroidUtilities.dp(AndroidUtilities.leftBaseline + 4) + (groupDrawable.getIntrinsicWidth());
|
||||
} else {
|
||||
if (!LocaleController.isRTL) {
|
||||
nameLeft = AndroidUtilities.dp(AndroidUtilities.leftBaseline);
|
||||
} else {
|
||||
nameLeft = AndroidUtilities.dp(14);
|
||||
}
|
||||
nameLockLeft = getMeasuredWidth() - AndroidUtilities.dp(AndroidUtilities.leftBaseline) - (groupDrawable.getIntrinsicWidth());
|
||||
nameLeft = AndroidUtilities.dp(14);
|
||||
}
|
||||
} else {
|
||||
if (!LocaleController.isRTL) {
|
||||
nameLeft = AndroidUtilities.dp(AndroidUtilities.leftBaseline);
|
||||
} else {
|
||||
nameLeft = AndroidUtilities.dp(14);
|
||||
}
|
||||
}
|
||||
|
||||
String mess = m_summary.getText2();
|
||||
if (mess.length() > 150) {
|
||||
mess = mess.substring(0, 150);
|
||||
}
|
||||
String title = m_summary.getText1();
|
||||
if( !title.isEmpty() )
|
||||
{
|
||||
checkMessage = false;
|
||||
String mess = m_summary.getText2();
|
||||
if (mess.length() > 150) {
|
||||
mess = mess.substring(0, 150);
|
||||
}
|
||||
String title = m_summary.getText1();
|
||||
if( !title.isEmpty() )
|
||||
{
|
||||
int title_meaning = m_summary.getText1Meaning();
|
||||
int title_color = Theme.DIALOGS_NAME_TEXT_COLOR;
|
||||
switch( title_meaning ) {
|
||||
case MrPoortext.MR_TEXT1_SELF: title_color = Theme.DIALOGS_SELF_TEXT_COLOR; break;
|
||||
case MrPoortext.MR_TEXT1_DRAFT: title_color = Theme.DIALOGS_DRAFT_TEXT_COLOR; break;
|
||||
}
|
||||
SpannableStringBuilder stringBuilder = SpannableStringBuilder.valueOf(String.format("%s: %s", title, mess));
|
||||
stringBuilder.setSpan(new ForegroundColorSpan(title_color), 0, title.length() + 1, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
messageString = Emoji.replaceEmoji(stringBuilder, messagePaint.getFontMetricsInt(), AndroidUtilities.dp(20), false);
|
||||
}
|
||||
else
|
||||
{
|
||||
messageString = mess;
|
||||
}
|
||||
|
||||
long timestmp =m_summary.getTimestamp();
|
||||
if( timestmp!=0 ) {
|
||||
timeString = LocaleController.stringForMessageListDate(timestmp);
|
||||
}
|
||||
else {
|
||||
timeString = "";
|
||||
}
|
||||
|
||||
drawCheck1 = false;
|
||||
drawCheck2 = false;
|
||||
drawClock = false;
|
||||
drawCount = false;
|
||||
drawError = false;
|
||||
switch( m_summary.getState() ) {
|
||||
case MrMsg.MR_OUT_ERROR: drawError = true; break;
|
||||
case MrMsg.MR_OUT_PENDING: drawClock = true; break;
|
||||
case MrMsg.MR_OUT_DELIVERED: drawCheck2 = true; break;
|
||||
case MrMsg.MR_OUT_READ: drawCheck1 = true; drawCheck2 = true; break;
|
||||
}
|
||||
int title_meaning = m_summary.getText1Meaning();
|
||||
int title_color = Theme.CHATLIST_NAME_TEXT_COLOR;
|
||||
switch( title_meaning ) {
|
||||
case MrLot.MR_TEXT1_SELF: title_color = Theme.CHATLIST_SELF_TEXT_COLOR; break;
|
||||
case MrLot.MR_TEXT1_DRAFT: title_color = Theme.CHATLIST_DRAFT_TEXT_COLOR; break;
|
||||
}
|
||||
SpannableStringBuilder stringBuilder = SpannableStringBuilder.valueOf(String.format("%s: %s", title, mess));
|
||||
stringBuilder.setSpan(new ForegroundColorSpan(title_color), 0, title.length() + 1, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
messageString = EmojiInputView.replaceEmoji(stringBuilder, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
messageString = mess;
|
||||
}
|
||||
|
||||
if (unreadCount != 0) {
|
||||
drawCount = true;
|
||||
countString = String.format("%d", unreadCount);
|
||||
} else {
|
||||
drawCount = false;
|
||||
long timestmp =m_summary.getTimestamp();
|
||||
if( timestmp!=0 ) {
|
||||
timeString = LocaleController.dateForChatlist(timestmp);
|
||||
}
|
||||
else {
|
||||
timeString = "";
|
||||
}
|
||||
|
||||
drawCheck1 = false;
|
||||
drawCheck2 = false;
|
||||
drawClock = false;
|
||||
drawCount = false;
|
||||
drawFlag = false;
|
||||
drawError = false;
|
||||
switch( m_summary.getState() ) {
|
||||
case MrMsg.MR_OUT_ERROR: drawError = true; break;
|
||||
case MrMsg.MR_OUT_PENDING: drawClock = true; break;
|
||||
case MrMsg.MR_OUT_DELIVERED: drawCheck2 = true; break;
|
||||
case MrMsg.MR_OUT_MDN_RCVD: drawCheck1 = true; drawCheck2 = true; break;
|
||||
}
|
||||
|
||||
int timeWidth = (int) Math.ceil(timePaint.measureText(timeString));
|
||||
@@ -347,7 +321,7 @@ public class DialogCell extends BaseCell {
|
||||
nameLeft += timeWidth;
|
||||
}
|
||||
|
||||
if (drawNameGroup) {
|
||||
if (drawGroupIcon) {
|
||||
nameWidth -= AndroidUtilities.dp(4) + groupDrawable.getIntrinsicWidth();
|
||||
}
|
||||
|
||||
@@ -383,14 +357,15 @@ public class DialogCell extends BaseCell {
|
||||
}
|
||||
}
|
||||
|
||||
if (dialogMuted) {
|
||||
int w = AndroidUtilities.dp(6) + muteDrawable.getIntrinsicWidth();
|
||||
if (chatVerified) {
|
||||
int w = AndroidUtilities.dp(6) + verifiedDrawable.getIntrinsicWidth();
|
||||
nameWidth -= w;
|
||||
if (LocaleController.isRTL) {
|
||||
nameLeft += w;
|
||||
}
|
||||
}
|
||||
|
||||
// build name
|
||||
nameWidth = Math.max(AndroidUtilities.dp(12), nameWidth);
|
||||
CharSequence nameStringFinal = TextUtils.ellipsize(nameString.replace('\n', ' '), currentNamePaint, nameWidth - AndroidUtilities.dp(12), TextUtils.TruncateAt.END);
|
||||
try {
|
||||
@@ -399,16 +374,24 @@ public class DialogCell extends BaseCell {
|
||||
|
||||
}
|
||||
|
||||
// build avatar
|
||||
int messageWidth = getMeasuredWidth() - AndroidUtilities.dp(AndroidUtilities.leftBaseline + 16);
|
||||
int avatarLeft;
|
||||
if (!LocaleController.isRTL) {
|
||||
messageLeft = AndroidUtilities.dp(AndroidUtilities.leftBaseline);
|
||||
avatarLeft = AndroidUtilities.dp(AndroidUtilities.isTablet() ? 13 : 9);
|
||||
avatarLeft = AndroidUtilities.dp(9);
|
||||
} else {
|
||||
messageLeft = AndroidUtilities.dp(16);
|
||||
avatarLeft = getMeasuredWidth() - AndroidUtilities.dp(AndroidUtilities.isTablet() ? 65 : 61);
|
||||
avatarLeft = getMeasuredWidth() - AndroidUtilities.dp(61);
|
||||
}
|
||||
avatarImage.setImageCoords(avatarLeft, avatarTop, AndroidUtilities.dp(52), AndroidUtilities.dp(52));
|
||||
|
||||
if( currentChatId==MrChat.MR_CHAT_ID_DEADDROP ) {
|
||||
|
||||
}
|
||||
else {
|
||||
avatarImage.setImageCoords(avatarLeft, avatarTop, avatarWH, avatarWH);
|
||||
}
|
||||
|
||||
// build counter
|
||||
if (drawError) {
|
||||
int w = errorDrawable.getIntrinsicWidth() + AndroidUtilities.dp(8);
|
||||
messageWidth -= w;
|
||||
@@ -418,7 +401,30 @@ public class DialogCell extends BaseCell {
|
||||
errorLeft = AndroidUtilities.dp(16);
|
||||
messageLeft += w;
|
||||
}
|
||||
} else if (countString != null) {
|
||||
} else if(m_mrChat.getArchived()!=0 || currentChatId==MrChat.MR_CHAT_ID_ARCHIVED_LINK ) {
|
||||
String str;
|
||||
TextPaint strPaint;
|
||||
if( currentChatId==MrChat.MR_CHAT_ID_ARCHIVED_LINK ) {
|
||||
str = m_mrChat.getName();
|
||||
strPaint = messagePaint;
|
||||
}
|
||||
else {
|
||||
str = ApplicationLoader.applicationContext.getString(R.string.Archived);
|
||||
strPaint = timePaint;
|
||||
}
|
||||
|
||||
flagWidth = Math.max(AndroidUtilities.dp(12), (int)Math.ceil(strPaint.measureText(str)));
|
||||
flagLayout = new StaticLayout(str, strPaint, flagWidth, Layout.Alignment.ALIGN_CENTER, 1.0f, 0.0f, false);
|
||||
int w = flagWidth + AndroidUtilities.dp(15);
|
||||
if (!LocaleController.isRTL) {
|
||||
messageWidth -= w;
|
||||
flagLeft = getMeasuredWidth() - flagWidth - AndroidUtilities.dp(15);
|
||||
} else {
|
||||
flagLeft = AndroidUtilities.dp(15);
|
||||
}
|
||||
drawFlag = true;
|
||||
} else if (unreadCount != 0 && currentChatId!=MrChat.MR_CHAT_ID_DEADDROP) {
|
||||
String countString = String.format("%d", unreadCount);
|
||||
countWidth = Math.max(AndroidUtilities.dp(12), (int)Math.ceil(countPaint.measureText(countString)));
|
||||
countLayout = new StaticLayout(countString, countPaint, countWidth, Layout.Alignment.ALIGN_CENTER, 1.0f, 0.0f, false);
|
||||
int w = countWidth + AndroidUtilities.dp(18);
|
||||
@@ -430,21 +436,17 @@ public class DialogCell extends BaseCell {
|
||||
messageLeft += w;
|
||||
}
|
||||
drawCount = true;
|
||||
} else {
|
||||
drawCount = false;
|
||||
}
|
||||
|
||||
if (checkMessage) {
|
||||
if (messageString == null) {
|
||||
messageString = "";
|
||||
if (chatMuted) {
|
||||
muteLeft = messageLeft;
|
||||
int w = AndroidUtilities.dp(6) + muteDrawable.getIntrinsicWidth();
|
||||
messageWidth -= w;
|
||||
if (!LocaleController.isRTL) {
|
||||
messageLeft += w;
|
||||
}
|
||||
String mess = messageString.toString();
|
||||
if (mess.length() > 150) {
|
||||
mess = mess.substring(0, 150);
|
||||
}
|
||||
mess = mess.replace('\n', ' ');
|
||||
messageString = Emoji.replaceEmoji(mess, messagePaint.getFontMetricsInt(), AndroidUtilities.dp(17), false);
|
||||
}
|
||||
|
||||
messageWidth = Math.max(AndroidUtilities.dp(12), messageWidth);
|
||||
CharSequence messageStringFinal = TextUtils.ellipsize(messageString, currentMessagePaint, messageWidth - AndroidUtilities.dp(12), TextUtils.TruncateAt.END);
|
||||
try {
|
||||
@@ -459,8 +461,8 @@ public class DialogCell extends BaseCell {
|
||||
if (nameLayout != null && nameLayout.getLineCount() > 0) {
|
||||
left = nameLayout.getLineLeft(0);
|
||||
widthpx = Math.ceil(nameLayout.getLineWidth(0));
|
||||
if (dialogMuted) {
|
||||
nameMuteLeft = (int) (nameLeft + (nameWidth - widthpx) - AndroidUtilities.dp(6) - muteDrawable.getIntrinsicWidth());
|
||||
if (chatVerified) {
|
||||
nameVerifiedLeft = (int) (nameLeft + (nameWidth - widthpx) - AndroidUtilities.dp(6) - muteDrawable.getIntrinsicWidth());
|
||||
}
|
||||
if (left == 0) {
|
||||
if (widthpx < nameWidth) {
|
||||
@@ -486,8 +488,8 @@ public class DialogCell extends BaseCell {
|
||||
nameLeft -= (nameWidth - widthpx);
|
||||
}
|
||||
}
|
||||
if (dialogMuted) {
|
||||
nameMuteLeft = (int) (nameLeft + left + AndroidUtilities.dp(6));
|
||||
if (chatVerified) {
|
||||
nameVerifiedLeft = (int) (nameLeft + left + AndroidUtilities.dp(6));
|
||||
}
|
||||
}
|
||||
if (messageLayout != null && messageLayout.getLineCount() > 0) {
|
||||
@@ -502,60 +504,24 @@ public class DialogCell extends BaseCell {
|
||||
}
|
||||
}
|
||||
|
||||
public void setDialogSelected(boolean value) {
|
||||
if (isSelected != value) {
|
||||
invalidate();
|
||||
}
|
||||
isSelected = value;
|
||||
}
|
||||
|
||||
public void checkCurrentDialogIndex() {
|
||||
if (index < MrMailbox.m_currChatlist.getCnt()) { // EDIT BY MR - was: index < getDialogsArray().size()
|
||||
TLRPC.TL_dialog dialog = MrMailbox.m_currChatlist.get_TLRPC_TL_dialog(index); // EDIT BY MR - was: getDialogsArray().get(index);
|
||||
final MessageObject newMessageObject = null;
|
||||
if (currentDialogId != dialog.id ||
|
||||
message != null && message.getId() != dialog.top_message ||
|
||||
unreadCount != dialog.unread_count ||
|
||||
message != newMessageObject ||
|
||||
message == null && newMessageObject != null ) {
|
||||
currentDialogId = dialog.id;
|
||||
update(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void update(int mask) {
|
||||
if( m_showUnreadCount ) {
|
||||
unreadCount = m_mrChat.getUnseenCount();
|
||||
unreadCount = MrMailbox.getFreshMsgCount(m_mrChat.getId());
|
||||
}
|
||||
|
||||
if (mask != 0) {
|
||||
boolean continueUpdate = false;
|
||||
if (!continueUpdate && (mask & MrMailbox.UPDATE_MASK_AVATAR) != 0) {
|
||||
if (chat == null) {
|
||||
continueUpdate = true;
|
||||
}
|
||||
continueUpdate = true;
|
||||
}
|
||||
if (!continueUpdate && (mask & MrMailbox.UPDATE_MASK_NAME) != 0) {
|
||||
if (chat == null) {
|
||||
continueUpdate = true;
|
||||
}
|
||||
continueUpdate = true;
|
||||
}
|
||||
if (!continueUpdate && (mask & MrMailbox.UPDATE_MASK_CHAT_AVATAR) != 0) {
|
||||
if (user == null) {
|
||||
continueUpdate = true;
|
||||
}
|
||||
continueUpdate = true;
|
||||
}
|
||||
if (!continueUpdate && (mask & MrMailbox.UPDATE_MASK_CHAT_NAME) != 0) {
|
||||
if (user == null) {
|
||||
continueUpdate = true;
|
||||
}
|
||||
}
|
||||
if (!continueUpdate && (mask & MrMailbox.UPDATE_MASK_SEND_STATE) != 0) {
|
||||
if (message != null && lastSendState != message.messageOwner.send_state) {
|
||||
lastSendState = message.messageOwner.send_state;
|
||||
continueUpdate = true;
|
||||
}
|
||||
continueUpdate = true;
|
||||
}
|
||||
|
||||
if (!continueUpdate) {
|
||||
@@ -563,25 +529,23 @@ public class DialogCell extends BaseCell {
|
||||
}
|
||||
}
|
||||
|
||||
dialogMuted = isDialogCell && MrMailbox.isDialogMuted(currentDialogId);
|
||||
//user = null;
|
||||
//chat = null;
|
||||
|
||||
/*int lower_id = (int)currentDialogId;
|
||||
int high_id = (int)(currentDialogId >> 32);
|
||||
if (lower_id != 0) {
|
||||
if (high_id == 1) {
|
||||
chat = MessagesController.getInstance().getChat(lower_id);
|
||||
} else {
|
||||
if (lower_id < 0) {
|
||||
chat = MessagesController.getInstance().getChat(-lower_id);
|
||||
} else {
|
||||
user = MessagesController.getInstance().getUser(lower_id);
|
||||
}
|
||||
|
||||
if( currentChatId == MrChat.MR_CHAT_ID_DEADDROP ) {
|
||||
chatMuted = false; // never draw mute icon, the deaddrop is always muted
|
||||
chatVerified = false;
|
||||
}
|
||||
else {
|
||||
chatMuted = MrMailbox.isDialogMuted(currentChatId);
|
||||
ContactsController.setupAvatar(this, avatarImage, new AvatarDrawable(), null, m_mrChat);
|
||||
chatVerified = m_mrChat.isVerified();
|
||||
|
||||
// can be deleted if this gets out-of-labs
|
||||
if( chatVerified && MrMailbox.getConfigInt("qr_enabled", 0)==0 ) {
|
||||
chatVerified = false;
|
||||
}
|
||||
}*/
|
||||
|
||||
ContactsController.setupAvatar(this, avatarImage, avatarDrawable, null, m_mrChat);
|
||||
// /can be deleted if this gets out-of-labs
|
||||
}
|
||||
|
||||
if (getMeasuredWidth() != 0 || getMeasuredHeight() != 0) {
|
||||
buildLayout();
|
||||
@@ -594,21 +558,20 @@ public class DialogCell extends BaseCell {
|
||||
|
||||
@Override
|
||||
protected void onDraw(Canvas canvas) {
|
||||
if (currentDialogId == 0) {
|
||||
if( currentChatId == MrChat.MR_CHAT_ID_ARCHIVED_LINK ) {
|
||||
canvas.save();
|
||||
canvas.translate(getMeasuredWidth()/2-flagWidth/2, getMeasuredHeight()/2-flagLayout.getHeight()/2);
|
||||
flagLayout.draw(canvas);
|
||||
canvas.restore();
|
||||
return;
|
||||
}
|
||||
|
||||
if (isSelected) {
|
||||
canvas.drawRect(0, 0, getMeasuredWidth(), getMeasuredHeight(), backPaint);
|
||||
|
||||
if (currentChatId == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
if (drawNameLock) {
|
||||
setDrawableBounds(lockDrawable, nameLockLeft, nameLockTop);
|
||||
lockDrawable.draw(canvas);
|
||||
} else
|
||||
*/
|
||||
if (drawNameGroup) {
|
||||
if (drawGroupIcon) {
|
||||
setDrawableBounds(groupDrawable, nameLockLeft, nameLockTop);
|
||||
groupDrawable.draw(canvas);
|
||||
}
|
||||
@@ -651,28 +614,43 @@ public class DialogCell extends BaseCell {
|
||||
}
|
||||
}
|
||||
|
||||
if (dialogMuted) {
|
||||
setDrawableBounds(muteDrawable, nameMuteLeft, AndroidUtilities.dp(16.5f));
|
||||
if (chatVerified) {
|
||||
setDrawableBounds(verifiedDrawable, nameVerifiedLeft, AndroidUtilities.dp(16.5f));
|
||||
verifiedDrawable.draw(canvas);
|
||||
}
|
||||
|
||||
if (chatMuted) {
|
||||
setDrawableBounds(muteDrawable, muteLeft, AndroidUtilities.dp(44));
|
||||
muteDrawable.draw(canvas);
|
||||
}
|
||||
|
||||
if (drawError) {
|
||||
setDrawableBounds(errorDrawable, errorLeft, errorTop);
|
||||
errorDrawable.draw(canvas);
|
||||
} else if(drawFlag) {
|
||||
canvas.save();
|
||||
canvas.translate(flagLeft, countTop + AndroidUtilities.dp(4));
|
||||
flagLayout.draw(canvas);
|
||||
canvas.restore();
|
||||
} else if (drawCount) {
|
||||
if (dialogMuted) {
|
||||
setDrawableBounds(countDrawableGrey, countLeft - AndroidUtilities.dp(5.5f), countTop, countWidth + AndroidUtilities.dp(11), countDrawable.getIntrinsicHeight());
|
||||
countDrawableGrey.draw(canvas);
|
||||
} else {
|
||||
setDrawableBounds(countDrawable, countLeft - AndroidUtilities.dp(5.5f), countTop, countWidth + AndroidUtilities.dp(11), countDrawable.getIntrinsicHeight());
|
||||
countDrawable.draw(canvas);
|
||||
}
|
||||
setDrawableBounds(countDrawable, countLeft - AndroidUtilities.dp(5.5f), countTop, countWidth + AndroidUtilities.dp(11), countDrawable.getIntrinsicHeight());
|
||||
countDrawable.draw(canvas);
|
||||
|
||||
canvas.save();
|
||||
canvas.translate(countLeft, countTop + AndroidUtilities.dp(4));
|
||||
countLayout.draw(canvas);
|
||||
canvas.restore();
|
||||
}
|
||||
|
||||
if( currentChatId==MrChat.MR_CHAT_ID_DEADDROP ) {
|
||||
int shrink = AndroidUtilities.dp(12);
|
||||
setDrawableBounds(closeDrawable, avatarLeft+shrink, avatarTop+shrink, avatarWH-shrink*2, avatarWH-shrink*2);
|
||||
closeDrawable.draw(canvas);
|
||||
}
|
||||
else {
|
||||
avatarImage.draw(canvas);
|
||||
}
|
||||
|
||||
if (useSeparator) {
|
||||
if (LocaleController.isRTL) {
|
||||
canvas.drawLine(0, getMeasuredHeight() - 1, getMeasuredWidth() - AndroidUtilities.dp(AndroidUtilities.leftBaseline), getMeasuredHeight() - 1, linePaint);
|
||||
@@ -680,8 +658,6 @@ public class DialogCell extends BaseCell {
|
||||
canvas.drawLine(AndroidUtilities.dp(AndroidUtilities.leftBaseline), getMeasuredHeight() - 1, getMeasuredWidth(), getMeasuredHeight() - 1, linePaint);
|
||||
}
|
||||
}
|
||||
|
||||
avatarImage.draw(canvas);
|
||||
}
|
||||
|
||||
@Override
|
||||
+37
-29
@@ -25,7 +25,7 @@
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
package com.b44t.ui.Cells;
|
||||
package com.b44t.messenger.Cells;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Canvas;
|
||||
@@ -39,8 +39,7 @@ import android.widget.FrameLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.b44t.messenger.AndroidUtilities;
|
||||
import com.b44t.messenger.LocaleController;
|
||||
import com.b44t.ui.Components.LayoutHelper;
|
||||
import com.b44t.messenger.Components.LayoutHelper;
|
||||
|
||||
public class EditTextCell extends FrameLayout {
|
||||
|
||||
@@ -49,14 +48,20 @@ public class EditTextCell extends FrameLayout {
|
||||
private static Paint paint;
|
||||
private boolean needDivider;
|
||||
private boolean useLabel;
|
||||
private boolean multiLine;
|
||||
|
||||
public EditTextCell(Context context) {
|
||||
this(context, true);
|
||||
this(context, true, false);
|
||||
}
|
||||
|
||||
public EditTextCell(Context context, boolean useLabel__) {
|
||||
public EditTextCell(Context context, boolean useLabel) {
|
||||
this(context, useLabel, false);
|
||||
}
|
||||
|
||||
public EditTextCell(Context context, boolean useLabel__, boolean multiLine__) {
|
||||
super(context);
|
||||
useLabel = useLabel__;
|
||||
multiLine = multiLine__;
|
||||
|
||||
if (paint == null) {
|
||||
paint = new Paint();
|
||||
@@ -75,41 +80,44 @@ public class EditTextCell extends FrameLayout {
|
||||
addView(labelTextView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.START | Gravity.TOP,
|
||||
17, 8, 17, 0));
|
||||
|
||||
|
||||
editView = new EditText(context);
|
||||
editView.setTextColor(0xff212121); // ok
|
||||
editView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 18); // ok, normal text is 16
|
||||
editView.setLines(1);
|
||||
editView.setMaxLines(1);
|
||||
editView.setSingleLine(true);
|
||||
editView.setTextColor(0xff212121);
|
||||
editView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 18); // normal text is 16
|
||||
int addImeFlag = 0, addInputType = 0;
|
||||
if( multiLine__ ) {
|
||||
editView.setLines(2);
|
||||
editView.setMaxLines(2);
|
||||
editView.setSingleLine(false);
|
||||
editView.setVerticalScrollBarEnabled(true);
|
||||
editView.setHorizontalScrollBarEnabled(false);
|
||||
editView.setMinimumHeight(AndroidUtilities.dp(100));
|
||||
addInputType = EditorInfo.TYPE_TEXT_FLAG_MULTI_LINE|EditorInfo.TYPE_TEXT_FLAG_CAP_SENTENCES;
|
||||
}
|
||||
else {
|
||||
editView.setLines(1);
|
||||
editView.setMaxLines(1);
|
||||
editView.setSingleLine(true);
|
||||
addInputType = InputType.TYPE_CLASS_TEXT|InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS;
|
||||
addImeFlag = EditorInfo.IME_ACTION_DONE; // just close the keyboard, NEXT would not work as the other entries nay not yet loaded
|
||||
}
|
||||
editView.setHintTextColor(0xffBBBBBB); // was: 0xff979797
|
||||
editView.setGravity(Gravity.START);
|
||||
editView.setInputType(InputType.TYPE_CLASS_TEXT|InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS);
|
||||
editView.setImeOptions(EditorInfo.IME_ACTION_DONE); // just close the keyboard, NEXT would not work as the other entries nay not yet loaded
|
||||
AndroidUtilities.clearCursorDrawable(editView);
|
||||
/*
|
||||
e.setPadding(0, 0, 0, 0);
|
||||
e.setOnEditorActionListener(new TextView.OnEditorActionListener() {
|
||||
@Override
|
||||
public boolean onEditorAction(TextView textView, int i, KeyEvent keyEvent) {
|
||||
if (i == EditorInfo.IME_ACTION_DONE && doneButton != null) {
|
||||
doneButton.performClick();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
});
|
||||
*/
|
||||
editView.setInputType(editView.getInputType()|addInputType);
|
||||
editView.setImeOptions(addImeFlag|EditorInfo.IME_FLAG_NO_EXTRACT_UI);
|
||||
|
||||
addView(editView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.START | Gravity.TOP,
|
||||
17, useLabel? 25 : 25-17, 17, 0));
|
||||
17, useLabel? 25 : 25-17, 17, multiLine?17:0));
|
||||
|
||||
setBackgroundColor(0xffffffff);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
||||
super.onMeasure(widthMeasureSpec, MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(useLabel? 64 : 64-15) + (needDivider ? 1 : 0), MeasureSpec.EXACTLY));
|
||||
int dpheight = multiLine? 49*2 : 49;
|
||||
if( useLabel ) {
|
||||
dpheight += 15;
|
||||
}
|
||||
super.onMeasure(widthMeasureSpec, MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(dpheight)+(needDivider ? 1 : 0), MeasureSpec.EXACTLY));
|
||||
}
|
||||
|
||||
public void setValueHintAndLabel(String value, String hint, String label, boolean divider) {
|
||||
+2
-3
@@ -21,7 +21,7 @@
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
package com.b44t.ui.Cells;
|
||||
package com.b44t.messenger.Cells;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Typeface;
|
||||
@@ -31,8 +31,7 @@ import android.widget.FrameLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.b44t.messenger.AndroidUtilities;
|
||||
import com.b44t.messenger.LocaleController;
|
||||
import com.b44t.ui.Components.LayoutHelper;
|
||||
import com.b44t.messenger.Components.LayoutHelper;
|
||||
|
||||
public class GreySectionCell extends FrameLayout {
|
||||
private TextView textView;
|
||||
+16
-9
@@ -21,7 +21,7 @@
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
package com.b44t.ui.Cells;
|
||||
package com.b44t.messenger.Cells;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Typeface;
|
||||
@@ -31,21 +31,28 @@ import android.widget.FrameLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.b44t.messenger.AndroidUtilities;
|
||||
import com.b44t.messenger.LocaleController;
|
||||
import com.b44t.ui.Components.LayoutHelper;
|
||||
import com.b44t.messenger.Components.LayoutHelper;
|
||||
|
||||
public class HeaderCell extends FrameLayout {
|
||||
|
||||
private TextView textView;
|
||||
|
||||
static public TextView createTextView(Context context, String text)
|
||||
{
|
||||
TextView ret = new TextView(context);
|
||||
ret.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 15);
|
||||
ret.setTypeface(Typeface.DEFAULT_BOLD);
|
||||
ret.setTextColor(0xff5099c9);
|
||||
ret.setGravity(Gravity.START | Gravity.CENTER_VERTICAL);
|
||||
if( text != null ) {
|
||||
ret.setText(text);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
public HeaderCell(Context context) {
|
||||
super(context);
|
||||
|
||||
textView = new TextView(getContext());
|
||||
textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 15);
|
||||
textView.setTypeface(Typeface.DEFAULT_BOLD);
|
||||
textView.setTextColor(0xff5099c9);
|
||||
textView.setGravity(Gravity.START | Gravity.CENTER_VERTICAL);
|
||||
textView = createTextView(getContext(), null);
|
||||
addView(textView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT, Gravity.START | Gravity.TOP, 17, 15, 17, 0));
|
||||
}
|
||||
|
||||
+5
-5
@@ -21,7 +21,7 @@
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
package com.b44t.ui.Cells;
|
||||
package com.b44t.messenger.Cells;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Rect;
|
||||
@@ -34,10 +34,10 @@ import android.widget.FrameLayout;
|
||||
import com.b44t.messenger.AndroidUtilities;
|
||||
import com.b44t.messenger.MediaController;
|
||||
import com.b44t.messenger.R;
|
||||
import com.b44t.ui.Components.BackupImageView;
|
||||
import com.b44t.ui.Components.CheckBoxView;
|
||||
import com.b44t.ui.Components.LayoutHelper;
|
||||
import com.b44t.ui.PhotoViewer;
|
||||
import com.b44t.messenger.Components.BackupImageView;
|
||||
import com.b44t.messenger.Components.CheckBoxView;
|
||||
import com.b44t.messenger.Components.LayoutHelper;
|
||||
import com.b44t.messenger.PhotoViewer;
|
||||
|
||||
public class PhotoAttachPhotoCell extends FrameLayout {
|
||||
|
||||
+2
-2
@@ -21,7 +21,7 @@
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
package com.b44t.ui.Cells;
|
||||
package com.b44t.messenger.Cells;
|
||||
|
||||
import android.content.Context;
|
||||
import android.text.TextUtils;
|
||||
@@ -32,7 +32,7 @@ import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.b44t.messenger.AndroidUtilities;
|
||||
import com.b44t.ui.Components.LayoutHelper;
|
||||
import com.b44t.messenger.Components.LayoutHelper;
|
||||
|
||||
public class PhotoEditToolCell extends FrameLayout {
|
||||
|
||||
+4
-8
@@ -21,7 +21,7 @@
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
package com.b44t.ui.Cells;
|
||||
package com.b44t.messenger.Cells;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Build;
|
||||
@@ -37,8 +37,8 @@ import android.widget.TextView;
|
||||
import com.b44t.messenger.AndroidUtilities;
|
||||
import com.b44t.messenger.MediaController;
|
||||
import com.b44t.messenger.R;
|
||||
import com.b44t.ui.Components.BackupImageView;
|
||||
import com.b44t.ui.Components.LayoutHelper;
|
||||
import com.b44t.messenger.Components.BackupImageView;
|
||||
import com.b44t.messenger.Components.LayoutHelper;
|
||||
|
||||
public class PhotoPickerAlbumsCell extends FrameLayout {
|
||||
|
||||
@@ -158,11 +158,7 @@ public class PhotoPickerAlbumsCell extends FrameLayout {
|
||||
@Override
|
||||
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
||||
int itemWidth;
|
||||
if (AndroidUtilities.isTablet()) {
|
||||
itemWidth = (AndroidUtilities.dp(490) - ((albumsCount + 1) * AndroidUtilities.dp(4))) / albumsCount;
|
||||
} else {
|
||||
itemWidth = (AndroidUtilities.displaySize.x - ((albumsCount + 1) * AndroidUtilities.dp(4))) / albumsCount;
|
||||
}
|
||||
itemWidth = (AndroidUtilities.displaySize.x - ((albumsCount + 1) * AndroidUtilities.dp(4))) / albumsCount;
|
||||
|
||||
for (int a = 0; a < albumsCount; a++) {
|
||||
LayoutParams layoutParams = (LayoutParams) albumViews[a].getLayoutParams();
|
||||
+4
-4
@@ -21,7 +21,7 @@
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
package com.b44t.ui.Cells;
|
||||
package com.b44t.messenger.Cells;
|
||||
|
||||
import android.animation.Animator;
|
||||
import android.animation.AnimatorSet;
|
||||
@@ -33,9 +33,9 @@ import android.widget.FrameLayout;
|
||||
import com.b44t.messenger.AndroidUtilities;
|
||||
import com.b44t.messenger.AnimatorListenerAdapterProxy;
|
||||
import com.b44t.messenger.R;
|
||||
import com.b44t.ui.Components.BackupImageView;
|
||||
import com.b44t.ui.Components.CheckBoxView;
|
||||
import com.b44t.ui.Components.LayoutHelper;
|
||||
import com.b44t.messenger.Components.BackupImageView;
|
||||
import com.b44t.messenger.Components.CheckBoxView;
|
||||
import com.b44t.messenger.Components.LayoutHelper;
|
||||
|
||||
public class PhotoPickerPhotoCell extends FrameLayout {
|
||||
|
||||
+8
-13
@@ -1,7 +1,6 @@
|
||||
/*******************************************************************************
|
||||
*
|
||||
* Delta Chat Android
|
||||
* (C) 2013-2016 Nikolai Kudashov
|
||||
* (C) 2017 Björn Petersen
|
||||
* Contact: r10s@b44t.com, http://b44t.com
|
||||
*
|
||||
@@ -21,14 +20,12 @@
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
package com.b44t.ui.Cells;
|
||||
package com.b44t.messenger.Cells;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.graphics.PorterDuffColorFilter;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.drawable.BitmapDrawable;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
@@ -42,15 +39,13 @@ import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.b44t.messenger.AndroidUtilities;
|
||||
import com.b44t.messenger.LocaleController;
|
||||
import com.b44t.messenger.MrMailbox;
|
||||
import com.b44t.messenger.ApplicationLoader;
|
||||
import com.b44t.messenger.R;
|
||||
import com.b44t.ui.ActionBar.DrawerLayoutContainer;
|
||||
import com.b44t.ui.Components.LayoutHelper;
|
||||
import com.b44t.ui.ActionBar.Theme;
|
||||
import com.b44t.messenger.Components.LayoutHelper;
|
||||
import com.b44t.messenger.ActionBar.Theme;
|
||||
|
||||
public class DrawerProfileCell extends FrameLayout {
|
||||
public class SettingsProfileCell extends FrameLayout {
|
||||
|
||||
private TextView nameTextView;
|
||||
private TextView subtitleTextView;
|
||||
@@ -58,7 +53,7 @@ public class DrawerProfileCell extends FrameLayout {
|
||||
private Rect destRect = new Rect();
|
||||
private Paint paint = new Paint();
|
||||
|
||||
public DrawerProfileCell(Context context) {
|
||||
public SettingsProfileCell(Context context) {
|
||||
super(context);
|
||||
setBackgroundColor(Theme.ACTION_BAR_COLOR);
|
||||
|
||||
@@ -69,7 +64,7 @@ public class DrawerProfileCell extends FrameLayout {
|
||||
|
||||
nameTextView = new TextView(context);
|
||||
nameTextView.setTextColor(0xffffffff);
|
||||
nameTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, DrawerLayoutContainer.USE_DRAWER? 23 : 26);
|
||||
nameTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 26);
|
||||
nameTextView.setLines(1);
|
||||
nameTextView.setMaxLines(1);
|
||||
nameTextView.setSingleLine(true);
|
||||
@@ -79,7 +74,7 @@ public class DrawerProfileCell extends FrameLayout {
|
||||
|
||||
subtitleTextView = new TextView(context);
|
||||
subtitleTextView.setTextColor(0xffc2e5ff);
|
||||
subtitleTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, DrawerLayoutContainer.USE_DRAWER? 13 : Theme.ACTION_BAR_SUBTITLE_TEXT_SIZE);
|
||||
subtitleTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, Theme.ACTION_BAR_SUBTITLE_TEXT_SIZE);
|
||||
subtitleTextView.setLines(1);
|
||||
subtitleTextView.setMaxLines(1);
|
||||
subtitleTextView.setSingleLine(true);
|
||||
@@ -90,7 +85,7 @@ public class DrawerProfileCell extends FrameLayout {
|
||||
|
||||
@Override
|
||||
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
||||
int mrHeight = DrawerLayoutContainer.USE_DRAWER? 180 : 100/*see also shadow height above*/;
|
||||
int mrHeight = 100/*see also shadow height above*/;
|
||||
if (Build.VERSION.SDK_INT >= 21) {
|
||||
super.onMeasure(widthMeasureSpec, MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(mrHeight) + AndroidUtilities.statusBarHeight, MeasureSpec.EXACTLY));
|
||||
} else {
|
||||
+1
-1
@@ -21,7 +21,7 @@
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
package com.b44t.ui.Cells;
|
||||
package com.b44t.messenger.Cells;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.View;
|
||||
+4
-4
@@ -21,7 +21,7 @@
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
package com.b44t.ui.Cells;
|
||||
package com.b44t.messenger.Cells;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Paint;
|
||||
@@ -36,9 +36,9 @@ import com.b44t.messenger.AndroidUtilities;
|
||||
import com.b44t.messenger.ImageReceiver;
|
||||
import com.b44t.messenger.LocaleController;
|
||||
import com.b44t.messenger.R;
|
||||
import com.b44t.ui.Components.BackupImageView;
|
||||
import com.b44t.ui.Components.CheckBoxView;
|
||||
import com.b44t.ui.Components.LayoutHelper;
|
||||
import com.b44t.messenger.Components.BackupImageView;
|
||||
import com.b44t.messenger.Components.CheckBoxView;
|
||||
import com.b44t.messenger.Components.LayoutHelper;
|
||||
|
||||
public class SharedDocumentCell extends FrameLayout {
|
||||
|
||||
+2
-2
@@ -21,7 +21,7 @@
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
package com.b44t.ui.Cells;
|
||||
package com.b44t.messenger.Cells;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Canvas;
|
||||
@@ -35,7 +35,7 @@ import android.widget.CheckBox;
|
||||
|
||||
import com.b44t.messenger.AndroidUtilities;
|
||||
import com.b44t.messenger.LocaleController;
|
||||
import com.b44t.ui.Components.LayoutHelper;
|
||||
import com.b44t.messenger.Components.LayoutHelper;
|
||||
|
||||
public class TextCheckCell extends FrameLayout {
|
||||
|
||||
+2
-3
@@ -21,7 +21,7 @@
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
package com.b44t.ui.Cells;
|
||||
package com.b44t.messenger.Cells;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Canvas;
|
||||
@@ -32,8 +32,7 @@ import android.widget.FrameLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.b44t.messenger.AndroidUtilities;
|
||||
import com.b44t.messenger.LocaleController;
|
||||
import com.b44t.ui.Components.LayoutHelper;
|
||||
import com.b44t.messenger.Components.LayoutHelper;
|
||||
|
||||
public class TextDetailSettingsCell extends FrameLayout {
|
||||
|
||||
+11
-7
@@ -20,7 +20,7 @@
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
package com.b44t.ui.Cells;
|
||||
package com.b44t.messenger.Cells;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.TypedValue;
|
||||
@@ -29,8 +29,7 @@ import android.widget.FrameLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.b44t.messenger.AndroidUtilities;
|
||||
import com.b44t.messenger.LocaleController;
|
||||
import com.b44t.ui.Components.LayoutHelper;
|
||||
import com.b44t.messenger.Components.LayoutHelper;
|
||||
|
||||
|
||||
public class TextInfoCell extends FrameLayout {
|
||||
@@ -40,13 +39,18 @@ public class TextInfoCell extends FrameLayout {
|
||||
|
||||
private final int iconDp = 34;
|
||||
|
||||
static public TextView createTextView(Context context) {
|
||||
TextView ret = new TextView(context);
|
||||
ret.setTextColor(0xff808080);
|
||||
ret.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14);
|
||||
ret.setGravity(Gravity.START);
|
||||
return ret;
|
||||
}
|
||||
|
||||
public TextInfoCell(Context context) {
|
||||
super(context);
|
||||
|
||||
textView = new TextView(context);
|
||||
textView.setTextColor(0xff808080);
|
||||
textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14);
|
||||
textView.setGravity(Gravity.START);
|
||||
textView = createTextView(context);
|
||||
addView(textView);
|
||||
|
||||
iconView = new TextView(context);
|
||||
+2
-4
@@ -21,7 +21,7 @@
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
package com.b44t.ui.Cells;
|
||||
package com.b44t.messenger.Cells;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Canvas;
|
||||
@@ -30,12 +30,10 @@ import android.text.TextUtils;
|
||||
import android.util.TypedValue;
|
||||
import android.view.Gravity;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.b44t.messenger.AndroidUtilities;
|
||||
import com.b44t.messenger.LocaleController;
|
||||
import com.b44t.ui.Components.LayoutHelper;
|
||||
import com.b44t.messenger.Components.LayoutHelper;
|
||||
|
||||
import static com.b44t.messenger.AndroidUtilities.dp;
|
||||
|
||||
+23
-40
@@ -21,9 +21,10 @@
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
package com.b44t.ui.Cells;
|
||||
package com.b44t.messenger.Cells;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.view.Gravity;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.ImageView;
|
||||
@@ -32,33 +33,29 @@ import com.b44t.messenger.AndroidUtilities;
|
||||
import com.b44t.messenger.ContactsController;
|
||||
import com.b44t.messenger.LocaleController;
|
||||
import com.b44t.messenger.MrContact;
|
||||
import com.b44t.messenger.MrMailbox;
|
||||
import com.b44t.messenger.R;
|
||||
import com.b44t.ui.Components.AvatarDrawable;
|
||||
import com.b44t.ui.Components.BackupImageView;
|
||||
import com.b44t.ui.Components.CheckBoxView;
|
||||
import com.b44t.ui.Components.LayoutHelper;
|
||||
import com.b44t.ui.ActionBar.SimpleTextView;
|
||||
import com.b44t.messenger.Components.AvatarDrawable;
|
||||
import com.b44t.messenger.Components.BackupImageView;
|
||||
import com.b44t.messenger.Components.CheckBoxView;
|
||||
import com.b44t.messenger.Components.LayoutHelper;
|
||||
import com.b44t.messenger.ActionBar.SimpleTextView;
|
||||
|
||||
public class UserCell extends FrameLayout {
|
||||
|
||||
private BackupImageView avatarImageView;
|
||||
private SimpleTextView nameTextView;
|
||||
private SimpleTextView statusTextView;
|
||||
private ImageView imageView;
|
||||
private CheckBoxView checkBox;
|
||||
|
||||
private AvatarDrawable avatarDrawable;
|
||||
private MrContact m_mrContact;
|
||||
|
||||
private CharSequence currentName;
|
||||
private CharSequence currentStatus;
|
||||
private int currentResId;
|
||||
|
||||
private int statusColor = 0xffa8a8a8;
|
||||
|
||||
public UserCell(Context context, int padding, int useCheckboxes) {
|
||||
public UserCell(Context context, int useCheckboxes) {
|
||||
super(context);
|
||||
|
||||
int padding = 1;
|
||||
|
||||
avatarDrawable = new AvatarDrawable();
|
||||
|
||||
avatarImageView = new BackupImageView(context);
|
||||
@@ -67,20 +64,16 @@ public class UserCell extends FrameLayout {
|
||||
|
||||
nameTextView = new SimpleTextView(context);
|
||||
nameTextView.setTextColor(0xff212121);
|
||||
nameTextView.setTextSize(16); /*same size as in TextCell */
|
||||
nameTextView.setTextSize(16);
|
||||
nameTextView.setGravity(Gravity.START | Gravity.TOP);
|
||||
addView(nameTextView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 20, Gravity.START | Gravity.TOP, LocaleController.isRTL ? 28 + (useCheckboxes == 2 ? 18 : 0) : (68 + padding), 11.5f, LocaleController.isRTL ? (68 + padding) : 28 + (useCheckboxes == 2 ? 18 : 0), 0));
|
||||
|
||||
statusTextView = new SimpleTextView(context);
|
||||
statusTextView.setTextSize(14);
|
||||
statusTextView.setTextColor(0xffa8a8a8);
|
||||
statusTextView.setGravity(Gravity.START | Gravity.TOP);
|
||||
addView(statusTextView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 20, Gravity.START | Gravity.TOP, LocaleController.isRTL ? 28 : (68 + padding), 34.5f, LocaleController.isRTL ? (68 + padding) : 28, 0));
|
||||
|
||||
imageView = new ImageView(context);
|
||||
imageView.setScaleType(ImageView.ScaleType.CENTER);
|
||||
imageView.setVisibility(GONE);
|
||||
addView(imageView, LayoutHelper.createFrame(LayoutParams.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.START | Gravity.CENTER_VERTICAL, LocaleController.isRTL ? 0 : 16, 0, LocaleController.isRTL ? 16 : 0, 0));
|
||||
|
||||
if( useCheckboxes == 1 ) {
|
||||
checkBox = new CheckBoxView(context, R.drawable.round_check2);
|
||||
checkBox.setVisibility(INVISIBLE);
|
||||
@@ -88,13 +81,8 @@ public class UserCell extends FrameLayout {
|
||||
}
|
||||
}
|
||||
|
||||
public void setData(MrContact mrContact, int resId) {
|
||||
public void setData(MrContact mrContact) {
|
||||
m_mrContact = mrContact;
|
||||
if( m_mrContact != null ) {
|
||||
currentName = m_mrContact.getDisplayName();
|
||||
currentStatus = m_mrContact.getAddr();
|
||||
}
|
||||
currentResId = resId;
|
||||
update();
|
||||
}
|
||||
|
||||
@@ -112,27 +100,22 @@ public class UserCell extends FrameLayout {
|
||||
super.onMeasure(MeasureSpec.makeMeasureSpec(MeasureSpec.getSize(widthMeasureSpec), MeasureSpec.EXACTLY), MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(64), MeasureSpec.EXACTLY));
|
||||
}
|
||||
|
||||
public void setStatusColors(int color) {
|
||||
statusColor = color;
|
||||
}
|
||||
|
||||
public void update() {
|
||||
if (m_mrContact==null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (currentName != null) {
|
||||
nameTextView.setText(currentName);
|
||||
}
|
||||
nameTextView.setText(m_mrContact.getDisplayName());
|
||||
|
||||
if (currentStatus != null) {
|
||||
statusTextView.setTextColor(statusColor);
|
||||
statusTextView.setText(currentStatus);
|
||||
}
|
||||
statusTextView.setText(m_mrContact.getAddr());
|
||||
|
||||
if (imageView.getVisibility() == VISIBLE && currentResId == 0 || imageView.getVisibility() == GONE && currentResId != 0) {
|
||||
imageView.setVisibility(currentResId == 0 ? GONE : VISIBLE);
|
||||
imageView.setImageResource(currentResId);
|
||||
if( m_mrContact.isVerified() ) {
|
||||
if( MrMailbox.getConfigInt("qr_enabled", 0) != 0 ) {
|
||||
nameTextView.setRightDrawable(R.drawable.verified);
|
||||
}
|
||||
}
|
||||
else {
|
||||
nameTextView.setRightDrawable(0);
|
||||
}
|
||||
|
||||
ContactsController.setupAvatar(avatarImageView, avatarImageView.imageReceiver, avatarDrawable, m_mrContact, null);
|
||||
+3
-3
@@ -21,7 +21,7 @@
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
package com.b44t.ui.Cells;
|
||||
package com.b44t.messenger.Cells;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.drawable.Drawable;
|
||||
@@ -33,8 +33,8 @@ import android.widget.ImageView;
|
||||
import com.b44t.messenger.AndroidUtilities;
|
||||
import com.b44t.messenger.R;
|
||||
import com.b44t.messenger.TLRPC;
|
||||
import com.b44t.ui.Components.BackupImageView;
|
||||
import com.b44t.ui.Components.LayoutHelper;
|
||||
import com.b44t.messenger.Components.BackupImageView;
|
||||
import com.b44t.messenger.Components.LayoutHelper;
|
||||
|
||||
public class WallpaperCell extends FrameLayout {
|
||||
|
||||
+281
-168
@@ -21,7 +21,7 @@
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
package com.b44t.ui;
|
||||
package com.b44t.messenger;
|
||||
|
||||
import android.Manifest;
|
||||
import android.animation.Animator;
|
||||
@@ -43,10 +43,12 @@ import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.provider.MediaStore;
|
||||
import android.support.v4.content.FileProvider;
|
||||
import android.text.Editable;
|
||||
import android.text.TextUtils;
|
||||
import android.text.TextWatcher;
|
||||
import android.text.style.ClickableSpan;
|
||||
import android.text.style.URLSpan;
|
||||
import android.util.Log;
|
||||
import android.util.SparseIntArray;
|
||||
import android.util.TypedValue;
|
||||
import android.view.Gravity;
|
||||
import android.view.MotionEvent;
|
||||
@@ -59,45 +61,26 @@ import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.b44t.messenger.AndroidUtilities;
|
||||
import com.b44t.messenger.BuildConfig;
|
||||
import com.b44t.messenger.LocaleController;
|
||||
import com.b44t.messenger.MediaController;
|
||||
import com.b44t.messenger.MrChat;
|
||||
import com.b44t.messenger.MrContact;
|
||||
import com.b44t.messenger.MrMailbox;
|
||||
import com.b44t.messenger.MrMsg;
|
||||
import com.b44t.messenger.NotificationsController;
|
||||
import com.b44t.messenger.SendMessagesHelper;
|
||||
import com.b44t.messenger.Utilities;
|
||||
import com.b44t.messenger.VideoEditedInfo;
|
||||
import com.b44t.messenger.browser.Browser;
|
||||
import com.b44t.messenger.support.widget.LinearLayoutManager;
|
||||
import com.b44t.messenger.support.widget.RecyclerView;
|
||||
import com.b44t.messenger.ApplicationLoader;
|
||||
import com.b44t.messenger.TLRPC;
|
||||
import com.b44t.messenger.MessageObject;
|
||||
import com.b44t.messenger.NotificationCenter;
|
||||
import com.b44t.messenger.R;
|
||||
import com.b44t.ui.ActionBar.BackDrawable;
|
||||
import com.b44t.ui.ActionBar.SimpleTextView;
|
||||
import com.b44t.messenger.AnimatorListenerAdapterProxy;
|
||||
import com.b44t.ui.Cells.ChatActionCell;
|
||||
import com.b44t.ui.ActionBar.ActionBar;
|
||||
import com.b44t.ui.ActionBar.ActionBarMenu;
|
||||
import com.b44t.ui.ActionBar.ActionBarMenuItem;
|
||||
import com.b44t.ui.Cells.ChatMessageCell;
|
||||
import com.b44t.ui.Cells.ChatUnreadCell;
|
||||
import com.b44t.ui.ActionBar.BaseFragment;
|
||||
import com.b44t.ui.Components.ChatActivityEnterView;
|
||||
import com.b44t.messenger.ImageReceiver;
|
||||
import com.b44t.ui.Components.ChatAttachAlert;
|
||||
import com.b44t.ui.Components.ChatAvatarContainer;
|
||||
import com.b44t.ui.Components.LayoutHelper;
|
||||
import com.b44t.ui.Components.NumberTextView;
|
||||
import com.b44t.ui.Components.RecyclerListView;
|
||||
import com.b44t.ui.Components.SizeNotifierFrameLayout;
|
||||
import com.b44t.ui.ActionBar.Theme;
|
||||
import com.b44t.messenger.Components.Browser;
|
||||
import com.b44t.messenger.aosp.LinearLayoutManager;
|
||||
import com.b44t.messenger.aosp.RecyclerView;
|
||||
import com.b44t.messenger.ActionBar.BackDrawable;
|
||||
import com.b44t.messenger.ActionBar.SimpleTextView;
|
||||
import com.b44t.messenger.Cells.ChatActionCell;
|
||||
import com.b44t.messenger.ActionBar.ActionBar;
|
||||
import com.b44t.messenger.ActionBar.ActionBarMenu;
|
||||
import com.b44t.messenger.ActionBar.ActionBarMenuItem;
|
||||
import com.b44t.messenger.Cells.ChatMessageCell;
|
||||
import com.b44t.messenger.Cells.ChatUnreadCell;
|
||||
import com.b44t.messenger.ActionBar.BaseFragment;
|
||||
import com.b44t.messenger.Components.ChatActivityEnterView;
|
||||
import com.b44t.messenger.Components.ChatAttachAlert;
|
||||
import com.b44t.messenger.Components.ChatAvatarContainer;
|
||||
import com.b44t.messenger.Components.LayoutHelper;
|
||||
import com.b44t.messenger.Components.NumberTextView;
|
||||
import com.b44t.messenger.Components.RecyclerListView;
|
||||
import com.b44t.messenger.Components.SizeNotifierFrameLayout;
|
||||
import com.b44t.messenger.ActionBar.Theme;
|
||||
|
||||
import java.io.File;
|
||||
import java.net.URLDecoder;
|
||||
@@ -106,13 +89,13 @@ import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public class ChatActivity extends BaseFragment implements NotificationCenter.NotificationCenterDelegate, DialogsActivity.DialogsActivityDelegate,
|
||||
public class ChatActivity extends BaseFragment implements NotificationCenter.NotificationCenterDelegate, ChatlistActivity.ChatlistActivityDelegate,
|
||||
PhotoViewer.PhotoViewerProvider {
|
||||
|
||||
// data
|
||||
private long dialog_id;
|
||||
public MrChat m_mrChat = new MrChat(0);
|
||||
private boolean m_isChatWithDeaddrop, m_isDeaddropInChatlist;
|
||||
private boolean m_isChatWithDeaddrop /*, m_isDeaddropInChatlist*/;
|
||||
private int[] m_msglist = {};
|
||||
|
||||
// the list view
|
||||
@@ -152,7 +135,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||
|
||||
private boolean paused = true;
|
||||
private boolean wasPaused = false;
|
||||
private boolean readWhenResume = false;
|
||||
private SparseIntArray markseenWhenResume = new SparseIntArray();
|
||||
|
||||
private boolean scrollToTopOnResume;
|
||||
private boolean forceScrollToTop;
|
||||
@@ -179,9 +162,11 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||
private final static int ID_COPY = 10;
|
||||
private final static int ID_FORWARD = 11;
|
||||
private final static int ID_DELETE_MESSAGES = 12;
|
||||
private final static int ID_LEAVE_GROUP = 13;
|
||||
private final static int ID_ATTACH = 14;
|
||||
private final static int ID_SHOW_PROFILE = 15;
|
||||
private final static int ID_DELETE_CHAT = 16;
|
||||
private final static int ID_ARCHIVE_CHAT = 17;
|
||||
private final static int ID_MUTE = 18;
|
||||
private final static int ID_REPLY = 19;
|
||||
private final static int ID_INFO = 20;
|
||||
@@ -189,6 +174,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||
private final static int ID_SHARE = 22;
|
||||
private final static int ID_OPEN = 23;
|
||||
private final static int ID_SEARCH = 40;
|
||||
private final static int ID_SHOW_QR = 50;
|
||||
private final static int ID_CHAT_COMPOSE_PANEL = 1000;
|
||||
private TextView m_replyMenuItem, m_infoMenuItem, m_saveToXXMenuItem, m_openMenuItem, m_shareMenuItem;
|
||||
|
||||
@@ -206,15 +192,14 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||
m_mrChat = MrMailbox.getChat((int)dialog_id);
|
||||
m_isChatWithDeaddrop = m_mrChat.getId()==MrChat.MR_CHAT_ID_DEADDROP;
|
||||
|
||||
m_isDeaddropInChatlist = false;
|
||||
/*m_isDeaddropInChatlist = false;
|
||||
if( m_isChatWithDeaddrop && MrMailbox.getConfigInt("show_deaddrop", 0)!=0 ) {
|
||||
m_isDeaddropInChatlist = true;
|
||||
}
|
||||
}*/
|
||||
|
||||
startLoadFromMessageId = arguments.getInt("message_id", 0);
|
||||
scrollToTopOnResume = arguments.getBoolean("scrollToTopOnResume", false);
|
||||
|
||||
NotificationCenter.getInstance().addObserver(this, NotificationCenter.emojiDidLoaded);
|
||||
NotificationCenter.getInstance().addObserver(this, NotificationCenter.dialogsNeedReload);
|
||||
NotificationCenter.getInstance().addObserver(this, NotificationCenter.updateInterfaces);
|
||||
NotificationCenter.getInstance().addObserver(this, NotificationCenter.didReceivedNewMessages);
|
||||
@@ -232,10 +217,6 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||
NotificationCenter.getInstance().addObserver(this, NotificationCenter.waveformCalculated);
|
||||
NotificationCenter.getInstance().addObserver(this, NotificationCenter.notificationsSettingsUpdated);
|
||||
|
||||
if (AndroidUtilities.isTablet()) {
|
||||
NotificationCenter.getInstance().postNotificationName(NotificationCenter.openedChatChanged, dialog_id, false);
|
||||
}
|
||||
|
||||
AndroidUtilities.runOnUIThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
@@ -325,7 +306,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||
AndroidUtilities.runOnUIThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
MrMailbox.markseenChat((int)dialog_id);
|
||||
MrMailbox.marknoticedChat((int)dialog_id);
|
||||
NotificationsController.getInstance().removeSeenMessages();
|
||||
}
|
||||
}, 700);
|
||||
@@ -344,7 +325,6 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||
chatActivityEnterView.onDestroy();
|
||||
}
|
||||
|
||||
NotificationCenter.getInstance().removeObserver(this, NotificationCenter.emojiDidLoaded);
|
||||
NotificationCenter.getInstance().removeObserver(this, NotificationCenter.dialogsNeedReload);
|
||||
NotificationCenter.getInstance().removeObserver(this, NotificationCenter.updateInterfaces);
|
||||
NotificationCenter.getInstance().removeObserver(this, NotificationCenter.didReceivedNewMessages);
|
||||
@@ -362,15 +342,6 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||
NotificationCenter.getInstance().removeObserver(this, NotificationCenter.notificationsSettingsUpdated);
|
||||
NotificationCenter.getInstance().removeObserver(this, NotificationCenter.audioPlayStateChanged);
|
||||
|
||||
if (AndroidUtilities.isTablet()) {
|
||||
NotificationCenter.getInstance().postNotificationName(NotificationCenter.openedChatChanged, dialog_id, true);
|
||||
}
|
||||
|
||||
/*
|
||||
if (currentUser != null) {
|
||||
MessagesController.getInstance().cancelLoadFullUser(currentUser.id);
|
||||
}
|
||||
*/
|
||||
AndroidUtilities.removeAdjustResize(getParentActivity(), classGuid);
|
||||
|
||||
if (chatAttachAlert != null) {
|
||||
@@ -443,14 +414,14 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||
args.putBoolean("onlySelect", true);
|
||||
args.putString("onlySelectTitle", context.getString(R.string.ForwardToTitle));
|
||||
args.putString("selectAlertString", context.getString(R.string.ForwardMessagesTo));
|
||||
DialogsActivity fragment = new DialogsActivity(args);
|
||||
ChatlistActivity fragment = new ChatlistActivity(args);
|
||||
fragment.setDelegate(ChatActivity.this);
|
||||
presentFragment(fragment); // this results in a call to didSelectDialog()
|
||||
presentFragment(fragment); // this results in a call to didSelectChat()
|
||||
}
|
||||
else if( id == ID_SHOW_PROFILE )
|
||||
{
|
||||
Bundle args = new Bundle();
|
||||
if( m_mrChat.getType()== MrChat.MR_CHAT_GROUP ) {
|
||||
if( m_mrChat.isGroup() ) {
|
||||
args.putInt("chat_id", m_mrChat.getId());
|
||||
}
|
||||
else {
|
||||
@@ -461,9 +432,32 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||
args.putInt("user_id", contact_ids[0]);
|
||||
}
|
||||
ProfileActivity fragment = new ProfileActivity(args);
|
||||
fragment.setPlayProfileAnimation(true);
|
||||
presentFragment(fragment);
|
||||
}
|
||||
else if( id == ID_LEAVE_GROUP )
|
||||
{
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
|
||||
builder.setPositiveButton(R.string.OK, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialogInterface, int i) {
|
||||
MrMailbox.removeContactFromChat(m_mrChat.getId(), MrContact.MR_CONTACT_ID_SELF);
|
||||
NotificationCenter.getInstance().postNotificationName(NotificationCenter.updateInterfaces, MrMailbox.UPDATE_MASK_CHAT_MEMBERS);
|
||||
AndroidUtilities.showDoneHint(context);
|
||||
}
|
||||
});
|
||||
builder.setNegativeButton(R.string.Cancel, null);
|
||||
builder.setMessage(AndroidUtilities.replaceTags(context.getString(R.string.AskLeaveGroup)));
|
||||
showDialog(builder.create());
|
||||
}
|
||||
else if ( id == ID_ARCHIVE_CHAT)
|
||||
{
|
||||
int do_archive = m_mrChat.getArchived()==0? 1: 0;
|
||||
MrMailbox.archiveChat((int)dialog_id, do_archive);
|
||||
AndroidUtilities.showDoneHint(context);
|
||||
if( do_archive == 1 ) {
|
||||
finishFragment();
|
||||
}
|
||||
}
|
||||
else if ( id == ID_DELETE_CHAT)
|
||||
{
|
||||
// as the history may be a mix of messenger-messages and emails, it is not safe to delete it.
|
||||
@@ -474,19 +468,15 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
|
||||
builder.setMessage(context.getString(R.string.AreYouSureDeleteThisChat));
|
||||
builder.setPositiveButton(context.getString(R.string.OK), new DialogInterface.OnClickListener() {
|
||||
builder.setPositiveButton(R.string.OK, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialogInterface, int i) {
|
||||
if( MrMailbox.deleteChat((int)dialog_id)!=0 ) {
|
||||
AndroidUtilities.showDoneHint(getParentActivity());
|
||||
finishFragment();
|
||||
}
|
||||
else {
|
||||
AndroidUtilities.showErrorHint(getParentActivity()); // normally, there is no reason for deleteChat to fail() as everything is just local
|
||||
}
|
||||
MrMailbox.deleteChat((int)dialog_id);
|
||||
AndroidUtilities.showDoneHint(getParentActivity());
|
||||
finishFragment();
|
||||
}
|
||||
});
|
||||
builder.setNegativeButton(context.getString(R.string.Cancel), null);
|
||||
builder.setNegativeButton(R.string.Cancel, null);
|
||||
showDialog(builder.create());
|
||||
} else if (id == ID_MUTE) {
|
||||
toggleMute();
|
||||
@@ -504,13 +494,8 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||
} else if (id == ID_INFO) {
|
||||
String info_str = MrMailbox.getMsgInfo(getFirstSelectedId());
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
|
||||
builder.setMessage(info_str);
|
||||
builder.setPositiveButton(context.getString(R.string.OK), new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialogInterface, int i) {
|
||||
;
|
||||
}
|
||||
});
|
||||
builder.setMessage(AndroidUtilities.replaceTags(info_str));
|
||||
builder.setPositiveButton(R.string.OK, null);
|
||||
showDialog(builder.create());
|
||||
actionBar.hideActionMode();
|
||||
updateVisibleRowsFast();
|
||||
@@ -549,10 +534,17 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||
} else if (id == ID_SEARCH) {
|
||||
openSearchWithText("");
|
||||
}
|
||||
else if( id == ID_SHOW_QR ) {
|
||||
Intent intent2 = new Intent(getParentActivity(), QRshowActivity.class);
|
||||
Bundle b = new Bundle();
|
||||
b.putInt("chat_id", (int)dialog_id);
|
||||
intent2.putExtras(b);
|
||||
getParentActivity().startActivity(intent2);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
if( m_isChatWithDeaddrop && !m_isDeaddropInChatlist ) {
|
||||
if( m_isChatWithDeaddrop /*&& !m_isDeaddropInChatlist*/ ) {
|
||||
actionBar.setTitle(context.getString(R.string.Deaddrop));
|
||||
}
|
||||
else {
|
||||
@@ -611,27 +603,31 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||
|
||||
|
||||
headerItem = menu.addItem(0, R.drawable.ic_ab_other);
|
||||
headerItem.addSubItem(ID_SEARCH, context.getString(R.string.Search), 0);
|
||||
headerItem.addSubItem(ID_SEARCH, context.getString(R.string.Search));
|
||||
|
||||
m_canMute = true;
|
||||
if( m_isChatWithDeaddrop && !m_isDeaddropInChatlist ) {
|
||||
if( m_isChatWithDeaddrop /*&& !m_isDeaddropInChatlist*/ ) {
|
||||
m_canMute = false;
|
||||
}
|
||||
|
||||
if( m_canMute ) {
|
||||
muteMenuEntry = headerItem.addSubItem(ID_MUTE, null, 0);
|
||||
muteMenuEntry = headerItem.addSubItem(ID_MUTE, null);
|
||||
}
|
||||
|
||||
//if( !m_isChatWithDeaddrop ) {
|
||||
//headerItem.addSubItem(ID_ATTACH, context.getString(R.string.AttachFiles), 0); // "Attach" means "Attach to chat", not "Attach to message" (which is not possible)
|
||||
//}
|
||||
|
||||
if( !m_isChatWithDeaddrop ) {
|
||||
headerItem.addSubItem(ID_ATTACH, context.getString(R.string.AttachFiles), 0); // "Attach" means "Attach to chat", not "Attach to message" (which is not possible)
|
||||
}
|
||||
|
||||
if( !m_isChatWithDeaddrop || m_isDeaddropInChatlist ) {
|
||||
headerItem.addSubItem(ID_SHOW_PROFILE, context.getString(R.string.ViewProfile), 0);
|
||||
}
|
||||
|
||||
if( !m_isChatWithDeaddrop ) {
|
||||
headerItem.addSubItem(ID_DELETE_CHAT, context.getString(R.string.DeleteChat), 0);
|
||||
headerItem.addSubItem(ID_SHOW_PROFILE, context.getString(R.string.ViewProfile));
|
||||
if( m_mrChat.isGroup() ) {
|
||||
if ( m_mrChat.isVerified() ) {
|
||||
headerItem.addSubItem(ID_SHOW_QR, context.getString(R.string.QrShowInviteCode));
|
||||
}
|
||||
headerItem.addSubItem(ID_LEAVE_GROUP, context.getString(R.string.LeaveGroup));
|
||||
}
|
||||
headerItem.addSubItem(ID_ARCHIVE_CHAT, context.getString(m_mrChat.getArchived()==0? R.string.ArchiveChat : R.string.UnarchiveChat));
|
||||
headerItem.addSubItem(ID_DELETE_CHAT, context.getString(R.string.DeleteChat));
|
||||
}
|
||||
|
||||
updateTitle();
|
||||
@@ -667,11 +663,11 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||
|
||||
setMeasuredDimension(width, height);
|
||||
|
||||
actionModeTextView.setTextSize(!AndroidUtilities.isTablet() && getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE ? 18 : 20);
|
||||
actionModeTextView.setTextSize(getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE ? 18 : 20);
|
||||
actionModeTextView.measure(MeasureSpec.makeMeasureSpec(width, MeasureSpec.AT_MOST), MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(24), MeasureSpec.AT_MOST));
|
||||
|
||||
if (actionModeSubTextView.getVisibility() != GONE) {
|
||||
actionModeSubTextView.setTextSize(!AndroidUtilities.isTablet() && getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE ? 14 : 16);
|
||||
actionModeSubTextView.setTextSize(getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE ? 14 : 16);
|
||||
actionModeSubTextView.measure(MeasureSpec.makeMeasureSpec(width, MeasureSpec.AT_MOST), MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(20), MeasureSpec.AT_MOST));
|
||||
}
|
||||
}
|
||||
@@ -682,14 +678,14 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||
|
||||
int textTop;
|
||||
if (actionModeSubTextView.getVisibility() != GONE) {
|
||||
textTop = (height / 2 - actionModeTextView.getTextHeight()) / 2 + AndroidUtilities.dp(!AndroidUtilities.isTablet() && getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE ? 2 : 3);
|
||||
textTop = (height / 2 - actionModeTextView.getTextHeight()) / 2 + AndroidUtilities.dp(getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE ? 2 : 3);
|
||||
} else {
|
||||
textTop = (height - actionModeTextView.getTextHeight()) / 2;
|
||||
}
|
||||
actionModeTextView.layout(0, textTop, actionModeTextView.getMeasuredWidth(), textTop + actionModeTextView.getTextHeight());
|
||||
|
||||
if (actionModeSubTextView.getVisibility() != GONE) {
|
||||
textTop = height / 2 + (height / 2 - actionModeSubTextView.getTextHeight()) / 2 - AndroidUtilities.dp(!AndroidUtilities.isTablet() && getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE ? 1 : 1);
|
||||
textTop = height / 2 + (height / 2 - actionModeSubTextView.getTextHeight()) / 2 - AndroidUtilities.dp(getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE ? 1 : 1);
|
||||
actionModeSubTextView.layout(0, textTop, actionModeSubTextView.getMeasuredWidth(), textTop + actionModeSubTextView.getTextHeight());
|
||||
}
|
||||
}
|
||||
@@ -717,13 +713,13 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||
actionModeViews.add(actionMode.addItem(ID_FORWARD, R.drawable.ic_ab_fwd_forward, Theme.ACTION_BAR_MODE_SELECTOR_COLOR, null, AndroidUtilities.dp(54)));
|
||||
ActionBarMenuItem submenu = actionMode.addItem(0, R.drawable.ic_ab_other_grey);
|
||||
if( m_isChatWithDeaddrop ) {
|
||||
m_replyMenuItem = submenu.addSubItem(ID_REPLY, context.getString(R.string.Reply), 0);
|
||||
m_replyMenuItem = submenu.addSubItem(ID_REPLY, context.getString(R.string.Reply));
|
||||
}
|
||||
submenu.addSubItem(ID_COPY, context.getString(R.string.CopyToClipboard), 0);
|
||||
m_saveToXXMenuItem = submenu.addSubItem(ID_SAVE_TO_XX, "", 0);
|
||||
m_openMenuItem = submenu.addSubItem(ID_OPEN, context.getString(R.string.Open), 0);
|
||||
m_shareMenuItem = submenu.addSubItem(ID_SHARE, context.getString(R.string.Share), 0);
|
||||
m_infoMenuItem = submenu.addSubItem(ID_INFO, context.getString(R.string.Info), 0);
|
||||
submenu.addSubItem(ID_COPY, context.getString(R.string.CopyToClipboard));
|
||||
m_saveToXXMenuItem = submenu.addSubItem(ID_SAVE_TO_XX, "");
|
||||
m_openMenuItem = submenu.addSubItem(ID_OPEN, context.getString(R.string.Open));
|
||||
m_shareMenuItem = submenu.addSubItem(ID_SHARE, context.getString(R.string.Share));
|
||||
m_infoMenuItem = submenu.addSubItem(ID_INFO, context.getString(R.string.Info));
|
||||
actionModeViews.add(submenu);
|
||||
checkActionBarMenu();
|
||||
|
||||
@@ -860,11 +856,11 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||
|
||||
TextView emptyView = new TextView(context);
|
||||
|
||||
if( m_mrChat.getParamInt(MrChat.MR_CHAT_PARAM_UNPROMOTED, 0)==1 ) {
|
||||
if( m_mrChat.isUnpromoted() ) {
|
||||
emptyView.setText(context.getString(R.string.MsgNewGroupDraftHint));
|
||||
emptyView.setGravity(Gravity.START);
|
||||
}
|
||||
else if( m_mrChat.getType()==MrChat.MR_CHAT_NORMAL ){
|
||||
else if( !m_mrChat.isGroup() && !m_mrChat.isSelfTalk() ){
|
||||
String name = m_mrChat.getName();
|
||||
emptyView.setText(AndroidUtilities.replaceTags(String.format(context.getString(R.string.NoMessagesHint), name, name)));
|
||||
emptyView.setGravity(Gravity.START);
|
||||
@@ -1077,8 +1073,6 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||
//noinspection ResourceType
|
||||
chatActivityEnterView.setId(ID_CHAT_COMPOSE_PANEL);
|
||||
|
||||
chatActivityEnterView.setAllowStickersAndGifs(false, false); // for the moment, we have no stickers
|
||||
|
||||
contentView.addView(chatActivityEnterView, contentView.getChildCount() - 1, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.START | Gravity.BOTTOM));
|
||||
chatActivityEnterView.setDelegate(new ChatActivityEnterView.ChatActivityEnterViewDelegate() {
|
||||
@Override
|
||||
@@ -1099,10 +1093,6 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||
@Override
|
||||
public void onWindowSizeChanged(int size) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStickersTab(boolean opened) {
|
||||
}
|
||||
});
|
||||
|
||||
bottomOverlay = new FrameLayout(context);
|
||||
@@ -1144,8 +1134,6 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||
|
||||
updateBottomOverlay();
|
||||
|
||||
fixLayoutInternal();
|
||||
|
||||
return fragmentView;
|
||||
}
|
||||
|
||||
@@ -1471,7 +1459,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||
}
|
||||
}
|
||||
|
||||
private void createChatByDeaddropMsgId(int messageId)
|
||||
private void createChatByDeaddropMsgId(final int messageId)
|
||||
{
|
||||
final Context context = getParentActivity();
|
||||
if (context == null) {
|
||||
@@ -1490,10 +1478,10 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||
|
||||
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
|
||||
builder.setPositiveButton(context.getString(R.string.OK), new DialogInterface.OnClickListener() {
|
||||
builder.setPositiveButton(R.string.OK, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialogInterface, int i) {
|
||||
int chatId = MrMailbox.createChatByContactId(fromId);
|
||||
int chatId = MrMailbox.createChatByMsgId(messageId);
|
||||
if( chatId != 0 ) {
|
||||
Bundle args = new Bundle();
|
||||
args.putInt("chat_id", chatId);
|
||||
@@ -1504,7 +1492,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||
}
|
||||
}
|
||||
});
|
||||
builder.setNegativeButton(context.getString(R.string.Cancel), null);
|
||||
builder.setNegativeButton(R.string.Cancel, null);
|
||||
builder.setMessage(AndroidUtilities.replaceTags(String.format(context.getString(R.string.AskStartChatWith), name)));
|
||||
showDialog(builder.create());
|
||||
}
|
||||
@@ -1642,6 +1630,9 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||
if (view instanceof ChatMessageCell) {
|
||||
message = ((ChatMessageCell) view).getMessageObject();
|
||||
}
|
||||
else if( view instanceof ChatActionCell) {
|
||||
message = ((ChatActionCell) view).getMessageObject();
|
||||
}
|
||||
|
||||
if (message==null || !message.isSelectable()) {
|
||||
return;
|
||||
@@ -1668,17 +1659,21 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||
}
|
||||
|
||||
private void updateTitleIcons() {
|
||||
int rightIcon = 0;
|
||||
int leftIcon = 0, rightIcon = 0;
|
||||
if( m_canMute && MrMailbox.isDialogMuted(dialog_id) ) {
|
||||
rightIcon = R.drawable.mute_fixed;
|
||||
leftIcon = R.drawable.mute_blue;
|
||||
}
|
||||
|
||||
if( m_mrChat!=null && m_mrChat.isVerified() ) {
|
||||
rightIcon = R.drawable.verified;
|
||||
}
|
||||
|
||||
if (avatarContainer != null) {
|
||||
avatarContainer.setTitleIcons(0, rightIcon);
|
||||
avatarContainer.setTitleIcons(leftIcon, rightIcon);
|
||||
}
|
||||
|
||||
if( muteMenuEntry != null ) {
|
||||
if (rightIcon != 0) {
|
||||
if (leftIcon != 0) {
|
||||
muteMenuEntry.setText(ApplicationLoader.applicationContext.getString(R.string.UnmuteNotifications));
|
||||
} else {
|
||||
muteMenuEntry.setText(ApplicationLoader.applicationContext.getString(R.string.MuteNotifications));
|
||||
@@ -1913,21 +1908,17 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||
|
||||
if (markAsRead) {
|
||||
if (paused) {
|
||||
readWhenResume = true;
|
||||
markseenWhenResume.put(evt_msg_id, 1);
|
||||
} else {
|
||||
MrMailbox.markseenMsg(evt_msg_id);
|
||||
int msg_ids[] = new int[1];
|
||||
msg_ids[0] = evt_msg_id;
|
||||
MrMailbox.markseenMsgs(msg_ids);
|
||||
NotificationsController.getInstance().removeSeenMessages();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (id == NotificationCenter.emojiDidLoaded)
|
||||
{
|
||||
if (chatListView != null) {
|
||||
chatListView.invalidateViews();
|
||||
}
|
||||
}
|
||||
else if (id == NotificationCenter.updateInterfaces)
|
||||
{
|
||||
int updateMask = (Integer) args[0];
|
||||
@@ -2251,9 +2242,15 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||
scrollToMessage = null;
|
||||
}
|
||||
paused = false;
|
||||
if (readWhenResume ) {
|
||||
readWhenResume = false;
|
||||
MrMailbox.markseenChat((int)dialog_id);
|
||||
|
||||
int markseenWhenResumeCnt = markseenWhenResume.size();
|
||||
if (markseenWhenResumeCnt>0 ) {
|
||||
int msg_ids[] = new int[markseenWhenResumeCnt];
|
||||
for(int i=0; i<markseenWhenResumeCnt; i++) {
|
||||
msg_ids[i] = markseenWhenResume.keyAt(i);
|
||||
}
|
||||
MrMailbox.markseenMsgs(msg_ids);
|
||||
markseenWhenResume.clear();
|
||||
NotificationsController.getInstance().removeSeenMessages();
|
||||
}
|
||||
|
||||
@@ -2335,24 +2332,6 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||
}
|
||||
}
|
||||
|
||||
private boolean fixLayoutInternal() {
|
||||
/*if (!AndroidUtilities.isTablet() && ApplicationLoader.applicationContext.getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) {
|
||||
selectedMessagesCountTextView.setTextSize(18);
|
||||
} else {
|
||||
selectedMessagesCountTextView.setTextSize(20);
|
||||
}*/
|
||||
|
||||
if (AndroidUtilities.isTablet()) {
|
||||
if (AndroidUtilities.isSmallTablet() && ApplicationLoader.applicationContext.getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT) {
|
||||
actionBar.setBackButtonDrawable(new BackDrawable(false));
|
||||
} else {
|
||||
actionBar.setBackButtonDrawable(new BackDrawable(parentLayout == null || parentLayout.fragmentsStack.isEmpty() || parentLayout.fragmentsStack.get(0) == ChatActivity.this || parentLayout.fragmentsStack.size() == 1));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private void fixLayout() {
|
||||
if (avatarContainer != null) {
|
||||
avatarContainer.getViewTreeObserver().addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() {
|
||||
@@ -2361,7 +2340,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||
if (avatarContainer != null) {
|
||||
avatarContainer.getViewTreeObserver().removeOnPreDrawListener(this);
|
||||
}
|
||||
return fixLayoutInternal();
|
||||
return true;
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -2375,7 +2354,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||
private void createDeleteMessagesAlert() {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
|
||||
builder.setMessage(ApplicationLoader.applicationContext.getResources().getQuantityString(R.plurals.AreYouSureDeleteMessages, selectedMessagesIds.size(), selectedMessagesIds.size()));
|
||||
builder.setPositiveButton(ApplicationLoader.applicationContext.getString(R.string.OK), new DialogInterface.OnClickListener() {
|
||||
builder.setPositiveButton(R.string.OK, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialogInterface, int i) {
|
||||
|
||||
@@ -2392,11 +2371,10 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||
actionBar.hideActionMode();
|
||||
updateVisibleRows();
|
||||
|
||||
MrMailbox.reloadMainChatlist();
|
||||
NotificationCenter.getInstance().postNotificationName(NotificationCenter.dialogsNeedReload);
|
||||
}
|
||||
});
|
||||
builder.setNegativeButton(ApplicationLoader.applicationContext.getString(R.string.Cancel), null);
|
||||
builder.setNegativeButton(R.string.Cancel, null);
|
||||
showDialog(builder.create());
|
||||
}
|
||||
|
||||
@@ -2458,7 +2436,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||
}
|
||||
|
||||
@Override
|
||||
public void didSelectDialog(DialogsActivity dialogsFragment, long fwd_chat_id, boolean param)
|
||||
public void didSelectChat(ChatlistActivity dialogsFragment, long fwd_chat_id, boolean param)
|
||||
{
|
||||
if( selectedMessagesIds.size()>0) {
|
||||
int ids[] = new int[selectedMessagesIds.size()], i = 0;
|
||||
@@ -2478,9 +2456,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||
args.putInt("chat_id", (int)fwd_chat_id);
|
||||
ChatActivity fragment = new ChatActivity(args);
|
||||
if( presentFragment(fragment, true /*remove last*/) ) {
|
||||
if (!AndroidUtilities.isTablet()) {
|
||||
removeSelfFromStack();
|
||||
}
|
||||
removeSelfFromStack();
|
||||
}
|
||||
else {
|
||||
dialogsFragment.finishFragment(false);
|
||||
@@ -2541,6 +2517,18 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||
messageCell.setHighlightedText(null);
|
||||
}
|
||||
}
|
||||
else if( view_ instanceof ChatActionCell ) {
|
||||
ChatActionCell actionCell = (ChatActionCell)view_;
|
||||
if (actionBar.isActionModeShowed()) {
|
||||
if ( selectedMessagesIds.containsKey(actionCell.getMessageObject().getId()) ) {
|
||||
actionCell.setBackgroundColor(Theme.MSG_SELECTED_BACKGROUND_COLOR);
|
||||
} else {
|
||||
actionCell.setBackgroundColor(0);
|
||||
}
|
||||
} else {
|
||||
actionCell.setBackgroundColor(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
chatListView.invalidate();
|
||||
@@ -2702,11 +2690,15 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||
Bundle args = new Bundle();
|
||||
args.putInt("user_id", user.id);
|
||||
ProfileActivity fragment = new ProfileActivity(args);
|
||||
fragment.setPlayProfileAnimation(false);
|
||||
presentFragment(fragment);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void didPressedSetupMessage(ChatMessageCell cell) {
|
||||
querySetupCode(cell.getMessageObject().getId(), null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canPerformActions() {
|
||||
return actionBar != null && !actionBar.isActionModeShowed();
|
||||
@@ -2769,13 +2761,13 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||
if( isMailto )
|
||||
{
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
|
||||
builder.setPositiveButton(mContext.getString(R.string.OK), new DialogInterface.OnClickListener() {
|
||||
builder.setPositiveButton(R.string.OK, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialogInterface, int i) {
|
||||
createChat(urlFinal);
|
||||
createChat(urlFinal);
|
||||
}
|
||||
});
|
||||
builder.setNegativeButton(mContext.getString(R.string.Cancel), null);
|
||||
builder.setNegativeButton(R.string.Cancel, null);
|
||||
builder.setMessage(AndroidUtilities.replaceTags(String.format(mContext.getString(R.string.AskStartChatWith), urlTitle)));
|
||||
showDialog(builder.create());
|
||||
}
|
||||
@@ -2800,7 +2792,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||
public void didPressedImage(ChatMessageCell cell) {
|
||||
MessageObject message = cell.getMessageObject();
|
||||
|
||||
if( message.type == MessageObject.MO_TYPE3_VIDEO && MrMailbox.getMsg(message.getId()).isIncreation()!=0 ) {
|
||||
if( message.type == MessageObject.MO_TYPE3_VIDEO && MrMailbox.getMsg(message.getId()).isIncreation() ) {
|
||||
return; // we're not ready (still compressing), a hint is already shown in the message itself
|
||||
}
|
||||
|
||||
@@ -2855,8 +2847,8 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||
MessageObject msgDrawObj = new MessageObject(msg, true);
|
||||
|
||||
ChatMessageCell messageCell = (ChatMessageCell) view;
|
||||
messageCell.isGroupChat = m_mrChat.getType()==MrChat.MR_CHAT_GROUP;
|
||||
messageCell.setMessageObject(msgDrawObj);
|
||||
messageCell.isGroupChat = m_mrChat.isGroup();
|
||||
messageCell.setMessageObject(msgDrawObj, m_isChatWithDeaddrop);
|
||||
messageCell.setCheckPressed(!disableSelection, disableSelection && selected);
|
||||
messageCell.setHighlighted(highlightMessageId != 0 && msgDrawObj.getId() == highlightMessageId);
|
||||
|
||||
@@ -2865,11 +2857,24 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||
} else {
|
||||
messageCell.setHighlightedText(null);
|
||||
}
|
||||
|
||||
// mark message as being read
|
||||
int state = mrMsg.getState();
|
||||
if( state == MrMsg.MR_IN_FRESH || state==MrMsg.MR_IN_NOTICED ) {
|
||||
if(paused) {
|
||||
markseenWhenResume.put(msg_id, 1);
|
||||
}
|
||||
else {
|
||||
int msg_ids[] = new int[1];
|
||||
msg_ids[0] = msg_id;
|
||||
MrMailbox.markseenMsgs(msg_ids);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if( view instanceof ChatActionCell )
|
||||
{
|
||||
// show a date headline (the date comes from the _next_ message)
|
||||
if( msg_id == MrMsg.MR_MSG_ID_DAYMARKER && i+1 < m_msglist.length ) {
|
||||
// show a date headline (the date comes from the _next_ message)
|
||||
MrMsg mrMsg = MrMailbox.getMsg(m_msglist[i+1]);
|
||||
|
||||
TLRPC.Message dateMsg = new TLRPC.Message();
|
||||
@@ -2880,6 +2885,28 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||
msgDrawObj.type = MessageObject.MO_TYPE10_DATE_HEADLINE;
|
||||
msgDrawObj.contentType = ROWTYPE_DATE_HEADLINE;
|
||||
|
||||
ChatActionCell actionCell = (ChatActionCell) view;
|
||||
actionCell.setMessageObject(msgDrawObj);
|
||||
}
|
||||
else {
|
||||
MrMsg mrMsg = MrMailbox.getMsg(msg_id);
|
||||
|
||||
MessageObject msgDrawObj = new MessageObject(mrMsg.get_TLRPC_Message(), false);
|
||||
|
||||
// Add the suffix " (by ...)" to the action, see strings.xml for details.
|
||||
int fromId = mrMsg.getFromId();
|
||||
if( fromId != MrContact.MR_CONTACT_ID_DEVICE ) {
|
||||
String actionStr = msgDrawObj.messageText.toString();
|
||||
if(actionStr.endsWith(".")) { actionStr = actionStr.substring(0, actionStr.length() - 1); }
|
||||
if( fromId == MrContact.MR_CONTACT_ID_SELF ) {
|
||||
msgDrawObj.messageText = String.format(ApplicationLoader.applicationContext.getString(R.string.ActionBySelf), actionStr);
|
||||
}
|
||||
else {
|
||||
String fromStr = MrMailbox.getContact(mrMsg.getFromId()).getFirstName();
|
||||
msgDrawObj.messageText = String.format(ApplicationLoader.applicationContext.getString(R.string.ActionByUser), actionStr, fromStr);
|
||||
}
|
||||
}
|
||||
|
||||
ChatActionCell actionCell = (ChatActionCell) view;
|
||||
actionCell.setMessageObject(msgDrawObj);
|
||||
}
|
||||
@@ -2901,6 +2928,11 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||
else if( m_msglist[i]==MrMsg.MR_MSG_ID_MARKER1 ) {
|
||||
return ROWTYPE_UNREAD_HEADLINE;
|
||||
}
|
||||
|
||||
if( MrMailbox.getMsg(m_msglist[i]).isInfo() ) {
|
||||
return ROWTYPE_DATE_HEADLINE;
|
||||
}
|
||||
|
||||
}
|
||||
return ROWTYPE_MESSAGE_CELL;
|
||||
}
|
||||
@@ -2932,4 +2964,85 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void querySetupCode(final int msg_id, String[] preload)
|
||||
{
|
||||
if( !MrMailbox.getMsg(msg_id).isSetupMessage()) {
|
||||
return;
|
||||
}
|
||||
|
||||
View gl = View.inflate(getParentActivity(), R.layout.setup_code_grid, null);
|
||||
final EditText[] editTexts = {
|
||||
(EditText) gl.findViewById(R.id.setupCode0), (EditText) gl.findViewById(R.id.setupCode1), (EditText) gl.findViewById(R.id.setupCode2),
|
||||
(EditText) gl.findViewById(R.id.setupCode3), (EditText) gl.findViewById(R.id.setupCode4), (EditText) gl.findViewById(R.id.setupCode5),
|
||||
(EditText) gl.findViewById(R.id.setupCode6), (EditText) gl.findViewById(R.id.setupCode7), (EditText) gl.findViewById(R.id.setupCode8)
|
||||
};
|
||||
AlertDialog.Builder builder1 = new AlertDialog.Builder(getParentActivity());
|
||||
builder1.setView(gl);
|
||||
editTexts[0].setText(MrMailbox.getMsg(msg_id).getSetupCodeBegin());
|
||||
editTexts[0].setSelection(editTexts[0].getText().length());
|
||||
|
||||
for( int i = 0; i < 9; i++ ) {
|
||||
if( preload != null && i < preload.length ) {
|
||||
editTexts[i].setText(preload[i]);
|
||||
editTexts[i].setSelection(editTexts[i].getText().length());
|
||||
}
|
||||
editTexts[i].addTextChangedListener(new TextWatcher() {
|
||||
@Override
|
||||
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||
if( s.length()==4 ) {
|
||||
for ( int i = 0; i < 8; i++ ) {
|
||||
if( editTexts[i].hasFocus() && editTexts[i+1].getText().length()<4 ) {
|
||||
editTexts[i+1].requestFocus();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterTextChanged(Editable s) {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
builder1.setTitle(ApplicationLoader.applicationContext.getString(R.string.AutocryptKeyTransfer));
|
||||
builder1.setMessage(AndroidUtilities.replaceTags(ApplicationLoader.applicationContext.getString(R.string.AutocryptKeyTransferPleaseEnterCode)));
|
||||
builder1.setNegativeButton(R.string.Cancel, null);
|
||||
builder1.setCancelable(false); // prevent the dialog from being dismissed accidentally (when the dialog is closed, the setup code is gone forever and the user has to create a new setup message)
|
||||
builder1.setPositiveButton(R.string.OK, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
String setup_code = "";
|
||||
final String[] preload = new String[9];
|
||||
for ( int i = 0; i < 9; i++ ) {
|
||||
preload[i] = editTexts[i].getText().toString();
|
||||
setup_code += preload[i];
|
||||
}
|
||||
boolean success = MrMailbox.continueKeyTransfer(msg_id, setup_code);
|
||||
|
||||
AlertDialog.Builder builder2 = new AlertDialog.Builder(getParentActivity());
|
||||
builder2.setTitle(ApplicationLoader.applicationContext.getString(R.string.AutocryptKeyTransfer));
|
||||
builder2.setMessage(AndroidUtilities.replaceTags(ApplicationLoader.applicationContext.getString(success? R.string.AutocryptKeyTransferSucceeded : R.string.AutocryptKeyTransferBadCode)));
|
||||
if( success ) {
|
||||
builder2.setPositiveButton(R.string.OK, null);
|
||||
}
|
||||
else {
|
||||
builder2.setNegativeButton(R.string.Cancel, null);
|
||||
builder2.setPositiveButton(R.string.Retry, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
querySetupCode(msg_id, preload);
|
||||
}
|
||||
});
|
||||
}
|
||||
showDialog(builder2.create());
|
||||
}
|
||||
});
|
||||
showDialog(builder1.create());
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
+1
-1
@@ -21,7 +21,7 @@
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
package com.b44t.ui.Components;
|
||||
package com.b44t.messenger.Components;
|
||||
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapShader;
|
||||
+56
-15
@@ -21,7 +21,7 @@
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
package com.b44t.ui.Components;
|
||||
package com.b44t.messenger.Components;
|
||||
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.ColorFilter;
|
||||
@@ -29,38 +29,77 @@ import android.graphics.Paint;
|
||||
import android.graphics.PixelFormat;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Build;
|
||||
import android.text.Layout;
|
||||
import android.text.StaticLayout;
|
||||
import android.text.TextPaint;
|
||||
|
||||
import com.b44t.messenger.AndroidUtilities;
|
||||
|
||||
public class LetterDrawable extends Drawable {
|
||||
public class AvatarDrawable extends Drawable {
|
||||
|
||||
public static Paint paint = new Paint();
|
||||
private static Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG);
|
||||
private static TextPaint namePaint;
|
||||
private static int[] arrColors = {0xffe56555, 0xfff28c48, 0xff8e85ee, 0xff76c84d, 0xff5bb6cc, 0xff549cdd, 0xffd25c99, 0xffb37800}; /* the colors should contrast to typical action bar colors as well as to white (more important, is used as text color)*/
|
||||
|
||||
private int color;
|
||||
private StaticLayout textLayout;
|
||||
private float textWidth;
|
||||
private float textHeight;
|
||||
private float textLeft;
|
||||
private StringBuilder stringBuilder = new StringBuilder(5);
|
||||
|
||||
public LetterDrawable() {
|
||||
public AvatarDrawable() {
|
||||
super();
|
||||
|
||||
if (namePaint == null) {
|
||||
paint.setColor(0xfff0f0f0);
|
||||
namePaint = new TextPaint(Paint.ANTI_ALIAS_FLAG);
|
||||
namePaint.setColor(0xffffffff);
|
||||
namePaint.setTextSize(AndroidUtilities.dp(28));
|
||||
namePaint.setTextSize(AndroidUtilities.dp(20));
|
||||
}
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
private static int getColorIndex(int id) {
|
||||
return Math.abs(id % arrColors.length);
|
||||
}
|
||||
|
||||
public static int getNameColor(String name) {
|
||||
int id = strChecksum(name);
|
||||
return arrColors[getColorIndex(id)];
|
||||
}
|
||||
|
||||
private static int strChecksum(String str) {
|
||||
int ret = 0;
|
||||
if( str!=null ) {
|
||||
int i;
|
||||
for (i = 0; i < str.length(); i++) {
|
||||
ret += (i+1)*str.charAt(i);
|
||||
ret %= 0x00FFFFFF;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
public void setInfoByName(String name) {
|
||||
int id = strChecksum(name);
|
||||
|
||||
color = arrColors[getColorIndex(id)];
|
||||
|
||||
stringBuilder.setLength(0);
|
||||
if (title != null && title.length() > 0) {
|
||||
stringBuilder.append(title.substring(0, 1));
|
||||
if (name != null && name.length() > 0) {
|
||||
stringBuilder.appendCodePoint(name.codePointAt(0));
|
||||
|
||||
for (int a = name.length() - 1; a >= 0; a--) {
|
||||
if (name.charAt(a) == ' ') {
|
||||
if (a != name.length() - 1 && name.charAt(a + 1) != ' ') {
|
||||
if (Build.VERSION.SDK_INT >= 16) {
|
||||
stringBuilder.append("\u200C"); // ZERO WIDTH NON-JOINER - avoids the two letter to melt into a ligature which would be incorrect on the initials
|
||||
}
|
||||
stringBuilder.appendCodePoint(name.codePointAt(a + 1));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (stringBuilder.length() > 0) {
|
||||
@@ -87,23 +126,25 @@ public class LetterDrawable extends Drawable {
|
||||
return;
|
||||
}
|
||||
int size = bounds.width();
|
||||
paint.setColor(color);
|
||||
canvas.save();
|
||||
canvas.drawRect(bounds.left, bounds.top, bounds.right, bounds.bottom, paint);
|
||||
canvas.translate(bounds.left, bounds.top);
|
||||
canvas.drawCircle(size / 2, size / 2, size / 2, paint);
|
||||
|
||||
if (textLayout != null) {
|
||||
canvas.translate(bounds.left + (size - textWidth) / 2 - textLeft, bounds.top + (size - textHeight) / 2);
|
||||
canvas.translate((size - textWidth) / 2 - textLeft, (size - textHeight) / 2);
|
||||
textLayout.draw(canvas);
|
||||
}
|
||||
|
||||
canvas.restore();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAlpha(int alpha) {
|
||||
|
||||
public void setAlpha(int alpha) { // must be present in non-abstract classes derived from Drawable
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setColorFilter(ColorFilter cf) {
|
||||
|
||||
public void setColorFilter(ColorFilter cf) { // must be present in non-abstract classes derived from Drawable
|
||||
}
|
||||
|
||||
@Override
|
||||
+6
-6
@@ -21,7 +21,7 @@
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
package com.b44t.ui.Components;
|
||||
package com.b44t.messenger.Components;
|
||||
|
||||
import android.Manifest;
|
||||
import android.app.Activity;
|
||||
@@ -40,11 +40,11 @@ import com.b44t.messenger.MediaController;
|
||||
import com.b44t.messenger.TLRPC;
|
||||
import com.b44t.messenger.FileLoader;
|
||||
import com.b44t.messenger.UserConfig;
|
||||
import com.b44t.ui.LaunchActivity;
|
||||
import com.b44t.ui.PhotoAlbumPickerActivity;
|
||||
import com.b44t.ui.PhotoCropActivity;
|
||||
import com.b44t.ui.ActionBar.BaseFragment;
|
||||
import com.b44t.ui.PhotoViewer;
|
||||
import com.b44t.messenger.LaunchActivity;
|
||||
import com.b44t.messenger.PhotoAlbumPickerActivity;
|
||||
import com.b44t.messenger.PhotoCropActivity;
|
||||
import com.b44t.messenger.ActionBar.BaseFragment;
|
||||
import com.b44t.messenger.PhotoViewer;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
+13
-3
@@ -21,7 +21,7 @@
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
package com.b44t.ui.Components;
|
||||
package com.b44t.messenger.Components;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Bitmap;
|
||||
@@ -32,6 +32,8 @@ import android.util.AttributeSet;
|
||||
import android.view.View;
|
||||
|
||||
import com.b44t.messenger.ImageReceiver;
|
||||
import com.b44t.messenger.MrMailbox;
|
||||
import com.b44t.messenger.R;
|
||||
import com.b44t.messenger.TLObject;
|
||||
import com.b44t.messenger.TLRPC;
|
||||
|
||||
@@ -142,11 +144,19 @@ public class BackupImageView extends View {
|
||||
|
||||
@Override
|
||||
protected void onDraw(Canvas canvas) {
|
||||
int x, y, w, h;
|
||||
if (width != -1 && height != -1) {
|
||||
imageReceiver.setImageCoords((getWidth() - width) / 2, (getHeight() - height) / 2, width, height);
|
||||
x = (getWidth() - width) / 2;
|
||||
y = (getHeight() - height) / 2;
|
||||
w = width;
|
||||
h = height;
|
||||
} else {
|
||||
imageReceiver.setImageCoords(0, 0, getWidth(), getHeight());
|
||||
x = 0;
|
||||
y = 0;
|
||||
w = getWidth();
|
||||
h = getHeight();
|
||||
}
|
||||
imageReceiver.setImageCoords(x, y, w, h);
|
||||
imageReceiver.draw(canvas);
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -21,7 +21,7 @@
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
package com.b44t.ui.Adapters;
|
||||
package com.b44t.messenger.Components;
|
||||
|
||||
import android.database.DataSetObserver;
|
||||
import android.view.View;
|
||||
+2
-2
@@ -21,14 +21,14 @@
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
package com.b44t.messenger.browser;
|
||||
package com.b44t.messenger.Components;
|
||||
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
|
||||
import com.b44t.ui.LaunchActivity;
|
||||
import com.b44t.messenger.LaunchActivity;
|
||||
|
||||
public class Browser {
|
||||
|
||||
+36
-134
@@ -21,7 +21,7 @@
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
package com.b44t.ui.Components;
|
||||
package com.b44t.messenger.Components;
|
||||
|
||||
import android.Manifest;
|
||||
import android.animation.Animator;
|
||||
@@ -40,7 +40,6 @@ import android.graphics.drawable.Drawable;
|
||||
import android.media.AudioManager;
|
||||
import android.os.Build;
|
||||
import android.os.PowerManager;
|
||||
import android.os.SystemClock;
|
||||
import android.text.Editable;
|
||||
import android.text.SpannableStringBuilder;
|
||||
import android.text.TextWatcher;
|
||||
@@ -61,7 +60,7 @@ import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.b44t.messenger.AndroidUtilities;
|
||||
import com.b44t.messenger.Emoji;
|
||||
import com.b44t.messenger.EmojiInputView;
|
||||
import com.b44t.messenger.MediaController;
|
||||
import com.b44t.messenger.MessageObject;
|
||||
import com.b44t.messenger.MrContact;
|
||||
@@ -72,11 +71,10 @@ import com.b44t.messenger.R;
|
||||
import com.b44t.messenger.TLRPC;
|
||||
import com.b44t.messenger.AnimatorListenerAdapterProxy;
|
||||
import com.b44t.messenger.ApplicationLoader;
|
||||
import com.b44t.ui.ActionBar.Theme;
|
||||
import com.b44t.ui.ChatActivity;
|
||||
import com.b44t.messenger.ActionBar.Theme;
|
||||
import com.b44t.messenger.ChatActivity;
|
||||
|
||||
import java.io.File;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class ChatActivityEnterView extends FrameLayout implements NotificationCenter.NotificationCenterDelegate, SizeNotifierFrameLayout.SizeNotifierFrameLayoutDelegate /*, StickersAlert.StickersAlertDelegate*/ {
|
||||
@@ -86,7 +84,6 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe
|
||||
void needSendTyping();
|
||||
void onTextChanged(CharSequence text, boolean bigChange);
|
||||
void onWindowSizeChanged(int size);
|
||||
void onStickersTab(boolean opened);
|
||||
}
|
||||
|
||||
private class SeekBarWaveformView extends View {
|
||||
@@ -149,26 +146,26 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe
|
||||
|
||||
private class EditTextCaption extends EditText {
|
||||
|
||||
private Object editor;
|
||||
private Field editorField;
|
||||
private Drawable[] mCursorDrawable;
|
||||
private Field mCursorDrawableField;
|
||||
//private Object editor;
|
||||
//private Field editorField;
|
||||
//private Drawable[] mCursorDrawable;
|
||||
//private Field mCursorDrawableField;
|
||||
|
||||
public EditTextCaption(Context context) {
|
||||
super(context);
|
||||
|
||||
try {
|
||||
Field field = TextView.class.getDeclaredField("mEditor");
|
||||
field.setAccessible(true);
|
||||
editor = field.get(this);
|
||||
Class editorClass = Class.forName("android.widget.Editor");
|
||||
editorField = editorClass.getDeclaredField("mShowCursor");
|
||||
editorField.setAccessible(true);
|
||||
mCursorDrawableField = editorClass.getDeclaredField("mCursorDrawable");
|
||||
mCursorDrawableField.setAccessible(true);
|
||||
mCursorDrawable = (Drawable[]) mCursorDrawableField.get(editor);
|
||||
} catch (Throwable e) {
|
||||
}
|
||||
//try {
|
||||
//Field field = TextView.class.getDeclaredField("mEditor");
|
||||
//field.setAccessible(true);
|
||||
//editor = field.get(this);
|
||||
//Class editorClass = Class.forName("android.widget.Editor");
|
||||
//editorField = editorClass.getDeclaredField("mShowCursor");
|
||||
//editorField.setAccessible(true);
|
||||
//mCursorDrawableField = editorClass.getDeclaredField("mCursorDrawable");
|
||||
//mCursorDrawableField.setAccessible(true);
|
||||
//mCursorDrawable = (Drawable[]) mCursorDrawableField.get(editor);
|
||||
//} catch (Throwable e) {
|
||||
//}
|
||||
}
|
||||
|
||||
@SuppressLint("DrawAllocation")
|
||||
@@ -189,10 +186,10 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe
|
||||
} catch (Exception e) {
|
||||
}
|
||||
|
||||
try {
|
||||
//try {
|
||||
// the following lines are because otherwise the cursor stops blinking if
|
||||
// the focus was set to another text field in between (eg. search)
|
||||
if (editorField != null && mCursorDrawable != null && mCursorDrawable[0] != null) {
|
||||
/*if (editorField != null && mCursorDrawable != null && mCursorDrawable[0] != null) {
|
||||
long mShowCursor = editorField.getLong(editor);
|
||||
boolean showCursor = (SystemClock.uptimeMillis() - mShowCursor) % (2 * 500) < 500;
|
||||
if (showCursor) {
|
||||
@@ -201,9 +198,9 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe
|
||||
mCursorDrawable[0].draw(canvas);
|
||||
canvas.restore();
|
||||
}
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
}
|
||||
}*/
|
||||
//} catch (Throwable e) {
|
||||
//}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -225,7 +222,7 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe
|
||||
private EditTextCaption messageEditText;
|
||||
private ImageView sendButton;
|
||||
private ImageView emojiButton;
|
||||
private EmojiView emojiView;
|
||||
private EmojiInputView emojiView;
|
||||
private TextView recordTimeText;
|
||||
private ImageView audioRecordButton;
|
||||
private FrameLayout recordPanel;
|
||||
@@ -424,7 +421,6 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe
|
||||
NotificationCenter.getInstance().addObserver(this, NotificationCenter.recordProgressChanged);
|
||||
NotificationCenter.getInstance().addObserver(this, NotificationCenter.closeChats);
|
||||
NotificationCenter.getInstance().addObserver(this, NotificationCenter.audioDidSent);
|
||||
NotificationCenter.getInstance().addObserver(this, NotificationCenter.emojiDidLoaded);
|
||||
NotificationCenter.getInstance().addObserver(this, NotificationCenter.audioRouteChanged);
|
||||
NotificationCenter.getInstance().addObserver(this, NotificationCenter.audioDidReset);
|
||||
NotificationCenter.getInstance().addObserver(this, NotificationCenter.audioProgressDidChanged);
|
||||
@@ -570,18 +566,11 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe
|
||||
for (int i = 0; i < spans.length; i++) {
|
||||
editable.removeSpan(spans[i]);
|
||||
}
|
||||
Emoji.replaceEmoji(editable, messageEditText.getPaint().getFontMetricsInt(), AndroidUtilities.dp(20), false);
|
||||
EmojiInputView.replaceEmoji(editable, false);
|
||||
processChange = false;
|
||||
}
|
||||
}
|
||||
});
|
||||
try {
|
||||
Field mCursorDrawableRes = TextView.class.getDeclaredField("mCursorDrawableRes");
|
||||
mCursorDrawableRes.setAccessible(true);
|
||||
mCursorDrawableRes.set(messageEditText, R.drawable.field_carret);
|
||||
} catch (Exception e) {
|
||||
//nothing to do
|
||||
}
|
||||
|
||||
if (isChat) {
|
||||
attachButton = new LinearLayout(context);
|
||||
@@ -601,7 +590,7 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe
|
||||
|
||||
ImageView imageView = new ImageView(context);
|
||||
imageView.setScaleType(ImageView.ScaleType.CENTER);
|
||||
imageView.setImageResource(R.drawable.delete_reply);
|
||||
imageView.setImageResource(R.drawable.dismiss_recording);
|
||||
recordedAudioPanel.addView(imageView, LayoutHelper.createFrame(48, 48));
|
||||
imageView.setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
@@ -806,24 +795,6 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe
|
||||
return false;
|
||||
}
|
||||
|
||||
public void setAllowStickersAndGifs(boolean value, boolean value2) {
|
||||
if ((allowStickers != value || allowGifs != value2) && emojiView != null) {
|
||||
if (emojiView.getVisibility() == VISIBLE) {
|
||||
hidePopup(false);
|
||||
}
|
||||
sizeNotifierLayout.removeView(emojiView);
|
||||
emojiView = null;
|
||||
}
|
||||
allowStickers = value;
|
||||
allowGifs = value2;
|
||||
}
|
||||
|
||||
public void setOpenGifsTabFirst() {
|
||||
createEmojiView();
|
||||
emojiView.loadGifRecent();
|
||||
emojiView.switchToGifRecent();
|
||||
}
|
||||
|
||||
public boolean isTopViewVisible() {
|
||||
return false;
|
||||
}
|
||||
@@ -845,13 +816,9 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe
|
||||
NotificationCenter.getInstance().removeObserver(this, NotificationCenter.recordProgressChanged);
|
||||
NotificationCenter.getInstance().removeObserver(this, NotificationCenter.closeChats);
|
||||
NotificationCenter.getInstance().removeObserver(this, NotificationCenter.audioDidSent);
|
||||
NotificationCenter.getInstance().removeObserver(this, NotificationCenter.emojiDidLoaded);
|
||||
NotificationCenter.getInstance().removeObserver(this, NotificationCenter.audioRouteChanged);
|
||||
NotificationCenter.getInstance().removeObserver(this, NotificationCenter.audioDidReset);
|
||||
NotificationCenter.getInstance().removeObserver(this, NotificationCenter.audioProgressDidChanged);
|
||||
if (emojiView != null) {
|
||||
emojiView.onDestroy();
|
||||
}
|
||||
if (mWakeLock != null) {
|
||||
try {
|
||||
mWakeLock.release();
|
||||
@@ -1338,9 +1305,9 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe
|
||||
if (emojiView != null) {
|
||||
return;
|
||||
}
|
||||
emojiView = new EmojiView(allowStickers, allowGifs, parentActivity);
|
||||
emojiView = new EmojiInputView(parentActivity);
|
||||
emojiView.setVisibility(GONE);
|
||||
emojiView.setListener(new EmojiView.Listener() {
|
||||
emojiView.setListener(new EmojiInputView.Listener() {
|
||||
public boolean onBackspace() {
|
||||
if (messageEditText.length() == 0) {
|
||||
return false;
|
||||
@@ -1356,7 +1323,7 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe
|
||||
}
|
||||
try {
|
||||
innerTextChange = 2;
|
||||
CharSequence localCharSequence = Emoji.replaceEmoji(symbol, messageEditText.getPaint().getFontMetricsInt(), AndroidUtilities.dp(20), false);
|
||||
CharSequence localCharSequence = EmojiInputView.replaceEmoji(symbol, false);
|
||||
messageEditText.setText(messageEditText.getText().insert(i, localCharSequence));
|
||||
int j = i + localCharSequence.length();
|
||||
messageEditText.setSelection(j, j);
|
||||
@@ -1367,47 +1334,6 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe
|
||||
}
|
||||
}
|
||||
|
||||
/*public void onStickerSelected(TLRPC.Document sticker) {
|
||||
ChatActivityEnterView.this.onStickerSelected(sticker);
|
||||
}*/
|
||||
|
||||
@Override
|
||||
public void onStickersSettingsClick() {
|
||||
if (parentFragment != null) {
|
||||
//parentFragment.presentFragment(new StickersActivity()); -- EDIT BY MR
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onGifSelected(TLRPC.Document gif) {
|
||||
SendMessagesHelper.getInstance().sendSticker(gif, dialog_id);
|
||||
if ((int) dialog_id == 0) {
|
||||
//MessagesController.getInstance().saveGif(gif);
|
||||
}
|
||||
if (delegate != null) {
|
||||
delegate.onMessageSend(null);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onGifTab(boolean opened) {
|
||||
if (!AndroidUtilities.usingHardwareInput) {
|
||||
if (opened) {
|
||||
if (messageEditText.length() == 0) {
|
||||
messageEditText.setText("@gif ");
|
||||
messageEditText.setSelection(messageEditText.length());
|
||||
}
|
||||
} else if (messageEditText.getText().toString().equals("@gif ")) {
|
||||
messageEditText.setText("");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStickersTab(boolean opened) {
|
||||
delegate.onStickersTab(opened);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClearEmojiRecent() {
|
||||
if (parentFragment == null || parentActivity == null) {
|
||||
@@ -1415,13 +1341,13 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe
|
||||
}
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(parentActivity);
|
||||
builder.setMessage(ApplicationLoader.applicationContext.getString(R.string.ClearRecentEmoji));
|
||||
builder.setPositiveButton(ApplicationLoader.applicationContext.getString(R.string.ClearButton).toUpperCase(), new DialogInterface.OnClickListener() {
|
||||
builder.setPositiveButton(R.string.ClearButton, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialogInterface, int i) {
|
||||
emojiView.clearRecentEmoji();
|
||||
emojiView.clearRecent();
|
||||
}
|
||||
});
|
||||
builder.setNegativeButton(ApplicationLoader.applicationContext.getString(R.string.Cancel), null);
|
||||
builder.setNegativeButton(R.string.Cancel, null);
|
||||
parentFragment.showDialog(builder.create());
|
||||
}
|
||||
});
|
||||
@@ -1429,14 +1355,6 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe
|
||||
sizeNotifierLayout.addView(emojiView);
|
||||
}
|
||||
|
||||
/*@Override
|
||||
public void onStickerSelected(TLRPC.Document sticker) {
|
||||
SendMessagesHelper.getInstance().sendSticker(sticker, dialog_id);
|
||||
if (delegate != null) {
|
||||
delegate.onMessageSend(null);
|
||||
}
|
||||
}*/
|
||||
|
||||
private void showPopup(int show, int contentType /*0=emojiView, 1=botKeyboardView*/ ) {
|
||||
if (show == 1) {
|
||||
if (contentType == 0 && emojiView == null) {
|
||||
@@ -1538,17 +1456,6 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe
|
||||
return emojiView != null && emojiView.getVisibility() == VISIBLE;
|
||||
}
|
||||
|
||||
public boolean isKeyboardVisible() {
|
||||
return keyboardVisible;
|
||||
}
|
||||
|
||||
public void addRecentGif(MediaController.SearchImage searchImage) {
|
||||
if (emojiView == null) {
|
||||
return;
|
||||
}
|
||||
emojiView.addRecentGif(searchImage);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSizeChanged(int height, boolean isWidthGreater) {
|
||||
if (height > AndroidUtilities.dp(50) && keyboardVisible) {
|
||||
@@ -1619,11 +1526,7 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe
|
||||
|
||||
@Override
|
||||
public void didReceivedNotification(int id, Object... args) {
|
||||
if (id == NotificationCenter.emojiDidLoaded) {
|
||||
if (emojiView != null) {
|
||||
emojiView.invalidateViews();
|
||||
}
|
||||
} else if (id == NotificationCenter.recordProgressChanged) {
|
||||
if (id == NotificationCenter.recordProgressChanged) {
|
||||
long t = (Long) args[0];
|
||||
Long time = t / 1000;
|
||||
int ms = (int) (t % 1000L) / 10;
|
||||
@@ -1665,8 +1568,7 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe
|
||||
TLRPC.TL_message message = new TLRPC.TL_message();
|
||||
message.out = true;
|
||||
message.id = 0;
|
||||
message.to_id = new TLRPC.TL_peerUser();
|
||||
message.to_id.user_id = message.from_id = MrContact.MR_CONTACT_ID_SELF;
|
||||
message.from_id = MrContact.MR_CONTACT_ID_SELF;
|
||||
message.date = (int) (System.currentTimeMillis() / 1000);
|
||||
message.message = "-1";
|
||||
message.attachPath = audioToSendPath;
|
||||
+9
-10
@@ -21,7 +21,7 @@
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
package com.b44t.ui.Components;
|
||||
package com.b44t.messenger.Components;
|
||||
|
||||
import android.Manifest;
|
||||
import android.animation.Animator;
|
||||
@@ -49,19 +49,18 @@ import android.widget.TextView;
|
||||
|
||||
import com.b44t.messenger.AndroidUtilities;
|
||||
import com.b44t.messenger.ApplicationLoader;
|
||||
import com.b44t.messenger.LocaleController;
|
||||
import com.b44t.messenger.MediaController;
|
||||
import com.b44t.messenger.MessageObject;
|
||||
import com.b44t.messenger.NotificationCenter;
|
||||
import com.b44t.messenger.support.widget.LinearLayoutManager;
|
||||
import com.b44t.messenger.aosp.LinearLayoutManager;
|
||||
import com.b44t.messenger.R;
|
||||
import com.b44t.messenger.support.widget.RecyclerView;
|
||||
import com.b44t.messenger.aosp.RecyclerView;
|
||||
import com.b44t.messenger.TLRPC;
|
||||
import com.b44t.ui.ActionBar.BottomSheet;
|
||||
import com.b44t.ui.ActionBar.Theme;
|
||||
import com.b44t.ui.Cells.PhotoAttachPhotoCell;
|
||||
import com.b44t.ui.ChatActivity;
|
||||
import com.b44t.ui.PhotoViewer;
|
||||
import com.b44t.messenger.ActionBar.BottomSheet;
|
||||
import com.b44t.messenger.ActionBar.Theme;
|
||||
import com.b44t.messenger.Cells.PhotoAttachPhotoCell;
|
||||
import com.b44t.messenger.ChatActivity;
|
||||
import com.b44t.messenger.PhotoViewer;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
@@ -757,7 +756,7 @@ public class ChatAttachAlert extends BottomSheet implements NotificationCenter.N
|
||||
}
|
||||
|
||||
private void setUseRevealAnimation(boolean value) {
|
||||
if (!value || value && Build.VERSION.SDK_INT >= 18 && !AndroidUtilities.isTablet()) {
|
||||
if (!value || value && Build.VERSION.SDK_INT >= 18) {
|
||||
useRevealAnimation = value;
|
||||
}
|
||||
}
|
||||
+8
-12
@@ -21,10 +21,9 @@
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
package com.b44t.ui.Components;
|
||||
package com.b44t.messenger.Components;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Typeface;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.view.Gravity;
|
||||
@@ -35,12 +34,11 @@ import com.b44t.messenger.AndroidUtilities;
|
||||
import com.b44t.messenger.ContactsController;
|
||||
import com.b44t.messenger.MrChat;
|
||||
import com.b44t.messenger.MrMailbox;
|
||||
import com.b44t.messenger.TLRPC;
|
||||
import com.b44t.ui.ActionBar.ActionBar;
|
||||
import com.b44t.ui.ActionBar.SimpleTextView;
|
||||
import com.b44t.ui.ActionBar.Theme;
|
||||
import com.b44t.ui.ChatActivity;
|
||||
import com.b44t.ui.ProfileActivity;
|
||||
import com.b44t.messenger.ActionBar.ActionBar;
|
||||
import com.b44t.messenger.ActionBar.SimpleTextView;
|
||||
import com.b44t.messenger.ActionBar.Theme;
|
||||
import com.b44t.messenger.ChatActivity;
|
||||
import com.b44t.messenger.ProfileActivity;
|
||||
|
||||
public class ChatAvatarContainer extends FrameLayout {
|
||||
|
||||
@@ -62,7 +60,6 @@ public class ChatAvatarContainer extends FrameLayout {
|
||||
titleTextView.setTextColor(Theme.ACTION_BAR_TITLE_COLOR);
|
||||
titleTextView.setTextSize(18);
|
||||
titleTextView.setGravity(Gravity.START);
|
||||
titleTextView.setLeftDrawableTopPadding(-AndroidUtilities.dp(1.3f));
|
||||
titleTextView.setRightDrawableTopPadding(-AndroidUtilities.dp(1.3f));
|
||||
addView(titleTextView);
|
||||
|
||||
@@ -76,7 +73,7 @@ public class ChatAvatarContainer extends FrameLayout {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Bundle args = new Bundle();
|
||||
if( parentFragment.m_mrChat.getType()== MrChat.MR_CHAT_GROUP ) {
|
||||
if( parentFragment.m_mrChat.isGroup() ) {
|
||||
args.putInt("chat_id", parentFragment.m_mrChat.getId());
|
||||
}
|
||||
else {
|
||||
@@ -88,7 +85,6 @@ public class ChatAvatarContainer extends FrameLayout {
|
||||
}
|
||||
|
||||
ProfileActivity fragment = new ProfileActivity(args);
|
||||
fragment.setPlayProfileAnimation(true);
|
||||
parentFragment.presentFragment(fragment);
|
||||
}
|
||||
});
|
||||
@@ -114,7 +110,7 @@ public class ChatAvatarContainer extends FrameLayout {
|
||||
}
|
||||
|
||||
public void setTitleIcons(int leftIcon, int rightIcon) {
|
||||
titleTextView.setLeftDrawable(leftIcon);
|
||||
subtitleTextView.setLeftDrawable(leftIcon);
|
||||
titleTextView.setRightDrawable(rightIcon);
|
||||
}
|
||||
|
||||
+1
-1
@@ -21,7 +21,7 @@
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
package com.b44t.ui.Components;
|
||||
package com.b44t.messenger.Components;
|
||||
|
||||
import android.animation.ObjectAnimator;
|
||||
import android.content.Context;
|
||||
+1
-1
@@ -21,7 +21,7 @@
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
package com.b44t.ui.Components;
|
||||
package com.b44t.messenger.Components;
|
||||
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.drawable.Drawable;
|
||||
+1
-1
@@ -21,7 +21,7 @@
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
package com.b44t.ui.Components;
|
||||
package com.b44t.messenger.Components;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Bitmap;
|
||||
+1
-1
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.b44t.ui.Components;
|
||||
package com.b44t.messenger.Components;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Canvas;
|
||||
+1
-2
@@ -20,7 +20,7 @@
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
package com.b44t.ui.Components;
|
||||
package com.b44t.messenger.Components;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.TypedValue;
|
||||
@@ -32,7 +32,6 @@ import android.widget.ProgressBar;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.b44t.messenger.AndroidUtilities;
|
||||
import com.b44t.messenger.LocaleController;
|
||||
import com.b44t.messenger.R;
|
||||
|
||||
public class EmptyTextProgressView extends FrameLayout {
|
||||
+1
-1
@@ -21,7 +21,7 @@
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
package com.b44t.ui.Components;
|
||||
package com.b44t.messenger.Components;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.Activity;
|
||||
+1
-1
@@ -21,7 +21,7 @@
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
package com.b44t.ui.Components;
|
||||
package com.b44t.messenger.Components;
|
||||
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.LinearLayout;
|
||||
+1
-1
@@ -21,7 +21,7 @@
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
package com.b44t.ui.Components;
|
||||
package com.b44t.messenger.Components;
|
||||
|
||||
import android.graphics.Path;
|
||||
import android.text.StaticLayout;
|
||||
+1
-1
@@ -21,7 +21,7 @@
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
package com.b44t.ui.Components;
|
||||
package com.b44t.messenger.Components;
|
||||
|
||||
import android.animation.Animator;
|
||||
import android.animation.ObjectAnimator;
|
||||
+1
-1
@@ -21,7 +21,7 @@
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
package com.b44t.ui.Components;
|
||||
package com.b44t.messenger.Components;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Canvas;
|
||||
+5
-17
@@ -21,7 +21,7 @@
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
package com.b44t.ui.Components;
|
||||
package com.b44t.messenger.Components;
|
||||
|
||||
import android.animation.Animator;
|
||||
import android.animation.AnimatorSet;
|
||||
@@ -61,13 +61,12 @@ import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.b44t.messenger.AndroidUtilities;
|
||||
import com.b44t.messenger.LocaleController;
|
||||
import com.b44t.messenger.NotificationCenter;
|
||||
import com.b44t.messenger.ApplicationLoader;
|
||||
import com.b44t.messenger.R;
|
||||
import com.b44t.messenger.UserConfig;
|
||||
import com.b44t.messenger.AnimatorListenerAdapterProxy;
|
||||
import com.b44t.ui.ActionBar.Theme;
|
||||
import com.b44t.messenger.ActionBar.Theme;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Locale;
|
||||
@@ -159,7 +158,6 @@ public class PasscodeView extends FrameLayout {
|
||||
passwordEditText.setImeOptions(EditorInfo.IME_ACTION_DONE);
|
||||
passwordEditText.setTypeface(Typeface.DEFAULT);
|
||||
passwordEditText.setBackgroundDrawable(null);
|
||||
AndroidUtilities.clearCursorDrawable(passwordEditText);
|
||||
passwordFrameLayout.addView(passwordEditText);
|
||||
layoutParams = (FrameLayout.LayoutParams) passwordEditText.getLayoutParams();
|
||||
layoutParams.height = LayoutHelper.WRAP_CONTENT;
|
||||
@@ -531,7 +529,7 @@ public class PasscodeView extends FrameLayout {
|
||||
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(getContext());
|
||||
builder.setView(relativeLayout);
|
||||
builder.setNegativeButton(ApplicationLoader.applicationContext.getString(R.string.Cancel), null);
|
||||
builder.setNegativeButton(R.string.Cancel, null);
|
||||
builder.setOnDismissListener(new DialogInterface.OnDismissListener() {
|
||||
@Override
|
||||
public void onDismiss(DialogInterface dialog) {
|
||||
@@ -666,7 +664,7 @@ public class PasscodeView extends FrameLayout {
|
||||
|
||||
LayoutParams layoutParams;
|
||||
|
||||
if (!AndroidUtilities.isTablet() && getContext().getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) {
|
||||
if (getContext().getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) {
|
||||
layoutParams = (LayoutParams) passwordFrameLayout.getLayoutParams();
|
||||
layoutParams.width = UserConfig.passcodeType == 0 ? width / 2 : width;
|
||||
layoutParams.height = AndroidUtilities.dp(140);
|
||||
@@ -682,16 +680,6 @@ public class PasscodeView extends FrameLayout {
|
||||
} else {
|
||||
int top = 0;
|
||||
int left = 0;
|
||||
if (AndroidUtilities.isTablet()) {
|
||||
if (width > AndroidUtilities.dp(498)) {
|
||||
left = (width - AndroidUtilities.dp(498)) / 2;
|
||||
width = AndroidUtilities.dp(498);
|
||||
}
|
||||
if (height > AndroidUtilities.dp(528)) {
|
||||
top = (height - AndroidUtilities.dp(528)) / 2;
|
||||
height = AndroidUtilities.dp(528);
|
||||
}
|
||||
}
|
||||
layoutParams = (LayoutParams) passwordFrameLayout.getLayoutParams();
|
||||
layoutParams.height = height / 3;
|
||||
layoutParams.width = width;
|
||||
@@ -759,7 +747,7 @@ public class PasscodeView extends FrameLayout {
|
||||
getWindowVisibleDisplayFrame(rect);
|
||||
keyboardHeight = usableViewHeight - (rect.bottom - rect.top);
|
||||
|
||||
if (UserConfig.passcodeType == 1 && (AndroidUtilities.isTablet() || getContext().getResources().getConfiguration().orientation != Configuration.ORIENTATION_LANDSCAPE)) {
|
||||
if (UserConfig.passcodeType == 1 && getContext().getResources().getConfiguration().orientation != Configuration.ORIENTATION_LANDSCAPE) {
|
||||
int t = 0;
|
||||
if (passwordFrameLayout.getTag() != null) {
|
||||
t = (Integer) passwordFrameLayout.getTag();
|
||||
+1
-1
@@ -21,7 +21,7 @@
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
package com.b44t.ui.Components;
|
||||
package com.b44t.messenger.Components;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Bitmap;
|
||||
+1
-1
@@ -21,7 +21,7 @@
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
package com.b44t.ui.Components;
|
||||
package com.b44t.messenger.Components;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Canvas;
|
||||
+1
-1
@@ -21,7 +21,7 @@
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
package com.b44t.ui.Components;
|
||||
package com.b44t.messenger.Components;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Canvas;
|
||||
+1
-1
@@ -21,7 +21,7 @@
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
package com.b44t.ui.Components;
|
||||
package com.b44t.messenger.Components;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
+6
-20
@@ -21,7 +21,7 @@
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
package com.b44t.ui.Components;
|
||||
package com.b44t.messenger.Components;
|
||||
|
||||
import android.animation.Animator;
|
||||
import android.animation.AnimatorSet;
|
||||
@@ -49,15 +49,14 @@ import android.widget.TextView;
|
||||
|
||||
import com.b44t.messenger.AndroidUtilities;
|
||||
import com.b44t.messenger.ApplicationLoader;
|
||||
import com.b44t.messenger.LocaleController;
|
||||
import com.b44t.messenger.support.widget.LinearLayoutManager;
|
||||
import com.b44t.messenger.support.widget.RecyclerView;
|
||||
import com.b44t.messenger.aosp.LinearLayoutManager;
|
||||
import com.b44t.messenger.aosp.RecyclerView;
|
||||
import com.b44t.messenger.DispatchQueue;
|
||||
import com.b44t.messenger.R;
|
||||
import com.b44t.messenger.Utilities;
|
||||
import com.b44t.messenger.AnimatorListenerAdapterProxy;
|
||||
import com.b44t.ui.ActionBar.Theme;
|
||||
import com.b44t.ui.Cells.PhotoEditToolCell;
|
||||
import com.b44t.messenger.ActionBar.Theme;
|
||||
import com.b44t.messenger.Cells.PhotoEditToolCell;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.ByteOrder;
|
||||
@@ -2292,7 +2291,7 @@ public class PhotoFilterView extends FrameLayout {
|
||||
}
|
||||
}
|
||||
});
|
||||
editView.addView(valueSeekBar, LayoutHelper.createFrame(AndroidUtilities.isTablet() ? 498 : LayoutHelper.MATCH_PARENT, 60, AndroidUtilities.isTablet() ? Gravity.CENTER_HORIZONTAL | Gravity.TOP : Gravity.START | Gravity.TOP, 14, 10, 14, 0));
|
||||
editView.addView(valueSeekBar, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 60, Gravity.START | Gravity.TOP, 14, 10, 14, 0));
|
||||
|
||||
curveLayout = new FrameLayout(context);
|
||||
editView.addView(curveLayout, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 78, Gravity.CENTER_HORIZONTAL));
|
||||
@@ -2699,19 +2698,6 @@ public class PhotoFilterView extends FrameLayout {
|
||||
layoutParams = (LayoutParams) curvesControl.getLayoutParams();
|
||||
layoutParams.height = viewHeight + AndroidUtilities.dp(28);
|
||||
curvesControl.setLayoutParams(layoutParams);
|
||||
|
||||
if (AndroidUtilities.isTablet()) {
|
||||
int total = AndroidUtilities.dp(86) * 10;
|
||||
layoutParams = (FrameLayout.LayoutParams) recyclerListView.getLayoutParams();
|
||||
if (total < viewWidth) {
|
||||
layoutParams.width = total;
|
||||
layoutParams.leftMargin = (viewWidth - total) / 2;
|
||||
} else {
|
||||
layoutParams.width = LayoutHelper.MATCH_PARENT;
|
||||
layoutParams.leftMargin = 0;
|
||||
}
|
||||
recyclerListView.setLayoutParams(layoutParams);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
+2
-3
@@ -21,7 +21,7 @@
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
package com.b44t.ui.Components;
|
||||
package com.b44t.messenger.Components;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Typeface;
|
||||
@@ -33,9 +33,8 @@ import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.b44t.messenger.AndroidUtilities;
|
||||
import com.b44t.messenger.LocaleController;
|
||||
import com.b44t.messenger.R;
|
||||
import com.b44t.ui.ActionBar.Theme;
|
||||
import com.b44t.messenger.ActionBar.Theme;
|
||||
|
||||
public class PickerBottomLayout extends FrameLayout {
|
||||
|
||||
+1
-1
@@ -21,7 +21,7 @@
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
package com.b44t.ui.Components;
|
||||
package com.b44t.messenger.Components;
|
||||
|
||||
public class Point {
|
||||
public float x;
|
||||
+2
-2
@@ -21,7 +21,7 @@
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
package com.b44t.ui.Components;
|
||||
package com.b44t.messenger.Components;
|
||||
|
||||
import android.animation.ObjectAnimator;
|
||||
import android.content.Context;
|
||||
@@ -34,7 +34,7 @@ import android.graphics.PorterDuffXfermode;
|
||||
import android.view.View;
|
||||
|
||||
import com.b44t.messenger.AndroidUtilities;
|
||||
import com.b44t.ui.ActionBar.Theme;
|
||||
import com.b44t.messenger.ActionBar.Theme;
|
||||
|
||||
public class RadioButton extends View {
|
||||
|
||||
+1
-1
@@ -21,7 +21,7 @@
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
package com.b44t.ui.Components;
|
||||
package com.b44t.messenger.Components;
|
||||
|
||||
public class Rect {
|
||||
|
||||
+2
-2
@@ -21,7 +21,7 @@
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
package com.b44t.ui.Components;
|
||||
package com.b44t.messenger.Components;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.TypedArray;
|
||||
@@ -34,7 +34,7 @@ import android.view.ViewConfiguration;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import com.b44t.messenger.AndroidUtilities;
|
||||
import com.b44t.messenger.support.widget.RecyclerView;
|
||||
import com.b44t.messenger.aosp.RecyclerView;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Method;
|
||||
+1
-1
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.b44t.ui.Components;
|
||||
package com.b44t.messenger.Components;
|
||||
|
||||
import android.content.Context;
|
||||
import android.hardware.SensorManager;
|
||||
+1
-1
@@ -21,7 +21,7 @@
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
package com.b44t.ui.Components;
|
||||
package com.b44t.messenger.Components;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Canvas;
|
||||
+1
-1
@@ -21,7 +21,7 @@
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
package com.b44t.ui.Components;
|
||||
package com.b44t.messenger.Components;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Canvas;
|
||||
+1
-1
@@ -21,7 +21,7 @@
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
package com.b44t.ui.Components;
|
||||
package com.b44t.messenger.Components;
|
||||
|
||||
public class Size {
|
||||
public float width;
|
||||
+1
-1
@@ -21,7 +21,7 @@
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
package com.b44t.ui.Components;
|
||||
package com.b44t.messenger.Components;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Canvas;
|
||||
+1
-1
@@ -21,7 +21,7 @@
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
package com.b44t.ui.Components;
|
||||
package com.b44t.messenger.Components;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Rect;
|
||||
+1
-1
@@ -21,7 +21,7 @@
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
package com.b44t.ui.Components;
|
||||
package com.b44t.messenger.Components;
|
||||
|
||||
import android.os.Build;
|
||||
import android.text.Layout;
|
||||
+1
-1
@@ -21,7 +21,7 @@
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
package com.b44t.ui.Components;
|
||||
package com.b44t.messenger.Components;
|
||||
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.Typeface;
|
||||
+1
-3
@@ -21,17 +21,15 @@
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
package com.b44t.ui.Components;
|
||||
package com.b44t.messenger.Components;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
|
||||
import com.b44t.messenger.AndroidUtilities;
|
||||
import com.b44t.messenger.R;
|
||||
|
||||
public class VideoSeekBarView extends View {
|
||||
+1
-2
@@ -21,9 +21,8 @@
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
package com.b44t.ui.Components;
|
||||
package com.b44t.messenger.Components;
|
||||
|
||||
import android.annotation.TargetApi;
|
||||
import android.content.Context;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.Canvas;
|
||||
@@ -0,0 +1,249 @@
|
||||
/*******************************************************************************
|
||||
*
|
||||
* Delta Chat Android
|
||||
* (C) 2017 Björn Petersen
|
||||
* Contact: r10s@b44t.com, http://b44t.com
|
||||
*
|
||||
* This program 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.
|
||||
*
|
||||
* This program 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
|
||||
* this program. If not, see http://www.gnu.org/licenses/ .
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
package com.b44t.messenger;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.text.InputFilter;
|
||||
import android.text.InputType;
|
||||
import android.util.TypedValue;
|
||||
import android.view.Gravity;
|
||||
import android.view.View;
|
||||
import android.view.inputmethod.EditorInfo;
|
||||
import android.widget.EditText;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.b44t.messenger.ActionBar.ActionBar;
|
||||
import com.b44t.messenger.ActionBar.ActionBarMenu;
|
||||
import com.b44t.messenger.ActionBar.BaseFragment;
|
||||
import com.b44t.messenger.Cells.HeaderCell;
|
||||
import com.b44t.messenger.Cells.TextInfoCell;
|
||||
import com.b44t.messenger.Components.LayoutHelper;
|
||||
|
||||
|
||||
public class ContactAddActivity extends BaseFragment implements NotificationCenter.NotificationCenterDelegate {
|
||||
|
||||
private int do_what = 0;
|
||||
public final static int CREATE_CONTACT = 1;
|
||||
public final static int EDIT_NAME = 2;
|
||||
|
||||
private EditText nameTextView;
|
||||
private EditText emailTextView;
|
||||
private String prefill;
|
||||
private int chat_id; // only used for EDIT_NAME in chats
|
||||
private int user_id;
|
||||
private boolean create_chat_when_done;
|
||||
|
||||
private final static int done_button = 1;
|
||||
|
||||
public ContactAddActivity(Bundle args) {
|
||||
super(args);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public boolean onFragmentCreate() {
|
||||
NotificationCenter.getInstance().addObserver(this, NotificationCenter.updateInterfaces);
|
||||
do_what = getArguments().getInt("do_what", 0);
|
||||
user_id = getArguments().getInt("user_id", 0);
|
||||
chat_id = getArguments().getInt("chat_id", 0);
|
||||
create_chat_when_done = getArguments().getBoolean("create_chat_when_done", false);
|
||||
prefill = getArguments().getString("prefill", "");
|
||||
return super.onFragmentCreate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFragmentDestroy() {
|
||||
super.onFragmentDestroy();
|
||||
NotificationCenter.getInstance().removeObserver(this, NotificationCenter.updateInterfaces);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
}
|
||||
|
||||
@Override
|
||||
public View createView(final Context context) {
|
||||
|
||||
String nameToSet = null;
|
||||
String emailToSet = null;
|
||||
|
||||
actionBar.setBackButtonImage(R.drawable.ic_close_white);
|
||||
if (do_what==CREATE_CONTACT) {
|
||||
actionBar.setTitle(context.getString(R.string.NewContactTitle));
|
||||
|
||||
if( prefill!=null && !prefill.isEmpty()) {
|
||||
if( prefill.contains("@") ) {
|
||||
emailToSet = prefill;
|
||||
}
|
||||
else {
|
||||
nameToSet = prefill;
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
actionBar.setTitle(context.getString(R.string.EditName));
|
||||
if( user_id!=0 ) {
|
||||
nameToSet = MrMailbox.getContact(user_id).getDisplayName();
|
||||
}
|
||||
else {
|
||||
nameToSet = MrMailbox.getChat(chat_id).getName();
|
||||
}
|
||||
}
|
||||
|
||||
actionBar.setActionBarMenuOnItemClick(new ActionBar.ActionBarMenuOnItemClick() {
|
||||
@Override
|
||||
public void onItemClick(int id) {
|
||||
if (id == -1) {
|
||||
finishFragment();
|
||||
} else if (id == done_button) {
|
||||
String name = nameTextView.getText().toString();
|
||||
if( chat_id!=0 ) {
|
||||
MrMailbox.setChatName(chat_id, name);
|
||||
}
|
||||
else {
|
||||
String addr = "";
|
||||
if (do_what==CREATE_CONTACT) {
|
||||
addr = emailTextView.getText().toString();
|
||||
}
|
||||
else {
|
||||
MrContact mrContact = MrMailbox.getContact(user_id);
|
||||
addr = mrContact.getAddr();
|
||||
}
|
||||
|
||||
int new_user_id;
|
||||
if( (new_user_id=MrMailbox.createContact(name, addr))==0 ) {
|
||||
Toast.makeText(getParentActivity(), context.getString(R.string.BadEmailAddress), Toast.LENGTH_LONG).show();
|
||||
return;
|
||||
}
|
||||
else if (do_what==CREATE_CONTACT) {
|
||||
if(create_chat_when_done) {
|
||||
int belonging_chat_id = MrMailbox.createChatByContactId(new_user_id);
|
||||
if( belonging_chat_id != 0 ) {
|
||||
Bundle args = new Bundle();
|
||||
args.putInt("chat_id", belonging_chat_id);
|
||||
presentFragment(new ChatActivity(args), true);
|
||||
NotificationCenter.getInstance().postNotificationName(NotificationCenter.chatDidCreated, belonging_chat_id); /*this will remove the contact list from stack */
|
||||
NotificationCenter.getInstance().postNotificationName(NotificationCenter.updateInterfaces, MrMailbox.UPDATE_MASK_NAME);
|
||||
return;
|
||||
}
|
||||
}
|
||||
else {
|
||||
Toast.makeText(getParentActivity(), context.getString(R.string.ContactCreated), Toast.LENGTH_LONG).show();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
finishFragment();
|
||||
NotificationCenter.getInstance().postNotificationName(NotificationCenter.updateInterfaces, MrMailbox.UPDATE_MASK_NAME);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
ActionBarMenu menu = actionBar.createMenu();
|
||||
menu.addItemWithWidth(done_button, R.drawable.ic_done, AndroidUtilities.dp(56));
|
||||
|
||||
fragmentView = new LinearLayout(context);
|
||||
LinearLayout linearLayout = (LinearLayout) fragmentView;
|
||||
linearLayout.setOrientation(LinearLayout.VERTICAL);
|
||||
|
||||
nameTextView = new EditText(context);
|
||||
|
||||
if(do_what==CREATE_CONTACT) {
|
||||
TextView label = HeaderCell.createTextView(context, context.getString(R.string.Name));
|
||||
linearLayout.addView(label, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.CENTER_VERTICAL, 18, 18, 18, 0));
|
||||
}
|
||||
nameTextView.setHint(context.getString(R.string.Name));
|
||||
|
||||
if (nameToSet != null) {
|
||||
nameTextView.setText(nameToSet);
|
||||
}
|
||||
nameTextView.setMaxLines(4);
|
||||
nameTextView.setGravity(Gravity.CENTER_VERTICAL | Gravity.START);
|
||||
nameTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 18);
|
||||
nameTextView.setHintTextColor(0xffBBBBBB);
|
||||
nameTextView.setImeOptions(EditorInfo.IME_FLAG_NO_EXTRACT_UI);
|
||||
nameTextView.setInputType(InputType.TYPE_TEXT_FLAG_CAP_WORDS);
|
||||
nameTextView.setPadding(0, 0, 0, AndroidUtilities.dp(8));
|
||||
InputFilter[] inputFilters = new InputFilter[1];
|
||||
inputFilters[0] = new InputFilter.LengthFilter(100);
|
||||
nameTextView.setFilters(inputFilters);
|
||||
nameTextView.setTextColor(0xff212121);
|
||||
linearLayout.addView(nameTextView, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.CENTER_VERTICAL, 18, do_what==CREATE_CONTACT? 1:18, 18, 0));
|
||||
|
||||
if( do_what==CREATE_CONTACT ) {
|
||||
TextView label = HeaderCell.createTextView(context, context.getString(R.string.EmailAddress));
|
||||
linearLayout.addView(label, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.CENTER_VERTICAL, 18, 18, 18, 0));
|
||||
|
||||
emailTextView = new EditText(context);
|
||||
if (emailToSet != null) {
|
||||
emailTextView.setText(emailToSet);
|
||||
}
|
||||
emailTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 18);
|
||||
emailTextView.setHint(R.string.ExampleEmailAddr);
|
||||
emailTextView.setHintTextColor(0xffBBBBBB);
|
||||
emailTextView.setTextColor(0xff212121);
|
||||
emailTextView.setMaxLines(4);
|
||||
emailTextView.setGravity(Gravity.START);
|
||||
emailTextView.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS | InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS);
|
||||
emailTextView.setImeOptions(EditorInfo.IME_FLAG_NO_EXTRACT_UI);
|
||||
emailTextView.setPadding(0, 0, 0, AndroidUtilities.dp(8));
|
||||
linearLayout.addView(emailTextView, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.CENTER_VERTICAL, 18, 1, 18, 0));
|
||||
}
|
||||
|
||||
if( do_what == EDIT_NAME && chat_id != 0 ) {
|
||||
TextView textView = TextInfoCell.createTextView(context);
|
||||
textView.setText(R.string.EditedNameWillBeShared);
|
||||
linearLayout.addView(textView, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.CENTER_VERTICAL, 18, 18, 18, 0));
|
||||
}
|
||||
|
||||
if( nameToSet != null ) {
|
||||
nameTextView.setSelection(nameToSet.length());
|
||||
}
|
||||
if( emailToSet != null ) {
|
||||
emailTextView.setSelection(emailToSet.length());
|
||||
}
|
||||
|
||||
return fragmentView;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivityResultFragment(int requestCode, int resultCode, Intent data) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTransitionAnimationEnd(boolean isOpen, boolean backward) {
|
||||
if (isOpen && nameTextView!=null) {
|
||||
nameTextView.requestFocus();
|
||||
AndroidUtilities.showKeyboard(nameTextView);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void didReceivedNotification(int id, final Object... args) {
|
||||
}
|
||||
}
|
||||
+377
-143
@@ -23,12 +23,13 @@
|
||||
|
||||
// this file also contains the GroupCreateActivity functionality
|
||||
|
||||
package com.b44t.ui;
|
||||
package com.b44t.messenger;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.drawable.BitmapDrawable;
|
||||
@@ -45,6 +46,7 @@ import android.view.Gravity;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.inputmethod.EditorInfo;
|
||||
import android.widget.AbsListView;
|
||||
import android.widget.AdapterView;
|
||||
@@ -54,24 +56,15 @@ import android.widget.LinearLayout;
|
||||
import android.widget.ListView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.b44t.messenger.AndroidUtilities;
|
||||
import com.b44t.messenger.ApplicationLoader;
|
||||
import com.b44t.messenger.ContactsController;
|
||||
import com.b44t.messenger.LocaleController;
|
||||
import com.b44t.messenger.MrContact;
|
||||
import com.b44t.messenger.MrMailbox;
|
||||
import com.b44t.messenger.Utilities;
|
||||
import com.b44t.messenger.TLRPC;
|
||||
import com.b44t.messenger.NotificationCenter;
|
||||
import com.b44t.messenger.R;
|
||||
import com.b44t.ui.Adapters.ContactsAdapter;
|
||||
import com.b44t.ui.Cells.UserCell;
|
||||
import com.b44t.ui.ActionBar.ActionBar;
|
||||
import com.b44t.ui.ActionBar.ActionBarMenu;
|
||||
import com.b44t.ui.ActionBar.ActionBarMenuItem;
|
||||
import com.b44t.ui.ActionBar.BaseFragment;
|
||||
import com.b44t.ui.Components.ChipSpan;
|
||||
import com.b44t.ui.Components.LayoutHelper;
|
||||
import com.b44t.messenger.Cells.TextSettingsCell;
|
||||
import com.b44t.messenger.Components.BaseFragmentAdapter;
|
||||
import com.b44t.messenger.Cells.UserCell;
|
||||
import com.b44t.messenger.ActionBar.ActionBar;
|
||||
import com.b44t.messenger.ActionBar.ActionBarMenu;
|
||||
import com.b44t.messenger.ActionBar.ActionBarMenuItem;
|
||||
import com.b44t.messenger.ActionBar.BaseFragment;
|
||||
import com.b44t.messenger.Components.ChipSpan;
|
||||
import com.b44t.messenger.Components.LayoutHelper;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
@@ -92,21 +85,30 @@ public class ContactsActivity extends BaseFragment implements NotificationCenter
|
||||
private HashMap<Integer, ChipSpan> selectedContacts = new HashMap<>();
|
||||
private ArrayList<ChipSpan> allSpans = new ArrayList<>();
|
||||
|
||||
private int do_what = 0;
|
||||
public final static int SELECT_CONTACT_FOR_NEW_CHAT = 1;
|
||||
public final static int SELECT_CONTACTS_FOR_NEW_GROUP = 2;
|
||||
public final static int ADD_CONTACTS_TO_GROUP = 3;
|
||||
public final static int SELECT_CONTACT_TO_BLOCK = 4;
|
||||
public final static int SELECT_CONTACT_TO_ATTACH = 5;
|
||||
private int rowNewGroup = -1;
|
||||
private int rowNewVerifiedGroup = -1;
|
||||
private int rowAddContact = -1;
|
||||
private int rowInviteViaQr = -1;
|
||||
private int rowContactFirst = -1;
|
||||
private int rowContactLast = -1;
|
||||
private int rowCount = 0;
|
||||
|
||||
private int do_what = 0;
|
||||
public final static int SELECT_CONTACT_FOR_NEW_CHAT = 1;
|
||||
public final static int SELECT_CONTACTS_FOR_NEW_GROUP = 2;
|
||||
public final static int SELECT_CONTACTS_FOR_NEW_VERIFIED_GROUP = 3;
|
||||
public final static int ADD_CONTACTS_TO_GROUP = 4;
|
||||
public final static int ADD_CONTACTS_TO_VERIFIED_GROUP = 5;
|
||||
public final static int SELECT_CONTACT_TO_BLOCK = 6;
|
||||
public final static int SELECT_CONTACT_TO_ATTACH = 7;
|
||||
private final static int id_add_contact = 20; // do_what is also used as internal IDs
|
||||
private final static int id_done_button = 30;
|
||||
|
||||
private ContactsActivityDelegate delegate;
|
||||
|
||||
private String title;
|
||||
private String subtitle;
|
||||
|
||||
private final static int id_add_contact = 2;
|
||||
private final static int id_done_button = 3;
|
||||
private final static int id_toggle = 4;
|
||||
|
||||
public interface ContactsActivityDelegate {
|
||||
void didSelectContact(int user_id);
|
||||
@@ -137,7 +139,12 @@ public class ContactsActivity extends BaseFragment implements NotificationCenter
|
||||
title = ApplicationLoader.applicationContext.getString(R.string.NewGroup);
|
||||
subtitle = ApplicationLoader.applicationContext.getResources().getQuantityString(R.plurals.MeAndMembers, 0, 0);
|
||||
}
|
||||
else if( do_what == ADD_CONTACTS_TO_GROUP )
|
||||
else if( do_what == SELECT_CONTACTS_FOR_NEW_VERIFIED_GROUP )
|
||||
{
|
||||
title = ApplicationLoader.applicationContext.getString(R.string.NewVerifiedGroup);
|
||||
subtitle = ApplicationLoader.applicationContext.getResources().getQuantityString(R.plurals.MeAndMembers, 0, 0);
|
||||
}
|
||||
else if( do_what == ADD_CONTACTS_TO_GROUP || do_what == ADD_CONTACTS_TO_VERIFIED_GROUP )
|
||||
{
|
||||
title = ApplicationLoader.applicationContext.getString(R.string.AddMember);
|
||||
}
|
||||
@@ -178,8 +185,7 @@ public class ContactsActivity extends BaseFragment implements NotificationCenter
|
||||
}
|
||||
|
||||
// initialize action
|
||||
actionBar.setBackButtonImage(do_what == SELECT_CONTACTS_FOR_NEW_GROUP? R.drawable.ic_close_white : R.drawable.ic_ab_back);
|
||||
actionBar.setAllowOverlayTitle(true);
|
||||
actionBar.setBackButtonImage((do_what == SELECT_CONTACTS_FOR_NEW_GROUP||do_what == SELECT_CONTACTS_FOR_NEW_VERIFIED_GROUP)? R.drawable.ic_close_white : R.drawable.ic_ab_back);
|
||||
if( title != null ) {
|
||||
actionBar.setTitle(title);
|
||||
if( subtitle != null ) {
|
||||
@@ -199,7 +205,7 @@ public class ContactsActivity extends BaseFragment implements NotificationCenter
|
||||
AndroidUtilities.runOnUIThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
NotificationCenter.getInstance().postNotificationName(NotificationCenter.contactsDidLoaded);
|
||||
NotificationCenter.getInstance().postNotificationName(NotificationCenter.contactsDidLoaded, 0);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -226,11 +232,11 @@ public class ContactsActivity extends BaseFragment implements NotificationCenter
|
||||
{
|
||||
finishFragment();
|
||||
}
|
||||
else if( id == id_toggle )
|
||||
else if( id == SELECT_CONTACT_FOR_NEW_CHAT || id == SELECT_CONTACTS_FOR_NEW_GROUP || id == SELECT_CONTACTS_FOR_NEW_VERIFIED_GROUP )
|
||||
{
|
||||
Bundle args = new Bundle();
|
||||
args.putInt("do_what", do_what==SELECT_CONTACTS_FOR_NEW_GROUP? SELECT_CONTACT_FOR_NEW_CHAT : SELECT_CONTACTS_FOR_NEW_GROUP);
|
||||
presentFragment(new ContactsActivity(args), true /*removeLast*/, true /*forceWithoutAnimation*/);
|
||||
args.putInt("do_what", id);
|
||||
presentFragment(new ContactsActivity(args), true , true );
|
||||
}
|
||||
else if( id == id_add_contact )
|
||||
{
|
||||
@@ -246,6 +252,7 @@ public class ContactsActivity extends BaseFragment implements NotificationCenter
|
||||
result.addAll(selectedContacts.keySet());
|
||||
Bundle args = new Bundle();
|
||||
args.putIntegerArrayList("result", result);
|
||||
args.putInt("do_what", do_what);
|
||||
presentFragment(new GroupCreateFinalActivity(args));
|
||||
}
|
||||
}
|
||||
@@ -253,20 +260,40 @@ public class ContactsActivity extends BaseFragment implements NotificationCenter
|
||||
|
||||
ActionBarMenu menu = actionBar.createMenu();
|
||||
|
||||
if( do_what == SELECT_CONTACTS_FOR_NEW_GROUP ) {
|
||||
if( do_what == SELECT_CONTACTS_FOR_NEW_GROUP || do_what == SELECT_CONTACTS_FOR_NEW_VERIFIED_GROUP ) {
|
||||
menu.addItem(id_done_button, R.drawable.ic_done); // should the "done" button be right or left of other buttons? Esp. for the "more" button, it looks better if it is right left of it - beside the title describing the action and nearer to "cancel"; the other buttons has not so much to do with the group but switches to other types. In other situations, the icon-oder-decision may be different.
|
||||
}
|
||||
|
||||
/* -- instead of a menu we're testing buttons in the list
|
||||
|
||||
ActionBarMenuItem item = menu.addItem(10, R.drawable.ic_ab_other);
|
||||
if (do_what == SELECT_CONTACT_FOR_NEW_CHAT || do_what == SELECT_CONTACTS_FOR_NEW_GROUP) {
|
||||
item.addSubItem(id_toggle, do_what == SELECT_CONTACT_FOR_NEW_CHAT ? context.getString(R.string.NewGroup) : context.getString(R.string.NewChat), 0);
|
||||
if (do_what == SELECT_CONTACT_FOR_NEW_CHAT || do_what == SELECT_CONTACTS_FOR_NEW_GROUP || do_what == SELECT_CONTACTS_FOR_NEW_VERIFIED_GROUP) {
|
||||
if( do_what!=SELECT_CONTACT_FOR_NEW_CHAT ) { item.addSubItem(SELECT_CONTACT_FOR_NEW_CHAT, context.getString(R.string.NewChat)); }
|
||||
if( do_what!=SELECT_CONTACTS_FOR_NEW_GROUP ) { item.addSubItem(SELECT_CONTACTS_FOR_NEW_GROUP, context.getString(R.string.NewGroup)); }
|
||||
|
||||
if( MrMailbox.getConfigInt("qr_enabled", 0) != 0 ) {
|
||||
if (do_what != SELECT_CONTACTS_FOR_NEW_VERIFIED_GROUP) {
|
||||
item.addSubItem(SELECT_CONTACTS_FOR_NEW_VERIFIED_GROUP, context.getString(R.string.NewVerifiedGroup));
|
||||
}
|
||||
}
|
||||
}
|
||||
item.addSubItem(id_add_contact, context.getString(R.string.NewContactTitle), 0);
|
||||
item.addSubItem(id_add_contact, context.getString(R.string.NewContactTitle));
|
||||
*/
|
||||
|
||||
int listflags = 0;
|
||||
if( do_what==SELECT_CONTACTS_FOR_NEW_VERIFIED_GROUP||do_what==ADD_CONTACTS_TO_VERIFIED_GROUP) {
|
||||
listflags |= MrMailbox.MR_GCL_VERIFIED_ONLY;
|
||||
}
|
||||
|
||||
listViewAdapter = new ContactsAdapter(context);
|
||||
listViewAdapter.setCheckedMap(selectedContacts);
|
||||
if( do_what==SELECT_CONTACT_FOR_NEW_CHAT || do_what==SELECT_CONTACT_TO_ATTACH ) {
|
||||
listflags |= MrMailbox.MR_GCL_ADD_SELF;
|
||||
}
|
||||
|
||||
listViewAdapter = new ContactsAdapter(context, listflags, do_what==SELECT_CONTACT_FOR_NEW_CHAT);
|
||||
|
||||
if( do_what == SELECT_CONTACTS_FOR_NEW_GROUP || do_what == SELECT_CONTACTS_FOR_NEW_VERIFIED_GROUP ) {
|
||||
listViewAdapter.setCheckedMap(selectedContacts);
|
||||
}
|
||||
|
||||
fragmentView = new LinearLayout(context);
|
||||
|
||||
@@ -279,7 +306,7 @@ public class ContactsActivity extends BaseFragment implements NotificationCenter
|
||||
// START SEARCH FIELD
|
||||
userSelectEditText = new EditText(context);
|
||||
userSelectEditText.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16);
|
||||
userSelectEditText.setHintTextColor(0xff979797);
|
||||
userSelectEditText.setHintTextColor(0xffBBBBBB);
|
||||
userSelectEditText.setTextColor(0xff212121);
|
||||
userSelectEditText.setInputType(InputType.TYPE_TEXT_VARIATION_FILTER | InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS | InputType.TYPE_TEXT_FLAG_MULTI_LINE);
|
||||
userSelectEditText.setMinimumHeight(AndroidUtilities.dp(54));
|
||||
@@ -291,8 +318,7 @@ public class ContactsActivity extends BaseFragment implements NotificationCenter
|
||||
userSelectEditText.setPadding(0, 0, 0, 0);
|
||||
userSelectEditText.setImeOptions(EditorInfo.IME_ACTION_DONE | EditorInfo.IME_FLAG_NO_EXTRACT_UI);
|
||||
userSelectEditText.setGravity(Gravity.START | Gravity.CENTER_VERTICAL);
|
||||
AndroidUtilities.clearCursorDrawable(userSelectEditText);
|
||||
frameLayout.addView(userSelectEditText, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.TOP | Gravity.START, 10, 0, 10, 0));
|
||||
frameLayout.addView(userSelectEditText, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.TOP | Gravity.START, 18, 0, 18, 0));
|
||||
|
||||
userSelectEditText.setHint(ApplicationLoader.applicationContext.getString(R.string.Search));
|
||||
userSelectEditText.setTextIsSelectable(false);
|
||||
@@ -346,11 +372,6 @@ public class ContactsActivity extends BaseFragment implements NotificationCenter
|
||||
if (text.length() != 0) {
|
||||
searching = true;
|
||||
searchWas = true;
|
||||
if (listView != null) {
|
||||
listView.setFastScrollAlwaysVisible(false);
|
||||
listView.setFastScrollEnabled(false);
|
||||
listView.setVerticalScrollBarEnabled(true);
|
||||
}
|
||||
if (emptyTextView != null) {
|
||||
emptyTextView.setText(context.getString(R.string.NoResult));
|
||||
}
|
||||
@@ -361,9 +382,6 @@ public class ContactsActivity extends BaseFragment implements NotificationCenter
|
||||
searching = false;
|
||||
searchWas = false;
|
||||
listViewAdapter.notifyDataSetChanged();
|
||||
listView.setFastScrollAlwaysVisible(true);
|
||||
listView.setFastScrollEnabled(true);
|
||||
listView.setVerticalScrollBarEnabled(false);
|
||||
emptyTextView.setText(context.getString(R.string.NoContacts));
|
||||
}
|
||||
}
|
||||
@@ -403,100 +421,123 @@ public class ContactsActivity extends BaseFragment implements NotificationCenter
|
||||
listView.setFastScrollEnabled(true);
|
||||
listView.setScrollBarStyle(View.SCROLLBARS_OUTSIDE_OVERLAY);
|
||||
listView.setAdapter(listViewAdapter);
|
||||
listView.setFastScrollAlwaysVisible(true);
|
||||
listView.setFastScrollAlwaysVisible(false);
|
||||
linearLayout.addView(listView);
|
||||
|
||||
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
||||
@Override
|
||||
public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
|
||||
// a single click on an contact item
|
||||
Object item = listViewAdapter.getItem(i);
|
||||
if (item instanceof TLRPC.User) {
|
||||
final TLRPC.User user = (TLRPC.User) item;
|
||||
if( do_what == SELECT_CONTACT_FOR_NEW_CHAT ) {
|
||||
int belonging_chat_id = MrMailbox.getChatIdByContactId(user.id);
|
||||
if( belonging_chat_id!=0 ) {
|
||||
Bundle args = new Bundle();
|
||||
args.putInt("chat_id", belonging_chat_id);
|
||||
presentFragment(new ChatActivity(args), true);
|
||||
return;
|
||||
}
|
||||
if( i == rowNewGroup || i == rowNewVerifiedGroup ) {
|
||||
Bundle args = new Bundle();
|
||||
args.putInt("do_what", i==rowNewGroup? SELECT_CONTACTS_FOR_NEW_GROUP : SELECT_CONTACTS_FOR_NEW_VERIFIED_GROUP);
|
||||
presentFragment(new ContactsActivity(args), false /*removeLast*/, false /*forceWithoutAnimation*/);
|
||||
}
|
||||
else if( i == rowAddContact) {
|
||||
Bundle args = new Bundle();
|
||||
args.putInt("do_what", ContactAddActivity.CREATE_CONTACT);
|
||||
args.putBoolean("create_chat_when_done", do_what==SELECT_CONTACT_FOR_NEW_CHAT);
|
||||
|
||||
String name = "";
|
||||
{
|
||||
MrContact mrContact = MrMailbox.getContact(user.id);
|
||||
name = mrContact.getNameNAddr();
|
||||
}
|
||||
String lastSearch = listViewAdapter.getSearch();
|
||||
if( lastSearch != null ) {
|
||||
args.putString("prefill", lastSearch);
|
||||
}
|
||||
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
|
||||
builder.setPositiveButton(context.getString(R.string.OK), new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialogInterface, int i) {
|
||||
int belonging_chat_id = MrMailbox.createChatByContactId(user.id);
|
||||
if( belonging_chat_id != 0 ) {
|
||||
Bundle args = new Bundle();
|
||||
args.putInt("chat_id", belonging_chat_id);
|
||||
presentFragment(new ChatActivity(args), true);
|
||||
presentFragment(new ContactAddActivity(args));
|
||||
}
|
||||
else if( i == rowInviteViaQr ) {
|
||||
Intent intent2 = new Intent(getParentActivity(), QRshowActivity.class);
|
||||
Bundle b = new Bundle();
|
||||
b.putInt("chat_id", 0);
|
||||
intent2.putExtras(b);
|
||||
getParentActivity().startActivity(intent2);
|
||||
}
|
||||
else {
|
||||
Object item = listViewAdapter.getItem(i);
|
||||
if (item instanceof TLRPC.User) {
|
||||
final TLRPC.User user = (TLRPC.User) item;
|
||||
if (do_what == SELECT_CONTACT_FOR_NEW_CHAT) {
|
||||
int belonging_chat_id = MrMailbox.getChatIdByContactId(user.id);
|
||||
if (belonging_chat_id != 0) {
|
||||
Bundle args = new Bundle();
|
||||
args.putInt("chat_id", belonging_chat_id);
|
||||
presentFragment(new ChatActivity(args), true);
|
||||
return;
|
||||
}
|
||||
|
||||
String name = "";
|
||||
{
|
||||
MrContact mrContact = MrMailbox.getContact(user.id);
|
||||
name = mrContact.getNameNAddr();
|
||||
}
|
||||
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
|
||||
builder.setPositiveButton(R.string.OK, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialogInterface, int i) {
|
||||
int belonging_chat_id = MrMailbox.createChatByContactId(user.id);
|
||||
if (belonging_chat_id != 0) {
|
||||
Bundle args = new Bundle();
|
||||
args.putInt("chat_id", belonging_chat_id);
|
||||
presentFragment(new ChatActivity(args), true);
|
||||
}
|
||||
}
|
||||
});
|
||||
builder.setNegativeButton(R.string.Cancel, null);
|
||||
builder.setMessage(AndroidUtilities.replaceTags(String.format(context.getString(R.string.AskStartChatWith), name)));
|
||||
showDialog(builder.create());
|
||||
} else if (do_what == SELECT_CONTACTS_FOR_NEW_GROUP || do_what == SELECT_CONTACTS_FOR_NEW_VERIFIED_GROUP) {
|
||||
boolean check = true;
|
||||
if (selectedContacts.containsKey(user.id)) {
|
||||
check = false;
|
||||
try {
|
||||
ChipSpan span = selectedContacts.get(user.id);
|
||||
selectedContacts.remove(user.id);
|
||||
SpannableStringBuilder text = new SpannableStringBuilder(userSelectEditText.getText());
|
||||
text.delete(text.getSpanStart(span), text.getSpanEnd(span));
|
||||
allSpans.remove(span);
|
||||
ignoreChange = true;
|
||||
userSelectEditText.setText(text);
|
||||
userSelectEditText.setSelection(text.length());
|
||||
ignoreChange = false;
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
} else {
|
||||
ignoreChange = true;
|
||||
ChipSpan span = createAndPutChipForUser(user.id);
|
||||
span.uid = user.id;
|
||||
ignoreChange = false;
|
||||
}
|
||||
|
||||
updateSubtitle();
|
||||
|
||||
if (searching || searchWas) {
|
||||
ignoreChange = true;
|
||||
SpannableStringBuilder ssb = new SpannableStringBuilder("");
|
||||
for (ImageSpan sp : allSpans) {
|
||||
ssb.append("<<");
|
||||
ssb.setSpan(sp, ssb.length() - 2, ssb.length(), SpannableStringBuilder.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
}
|
||||
userSelectEditText.setText(ssb);
|
||||
userSelectEditText.setSelection(ssb.length());
|
||||
ignoreChange = false;
|
||||
|
||||
listViewAdapter.search(null);
|
||||
searching = false;
|
||||
searchWas = false;
|
||||
listViewAdapter.notifyDataSetChanged();
|
||||
emptyTextView.setText(context.getString(R.string.NoContacts));
|
||||
} else {
|
||||
if (view instanceof UserCell) {
|
||||
((UserCell) view).setChecked(check, true);
|
||||
}
|
||||
}
|
||||
});
|
||||
builder.setNegativeButton(context.getString(R.string.Cancel), null);
|
||||
builder.setMessage(AndroidUtilities.replaceTags(String.format(context.getString(R.string.AskStartChatWith), name)));
|
||||
showDialog(builder.create());
|
||||
}
|
||||
else if( do_what == SELECT_CONTACTS_FOR_NEW_GROUP ) {
|
||||
boolean check = true;
|
||||
if (selectedContacts.containsKey(user.id)) {
|
||||
check = false;
|
||||
try {
|
||||
ChipSpan span = selectedContacts.get(user.id);
|
||||
selectedContacts.remove(user.id);
|
||||
SpannableStringBuilder text = new SpannableStringBuilder(userSelectEditText.getText());
|
||||
text.delete(text.getSpanStart(span), text.getSpanEnd(span));
|
||||
allSpans.remove(span);
|
||||
ignoreChange = true;
|
||||
userSelectEditText.setText(text);
|
||||
userSelectEditText.setSelection(text.length());
|
||||
ignoreChange = false;
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
} else {
|
||||
ignoreChange = true;
|
||||
ChipSpan span = createAndPutChipForUser(user);
|
||||
span.uid = user.id;
|
||||
ignoreChange = false;
|
||||
} else if (delegate != null) {
|
||||
delegate.didSelectContact(user.id);
|
||||
delegate = null;
|
||||
finishFragment();
|
||||
}
|
||||
actionBar.setSubtitle(context.getResources().getQuantityString(R.plurals.MeAndMembers, selectedContacts.size(), selectedContacts.size()));
|
||||
if (searching || searchWas) {
|
||||
ignoreChange = true;
|
||||
SpannableStringBuilder ssb = new SpannableStringBuilder("");
|
||||
for (ImageSpan sp : allSpans) {
|
||||
ssb.append("<<");
|
||||
ssb.setSpan(sp, ssb.length() - 2, ssb.length(), SpannableStringBuilder.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
}
|
||||
userSelectEditText.setText(ssb);
|
||||
userSelectEditText.setSelection(ssb.length());
|
||||
ignoreChange = false;
|
||||
|
||||
listViewAdapter.search(null);
|
||||
searching = false;
|
||||
searchWas = false;
|
||||
listViewAdapter.notifyDataSetChanged();
|
||||
listView.setFastScrollAlwaysVisible(true);
|
||||
listView.setFastScrollEnabled(true);
|
||||
listView.setVerticalScrollBarEnabled(false);
|
||||
emptyTextView.setText(context.getString(R.string.NoContacts));
|
||||
} else {
|
||||
if (view instanceof UserCell) {
|
||||
((UserCell) view).setChecked(check, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (delegate != null) {
|
||||
delegate.didSelectContact(user.id);
|
||||
delegate = null;
|
||||
finishFragment();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -509,14 +550,34 @@ public class ContactsActivity extends BaseFragment implements NotificationCenter
|
||||
if (item instanceof TLRPC.User) {
|
||||
final TLRPC.User user = (TLRPC.User) item;
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
|
||||
CharSequence[] items = new CharSequence[]{context.getString(R.string.ViewProfile)};
|
||||
CharSequence[] items = new CharSequence[]{context.getString(R.string.ViewProfile),context.getString(R.string.DeleteContact)};
|
||||
builder.setItems(items, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialogInterface, int i) {
|
||||
Bundle args = new Bundle();
|
||||
args.putInt("user_id", user.id);
|
||||
ProfileActivity fragment = new ProfileActivity(args);
|
||||
presentFragment(fragment);
|
||||
if( i == 0 ) {
|
||||
Bundle args = new Bundle();
|
||||
args.putInt("user_id", user.id);
|
||||
ProfileActivity fragment = new ProfileActivity(args);
|
||||
presentFragment(fragment);
|
||||
}
|
||||
else if( i == 1 ) {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
|
||||
builder.setMessage(context.getString(R.string.AreYouSureDeleteContact));
|
||||
builder.setPositiveButton(R.string.OK, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialogInterface, int i) {
|
||||
if( MrMailbox.deleteContact(user.id)==0 ) {
|
||||
AndroidUtilities.showHint(getParentActivity(), context.getString(R.string.CannotDeleteContact));
|
||||
}
|
||||
else {
|
||||
AndroidUtilities.showDoneHint(getParentActivity());
|
||||
listViewAdapter.searchAgain();
|
||||
listViewAdapter.notifyDataSetChanged(); }
|
||||
}
|
||||
});
|
||||
builder.setNegativeButton(R.string.Cancel, null);
|
||||
showDialog(builder.create());
|
||||
}
|
||||
}
|
||||
});
|
||||
showDialog(builder.create());
|
||||
@@ -547,6 +608,16 @@ public class ContactsActivity extends BaseFragment implements NotificationCenter
|
||||
return fragmentView;
|
||||
}
|
||||
|
||||
public void updateSubtitle()
|
||||
{
|
||||
int selectedContactsButMe = selectedContacts.size();
|
||||
if (selectedContacts.containsKey(MrContact.MR_CONTACT_ID_SELF)) {
|
||||
selectedContactsButMe--;
|
||||
}
|
||||
actionBar.setSubtitle(ApplicationLoader.applicationContext.getResources().getQuantityString(R.plurals.MeAndMembers, selectedContactsButMe, selectedContactsButMe));
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
@@ -570,6 +641,11 @@ public class ContactsActivity extends BaseFragment implements NotificationCenter
|
||||
if (listViewAdapter != null) {
|
||||
listViewAdapter.searchAgain();
|
||||
listViewAdapter.notifyDataSetChanged();
|
||||
int sel_contact_id = (int) args[0];
|
||||
if( sel_contact_id != 0 ) {
|
||||
createAndPutChipForUser(sel_contact_id);
|
||||
updateSubtitle();
|
||||
}
|
||||
}
|
||||
} else if (id == NotificationCenter.updateInterfaces) {
|
||||
int mask = (Integer)args[0];
|
||||
@@ -599,14 +675,14 @@ public class ContactsActivity extends BaseFragment implements NotificationCenter
|
||||
this.delegate = delegate;
|
||||
}
|
||||
|
||||
private ChipSpan createAndPutChipForUser(TLRPC.User user) {
|
||||
private ChipSpan createAndPutChipForUser(int contact_id) {
|
||||
LayoutInflater lf = (LayoutInflater) ApplicationLoader.applicationContext.getSystemService(Activity.LAYOUT_INFLATER_SERVICE);
|
||||
View textView = lf.inflate(R.layout.group_create_bubble, null);
|
||||
TextView text = (TextView)textView.findViewById(R.id.bubble_text_view);
|
||||
|
||||
String name ="";
|
||||
{
|
||||
MrContact mrContact = MrMailbox.getContact(user.id);
|
||||
MrContact mrContact = MrMailbox.getContact(contact_id);
|
||||
name = mrContact.getDisplayName();
|
||||
}
|
||||
|
||||
@@ -631,7 +707,7 @@ public class ContactsActivity extends BaseFragment implements NotificationCenter
|
||||
SpannableStringBuilder ssb = new SpannableStringBuilder("");
|
||||
ChipSpan span = new ChipSpan(bmpDrawable, ImageSpan.ALIGN_BASELINE);
|
||||
allSpans.add(span);
|
||||
selectedContacts.put(user.id, span);
|
||||
selectedContacts.put(contact_id, span);
|
||||
for (ImageSpan sp : allSpans) {
|
||||
ssb.append("<<");
|
||||
ssb.setSpan(sp, ssb.length() - 2, ssb.length(), SpannableStringBuilder.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
@@ -640,4 +716,162 @@ public class ContactsActivity extends BaseFragment implements NotificationCenter
|
||||
userSelectEditText.setSelection(ssb.length());
|
||||
return span;
|
||||
}
|
||||
|
||||
private class ContactsAdapter extends BaseFragmentAdapter {
|
||||
|
||||
private Context mContext;
|
||||
private HashMap<Integer, ?> checkedMap;
|
||||
private boolean scrolling;
|
||||
private String lastQuery;
|
||||
|
||||
private int[] contactIds;
|
||||
|
||||
private int mListflags = 0;
|
||||
private boolean mAddNewGroupRows;
|
||||
|
||||
private final int ROWTYPE_TEXT_SETTINGS = 0;
|
||||
private final int ROWTYPE_CONTACT = 1;
|
||||
private final int ROWTYPE_COUNT = 2;
|
||||
|
||||
public ContactsAdapter(Context context, int listflags, boolean addNewGroupRows) {
|
||||
mContext = context;
|
||||
mListflags = listflags;
|
||||
mAddNewGroupRows = addNewGroupRows;
|
||||
contactIds = MrMailbox.getContacts(mListflags, null);
|
||||
updateRowIds();
|
||||
}
|
||||
|
||||
public void updateRowIds()
|
||||
{
|
||||
rowCount = 0;
|
||||
rowNewGroup = -1;
|
||||
rowNewVerifiedGroup = -1;
|
||||
rowAddContact = -1;
|
||||
rowInviteViaQr = -1;
|
||||
rowContactFirst = -1;
|
||||
rowContactLast = -1;
|
||||
|
||||
if( lastQuery == null || lastQuery.isEmpty() ) {
|
||||
if (mAddNewGroupRows) {
|
||||
rowNewGroup = rowCount++;
|
||||
if( MrMailbox.getConfigInt("qr_enabled", 0) != 0 ) {
|
||||
rowNewVerifiedGroup = rowCount++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if( (mListflags & MrMailbox.MR_GCL_VERIFIED_ONLY)!=0 ) {
|
||||
rowInviteViaQr = rowCount++;
|
||||
}
|
||||
else {
|
||||
rowAddContact = rowCount++;
|
||||
}
|
||||
|
||||
if( contactIds.length > 0 ) {
|
||||
rowContactFirst = rowCount;
|
||||
rowCount += contactIds.length;
|
||||
rowContactLast = rowCount - 1;
|
||||
}
|
||||
}
|
||||
|
||||
public void setCheckedMap(HashMap<Integer, ?> map) {
|
||||
checkedMap = map;
|
||||
}
|
||||
|
||||
public void setIsScrolling(boolean value) {
|
||||
scrolling = value;
|
||||
}
|
||||
|
||||
public void search(String query) {
|
||||
contactIds = MrMailbox.getContacts(mListflags, query);
|
||||
lastQuery = query;
|
||||
updateRowIds();
|
||||
}
|
||||
|
||||
public void searchAgain() {
|
||||
contactIds = MrMailbox.getContacts(mListflags, lastQuery);
|
||||
updateRowIds();
|
||||
}
|
||||
|
||||
public String getSearch(){
|
||||
return lastQuery;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getItem(int i) {
|
||||
int curr_user_index = i - rowContactFirst;
|
||||
if(curr_user_index>=0 && curr_user_index<contactIds.length) {
|
||||
TLRPC.User u = new TLRPC.User();
|
||||
u.id = contactIds[curr_user_index];
|
||||
return u;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEnabled(int i) {
|
||||
int type = getItemViewType(i);
|
||||
return (type == ROWTYPE_CONTACT || type == ROWTYPE_TEXT_SETTINGS);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
return rowCount;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(int i, View view, ViewGroup parent) {
|
||||
int type = getItemViewType(i);
|
||||
if( type == ROWTYPE_TEXT_SETTINGS ) {
|
||||
if (view == null) {
|
||||
view = new TextSettingsCell(mContext);
|
||||
view.setBackgroundColor(0xffffffff);
|
||||
}
|
||||
TextSettingsCell textCell = (TextSettingsCell) view;
|
||||
if( i == rowNewGroup ) {
|
||||
textCell.setText(mContext.getString(R.string.NewGroup), true);
|
||||
}
|
||||
else if( i == rowNewVerifiedGroup ) {
|
||||
textCell.setText(mContext.getString(R.string.NewVerifiedGroup), true);
|
||||
}
|
||||
else if( i == rowAddContact) {
|
||||
textCell.setText(mContext.getString(R.string.NewContactTitle), false);
|
||||
}
|
||||
else if( i == rowInviteViaQr) {
|
||||
textCell.setText(mContext.getString(R.string.QrShowVerifyCode), false);
|
||||
}
|
||||
}
|
||||
else if( type == ROWTYPE_CONTACT ) {
|
||||
if (view == null) {
|
||||
view = new UserCell(mContext, 1);
|
||||
}
|
||||
|
||||
int curr_user_index = i - rowContactFirst;
|
||||
if (curr_user_index >= 0 && curr_user_index < contactIds.length) {
|
||||
int curr_user_id = contactIds[curr_user_index];
|
||||
MrContact mrContact = MrMailbox.getContact(curr_user_id);
|
||||
((UserCell) view).setData(mrContact);
|
||||
if (checkedMap != null) {
|
||||
boolean checked = curr_user_id == MrContact.MR_CONTACT_ID_SELF || checkedMap.containsKey(curr_user_id);
|
||||
((UserCell) view).setChecked(checked, !scrolling);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemViewType(int i) {
|
||||
if(i>=rowContactFirst && i<=rowContactLast ) {
|
||||
return ROWTYPE_CONTACT;
|
||||
}
|
||||
return ROWTYPE_TEXT_SETTINGS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getViewTypeCount() {
|
||||
return ROWTYPE_COUNT;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -42,10 +42,9 @@ import android.graphics.Shader;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.provider.ContactsContract;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
|
||||
import com.b44t.ui.Components.AvatarDrawable;
|
||||
import com.b44t.messenger.Components.AvatarDrawable;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.util.HashMap;
|
||||
@@ -167,12 +166,13 @@ public class ContactsController {
|
||||
// get email/name to search avatar image for
|
||||
String tempEmail = null;
|
||||
String tempName = "";
|
||||
String tempPath = "";
|
||||
if (mrContact != null) {
|
||||
tempEmail = mrContact.getAddr();
|
||||
tempName = mrContact.getDisplayName();
|
||||
} else if (mrChat != null) {
|
||||
tempName = mrChat.getName();
|
||||
if (mrChat.getType() == MrChat.MR_CHAT_NORMAL) {
|
||||
if (!mrChat.isGroup()) {
|
||||
int[] contact_ids = MrMailbox.getChatContacts(mrChat.getId());
|
||||
if (contact_ids.length == 1) {
|
||||
MrContact mrc = MrMailbox.getContact(contact_ids[0]);
|
||||
@@ -180,16 +180,20 @@ public class ContactsController {
|
||||
tempName = mrc.getDisplayName();
|
||||
}
|
||||
}
|
||||
else {
|
||||
tempPath = mrChat.getProfileImage();
|
||||
}
|
||||
}
|
||||
|
||||
setupAvatarByStrings(avtView, avtImageReceiver, avtDrawable, tempEmail, tempName);
|
||||
setupAvatarByStrings(avtView, avtImageReceiver, avtDrawable, tempEmail, tempName, tempPath);
|
||||
}
|
||||
|
||||
public static void setupAvatarByStrings(final View avtView,
|
||||
private static void setupAvatarByStrings(final View avtView,
|
||||
final ImageReceiver avtImageReceiver,
|
||||
final AvatarDrawable avtDrawable,
|
||||
String tempEmail,
|
||||
String tempName)
|
||||
String tempName,
|
||||
String tempPath)
|
||||
{
|
||||
if( tempEmail == null ) {
|
||||
tempEmail = "fallback:" + tempName;
|
||||
@@ -197,13 +201,14 @@ public class ContactsController {
|
||||
|
||||
final String email = tempEmail;
|
||||
final String fallbackName = tempName;
|
||||
final String path = tempPath;
|
||||
|
||||
// bind email+name address to view object to detect overwrites and discard loading old images (may happen on fast scrolling)
|
||||
// moreover, check if the avatar is in cache
|
||||
AvtCacheEntry cacheEntry;
|
||||
synchronized (s_sync) {
|
||||
avtImageReceiver.m_userDataUnique = email+fallbackName;
|
||||
cacheEntry = s_avtCache.get(email+fallbackName);
|
||||
avtImageReceiver.m_userDataUnique = email+fallbackName+path;
|
||||
cacheEntry = s_avtCache.get(email+fallbackName+path);
|
||||
}
|
||||
|
||||
if( cacheEntry != null )
|
||||
@@ -231,14 +236,27 @@ public class ContactsController {
|
||||
public void run() {
|
||||
// is the avatar still desired?
|
||||
synchronized (s_sync) {
|
||||
if (!avtImageReceiver.m_userDataUnique.equals(email+fallbackName)) {
|
||||
if (!avtImageReceiver.m_userDataUnique.equals(email+fallbackName+path)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// try to get avatar image from the address book
|
||||
Bitmap tempBitmap = null;
|
||||
if (!email.startsWith("fallback:")) {
|
||||
|
||||
if( !path.isEmpty() ) {
|
||||
try {
|
||||
Bitmap tempBitmap2 = BitmapFactory.decodeFile(path);
|
||||
if (tempBitmap2 != null) {
|
||||
tempBitmap = createRoundBitmap(tempBitmap2);
|
||||
}
|
||||
}
|
||||
catch (Exception e) {
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
if( tempBitmap==null && !email.startsWith("fallback:")) {
|
||||
try {
|
||||
if (s_cr == null) {
|
||||
s_cr = ApplicationLoader.applicationContext.getContentResolver();
|
||||
@@ -274,7 +292,7 @@ public class ContactsController {
|
||||
public void run() {
|
||||
// is the avatar still desired?
|
||||
synchronized (s_sync) {
|
||||
if (!avtImageReceiver.m_userDataUnique.equals(email+fallbackName)) {
|
||||
if (!avtImageReceiver.m_userDataUnique.equals(email+fallbackName+path)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -288,7 +306,7 @@ public class ContactsController {
|
||||
avtView.invalidate();
|
||||
|
||||
synchronized (s_sync) {
|
||||
s_avtCache.put(email+fallbackName, new AvtCacheEntry(photoBitmap, fallbackName));
|
||||
s_avtCache.put(email+fallbackName+path, new AvtCacheEntry(photoBitmap, fallbackName));
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -334,7 +352,8 @@ public class ContactsController {
|
||||
private static RectF bitmapRect;
|
||||
private static Bitmap createRoundBitmap(Bitmap bitmap) {
|
||||
try {
|
||||
Bitmap result = Bitmap.createBitmap(bitmap.getWidth(), bitmap.getHeight(), Bitmap.Config.ARGB_8888);
|
||||
int wh = Math.min(bitmap.getWidth(), bitmap.getHeight());
|
||||
Bitmap result = Bitmap.createBitmap(wh, wh, Bitmap.Config.ARGB_8888);
|
||||
result.eraseColor(Color.TRANSPARENT);
|
||||
Canvas canvas = new Canvas(result);
|
||||
BitmapShader shader = new BitmapShader(bitmap, Shader.TileMode.CLAMP, Shader.TileMode.CLAMP);
|
||||
@@ -343,8 +362,8 @@ public class ContactsController {
|
||||
bitmapRect = new RectF();
|
||||
}
|
||||
roundPaint.setShader(shader);
|
||||
bitmapRect.set(0, 0, bitmap.getWidth(), bitmap.getHeight());
|
||||
canvas.drawRoundRect(bitmapRect, bitmap.getWidth(), bitmap.getHeight(), roundPaint);
|
||||
bitmapRect.set(0, 0, wh, wh);
|
||||
canvas.drawRoundRect(bitmapRect, wh, wh, roundPaint);
|
||||
return result;
|
||||
} catch (Throwable e) {
|
||||
;
|
||||
|
||||
+12
-17
@@ -21,7 +21,7 @@
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
package com.b44t.ui;
|
||||
package com.b44t.messenger;
|
||||
|
||||
import android.animation.Animator;
|
||||
import android.animation.AnimatorSet;
|
||||
@@ -43,19 +43,15 @@ import android.widget.AdapterView;
|
||||
import android.widget.ListView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.b44t.messenger.AndroidUtilities;
|
||||
import com.b44t.messenger.ApplicationLoader;
|
||||
import com.b44t.messenger.LocaleController;
|
||||
import com.b44t.messenger.R;
|
||||
import com.b44t.ui.ActionBar.BackDrawable;
|
||||
import com.b44t.ui.ActionBar.Theme;
|
||||
import com.b44t.ui.Adapters.BaseFragmentAdapter;
|
||||
import com.b44t.ui.ActionBar.ActionBar;
|
||||
import com.b44t.ui.ActionBar.ActionBarMenu;
|
||||
import com.b44t.ui.ActionBar.BaseFragment;
|
||||
import com.b44t.ui.Cells.SharedDocumentCell;
|
||||
import com.b44t.ui.Components.LayoutHelper;
|
||||
import com.b44t.ui.Components.NumberTextView;
|
||||
import com.b44t.messenger.ActionBar.BackDrawable;
|
||||
import com.b44t.messenger.ActionBar.Theme;
|
||||
import com.b44t.messenger.Components.BaseFragmentAdapter;
|
||||
import com.b44t.messenger.ActionBar.ActionBar;
|
||||
import com.b44t.messenger.ActionBar.ActionBarMenu;
|
||||
import com.b44t.messenger.ActionBar.BaseFragment;
|
||||
import com.b44t.messenger.Cells.SharedDocumentCell;
|
||||
import com.b44t.messenger.Components.LayoutHelper;
|
||||
import com.b44t.messenger.Components.NumberTextView;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
@@ -160,7 +156,6 @@ public class DocumentSelectActivity extends BaseFragment {
|
||||
}
|
||||
|
||||
actionBar.setBackButtonDrawable(new BackDrawable(false));
|
||||
actionBar.setAllowOverlayTitle(true);
|
||||
actionBar.setTitle(context.getString(R.string.SelectFile));
|
||||
actionBar.setActionBarMenuOnItemClick(new ActionBar.ActionBarMenuOnItemClick() {
|
||||
@Override
|
||||
@@ -303,7 +298,7 @@ public class DocumentSelectActivity extends BaseFragment {
|
||||
} else {
|
||||
if (!file.canRead()) {
|
||||
showErrorBox(ApplicationLoader.applicationContext.getString(R.string.AccessError));
|
||||
file = new File("/mnt/sdcard");
|
||||
return;
|
||||
}
|
||||
if (file.length() == 0) {
|
||||
return;
|
||||
@@ -368,7 +363,7 @@ public class DocumentSelectActivity extends BaseFragment {
|
||||
if (selectedMessagesCountTextView == null) {
|
||||
return;
|
||||
}
|
||||
if (!AndroidUtilities.isTablet() && ApplicationLoader.applicationContext.getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) {
|
||||
if (ApplicationLoader.applicationContext.getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) {
|
||||
selectedMessagesCountTextView.setTextSize(18);
|
||||
} else {
|
||||
selectedMessagesCountTextView.setTextSize(20);
|
||||
@@ -1,491 +0,0 @@
|
||||
/*******************************************************************************
|
||||
*
|
||||
* Delta Chat Android
|
||||
* (C) 2013-2016 Nikolai Kudashov
|
||||
* (C) 2017 Björn Petersen
|
||||
* Contact: r10s@b44t.com, http://b44t.com
|
||||
*
|
||||
* This program 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.
|
||||
*
|
||||
* This program 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
|
||||
* this program. If not, see http://www.gnu.org/licenses/ .
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
package com.b44t.messenger;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.InputStream;
|
||||
import java.util.HashMap;
|
||||
import java.util.Locale;
|
||||
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.ColorFilter;
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.PixelFormat;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.text.Spannable;
|
||||
|
||||
public class Emoji {
|
||||
private static HashMap<CharSequence, DrawableInfo> rects = new HashMap<>();
|
||||
private static int drawImgSize;
|
||||
private static int bigImgSize;
|
||||
private static boolean inited = false;
|
||||
private static Paint placeholderPaint;
|
||||
private static final int splitCount = 4;
|
||||
private static Bitmap emojiBmp[][] = new Bitmap[5][splitCount];
|
||||
private static boolean loadingEmoji[][] = new boolean[5][splitCount];
|
||||
|
||||
private static final int[][] cols = {
|
||||
{11, 11, 11, 11},
|
||||
{6, 6, 6, 6},
|
||||
{9, 9, 9, 9},
|
||||
{9, 9, 9, 9},
|
||||
{8, 8, 8, 7}
|
||||
};
|
||||
|
||||
static {
|
||||
int emojiFullSize;
|
||||
if (AndroidUtilities.density <= 1.0f) {
|
||||
emojiFullSize = 32;
|
||||
} else if (AndroidUtilities.density <= 1.5f) {
|
||||
emojiFullSize = 48;
|
||||
} else if (AndroidUtilities.density <= 2.0f) {
|
||||
emojiFullSize = 64;
|
||||
} else {
|
||||
emojiFullSize = 64;
|
||||
}
|
||||
drawImgSize = AndroidUtilities.dp(20);
|
||||
bigImgSize = AndroidUtilities.dp(AndroidUtilities.isTablet() ? 40 : 32);
|
||||
|
||||
for (int j = 0; j < EmojiData.data.length; j++) {
|
||||
int count2 = (int) Math.ceil(EmojiData.data[j].length / (float) splitCount);
|
||||
int position;
|
||||
for (int i = 0; i < EmojiData.data[j].length; i++) {
|
||||
int page = i / count2;
|
||||
position = i - page * count2;
|
||||
Rect rect = new Rect((position % cols[j][page]) * emojiFullSize, (position / cols[j][page]) * emojiFullSize, (position % cols[j][page] + 1) * emojiFullSize, (position / cols[j][page] + 1) * emojiFullSize);
|
||||
rects.put(EmojiData.data[j][i], new DrawableInfo(rect, (byte) j, (byte) page));
|
||||
}
|
||||
}
|
||||
placeholderPaint = new Paint();
|
||||
placeholderPaint.setColor(0x00000000);
|
||||
}
|
||||
|
||||
/*private static void loadEmoji(final int page, final int page2) {
|
||||
try {
|
||||
float scale;
|
||||
int imageResize = 1;
|
||||
if (AndroidUtilities.density <= 1.0f) {
|
||||
scale = 2.0f;
|
||||
imageResize = 2;
|
||||
} else if (AndroidUtilities.density <= 1.5f) {
|
||||
scale = 3.0f;
|
||||
imageResize = 2;
|
||||
} else if (AndroidUtilities.density <= 2.0f) {
|
||||
scale = 2.0f;
|
||||
} else {
|
||||
scale = 2.0f;
|
||||
}
|
||||
|
||||
String imageName;
|
||||
File imageFile;
|
||||
|
||||
try {
|
||||
for (int a = 4; a < 6; a++) {
|
||||
imageName = String.format(Locale.US, "v%d_emoji%.01fx_%d.jpg", a, scale, page);
|
||||
imageFile = ApplicationLoader.applicationContext.getFileStreamPath(imageName);
|
||||
if (imageFile.exists()) {
|
||||
imageFile.delete();
|
||||
}
|
||||
imageName = String.format(Locale.US, "v%d_emoji%.01fx_a_%d.jpg", a, scale, page);
|
||||
imageFile = ApplicationLoader.applicationContext.getFileStreamPath(imageName);
|
||||
if (imageFile.exists()) {
|
||||
imageFile.delete();
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
imageName = String.format(Locale.US, "v7_emoji%.01fx_%d_%d.jpg", scale, page, page2);
|
||||
imageFile = ApplicationLoader.applicationContext.getFileStreamPath(imageName);
|
||||
if (!imageFile.exists()) {
|
||||
InputStream is = ApplicationLoader.applicationContext.getAssets().open("emoji/" + imageName);
|
||||
AndroidUtilities.copyFile(is, imageFile);
|
||||
is.close();
|
||||
}
|
||||
|
||||
BitmapFactory.Options opts = new BitmapFactory.Options();
|
||||
opts.inJustDecodeBounds = true;
|
||||
BitmapFactory.decodeFile(imageFile.getAbsolutePath(), opts);
|
||||
|
||||
int width = opts.outWidth / imageResize;
|
||||
int height = opts.outHeight / imageResize;
|
||||
int stride = width * 4;
|
||||
|
||||
final Bitmap bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
|
||||
Utilities.loadBitmap(imageFile.getAbsolutePath(), bitmap, imageResize, width, height, stride);
|
||||
|
||||
imageName = String.format(Locale.US, "v7_emoji%.01fx_a_%d_%d.jpg", scale, page, page2);
|
||||
imageFile = ApplicationLoader.applicationContext.getFileStreamPath(imageName);
|
||||
if (!imageFile.exists()) {
|
||||
InputStream is = ApplicationLoader.applicationContext.getAssets().open("emoji/" + imageName);
|
||||
AndroidUtilities.copyFile(is, imageFile);
|
||||
is.close();
|
||||
}
|
||||
|
||||
Utilities.loadBitmap(imageFile.getAbsolutePath(), bitmap, imageResize, width, height, stride);
|
||||
|
||||
AndroidUtilities.runOnUIThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
emojiBmp[page][page2] = bitmap;
|
||||
NotificationCenter.getInstance().postNotificationName(NotificationCenter.emojiDidLoaded);
|
||||
}
|
||||
});
|
||||
} catch (Throwable x) {
|
||||
//Log.i("DeltaChat", "Error loading emoji", x);
|
||||
}
|
||||
}*/
|
||||
|
||||
/*
|
||||
public static void invalidateAll(View view) {
|
||||
if (view instanceof ViewGroup) {
|
||||
ViewGroup g = (ViewGroup) view;
|
||||
for (int i = 0; i < g.getChildCount(); i++) {
|
||||
invalidateAll(g.getChildAt(i));
|
||||
}
|
||||
} else if (view instanceof TextView) {
|
||||
view.invalidate();
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
public static String fixEmoji(String emoji) {
|
||||
char ch;
|
||||
int lenght = emoji.length();
|
||||
for (int a = 0; a < lenght; a++) {
|
||||
ch = emoji.charAt(a);
|
||||
if (ch >= 0xD83C && ch <= 0xD83E) {
|
||||
if (ch == 0xD83C && a < lenght - 1) {
|
||||
ch = emoji.charAt(a + 1);
|
||||
if (ch == 0xDE2F || ch == 0xDC04 || ch == 0xDE1A || ch == 0xDD7F) {
|
||||
emoji = emoji.substring(0, a + 2) + "\uFE0F" + emoji.substring(a + 2);
|
||||
lenght++;
|
||||
a += 2;
|
||||
} else {
|
||||
a++;
|
||||
}
|
||||
} else {
|
||||
a++;
|
||||
}
|
||||
} else if (ch == 0x20E3) {
|
||||
return emoji;
|
||||
} else if (ch >= 0x203C && ch <= 0x3299) {
|
||||
if (EmojiData.emojiToFE0FMap.containsKey(ch)) {
|
||||
emoji = emoji.substring(0, a + 1) + "\uFE0F" + emoji.substring(a + 1);
|
||||
lenght++;
|
||||
a++;
|
||||
}
|
||||
}
|
||||
}
|
||||
return emoji;
|
||||
}
|
||||
|
||||
/*public static EmojiDrawable getEmojiDrawable(CharSequence code) {
|
||||
DrawableInfo info = rects.get(code);
|
||||
if (info == null) {
|
||||
//Log.i("DeltaChat", "No drawable for emoji " + code);
|
||||
return null;
|
||||
}
|
||||
EmojiDrawable ed = new EmojiDrawable(info);
|
||||
ed.setBounds(0, 0, drawImgSize, drawImgSize);
|
||||
return ed;
|
||||
}*/
|
||||
|
||||
/*
|
||||
public static Drawable getEmojiBigDrawable(String code) {
|
||||
EmojiDrawable ed = getEmojiDrawable(code);
|
||||
if (ed == null) {
|
||||
return null;
|
||||
}
|
||||
ed.setBounds(0, 0, bigImgSize, bigImgSize);
|
||||
ed.fullSize = true;
|
||||
return ed;
|
||||
}
|
||||
*/
|
||||
|
||||
/*public static class EmojiDrawable extends Drawable {
|
||||
private DrawableInfo info;
|
||||
private boolean fullSize = false;
|
||||
private static Paint paint = new Paint(Paint.FILTER_BITMAP_FLAG);
|
||||
private static Rect rect = new Rect();
|
||||
|
||||
public EmojiDrawable(DrawableInfo i) {
|
||||
info = i;
|
||||
}
|
||||
|
||||
public DrawableInfo getDrawableInfo() {
|
||||
return info;
|
||||
}
|
||||
|
||||
public Rect getDrawRect() {
|
||||
Rect original = getBounds();
|
||||
int cX = original.centerX(), cY = original.centerY();
|
||||
rect.left = cX - (fullSize ? bigImgSize : drawImgSize) / 2;
|
||||
rect.right = cX + (fullSize ? bigImgSize : drawImgSize) / 2;
|
||||
rect.top = cY - (fullSize ? bigImgSize : drawImgSize) / 2;
|
||||
rect.bottom = cY + (fullSize ? bigImgSize : drawImgSize) / 2;
|
||||
return rect;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(Canvas canvas) {
|
||||
if (emojiBmp[info.page][info.page2] == null) {
|
||||
if (loadingEmoji[info.page][info.page2]) {
|
||||
return;
|
||||
}
|
||||
loadingEmoji[info.page][info.page2] = true;
|
||||
Utilities.globalQueue.postRunnable(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
loadEmoji(info.page, info.page2);
|
||||
loadingEmoji[info.page][info.page2] = false;
|
||||
}
|
||||
});
|
||||
canvas.drawRect(getBounds(), placeholderPaint);
|
||||
return;
|
||||
}
|
||||
|
||||
Rect b;
|
||||
if (fullSize) {
|
||||
b = getDrawRect();
|
||||
} else {
|
||||
b = getBounds();
|
||||
}
|
||||
|
||||
//if (!canvas.quickReject(b.left, b.top, b.right, b.bottom, Canvas.EdgeType.AA)) {
|
||||
canvas.drawBitmap(emojiBmp[info.page][info.page2], info.rect, b, paint);
|
||||
//}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getOpacity() {
|
||||
return PixelFormat.TRANSPARENT;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAlpha(int alpha) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setColorFilter(ColorFilter cf) {
|
||||
|
||||
}
|
||||
}*/
|
||||
|
||||
private static class DrawableInfo {
|
||||
public Rect rect;
|
||||
public byte page;
|
||||
public byte page2;
|
||||
|
||||
public DrawableInfo(Rect r, byte p, byte p2) {
|
||||
rect = r;
|
||||
page = p;
|
||||
page2 = p2;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
private static boolean inArray(char c, char[] a) {
|
||||
for (char cc : a) {
|
||||
if (cc == c) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
*/
|
||||
|
||||
public static CharSequence replaceEmoji(CharSequence cs, Paint.FontMetricsInt fontMetrics, int size, boolean createNew) {
|
||||
if (cs == null || cs.length() == 0) {
|
||||
return cs;
|
||||
}
|
||||
//SpannableStringLight.isFieldsAvailable();
|
||||
//SpannableStringLight s = new SpannableStringLight(cs.toString());
|
||||
Spannable s;
|
||||
if (!createNew && cs instanceof Spannable) {
|
||||
s = (Spannable) cs;
|
||||
} else {
|
||||
s = Spannable.Factory.getInstance().newSpannable(cs.toString());
|
||||
}
|
||||
/* Telegram-FOSS - Disable emoji replacement, falling back to native emojis. */
|
||||
// long buf = 0;
|
||||
// int emojiCount = 0;
|
||||
// char c;
|
||||
// int startIndex = -1;
|
||||
// int startLength = 0;
|
||||
// int previousGoodIndex = 0;
|
||||
// StringBuilder emojiCode = new StringBuilder(16);
|
||||
// boolean nextIsSkinTone;
|
||||
// EmojiDrawable drawable;
|
||||
// EmojiSpan span;
|
||||
// int length = cs.length();
|
||||
// boolean doneEmoji = false;
|
||||
// //s.setSpansCount(emojiCount);
|
||||
//
|
||||
// try {
|
||||
// for (int i = 0; i < length; i++) {
|
||||
// c = cs.charAt(i);
|
||||
// if (c >= 0xD83C && c <= 0xD83E || (buf != 0 && (buf & 0xFFFFFFFF00000000L) == 0 && (buf & 0xFFFF) == 0xD83C && (c >= 0xDDE6 && c <= 0xDDFF))) {
|
||||
// if (startIndex == -1) {
|
||||
// startIndex = i;
|
||||
// }
|
||||
// emojiCode.append(c);
|
||||
// startLength++;
|
||||
// buf <<= 16;
|
||||
// buf |= c;
|
||||
// } else if (buf > 0 && (c & 0xF000) == 0xD000) {
|
||||
// emojiCode.append(c);
|
||||
// startLength++;
|
||||
// buf = 0;
|
||||
// doneEmoji = true;
|
||||
// } else if (c == 0x20E3) {
|
||||
// if (i > 0) {
|
||||
// char c2 = cs.charAt(previousGoodIndex);
|
||||
// if ((c2 >= '0' && c2 <= '9') || c2 == '#' || c2 == '*') {
|
||||
// startIndex = previousGoodIndex;
|
||||
// startLength = i - previousGoodIndex + 1;
|
||||
// emojiCode.append(c2);
|
||||
// emojiCode.append(c);
|
||||
// doneEmoji = true;
|
||||
// }
|
||||
// }
|
||||
// } else if ((c == 0x00A9 || c == 0x00AE || c >= 0x203C && c <= 0x3299) && EmojiData.dataCharsMap.containsKey(c)) {
|
||||
// if (startIndex == -1) {
|
||||
// startIndex = i;
|
||||
// }
|
||||
// startLength++;
|
||||
// emojiCode.append(c);
|
||||
// doneEmoji = true;
|
||||
// } else if (startIndex != -1) {
|
||||
// emojiCode.setLength(0);
|
||||
// startIndex = -1;
|
||||
// startLength = 0;
|
||||
// doneEmoji = false;
|
||||
// }
|
||||
// previousGoodIndex = i;
|
||||
// for (int a = 0; a < 3; a++) {
|
||||
// if (i + 1 < length) {
|
||||
// c = cs.charAt(i + 1);
|
||||
// if (a == 1) {
|
||||
// if (c == 0x200D) {
|
||||
// emojiCode.append(c);
|
||||
// i++;
|
||||
// startLength++;
|
||||
// doneEmoji = false;
|
||||
// }
|
||||
// } else {
|
||||
// if (c >= 0xFE00 && c <= 0xFE0F) {
|
||||
// i++;
|
||||
// startLength++;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// if (doneEmoji) {
|
||||
// if (i + 2 < length) {
|
||||
// if (cs.charAt(i + 1) == 0xD83C && cs.charAt(i + 2) >= 0xDFFB && cs.charAt(i + 2) <= 0xDFFF) {
|
||||
// emojiCode.append(cs.subSequence(i + 1, i + 3));
|
||||
// startLength += 2;
|
||||
// i += 2;
|
||||
// }
|
||||
// }
|
||||
// drawable = Emoji.getEmojiDrawable(emojiCode.subSequence(0, emojiCode.length()));
|
||||
// if (drawable != null) {
|
||||
// span = new EmojiSpan(drawable, DynamicDrawableSpan.ALIGN_BOTTOM, size, fontMetrics);
|
||||
// s.setSpan(span, startIndex, startIndex + startLength, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
// emojiCount++;
|
||||
// }
|
||||
// startLength = 0;
|
||||
// startIndex = -1;
|
||||
// emojiCode.setLength(0);
|
||||
// doneEmoji = false;
|
||||
// }
|
||||
// if (emojiCount >= 50) { //654 new
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// } catch (Exception e) {
|
||||
//
|
||||
// return cs;
|
||||
// }
|
||||
return s;
|
||||
}
|
||||
|
||||
/*
|
||||
public static class EmojiSpan extends ImageSpan {
|
||||
private Paint.FontMetricsInt fontMetrics = null;
|
||||
private int size = AndroidUtilities.dp(20);
|
||||
|
||||
public EmojiSpan(EmojiDrawable d, int verticalAlignment, int s, Paint.FontMetricsInt original) {
|
||||
super(d, verticalAlignment);
|
||||
fontMetrics = original;
|
||||
if (original != null) {
|
||||
size = Math.abs(fontMetrics.descent) + Math.abs(fontMetrics.ascent);
|
||||
if (size == 0) {
|
||||
size = AndroidUtilities.dp(20);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSize(Paint paint, CharSequence text, int start, int end, Paint.FontMetricsInt fm) {
|
||||
if (fm == null) {
|
||||
fm = new Paint.FontMetricsInt();
|
||||
}
|
||||
|
||||
if (fontMetrics == null) {
|
||||
int sz = super.getSize(paint, text, start, end, fm);
|
||||
|
||||
int offset = AndroidUtilities.dp(8);
|
||||
int w = AndroidUtilities.dp(10);
|
||||
fm.top = -w - offset;
|
||||
fm.bottom = w - offset;
|
||||
fm.ascent = -w - offset;
|
||||
fm.leading = 0;
|
||||
fm.descent = w - offset;
|
||||
|
||||
return sz;
|
||||
} else {
|
||||
if (fm != null) {
|
||||
fm.ascent = fontMetrics.ascent;
|
||||
fm.descent = fontMetrics.descent;
|
||||
|
||||
fm.top = fontMetrics.top;
|
||||
fm.bottom = fontMetrics.bottom;
|
||||
}
|
||||
if (getDrawable() != null) {
|
||||
getDrawable().setBounds(0, 0, size, size);
|
||||
}
|
||||
return size;
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
@@ -1,364 +0,0 @@
|
||||
/*******************************************************************************
|
||||
*
|
||||
* Delta Chat Android
|
||||
* (C) 2013-2016 Nikolai Kudashov
|
||||
* (C) 2017 Björn Petersen
|
||||
* Contact: r10s@b44t.com, http://b44t.com
|
||||
*
|
||||
* This program 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.
|
||||
*
|
||||
* This program 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
|
||||
* this program. If not, see http://www.gnu.org/licenses/ .
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
package com.b44t.messenger;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
public class EmojiData {
|
||||
|
||||
public static final char[] emojiToFE0F = {
|
||||
0x2B50, 0x2600, 0x26C5, 0x2601, 0x26A1, 0x2744, 0x26C4, 0x2614, 0x2708, 0x26F5,
|
||||
0x2693, 0x26FD, 0x26F2, 0x26FA, 0x26EA, 0x2615, 0x26BD, 0x26BE, 0x26F3, 0x231A,
|
||||
0x260E, 0x231B, 0x2709, 0x2702, 0x2712, 0x270F, 0x2648, 0x2649, 0x264A, 0x264B,
|
||||
0x264C, 0x264D, 0x264E, 0x264F, 0x2650, 0x2651, 0x2652, 0x2653, 0x2734, 0x3299,
|
||||
0x3297, 0x26D4, 0x2B55, 0x2668, 0x2757, 0x203C, 0x2049, 0x303D, 0x26A0, 0x267B,
|
||||
0x2747, 0x2733, 0x24C2, 0x267F, 0x25B6, 0x25C0, 0x27A1, 0x2B05, 0x2B06, 0x2B07,
|
||||
0x2197, 0x2198, 0x2199, 0x2196, 0x2195, 0x2194, 0x21AA, 0x21A9, 0x2934, 0x2935,
|
||||
0x2139, 0x2714, 0x2716, 0x2611, 0x26AA, 0x26AB, 0x25AA, 0x25AB, 0x2B1B, 0x2B1C,
|
||||
0x25FC, 0x25FB, 0x25FE, 0x25FD, 0x2660, 0x2663, 0x2665, 0x2666, 0x263A, 0x2639,
|
||||
0x270C, 0x261D, 0x2764
|
||||
};
|
||||
//0xD83CDE2F, 0xD83CDC04, 0xD83CDE1A, 0xD83CDD7F
|
||||
|
||||
public static final char[] dataChars = {
|
||||
0x262E, 0x271D, 0x262A, 0x2638, 0x2721, 0x262F, 0x2626, 0x26CE, 0x2648, 0x2649,
|
||||
0x264A, 0x264B, 0x264C, 0x264D, 0x264E, 0x264F, 0x2650, 0x2651, 0x2652, 0x2653,
|
||||
0x269B, 0x2622, 0x2623, 0x2734, 0x3299, 0x3297, 0x26D4, 0x274C, 0x2B55, 0x2668,
|
||||
0x2757, 0x2755, 0x2753, 0x2754, 0x203C, 0x2049, 0x269C, 0x303D, 0x26A0, 0x267B,
|
||||
0x2747, 0x2733, 0x274E, 0x2705, 0x27BF, 0x24C2, 0x267F, 0x25B6, 0x23F8, 0x23EF,
|
||||
0x23F9, 0x23FA, 0x23ED, 0x23EE, 0x23E9, 0x23EA, 0x25C0, 0x23EB, 0x23EC, 0x27A1,
|
||||
0x2B05, 0x2B06, 0x2B07, 0x2197, 0x2198, 0x2199, 0x2196, 0x2195, 0x2194, 0x21AA,
|
||||
0x21A9, 0x2934, 0x2935, 0x2139, 0x3030, 0x27B0, 0x2714, 0x2795, 0x2796, 0x2797,
|
||||
0x2716, 0x00A9, 0x00AE, 0x2122, 0x2611, 0x26AA, 0x26AB, 0x25AA, 0x25AB, 0x2B1B,
|
||||
0x2B1C, 0x25FC, 0x25FB, 0x25FE, 0x25FD, 0x2660, 0x2663, 0x2665, 0x2666, 0x263A,
|
||||
0x2639, 0x270A, 0x270C, 0x270B, 0x261D, 0x270D, 0x26D1, 0x2764, 0x2763, 0x2615,
|
||||
0x26BD, 0x26BE, 0x26F3, 0x26F7, 0x26F8, 0x26F9, 0x231A, 0x2328, 0x260E, 0x23F1,
|
||||
0x23F2, 0x23F0, 0x23F3, 0x231B, 0x2696, 0x2692, 0x26CF, 0x2699, 0x26D3, 0x2694,
|
||||
0x2620, 0x26B0, 0x26B1, 0x2697, 0x26F1, 0x2709, 0x2702, 0x2712, 0x270F, 0x2708,
|
||||
0x26F5, 0x26F4, 0x2693, 0x26FD, 0x26F2, 0x26F0, 0x26FA, 0x26EA, 0x26E9, 0x2618,
|
||||
0x2B50, 0x2728, 0x2604, 0x2600, 0x26C5, 0x2601, 0x26C8, 0x26A1, 0x2744, 0x2603,
|
||||
0x26C4, 0x2602, 0x2614
|
||||
};
|
||||
|
||||
public static final String[] emojiColored = {
|
||||
"🙌", "👏", "👋", "👍", "👎", "👊", "✊", "✌", "👌", "✋",
|
||||
"👐", "💪", "🙏", "☝", "👆", "👇", "👈", "👉", "🖕", "🖐",
|
||||
"🤘", "🖖", "✍", "💅", "👂", "👃", "👶", "👦", "👧", "👨",
|
||||
"👩", "👱", "👴", "👵", "👲", "👳", "👮", "👷", "💂", "🎅",
|
||||
"👼", "👸", "👰", "🚶", "🏃", "💃", "🙇", "💁", "🙅", "🙆",
|
||||
"🙋", "🙎", "🙍", "💇", "💆", "🚣", "🏊", "🏄", "🛀", "⛹",
|
||||
"🏋", "🚴", "🚵", "🏇",
|
||||
};
|
||||
|
||||
public static final String[][] dataColored = {
|
||||
new String[]{
|
||||
"😀", "😬", "😁", "😂", "😃", "😄", "😅", "😆", "😇", "😉", "😊",
|
||||
"🙂", "🙃", "☺", "😋", "😌", "😍", "😘", "😗", "😙", "😚",
|
||||
"😜", "😝", "😛", "🤑", "🤓", "😎", "🤗", "😏", "😶", "😐",
|
||||
"😑", "😒", "🙄", "🤔", "😳", "😞", "😟", "😠", "😡", "😔",
|
||||
"😕", "🙁", "☹", "😣", "😖", "😫", "😩", "😤", "😮", "😱",
|
||||
"😨", "😰", "😯", "😦", "😧", "😢", "😥", "😪", "😓", "😭",
|
||||
"😵", "😲", "🤐", "😷", "🤒", "🤕", "😴", "💤", "💩", "😈",
|
||||
"👿", "👹", "👺", "💀", "👻", "👽", "🤖", "😺", "😸", "😹",
|
||||
"😻", "😼", "😽", "🙀", "😿", "😾", "🙌",
|
||||
"👏", "👋",
|
||||
"👍",
|
||||
"👎", "👊",
|
||||
"✊", "✌",
|
||||
"👌",
|
||||
"✋", "👐",
|
||||
"💪", "🙏",
|
||||
"☝",
|
||||
"👆", "👇",
|
||||
"👈", "👉",
|
||||
"🖕",
|
||||
"🖐", "🤘",
|
||||
"🖖", "✍",
|
||||
"💅",
|
||||
"👄", "👅", "👂", "👃",
|
||||
"👁", "👀", "👤", "👥", "🗣", "👶",
|
||||
"👦",
|
||||
"👧", "👨",
|
||||
"👩", "👱",
|
||||
"👴",
|
||||
"👵", "👲",
|
||||
"👳", "👮",
|
||||
"👷",
|
||||
"💂", "🕵", "🎅",
|
||||
"👼",
|
||||
"👸", "👰",
|
||||
"🚶", "🏃",
|
||||
"💃",
|
||||
"👯", "👫", "👬", "👭", "🙇",
|
||||
"💁", "🙅",
|
||||
"🙆", "🙋",
|
||||
"🙎",
|
||||
"🙍", "💇",
|
||||
"💆", "💑", "👩❤👩",
|
||||
"👨❤👨", "💏", "👩❤💋👩", "👨❤💋👨", "👪", "👨👩👧", "👨👩👧👦", "👨👩👦👦", "👨👩👧👧", "👩👩👦",
|
||||
"👩👩👧", "👩👩👧👦", "👩👩👦👦", "👩👩👧👧", "👨👨👦", "👨👨👧", "👨👨👧👦", "👨👨👦👦", "👨👨👧👧", "👚",
|
||||
"👕", "👖", "👔", "👗", "👙", "👘", "💄", "💋", "👣", "👠",
|
||||
"👡", "👢", "👞", "👟", "👒", "🎩", "🎓", "👑", "⛑", "🎒",
|
||||
"👝", "👛", "👜", "💼", "👓", "🕶", "💍", "🌂", "❤", "💛",
|
||||
"💚", "💙", "💜", "💔", "❣", "💕", "💞", "💓", "💗", "💖",
|
||||
"💘", "💝",
|
||||
},
|
||||
null,
|
||||
new String[]{
|
||||
"🍏", "🍎", "🍐", "🍊", "🍋", "🍌", "🍉", "🍇", "🍓", "🍈", "🍒",
|
||||
"🍑", "🍍", "🍅", "🍆", "🌶", "🌽", "🍠", "🍯", "🍞", "🧀",
|
||||
"🍗", "🍖", "🍤", "🍳", "🍔", "🍟", "🌭", "🍕", "🍝", "🌮",
|
||||
"🌯", "🍜", "🍲", "🍥", "🍣", "🍱", "🍛", "🍙", "🍚", "🍘",
|
||||
"🍢", "🍡", "🍧", "🍨", "🍦", "🍰", "🎂", "🍮", "🍬", "🍭",
|
||||
"🍫", "🍿", "🍩", "🍪", "🍺", "🍻", "🍷", "🍸", "🍹", "🍾",
|
||||
"🍶", "🍵", "☕", "🍼", "🍴", "🍽", "⚽", "🏀", "🏈", "⚾",
|
||||
"🎾", "🏐", "🏉", "🎱", "⛳", "🏌", "🏓", "🏸", "🏒", "🏑",
|
||||
"🏏", "🎿", "⛷", "🏂", "⛸", "🏹", "🎣", "🚣",
|
||||
"🏊", "🏄",
|
||||
"🛀",
|
||||
"⛹", "🏋",
|
||||
"🚴", "🚵",
|
||||
"🏇",
|
||||
"🕴", "🏆", "🎽", "🏅", "🎖", "🎗", "🏵", "🎫", "🎟",
|
||||
"🎭", "🎨", "🎪", "🎤", "🎧", "🎼", "🎹", "🎷", "🎺", "🎸",
|
||||
"🎻", "🎬", "🎮", "👾", "🎯", "🎲", "🎰", "🎳", "⌚", "📱",
|
||||
"📲", "💻", "⌨", "🖥", "🖨", "🖱", "🖲", "🕹", "🗜", "💽",
|
||||
"💾", "💿", "📀", "📼", "📷", "📸", "📹", "🎥", "📽", "🎞",
|
||||
"📞", "☎", "📟", "🎛", "⏱", "⏲", "⏰", "🕰", "⏳", "⌛",
|
||||
"📡", "🔋", "🔌", "💡", "🔦", "🕯", "🗑", "🛢", "💸", "💵",
|
||||
"💴", "💶", "💷", "💰", "💳", "💎", "⚖", "🔧", "🔨", "⚒",
|
||||
"🛠", "⛏", "🔩", "⚙", "⛓", "🔫", "💣", "🔪", "🗡", "⚔",
|
||||
"🛡", "🚬", "☠", "⚰", "⚱", "🏺", "🔮", "📿", "💈", "⚗",
|
||||
"🔭", "🔬", "🕳", "💊", "💉", "🌡", "🏷", "🔖", "🚽", "🚿",
|
||||
"🛁", "🔑", "🗝", "🛋", "🛌", "🛏", "🚪", "🛎", "🖼", "🗺",
|
||||
"⛱", "🗿", "🛍", "🎈", "🎏", "🎀", "🎁", "🎊", "🎉", "🎎",
|
||||
"🎐", "🎌", "🏮", "✉", "📩", "📨", "📧", "💌", "📮", "📪",
|
||||
"📫", "📬", "📭", "📦", "📯", "📥", "📤", "📜", "📃", "📑",
|
||||
"📊", "📈", "📉", "📄", "📅", "📆", "🗓", "📇", "🗃", "🗳",
|
||||
"🗄", "📋", "🗒", "📁", "📂", "🗂", "🗞", "📰", "📓", "📕",
|
||||
"📗", "📘", "📙", "📔", "📒", "📚", "📖", "🔗", "📎", "🖇",
|
||||
"✂", "📐", "📏", "📌", "📍", "🚩", "🏳", "🏴", "🔐", "🔒",
|
||||
"🔓", "🔏", "🖊", "🖋", "✒", "📝", "✏", "🖍", "🖌", "🔍",
|
||||
"🔎",
|
||||
},
|
||||
null,
|
||||
null
|
||||
};
|
||||
|
||||
public static final String[][] data = {
|
||||
new String[]{
|
||||
"😀", "😬", "😁", "😂", "😃", "😄", "😅", "😆", "😇", "😉", "😊",
|
||||
"🙂", "🙃", "☺", "😋", "😌", "😍", "😘", "😗", "😙", "😚",
|
||||
"😜", "😝", "😛", "🤑", "🤓", "😎", "🤗", "😏", "😶", "😐",
|
||||
"😑", "😒", "🙄", "🤔", "😳", "😞", "😟", "😠", "😡", "😔",
|
||||
"😕", "🙁", "☹", "😣", "😖", "😫", "😩", "😤", "😮", "😱",
|
||||
"😨", "😰", "😯", "😦", "😧", "😢", "😥", "😪", "😓", "😭",
|
||||
"😵", "😲", "🤐", "😷", "🤒", "🤕", "😴", "💤", "💩", "😈",
|
||||
"👿", "👹", "👺", "💀", "👻", "👽", "🤖", "😺", "😸", "😹",
|
||||
"😻", "😼", "😽", "🙀", "😿", "😾", "🙌", "🙌🏻", "🙌🏼", "🙌🏽",
|
||||
"🙌🏾", "🙌🏿", "👏", "👏🏻", "👏🏼", "👏🏽", "👏🏾", "👏🏿", "👋", "👋🏻",
|
||||
"👋🏼", "👋🏽", "👋🏾", "👋🏿", "👍", "👍🏻", "👍🏼", "👍🏽", "👍🏾", "👍🏿",
|
||||
"👎", "👎🏻", "👎🏼", "👎🏽", "👎🏾", "👎🏿", "👊", "👊🏻", "👊🏼", "👊🏽",
|
||||
"👊🏾", "👊🏿", "✊", "✊🏻", "✊🏼", "✊🏽", "✊🏾", "✊🏿", "✌", "✌🏻",
|
||||
"✌🏼", "✌🏽", "✌🏾", "✌🏿", "👌", "👌🏻", "👌🏼", "👌🏽", "👌🏾", "👌🏿",
|
||||
"✋", "✋🏻", "✋🏼", "✋🏽", "✋🏾", "✋🏿", "👐", "👐🏻", "👐🏼", "👐🏽",
|
||||
"👐🏾", "👐🏿", "💪", "💪🏻", "💪🏼", "💪🏽", "💪🏾", "💪🏿", "🙏", "🙏🏻",
|
||||
"🙏🏼", "🙏🏽", "🙏🏾", "🙏🏿", "☝", "☝🏻", "☝🏼", "☝🏽", "☝🏾", "☝🏿",
|
||||
"👆", "👆🏻", "👆🏼", "👆🏽", "👆🏾", "👆🏿", "👇", "👇🏻", "👇🏼", "👇🏽",
|
||||
"👇🏾", "👇🏿", "👈", "👈🏻", "👈🏼", "👈🏽", "👈🏾", "👈🏿", "👉", "👉🏻",
|
||||
"👉🏼", "👉🏽", "👉🏾", "👉🏿", "🖕", "🖕🏻", "🖕🏼", "🖕🏽", "🖕🏾", "🖕🏿",
|
||||
"🖐", "🖐🏻", "🖐🏼", "🖐🏽", "🖐🏾", "🖐🏿", "🤘", "🤘🏻", "🤘🏼", "🤘🏽",
|
||||
"🤘🏾", "🤘🏿", "🖖", "🖖🏻", "🖖🏼", "🖖🏽", "🖖🏾", "🖖🏿", "✍", "✍🏻",
|
||||
"✍🏼", "✍🏽", "✍🏾", "✍🏿", "💅", "💅🏻", "💅🏼", "💅🏽", "💅🏾", "💅🏿",
|
||||
"👄", "👅", "👂", "👂🏻", "👂🏼", "👂🏽", "👂🏾", "👂🏿", "👃", "👃🏻",
|
||||
"👃🏼", "👃🏽", "👃🏾", "👃🏿", "👁", "👀", "👤", "👥", "🗣", "👶",
|
||||
"👶🏻", "👶🏼", "👶🏽", "👶🏾", "👶🏿", "👦", "👦🏻", "👦🏼", "👦🏽", "👦🏾",
|
||||
"👦🏿", "👧", "👧🏻", "👧🏼", "👧🏽", "👧🏾", "👧🏿", "👨", "👨🏻", "👨🏼",
|
||||
"👨🏽", "👨🏾", "👨🏿", "👩", "👩🏻", "👩🏼", "👩🏽", "👩🏾", "👩🏿", "👱",
|
||||
"👱🏻", "👱🏼", "👱🏽", "👱🏾", "👱🏿", "👴", "👴🏻", "👴🏼", "👴🏽", "👴🏾",
|
||||
"👴🏿", "👵", "👵🏻", "👵🏼", "👵🏽", "👵🏾", "👵🏿", "👲", "👲🏻", "👲🏼",
|
||||
"👲🏽", "👲🏾", "👲🏿", "👳", "👳🏻", "👳🏼", "👳🏽", "👳🏾", "👳🏿", "👮",
|
||||
"👮🏻", "👮🏼", "👮🏽", "👮🏾", "👮🏿", "👷", "👷🏻", "👷🏼", "👷🏽", "👷🏾",
|
||||
"👷🏿", "💂", "💂🏻", "💂🏼", "💂🏽", "💂🏾", "💂🏿", "🕵", "🎅", "🎅🏻",
|
||||
"🎅🏼", "🎅🏽", "🎅🏾", "🎅🏿", "👼", "👼🏻", "👼🏼", "👼🏽", "👼🏾", "👼🏿",
|
||||
"👸", "👸🏻", "👸🏼", "👸🏽", "👸🏾", "👸🏿", "👰", "👰🏻", "👰🏼", "👰🏽",
|
||||
"👰🏾", "👰🏿", "🚶", "🚶🏻", "🚶🏼", "🚶🏽", "🚶🏾", "🚶🏿", "🏃", "🏃🏻",
|
||||
"🏃🏼", "🏃🏽", "🏃🏾", "🏃🏿", "💃", "💃🏻", "💃🏼", "💃🏽", "💃🏾", "💃🏿",
|
||||
"👯", "👫", "👬", "👭", "🙇", "🙇🏻", "🙇🏼", "🙇🏽", "🙇🏾", "🙇🏿",
|
||||
"💁", "💁🏻", "💁🏼", "💁🏽", "💁🏾", "💁🏿", "🙅", "🙅🏻", "🙅🏼", "🙅🏽",
|
||||
"🙅🏾", "🙅🏿", "🙆", "🙆🏻", "🙆🏼", "🙆🏽", "🙆🏾", "🙆🏿", "🙋", "🙋🏻",
|
||||
"🙋🏼", "🙋🏽", "🙋🏾", "🙋🏿", "🙎", "🙎🏻", "🙎🏼", "🙎🏽", "🙎🏾", "🙎🏿",
|
||||
"🙍", "🙍🏻", "🙍🏼", "🙍🏽", "🙍🏾", "🙍🏿", "💇", "💇🏻", "💇🏼", "💇🏽",
|
||||
"💇🏾", "💇🏿", "💆", "💆🏻", "💆🏼", "💆🏽", "💆🏾", "💆🏿", "💑", "👩❤👩",
|
||||
"👨❤👨", "💏", "👩❤💋👩", "👨❤💋👨", "👪", "👨👩👧", "👨👩👧👦", "👨👩👦👦", "👨👩👧👧", "👩👩👦",
|
||||
"👩👩👧", "👩👩👧👦", "👩👩👦👦", "👩👩👧👧", "👨👨👦", "👨👨👧", "👨👨👧👦", "👨👨👦👦", "👨👨👧👧", "👚",
|
||||
"👕", "👖", "👔", "👗", "👙", "👘", "💄", "💋", "👣", "👠",
|
||||
"👡", "👢", "👞", "👟", "👒", "🎩", "🎓", "👑", "⛑", "🎒",
|
||||
"👝", "👛", "👜", "💼", "👓", "🕶", "💍", "🌂", "❤", "💛",
|
||||
"💚", "💙", "💜", "💔", "❣", "💕", "💞", "💓", "💗", "💖",
|
||||
"💘", "💝"
|
||||
},
|
||||
new String[]{
|
||||
"🐶", "🐱", "🐭", "🐹", "🐰", "🐻", "🐼", "🐨", "🐯", "🦁", "🐮",
|
||||
"🐷", "🐽", "🐸", "🐙", "🐵", "🙈", "🙉", "🙊", "🐒", "🐔",
|
||||
"🐧", "🐦", "🐤", "🐣", "🐥", "🐺", "🐗", "🐴", "🦄", "🐝",
|
||||
"🐛", "🐌", "🐞", "🐜", "🕷", "🦂", "🦀", "🐍", "🐢", "🐠",
|
||||
"🐟", "🐡", "🐬", "🐳", "🐋", "🐊", "🐆", "🐅", "🐃", "🐂",
|
||||
"🐄", "🐪", "🐫", "🐘", "🐐", "🐏", "🐑", "🐎", "🐖", "🐀",
|
||||
"🐁", "🐓", "🦃", "🕊", "🐕", "🐩", "🐈", "🐇", "🐿", "🐾",
|
||||
"🐉", "🐲", "🌵", "🎄", "🌲", "🌳", "🌴", "🌱", "🌿", "☘",
|
||||
"🍀", "🎍", "🎋", "🍃", "🍂", "🍁", "🌾", "🌺", "🌻", "🌹",
|
||||
"🌷", "🌼", "🌸", "💐", "🍄", "🌰", "🎃", "🐚", "🕸", "🌎",
|
||||
"🌍", "🌏", "🌕", "🌖", "🌗", "🌘", "🌑", "🌒", "🌓", "🌔",
|
||||
"🌚", "🌝", "🌛", "🌜", "🌞", "🌙", "⭐", "🌟", "💫", "✨",
|
||||
"☄", "☀", "🌤", "⛅", "🌥", "🌦", "☁", "🌧", "⛈", "🌩",
|
||||
"⚡", "🔥", "💥", "❄", "🌨", "☃", "⛄", "🌬", "💨", "🌪",
|
||||
"🌫", "☂", "☔", "💧", "💦", "🌊"
|
||||
},
|
||||
new String[]{
|
||||
"🍏", "🍎", "🍐", "🍊", "🍋", "🍌", "🍉", "🍇", "🍓", "🍈", "🍒",
|
||||
"🍑", "🍍", "🍅", "🍆", "🌶", "🌽", "🍠", "🍯", "🍞", "🧀",
|
||||
"🍗", "🍖", "🍤", "🍳", "🍔", "🍟", "🌭", "🍕", "🍝", "🌮",
|
||||
"🌯", "🍜", "🍲", "🍥", "🍣", "🍱", "🍛", "🍙", "🍚", "🍘",
|
||||
"🍢", "🍡", "🍧", "🍨", "🍦", "🍰", "🎂", "🍮", "🍬", "🍭",
|
||||
"🍫", "🍿", "🍩", "🍪", "🍺", "🍻", "🍷", "🍸", "🍹", "🍾",
|
||||
"🍶", "🍵", "☕", "🍼", "🍴", "🍽", "⚽", "🏀", "🏈", "⚾",
|
||||
"🎾", "🏐", "🏉", "🎱", "⛳", "🏌", "🏓", "🏸", "🏒", "🏑",
|
||||
"🏏", "🎿", "⛷", "🏂", "⛸", "🏹", "🎣", "🚣", "🚣🏻", "🚣🏼",
|
||||
"🚣🏽", "🚣🏾", "🚣🏿", "🏊", "🏊🏻", "🏊🏼", "🏊🏽", "🏊🏾", "🏊🏿", "🏄",
|
||||
"🏄🏻", "🏄🏼", "🏄🏽", "🏄🏾", "🏄🏿", "🛀", "🛀🏻", "🛀🏼", "🛀🏽", "🛀🏾",
|
||||
"🛀🏿", "⛹", "⛹🏻", "⛹🏼", "⛹🏽", "⛹🏾", "⛹🏿", "🏋", "🏋🏻", "🏋🏼",
|
||||
"🏋🏽", "🏋🏾", "🏋🏿", "🚴", "🚴🏻", "🚴🏼", "🚴🏽", "🚴🏾", "🚴🏿", "🚵",
|
||||
"🚵🏻", "🚵🏼", "🚵🏽", "🚵🏾", "🚵🏿", "🏇", "🏇🏻", "🏇🏼", "🏇🏽", "🏇🏾",
|
||||
"🏇🏿", "🕴", "🏆", "🎽", "🏅", "🎖", "🎗", "🏵", "🎫", "🎟",
|
||||
"🎭", "🎨", "🎪", "🎤", "🎧", "🎼", "🎹", "🎷", "🎺", "🎸",
|
||||
"🎻", "🎬", "🎮", "👾", "🎯", "🎲", "🎰", "🎳", "⌚", "📱",
|
||||
"📲", "💻", "⌨", "🖥", "🖨", "🖱", "🖲", "🕹", "🗜", "💽",
|
||||
"💾", "💿", "📀", "📼", "📷", "📸", "📹", "🎥", "📽", "🎞",
|
||||
"📞", "☎", "📟", "🎛", "⏱", "⏲", "⏰", "🕰", "⏳", "⌛",
|
||||
"📡", "🔋", "🔌", "💡", "🔦", "🕯", "🗑", "🛢", "💸", "💵",
|
||||
"💴", "💶", "💷", "💰", "💳", "💎", "⚖", "🔧", "🔨", "⚒",
|
||||
"🛠", "⛏", "🔩", "⚙", "⛓", "🔫", "💣", "🔪", "🗡", "⚔",
|
||||
"🛡", "🚬", "☠", "⚰", "⚱", "🏺", "🔮", "📿", "💈", "⚗",
|
||||
"🔭", "🔬", "🕳", "💊", "💉", "🌡", "🏷", "🔖", "🚽", "🚿",
|
||||
"🛁", "🔑", "🗝", "🛋", "🛌", "🛏", "🚪", "🛎", "🖼", "🗺",
|
||||
"⛱", "🗿", "🛍", "🎈", "🎏", "🎀", "🎁", "🎊", "🎉", "🎎",
|
||||
"🎐", "🎌", "🏮", "✉", "📩", "📨", "📧", "💌", "📮", "📪",
|
||||
"📫", "📬", "📭", "📦", "📯", "📥", "📤", "📜", "📃", "📑",
|
||||
"📊", "📈", "📉", "📄", "📅", "📆", "🗓", "📇", "🗃", "🗳",
|
||||
"🗄", "📋", "🗒", "📁", "📂", "🗂", "🗞", "📰", "📓", "📕",
|
||||
"📗", "📘", "📙", "📔", "📒", "📚", "📖", "🔗", "📎", "🖇",
|
||||
"✂", "📐", "📏", "📌", "📍", "🚩", "🏳", "🏴", "🔐", "🔒",
|
||||
"🔓", "🔏", "🖊", "🖋", "✒", "📝", "✏", "🖍", "🖌", "🔍",
|
||||
"🔎"
|
||||
},
|
||||
new String[]{
|
||||
"🚗", "🚕", "🚙", "🚌", "🚎", "🏎", "🚓", "🚑", "🚒", "🚐", "🚚",
|
||||
"🚛", "🚜", "🏍", "🚲", "🚨", "🚔", "🚍", "🚘", "🚖", "🚡",
|
||||
"🚠", "🚟", "🚃", "🚋", "🚝", "🚄", "🚅", "🚈", "🚞", "🚂",
|
||||
"🚆", "🚇", "🚊", "🚉", "🚁", "🛩", "✈", "🛫", "🛬", "⛵",
|
||||
"🛥", "🚤", "⛴", "🛳", "🚀", "🛰", "💺", "⚓", "🚧", "⛽",
|
||||
"🚏", "🚦", "🚥", "🏁", "🚢", "🎡", "🎢", "🎠", "🏗", "🌁",
|
||||
"🗼", "🏭", "⛲", "🎑", "⛰", "🏔", "🗻", "🌋", "🗾", "🏕",
|
||||
"⛺", "🏞", "🛣", "🛤", "🌅", "🌄", "🏜", "🏖", "🏝", "🌇",
|
||||
"🌆", "🏙", "🌃", "🌉", "🌌", "🌠", "🎇", "🎆", "🌈", "🏘",
|
||||
"🏰", "🏯", "🏟", "🗽", "🏠", "🏡", "🏚", "🏢", "🏬", "🏣",
|
||||
"🏤", "🏥", "🏦", "🏨", "🏪", "🏫", "🏩", "💒", "🏛", "⛪",
|
||||
"🕌", "🕍", "🕋", "⛩", "🇦🇺", "🇦🇹", "🇦🇿", "🇦🇽", "🇦🇱", "🇩🇿",
|
||||
"🇦🇸", "🇦🇮", "🇦🇴", "🇦🇩", "🇦🇶", "🇦🇬", "🇦🇷", "🇦🇲", "🇦🇼", "🇦🇫",
|
||||
"🇧🇸", "🇧🇩", "🇧🇧", "🇧🇭", "🇧🇾", "🇧🇿", "🇧🇪", "🇧🇯", "🇧🇲", "🇧🇬",
|
||||
"🇧🇴", "🇧🇶", "🇧🇦", "🇧🇼", "🇧🇷", "🇮🇴", "🇧🇳", "🇧🇫", "🇧🇮", "🇧🇹",
|
||||
"🇻🇺", "🇻🇦", "🇬🇧", "🇭🇺", "🇻🇪", "🇻🇬", "🇻🇮", "🇹🇱", "🇻🇳", "🇬🇦",
|
||||
"🇭🇹", "🇬🇾", "🇬🇲", "🇬🇭", "🇬🇵", "🇬🇹", "🇬🇳", "🇬🇼", "🇩🇪", "🇬🇬",
|
||||
"🇬🇮", "🇭🇳", "🇭🇰", "🇬🇩", "🇬🇱", "🇬🇷", "🇬🇪", "🇬🇺", "🇩🇰", "🇯🇪",
|
||||
"🇩🇯", "🇩🇲", "🇩🇴", "🇪🇺", "🇪🇬", "🇿🇲", "🇪🇭", "🇿🇼", "🇮🇱", "🇮🇳",
|
||||
"🇮🇩", "🇯🇴", "🇮🇶", "🇮🇷", "🇮🇪", "🇮🇸", "🇪🇸", "🇮🇹", "🇾🇪", "🇨🇻",
|
||||
"🇰🇿", "🇰🇾", "🇰🇭", "🇨🇲", "🇨🇦", "🇮🇨", "🇶🇦", "🇰🇪", "🇨🇾", "🇰🇬",
|
||||
"🇰🇮", "🇨🇳", "🇰🇵", "🇨🇨", "🇨🇴", "🇰🇲", "🇨🇬", "🇨🇩", "🇽🇰", "🇨🇷",
|
||||
"🇨🇮", "🇨🇺", "🇰🇼", "🇨🇼", "🇱🇦", "🇱🇻", "🇱🇸", "🇱🇷", "🇱🇧", "🇱🇾",
|
||||
"🇱🇹", "🇱🇮", "🇱🇺", "🇲🇺", "🇲🇷", "🇲🇬", "🇾🇹", "🇲🇴", "🇲🇰", "🇲🇼",
|
||||
"🇲🇾", "🇲🇱", "🇲🇻", "🇲🇹", "🇲🇦", "🇲🇶", "🇲🇭", "🇲🇽", "🇫🇲", "🇲🇿",
|
||||
"🇲🇩", "🇲🇨", "🇲🇳", "🇲🇸", "🇲🇲", "🇳🇦", "🇳🇷", "🇳🇵", "🇳🇪", "🇳🇬",
|
||||
"🇳🇱", "🇳🇮", "🇳🇺", "🇳🇿", "🇳🇨", "🇳🇴", "🇮🇲", "🇳🇫", "🇨🇽", "🇸🇭",
|
||||
"🇨🇰", "🇹🇨", "🇦🇪", "🇴🇲", "🇵🇰", "🇵🇼", "🇵🇸", "🇵🇦", "🇵🇬", "🇵🇾",
|
||||
"🇵🇪", "🇵🇳", "🇵🇱", "🇵🇹", "🇵🇷", "🇰🇷", "🇷🇪", "🇷🇺", "🇷🇼", "🇷🇴",
|
||||
"🇸🇻", "🇼🇸", "🇸🇲", "🇸🇹", "🇸🇦", "🇸🇿", "🇲🇵", "🇸🇨", "🇧🇱", "🇵🇲",
|
||||
"🇸🇳", "🇻🇨", "🇰🇳", "🇱🇨", "🇷🇸", "🇸🇬", "🇸🇽", "🇸🇾", "🇸🇰", "🇸🇮",
|
||||
"🇺🇸", "🇸🇧", "🇸🇴", "🇸🇩", "🇸🇷", "🇸🇱", "🇹🇯", "🇹🇭", "🇹🇼", "🇹🇿",
|
||||
"🇹🇬", "🇹🇰", "🇹🇴", "🇹🇹", "🇹🇻", "🇹🇳", "🇹🇲", "🇹🇷", "🇺🇬", "🇺🇿",
|
||||
"🇺🇦", "🇼🇫", "🇺🇾", "🇫🇴", "🇫🇯", "🇵🇭", "🇫🇮", "🇫🇰", "🇫🇷", "🇬🇫",
|
||||
"🇵🇫", "🇹🇫", "🇭🇷", "🇨🇫", "🇹🇩", "🇲🇪", "🇨🇿", "🇨🇱", "🇨🇭", "🇸🇪",
|
||||
"🇱🇰", "🇪🇨", "🇬🇶", "🇪🇷", "🇪🇪", "🇪🇹", "🇿🇦", "🇬🇸", "🇸🇸", "🇯🇲",
|
||||
"🇯🇵"
|
||||
},
|
||||
new String[]{
|
||||
"💟", "☮", "✝", "☪", "🕉", "☸", "✡", "🔯", "🕎", "☯", "☦",
|
||||
"🛐", "⛎", "♈", "♉", "♊", "♋", "♌", "♍", "♎", "♏",
|
||||
"♐", "♑", "♒", "♓", "🆔", "⚛", "🈳", "🈹", "☢", "☣",
|
||||
"📴", "📳", "🈶", "🈚", "🈸", "🈺", "🈷", "✴", "🆚", "🉑",
|
||||
"💮", "🉐", "㊙", "㊗", "🈴", "🈵", "🈲", "🅰", "🅱", "🆎",
|
||||
"🆑", "🅾", "🆘", "⛔", "📛", "🚫", "❌", "⭕", "💢", "♨",
|
||||
"🚷", "🚯", "🚳", "🚱", "🔞", "📵", "❗", "❕", "❓", "❔",
|
||||
"‼", "⁉", "💯", "🔅", "🔆", "🔱", "⚜", "〽", "⚠", "🚸",
|
||||
"🔰", "♻", "🈯", "💹", "❇", "✳", "❎", "✅", "💠", "🌀",
|
||||
"➿", "🌐", "Ⓜ", "🏧", "🈂", "🛂", "🛃", "🛄", "🛅", "♿",
|
||||
"🚭", "🚾", "🅿", "🚰", "🚹", "🚺", "🚼", "🚻", "🚮", "🎦",
|
||||
"📶", "🈁", "🆖", "🆗", "🆙", "🆒", "🆕", "🆓", "0⃣", "1⃣",
|
||||
"2⃣", "3⃣", "4⃣", "5⃣", "6⃣", "7⃣", "8⃣", "9⃣", "🔟", "🔢",
|
||||
"▶", "⏸", "⏯", "⏹", "⏺", "⏭", "⏮", "⏩", "⏪", "🔀",
|
||||
"🔁", "🔂", "◀", "🔼", "🔽", "⏫", "⏬", "➡", "⬅", "⬆",
|
||||
"⬇", "↗", "↘", "↙", "↖", "↕", "↔", "🔄", "↪", "↩",
|
||||
"⤴", "⤵", "#⃣", "*⃣", "ℹ", "🔤", "🔡", "🔠", "🔣", "🎵",
|
||||
"🎶", "〰", "➰", "✔", "🔃", "➕", "➖", "➗", "✖", "💲",
|
||||
"💱", "©", "®", "™", "🔚", "🔙", "🔛", "🔝", "🔜", "☑",
|
||||
"🔘", "⚪", "⚫", "🔴", "🔵", "🔸", "🔹", "🔶", "🔷", "🔺",
|
||||
"▪", "▫", "⬛", "⬜", "🔻", "◼", "◻", "◾", "◽", "🔲",
|
||||
"🔳", "🔈", "🔉", "🔊", "🔇", "📣", "📢", "🔔", "🔕", "🃏",
|
||||
"🀄", "♠", "♣", "♥", "♦", "🎴", "👁🗨", "💭", "🗯", "💬",
|
||||
"🕐", "🕑", "🕒", "🕓", "🕔", "🕕", "🕖", "🕗", "🕘", "🕙",
|
||||
"🕚", "🕛", "🕜", "🕝", "🕞", "🕟", "🕠", "🕡", "🕢", "🕣",
|
||||
"🕤", "🕥", "🕦", "🕧"
|
||||
}
|
||||
};
|
||||
|
||||
public static final HashMap<Character, Boolean> emojiToFE0FMap = new HashMap<>(emojiToFE0F.length);
|
||||
public static final HashMap<Character, Boolean> dataCharsMap = new HashMap<>(dataChars.length);
|
||||
public static final HashMap<String, Boolean> emojiColoredMap = new HashMap<>(emojiColored.length);
|
||||
|
||||
static {
|
||||
for (int a = 0; a < emojiToFE0F.length; a++) {
|
||||
emojiToFE0FMap.put(emojiToFE0F[a], true);
|
||||
}
|
||||
for (int a = 0; a < dataChars.length; a++) {
|
||||
dataCharsMap.put(dataChars[a], true);
|
||||
}
|
||||
for (int a = 0; a < emojiColored.length; a++) {
|
||||
//Disable colored emoji.
|
||||
//emojiColoredMap.put(emojiColored[a], true);
|
||||
}
|
||||
dataColored[1] = data[1];
|
||||
dataColored[3] = data[3];
|
||||
dataColored[4] = data[4];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,629 @@
|
||||
/*******************************************************************************
|
||||
*
|
||||
* Delta Chat Android
|
||||
* (C) 2017 Björn Petersen
|
||||
* Contact: r10s@b44t.com, http://b44t.com
|
||||
*
|
||||
* This program 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.
|
||||
*
|
||||
* This program 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
|
||||
* this program. If not, see http://www.gnu.org/licenses/ .
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
package com.b44t.messenger;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.database.DataSetObserver;
|
||||
import android.graphics.Color;
|
||||
import android.support.v4.view.PagerAdapter;
|
||||
import android.support.v4.view.ViewPager;
|
||||
import android.text.Spannable;
|
||||
import android.view.Gravity;
|
||||
import android.view.HapticFeedbackConstants;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.BaseAdapter;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.GridView;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.b44t.messenger.Components.LayoutHelper;
|
||||
import com.b44t.messenger.Components.PagerSlidingTabStrip;
|
||||
|
||||
import com.amulyakhare.textdrawable.TextDrawable;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
|
||||
public class EmojiInputView extends FrameLayout {
|
||||
|
||||
public interface Listener {
|
||||
boolean onBackspace();
|
||||
void onEmojiSelected(String emoji);
|
||||
void onClearEmojiRecent();
|
||||
}
|
||||
|
||||
private static final String[][] predefinedEmojis = {
|
||||
new String[]{
|
||||
"😀", "😬", "😁", "😂", "😃", "😄", "😅", "😆", "😇", "😉", "😊", "🙂", "🙃", "☺", "😋",
|
||||
"😌", "😍", "😘", "😗", "😙", "😚", "😜", "😝", "😛", "🤑", "🤓", "😎", "🤗", "😏", "😶",
|
||||
"😐", "😑", "😒", "🙄", "🤔", "😳", "😞", "😟", "😠", "😡", "😔", "😕", "🙁", "☹", "😣",
|
||||
"😖", "😫", "😩", "😤", "😮", "😱", "😨", "😰", "😯", "😦", "😧", "😢", "😥", "😪", "😓",
|
||||
"😭", "😵", "😲", "🤐", "😷", "🤒", "🤕", "😴", "💤", "💩", "😈", "👿", "👹", "👺", "💀",
|
||||
"👻", "👽", "🤖", "😺", "😸", "😹", "😻", "😼", "😽", "🙀", "😿", "😾", "🙌", "👏", "👋",
|
||||
"👍", "👎", "👊", "✊", "✌", "👌", "✋", "👐", "💪", "🙏", "☝", "👆", "👇", "👈", "👉", "🖕", "🖐",
|
||||
"🤘", "🖖", "✍", "💅", "👄", "👅", "👂", "👃", "👁", "👀", "👤", "👥", "🗣", "👶", "👦", "👧",
|
||||
"👨", "👩", "👱", "👴", "👵", "👲", "👳", "👮", "👷", "💂", "🕵", "🎅", "👼", "👸", "👰", "🚶",
|
||||
"🏃", "💃", "👯", "👫", "👬", "👭", "🙇", "💁", "🙅", "🙆", "🙋", "🙎", "🙍", "💇", "💆", "💑",
|
||||
"👩❤👩", "👨❤👨", "💏", "👩❤💋👩", "👨❤💋👨", "👪", "👨👩👧", "👨👩👧👦", "👨👩👦👦", "👨👩👧👧",
|
||||
"👩👩👦", "👩👩👧", "👩👩👧👦", "👩👩👦👦", "👩👩👧👧", "👨👨👦", "👨👨👧", "👨👨👧👦", "👨👨👦👦",
|
||||
"👨👨👧👧", "👚", "👕", "👖", "👔", "👗", "👙", "👘", "💄", "💋", "👣", "👠", "👡", "👢", "👞",
|
||||
"👟", "👒", "🎩", "🎓", "👑", "⛑", "🎒", "👝", "👛", "👜", "💼", "👓", "🕶", "💍", "🌂", "❤",
|
||||
"💛", "💚", "💙", "💜", "💔", "❣", "💕", "💞", "💓", "💗", "💖", "💘", "💝",
|
||||
},
|
||||
new String[]{
|
||||
"🐶", "🐱", "🐭", "🐹", "🐰", "🐻", "🐼", "🐨", "🐯", "🦁", "🐮", "🐷", "🐽", "🐸", "🐙",
|
||||
"🐵", "🙈", "🙉", "🙊", "🐒", "🐔", "🐧", "🐦", "🐤", "🐣", "🐥", "🐺", "🐗", "🐴", "🦄", "🐝",
|
||||
"🐛", "🐌", "🐞", "🐜", "🕷", "🦂", "🦀", "🐍", "🐢", "🐠", "🐟", "🐡", "🐬", "🐳", "🐋",
|
||||
"🐊", "🐆", "🐅", "🐃", "🐂", "🐄", "🐪", "🐫", "🐘", "🐐", "🐏", "🐑", "🐎", "🐖", "🐀",
|
||||
"🐁", "🐓", "🦃", "🕊", "🐕", "🐩", "🐈", "🐇", "🐿", "🐾", "🐉", "🐲", "🌵", "🎄", "🌲", "🌳",
|
||||
"🌴", "🌱", "🌿", "☘", "🍀", "🎍", "🎋", "🍃", "🍂", "🍁", "🌾", "🌺", "🌻", "🌹", "🌷", "🌼",
|
||||
"🌸", "💐", "🍄", "🌰", "🎃", "🐚", "🕸", "🌎", "🌍", "🌏", "🌕", "🌖", "🌗", "🌘", "🌑", "🌒",
|
||||
"🌓", "🌔", "🌚", "🌝", "🌛", "🌜", "🌞", "🌙", "⭐", "🌟", "💫", "✨", "☄", "☀", "🌤", "⛅",
|
||||
"🌥", "🌦", "☁", "🌧", "⛈", "🌩", "⚡", "🔥", "💥", "❄", "🌨", "☃", "⛄", "🌬", "💨", "🌪",
|
||||
"🌫", "☂", "☔", "💧", "💦", "🌊"
|
||||
},
|
||||
new String[]{
|
||||
"🍏", "🍎", "🍐", "🍊", "🍋", "🍌", "🍉", "🍇", "🍓", "🍈", "🍒", "🍑", "🍍", "🍅", "🍆", "🌶",
|
||||
"🌽", "🍠", "🍯", "🍞", "🧀", "🍗", "🍖", "🍤", "🍳", "🍔", "🍟", "🌭", "🍕", "🍝", "🌮", "🌯",
|
||||
"🍜", "🍲", "🍥", "🍣", "🍱", "🍛", "🍙", "🍚", "🍘", "🍢", "🍡", "🍧", "🍨", "🍦", "🍰", "🎂",
|
||||
"🍮", "🍬", "🍭", "🍫", "🍿", "🍩", "🍪", "🍺", "🍻", "🍷", "🍸", "🍹", "🍾", "🍶", "🍵", "☕",
|
||||
"🍼", "🍴", "🍽", "⚽", "🏀", "🏈", "⚾", "🎾", "🏐", "🏉", "🎱", "⛳", "🏌", "🏓", "🏸", "🏒",
|
||||
"🏑", "🏏", "🎿", "⛷", "🏂", "⛸", "🏹", "🎣", "🚣", "🏊", "🏄", "🛀", "⛹", "🏋", "🚴", "🚵",
|
||||
"🏇", "🕴", "🏆", "🎽", "🏅", "🎖", "🎗", "🏵", "🎫", "🎟", "🎭", "🎨", "🎪", "🎤", "🎧", "🎼",
|
||||
"🎹", "🎷", "🎺", "🎸", "🎻", "🎬", "🎮", "👾", "🎯", "🎲", "🎰", "🎳", "⌚", "📱", "📲", "💻",
|
||||
"⌨", "🖥", "🖨", "🖱", "🖲", "🕹", "🗜", "💽", "💾", "💿", "📀", "📼", "📷", "📸", "📹", "🎥",
|
||||
"📽", "🎞", "📞", "☎", "📟", "🎛", "⏱", "⏲", "⏰", "🕰", "⏳", "⌛", "📡", "🔋", "🔌", "💡",
|
||||
"🔦", "🕯", "🗑", "🛢", "💸", "💵", "💴", "💶", "💷", "💰", "💳", "💎", "⚖", "🔧", "🔨", "⚒",
|
||||
"🛠", "⛏", "🔩", "⚙", "⛓", "🔫", "💣", "🔪", "🗡", "⚔", "🛡", "🚬", "☠", "⚰", "⚱", "🏺",
|
||||
"🔮", "📿", "💈", "⚗", "🔭", "🔬", "🕳", "💊", "💉", "🌡", "🏷", "🔖", "🚽", "🚿", "🛁", "🔑",
|
||||
"🗝", "🛋", "🛌", "🛏", "🚪", "🛎", "🖼", "🗺", "⛱", "🗿", "🛍", "🎈", "🎏", "🎀", "🎁",
|
||||
"🎊", "🎉", "🎎", "🎐", "🎌", "🏮", "✉", "📩", "📨", "📧", "💌", "📮", "📪", "📫", "📬", "📭",
|
||||
"📦", "📯", "📥", "📤", "📜", "📃", "📑", "📊", "📈", "📉", "📄", "📅", "📆", "🗓", "📇", "🗃",
|
||||
"🗳", "🗄", "📋", "🗒", "📁", "📂", "🗂", "🗞", "📰", "📓", "📕", "📗", "📘", "📙", "📔", "📒",
|
||||
"📚", "📖", "🔗", "📎", "🖇", "✂", "📐", "📏", "📌", "📍", "🚩", "🏳", "🏴", "🔐", "🔒", "🔓",
|
||||
"🔏", "🖊", "🖋", "✒", "📝", "✏", "🖍", "🖌", "🔍", "🔎",
|
||||
},
|
||||
new String[]{
|
||||
"🚗", "🚕", "🚙", "🚌", "🚎", "🏎", "🚓", "🚑", "🚒", "🚐", "🚚", "🚛", "🚜", "🏍", "🚲",
|
||||
"🚨", "🚔", "🚍", "🚘", "🚖", "🚡", "🚠", "🚟", "🚃", "🚋", "🚝", "🚄", "🚅", "🚈", "🚞", "🚂",
|
||||
"🚆", "🚇", "🚊", "🚉", "🚁", "🛩", "✈", "🛫", "🛬", "⛵", "🛥", "🚤", "⛴", "🛳", "🚀", "🛰",
|
||||
"💺", "⚓", "🚧", "⛽", "🚏", "🚦", "🚥", "🏁", "🚢", "🎡", "🎢", "🎠", "🏗", "🌁", "🗼", "🏭",
|
||||
"⛲", "🎑", "⛰", "🏔", "🗻", "🌋", "🗾", "🏕", "⛺", "🏞", "🛣", "🛤", "🌅", "🌄", "🏜",
|
||||
"🏖", "🏝", "🌇", "🌆", "🏙", "🌃", "🌉", "🌌", "🌠", "🎇", "🎆", "🌈", "🏘", "🏰", "🏯", "🏟",
|
||||
"🗽", "🏠", "🏡", "🏚", "🏢", "🏬", "🏣", "🏤", "🏥", "🏦", "🏨", "🏪", "🏫", "🏩", "💒", "🏛",
|
||||
"⛪", "🕌", "🕍", "🕋", "⛩", "🇦🇺", "🇦🇹", "🇦🇿", "🇦🇽", "🇦🇱", "🇩🇿", "🇦🇸", "🇦🇮",
|
||||
"🇦🇴", "🇦🇩", "🇦🇶", "🇦🇬", "🇦🇷", "🇦🇲", "🇦🇼", "🇦🇫", "🇧🇸", "🇧🇩", "🇧🇧", "🇧🇭",
|
||||
"🇧🇾", "🇧🇿", "🇧🇪", "🇧🇯", "🇧🇲", "🇧🇬", "🇧🇴", "🇧🇶", "🇧🇦", "🇧🇼", "🇧🇷", "🇮🇴",
|
||||
"🇧🇳", "🇧🇫", "🇧🇮", "🇧🇹", "🇻🇺", "🇻🇦", "🇬🇧", "🇭🇺", "🇻🇪", "🇻🇬", "🇻🇮", "🇹🇱",
|
||||
"🇻🇳", "🇬🇦", "🇭🇹", "🇬🇾", "🇬🇲", "🇬🇭", "🇬🇵", "🇬🇹", "🇬🇳", "🇬🇼", "🇩🇪", "🇬🇬",
|
||||
"🇬🇮", "🇭🇳", "🇭🇰", "🇬🇩", "🇬🇱", "🇬🇷", "🇬🇪", "🇬🇺", "🇩🇰", "🇯🇪", "🇩🇯", "🇩🇲",
|
||||
"🇩🇴", "🇪🇺", "🇪🇬", "🇿🇲", "🇪🇭", "🇿🇼", "🇮🇱", "🇮🇳", "🇮🇩", "🇯🇴", "🇮🇶", "🇮🇷",
|
||||
"🇮🇪", "🇮🇸", "🇪🇸", "🇮🇹", "🇾🇪", "🇨🇻", "🇰🇿", "🇰🇾", "🇰🇭", "🇨🇲", "🇨🇦", "🇮🇨",
|
||||
"🇶🇦", "🇰🇪", "🇨🇾", "🇰🇬", "🇰🇮", "🇨🇳", "🇰🇵", "🇨🇨", "🇨🇴", "🇰🇲", "🇨🇬", "🇨🇩",
|
||||
"🇽🇰", "🇨🇷", "🇨🇮", "🇨🇺", "🇰🇼", "🇨🇼", "🇱🇦", "🇱🇻", "🇱🇸", "🇱🇷", "🇱🇧", "🇱🇾",
|
||||
"🇱🇹", "🇱🇮", "🇱🇺", "🇲🇺", "🇲🇷", "🇲🇬", "🇾🇹", "🇲🇴", "🇲🇰", "🇲🇼", "🇲🇾", "🇲🇱",
|
||||
"🇲🇻", "🇲🇹", "🇲🇦", "🇲🇶", "🇲🇭", "🇲🇽", "🇫🇲", "🇲🇿", "🇲🇩", "🇲🇨", "🇲🇳", "🇲🇸",
|
||||
"🇲🇲", "🇳🇦", "🇳🇷", "🇳🇵", "🇳🇪", "🇳🇬", "🇳🇱", "🇳🇮", "🇳🇺", "🇳🇿", "🇳🇨", "🇳🇴",
|
||||
"🇮🇲", "🇳🇫", "🇨🇽", "🇸🇭", "🇨🇰", "🇹🇨", "🇦🇪", "🇴🇲", "🇵🇰", "🇵🇼", "🇵🇸", "🇵🇦",
|
||||
"🇵🇬", "🇵🇾", "🇵🇪", "🇵🇳", "🇵🇱", "🇵🇹", "🇵🇷", "🇰🇷", "🇷🇪", "🇷🇺", "🇷🇼", "🇷🇴",
|
||||
"🇸🇻", "🇼🇸", "🇸🇲", "🇸🇹", "🇸🇦", "🇸🇿", "🇲🇵", "🇸🇨", "🇧🇱", "🇵🇲", "🇸🇳", "🇻🇨",
|
||||
"🇰🇳", "🇱🇨", "🇷🇸", "🇸🇬", "🇸🇽", "🇸🇾", "🇸🇰", "🇸🇮", "🇺🇸", "🇸🇧", "🇸🇴", "🇸🇩",
|
||||
"🇸🇷", "🇸🇱", "🇹🇯", "🇹🇭", "🇹🇼", "🇹🇿", "🇹🇬", "🇹🇰", "🇹🇴", "🇹🇹", "🇹🇻", "🇹🇳",
|
||||
"🇹🇲", "🇹🇷", "🇺🇬", "🇺🇿", "🇺🇦", "🇼🇫", "🇺🇾", "🇫🇴", "🇫🇯", "🇵🇭", "🇫🇮", "🇫🇰",
|
||||
"🇫🇷", "🇬🇫", "🇵🇫", "🇹🇫", "🇭🇷", "🇨🇫", "🇹🇩", "🇲🇪", "🇨🇿", "🇨🇱", "🇨🇭", "🇸🇪",
|
||||
"🇱🇰", "🇪🇨", "🇬🇶", "🇪🇷", "🇪🇪", "🇪🇹", "🇿🇦", "🇬🇸", "🇸🇸", "🇯🇲", "🇯🇵"
|
||||
},
|
||||
new String[]{
|
||||
"💟", "☮", "✝", "☪", "🕉", "☸", "✡", "🔯", "🕎", "☯", "☦", "🛐", "⛎", "♈", "♉", "♊", "♋",
|
||||
"♌", "♍", "♎", "♏", "♐", "♑", "♒", "♓", "🆔", "⚛", "🈳", "🈹", "☢", "☣", "📴", "📳", "🈶",
|
||||
"🈚", "🈸", "🈺", "🈷", "✴", "🆚", "🉑", "💮", "🉐", "㊙", "㊗", "🈴", "🈵", "🈲", "🅰", "🅱",
|
||||
"🆎", "🆑", "🅾", "🆘", "⛔", "📛", "🚫", "❌", "⭕", "💢", "♨", "🚷", "🚯", "🚳", "🚱", "🔞",
|
||||
"📵", "❗", "❕", "❓", "❔", "‼", "⁉", "💯", "🔅", "🔆", "🔱", "⚜", "〽", "⚠", "🚸", "🔰", "♻",
|
||||
"🈯", "💹", "❇", "✳", "❎", "✅", "💠", "🌀", "➿", "🌐", "Ⓜ", "🏧", "🈂", "🛂", "🛃", "🛄",
|
||||
"🛅", "♿", "🚭", "🚾", "🅿", "🚰", "🚹", "🚺", "🚼", "🚻", "🚮", "🎦", "📶", "🈁", "🆖", "🆗",
|
||||
"🆙", "🆒", "🆕", "🆓", "0⃣", "1⃣", "2⃣", "3⃣", "4⃣", "5⃣", "6⃣", "7⃣", "8⃣", "9⃣", "🔟", "🔢", "▶",
|
||||
"⏸", "⏯", "⏹", "⏺", "⏭", "⏮", "⏩", "⏪", "🔀", "🔁", "🔂", "◀", "🔼", "🔽", "⏫", "⏬", "➡",
|
||||
"⬅", "⬆", "⬇", "↗", "↘", "↙", "↖", "↕", "↔", "🔄", "↪", "↩", "⤴", "⤵", "#⃣", "*⃣", "ℹ",
|
||||
"🔤", "🔡", "🔠", "🔣", "🎵", "🎶", "〰", "➰", "✔", "🔃", "➕", "➖", "➗", "✖", "💲", "💱",
|
||||
"©", "®", "™", "🔚", "🔙", "🔛", "🔝", "🔜", "☑", "🔘", "⚪", "⚫", "🔴", "🔵", "🔸", "🔹",
|
||||
"🔶", "🔷", "🔺", "▪", "▫", "⬛", "⬜", "🔻", "◼", "◻", "◾", "◽", "🔲", "🔳", "🔈", "🔉", "🔊",
|
||||
"🔇", "📣", "📢", "🔔", "🔕", "🃏", "🀄", "♠", "♣", "♥", "♦", "🎴", "👁🗨", "💭", "🗯", "💬",
|
||||
"🕐", "🕑", "🕒", "🕓", "🕔", "🕕", "🕖", "🕗", "🕘", "🕙", "🕚", "🕛", "🕜", "🕝", "🕞", "🕟",
|
||||
"🕠", "🕡", "🕢", "🕣", "🕤", "🕥", "🕦", "🕧"
|
||||
}
|
||||
};
|
||||
|
||||
private ArrayList<EmojiGridAdapter> adapters = new ArrayList<>();
|
||||
private HashMap<String, Integer> recentUsageCounts = new HashMap<>();
|
||||
private ArrayList<String> recentChars = new ArrayList<>();
|
||||
|
||||
private Listener listener;
|
||||
private ViewPager pager;
|
||||
private FrameLayout recentsWrap;
|
||||
private ArrayList<GridView> views = new ArrayList<>();
|
||||
private ImageView backspaceButton;
|
||||
private LinearLayout pagerSlidingTabStripContainer;
|
||||
|
||||
private int oldWidth;
|
||||
private int lastNotifyWidth;
|
||||
|
||||
private boolean backspacePressed;
|
||||
private boolean backspaceOnce;
|
||||
|
||||
public EmojiInputView(final Context context) {
|
||||
super(context);
|
||||
|
||||
for (int i = 0; i < predefinedEmojis.length + 1/*add one for the recent page*/; i++) {
|
||||
GridView gridView = new GridView(context);
|
||||
gridView.setColumnWidth(AndroidUtilities.dp(45));
|
||||
gridView.setNumColumns(-1);
|
||||
views.add(gridView);
|
||||
|
||||
EmojiGridAdapter emojiGridAdapter = new EmojiGridAdapter(i - 1); // -1: recent, >=0: predefined
|
||||
gridView.setAdapter(emojiGridAdapter);
|
||||
adapters.add(emojiGridAdapter);
|
||||
}
|
||||
|
||||
setBackgroundColor(0xfff5f6f7);
|
||||
|
||||
pager = new ViewPager(context) {
|
||||
@Override
|
||||
public boolean onInterceptTouchEvent(MotionEvent ev) {
|
||||
if (getParent() != null) {
|
||||
getParent().requestDisallowInterceptTouchEvent(true);
|
||||
}
|
||||
return super.onInterceptTouchEvent(ev);
|
||||
}
|
||||
};
|
||||
pager.setAdapter(new EmojiPagerAdapter());
|
||||
|
||||
pagerSlidingTabStripContainer = new LinearLayout(context) {
|
||||
@Override
|
||||
public boolean onInterceptTouchEvent(MotionEvent ev) {
|
||||
if (getParent() != null) {
|
||||
getParent().requestDisallowInterceptTouchEvent(true);
|
||||
}
|
||||
return super.onInterceptTouchEvent(ev);
|
||||
}
|
||||
};
|
||||
pagerSlidingTabStripContainer.setOrientation(LinearLayout.HORIZONTAL);
|
||||
pagerSlidingTabStripContainer.setBackgroundColor(0xfff5f6f7);
|
||||
addView(pagerSlidingTabStripContainer, LayoutHelper.createFrame(LayoutParams.MATCH_PARENT, 48));
|
||||
|
||||
PagerSlidingTabStrip pagerSlidingTabStrip = new PagerSlidingTabStrip(context);
|
||||
pagerSlidingTabStrip.setViewPager(pager);
|
||||
pagerSlidingTabStrip.setShouldExpand(true);
|
||||
pagerSlidingTabStrip.setIndicatorHeight(AndroidUtilities.dp(2));
|
||||
pagerSlidingTabStrip.setUnderlineHeight(AndroidUtilities.dp(1));
|
||||
pagerSlidingTabStrip.setIndicatorColor(0xff2b96e2);
|
||||
pagerSlidingTabStrip.setUnderlineColor(0xffe2e5e7);
|
||||
pagerSlidingTabStripContainer.addView(pagerSlidingTabStrip, LayoutHelper.createLinear(0, 48, 1.0f));
|
||||
|
||||
FrameLayout frameLayout = new FrameLayout(context);
|
||||
pagerSlidingTabStripContainer.addView(frameLayout, LayoutHelper.createLinear(52, 48));
|
||||
|
||||
backspaceButton = new ImageView(context) {
|
||||
@Override
|
||||
public boolean onTouchEvent(MotionEvent event) {
|
||||
if (event.getAction() == MotionEvent.ACTION_DOWN) {
|
||||
backspacePressed = true;
|
||||
backspaceOnce = false;
|
||||
postBackspaceRunnable(350);
|
||||
} else if (event.getAction() == MotionEvent.ACTION_CANCEL || event.getAction() == MotionEvent.ACTION_UP) {
|
||||
backspacePressed = false;
|
||||
if (!backspaceOnce) {
|
||||
if (listener != null && listener.onBackspace()) {
|
||||
backspaceButton.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP);
|
||||
}
|
||||
}
|
||||
}
|
||||
super.onTouchEvent(event);
|
||||
return true;
|
||||
}
|
||||
};
|
||||
backspaceButton.setImageResource(R.drawable.ic_smiles_backspace);
|
||||
backspaceButton.setBackgroundResource(R.drawable.ic_emoji_backspace);
|
||||
backspaceButton.setScaleType(ImageView.ScaleType.CENTER);
|
||||
frameLayout.addView(backspaceButton, LayoutHelper.createFrame(52, 48));
|
||||
|
||||
View view = new View(context);
|
||||
view.setBackgroundColor(0xffe2e5e7);
|
||||
frameLayout.addView(view, LayoutHelper.createFrame(52, 1, Gravity.START | Gravity.BOTTOM));
|
||||
|
||||
recentsWrap = new FrameLayout(context);
|
||||
recentsWrap.addView(views.get(0));
|
||||
|
||||
TextView textView = new TextView(context);
|
||||
textView.setText(context.getString(R.string.NoRecentEmoji));
|
||||
textView.setTextSize(18);
|
||||
textView.setTextColor(0xff888888);
|
||||
textView.setGravity(Gravity.CENTER);
|
||||
recentsWrap.addView(textView);
|
||||
views.get(0).setEmptyView(textView);
|
||||
|
||||
addView(pager, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT, Gravity.START | Gravity.TOP, 0, 48, 0, 0));
|
||||
|
||||
loadRecentUsageCounts();
|
||||
sortRecentEmoji();
|
||||
adapters.get(0).notifyDataSetChanged();
|
||||
|
||||
// normally, we open the emoji-input-keyboard with the most recent page (index 0)
|
||||
// if there are no most recent emojis, open the first page (index 1) which contains smilies then
|
||||
if( recentChars.size() == 0 ) {
|
||||
pager.setCurrentItem(1);
|
||||
}
|
||||
}
|
||||
|
||||
private void postBackspaceRunnable(final int time) {
|
||||
AndroidUtilities.runOnUIThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (!backspacePressed) {
|
||||
return;
|
||||
}
|
||||
if (listener != null && listener.onBackspace()) {
|
||||
backspaceButton.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP);
|
||||
}
|
||||
backspaceOnce = true;
|
||||
postBackspaceRunnable(Math.max(50, time - 100));
|
||||
}
|
||||
}, time);
|
||||
}
|
||||
|
||||
public void clearRecent() {
|
||||
recentUsageCounts.clear();
|
||||
recentChars.clear();
|
||||
saveRecentUsageCounts();
|
||||
adapters.get(0).notifyDataSetChanged();
|
||||
}
|
||||
|
||||
private void saveRecentUsageCounts() {
|
||||
SharedPreferences preferences = getContext().getSharedPreferences("emoji", Activity.MODE_PRIVATE);
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
for (HashMap.Entry<String, Integer> entry : recentUsageCounts.entrySet()) {
|
||||
if (stringBuilder.length() != 0) {
|
||||
stringBuilder.append(",");
|
||||
}
|
||||
stringBuilder.append(entry.getKey());
|
||||
stringBuilder.append("=");
|
||||
stringBuilder.append(entry.getValue());
|
||||
}
|
||||
preferences.edit().putString("emojis", stringBuilder.toString()).apply();
|
||||
}
|
||||
|
||||
public void loadRecentUsageCounts() {
|
||||
SharedPreferences preferences = getContext().getSharedPreferences("emoji", Activity.MODE_PRIVATE);
|
||||
String str;
|
||||
try {
|
||||
recentUsageCounts.clear();
|
||||
str = preferences.getString("emojis", "");
|
||||
if (str.length() > 0) {
|
||||
String[] args = str.split(",");
|
||||
for (String arg : args) {
|
||||
String[] args2 = arg.split("=");
|
||||
recentUsageCounts.put(args2[0], Utilities.parseInt(args2[1]));
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private void sortRecentEmoji() {
|
||||
recentChars.clear();
|
||||
for (HashMap.Entry<String, Integer> entry : recentUsageCounts.entrySet()) {
|
||||
recentChars.add(entry.getKey());
|
||||
}
|
||||
Collections.sort(recentChars, new Comparator<String>() {
|
||||
@Override
|
||||
public int compare(String lhs, String rhs) {
|
||||
Integer count1 = recentUsageCounts.get(lhs);
|
||||
Integer count2 = recentUsageCounts.get(rhs);
|
||||
if (count1 == null) {
|
||||
count1 = 0;
|
||||
}
|
||||
if (count2 == null) {
|
||||
count2 = 0;
|
||||
}
|
||||
if (count1 > count2) {
|
||||
return -1;
|
||||
} else if (count1 < count2) {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
});
|
||||
while (recentChars.size() > 50) {
|
||||
recentChars.remove(recentChars.size() - 1);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
||||
FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) pagerSlidingTabStripContainer.getLayoutParams();
|
||||
layoutParams.width = View.MeasureSpec.getSize(widthMeasureSpec);
|
||||
if (layoutParams.width != oldWidth) {
|
||||
pagerSlidingTabStripContainer.setLayoutParams(layoutParams);
|
||||
oldWidth = layoutParams.width;
|
||||
}
|
||||
super.onMeasure(View.MeasureSpec.makeMeasureSpec(layoutParams.width, MeasureSpec.EXACTLY), View.MeasureSpec.makeMeasureSpec(View.MeasureSpec.getSize(heightMeasureSpec), MeasureSpec.EXACTLY));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
|
||||
if (lastNotifyWidth != right - left) {
|
||||
lastNotifyWidth = right - left;
|
||||
}
|
||||
super.onLayout(changed, left, top, right, bottom);
|
||||
}
|
||||
|
||||
public void setListener(Listener value) {
|
||||
listener = value;
|
||||
}
|
||||
|
||||
public void invalidateViews() {
|
||||
for (GridView gridView : views) {
|
||||
if (gridView != null) {
|
||||
gridView.invalidateViews();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setVisibility(int visibility) {
|
||||
super.setVisibility(visibility);
|
||||
if (visibility != GONE) {
|
||||
sortRecentEmoji();
|
||||
adapters.get(0).notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
|
||||
private class SingleEmojiView extends ImageView {
|
||||
|
||||
public SingleEmojiView(Context context) {
|
||||
super(context);
|
||||
|
||||
setOnClickListener(new View.OnClickListener() {
|
||||
public void onClick(View view) {
|
||||
sendEmoji();
|
||||
}
|
||||
});
|
||||
setOnLongClickListener(new OnLongClickListener() {
|
||||
@Override
|
||||
public boolean onLongClick(View view) {
|
||||
if (pager.getCurrentItem() == 0) {
|
||||
listener.onClearEmojiRecent();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
});
|
||||
setBackgroundResource(R.drawable.list_selector);
|
||||
setScaleType(ImageView.ScaleType.CENTER);
|
||||
}
|
||||
|
||||
private void sendEmoji() {
|
||||
String code = (String) getTag();
|
||||
|
||||
Integer count = recentUsageCounts.get(code);
|
||||
if (count == null) {
|
||||
count = 0;
|
||||
}
|
||||
if (count == 0 && recentUsageCounts.size() > 50) {
|
||||
for (int a = recentChars.size() - 1; a >= 0; a--) {
|
||||
String emoji = recentChars.get(a);
|
||||
recentUsageCounts.remove(emoji);
|
||||
recentChars.remove(a);
|
||||
if (recentUsageCounts.size() <= 50) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
recentUsageCounts.put(code, ++count);
|
||||
if (pager.getCurrentItem() != 0) {
|
||||
sortRecentEmoji();
|
||||
adapters.get(0).notifyDataSetChanged();
|
||||
views.get(0).invalidateViews();
|
||||
}
|
||||
saveRecentUsageCounts();
|
||||
if (listener != null) {
|
||||
listener.onEmojiSelected(fixEmoji(code));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
||||
setMeasuredDimension(View.MeasureSpec.getSize(widthMeasureSpec), View.MeasureSpec.getSize(widthMeasureSpec));
|
||||
}
|
||||
}
|
||||
|
||||
private class EmojiGridAdapter extends BaseAdapter {
|
||||
|
||||
private int emojiPage; // -1: recent, >= 0: predefined from predefinedEmojis
|
||||
|
||||
public EmojiGridAdapter(int page) {
|
||||
emojiPage = page;
|
||||
}
|
||||
|
||||
public int getCount() {
|
||||
int ret = emojiPage == -1? recentChars.size() : predefinedEmojis[emojiPage].length;
|
||||
return ret;
|
||||
}
|
||||
|
||||
public Object getItem(int i) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getItemId(int position) {
|
||||
return position;
|
||||
}
|
||||
|
||||
public View getView(int i, View view, ViewGroup paramViewGroup) {
|
||||
SingleEmojiView imageView = (SingleEmojiView) view;
|
||||
if (imageView == null) {
|
||||
imageView = new SingleEmojiView(getContext());
|
||||
}
|
||||
String code;
|
||||
String coloredCode;
|
||||
if (emojiPage == -1) {
|
||||
coloredCode = code = recentChars.get(i);
|
||||
} else {
|
||||
coloredCode = code = predefinedEmojis[emojiPage][i];
|
||||
}
|
||||
|
||||
// Draw native Emojis using TextDrawable, not imageView.setImageDrawable(Emoji.getEmojiBigDrawable(code)). See:
|
||||
// https://github.com/Jamesits/Moegram/commit/8e52c6222cf00bc9a86d52fed4c06558f48c345c
|
||||
// and https://github.com/amulyakhare/TextDrawable
|
||||
imageView.setTag(code);
|
||||
int bigImgSize;
|
||||
bigImgSize = AndroidUtilities.dp(32);
|
||||
imageView.setImageDrawable(TextDrawable.builder().beginConfig().textColor(Color.BLACK).fontSize(bigImgSize).endConfig().buildRect(coloredCode, Color.TRANSPARENT));
|
||||
return imageView;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unregisterDataSetObserver(DataSetObserver observer) {
|
||||
if (observer != null) {
|
||||
super.unregisterDataSetObserver(observer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class EmojiPagerAdapter extends PagerAdapter implements PagerSlidingTabStrip.IconTabProvider {
|
||||
|
||||
public void destroyItem(ViewGroup viewGroup, int position, Object object) {
|
||||
View view;
|
||||
if (position == 0) {
|
||||
view = recentsWrap;
|
||||
} else {
|
||||
view = views.get(position);
|
||||
}
|
||||
viewGroup.removeView(view);
|
||||
}
|
||||
|
||||
public int getCount() {
|
||||
return views.size();
|
||||
}
|
||||
|
||||
public int getPageIconResId(int position) {
|
||||
int[] icons = {
|
||||
R.drawable.ic_emoji_recent,
|
||||
R.drawable.ic_emoji_smile,
|
||||
R.drawable.ic_emoji_flower,
|
||||
R.drawable.ic_emoji_bell,
|
||||
R.drawable.ic_emoji_car,
|
||||
R.drawable.ic_emoji_symbol};
|
||||
return icons[position>=0 && position<icons.length? position : 0];
|
||||
}
|
||||
|
||||
public Object instantiateItem(ViewGroup viewGroup, int position) {
|
||||
View view;
|
||||
if (position == 0) {
|
||||
view = recentsWrap;
|
||||
} else {
|
||||
view = views.get(position);
|
||||
}
|
||||
viewGroup.addView(view);
|
||||
return view;
|
||||
}
|
||||
|
||||
public boolean isViewFromObject(View view, Object object) {
|
||||
return view == object;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unregisterDataSetObserver(DataSetObserver observer) {
|
||||
if (observer != null) {
|
||||
super.unregisterDataSetObserver(observer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static final char[] insertVariationSelector = {
|
||||
0x2B50, 0x2600, 0x26C5, 0x2601, 0x26A1, 0x2744, 0x26C4, 0x2614, 0x2708, 0x26F5, 0x2693,
|
||||
0x26FD, 0x26F2, 0x26FA, 0x26EA, 0x2615, 0x26BD, 0x26BE, 0x26F3, 0x231A, 0x260E, 0x231B,
|
||||
0x2709, 0x2702, 0x2712, 0x270F, 0x2648, 0x2649, 0x264A, 0x264B, 0x264C, 0x264D, 0x264E,
|
||||
0x264F, 0x2650, 0x2651, 0x2652, 0x2653, 0x2734, 0x3299, 0x3297, 0x26D4, 0x2B55, 0x2668,
|
||||
0x2757, 0x203C, 0x2049, 0x303D, 0x26A0, 0x267B, 0x2747, 0x2733, 0x24C2, 0x267F, 0x25B6,
|
||||
0x25C0, 0x27A1, 0x2B05, 0x2B06, 0x2B07, 0x2197, 0x2198, 0x2199, 0x2196, 0x2195, 0x2194,
|
||||
0x21AA, 0x21A9, 0x2934, 0x2935, 0x2139, 0x2714, 0x2716, 0x2611, 0x26AA, 0x26AB, 0x25AA,
|
||||
0x25AB, 0x2B1B, 0x2B1C, 0x25FC, 0x25FB, 0x25FE, 0x25FD, 0x2660, 0x2663, 0x2665, 0x2666,
|
||||
0x263A, 0x2639, 0x270C, 0x261D, 0x2764
|
||||
};
|
||||
private static final HashMap<Character, Boolean> insertVariationSelectorMap = new HashMap<>(insertVariationSelector.length);
|
||||
static {
|
||||
for (int a = 0; a < insertVariationSelector.length; a++) {
|
||||
insertVariationSelectorMap.put(insertVariationSelector[a], true);
|
||||
}
|
||||
}
|
||||
private static String fixEmoji(String emoji) {
|
||||
char ch;
|
||||
int lenght = emoji.length();
|
||||
for (int a = 0; a < lenght; a++) {
|
||||
ch = emoji.charAt(a);
|
||||
if (ch >= 0xD83C && ch <= 0xD83E) {
|
||||
if (ch == 0xD83C && a < lenght - 1) {
|
||||
ch = emoji.charAt(a + 1);
|
||||
if (ch == 0xDE2F || ch == 0xDC04 || ch == 0xDE1A || ch == 0xDD7F) {
|
||||
emoji = emoji.substring(0, a + 2) + "\uFE0F"/*VARIATION SELECTOR-16*/ + emoji.substring(a + 2);
|
||||
lenght++;
|
||||
a += 2;
|
||||
} else {
|
||||
a++;
|
||||
}
|
||||
} else {
|
||||
a++;
|
||||
}
|
||||
} else if (ch == 0x20E3 /*COMBINING ENCLOSING KEYCAP*/) {
|
||||
return emoji;
|
||||
} if (insertVariationSelectorMap.containsKey(ch)) {
|
||||
emoji = emoji.substring(0, a + 1) + "\uFE0F"/*VARIATION SELECTOR-16*/ + emoji.substring(a + 1);
|
||||
lenght++;
|
||||
a++;
|
||||
}
|
||||
}
|
||||
return emoji;
|
||||
}
|
||||
|
||||
public static CharSequence replaceEmoji(CharSequence cs, boolean createNew) {
|
||||
if (cs == null || cs.length() == 0) {
|
||||
return cs;
|
||||
}
|
||||
Spannable s;
|
||||
if (!createNew && cs instanceof Spannable) {
|
||||
s = (Spannable) cs;
|
||||
} else {
|
||||
s = Spannable.Factory.getInstance().newSpannable(cs.toString());
|
||||
}
|
||||
|
||||
return s;
|
||||
}
|
||||
}
|
||||
@@ -1,106 +0,0 @@
|
||||
/*******************************************************************************
|
||||
*
|
||||
* Delta Chat Android
|
||||
* (C) 2013-2016 Nikolai Kudashov
|
||||
* (C) 2017 Björn Petersen
|
||||
* Contact: r10s@b44t.com, http://b44t.com
|
||||
*
|
||||
* This program 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.
|
||||
*
|
||||
* This program 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
|
||||
* this program. If not, see http://www.gnu.org/licenses/ .
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
package com.b44t.messenger;
|
||||
|
||||
import com.b44t.messenger.time.FastDateFormat;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.OutputStreamWriter;
|
||||
import java.util.Locale;
|
||||
|
||||
public class FileLog {
|
||||
private OutputStreamWriter streamWriter = null;
|
||||
private FastDateFormat dateFormat = null;
|
||||
private DispatchQueue logQueue = null;
|
||||
private File currentFile = null;
|
||||
|
||||
private static volatile FileLog Instance = null;
|
||||
public static FileLog getInstance() {
|
||||
FileLog localInstance = Instance;
|
||||
if (localInstance == null) {
|
||||
synchronized (FileLog.class) {
|
||||
localInstance = Instance;
|
||||
if (localInstance == null) {
|
||||
Instance = localInstance = new FileLog();
|
||||
}
|
||||
}
|
||||
}
|
||||
return localInstance;
|
||||
}
|
||||
|
||||
public FileLog() {
|
||||
dateFormat = FastDateFormat.getInstance("yyyyMMdd_HHmmss", Locale.US);
|
||||
try {
|
||||
File sdCard = ApplicationLoader.applicationContext.getExternalFilesDir(null);
|
||||
if (sdCard == null) {
|
||||
return;
|
||||
}
|
||||
File dir = new File(sdCard.getAbsolutePath() + "/logs");
|
||||
dir.mkdirs();
|
||||
currentFile = new File(dir, dateFormat.format(System.currentTimeMillis()) + ".txt");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
try {
|
||||
logQueue = new DispatchQueue("logQueue");
|
||||
currentFile.createNewFile();
|
||||
FileOutputStream stream = new FileOutputStream(currentFile);
|
||||
streamWriter = new OutputStreamWriter(stream);
|
||||
streamWriter.write("-----start log " + dateFormat.format(System.currentTimeMillis()) + "-----\n");
|
||||
streamWriter.flush();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private static void log(final String what, final String tag, final String message)
|
||||
{
|
||||
if (getInstance().streamWriter != null) {
|
||||
getInstance().logQueue.postRunnable(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
getInstance().streamWriter.write(getInstance().dateFormat.format(System.currentTimeMillis()) + " " + what + "/" + tag + ": " + message + "\n");
|
||||
getInstance().streamWriter.flush();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public static void e(final String tag, final String message) {
|
||||
log("E", tag, message);
|
||||
}
|
||||
|
||||
public static void w(final String tag, final String message) {
|
||||
log("W", tag, message);
|
||||
}
|
||||
|
||||
public static void i(final String tag, final String message) {
|
||||
log("I", tag, message);
|
||||
}
|
||||
}
|
||||
+36
-170
@@ -21,15 +21,13 @@
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
package com.b44t.ui;
|
||||
package com.b44t.messenger;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.text.Editable;
|
||||
import android.text.InputFilter;
|
||||
import android.text.InputType;
|
||||
import android.text.TextWatcher;
|
||||
import android.util.TypedValue;
|
||||
import android.view.Gravity;
|
||||
import android.view.View;
|
||||
@@ -39,60 +37,50 @@ import android.widget.EditText;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.ListView;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.b44t.messenger.AndroidUtilities;
|
||||
import com.b44t.messenger.ApplicationLoader;
|
||||
import com.b44t.messenger.ContactsController;
|
||||
import com.b44t.messenger.LocaleController;
|
||||
import com.b44t.messenger.MrContact;
|
||||
import com.b44t.messenger.MrMailbox;
|
||||
import com.b44t.messenger.TLRPC;
|
||||
import com.b44t.messenger.NotificationCenter;
|
||||
import com.b44t.messenger.R;
|
||||
import com.b44t.ui.Adapters.BaseFragmentAdapter;
|
||||
import com.b44t.ui.Cells.GreySectionCell;
|
||||
import com.b44t.ui.Cells.UserCell;
|
||||
import com.b44t.ui.ActionBar.ActionBar;
|
||||
import com.b44t.ui.ActionBar.ActionBarMenu;
|
||||
import com.b44t.ui.Components.AvatarDrawable;
|
||||
import com.b44t.ui.Components.AvatarUpdater;
|
||||
import com.b44t.ui.Components.BackupImageView;
|
||||
import com.b44t.ui.ActionBar.BaseFragment;
|
||||
import com.b44t.ui.Components.LayoutHelper;
|
||||
import com.b44t.messenger.Cells.HeaderCell;
|
||||
import com.b44t.messenger.Components.BaseFragmentAdapter;
|
||||
import com.b44t.messenger.Cells.GreySectionCell;
|
||||
import com.b44t.messenger.Cells.UserCell;
|
||||
import com.b44t.messenger.ActionBar.ActionBar;
|
||||
import com.b44t.messenger.ActionBar.ActionBarMenu;
|
||||
import com.b44t.messenger.ActionBar.BaseFragment;
|
||||
import com.b44t.messenger.Components.LayoutHelper;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class GroupCreateFinalActivity extends BaseFragment implements NotificationCenter.NotificationCenterDelegate, AvatarUpdater.AvatarUpdaterDelegate {
|
||||
public class GroupCreateFinalActivity extends BaseFragment implements NotificationCenter.NotificationCenterDelegate {
|
||||
|
||||
private ListAdapter listAdapter;
|
||||
private ListView listView;
|
||||
private EditText nameTextView;
|
||||
private TLRPC.FileLocation avatar;
|
||||
private TLRPC.InputFile uploadedAvatar;
|
||||
private ArrayList<Integer> selectedContacts;
|
||||
private BackupImageView avatarImage;
|
||||
private AvatarDrawable avatarDrawable;
|
||||
private AvatarUpdater avatarUpdater = new AvatarUpdater();
|
||||
private String nameToSet = null;
|
||||
|
||||
private final static int done_button = 1;
|
||||
|
||||
int do_what; // values from ContactsActivity
|
||||
|
||||
public GroupCreateFinalActivity(Bundle args) {
|
||||
|
||||
super(args);
|
||||
avatarDrawable = new AvatarDrawable();
|
||||
if( args != null ) {
|
||||
do_what = args.getInt("do_what", 0);
|
||||
selectedContacts = args.getIntegerArrayList("result"); /* may be empty - in this case a group only with SELF is created */
|
||||
}
|
||||
if( selectedContacts == null ) { selectedContacts = new ArrayList<>(); }
|
||||
if( !selectedContacts.contains(MrContact.MR_CONTACT_ID_SELF) ) {
|
||||
selectedContacts.add(MrContact.MR_CONTACT_ID_SELF);
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public boolean onFragmentCreate() {
|
||||
NotificationCenter.getInstance().addObserver(this, NotificationCenter.updateInterfaces);
|
||||
avatarUpdater.parentFragment = this;
|
||||
avatarUpdater.delegate = this;
|
||||
avatarUpdater.returnOnly = true;
|
||||
selectedContacts = getArguments().getIntegerArrayList("result"); /* may be empty - in this case a group only with SELF is created */
|
||||
if( selectedContacts == null ) { selectedContacts = new ArrayList<>(); }
|
||||
selectedContacts.add(MrContact.MR_CONTACT_ID_SELF);
|
||||
|
||||
return super.onFragmentCreate();
|
||||
}
|
||||
|
||||
@@ -100,7 +88,6 @@ public class GroupCreateFinalActivity extends BaseFragment implements Notificati
|
||||
public void onFragmentDestroy() {
|
||||
super.onFragmentDestroy();
|
||||
NotificationCenter.getInstance().removeObserver(this, NotificationCenter.updateInterfaces);
|
||||
avatarUpdater.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -114,8 +101,7 @@ public class GroupCreateFinalActivity extends BaseFragment implements Notificati
|
||||
@Override
|
||||
public View createView(final Context context) {
|
||||
actionBar.setBackButtonImage(R.drawable.ic_close_white);
|
||||
actionBar.setAllowOverlayTitle(true);
|
||||
actionBar.setTitle(context.getString(R.string.NewGroup));
|
||||
actionBar.setTitle(do_what==ContactsActivity.SELECT_CONTACTS_FOR_NEW_VERIFIED_GROUP? context.getString(R.string.NewVerifiedGroup) : context.getString(R.string.NewGroup));
|
||||
actionBar.setActionBarMenuOnItemClick(new ActionBar.ActionBarMenuOnItemClick() {
|
||||
@Override
|
||||
public void onItemClick(int id) {
|
||||
@@ -127,7 +113,7 @@ public class GroupCreateFinalActivity extends BaseFragment implements Notificati
|
||||
Toast.makeText(getParentActivity(), context.getString(R.string.ErrGroupNameEmpty), Toast.LENGTH_LONG).show();
|
||||
return;
|
||||
}
|
||||
int chat_id=MrMailbox.createGroupChat(groupName);
|
||||
int chat_id=MrMailbox.createGroupChat(do_what==ContactsActivity.SELECT_CONTACTS_FOR_NEW_VERIFIED_GROUP, groupName);
|
||||
if( chat_id<=0 ) {
|
||||
/* this should never happen, the group is created locally, there is no reason to fail here */
|
||||
Toast.makeText(getParentActivity(), "ErrCreateGroup", Toast.LENGTH_LONG).show();
|
||||
@@ -148,9 +134,6 @@ public class GroupCreateFinalActivity extends BaseFragment implements Notificati
|
||||
Bundle args2 = new Bundle();
|
||||
args2.putInt("chat_id", chat_id);
|
||||
presentFragment(new ChatActivity(args2), true);
|
||||
if (uploadedAvatar != null) {
|
||||
//MessagesController.getInstance().changeChatAvatar(chat_id, uploadedAvatar);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -162,66 +145,8 @@ public class GroupCreateFinalActivity extends BaseFragment implements Notificati
|
||||
LinearLayout linearLayout = (LinearLayout) fragmentView;
|
||||
linearLayout.setOrientation(LinearLayout.VERTICAL);
|
||||
|
||||
FrameLayout frameLayout = new FrameLayout(context);
|
||||
linearLayout.addView(frameLayout);
|
||||
LinearLayout.LayoutParams layoutParams = (LinearLayout.LayoutParams) frameLayout.getLayoutParams();
|
||||
layoutParams.width = LayoutHelper.MATCH_PARENT;
|
||||
layoutParams.height = LayoutHelper.WRAP_CONTENT;
|
||||
layoutParams.gravity = Gravity.TOP | Gravity.START;
|
||||
frameLayout.setLayoutParams(layoutParams);
|
||||
|
||||
avatarImage = new BackupImageView(context);
|
||||
avatarImage.setRoundRadius(AndroidUtilities.dp(32));
|
||||
//avatarDrawable.setInfoByName("?");
|
||||
avatarImage.setImageDrawable(avatarDrawable);
|
||||
frameLayout.addView(avatarImage);
|
||||
FrameLayout.LayoutParams layoutParams1 = (FrameLayout.LayoutParams) avatarImage.getLayoutParams();
|
||||
layoutParams1.width = AndroidUtilities.dp(64);
|
||||
layoutParams1.height = AndroidUtilities.dp(64);
|
||||
layoutParams1.topMargin = AndroidUtilities.dp(12);
|
||||
layoutParams1.bottomMargin = AndroidUtilities.dp(12);
|
||||
layoutParams1.leftMargin = LocaleController.isRTL ? 0 : AndroidUtilities.dp(16);
|
||||
layoutParams1.rightMargin = LocaleController.isRTL ? AndroidUtilities.dp(16) : 0;
|
||||
layoutParams1.gravity = Gravity.TOP | Gravity.START;
|
||||
avatarImage.setLayoutParams(layoutParams1);
|
||||
{
|
||||
//avatarDrawable.setDrawPhoto(true);
|
||||
/* TODO: let the user select a photo for the group
|
||||
avatarImage.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
if (getParentActivity() == null) {
|
||||
return;
|
||||
}
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
|
||||
|
||||
CharSequence[] items;
|
||||
|
||||
if (avatar != null) {
|
||||
items = new CharSequence[]{LocaleController.getString("FromCamera", R.string.FromCamera), LocaleController.getString("FromGalley", R.string.FromGalley), LocaleController.getString("DeletePhoto", R.string.DeletePhoto)};
|
||||
} else {
|
||||
items = new CharSequence[]{LocaleController.getString("FromCamera", R.string.FromCamera), LocaleController.getString("FromGalley", R.string.FromGalley)};
|
||||
}
|
||||
|
||||
builder.setItems(items, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialogInterface, int i) {
|
||||
if (i == 0) {
|
||||
avatarUpdater.openCamera();
|
||||
} else if (i == 1) {
|
||||
avatarUpdater.openGallery();
|
||||
} else if (i == 2) {
|
||||
avatar = null;
|
||||
uploadedAvatar = null;
|
||||
avatarImage.setImage(avatar, "50_50", avatarDrawable);
|
||||
}
|
||||
}
|
||||
});
|
||||
showDialog(builder.create());
|
||||
}
|
||||
});
|
||||
*/
|
||||
}
|
||||
TextView label = HeaderCell.createTextView(context, context.getString(R.string.Name));
|
||||
linearLayout.addView(label, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.CENTER_VERTICAL, 18, 18, 18, 0));
|
||||
|
||||
nameTextView = new EditText(context);
|
||||
nameTextView.setHint(context.getString(R.string.EnterGroupNamePlaceholder));
|
||||
@@ -231,96 +156,40 @@ public class GroupCreateFinalActivity extends BaseFragment implements Notificati
|
||||
}
|
||||
nameTextView.setMaxLines(4);
|
||||
nameTextView.setGravity(Gravity.CENTER_VERTICAL | Gravity.START);
|
||||
nameTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16);
|
||||
nameTextView.setHintTextColor(0xff979797);
|
||||
nameTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 18);
|
||||
nameTextView.setHintTextColor(0xffBBBBBB);
|
||||
nameTextView.setImeOptions(EditorInfo.IME_FLAG_NO_EXTRACT_UI);
|
||||
nameTextView.setInputType(InputType.TYPE_TEXT_FLAG_CAP_WORDS);
|
||||
nameTextView.setPadding(0, 0, 0, AndroidUtilities.dp(8));
|
||||
InputFilter[] inputFilters = new InputFilter[1];
|
||||
inputFilters[0] = new InputFilter.LengthFilter(100);
|
||||
nameTextView.setFilters(inputFilters);
|
||||
AndroidUtilities.clearCursorDrawable(nameTextView);
|
||||
nameTextView.setTextColor(0xff212121);
|
||||
frameLayout.addView(nameTextView);
|
||||
layoutParams1 = (FrameLayout.LayoutParams) nameTextView.getLayoutParams();
|
||||
layoutParams1.width = LayoutHelper.MATCH_PARENT;
|
||||
layoutParams1.height = LayoutHelper.WRAP_CONTENT;
|
||||
layoutParams1.leftMargin = LocaleController.isRTL ? AndroidUtilities.dp(16) : AndroidUtilities.dp(96);
|
||||
layoutParams1.rightMargin = LocaleController.isRTL ? AndroidUtilities.dp(96) : AndroidUtilities.dp(16);
|
||||
layoutParams1.gravity = Gravity.CENTER_VERTICAL;
|
||||
nameTextView.setLayoutParams(layoutParams1);
|
||||
{
|
||||
nameTextView.addTextChangedListener(new TextWatcher() {
|
||||
@Override
|
||||
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
||||
linearLayout.addView(nameTextView, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.CENTER_VERTICAL, 18, 1, 18, 18));
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterTextChanged(Editable s) {
|
||||
updateAvatar();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
GreySectionCell sectionCell = new GreySectionCell(context);
|
||||
sectionCell.setText(context.getResources().getQuantityString(R.plurals.Members, selectedContacts.size(), selectedContacts.size()));
|
||||
linearLayout.addView(sectionCell);
|
||||
label = HeaderCell.createTextView(context, context.getResources().getQuantityString(R.plurals.Members, selectedContacts.size(), selectedContacts.size()));
|
||||
linearLayout.addView(label, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.CENTER_VERTICAL, 18, 9, 18, 4));
|
||||
|
||||
listView = new ListView(context);
|
||||
listView.setDivider(null);
|
||||
listView.setDividerHeight(0);
|
||||
listView.setAdapter(listAdapter = new ListAdapter(context));
|
||||
linearLayout.addView(listView);
|
||||
layoutParams = (LinearLayout.LayoutParams) listView.getLayoutParams();
|
||||
LinearLayout.LayoutParams layoutParams = (LinearLayout.LayoutParams) listView.getLayoutParams();
|
||||
layoutParams.width = LayoutHelper.MATCH_PARENT;
|
||||
layoutParams.height = LayoutHelper.MATCH_PARENT;
|
||||
listView.setLayoutParams(layoutParams);
|
||||
|
||||
updateAvatar();
|
||||
|
||||
return fragmentView;
|
||||
}
|
||||
|
||||
private void updateAvatar()
|
||||
{
|
||||
ContactsController.setupAvatarByStrings(avatarImage, avatarImage.imageReceiver, avatarDrawable, null,
|
||||
nameTextView.length() > 0 ? nameTextView.getText().toString() : "?");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void didUploadedPhoto(final TLRPC.InputFile file, final TLRPC.PhotoSize small, final TLRPC.PhotoSize big) {
|
||||
Toast.makeText(getParentActivity(), ApplicationLoader.applicationContext.getString(R.string.NotYetImplemented), Toast.LENGTH_SHORT).show();
|
||||
/*
|
||||
AndroidUtilities.runOnUIThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
uploadedAvatar = file;
|
||||
avatar = small.location;
|
||||
avatarImage.setImage(avatar, "50_50", avatarDrawable);
|
||||
if (createAfterUpload) {
|
||||
MessagesController.getInstance().createChat(nameTextView.getText().toString(), selectedContacts, null, chatType, GroupCreateFinalActivity.this);
|
||||
}
|
||||
}
|
||||
});
|
||||
*/
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivityResultFragment(int requestCode, int resultCode, Intent data) {
|
||||
avatarUpdater.onActivityResult(requestCode, resultCode, data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveSelfArgs(Bundle args) {
|
||||
if (avatarUpdater != null && avatarUpdater.currentPicturePath != null) {
|
||||
args.putString("path", avatarUpdater.currentPicturePath);
|
||||
}
|
||||
if (nameTextView != null) {
|
||||
String text = nameTextView.getText().toString();
|
||||
if (text != null && text.length() != 0) {
|
||||
@@ -331,9 +200,6 @@ public class GroupCreateFinalActivity extends BaseFragment implements Notificati
|
||||
|
||||
@Override
|
||||
public void restoreSelfArgs(Bundle args) {
|
||||
if (avatarUpdater != null) {
|
||||
avatarUpdater.currentPicturePath = args.getString("path");
|
||||
}
|
||||
String text = args.getString("nameTextView");
|
||||
if (text != null) {
|
||||
if (nameTextView != null) {
|
||||
@@ -346,7 +212,7 @@ public class GroupCreateFinalActivity extends BaseFragment implements Notificati
|
||||
|
||||
@Override
|
||||
public void onTransitionAnimationEnd(boolean isOpen, boolean backward) {
|
||||
if (isOpen) {
|
||||
if (isOpen && nameTextView!=null) {
|
||||
nameTextView.requestFocus();
|
||||
AndroidUtilities.showKeyboard(nameTextView);
|
||||
}
|
||||
@@ -395,14 +261,14 @@ public class GroupCreateFinalActivity extends BaseFragment implements Notificati
|
||||
@Override
|
||||
public View getView(int i, View view, ViewGroup viewGroup) {
|
||||
if (view == null) {
|
||||
view = new UserCell(mContext, 1, 0);
|
||||
view = new UserCell(mContext,0);
|
||||
}
|
||||
|
||||
int curr_user_id = selectedContacts.get(i);
|
||||
|
||||
MrContact mrContact = MrMailbox.getContact(curr_user_id);
|
||||
|
||||
((UserCell) view).setData(mrContact, 0);
|
||||
((UserCell) view).setData(mrContact);
|
||||
|
||||
return view;
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user