Compare commits

...

562 Commits

Author SHA1 Message Date
B. Petersen 3441162de4 Update messenger-backend submodule. 2018-05-17 22:26:38 +02:00
B. Petersen b695015e8f update translations 2018-05-17 22:26:29 +02:00
B. Petersen e50bf6ef95 bump version 2018-05-17 22:26:13 +02:00
B. Petersen 3ca55ad986 Update messenger-backend submodule. 2018-05-17 18:02:16 +02:00
Björn Petersen 40ff8268a8 Merge pull request #308 from testbird/patch-5
doubled & typo
2018-05-16 15:23:47 +02:00
testbird 2e7fac05ba Update SettingsAdvFragment.java 2018-05-16 15:04:26 +02:00
B. Petersen a42996892d bump version 2018-05-15 23:24:44 +02:00
B. Petersen 3e926becba Update messenger-backend submodule. 2018-05-15 23:23:47 +02:00
B. Petersen a1eeb25dff changelog 2018-05-15 23:23:33 +02:00
B. Petersen a1f4b64c4a Update messenger-backend submodule. 2018-05-12 00:37:40 +02:00
B. Petersen 5673b25e52 refactor connect-functions 2018-05-12 00:36:40 +02:00
B. Petersen f755add1d2 bump version 2018-05-11 15:21:58 +02:00
B. Petersen 60dd8098c4 Update messenger-backend submodule. 2018-05-11 15:20:49 +02:00
B. Petersen 5823d04a20 update changelog and translations 2018-05-11 15:20:30 +02:00
B. Petersen 3cdfa949e9 Update messenger-backend submodule. 2018-05-11 15:13:39 +02:00
B. Petersen b69eaddddf add a labs-option to disable the logo overlay 2018-05-11 15:13:15 +02:00
B. Petersen 137b32303f refine qr-show layout 2018-05-09 12:51:16 +02:00
B. Petersen da87705fb8 layout show-qr activity 2018-05-09 01:21:55 +02:00
B. Petersen d808adeb39 derive qr-scan and qr-show activities from AppCompat, add back button and title 2018-05-08 17:28:07 +02:00
B. Petersen 2ca07c6ee9 typo 2018-05-08 00:31:53 +02:00
B. Petersen 9a05cd4646 show a little info before enable qr code options 2018-05-08 00:29:40 +02:00
B. Petersen 85e16df79a update translations 2018-05-08 00:01:36 +02:00
B. Petersen 2fd0bdf68b changelog 2018-05-07 23:59:39 +02:00
B. Petersen 23a2d11944 bump version 2018-05-07 14:46:44 +02:00
B. Petersen 02e515e531 Update messenger-backend submodule. 2018-05-07 14:34:58 +02:00
B. Petersen 6651d26a47 unify add-contacts search-field 2018-05-05 01:54:54 +02:00
B. Petersen 84df07dcd1 unify group-final layout 2018-05-05 01:47:03 +02:00
B. Petersen d865b08aa1 add hints to add-contact dialog; unify colors 2018-05-05 01:31:13 +02:00
B. Petersen 220c855222 directly select added contact on group creation 2018-05-05 00:53:20 +02:00
B. Petersen de2fa484ef close qr-show activity after all pending joins are done successfully 2018-05-05 00:19:30 +02:00
B. Petersen f5c3b79a1d for verified-groups, show join-via-qr instead of add-member (the latter won't work as only unverified contacts are created this way) 2018-05-04 23:51:47 +02:00
B. Petersen 254f489d27 update translations 2018-05-04 20:54:33 +02:00
B. Petersen 716d42c21a allow going one step back from group createion 2018-05-04 20:53:39 +02:00
B. Petersen 3f3bfa562f prefill the add-contact dialog by the entered (and probably unsuccessfull) contact-search 2018-05-04 20:30:46 +02:00
B. Petersen a11ca07f4e move 'new group' from the menu to a more visible button above the contact-list 2018-05-04 20:15:03 +02:00
B. Petersen 575c275d39 comment 2018-05-03 22:57:51 +02:00
B. Petersen acf0d801ce update translations 2018-05-03 22:54:51 +02:00
B. Petersen 14d810c319 refine 'action by me' wording, add translators hint 2018-05-03 22:54:33 +02:00
B. Petersen 5d7bca4538 update translations 2018-05-03 21:28:48 +02:00
B. Petersen db48d7be5e Update messenger-backend submodule. 2018-05-03 00:46:15 +02:00
B. Petersen 234dd6d13e add the sender to system-messages 2018-05-03 00:46:02 +02:00
B. Petersen 948f89f957 Update messenger-backend submodule. 2018-05-02 00:38:46 +02:00
B. Petersen b9c64626d1 Update messenger-backend submodule. 2018-05-01 01:08:24 +02:00
B. Petersen 469169b2f1 secure-join returns new chat-id on success 2018-05-01 01:07:50 +02:00
B. Petersen 113a270407 ask whether to join verified groups 2018-04-30 11:57:18 +02:00
B. Petersen 2469324f65 add a button to open the url from a qr-code 2018-04-30 11:29:56 +02:00
B. Petersen f1b5facc6a refactor 2018-04-30 10:58:58 +02:00
B. Petersen b0260c352d update translations 2018-04-30 01:18:14 +02:00
B. Petersen a5168ed1a5 Update messenger-backend submodule. 2018-04-30 01:17:03 +02:00
B. Petersen 4c9e7cc516 more precise secure-join progress information on joiner side 2018-04-30 01:16:46 +02:00
B. Petersen 733b123c09 wording 2018-04-30 00:47:51 +02:00
B. Petersen dd2b484cdb Update messenger-backend submodule. 2018-04-30 00:29:57 +02:00
B. Petersen 1b4811e334 refactor 2018-04-30 00:21:48 +02:00
B. Petersen d23ce67862 more precise secure-join progress information on inviter side 2018-04-30 00:06:55 +02:00
B. Petersen b26f127fb0 avoid null-pointer exception 2018-04-30 00:00:56 +02:00
B. Petersen 359cebec8e Update messenger-backend submodule. 2018-04-29 18:11:20 +02:00
B. Petersen ce3bb860b8 update translations 2018-04-28 11:48:20 +02:00
B. Petersen a1d8cffc85 Update messenger-backend submodule. 2018-04-28 11:45:59 +02:00
B. Petersen 0b4b11e7f3 simplify encryption info; we cannot say 'encryption enabled' any longer as this depends eg. onverified groups. we just show the fingerprints and other states of the peer. 2018-04-28 11:45:38 +02:00
B. Petersen 50f3ab528d add qr-invite-option to chat-menu 2018-04-28 00:28:53 +02:00
B. Petersen a85dcead6b add chat_id to qr-code 2018-04-28 00:22:03 +02:00
B. Petersen 5b1b2a916c Update messenger-backend submodule. 2018-04-28 00:15:43 +02:00
B. Petersen 53b6adb0a5 wording 2018-04-28 00:15:34 +02:00
B. Petersen 0cd5a372d5 separate encryption-info button in contact-profile 2018-04-28 00:09:42 +02:00
B. Petersen 69fa2cb4ee add invite-qr-code to group-profile 2018-04-27 23:56:54 +02:00
B. Petersen 52208d8653 Update messenger-backend submodule. 2018-04-27 12:00:19 +02:00
B. Petersen 3630606f52 wording 2018-04-26 18:04:18 +02:00
B. Petersen ac9aa2e6dd wording 2018-04-26 16:04:57 +02:00
B. Petersen f72ec65b79 update translations 2018-04-26 15:58:20 +02:00
B. Petersen b3920d9bf3 Update messenger-backend submodule. 2018-04-26 15:57:27 +02:00
B. Petersen a828650a44 move contact-deletion to the contact-list, tackles 2018-04-25 22:34:20 +02:00
B. Petersen a2c3163df8 move encryption-info to profile-email-longclick 2018-04-25 22:19:57 +02:00
B. Petersen 15245fa85c move profile-menu options to profile-settings, delete profile-menu 2018-04-25 22:14:35 +02:00
B. Petersen 28f3288d2a layout 2018-04-25 19:52:59 +02:00
B. Petersen 7b69a50623 move supported options from advanced-menu to avanced-other, removed advanced-menu 2018-04-25 17:48:51 +02:00
B. Petersen 790e45795c move passcode-options to advances-settings 2018-04-25 17:19:34 +02:00
B. Petersen 185d7ca4d3 cleanup adv-settings 2018-04-25 17:10:30 +02:00
B. Petersen 383042d778 show qr-scan-icon only if the qr-labs-options are endabled 2018-04-25 16:57:01 +02:00
B. Petersen d39a6f16aa add separate qrscan-button 2018-04-25 16:49:09 +02:00
B. Petersen 7c9e879454 update translations 2018-04-24 22:26:37 +02:00
B. Petersen bb283230f4 Update messenger-backend submodule. 2018-04-24 22:23:30 +02:00
B. Petersen 363d816a17 update makefile 2018-04-24 22:23:15 +02:00
B. Petersen 38e70d8640 Update messenger-backend submodule. 2018-04-22 10:14:15 +02:00
B. Petersen 652f2d0665 show SELF in contact list only when creating a new single chat or when selecing a contact to attach to a message 2018-04-22 10:14:06 +02:00
B. Petersen 75b430b323 filter contact list when adding contacts to a verified group 2018-04-21 16:19:45 +02:00
B. Petersen 0491f93192 Update messenger-backend submodule. 2018-04-21 15:47:58 +02:00
B. Petersen 9a33ddbbc4 simplify checking for groups 2018-04-21 15:19:36 +02:00
B. Petersen e3e4b509e8 update translations 2018-04-21 13:10:53 +02:00
B. Petersen 0e6bac1b2f tell what happens if the user changes the name of a group, fixed #264 2018-04-21 13:09:04 +02:00
B. Petersen ebeb2c9443 correct profile layout 2018-04-21 12:27:23 +02:00
B. Petersen f00c0a16f1 pass 'verified' paramter to group creation 2018-04-20 23:40:46 +02:00
B. Petersen 1733529486 remove dead code 2018-04-20 23:19:52 +02:00
B. Petersen a0cd2d0a7c avoid adding SELF twice 2018-04-20 23:17:14 +02:00
B. Petersen 8decc0176f Update messenger-backend submodule. 2018-04-20 21:11:46 +02:00
B. Petersen 2015a620d6 changelog 2018-04-20 21:10:39 +02:00
B. Petersen 3e042ff2a2 update tranlsations, changelog 2018-04-20 15:36:00 +02:00
B. Petersen 0768ccb2fd show type of contact/group in profile 2018-04-20 15:33:48 +02:00
B. Petersen ff19d4dae3 automatically update chatlist in profile 2018-04-20 14:49:06 +02:00
B. Petersen adc8652cad handle clicks on chat in profile 2018-04-20 11:22:27 +02:00
B. Petersen 903e2e9084 profile move add member/chat to list 2018-04-20 11:14:10 +02:00
B. Petersen 2fcc37dddb simplify profile enabled cells 2018-04-20 10:45:01 +02:00
B. Petersen 42c588b51d show shared chats in profile 2018-04-20 01:02:10 +02:00
B. Petersen 0d4afae561 refactor 2018-04-19 22:45:08 +02:00
B. Petersen 76e3422acd hack mute icon into the message preview 2018-04-19 22:40:24 +02:00
B. Petersen 4ac2c61556 move mute icon to subtitle-left 2018-04-19 22:18:44 +02:00
B. Petersen ec0a7dc65c show verified icon in chat view right of name 2018-04-19 21:44:42 +02:00
B. Petersen fb5543f31c profile: show verified-check beside name 2018-04-19 18:43:27 +02:00
B. Petersen a7d8c6af0b slightly larger 'verified' icon 2018-04-19 16:37:12 +02:00
B. Petersen 0a65209406 draw verified icon beside name (clashes with the selection checkmark otherwise and looks more familiar) 2018-04-19 15:46:22 +02:00
B. Petersen a5d6150119 use the same buttons in the profile as in the other settings screens 2018-04-19 14:30:23 +02:00
B. Petersen d49e7ad60e simplify UserCell 2018-04-19 14:14:39 +02:00
B. Petersen 989c3985ca let the system decide where to use 'fastScroll' 2018-04-18 21:51:07 +02:00
B. Petersen fb0f4bfc2b Update messenger-backend submodule. 2018-04-18 20:08:42 +02:00
B. Petersen e43e30b61a Update messenger-backend submodule. 2018-04-18 17:49:46 +02:00
B. Petersen 270a695da1 add options to create a verfied group 2018-04-18 17:49:32 +02:00
B. Petersen d80fba84cf wording 2018-04-18 14:09:37 +02:00
B. Petersen e34cd917ea reorder advaced settings 2018-04-18 10:53:58 +02:00
B. Petersen 942770372c wording 2018-04-18 10:48:53 +02:00
B. Petersen b36477c160 explain autocrypt in a few words 2018-04-17 23:11:24 +02:00
B. Petersen c39b16a8d9 update translations 2018-04-17 22:14:03 +02:00
B. Petersen 0583a0582e remove 'key' language from most strings, targets #223 2018-04-17 18:43:38 +02:00
B. Petersen 4a5e563bda update Albanian translation 2018-04-17 18:10:59 +02:00
B. Petersen f314809a06 wording 2018-04-17 18:01:52 +02:00
B. Petersen d561dcb6e6 make 'cannot encrypt' message localizable 2018-04-16 20:14:59 +02:00
B. Petersen 6f88e49cac changelog 2018-04-16 20:14:39 +02:00
Björn Petersen 751fd56b4e Merge pull request #295 from Ampli-fier/master
enable STATIC_LOGIN mech
2018-04-15 21:54:57 +02:00
Ampli-fier b37e7fc9bb enable STATIC_LOGIN mech
enable STATIC_LOGIN mech to make it possible to use the authentication-type PLAIN
2018-04-14 17:07:10 +02:00
B. Petersen 5e61857384 update Dutch translation 2018-04-12 23:13:15 +02:00
B. Petersen aee29ad821 Update messenger-backend submodule. 2018-04-09 18:59:00 +02:00
B. Petersen aad3db6f6a add menu entry to enable/disable the QR code options in the advanced options 2018-04-09 14:12:34 +02:00
B. Petersen 236d54557d Update messenger-backend submodule. 2018-04-07 00:01:17 +02:00
B. Petersen 27cb4328b2 show a checkmark in the avatar of verified contacts 2018-04-07 00:00:52 +02:00
B. Petersen d91c81e0d4 Update messenger-backend submodule. 2018-04-05 22:06:26 +02:00
B. Petersen 6100589818 refactor 2018-04-05 22:06:13 +02:00
B. Petersen 09b848f832 Update messenger-backend submodule. 2018-04-01 23:08:49 +02:00
B. Petersen 14825e97cc make info cells selectable and allow the typical actions 2018-04-01 22:31:24 +02:00
B. Petersen 669d573345 update to new api 2018-04-01 22:00:50 +02:00
B. Petersen 4231b0282f Update messenger-backend submodule. 2018-04-01 21:52:09 +02:00
B. Petersen 43448e286b update to new api 2018-04-01 21:51:51 +02:00
B. Petersen ba6d2a3099 do not show setup message as 'centered status text' 2018-04-01 17:38:58 +02:00
B. Petersen 8f91e14049 update Dutch, Geman, Hungarian, Norwegian, Russian translations 2018-03-31 22:41:52 +02:00
B. Petersen 0bf0d0c316 show system messages centered in the chatlist 2018-03-31 11:14:24 +02:00
B. Petersen b60fd2405a Update messenger-backend submodule. 2018-03-31 00:25:04 +02:00
Björn Petersen a0d4bcc2ac Update CHANGELOG.md 2018-03-30 15:27:09 +02:00
B. Petersen aaec546629 show a toast in the qr activity if someone is joining 2018-03-29 15:02:20 +02:00
B. Petersen 88d45ca86c Update messenger-backend submodule. 2018-03-29 00:48:39 +02:00
B. Petersen 8796e77cc0 Update messenger-backend submodule. 2018-03-29 00:44:19 +02:00
B. Petersen 07f05000b9 Update messenger-backend submodule. 2018-03-28 00:47:41 +02:00
B. Petersen 6beb57a2e7 show oobv errors in a dialog 2018-03-28 00:47:24 +02:00
B. Petersen 75dc23c907 Add Basque translation 2018-03-27 23:11:18 +02:00
B. Petersen a0d0f23548 update translations 2018-03-27 23:10:16 +02:00
Björn Petersen 136ab5ec01 Merge pull request #280 from comradekingu/patch-4
Spelling: ⏎, IF, record, mail server, necessarily
2018-03-27 22:30:47 +02:00
Allan Nordhøy 8578ac67c6 ⏎, IF, record, mail server, necessarily 2018-03-27 21:45:10 +02:00
B. Petersen 53907bb44e add link to LICENSE to readme 2018-03-27 11:33:43 +02:00
B. Petersen e71e67ec6a update Spanish and Polish translations 2018-03-23 21:47:31 +01:00
B. Petersen a91e2dd591 typo 2018-03-23 17:11:51 +01:00
B. Petersen 1980c70bad add transifex configuration file 2018-03-23 00:28:49 +01:00
B. Petersen 97380cd16a fix transifex weired end-of-line 2018-03-22 19:52:44 +01:00
B. Petersen 01844469a0 move standards.md here (from deltachat-pages/en/standards) 2018-03-22 14:57:39 +01:00
B. Petersen aace88ebfa simplify interface 2018-03-21 22:15:19 +01:00
B. Petersen cb323ee444 send the 1st oobv message 2018-03-21 17:56:54 +01:00
B. Petersen 4c35109b9b wait for oobv to finish 2018-03-21 14:25:45 +01:00
B. Petersen efec8c45d9 prepare functionality to join oob-verification 2018-03-21 01:17:33 +01:00
B. Petersen f450b14fa9 add initial Chinese and Japanese translations 2018-03-20 22:00:20 +01:00
B. Petersen 91b1155bd4 show mismatching fingerprints 2018-03-20 21:47:56 +01:00
Björn Petersen 0917c9cd1d Update CHANGELOG.md 2018-03-19 21:49:57 +01:00
B. Petersen 64510a419c typo 2018-03-19 16:24:33 +01:00
B. Petersen c01eab9b00 changelog 2018-03-19 15:36:13 +01:00
B. Petersen 76a1fc4803 changelog 2018-03-19 15:33:51 +01:00
B. Petersen 01e46c72cd typo 2018-03-19 15:32:13 +01:00
B. Petersen 957153e79e bump version 2018-03-19 15:27:32 +01:00
B. Petersen c3d1b6814c Update messenger-backend submodule. 2018-03-19 15:26:07 +01:00
B. Petersen d0672865ce changelog 2018-03-19 15:25:42 +01:00
B. Petersen 74ffbf48be hide qr-code options, you can enabled them by entering '.set qr_enabled 1' into the 'my name' field (a little weired, see #215) 2018-03-19 14:06:19 +01:00
B. Petersen 06cb0ff325 Update messenger-backend submodule. 2018-03-18 22:04:23 +01:00
B. Petersen 5af70bc27c allow formatting the message info dialog 2018-03-18 22:04:06 +01:00
B. Petersen 3240a25aef Update messenger-backend submodule. 2018-03-18 00:44:31 +01:00
B. Petersen 88688e6a81 improve qr code error handling 2018-03-17 22:59:18 +01:00
B. Petersen 081e2b23b1 recognize basic qr codes 2018-03-17 19:29:58 +01:00
B. Petersen cc8e178e85 update Tamil translation 2018-03-15 15:44:31 +01:00
B. Petersen 1411e7be15 Update messenger-backend submodule. 2018-03-15 15:41:51 +01:00
B. Petersen d5c2a8b9fa do not call heartbeat() from the main thread - this retults in massive hangs in the past if the network was down when trying to connect to IMAP 2018-03-15 14:23:17 +01:00
B. Petersen 60b9085237 add option to scan qr code 2018-03-14 20:58:43 +01:00
B. Petersen 828f96a73d add an option to show the fingerprint as an OPENPGP4FPR qr-code 2018-03-14 01:19:18 +01:00
B. Petersen 2b8cb0c495 remove unsed parameter 2018-03-13 19:25:23 +01:00
B. Petersen c0457803c7 update Turkish translation 2018-03-11 22:36:41 +01:00
B. Petersen 3a8b40bfa0 Update messenger-backend submodule. 2018-03-11 22:35:31 +01:00
B. Petersen 8e8ade004c update Russian, Tamil, Turkish translations 2018-03-05 16:31:22 +01:00
B. Petersen bb7452918d Update messenger-backend submodule. 2018-03-02 16:23:12 +01:00
B. Petersen 3731884843 add file 2018-03-02 16:22:48 +01:00
B. Petersen 28f9eca5e4 Update messenger-backend submodule. 2018-03-02 13:40:21 +01:00
Björn Petersen deda874741 Merge pull request #257 from deltachat/fix53
Use new function to create groups directly from the Contact requests
2018-03-02 13:32:02 +01:00
B. Petersen ed4ba18767 adapt chat creation to the new deaddrop behavior 2018-03-01 23:03:55 +01:00
B. Petersen edfbab06db simplify drawing deaddrop-reply button condition 2018-03-01 21:36:33 +01:00
B. Petersen bdee370b7e hide 'please start chatting' hint if the overview shows and empty archived-chats list (may happen when chats are unarchived in subsequent screens) 2018-03-01 00:53:17 +01:00
B. Petersen 27a4b7637d Update messenger-backend submodule. 2018-02-27 12:07:30 +01:00
B. Petersen de524cc9f5 changelog 2018-02-27 11:56:24 +01:00
B. Petersen 274d9b0b8f update Albanian translation 2018-02-27 11:43:13 +01:00
B. Petersen 7af947189b wording 2018-02-27 11:01:54 +01:00
B. Petersen ffce932eb9 add links to the issues that are the reason why we stuck on ndk r14b currently 2018-02-25 17:40:13 +01:00
Ampli-fier 3ecb5a4330 mentioned dependency on NDK Revision 14b 2018-02-25 07:50:55 +01:00
B. Petersen 90cd8838f3 remove dead code 2018-02-23 17:29:56 +01:00
B. Petersen ed5c7e549e Update messenger-backend submodule. 2018-02-23 11:55:28 +01:00
B. Petersen a036d892c5 changelog 2018-02-23 11:54:56 +01:00
B. Petersen de1d3ef2bf bump version 2018-02-23 11:52:03 +01:00
B. Petersen 57f58c5619 typo 2018-02-20 16:09:34 +01:00
B. Petersen fcf2b8c20a changelog 2018-02-20 16:01:48 +01:00
B. Petersen ca1a16671a Update messenger-backend submodule. 2018-02-20 15:57:25 +01:00
B. Petersen 1c52ead6bc Update messenger-backend submodule. 2018-02-20 14:39:51 +01:00
B. Petersen a9e0f6c8c4 bump version 2018-02-20 14:39:34 +01:00
B. Petersen 7d7d2acf76 hide retry button on successful setup code entry 2018-02-20 01:13:52 +01:00
B. Petersen ed6e16581d Update messenger-backend submodule. 2018-02-20 00:54:47 +01:00
B. Petersen 083ecdde1a enable setup message parsing (continue key transfer) 2018-02-20 00:54:11 +01:00
B. Petersen 4e862134ee update Turkish translation 2018-02-15 00:34:20 +01:00
B. Petersen 806574ff8d Update messenger-backend submodule. 2018-02-15 00:33:30 +01:00
B. Petersen d0571160c4 Update messenger-backend submodule. 2018-02-14 15:03:01 +01:00
B. Petersen 5a54cd4b8a Update messenger-backend submodule. 2018-02-12 22:48:51 +01:00
Björn Petersen d1f163050c Merge pull request #251 from Hocceruser/contacts-dialog
Show the PermissionContact dialog only once
2018-02-12 22:33:22 +01:00
Hocceruser 81041c8e89 Revert "Do not show the StoragePermission dialog on startup as this permission is not needed yet (only for chats)"
This reverts commit f3508787b8.
2018-02-12 20:51:35 +01:00
Hocceruser f3508787b8 Do not show the StoragePermission dialog on startup as this permission is not needed yet (only for chats) 2018-02-12 20:49:27 +01:00
Hocceruser 6fec2424db Renamed shared preference "general" to "mainconfig". 2018-02-12 20:29:10 +01:00
Björn Petersen e991a209ea Merge pull request #250 from Hocceruser/patch-1
Do not send messages when there is an access error
2018-02-12 18:53:38 +01:00
Hocceruser 8a85c02aba Show the PermissionContact dialog only once 2018-02-11 19:35:04 +01:00
Hocceruser b9edf88093 Do not send messages when there is an access error 2018-02-11 12:39:05 +01:00
B. Petersen f01fa02082 mention the problems with NDK r16b 2018-02-10 19:40:29 +01:00
B. Petersen 5e495c4757 Update french and Turkish translations 2018-02-08 18:21:08 +01:00
B. Petersen dd21632e35 do not flood the log with errors about missing teslacoilsw-URIs 2018-02-08 18:19:22 +01:00
Ampli-fier 5c4898fff7 minor change 2018-01-23 09:08:41 +01:00
B. Petersen c13a5e9b68 changelog 2018-01-18 17:45:55 +01:00
B. Petersen 3a21f4a6c4 Update messenger-backend submodule. 2018-01-18 17:37:05 +01:00
B. Petersen c02aa85cab bump copyright year 2018-01-18 17:36:42 +01:00
B. Petersen 0e731a954c Update messenger-backend submodule. 2018-01-18 17:27:06 +01:00
B. Petersen 271ff3cbb8 bump version 2018-01-18 17:12:58 +01:00
B. Petersen 5ebebc9c43 update Russian and Turkish translations 2018-01-18 16:21:35 +01:00
B. Petersen 091a31d975 Merge branch 'master' of https://github.com/deltachat/deltachat-android 2018-01-18 16:16:38 +01:00
B. Petersen a505f24aa0 Update messenger-backend submodule. 2018-01-18 16:16:23 +01:00
Ampli-fier c58f2017f6 Add IRC channel info 2018-01-14 22:58:54 +01:00
B. Petersen dc6b32d389 update ilya's intro2 2018-01-11 23:46:38 +01:00
B. Petersen ca23b6e2c5 update ilya's intro icons 2018-01-10 23:16:47 +01:00
B. Petersen c8a0d268f9 add new graphics from ilya 2018-01-10 16:35:33 +01:00
B. Petersen 9110ed7c6c update Norwegian and Russian translations 2018-01-09 22:31:49 +01:00
B. Petersen ecf3330e4c Update messenger-backend submodule. 2018-01-07 22:02:45 +01:00
B. Petersen 6b3ce880c0 changelog 2018-01-07 22:01:14 +01:00
B. Petersen 0bbc7677f6 adapt to new api 2018-01-07 21:30:37 +01:00
Björn Petersen ee185d0f87 Merge pull request #241 from Ampli-fier/master
Notification clickable
2018-01-06 23:29:22 +01:00
Ampli-fier 877ca293a0 Notification clickable
Click on Notification opens Delta Chat
2018-01-06 22:36:21 +01:00
B. Petersen 809185769a Wording 2018-01-06 19:39:14 +01:00
Björn Petersen fac34140e9 Merge pull request #238 from Ampli-fier/master
Update the Notification after import
2018-01-05 15:24:49 +01:00
Ampli-fier ec0fd48a1e Update the Notification after import
"Account not configured" was shown instead of the configured mail address.
2018-01-05 14:50:18 +01:00
B. Petersen 0d6d08b911 show links in system command messages, fixes #237 2018-01-04 18:12:39 +01:00
B. Petersen fd8fb3bd55 Update Italian and Polish translations 2018-01-04 14:12:18 +01:00
B. Petersen 1faaab1f9c changelog 2018-01-03 21:38:46 +01:00
B. Petersen 52b6346f08 Update messenger-backend submodule. 2018-01-03 21:34:51 +01:00
B. Petersen 036cc8a9fa adapt to new c-api 2018-01-03 21:32:46 +01:00
B. Petersen 5db22aa4ad remove superfluous to_id 2018-01-03 14:18:42 +01:00
Björn Petersen 2e1e804e8c Merge pull request #232 from staviss/master
Russian translation correction
2017-12-31 15:00:37 +01:00
B. Petersen 78a865166c Update French, Norwegian, Russian, Albanian, Turkish 2017-12-31 14:58:32 +01:00
staviss 35c9a96c18 Update strings.xml 2017-12-31 15:45:56 +03:00
staviss 3b39ff6649 Update strings.xml 2017-12-30 14:31:38 +03:00
B. Petersen 90722b5ac4 changelog 2017-12-25 23:58:27 +01:00
B. Petersen 12e0ecf347 Bump version 2017-12-19 18:38:14 +01:00
B. Petersen da664bc881 update gradle to avoid error about missing forTask() function, do _not_ update version in build.gradle 2017-12-19 18:37:46 +01:00
B. Petersen ce37da0084 Changelog 2017-12-19 18:17:39 +01:00
B. Petersen fb874d5359 Update messenger-backend submodule. 2017-12-19 18:16:16 +01:00
B. Petersen bdc86b0285 revert gradle changes, this should fix #219 2017-12-19 18:15:59 +01:00
B. Petersen a6d8386b08 take more care on JavaArray<->CArray conversions 2017-12-19 13:11:23 +01:00
B. Petersen b69ca46485 protecting c-pointer-handles from being freed twice. 2017-12-18 17:49:49 +01:00
B. Petersen cb30257b83 Update Albanian, Portuguese, Russian, Turkish and Ukrainian translations 2017-12-18 08:31:06 +01:00
B. Petersen 9123210f69 bump version 2017-12-15 17:27:07 +01:00
B. Petersen 630a259a5a add missing MrLotUnref() function, fixes #218 2017-12-15 17:26:54 +01:00
B. Petersen f0183064ed show a 'not yet implemented' message when trying to enter the setup code 2017-12-15 17:08:28 +01:00
B. Petersen 11bca87a47 update gradle 2017-12-15 08:22:56 +01:00
B. Petersen 3863b74fbd Update messenger-backend submodule. 2017-12-15 01:04:56 +01:00
B. Petersen 8216ce7d20 bump version 2017-12-15 01:02:46 +01:00
B. Petersen a7a06ce26b wording 2017-12-15 00:05:37 +01:00
B. Petersen e9e4c01e54 Update messenger-backend submodule. 2017-12-14 23:59:26 +01:00
B. Petersen 47e2fa4a22 disable entering the setup code, for now 2017-12-14 23:59:07 +01:00
B. Petersen 90fad460a6 changelog 2017-12-14 23:54:41 +01:00
B. Petersen 929962c228 bump version 2017-12-14 23:47:52 +01:00
B. Petersen a55edf0ba0 update gradle, simplify versionCode, add flavorDimensions, fixed #217 2017-12-14 23:40:54 +01:00
B. Petersen e255926e10 allow self talk chats 2017-12-14 23:39:06 +01:00
B. Petersen 21ed3e06e6 update german and polish translations 2017-12-11 22:21:53 +01:00
B. Petersen 2ceffb283f update translations 2017-12-09 16:29:50 +01:00
B. Petersen 2e52bacfba wording 2017-12-09 16:28:13 +01:00
B. Petersen 6c624e93b3 Update messenger-backend submodule. 2017-12-07 16:13:49 +01:00
B. Petersen ee5b2371e0 update jni makefile 2017-12-07 16:13:34 +01:00
B. Petersen 18297213f2 update translations 2017-12-06 16:39:31 +01:00
B. Petersen 1373e46d04 regarding cancel/move events on setup message clicks 2017-12-06 12:58:11 +01:00
B. Petersen d7c6bac301 add a little margin below the last setup code row (for kitkat) 2017-12-06 12:48:27 +01:00
B. Petersen b9e3a5454e update Russian translation 2017-12-06 12:26:21 +01:00
B. Petersen 3decd485ea add an option to retry entering the setup code 2017-12-06 12:24:21 +01:00
B. Petersen 285fcf3df3 Update messenger-backend submodule. 2017-12-06 11:27:10 +01:00
B. Petersen 0312960e93 show a message after entering the setup code 2017-12-06 00:39:07 +01:00
B. Petersen cfee7400c9 update Italian 2017-12-06 00:20:03 +01:00
B. Petersen e113fb0902 add layout file for displaying the setup code entry fields 2017-12-06 00:19:18 +01:00
B. Petersen deedd1acac add ui for entering the setup code 2017-12-06 00:17:40 +01:00
B. Petersen e1d912158d detect clicks on setup messages 2017-12-05 17:30:44 +01:00
B. Petersen 373e15b08a changelog 2017-12-05 16:10:57 +01:00
B. Petersen e2bdb0bf13 do not use a symbol for the enter key; while a good idea, in practise, this creates too much confusion and problems with translations. 2017-12-05 16:03:01 +01:00
B. Petersen 19de16887c fix some string escapes 2017-12-05 15:50:07 +01:00
B. Petersen 8609892116 update Albanian 2017-12-05 15:45:08 +01:00
B. Petersen 76717b908d connect after importing a backup, fixes #213 2017-12-05 15:33:52 +01:00
B. Petersen c57ae9861f do the key transfer in a separate thread 2017-12-05 14:01:48 +01:00
B. Petersen 63a2899fdc hilite setup message 2017-12-04 17:44:05 +01:00
B. Petersen 2d86c5b10b update Albanian translation 2017-12-04 16:31:33 +01:00
B. Petersen bd5ba8ebaf Add Setup Message text 2017-12-03 23:52:51 +01:00
B. Petersen 0e90ea1308 add albanian translation 2017-12-03 16:49:25 +01:00
B. Petersen ec05602bb1 update german translation 2017-12-03 16:47:36 +01:00
B. Petersen 2c55c93367 add ui for initiating autocrypt key transfer 2017-12-03 15:53:59 +01:00
B. Petersen b37a91cdd9 adapt to new imex api 2017-11-30 23:44:46 +01:00
B. Petersen 223c39d26a comment 2017-11-30 14:16:56 +01:00
B. Petersen 0a46073552 comment 2017-11-29 17:55:40 +01:00
B. Petersen 0325c9531f Update messenger-backend submodule. 2017-11-29 17:30:21 +01:00
B. Petersen c4ec5c6e1a comment 2017-11-29 17:21:03 +01:00
B. Petersen b00e35f341 Update Portuguese and Turkish translations 2017-11-29 12:05:27 +01:00
B. Petersen a935425e5d typo 2017-11-29 12:03:29 +01:00
B. Petersen 46fc46ee4f switch to Semantic Versioning, https://semver.org/ 2017-11-26 18:00:38 +01:00
B. Petersen d7fcf9433d Update messenger-backend submodule. 2017-11-26 17:59:10 +01:00
B. Petersen ec921e22e8 adapt to new mrlot_t api 2017-11-24 14:42:56 +01:00
B. Petersen 55bc139c72 adapt to new send api 2017-11-23 17:32:58 +01:00
B. Petersen a5187ed1a2 adapt to new late filing api 2017-11-23 13:31:48 +01:00
B. Petersen a79cbe9804 adapt to new api 2017-11-23 11:44:02 +01:00
B. Petersen dd9d10a991 adapt duration/width to new api 2017-11-22 21:59:04 +01:00
Björn Petersen 3c78f6a82f Update ISSUE_TEMPLATE.md 2017-11-22 20:03:03 +01:00
Björn Petersen 4a30940d54 Merge pull request #206 from Ampli-fier/master
Contributing guidelines and Issue template
2017-11-22 19:54:45 +01:00
B. Petersen 0c0e1a35e2 fix memory leak 2017-11-22 16:52:02 +01:00
B. Petersen 0fe4827214 use core function to get the mime type 2017-11-22 16:45:02 +01:00
B. Petersen 80c8b7ef20 use mrmsg_get_file() function 2017-11-22 15:38:43 +01:00
B. Petersen 93a99cdd2c fix weird return values 2017-11-22 15:29:05 +01:00
B. Petersen 76dfa1fca5 adapt to new forward-check-c-api 2017-11-22 15:18:20 +01:00
B. Petersen ba1c32fe05 adapt to new c-api 2017-11-22 14:34:41 +01:00
B. Petersen 1c77b0bf4e Update messenger-backend submodule. 2017-11-21 23:47:14 +01:00
B. Petersen 31331b958f fix usage of jobject and jclass 2017-11-21 23:46:46 +01:00
B. Petersen 80fc718ec8 adapt to new c-api 2017-11-21 23:42:56 +01:00
B. Petersen 823a1e2197 adapt to new C-API 2017-11-21 23:06:11 +01:00
Ampli-fier 8fad2d0226 Update ISSUE_TEMPLATE.md 2017-11-21 22:29:24 +01:00
Ampli-fier ad69dc4ad4 Update CONTRIBUTING.md 2017-11-21 22:19:38 +01:00
B. Petersen f8f89497a9 Adapt to new C-API 2017-11-21 17:01:34 +01:00
B. Petersen 4272ac7619 Adapt to new C-API. 2017-11-21 16:32:40 +01:00
B. Petersen 3e5da102a5 Update checklist 2017-11-20 23:57:35 +01:00
B. Petersen 51742716ec Changelog 2017-11-20 23:43:59 +01:00
B. Petersen fb7a106617 Update messenger-backend submodule. 2017-11-20 18:19:17 +01:00
B. Petersen c016c728d3 Adapt to new C-API. 2017-11-20 16:24:23 +01:00
Ampli-fier b6c1d4b768 Created CONTRIBUTING.md 2017-11-19 19:48:59 +01:00
Ampli-fier 21cb85ce39 Create ISSUE_TEMPLATE.md 2017-11-19 19:48:09 +01:00
B. Petersen fa9f13bba8 Adapt to new API, use mrarray_t instead of carray 2017-11-19 11:41:20 +01:00
B. Petersen 7feda6323a Bump version 2017-11-18 17:15:16 +01:00
B. Petersen 4cd02a673f Changelog 2017-11-18 17:09:11 +01:00
B. Petersen 22659c35fb Update messenger-backend submodule. 2017-11-18 16:58:47 +01:00
B. Petersen a6f89674b8 Add Serbian translation. 2017-11-18 16:31:33 +01:00
B. Petersen 1bfdbfc00d Show correct hint after chat deletion. 2017-11-17 17:45:20 +01:00
B. Petersen 73686ba57f Comment 2017-11-17 16:22:17 +01:00
B. Petersen c44c78c87d Update strings. 2017-11-17 14:59:17 +01:00
Björn Petersen 371042029f Merge pull request #203 from Ampli-fier/master
Minor corrections to strings.xml
2017-11-17 14:58:04 +01:00
Ampli-fier fa0f66bde2 Minor corrections to strings.xml 2017-11-17 14:40:34 +01:00
B. Petersen 843c5b548e Update checklist. 2017-11-17 13:47:14 +01:00
B. Petersen 06a3a6b285 Add changes from modified PR 191, https://github.com/deltachat/deltachat-android/pull/191/ 2017-11-17 13:32:56 +01:00
B. Petersen d2ac75d526 Comment 2017-11-17 11:47:48 +01:00
B. Petersen 723b56b2d9 Simplify txpull/txpush scripts. 2017-11-17 11:42:41 +01:00
B. Petersen 1910ccff83 Wording 2017-11-17 11:42:09 +01:00
B. Petersen 11e676de2c Move update-core script to tools. 2017-11-17 01:25:51 +01:00
B. Petersen eb2c357868 Update messenger-backend submodule. 2017-11-17 01:25:06 +01:00
B. Petersen 4020b9c086 Fix translation issues. 2017-11-17 01:20:31 +01:00
B. Petersen be0670c592 Add a script to push back to Transifex. 2017-11-17 01:19:44 +01:00
B. Petersen d1786bc9dc Update translations. 2017-11-17 01:05:56 +01:00
B. Petersen 215b834da9 Add a script to pull all translation files from Transifex. 2017-11-17 01:03:27 +01:00
B. Petersen 5e77be8dd0 Update messenger-backend submodule. 2017-11-16 22:32:27 +01:00
B. Petersen 913663743c Bump version 2017-11-16 21:41:33 +01:00
B. Petersen 95786d1268 Update messenger-backend submodule. 2017-11-15 22:41:49 +01:00
B. Petersen cfc69e483e Changelog 2017-11-15 22:33:50 +01:00
B. Petersen 73b59ed4bf Adapt to new synchronous configure function. 2017-11-15 22:28:55 +01:00
B. Petersen e8a996d1f3 Update messenger-backend submodule. 2017-11-15 14:03:54 +01:00
B. Petersen c04ba91b50 Adapt to new blobdir API. 2017-11-15 13:43:07 +01:00
B. Petersen d763be42a1 Adapt to new MR_EVENT_IS_OFFLINE 2017-11-15 13:08:08 +01:00
B. Petersen 10d01b0d68 Adapt configure progress indicator. 2017-11-15 09:45:19 +01:00
B. Petersen 7699c5e63f Bump version 2017-11-14 22:21:34 +01:00
B. Petersen 78a033a221 Changelog 2017-11-14 22:15:08 +01:00
B. Petersen 7f23570160 Update messenger-backend submodule. 2017-11-14 22:10:01 +01:00
B. Petersen a9e1dd7e38 Update messenger-backend submodule. 2017-11-14 20:39:04 +01:00
B. Petersen 058f13f9d8 Show 'Leave groups' menu entry only in groups. 2017-11-14 16:53:25 +01:00
B. Petersen 515fb92873 Update messenger-backend submodule. 2017-11-13 19:25:30 +01:00
B. Petersen abac76125c Adapt to new API. 2017-11-13 19:25:15 +01:00
B. Petersen 149df4e3d7 Adapt to new API. 2017-11-12 23:19:47 +01:00
B. Petersen 0a4796e959 Update messenger-backend submodule. 2017-11-11 12:46:33 +01:00
B. Petersen e79b6d9b1d Adapt to core changes. 2017-11-10 17:18:27 +01:00
B. Petersen af471f4cf8 Adapt getFreshMsgCount() to new core. 2017-11-10 12:25:33 +01:00
B. Petersen 1c97c2e408 Sending messages via MrMailbox instead of MrChat. 2017-11-10 10:54:47 +01:00
B. Petersen 2c34aa83c3 Set os name. 2017-11-07 15:55:06 +01:00
B. Petersen bf93a9e54b Remove mrosnative.c from JNI-wrapper. 2017-11-06 11:30:16 +01:00
B. Petersen c7c3990283 Update messenger-backend submodule. 2017-11-02 23:04:01 +01:00
B. Petersen e4454044f6 Dismissing the contact request popup only marks the messages from the contact in scope as being noticed. 2017-11-02 23:03:15 +01:00
B. Petersen f6ad0f2ee5 Print system messages different from normal messages. 2017-11-02 22:46:31 +01:00
B. Petersen 9abf23073d Add option to block a contact message box that opens when the contact request popup is clicked. 2017-11-02 22:34:04 +01:00
B. Petersen 66253123ad Delete chats directly from the chatlist. Update global search if messages or chats are deleted. 2017-11-02 19:16:19 +01:00
B. Petersen 920a683e9b Do not implicitly leave groups, do not send leave-messages unexpectedly. 2017-11-02 18:20:35 +01:00
B. Petersen a0ce2b5dea Archive chats from chats menu. 2017-11-01 18:27:48 +01:00
B. Petersen be1e1fa3c1 Show 'archived chats' title. 2017-11-01 15:38:29 +01:00
B. Petersen 0a925f8f51 Draw 'Archived' flag. 2017-11-01 14:21:35 +01:00
B. Petersen 2db619e263 Remove dead code. 2017-11-01 13:46:24 +01:00
B. Petersen e75e9410d6 Remove dead code. 2017-11-01 13:37:52 +01:00
B. Petersen bbc09af77b No floating button in archive list. 2017-11-01 13:33:44 +01:00
B. Petersen e3d3f13bef Show archived chats. 2017-11-01 13:13:56 +01:00
B. Petersen affe4ca82e Get rid of global chatlist. 2017-11-01 13:07:17 +01:00
B. Petersen 3b9a2e2d6d Haptical feedback on chatlist longpress. 2017-11-01 07:54:34 +01:00
B. Petersen dff6fedb67 Add option to (un-)archive threads. 2017-10-31 22:05:25 +01:00
B. Petersen 9615a47f03 Possibility to start a chat directly from the deaddrop popup. 2017-10-31 02:54:02 +01:00
B. Petersen 87ae709add Remove dead code. 2017-10-30 09:56:25 +01:00
B. Petersen 80ecd1f697 Update German and Italian translations. 2017-10-29 22:26:08 +01:00
B. Petersen 481b5816b1 Add the deaddrop temporary to the chatlist on new messages from unknown contacts. 2017-10-28 19:33:14 +02:00
B. Petersen 97da31ae2d Init notifications for deaddrop. 2017-10-28 18:37:32 +02:00
B. Petersen 48684bded4 Check vector drawable support on KitKat, see https://stackoverflow.com/questions/37892573/android-vector-drawables-in-support-library-v24-0-0 - seems to work :) 2017-10-28 17:06:54 +02:00
B. Petersen b191ad8b84 Simplify chatlist cell. 2017-10-28 16:52:31 +02:00
B. Petersen 363fa04dca Typo 2017-10-28 16:24:36 +02:00
B. Petersen e8c11aef6e Add Turkish translation. 2017-10-28 16:08:15 +02:00
B. Petersen d0df88b113 Use standard SimpleDateFormat class. 2017-10-28 15:51:11 +02:00
B. Petersen 477f3e638c Use native NumberPicker. 2017-10-28 12:39:47 +02:00
B. Petersen 478e093783 Rework deaddrop line in chatlist. 2017-10-26 22:11:26 +02:00
B. Petersen a7c13e83c9 Refactor Dialogs->Chatlist, prepare showing deaddrop temporary in chatlist. 2017-10-26 18:49:07 +02:00
B. Petersen e9e1db7773 Add Norwegian Bokmål translation and Tamil translations, update Catalan, German, French, Italian, Korean, Dutch, Polish, Portuguese, Russian, Telugu and Ukrainian translations. 2017-10-26 17:02:22 +02:00
B. Petersen f1a2268712 Update messenger-backend submodule. 2017-10-25 21:05:39 +02:00
Björn Petersen d28394d59e Merge pull request #192 from comradekingu/patch-2
linux → Linux, etc
2017-10-25 20:55:11 +02:00
B. Petersen aa5d6d289a Typo 2017-10-25 20:34:26 +02:00
Allan Nordhøy 36f56d557d linux → Linux, etc 2017-10-25 19:22:27 +02:00
B. Petersen e8dcd05f79 Do not show the padlock if end-to-end-encryption is disabled by the user, fixes #190. 2017-10-25 01:49:34 +02:00
B. Petersen b29a50304c Show more detailed reasons about failed end-to-end-encryptions. 2017-10-25 00:23:24 +02:00
B. Petersen 61355499f4 Wording. 2017-10-24 16:23:13 +02:00
B. Petersen 05fd267cb8 Cleanup 2017-10-23 20:26:52 +02:00
B. Petersen 440e3d8a61 Cleanup 2017-10-23 20:24:43 +02:00
B. Petersen ab82ed53e5 Cleanup. 2017-10-23 19:34:03 +02:00
B. Petersen 151c4426ec Update recent emoji view directly; if the recent emoji list is empty, show the first smilies page. 2017-10-23 01:11:01 +02:00
B. Petersen 3c87751491 Rework Emoji code. 2017-10-22 18:03:38 +02:00
B. Petersen 9f93cb8bd8 Rework Emoji code. 2017-10-22 17:53:15 +02:00
B. Petersen 5bf9311371 Cleanup emoji code. 2017-10-22 16:39:56 +02:00
B. Petersen 45fede3a02 Merge com.b44t.messenger and com.b44t.ui. 2017-10-22 13:31:11 +02:00
B. Petersen addadf9634 Cleanup AOSP. 2017-10-22 02:57:52 +02:00
B. Petersen 520a7a6e9e Cleanup 2017-10-22 01:08:17 +02:00
B. Petersen 65eb204ddc Refactor Emoji views. 2017-10-21 19:59:11 +02:00
B. Petersen 6eee460532 Rename Settings*Activity to what they are, a Settings*Fragment. 2017-10-21 17:57:00 +02:00
B. Petersen c85fa85290 Show messages only for explicitly wanted chats. 2017-10-21 02:42:28 +02:00
B. Petersen 39324c6f73 Add copy-to-clipboard function for 'About / Info'. 2017-10-21 01:29:58 +02:00
B. Petersen 9702286e59 Wording (not sure when we parse the status and really show it in the profiles; so we just lower the expectations). 2017-10-18 17:15:19 +02:00
B. Petersen 512acd9fc3 Bump version 2017-10-18 13:44:20 +02:00
B. Petersen 930facc457 Changelog. 2017-10-18 13:27:08 +02:00
B. Petersen 5a428458b5 Show correct export/import done hints. 2017-10-14 16:25:49 +02:00
B. Petersen fa12c90f23 Re-create symbolic links when updating deltachat-core. 2017-10-14 16:00:40 +02:00
B. Petersen 2e16ccb041 Changelog 2017-10-14 02:38:17 +02:00
B. Petersen df7dda0e96 Update messenger-backend submodule. 2017-10-14 02:37:04 +02:00
B. Petersen 28c86b4784 Simplify some AlertDialog.Builder calls. 2017-10-09 17:40:19 +02:00
B. Petersen 175a4ddf95 Bump version. 2017-10-09 16:17:10 +02:00
B. Petersen e4b24b0d99 Typo 2017-10-08 23:26:15 +02:00
B. Petersen 989fcd9564 Update messenger-backend submodule. 2017-10-08 23:22:46 +02:00
B. Petersen 4877ef1407 Changelog. 2017-10-08 23:21:26 +02:00
B. Petersen c1487e3f74 Language fixes. 2017-10-08 23:08:40 +02:00
B. Petersen 6d4650bba9 Update Portuguese. 2017-10-08 23:02:56 +02:00
B. Petersen fb6f02696d Update Italian. 2017-10-08 22:59:56 +02:00
B. Petersen 8ed4abebb7 Update French. 2017-10-08 22:58:45 +02:00
B. Petersen f90de9c0de Update Ukrainian. 2017-10-08 22:57:22 +02:00
B. Petersen 206d2a58d2 Update polish. 2017-10-08 22:55:02 +02:00
B. Petersen 6001d2fb3a Update russian. 2017-10-08 22:53:29 +02:00
B. Petersen 1ceab73dfe Update German. 2017-10-08 22:52:29 +02:00
B. Petersen dc38b949a8 Changelog 2017-10-08 22:52:19 +02:00
B. Petersen 96b740d4da Make exported files visible to USB/MTP. 2017-10-08 21:58:41 +02:00
B. Petersen 1455f7849b The 'Back' button works in the welcome-screen as expected. 2017-10-08 14:01:37 +02:00
B. Petersen 7f14a4da90 Code cleanup. 2017-10-08 12:09:51 +02:00
B. Petersen 0d04064969 Code cleanup. 2017-10-08 12:06:12 +02:00
B. Petersen 37fbda3126 Changelog 2017-10-08 00:23:26 +02:00
B. Petersen 023e62fbd4 Import backups. 2017-10-08 00:22:40 +02:00
B. Petersen b818007398 Update messenger-backend submodule. 2017-10-06 00:58:57 +02:00
B. Petersen 7c1bb82dd4 Prepare import functionality. 2017-10-06 00:58:43 +02:00
B. Petersen e3a6fa4cac Code cleanup. 2017-10-03 22:35:23 +02:00
B. Petersen 6e6aa88b3a Do not query password before import. 2017-10-03 18:12:12 +02:00
B. Petersen c266bd6eba Query password before import. 2017-10-03 14:46:37 +02:00
B. Petersen e383c2b79a Clearify string meaning. 2017-10-03 13:12:34 +02:00
B. Petersen 56a5b23d98 Cleanup 2017-10-03 00:14:41 +02:00
B. Petersen 10eb41aca7 Merge branch 'master' of https://github.com/deltachat/deltachat-android 2017-10-02 21:11:57 +02:00
B. Petersen a0a50e3433 Query password before exporting anything. 2017-10-02 21:11:43 +02:00
Björn Petersen 07449e9018 Merge pull request #171 from Ampli-fier/master
Intro5 Message updates in strings.xml (de)
2017-10-02 16:35:50 +02:00
Ampli-fier 5027373b54 Intro5 Message updates in strings.xml (de)
To align with (coming) web updates
2017-09-30 19:51:24 +02:00
B. Petersen 1d1e08fc15 Add backup function. 2017-09-29 18:30:15 +02:00
Björn Petersen 6eabf32464 Update README.md 2017-09-28 22:04:28 +02:00
B. Petersen acb4a2e5a0 Update messenger-backend submodule. 2017-09-24 21:42:39 +02:00
B. Petersen ba1b5211a2 Try to improve battery usage. 2017-09-24 14:02:29 +02:00
B. Petersen eb8d248fd9 Update messenger-backend submodule. 2017-09-19 11:37:16 +02:00
B. Petersen f248a86ce2 Add C file. 2017-09-19 11:36:26 +02:00
B. Petersen 8e9b55958d Changelog 2017-09-18 00:16:21 +02:00
B. Petersen 6decd0ee76 Changelog 2017-09-12 19:52:52 +02:00
B. Petersen 16384c12c2 Update grade. 2017-09-04 13:18:33 +02:00
B. Petersen 9be5c50e31 Add a section about how to setup a development environment. 2017-09-03 01:50:19 +02:00
B. Petersen 46421d8821 A little hack: Disable sqlite's WAL (Write-ahead-log) as it uses a possibly weired pointer reference to mmap 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) 2017-09-03 01:47:13 +02:00
B. Petersen 13cb356aef Bump version. 2017-09-03 01:44:56 +02:00
B. Petersen b210b72460 APP_PLATFORM android-9 is unsupported. Using minimum supported version android-14 (same as used for the Java part). 2017-09-03 00:30:22 +02:00
B. Petersen 6aa63f48e1 Add URL to default footer. 2017-08-27 14:13:14 +02:00
B. Petersen eaba4a4ab7 Changelog 2017-08-26 13:23:07 +02:00
B. Petersen fbc61bce2a Update messenger-backend submodule. 2017-08-23 21:58:26 +02:00
B. Petersen 5c98e34966 Changelog. 2017-08-23 21:58:00 +02:00
B. Petersen 9b461d372d Update German, Spanish, French, Hungarian, Italian, Polish, Portuguese and Russian translations from Transifex. 2017-08-23 21:48:41 +02:00
B. Petersen b57a81c7c2 Add Catalan translation. 2017-08-23 21:46:46 +02:00
B. Petersen 7cf41805ec Add Telugu translation. 2017-08-23 21:42:29 +02:00
B. Petersen 59efa059fd Add Ukrainian translation. 2017-08-23 21:35:46 +02:00
Björn Petersen e462d66746 Update README.md 2017-08-23 18:50:42 +02:00
Björn Petersen cd0c3f533a Merge pull request #147 from Poussinou/master
Update README.md
2017-08-23 18:49:18 +02:00
B. Petersen 0027b17ef9 Remove badge counter on app restart. 2017-08-23 18:42:06 +02:00
Poussinou 9ee5325f29 Update README.md 2017-07-31 16:34:46 +02:00
B. Petersen ac433edcf8 Do no spread the original authors name nor address when forwarding messages. 2017-07-28 17:56:13 +02:00
B. Petersen f71e7e58e1 Clearify submodule usage. 2017-07-28 14:47:52 +02:00
B. Petersen 4af1e9263a Add submodule hint to readme. 2017-07-28 11:53:36 +02:00
B. Petersen 01d3a75faa Changelog 2017-07-27 10:56:23 +02:00
B. Petersen d015ab4e93 Typo 2017-07-26 22:12:38 +02:00
B. Petersen abcf3600a6 Add 'Blocked users' to advanced settings as it is no preferred way to block users from here or to unblock some. The preferred way is to use the 'Block user' option in the profile of the user to block. 2017-07-26 20:19:19 +02:00
Björn Petersen ac6c497721 Merge pull request #131 from vitalyster/debugkeystore
gradle: use default debug keystore if there is no configured one
2017-07-26 17:38:06 +02:00
Vitaly Takmazov 2dafecc665 gradle: use default debug keystore if there is no configured one 2017-07-26 11:53:57 +03:00
B. Petersen 3a48f0a04a Allow emoticons in avatars. 2017-07-26 01:27:01 +02:00
B. Petersen 1caf3a8956 Explain why debug.keyfile is in separate directory. 2017-07-26 01:00:45 +02:00
B. Petersen ba1dd07b01 Revert "gradle: use default debug keystore path" because it allows using the same debug.keystore file on different machines which is needed to use testing devices with chats wich will be lost when using different debug.keystore files on different developer machines.
This reverts commit e357786980.
2017-07-26 00:48:12 +02:00
Björn Petersen 695a97276f Merge pull request #128 from vitalyster/debugkeystore
gradle: use default debug keystore path
2017-07-26 00:15:04 +02:00
B. Petersen 0d50753754 Cleanup AvatarDrawable code. 2017-07-26 00:06:10 +02:00
Vitaly Takmazov e357786980 gradle: use default debug keystore path 2017-07-25 22:36:32 +03:00
B. Petersen 54ab0ba860 Update messenger-backend submodule. 2017-07-25 21:28:39 +02:00
B. Petersen 44675fffe5 Cleanup code. 2017-07-25 20:04:35 +02:00
B. Petersen e5c6fb0e50 Wording 2017-07-25 15:39:40 +02:00
B. Petersen 82666fb5f0 Ask before deleting the group image. 2017-07-25 15:28:26 +02:00
B. Petersen 9ab86ca310 Use group profile image. 2017-07-22 19:37:35 +02:00
B. Petersen 7153b4c7be Let the user select group images and send message. 2017-07-22 14:47:18 +02:00
B. Petersen e73f4f30cb Add an extra text for 'Group image deleted'. 2017-07-22 14:09:54 +02:00
B. Petersen e365a20d6e Show text 'Group image changed.' beside such action images. 2017-07-22 13:32:58 +02:00
B. Petersen 4a9f9eefd2 Remove dead code. 2017-07-22 12:55:29 +02:00
B. Petersen 2ff632bb87 Do not edit avatar of contact requests & Co. 2017-07-21 17:43:59 +02:00
B. Petersen f5be0708be Add 'Edit image' menu to profile. 2017-07-21 17:32:54 +02:00
B. Petersen 92908ab673 Remove unused resources. 2017-07-21 16:53:33 +02:00
B. Petersen c20f8699f3 Comment 2017-07-21 16:47:30 +02:00
B. Petersen 81e60a3916 Simplify profile animation. 2017-07-21 16:23:19 +02:00
B. Petersen 4f8e25a6c0 Simplify profile animation. 2017-07-21 16:12:26 +02:00
B. Petersen 4038088c5f Remove dead code. 2017-07-21 15:39:47 +02:00
B. Petersen bc972faf2a Allow status text being in the state 'default status'. 2017-07-21 12:29:31 +02:00
B. Petersen 0720fec295 Do not change cursors etc., just use the system defaults. 2017-07-21 02:11:47 +02:00
B. Petersen fba37c7c12 Check for null-pointers. 2017-07-21 01:58:04 +02:00
B. Petersen debaa48e58 Simplify create/rename contact/groups dialogs. 2017-07-21 01:34:22 +02:00
Björn Petersen c4a63657cd Merge pull request #122 from deltachat/newstatus
Newstatus
2017-07-20 21:55:38 +02:00
Björn Petersen a723783c01 Update README.md 2017-07-20 21:00:38 +02:00
B. Petersen 26a922e16a Remove avatar from group creation (This and other secondary settings can be done in the group profile later). 2017-07-17 14:31:28 +02:00
B. Petersen 9a20d33d55 Remove unused resources. 2017-07-17 13:32:14 +02:00
B. Petersen 3abe9946d4 Make status text editable. 2017-07-17 00:40:35 +02:00
B. Petersen dcf4857b6e Remove tablet conditions from launcher.
Remove some isTablet()-calls.

Remove rest isTablet() code.
2017-07-16 22:01:06 +02:00
B. Petersen 701ae43bd6 Remove drawer functionality.
Remove open/close drawer functions.

Remove MenuDrawable.

Remove DrawerLayoutContainer.drawChild(), not sure, if this is needed.

Remove DrawerLayoutAdapter.

Remove menu_shadow drawable.

Cleanup drawer drawing.

Remove ManageSpaceActivity.

Rename DrawerProfileCell to SettingsProfileCell.

Remove title overlay.

Remove drawer from action bar.

Rename DrawerLayoutContainer to LaunchLayoutContainer.

Add LaunchLayoutContainer file.
2017-07-15 19:48:28 +02:00
B. Petersen cb67d0a45b Changelog. 2017-07-15 13:10:41 +02:00
B. Petersen 1684bc3acc Bump version. 2017-07-14 13:52:55 +02:00
B. Petersen ee32ef2f09 Update messenger-backend submodule. 2017-07-13 23:32:56 +02:00
B. Petersen c9ed86a81a Update Polish. 2017-07-13 23:30:50 +02:00
B. Petersen 8421e85229 Wording. 2017-07-13 23:12:15 +02:00
B. Petersen 0b2eead1be Changelog 2017-07-13 18:16:36 +02:00
B. Petersen 0d30d4a4f3 Changelog 2017-07-12 18:16:43 +02:00
B. Petersen ac55638e46 Update Portuguese. 2017-07-07 13:48:13 +02:00
B. Petersen e57c45da71 Rename 'Read receipt' to 'MDN'. 2017-07-05 17:00:27 +02:00
B. Petersen 4b93e2e57c Wording 2017-07-05 14:08:55 +02:00
B. Petersen 2bab5a65f4 Localize. 2017-07-04 23:07:41 +02:00
B. Petersen 66f379f80b Move MIME creation to new mrmimefactory class. 2017-07-04 01:40:32 +02:00
B. Petersen 4a8749349f Changing incoming message states from unseen/seen to fresh/noticed/seen. 2017-07-03 23:35:16 +02:00
B. Petersen 54fe2accb6 Wording 2017-06-29 22:27:40 +02:00
B. Petersen ec21b57106 Request read receipts. 2017-06-29 16:39:29 +02:00
B. Petersen 9e62523b6d Bump version. 2017-06-29 14:24:00 +02:00
B. Petersen 2b69ba5716 Correct russian plural forms, thanks to @guland2000 2017-06-29 00:51:25 +02:00
B. Petersen dadfecf8f3 Changelog. 2017-06-28 18:48:04 +02:00
337 changed files with 13520 additions and 21483 deletions
+25
View File
@@ -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).
+34
View File
@@ -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.
+3
View File
@@ -9,3 +9,6 @@ libs/
# ignore private scripts and directories, eg. local2github.prv.sh
*.prv*
# transifex temporary files
tools/translations/
+192
View File
@@ -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
+16 -9
View File
@@ -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
}
}
+14 -3
View File
@@ -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 -1
View File
@@ -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 */
File diff suppressed because it is too large Load Diff
+17 -10
View File
@@ -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"
@@ -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);
@@ -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;
@@ -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 ) {
@@ -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() {
@@ -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;
@@ -21,7 +21,7 @@
******************************************************************************/
package com.b44t.ui.ActionBar;
package com.b44t.messenger.ActionBar;
import android.graphics.Canvas;
import android.graphics.Color;
@@ -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) {
@@ -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));
@@ -21,7 +21,7 @@
******************************************************************************/
package com.b44t.ui.ActionBar;
package com.b44t.messenger.ActionBar;
import android.content.Context;
import android.graphics.Canvas;
@@ -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
@@ -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();
}
}
@@ -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;
}
@@ -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 {
@@ -21,7 +21,7 @@
******************************************************************************/
package com.b44t.ui.Cells;
package com.b44t.messenger.Cells;
import android.content.Context;
import android.graphics.drawable.Drawable;
@@ -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 {
@@ -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) {
@@ -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 {
@@ -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
@@ -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) {
@@ -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;
@@ -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));
}
@@ -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 {
@@ -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 {
@@ -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();
@@ -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 {
@@ -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 {
@@ -21,7 +21,7 @@
******************************************************************************/
package com.b44t.ui.Cells;
package com.b44t.messenger.Cells;
import android.content.Context;
import android.view.View;
@@ -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 {
@@ -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 {
@@ -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 {
@@ -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);
@@ -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;
@@ -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);
@@ -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 {
@@ -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
@@ -21,7 +21,7 @@
******************************************************************************/
package com.b44t.ui.Components;
package com.b44t.messenger.Components;
import android.graphics.Bitmap;
import android.graphics.BitmapShader;
@@ -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
@@ -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;
@@ -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);
}
}
@@ -21,7 +21,7 @@
******************************************************************************/
package com.b44t.ui.Adapters;
package com.b44t.messenger.Components;
import android.database.DataSetObserver;
import android.view.View;
@@ -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 {
@@ -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;
@@ -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;
}
}
@@ -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);
}
@@ -21,7 +21,7 @@
******************************************************************************/
package com.b44t.ui.Components;
package com.b44t.messenger.Components;
import android.animation.ObjectAnimator;
import android.content.Context;
@@ -21,7 +21,7 @@
******************************************************************************/
package com.b44t.ui.Components;
package com.b44t.messenger.Components;
import android.graphics.Paint;
import android.graphics.drawable.Drawable;
@@ -21,7 +21,7 @@
******************************************************************************/
package com.b44t.ui.Components;
package com.b44t.messenger.Components;
import android.content.Context;
import android.graphics.Bitmap;
@@ -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;
@@ -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 {
@@ -21,7 +21,7 @@
******************************************************************************/
package com.b44t.ui.Components;
package com.b44t.messenger.Components;
import android.annotation.SuppressLint;
import android.app.Activity;
@@ -21,7 +21,7 @@
******************************************************************************/
package com.b44t.ui.Components;
package com.b44t.messenger.Components;
import android.widget.FrameLayout;
import android.widget.LinearLayout;
@@ -21,7 +21,7 @@
******************************************************************************/
package com.b44t.ui.Components;
package com.b44t.messenger.Components;
import android.graphics.Path;
import android.text.StaticLayout;
@@ -21,7 +21,7 @@
******************************************************************************/
package com.b44t.ui.Components;
package com.b44t.messenger.Components;
import android.animation.Animator;
import android.animation.ObjectAnimator;
@@ -21,7 +21,7 @@
******************************************************************************/
package com.b44t.ui.Components;
package com.b44t.messenger.Components;
import android.content.Context;
import android.graphics.Canvas;
@@ -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();
@@ -21,7 +21,7 @@
******************************************************************************/
package com.b44t.ui.Components;
package com.b44t.messenger.Components;
import android.content.Context;
import android.graphics.Bitmap;
@@ -21,7 +21,7 @@
******************************************************************************/
package com.b44t.ui.Components;
package com.b44t.messenger.Components;
import android.content.Context;
import android.graphics.Canvas;
@@ -21,7 +21,7 @@
******************************************************************************/
package com.b44t.ui.Components;
package com.b44t.messenger.Components;
import android.content.Context;
import android.graphics.Canvas;
@@ -21,7 +21,7 @@
******************************************************************************/
package com.b44t.ui.Components;
package com.b44t.messenger.Components;
import android.annotation.SuppressLint;
import android.content.Context;
@@ -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
@@ -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 {
@@ -21,7 +21,7 @@
******************************************************************************/
package com.b44t.ui.Components;
package com.b44t.messenger.Components;
public class Point {
public float x;
@@ -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 {
@@ -21,7 +21,7 @@
******************************************************************************/
package com.b44t.ui.Components;
package com.b44t.messenger.Components;
public class Rect {
@@ -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;
@@ -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;
@@ -21,7 +21,7 @@
******************************************************************************/
package com.b44t.ui.Components;
package com.b44t.messenger.Components;
import android.content.Context;
import android.graphics.Canvas;
@@ -21,7 +21,7 @@
******************************************************************************/
package com.b44t.ui.Components;
package com.b44t.messenger.Components;
import android.content.Context;
import android.graphics.Canvas;
@@ -21,7 +21,7 @@
******************************************************************************/
package com.b44t.ui.Components;
package com.b44t.messenger.Components;
public class Size {
public float width;
@@ -21,7 +21,7 @@
******************************************************************************/
package com.b44t.ui.Components;
package com.b44t.messenger.Components;
import android.content.Context;
import android.graphics.Canvas;
@@ -21,7 +21,7 @@
******************************************************************************/
package com.b44t.ui.Components;
package com.b44t.messenger.Components;
import android.content.Context;
import android.graphics.Rect;
@@ -21,7 +21,7 @@
******************************************************************************/
package com.b44t.ui.Components;
package com.b44t.messenger.Components;
import android.os.Build;
import android.text.Layout;
@@ -21,7 +21,7 @@
******************************************************************************/
package com.b44t.ui.Components;
package com.b44t.messenger.Components;
import android.graphics.Paint;
import android.graphics.Typeface;
@@ -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 {
@@ -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) {
}
}
@@ -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) {
;
@@ -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);
}
}
@@ -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