mirror of
https://github.com/ArcaneChat/android.git
synced 2026-07-03 14:05:24 +02:00
Compare commits
300 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| ce37da0084 | |||
| fb874d5359 | |||
| bdc86b0285 | |||
| a6d8386b08 | |||
| b69ca46485 | |||
| cb30257b83 | |||
| 9123210f69 | |||
| 630a259a5a | |||
| f0183064ed | |||
| 11bca87a47 | |||
| 3863b74fbd | |||
| 8216ce7d20 | |||
| a7a06ce26b | |||
| e9e4c01e54 | |||
| 47e2fa4a22 | |||
| 90fad460a6 | |||
| 929962c228 | |||
| a55edf0ba0 | |||
| e255926e10 | |||
| 21ed3e06e6 | |||
| 2ceffb283f | |||
| 2e52bacfba | |||
| 6c624e93b3 | |||
| ee5b2371e0 | |||
| 18297213f2 | |||
| 1373e46d04 | |||
| d7c6bac301 | |||
| b9e3a5454e | |||
| 3decd485ea | |||
| 285fcf3df3 | |||
| 0312960e93 | |||
| cfee7400c9 | |||
| e113fb0902 | |||
| deedd1acac | |||
| e1d912158d | |||
| 373e15b08a | |||
| e2bdb0bf13 | |||
| 19de16887c | |||
| 8609892116 | |||
| 76717b908d | |||
| c57ae9861f | |||
| 63a2899fdc | |||
| 2d86c5b10b | |||
| bd5ba8ebaf | |||
| 0e90ea1308 | |||
| ec05602bb1 | |||
| 2c55c93367 | |||
| b37a91cdd9 | |||
| 223c39d26a | |||
| 0a46073552 | |||
| 0325c9531f | |||
| c4ec5c6e1a | |||
| b00e35f341 | |||
| a935425e5d | |||
| 46fc46ee4f | |||
| d7fcf9433d | |||
| ec921e22e8 | |||
| 55bc139c72 | |||
| a5187ed1a2 | |||
| a79cbe9804 | |||
| dd9d10a991 | |||
| 3c78f6a82f | |||
| 4a30940d54 | |||
| 0c0e1a35e2 | |||
| 0fe4827214 | |||
| 80c8b7ef20 | |||
| 93a99cdd2c | |||
| 76dfa1fca5 | |||
| ba1c32fe05 | |||
| 1c77b0bf4e | |||
| 31331b958f | |||
| 80fc718ec8 | |||
| 823a1e2197 | |||
| 8fad2d0226 | |||
| ad69dc4ad4 | |||
| f8f89497a9 | |||
| 4272ac7619 | |||
| 3e5da102a5 | |||
| 51742716ec | |||
| fb7a106617 | |||
| c016c728d3 | |||
| b6c1d4b768 | |||
| 21cb85ce39 | |||
| fa9f13bba8 | |||
| 7feda6323a | |||
| 4cd02a673f | |||
| 22659c35fb | |||
| a6f89674b8 | |||
| 1bfdbfc00d | |||
| 73686ba57f | |||
| c44c78c87d | |||
| 371042029f | |||
| fa0f66bde2 | |||
| 843c5b548e | |||
| 06a3a6b285 | |||
| d2ac75d526 | |||
| 723b56b2d9 | |||
| 1910ccff83 | |||
| 11e676de2c | |||
| eb2c357868 | |||
| 4020b9c086 | |||
| be0670c592 | |||
| d1786bc9dc | |||
| 215b834da9 | |||
| 5e77be8dd0 | |||
| 913663743c | |||
| 95786d1268 | |||
| cfc69e483e | |||
| 73b59ed4bf | |||
| e8a996d1f3 | |||
| c04ba91b50 | |||
| d763be42a1 | |||
| 10d01b0d68 | |||
| 7699c5e63f | |||
| 78a033a221 | |||
| 7f23570160 | |||
| a9e1dd7e38 | |||
| 058f13f9d8 | |||
| 515fb92873 | |||
| abac76125c | |||
| 149df4e3d7 | |||
| 0a4796e959 | |||
| e79b6d9b1d | |||
| af471f4cf8 | |||
| 1c97c2e408 | |||
| 2c34aa83c3 | |||
| bf93a9e54b | |||
| c7c3990283 | |||
| e4454044f6 | |||
| f6ad0f2ee5 | |||
| 9abf23073d | |||
| 66253123ad | |||
| 920a683e9b | |||
| a0ce2b5dea | |||
| be1e1fa3c1 | |||
| 0a925f8f51 | |||
| 2db619e263 | |||
| e75e9410d6 | |||
| bbc09af77b | |||
| e3d3f13bef | |||
| affe4ca82e | |||
| 3b9a2e2d6d | |||
| dff6fedb67 | |||
| 9615a47f03 | |||
| 87ae709add | |||
| 80ecd1f697 | |||
| 481b5816b1 | |||
| 97da31ae2d | |||
| 48684bded4 | |||
| b191ad8b84 | |||
| 363fa04dca | |||
| e8c11aef6e | |||
| d0df88b113 | |||
| 477f3e638c | |||
| 478e093783 | |||
| a7c13e83c9 | |||
| e9e1db7773 | |||
| f1a2268712 | |||
| d28394d59e | |||
| aa5d6d289a | |||
| 36f56d557d | |||
| e8dcd05f79 | |||
| b29a50304c | |||
| 61355499f4 | |||
| 05fd267cb8 | |||
| 440e3d8a61 | |||
| ab82ed53e5 | |||
| 151c4426ec | |||
| 3c87751491 | |||
| 9f93cb8bd8 | |||
| 5bf9311371 | |||
| 45fede3a02 | |||
| addadf9634 | |||
| 520a7a6e9e | |||
| 65eb204ddc | |||
| 6eee460532 | |||
| c85fa85290 | |||
| 39324c6f73 | |||
| 9702286e59 | |||
| 512acd9fc3 | |||
| 930facc457 | |||
| 5a428458b5 | |||
| fa12c90f23 | |||
| 2e16ccb041 | |||
| df7dda0e96 | |||
| 28c86b4784 | |||
| 175a4ddf95 | |||
| e4b24b0d99 | |||
| 989fcd9564 | |||
| 4877ef1407 | |||
| c1487e3f74 | |||
| 6d4650bba9 | |||
| fb6f02696d | |||
| 8ed4abebb7 | |||
| f90de9c0de | |||
| 206d2a58d2 | |||
| 6001d2fb3a | |||
| 1ceab73dfe | |||
| dc38b949a8 | |||
| 96b740d4da | |||
| 1455f7849b | |||
| 7f14a4da90 | |||
| 0d04064969 | |||
| 37fbda3126 | |||
| 023e62fbd4 | |||
| b818007398 | |||
| 7c1bb82dd4 | |||
| e3a6fa4cac | |||
| 6e6aa88b3a | |||
| c266bd6eba | |||
| e383c2b79a | |||
| 56a5b23d98 | |||
| 10eb41aca7 | |||
| a0a50e3433 | |||
| 07449e9018 | |||
| 5027373b54 | |||
| 1d1e08fc15 | |||
| 6eabf32464 | |||
| acb4a2e5a0 | |||
| ba1b5211a2 | |||
| eb8d248fd9 | |||
| f248a86ce2 | |||
| 8e9b55958d | |||
| 6decd0ee76 | |||
| 16384c12c2 | |||
| 9be5c50e31 | |||
| 46421d8821 | |||
| 13cb356aef | |||
| b210b72460 | |||
| 6aa63f48e1 | |||
| eaba4a4ab7 | |||
| fbc61bce2a | |||
| 5c98e34966 | |||
| 9b461d372d | |||
| b57a81c7c2 | |||
| 7cf41805ec | |||
| 59efa059fd | |||
| e462d66746 | |||
| cd0c3f533a | |||
| 0027b17ef9 | |||
| 9ee5325f29 | |||
| ac433edcf8 | |||
| f71e7e58e1 | |||
| 4af1e9263a | |||
| 01d3a75faa | |||
| d015ab4e93 | |||
| abcf3600a6 | |||
| ac6c497721 | |||
| 2dafecc665 | |||
| 3a48f0a04a | |||
| 1caf3a8956 | |||
| ba1dd07b01 | |||
| 695a97276f | |||
| 0d50753754 | |||
| e357786980 | |||
| 54ab0ba860 | |||
| 44675fffe5 | |||
| e5c6fb0e50 | |||
| 82666fb5f0 | |||
| 9ab86ca310 | |||
| 7153b4c7be | |||
| e73f4f30cb | |||
| e365a20d6e | |||
| 4a9f9eefd2 | |||
| 2ff632bb87 | |||
| f5be0708be | |||
| 92908ab673 | |||
| c20f8699f3 | |||
| 81e60a3916 | |||
| 4f8e25a6c0 | |||
| 4038088c5f | |||
| bc972faf2a | |||
| 0720fec295 | |||
| fba37c7c12 | |||
| debaa48e58 | |||
| c4a63657cd | |||
| a723783c01 | |||
| 26a922e16a | |||
| 9a20d33d55 | |||
| 3abe9946d4 | |||
| dcf4857b6e | |||
| 701ae43bd6 | |||
| cb67d0a45b | |||
| 1684bc3acc | |||
| ee32ef2f09 | |||
| c9ed86a81a | |||
| 8421e85229 | |||
| 0b2eead1be | |||
| 0d30d4a4f3 | |||
| ac55638e46 | |||
| e57c45da71 | |||
| 4b93e2e57c | |||
| 2bab5a65f4 | |||
| 66f379f80b | |||
| 4a8749349f | |||
| 54fe2accb6 | |||
| ec21b57106 | |||
| 9e62523b6d | |||
| 2b69ba5716 | |||
| dadfecf8f3 |
@@ -0,0 +1,23 @@
|
||||
# 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. We will move the issue if necessary.
|
||||
|
||||
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?
|
||||
@@ -0,0 +1,34 @@
|
||||
_Please read the guidelines linked above, especially when you are a first time contributor. Remove this text and provide some basic informations below, if applicable. Remove template content that is not applicable._
|
||||
|
||||
**Delta Chat version**
|
||||
|
||||
See settings dialog …
|
||||
|
||||
**Expected behavior**
|
||||
|
||||
What is the expected output?
|
||||
|
||||
**Actual behavior**
|
||||
|
||||
What do you see instead?
|
||||
|
||||
**Steps to reproduce the problem**
|
||||
|
||||
1. …
|
||||
2. …
|
||||
|
||||
**Screen snapshots**
|
||||
|
||||
If applicable …
|
||||
|
||||
**Debug logs**
|
||||
|
||||
If applicable, debug logs can be copied from within the Delta Chat app:
|
||||
|
||||
Open the _Settings_ menu -> _About_ -> _version number|Info_.
|
||||
|
||||
Alternatively from the Android system log:
|
||||
|
||||
` adb logcat -v time -s DeltaChat `
|
||||
|
||||
This log contains private data (e.g. mail address, provider information) which shall be removed or anonymised prior to posting.
|
||||
@@ -9,3 +9,7 @@ libs/
|
||||
|
||||
# ignore private scripts and directories, eg. local2github.prv.sh
|
||||
*.prv*
|
||||
|
||||
# transifex temporary files
|
||||
tools/.tx/
|
||||
tools/translations/
|
||||
|
||||
@@ -1,5 +1,97 @@
|
||||
# Delta Chat Changelog
|
||||
|
||||
## v0.11.3
|
||||
2017-12-17
|
||||
|
||||
* Add option to initiate Autocrypt Key Transfer
|
||||
* Connect after importing a backup
|
||||
* Add Albanian translation
|
||||
* Update Albanian, 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 +102,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
|
||||
|
||||
|
||||
@@ -31,8 +31,8 @@ dependencies {
|
||||
}
|
||||
|
||||
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 +48,10 @@ android {
|
||||
|
||||
signingConfigs {
|
||||
debug {
|
||||
storeFile file("config/debug.keystore")
|
||||
def debugKeystore = file("config/debug.keystore")
|
||||
if (debugKeystore.exists()) {
|
||||
storeFile debugKeystore
|
||||
}
|
||||
}
|
||||
|
||||
release {
|
||||
@@ -76,13 +79,12 @@ android {
|
||||
}
|
||||
}
|
||||
|
||||
defaultConfig.versionCode = 41
|
||||
|
||||
sourceSets.main {
|
||||
jniLibs.srcDir 'libs'
|
||||
jni.srcDirs = [] //disable automatic ndk-build call
|
||||
}
|
||||
|
||||
flavorDimensions "none"
|
||||
productFlavors {
|
||||
/*
|
||||
x86 {
|
||||
@@ -105,19 +107,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.11.3" // do NOT forget to increase defaultConfig.versionCode!
|
||||
versionCode 508
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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,36 @@ 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_e2ee.c \
|
||||
./messenger-backend/src/mrmailbox_imex.c \
|
||||
./messenger-backend/src/mrmailbox_log.c \
|
||||
./messenger-backend/src/mrmailbox_tools.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/mrtools.c \
|
||||
./messenger-backend/cmdline/cmdline.c \
|
||||
./mrwrapper.c
|
||||
|
||||
include $(BUILD_SHARED_LIBRARY)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
APP_PLATFORM := android-9
|
||||
APP_PLATFORM := android-14
|
||||
APP_ABI := armeabi armeabi-v7a x86
|
||||
NDK_TOOLCHAIN_VERSION := 4.9
|
||||
APP_STL := gnustl_static
|
||||
|
||||
Submodule MessengerProj/jni/messenger-backend updated: aae712fcb8...32f7796cac
+346
-172
@@ -28,6 +28,7 @@
|
||||
#include <jni.h>
|
||||
#include <android/log.h>
|
||||
#include "messenger-backend/src/mrmailbox.h"
|
||||
#include "messenger-backend/cmdline/cmdline.h"
|
||||
|
||||
|
||||
#define CHAR_REF(a) \
|
||||
@@ -116,15 +117,17 @@ void mrosnative_unsetup_thread(mrmailbox_t* mailbox)
|
||||
|
||||
/* tools */
|
||||
|
||||
static jintArray carray2jintArray_n_carray_free(JNIEnv *env, const carray* ca)
|
||||
static jintArray mrarray2jintArray_n_mrarray_unref(JNIEnv *env, mrarray_t* ca)
|
||||
{
|
||||
int i, icnt = ca? carray_count(ca) : 0;
|
||||
/* takes a C-array of type mrarray_t and converts it it a Java-Array.
|
||||
then the C-array is freed and the Java-Array is returned. */
|
||||
int i, icnt = ca? mrarray_get_cnt(ca) : 0;
|
||||
jintArray ret = (*env)->NewIntArray(env, icnt); if (ret == NULL) { return NULL; }
|
||||
|
||||
if( ca ) {
|
||||
if( icnt ) {
|
||||
void** ca_data = carray_data(ca);
|
||||
if( sizeof(void*)==sizeof(jint) ) {
|
||||
uintptr_t* ca_data = ca->m_array;
|
||||
if( sizeof(uintptr_t)==sizeof(jint) ) {
|
||||
(*env)->SetIntArrayRegion(env, ret, 0, icnt, (jint*)ca_data);
|
||||
}
|
||||
else {
|
||||
@@ -136,7 +139,7 @@ static jintArray carray2jintArray_n_carray_free(JNIEnv *env, const carray* ca)
|
||||
free(temp);
|
||||
}
|
||||
}
|
||||
carray_free(ca);
|
||||
mrarray_unref(ca);
|
||||
}
|
||||
|
||||
return ret;
|
||||
@@ -145,7 +148,10 @@ static jintArray carray2jintArray_n_carray_free(JNIEnv *env, const carray* ca)
|
||||
|
||||
static uint32_t* jintArray2uint32Pointer(JNIEnv* env, jintArray ja, int* ret_icnt)
|
||||
{
|
||||
/* takes a Java-Array and converts it to a C-Array. */
|
||||
uint32_t* ret = NULL;
|
||||
if( ret_icnt ) { *ret_icnt = 0; }
|
||||
|
||||
if( env && ja && ret_icnt )
|
||||
{
|
||||
int i, icnt = (*env)->GetArrayLength(env, ja);
|
||||
@@ -166,6 +172,7 @@ static uint32_t* jintArray2uint32Pointer(JNIEnv* env, jintArray ja, int* ret_icn
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -223,7 +230,7 @@ static uintptr_t s_mailbox_callback_(mrmailbox_t* mailbox, int event, uintptr_t
|
||||
JNIEXPORT jlong Java_com_b44t_messenger_MrMailbox_MrMailboxNew(JNIEnv *env, jclass c)
|
||||
{
|
||||
s_init_globals(env, c);
|
||||
return (jlong)mrmailbox_new(s_mailbox_callback_, NULL);
|
||||
return (jlong)mrmailbox_new(s_mailbox_callback_, NULL, "Android");
|
||||
}
|
||||
|
||||
|
||||
@@ -246,20 +253,20 @@ JNIEXPORT void Java_com_b44t_messenger_MrMailbox_close(JNIEnv *env, jclass cls)
|
||||
|
||||
JNIEXPORT jstring Java_com_b44t_messenger_MrMailbox_getBlobdir(JNIEnv *env, jclass cls)
|
||||
{
|
||||
mrmailbox_t* ths = get_mrmailbox_t(env, cls);
|
||||
return JSTRING_NEW((ths&&ths->m_blobdir)? ths->m_blobdir : NULL);
|
||||
mrmailbox_t* ths = get_mrmailbox_t(env, cls); if( ths == NULL ) { return JSTRING_NEW(NULL); }
|
||||
return JSTRING_NEW(ths->m_blobdir);
|
||||
}
|
||||
|
||||
|
||||
JNIEXPORT void Java_com_b44t_messenger_MrMailbox_configureAndConnect(JNIEnv *env, jclass cls)
|
||||
JNIEXPORT jint Java_com_b44t_messenger_MrMailbox_configureAndConnect(JNIEnv *env, jclass cls)
|
||||
{
|
||||
mrmailbox_configure_and_connect(get_mrmailbox_t(env, cls));
|
||||
return (jint)mrmailbox_configure_and_connect(get_mrmailbox_t(env, cls));
|
||||
}
|
||||
|
||||
|
||||
JNIEXPORT void Java_com_b44t_messenger_MrMailbox_configureCancel(JNIEnv *env, jclass cls)
|
||||
JNIEXPORT void Java_com_b44t_messenger_MrMailbox_stopOngoingProcess(JNIEnv *env, jclass cls)
|
||||
{
|
||||
mrmailbox_configure_cancel(get_mrmailbox_t(env, cls));
|
||||
mrmailbox_stop_ongoing_process(get_mrmailbox_t(env, cls));
|
||||
}
|
||||
|
||||
|
||||
@@ -286,9 +293,9 @@ JNIEXPORT void Java_com_b44t_messenger_MrMailbox_disconnect(JNIEnv *env, jclass
|
||||
JNIEXPORT jintArray Java_com_b44t_messenger_MrMailbox_getKnownContacts(JNIEnv *env, jclass cls, jstring query)
|
||||
{
|
||||
CHAR_REF(query);
|
||||
carray* ca = mrmailbox_get_known_contacts(get_mrmailbox_t(env, cls), queryPtr);
|
||||
mrarray_t* ca = mrmailbox_get_known_contacts(get_mrmailbox_t(env, cls), queryPtr);
|
||||
CHAR_UNREF(query);
|
||||
return carray2jintArray_n_carray_free(env, ca);
|
||||
return mrarray2jintArray_n_mrarray_unref(env, ca);
|
||||
}
|
||||
|
||||
|
||||
@@ -300,8 +307,8 @@ JNIEXPORT jint Java_com_b44t_messenger_MrMailbox_getBlockedCount(JNIEnv *env, jc
|
||||
|
||||
JNIEXPORT jintArray Java_com_b44t_messenger_MrMailbox_getBlockedContacts(JNIEnv *env, jclass cls)
|
||||
{
|
||||
carray* ca = mrmailbox_get_blocked_contacts(get_mrmailbox_t(env, cls));
|
||||
return carray2jintArray_n_carray_free(env, ca);
|
||||
mrarray_t* ca = mrmailbox_get_blocked_contacts(get_mrmailbox_t(env, cls));
|
||||
return mrarray2jintArray_n_mrarray_unref(env, ca);
|
||||
}
|
||||
|
||||
|
||||
@@ -322,9 +329,9 @@ JNIEXPORT jint Java_com_b44t_messenger_MrMailbox_MrMailboxCreateContact(JNIEnv *
|
||||
}
|
||||
|
||||
|
||||
JNIEXPORT jint Java_com_b44t_messenger_MrMailbox_MrMailboxBlockContact(JNIEnv *env, jclass c, jlong hMailbox, jint contact_id, jint block)
|
||||
JNIEXPORT void Java_com_b44t_messenger_MrMailbox_MrMailboxBlockContact(JNIEnv *env, jclass c, jlong hMailbox, jint contact_id, jint block)
|
||||
{
|
||||
return (jint)mrmailbox_block_contact((mrmailbox_t*)hMailbox, contact_id, block);
|
||||
mrmailbox_block_contact((mrmailbox_t*)hMailbox, contact_id, block);
|
||||
}
|
||||
|
||||
|
||||
@@ -336,16 +343,16 @@ JNIEXPORT jint Java_com_b44t_messenger_MrMailbox_MrMailboxDeleteContact(JNIEnv *
|
||||
|
||||
/* MrMailbox - handle chats */
|
||||
|
||||
JNIEXPORT jlong Java_com_b44t_messenger_MrMailbox_MrMailboxGetChatlist(JNIEnv *env, jclass c, jlong hMailbox, jstring query)
|
||||
JNIEXPORT jlong Java_com_b44t_messenger_MrMailbox_MrMailboxGetChatlist(JNIEnv *env, jclass c, jlong hMailbox, jint listflags, jstring query)
|
||||
{
|
||||
jlong ret;
|
||||
if( query ) {
|
||||
CHAR_REF(query);
|
||||
ret = (jlong)mrmailbox_get_chatlist((mrmailbox_t*)hMailbox, queryPtr);
|
||||
ret = (jlong)mrmailbox_get_chatlist((mrmailbox_t*)hMailbox, listflags, queryPtr);
|
||||
CHAR_UNREF(query);
|
||||
}
|
||||
else {
|
||||
ret = (jlong)mrmailbox_get_chatlist((mrmailbox_t*)hMailbox, NULL);
|
||||
ret = (jlong)mrmailbox_get_chatlist((mrmailbox_t*)hMailbox, listflags, NULL);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
@@ -363,15 +370,30 @@ JNIEXPORT jint Java_com_b44t_messenger_MrMailbox_getChatIdByContactId(JNIEnv *en
|
||||
}
|
||||
|
||||
|
||||
JNIEXPORT jint Java_com_b44t_messenger_MrMailbox_markseenMsg(JNIEnv *env, jclass cls, jint msg_id)
|
||||
JNIEXPORT void Java_com_b44t_messenger_MrMailbox_markseenMsgs(JNIEnv *env, jclass cls, jintArray msg_ids)
|
||||
{
|
||||
return (jint)mrmailbox_markseen_msg(get_mrmailbox_t(env, cls), msg_id);
|
||||
int msg_ids_cnt = 0;
|
||||
const uint32_t* msg_ids_ptr = jintArray2uint32Pointer(env, msg_ids, &msg_ids_cnt);
|
||||
mrmailbox_markseen_msgs(get_mrmailbox_t(env, cls), msg_ids_ptr, msg_ids_cnt);
|
||||
free(msg_ids_ptr);
|
||||
}
|
||||
|
||||
|
||||
JNIEXPORT jint Java_com_b44t_messenger_MrMailbox_markseenChat(JNIEnv *env, jclass cls, jint chat_id)
|
||||
JNIEXPORT void Java_com_b44t_messenger_MrMailbox_marknoticedChat(JNIEnv *env, jclass cls, jint chat_id)
|
||||
{
|
||||
return (jlong)mrmailbox_markseen_chat(get_mrmailbox_t(env, cls), chat_id);
|
||||
mrmailbox_marknoticed_chat(get_mrmailbox_t(env, cls), chat_id);
|
||||
}
|
||||
|
||||
|
||||
JNIEXPORT void Java_com_b44t_messenger_MrMailbox_marknoticedContact(JNIEnv *env, jclass cls, jint contact_id)
|
||||
{
|
||||
mrmailbox_marknoticed_contact(get_mrmailbox_t(env, cls), contact_id);
|
||||
}
|
||||
|
||||
|
||||
JNIEXPORT void Java_com_b44t_messenger_MrMailbox_archiveChat(JNIEnv *env, jclass cls, jint chat_id, jint archive)
|
||||
{
|
||||
mrmailbox_archive_chat(get_mrmailbox_t(env, cls), chat_id, archive);
|
||||
}
|
||||
|
||||
|
||||
@@ -417,6 +439,15 @@ JNIEXPORT jint Java_com_b44t_messenger_MrMailbox_setChatName(JNIEnv *env, jclass
|
||||
}
|
||||
|
||||
|
||||
JNIEXPORT jint Java_com_b44t_messenger_MrMailbox_setChatProfileImage(JNIEnv *env, jclass cls, jint chat_id, jstring image/*NULL=delete*/)
|
||||
{
|
||||
CHAR_REF(image);
|
||||
jint ret = (jint)mrmailbox_set_chat_profile_image(get_mrmailbox_t(env, cls), chat_id, imagePtr/*CHAR_REF() preserves NULL*/);
|
||||
CHAR_UNREF(image);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
JNIEXPORT void Java_com_b44t_messenger_MrMailbox_deleteChat(JNIEnv *env, jclass cls, jint chat_id)
|
||||
{
|
||||
mrmailbox_delete_chat(get_mrmailbox_t(env, cls), chat_id);
|
||||
@@ -425,6 +456,13 @@ JNIEXPORT void Java_com_b44t_messenger_MrMailbox_deleteChat(JNIEnv *env, jclass
|
||||
|
||||
/* MrMailbox - handle messages */
|
||||
|
||||
|
||||
JNIEXPORT jint Java_com_b44t_messenger_MrMailbox_getFreshMsgCount(JNIEnv *env, jclass cls, jint chat_id)
|
||||
{
|
||||
return mrmailbox_get_fresh_msg_count(get_mrmailbox_t(env, cls), chat_id);
|
||||
}
|
||||
|
||||
|
||||
JNIEXPORT jlong Java_com_b44t_messenger_MrMailbox_MrMailboxGetMsg(JNIEnv *env, jclass c, jlong hMailbox, jint id)
|
||||
{
|
||||
return (jlong)mrmailbox_get_msg((mrmailbox_t*)hMailbox, id);
|
||||
@@ -442,7 +480,7 @@ JNIEXPORT jstring Java_com_b44t_messenger_MrMailbox_MrMailboxGetMsgInfo(JNIEnv *
|
||||
|
||||
JNIEXPORT void Java_com_b44t_messenger_MrMailbox_deleteMsgs(JNIEnv *env, jclass cls, jintArray msg_ids)
|
||||
{
|
||||
int msg_ids_cnt;
|
||||
int msg_ids_cnt = 0;
|
||||
const uint32_t* msg_ids_ptr = jintArray2uint32Pointer(env, msg_ids, &msg_ids_cnt);
|
||||
mrmailbox_delete_msgs(get_mrmailbox_t(env, cls), msg_ids_ptr, msg_ids_cnt);
|
||||
free(msg_ids_ptr);
|
||||
@@ -451,20 +489,57 @@ JNIEXPORT void Java_com_b44t_messenger_MrMailbox_deleteMsgs(JNIEnv *env, jclass
|
||||
|
||||
JNIEXPORT void Java_com_b44t_messenger_MrMailbox_forwardMsgs(JNIEnv *env, jclass cls, jintArray msg_ids, jint chat_id)
|
||||
{
|
||||
int msg_ids_cnt;
|
||||
int msg_ids_cnt = 0;
|
||||
const uint32_t* msg_ids_ptr = jintArray2uint32Pointer(env, msg_ids, &msg_ids_cnt);
|
||||
mrmailbox_forward_msgs(get_mrmailbox_t(env, cls), msg_ids_ptr, msg_ids_cnt, chat_id);
|
||||
free(msg_ids_ptr);
|
||||
}
|
||||
|
||||
|
||||
JNIEXPORT jint Java_com_b44t_messenger_MrMailbox_sendTextMsg(JNIEnv *env, jclass cls, jint chat_id, jstring text)
|
||||
{
|
||||
CHAR_REF(text);
|
||||
jint msg_id = mrmailbox_send_text_msg(get_mrmailbox_t(env, cls), chat_id, textPtr);
|
||||
CHAR_UNREF(text);
|
||||
return msg_id;
|
||||
}
|
||||
|
||||
|
||||
JNIEXPORT jint Java_com_b44t_messenger_MrMailbox_sendVcardMsg(JNIEnv *env, jobject obj, jint chat_id, jint contact_id)
|
||||
{
|
||||
return mrmailbox_send_vcard_msg(get_mrmailbox_t(env, obj), chat_id, contact_id);
|
||||
}
|
||||
|
||||
|
||||
JNIEXPORT jint Java_com_b44t_messenger_MrMailbox_sendMediaMsg(JNIEnv *env, jclass cls, jint chat_id, jint type, jstring file, jstring mime, jint w, jint h, jint ms, jstring author, jstring trackname)
|
||||
{
|
||||
jint msg_id = 0;
|
||||
CHAR_REF(file);
|
||||
CHAR_REF(mime);
|
||||
CHAR_REF(author);
|
||||
CHAR_REF(trackname);
|
||||
switch( type ) {
|
||||
case MR_MSG_IMAGE: msg_id = (jint)mrmailbox_send_image_msg(get_mrmailbox_t(env, cls), chat_id, filePtr, mimePtr, w, h); break;
|
||||
case MR_MSG_VIDEO: msg_id = (jint)mrmailbox_send_video_msg(get_mrmailbox_t(env, cls), chat_id, filePtr, mimePtr, w, h, ms); break;
|
||||
case MR_MSG_VOICE: msg_id = (jint)mrmailbox_send_voice_msg(get_mrmailbox_t(env, cls), chat_id, filePtr, mimePtr, ms); break;
|
||||
case MR_MSG_AUDIO: msg_id = (jint)mrmailbox_send_audio_msg(get_mrmailbox_t(env, cls), chat_id, filePtr, mimePtr, ms, authorPtr, tracknamePtr); break;
|
||||
default: msg_id = (jint)mrmailbox_send_file_msg (get_mrmailbox_t(env, cls), chat_id, filePtr, mimePtr); break;
|
||||
}
|
||||
CHAR_UNREF(trackname);
|
||||
CHAR_UNREF(author);
|
||||
CHAR_UNREF(mime);
|
||||
CHAR_UNREF(file);
|
||||
return msg_id;
|
||||
}
|
||||
|
||||
|
||||
/* MrMailbox - handle config */
|
||||
|
||||
JNIEXPORT void Java_com_b44t_messenger_MrMailbox_setConfig(JNIEnv *env, jclass cls, jstring key, jstring value)
|
||||
JNIEXPORT void Java_com_b44t_messenger_MrMailbox_setConfig(JNIEnv *env, jclass cls, jstring key, jstring value /*may be NULL*/)
|
||||
{
|
||||
CHAR_REF(key);
|
||||
CHAR_REF(value);
|
||||
mrmailbox_set_config(get_mrmailbox_t(env, cls), keyPtr, valuePtr);
|
||||
mrmailbox_set_config(get_mrmailbox_t(env, cls), keyPtr, valuePtr /*is NULL if value is NULL, CHAR_REF() handles this*/);
|
||||
CHAR_UNREF(key);
|
||||
CHAR_UNREF(value);
|
||||
}
|
||||
@@ -478,16 +553,19 @@ JNIEXPORT void Java_com_b44t_messenger_MrMailbox_setConfigInt(JNIEnv *env, jclas
|
||||
}
|
||||
|
||||
|
||||
JNIEXPORT jstring Java_com_b44t_messenger_MrMailbox_getConfig(JNIEnv *env, jclass cls, jstring key, jstring def)
|
||||
JNIEXPORT jstring Java_com_b44t_messenger_MrMailbox_getConfig(JNIEnv *env, jclass cls, jstring key, jstring def/*may be NULL*/)
|
||||
{
|
||||
CHAR_REF(key);
|
||||
CHAR_REF(def);
|
||||
char* temp = mrmailbox_get_config(get_mrmailbox_t(env, cls), keyPtr, defPtr);
|
||||
jstring ret = JSTRING_NEW(temp);
|
||||
char* temp = mrmailbox_get_config(get_mrmailbox_t(env, cls), keyPtr, defPtr /*is NULL if value is NULL, CHAR_REF() handles this*/);
|
||||
jstring ret = NULL;
|
||||
if( temp ) {
|
||||
ret = JSTRING_NEW(temp);
|
||||
}
|
||||
free(temp);
|
||||
CHAR_UNREF(key);
|
||||
CHAR_UNREF(def);
|
||||
return ret;
|
||||
return ret; /* returns NULL only if key is unset and "def" is NULL */
|
||||
}
|
||||
|
||||
|
||||
@@ -531,11 +609,56 @@ JNIEXPORT jstring Java_com_b44t_messenger_MrMailbox_cmdline(JNIEnv *env, jclass
|
||||
}
|
||||
|
||||
|
||||
JNIEXPORT void Java_com_b44t_messenger_MrMailbox_imex(JNIEnv *env, jclass cls, jint what, jstring dir)
|
||||
JNIEXPORT jstring Java_com_b44t_messenger_MrMailbox_initiateKeyTransfer(JNIEnv *env, jclass cls)
|
||||
{
|
||||
jstring setup_code = NULL;
|
||||
char* temp = mrmailbox_initiate_key_transfer(get_mrmailbox_t(env, cls));
|
||||
if( temp ) {
|
||||
setup_code = JSTRING_NEW(temp);
|
||||
free(temp);
|
||||
}
|
||||
return setup_code;
|
||||
}
|
||||
|
||||
|
||||
JNIEXPORT jboolean Java_com_b44t_messenger_MrMailbox_continueKeyTransfer(JNIEnv *env, jclass cls, jint msg_id, jstring setupCode)
|
||||
{
|
||||
CHAR_REF(setupCode);
|
||||
jboolean ret = mrmailbox_continue_key_transfer(get_mrmailbox_t(env, cls), msg_id, setupCodePtr);
|
||||
CHAR_UNREF(setupCode);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
JNIEXPORT int Java_com_b44t_messenger_MrMailbox_imex(JNIEnv *env, jclass cls, jint what, jstring dir)
|
||||
{
|
||||
CHAR_REF(dir);
|
||||
mrmailbox_imex(get_mrmailbox_t(env, cls), what, dirPtr, "");
|
||||
jint ret = mrmailbox_imex(get_mrmailbox_t(env, cls), what, dirPtr, "");
|
||||
CHAR_UNREF(dir);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
JNIEXPORT jint Java_com_b44t_messenger_MrMailbox_checkPassword(JNIEnv *env, jclass cls, jstring pw)
|
||||
{
|
||||
CHAR_REF(pw);
|
||||
jint r = mrmailbox_check_password(get_mrmailbox_t(env, cls), pwPtr);
|
||||
CHAR_UNREF(pw);
|
||||
return r;
|
||||
}
|
||||
|
||||
|
||||
JNIEXPORT jstring Java_com_b44t_messenger_MrMailbox_imexHasBackup(JNIEnv *env, jclass cls, jstring dir)
|
||||
{
|
||||
CHAR_REF(dir);
|
||||
jstring ret = NULL;
|
||||
char* temp = mrmailbox_imex_has_backup(get_mrmailbox_t(env, cls), dirPtr);
|
||||
if( temp ) {
|
||||
ret = JSTRING_NEW(temp);
|
||||
free(temp);
|
||||
}
|
||||
CHAR_UNREF(dir);
|
||||
return ret; /* may be NULL! */
|
||||
}
|
||||
|
||||
|
||||
@@ -574,13 +697,21 @@ JNIEXPORT jint Java_com_b44t_messenger_MrChatlist_MrChatlistGetCnt(JNIEnv *env,
|
||||
|
||||
JNIEXPORT jlong Java_com_b44t_messenger_MrChatlist_MrChatlistGetChatByIndex(JNIEnv *env, jclass c, jlong hChatlist, jint index)
|
||||
{
|
||||
return (jlong)mrchatlist_get_chat_by_index((mrchatlist_t*)hChatlist, index);
|
||||
mrchatlist_t* chatlist = (mrchatlist_t*)hChatlist;
|
||||
return (jlong)mrmailbox_get_chat(chatlist->m_mailbox, mrchatlist_get_chat_id(chatlist, index));
|
||||
}
|
||||
|
||||
|
||||
JNIEXPORT jlong Java_com_b44t_messenger_MrChatlist_MrChatlistGetMsgByIndex(JNIEnv *env, jclass c, jlong hChatlist, jint index)
|
||||
{
|
||||
mrchatlist_t* chatlist = (mrchatlist_t*)hChatlist;
|
||||
return (jlong)mrmailbox_get_msg(chatlist->m_mailbox, mrchatlist_get_msg_id(chatlist, index));
|
||||
}
|
||||
|
||||
|
||||
JNIEXPORT jlong Java_com_b44t_messenger_MrChatlist_MrChatlistGetSummaryByIndex(JNIEnv *env, jclass c, jlong hChatlist, jint index, jlong hChat)
|
||||
{
|
||||
return (jlong)mrchatlist_get_summary_by_index((mrchatlist_t*)hChatlist, index, (mrchat_t*)hChat);
|
||||
return (jlong)mrchatlist_get_summary((mrchatlist_t*)hChatlist, index, (mrchat_t*)hChat);
|
||||
}
|
||||
|
||||
|
||||
@@ -609,40 +740,61 @@ JNIEXPORT void Java_com_b44t_messenger_MrChat_MrChatUnref(JNIEnv *env, jclass c,
|
||||
}
|
||||
|
||||
|
||||
JNIEXPORT jint Java_com_b44t_messenger_MrChat_getId(JNIEnv *env, jclass cls)
|
||||
JNIEXPORT jint Java_com_b44t_messenger_MrChat_getId(JNIEnv *env, jobject obj)
|
||||
{
|
||||
mrchat_t* ths = get_mrchat_t(env, cls); if( ths == NULL ) { return 0; }
|
||||
mrchat_t* ths = get_mrchat_t(env, obj); if( ths == NULL ) { return 0; }
|
||||
return ths->m_id;
|
||||
}
|
||||
|
||||
|
||||
JNIEXPORT jint Java_com_b44t_messenger_MrChat_getType(JNIEnv *env, jclass cls)
|
||||
JNIEXPORT jint Java_com_b44t_messenger_MrChat_getType(JNIEnv *env, jobject obj)
|
||||
{
|
||||
mrchat_t* ths = get_mrchat_t(env, cls); if( ths == NULL ) { return 0; }
|
||||
mrchat_t* ths = get_mrchat_t(env, obj); if( ths == NULL ) { return 0; }
|
||||
return ths->m_type;
|
||||
}
|
||||
|
||||
|
||||
JNIEXPORT jstring Java_com_b44t_messenger_MrChat_getName(JNIEnv *env, jclass cls)
|
||||
JNIEXPORT jint Java_com_b44t_messenger_MrChat_getArchived(JNIEnv *env, jobject obj)
|
||||
{
|
||||
mrchat_t* ths = get_mrchat_t(env, cls); if( ths == NULL ) { return JSTRING_NEW(NULL); }
|
||||
mrchat_t* ths = get_mrchat_t(env, obj); if( ths == NULL ) { return 0; }
|
||||
return ths->m_archived;
|
||||
}
|
||||
|
||||
|
||||
JNIEXPORT jstring Java_com_b44t_messenger_MrChat_getName(JNIEnv *env, jobject obj)
|
||||
{
|
||||
mrchat_t* ths = get_mrchat_t(env, obj); if( ths == NULL ) { return JSTRING_NEW(NULL); }
|
||||
return JSTRING_NEW(ths->m_name);
|
||||
}
|
||||
|
||||
|
||||
JNIEXPORT jstring Java_com_b44t_messenger_MrChat_getSubtitle(JNIEnv *env, jclass cls)
|
||||
JNIEXPORT jstring Java_com_b44t_messenger_MrChat_getSubtitle(JNIEnv *env, jobject obj)
|
||||
{
|
||||
const char* temp = mrchat_get_subtitle(get_mrchat_t(env, cls));
|
||||
const char* temp = mrchat_get_subtitle(get_mrchat_t(env, obj));
|
||||
jstring ret = JSTRING_NEW(temp);
|
||||
free(temp);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
JNIEXPORT jint Java_com_b44t_messenger_MrChat_getParamInt(JNIEnv *env, jclass cls, jint key, jint def)
|
||||
JNIEXPORT jstring Java_com_b44t_messenger_MrChat_getProfileImage(JNIEnv *env, jobject obj)
|
||||
{
|
||||
mrchat_t* ths = get_mrchat_t(env, cls);
|
||||
return mrparam_get_int(ths? ths->m_param:NULL, key, def);
|
||||
const char* temp = mrchat_get_profile_image(get_mrchat_t(env, obj));
|
||||
jstring ret = JSTRING_NEW(temp);
|
||||
free(temp);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
JNIEXPORT jboolean Java_com_b44t_messenger_MrChat_isUnpromoted(JNIEnv *env, jobject obj)
|
||||
{
|
||||
return mrchat_is_unpromoted(get_mrchat_t(env, obj)) != 0;
|
||||
}
|
||||
|
||||
|
||||
JNIEXPORT jboolean Java_com_b44t_messenger_MrChat_isSelfTalk(JNIEnv *env, jobject obj)
|
||||
{
|
||||
return mrchat_is_self_talk(get_mrchat_t(env, obj)) != 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -670,18 +822,6 @@ JNIEXPORT jint Java_com_b44t_messenger_MrChat_MrChatGetDraftReplyToMsgId(JNIEnv
|
||||
}
|
||||
|
||||
|
||||
JNIEXPORT jint Java_com_b44t_messenger_MrChat_MrChatGetTotalMsgCount(JNIEnv *env, jclass c, jlong hChat)
|
||||
{
|
||||
return mrchat_get_total_msg_count((mrchat_t*)hChat);
|
||||
}
|
||||
|
||||
|
||||
JNIEXPORT jint Java_com_b44t_messenger_MrChat_MrChatGetUnseenCount(JNIEnv *env, jclass c, jlong hChat)
|
||||
{
|
||||
return mrchat_get_unseen_count((mrchat_t*)hChat);
|
||||
}
|
||||
|
||||
|
||||
JNIEXPORT jint Java_com_b44t_messenger_MrChat_MrChatSetDraft(JNIEnv *env, jclass c, jlong hChat, jstring draft /* NULL=delete */, jint replyToMsgId)
|
||||
{
|
||||
CHAR_REF(draft);
|
||||
@@ -691,54 +831,10 @@ JNIEXPORT jint Java_com_b44t_messenger_MrChat_MrChatSetDraft(JNIEnv *env, jclass
|
||||
}
|
||||
|
||||
|
||||
JNIEXPORT jint Java_com_b44t_messenger_MrChat_sendText(JNIEnv *env, jclass cls, jstring text)
|
||||
{
|
||||
mrmsg_t* msg = mrmsg_new();
|
||||
msg->m_type = MR_MSG_TEXT;
|
||||
CHAR_REF(text);
|
||||
msg->m_text = textPtr? strdup(textPtr) : NULL;
|
||||
CHAR_UNREF(text);
|
||||
jint msg_id = mrchat_send_msg(get_mrchat_t(env, cls), msg);
|
||||
mrmsg_unref(msg);
|
||||
return msg_id;
|
||||
}
|
||||
|
||||
|
||||
JNIEXPORT jint Java_com_b44t_messenger_MrChat_sendMedia(JNIEnv *env, jclass cls, jint type, jstring file, jstring mime, jint w, jint h, jint ms, jstring author, jstring trackname)
|
||||
{
|
||||
mrmsg_t* msg = mrmsg_new();
|
||||
msg->m_type = type;
|
||||
CHAR_REF(mime);
|
||||
mrparam_set(msg->m_param, 'm', mimePtr);
|
||||
CHAR_UNREF(mime);
|
||||
CHAR_REF(file);
|
||||
mrparam_set(msg->m_param, 'f', filePtr);
|
||||
CHAR_UNREF(file);
|
||||
if( type == MR_MSG_IMAGE || type == MR_MSG_GIF || type == MR_MSG_VIDEO ) {
|
||||
mrparam_set_int(msg->m_param, 'w', w);
|
||||
mrparam_set_int(msg->m_param, 'h', h);
|
||||
}
|
||||
if( type == MR_MSG_AUDIO || type == MR_MSG_VOICE || type == MR_MSG_VIDEO ) {
|
||||
mrparam_set_int(msg->m_param, 'd', ms);
|
||||
}
|
||||
if( type == MR_MSG_AUDIO ) {
|
||||
CHAR_REF(author);
|
||||
mrparam_set(msg->m_param, 'N', authorPtr);
|
||||
CHAR_UNREF(author);
|
||||
CHAR_REF(trackname);
|
||||
mrparam_set(msg->m_param, 'n', tracknamePtr);
|
||||
CHAR_UNREF(trackname);
|
||||
}
|
||||
jint msg_id = mrchat_send_msg(get_mrchat_t(env, cls), msg);
|
||||
mrmsg_unref(msg);
|
||||
return msg_id;
|
||||
}
|
||||
|
||||
|
||||
JNIEXPORT jintArray Java_com_b44t_messenger_MrMailbox_getChatMedia(JNIEnv *env, jclass cls, jint chat_id, jint msg_type, jint or_msg_type)
|
||||
{
|
||||
carray* ca = mrmailbox_get_chat_media(get_mrmailbox_t(env, cls), chat_id, msg_type, or_msg_type);
|
||||
return carray2jintArray_n_carray_free(env, ca);
|
||||
mrarray_t* ca = mrmailbox_get_chat_media(get_mrmailbox_t(env, cls), chat_id, msg_type, or_msg_type);
|
||||
return mrarray2jintArray_n_mrarray_unref(env, ca);
|
||||
}
|
||||
|
||||
|
||||
@@ -750,31 +846,31 @@ JNIEXPORT jint Java_com_b44t_messenger_MrMailbox_getNextMedia(JNIEnv *env, jclas
|
||||
|
||||
JNIEXPORT jintArray Java_com_b44t_messenger_MrMailbox_getChatMsgs(JNIEnv *env, jclass cls, jint chat_id, jint flags, jint marker1before)
|
||||
{
|
||||
carray* ca = mrmailbox_get_chat_msgs(get_mrmailbox_t(env, cls), chat_id, flags, marker1before);
|
||||
return carray2jintArray_n_carray_free(env, ca);
|
||||
mrarray_t* ca = mrmailbox_get_chat_msgs(get_mrmailbox_t(env, cls), chat_id, flags, marker1before);
|
||||
return mrarray2jintArray_n_mrarray_unref(env, ca);
|
||||
}
|
||||
|
||||
|
||||
JNIEXPORT jintArray Java_com_b44t_messenger_MrMailbox_searchMsgs(JNIEnv *env, jclass cls, jint chat_id, jstring query)
|
||||
{
|
||||
CHAR_REF(query);
|
||||
carray* ca = mrmailbox_search_msgs(get_mrmailbox_t(env, cls), chat_id, queryPtr);
|
||||
mrarray_t* ca = mrmailbox_search_msgs(get_mrmailbox_t(env, cls), chat_id, queryPtr);
|
||||
CHAR_UNREF(query);
|
||||
return carray2jintArray_n_carray_free(env, ca);
|
||||
return mrarray2jintArray_n_mrarray_unref(env, ca);
|
||||
}
|
||||
|
||||
|
||||
JNIEXPORT jintArray Java_com_b44t_messenger_MrMailbox_getUnseenMsgs(JNIEnv *env, jclass cls)
|
||||
JNIEXPORT jintArray Java_com_b44t_messenger_MrMailbox_getFreshMsgs(JNIEnv *env, jclass cls)
|
||||
{
|
||||
carray* ca = mrmailbox_get_unseen_msgs(get_mrmailbox_t(env, cls));
|
||||
return carray2jintArray_n_carray_free(env, ca);
|
||||
mrarray_t* ca = mrmailbox_get_fresh_msgs(get_mrmailbox_t(env, cls));
|
||||
return mrarray2jintArray_n_mrarray_unref(env, ca);
|
||||
}
|
||||
|
||||
|
||||
JNIEXPORT jintArray Java_com_b44t_messenger_MrMailbox_getChatContacts(JNIEnv *env, jclass cls, jint chat_id)
|
||||
{
|
||||
carray* ca = mrmailbox_get_chat_contacts(get_mrmailbox_t(env, cls), chat_id);
|
||||
return carray2jintArray_n_carray_free(env, ca);
|
||||
mrarray_t* ca = mrmailbox_get_chat_contacts(get_mrmailbox_t(env, cls), chat_id);
|
||||
return mrarray2jintArray_n_mrarray_unref(env, ca);
|
||||
}
|
||||
|
||||
|
||||
@@ -859,50 +955,35 @@ JNIEXPORT jint Java_com_b44t_messenger_MrMsg_MrMsgGetToId(JNIEnv *env, jclass c,
|
||||
}
|
||||
|
||||
|
||||
JNIEXPORT jstring Java_com_b44t_messenger_MrMsg_getParam(JNIEnv *env, jobject obj, jint key, jstring def)
|
||||
JNIEXPORT jint Java_com_b44t_messenger_MrMsg_getWidth(JNIEnv *env, jobject obj, jint def)
|
||||
{
|
||||
mrmsg_t* ths = get_mrmsg_t(env, obj);
|
||||
CHAR_REF(def);
|
||||
char* temp = mrparam_get(ths? ths->m_param:NULL, key, defPtr);
|
||||
jstring ret = JSTRING_NEW(temp);
|
||||
free(temp);
|
||||
CHAR_UNREF(def);
|
||||
return ret;
|
||||
jint ret = (jint)mrmsg_get_width(get_mrmsg_t(env, obj));
|
||||
return ret? ret : def;
|
||||
}
|
||||
|
||||
|
||||
JNIEXPORT jint Java_com_b44t_messenger_MrMsg_getParamInt(JNIEnv *env, jobject obj, jint key, jint def)
|
||||
JNIEXPORT jint Java_com_b44t_messenger_MrMsg_getHeight(JNIEnv *env, jobject obj, jint def)
|
||||
{
|
||||
mrmsg_t* ths = get_mrmsg_t(env, obj);
|
||||
return mrparam_get_int(ths? ths->m_param:NULL, key, def);
|
||||
jint ret = (jint)mrmsg_get_height(get_mrmsg_t(env, obj));
|
||||
return ret? ret : def;
|
||||
}
|
||||
|
||||
|
||||
JNIEXPORT void Java_com_b44t_messenger_MrMsg_setParamInt(JNIEnv *env, jobject obj, jint key, jint value)
|
||||
JNIEXPORT jint Java_com_b44t_messenger_MrMsg_getDuration(JNIEnv *env, jobject obj)
|
||||
{
|
||||
mrmsg_t* ths = get_mrmsg_t(env, obj);
|
||||
mrparam_set_int(ths? ths->m_param:NULL, key, value);
|
||||
return mrmsg_get_duration(get_mrmsg_t(env, obj));
|
||||
}
|
||||
|
||||
|
||||
JNIEXPORT void Java_com_b44t_messenger_MrMsg_saveParamToDisk(JNIEnv *env, jobject obj)
|
||||
JNIEXPORT void Java_com_b44t_messenger_MrMsg_lateFilingMediaSize(JNIEnv *env, jobject obj, jint width, jint height, jint duration)
|
||||
{
|
||||
mrmsg_save_param_to_disk(get_mrmsg_t(env, obj));
|
||||
mrmsg_latefiling_mediasize(get_mrmsg_t(env, obj), width, height, duration);
|
||||
}
|
||||
|
||||
|
||||
JNIEXPORT jint Java_com_b44t_messenger_MrMsg_getBytes(JNIEnv *env, jobject obj)
|
||||
{
|
||||
jint ret = 0;
|
||||
mrmsg_t* ths = get_mrmsg_t(env, obj);
|
||||
if( ths ) {
|
||||
const char* file = mrparam_get(ths->m_param, 'f', NULL);
|
||||
if( file ) {
|
||||
ret = mr_get_filebytes(file);
|
||||
free(file);
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
return (jint)mrmsg_get_filebytes(get_mrmsg_t(env, obj));
|
||||
}
|
||||
|
||||
|
||||
@@ -912,15 +993,45 @@ JNIEXPORT jlong Java_com_b44t_messenger_MrMsg_getSummaryCPtr(JNIEnv *env, jobjec
|
||||
}
|
||||
|
||||
|
||||
JNIEXPORT jint Java_com_b44t_messenger_MrMsg_getSummarytext(JNIEnv *env, jobject obj, jint approx_characters)
|
||||
JNIEXPORT jstring Java_com_b44t_messenger_MrMsg_getSummarytext(JNIEnv *env, jobject obj, jint approx_characters)
|
||||
{
|
||||
return JSTRING_NEW(mrmsg_get_summarytext(get_mrmsg_t(env, obj), approx_characters));
|
||||
char* temp = mrmsg_get_summarytext(get_mrmsg_t(env, obj), approx_characters);
|
||||
jstring ret = JSTRING_NEW(temp);
|
||||
free(temp);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
JNIEXPORT jint Java_com_b44t_messenger_MrMsg_getFilename(JNIEnv *env, jobject obj)
|
||||
JNIEXPORT jint Java_com_b44t_messenger_MrMsg_showPadlock(JNIEnv *env, jobject obj)
|
||||
{
|
||||
return JSTRING_NEW(mrmsg_get_filename(get_mrmsg_t(env, obj)));
|
||||
return mrmsg_get_showpadlock(get_mrmsg_t(env, obj));
|
||||
}
|
||||
|
||||
|
||||
JNIEXPORT jstring Java_com_b44t_messenger_MrMsg_getFile(JNIEnv *env, jobject obj)
|
||||
{
|
||||
char* temp = mrmsg_get_file(get_mrmsg_t(env, obj));
|
||||
jstring ret = JSTRING_NEW(temp);
|
||||
free(temp);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
JNIEXPORT jstring Java_com_b44t_messenger_MrMsg_getFilemime(JNIEnv *env, jobject obj)
|
||||
{
|
||||
char* temp = mrmsg_get_filemime(get_mrmsg_t(env, obj));
|
||||
jstring ret = JSTRING_NEW(temp);
|
||||
free(temp);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
JNIEXPORT jstring Java_com_b44t_messenger_MrMsg_getFilename(JNIEnv *env, jobject obj)
|
||||
{
|
||||
char* temp = mrmsg_get_filename(get_mrmsg_t(env, obj));
|
||||
jstring ret = JSTRING_NEW(temp);
|
||||
free(temp);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@@ -930,12 +1041,40 @@ JNIEXPORT jlong Java_com_b44t_messenger_MrMsg_getMediainfoCPtr(JNIEnv *env, jobj
|
||||
}
|
||||
|
||||
|
||||
JNIEXPORT jint Java_com_b44t_messenger_MrMsg_isIncreation(JNIEnv *env, jobject obj)
|
||||
JNIEXPORT jboolean Java_com_b44t_messenger_MrMsg_isForwarded(JNIEnv *env, jobject obj)
|
||||
{
|
||||
return (jint)mrmsg_is_increation(get_mrmsg_t(env, obj));
|
||||
return mrmsg_is_forwarded(get_mrmsg_t(env, obj)) != 0;
|
||||
}
|
||||
|
||||
|
||||
JNIEXPORT jboolean Java_com_b44t_messenger_MrMsg_isIncreation(JNIEnv *env, jobject obj)
|
||||
{
|
||||
return mrmsg_is_increation(get_mrmsg_t(env, obj)) != 0;
|
||||
}
|
||||
|
||||
|
||||
JNIEXPORT jboolean Java_com_b44t_messenger_MrMsg_isSystemcmd(JNIEnv *env, jobject obj)
|
||||
{
|
||||
return mrmsg_is_systemcmd(get_mrmsg_t(env, obj)) != 0;
|
||||
}
|
||||
|
||||
|
||||
JNIEXPORT jboolean Java_com_b44t_messenger_MrMsg_isSetupMessage(JNIEnv *env, jobject obj)
|
||||
{
|
||||
return mrmsg_is_setupmessage(get_mrmsg_t(env, obj));
|
||||
}
|
||||
|
||||
|
||||
JNIEXPORT jstring Java_com_b44t_messenger_MrMsg_getSetupCodeBegin(JNIEnv *env, jobject obj)
|
||||
{
|
||||
char* temp = mrmsg_get_setupcodebegin(get_mrmsg_t(env, obj));
|
||||
jstring ret = JSTRING_NEW(temp);
|
||||
free(temp);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* MrContact
|
||||
******************************************************************************/
|
||||
@@ -961,80 +1100,115 @@ JNIEXPORT void Java_com_b44t_messenger_MrContact_MrContactUnref(JNIEnv *env, jcl
|
||||
}
|
||||
|
||||
|
||||
JNIEXPORT jstring Java_com_b44t_messenger_MrContact_MrContactGetName(JNIEnv *env, jclass c, jlong hContact)
|
||||
JNIEXPORT jstring Java_com_b44t_messenger_MrContact_getName(JNIEnv *env, jobject obj)
|
||||
{
|
||||
mrcontact_t* ths = (mrcontact_t*)hContact; if( ths == NULL ) { return JSTRING_NEW(NULL); }
|
||||
return JSTRING_NEW(ths->m_name);
|
||||
const char* temp = mrcontact_get_name(get_mrcontact_t(env, obj));
|
||||
jstring ret = JSTRING_NEW(temp);
|
||||
free(temp);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
JNIEXPORT jstring Java_com_b44t_messenger_MrContact_getAuthName(JNIEnv *env, jclass cls)
|
||||
JNIEXPORT jstring Java_com_b44t_messenger_MrContact_getDisplayName(JNIEnv *env, jobject obj)
|
||||
{
|
||||
mrcontact_t* ths = get_mrcontact_t(env, cls); if( ths == NULL ) { return JSTRING_NEW(NULL); }
|
||||
return JSTRING_NEW(ths->m_authname);
|
||||
const char* temp = mrcontact_get_display_name(get_mrcontact_t(env, obj));
|
||||
jstring ret = JSTRING_NEW(temp);
|
||||
free(temp);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
JNIEXPORT jstring Java_com_b44t_messenger_MrContact_MrContactGetAddr(JNIEnv *env, jclass c, jlong hContact)
|
||||
JNIEXPORT jstring Java_com_b44t_messenger_MrContact_getAddr(JNIEnv *env, jobject obj)
|
||||
{
|
||||
mrcontact_t* ths = (mrcontact_t*)hContact; if( ths == NULL ) { return JSTRING_NEW(NULL); }
|
||||
return JSTRING_NEW(ths->m_addr);
|
||||
const char* temp = mrcontact_get_addr(get_mrcontact_t(env, obj));
|
||||
jstring ret = JSTRING_NEW(temp);
|
||||
free(temp);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
JNIEXPORT jint Java_com_b44t_messenger_MrContact_MrContactIsBlocked(JNIEnv *env, jclass c, jlong hContact)
|
||||
JNIEXPORT jstring Java_com_b44t_messenger_MrContact_getNameNAddr(JNIEnv *env, jobject obj)
|
||||
{
|
||||
mrcontact_t* ths = (mrcontact_t*)hContact; if( ths == NULL ) { return 0; }
|
||||
return (jint)ths->m_blocked;
|
||||
const char* temp = mrcontact_get_name_n_addr(get_mrcontact_t(env, obj));
|
||||
jstring ret = JSTRING_NEW(temp);
|
||||
free(temp);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
JNIEXPORT jboolean Java_com_b44t_messenger_MrContact_isBlocked(JNIEnv *env, jobject obj)
|
||||
{
|
||||
mrcontact_t* ths = get_mrcontact_t(env, obj); if( ths == NULL ) { return 0; }
|
||||
return (jboolean)(ths->m_blocked != 0);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* MrPoortext
|
||||
* MrLot
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
JNIEXPORT void Java_com_b44t_messenger_MrPoortext_MrPoortextUnref(JNIEnv *env, jclass c, jlong hPoortext)
|
||||
static mrlot_t* get_mrlot_t(JNIEnv *env, jobject obj)
|
||||
{
|
||||
mrpoortext_unref((mrpoortext_t*)hPoortext);
|
||||
static jfieldID fid = 0;
|
||||
if( fid == 0 ) {
|
||||
jclass cls = (*env)->GetObjectClass(env, obj);
|
||||
fid = (*env)->GetFieldID(env, cls, "m_hLot", "J" /*Signature, J=long*/);
|
||||
}
|
||||
if( fid ) {
|
||||
return (mrlot_t*)(*env)->GetLongField(env, obj, fid);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
JNIEXPORT jstring Java_com_b44t_messenger_MrPoortext_MrPoortextGetText1(JNIEnv *env, jclass c, jlong hPoortext)
|
||||
JNIEXPORT void Java_com_b44t_messenger_MrLot_unref(JNIEnv *env, jclass cls, jlong hLot)
|
||||
{
|
||||
mrpoortext_t* ths = (mrpoortext_t*)hPoortext; if( ths == NULL ) { return JSTRING_NEW(NULL); }
|
||||
mrlot_unref((mrlot_t*)hLot);
|
||||
}
|
||||
|
||||
|
||||
JNIEXPORT jstring Java_com_b44t_messenger_MrLot_getText1(JNIEnv *env, jobject obj)
|
||||
{
|
||||
mrlot_t* ths = get_mrlot_t(env, obj); if( ths == NULL ) { return JSTRING_NEW(NULL); }
|
||||
return JSTRING_NEW(ths->m_text1);
|
||||
}
|
||||
|
||||
|
||||
JNIEXPORT jint Java_com_b44t_messenger_MrPoortext_MrPoortextGetText1Meaning(JNIEnv *env, jclass c, jlong hPoortext)
|
||||
JNIEXPORT jint Java_com_b44t_messenger_MrLot_getText1Meaning(JNIEnv *env, jobject obj)
|
||||
{
|
||||
mrpoortext_t* ths = (mrpoortext_t*)hPoortext; if( ths == NULL ) { return 0; }
|
||||
mrlot_t* ths = get_mrlot_t(env, obj); if( ths == NULL ) { return 0; }
|
||||
return ths->m_text1_meaning;
|
||||
}
|
||||
|
||||
|
||||
JNIEXPORT jstring Java_com_b44t_messenger_MrPoortext_MrPoortextGetText2(JNIEnv *env, jclass c, jlong hPoortext)
|
||||
JNIEXPORT jstring Java_com_b44t_messenger_MrLot_getText2(JNIEnv *env, jobject obj)
|
||||
{
|
||||
mrpoortext_t* ths = (mrpoortext_t*)hPoortext; if( ths == NULL ) { return JSTRING_NEW(NULL); }
|
||||
mrlot_t* ths = get_mrlot_t(env, obj); if( ths == NULL ) { return JSTRING_NEW(NULL); }
|
||||
return JSTRING_NEW(ths->m_text2);
|
||||
}
|
||||
|
||||
|
||||
JNIEXPORT jlong Java_com_b44t_messenger_MrPoortext_MrPoortextGetTimestamp(JNIEnv *env, jclass c, jlong hPoortext)
|
||||
JNIEXPORT jlong Java_com_b44t_messenger_MrLot_getTimestamp(JNIEnv *env, jobject obj)
|
||||
{
|
||||
mrpoortext_t* ths = (mrpoortext_t*)hPoortext; if( ths == NULL ) { return 0; }
|
||||
mrlot_t* ths = get_mrlot_t(env, obj); if( ths == NULL ) { return 0; }
|
||||
return ths->m_timestamp;
|
||||
}
|
||||
|
||||
|
||||
JNIEXPORT jint Java_com_b44t_messenger_MrPoortext_MrPoortextGetState(JNIEnv *env, jclass c, jlong hPoortext)
|
||||
JNIEXPORT jint Java_com_b44t_messenger_MrLot_getState(JNIEnv *env, jobject obj)
|
||||
{
|
||||
mrpoortext_t* ths = (mrpoortext_t*)hPoortext; if( ths == NULL ) { return 0; }
|
||||
mrlot_t* ths = get_mrlot_t(env, obj); if( ths == NULL ) { return 0; }
|
||||
return ths->m_state;
|
||||
}
|
||||
|
||||
|
||||
JNIEXPORT void Java_com_b44t_messenger_MrLot_MrLotUnref(JNIEnv *env, jclass c, jlong hLot)
|
||||
{
|
||||
mrlot_unref((mrlot_t*)hLot);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* Tools
|
||||
******************************************************************************/
|
||||
|
||||
@@ -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,17 @@
|
||||
<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=".SettingsAdvActivity"
|
||||
android:configChanges="keyboard|keyboardHidden|orientation|screenSize">
|
||||
</activity>
|
||||
|
||||
<activity
|
||||
android:name="com.b44t.messenger.OpenChatReceiver"
|
||||
android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
|
||||
|
||||
+6
-32
@@ -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;
|
||||
|
||||
@@ -378,12 +377,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 +428,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 +467,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());
|
||||
}
|
||||
|
||||
@@ -553,22 +545,6 @@ public class ActionBar extends FrameLayout {
|
||||
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 +581,7 @@ public class ActionBar extends FrameLayout {
|
||||
}
|
||||
|
||||
public static int getCurrentActionBarHeight() {
|
||||
if (AndroidUtilities.isTablet()) {
|
||||
return AndroidUtilities.dp(64);
|
||||
} else if (ApplicationLoader.applicationContext.getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) {
|
||||
if (ApplicationLoader.applicationContext.getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) {
|
||||
return AndroidUtilities.dp(48);
|
||||
} else {
|
||||
return AndroidUtilities.dp(56);
|
||||
+49
-208
@@ -21,7 +21,7 @@
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
package com.b44t.ui.ActionBar;
|
||||
package com.b44t.messenger.ActionBar;
|
||||
|
||||
import android.animation.Animator;
|
||||
import android.animation.AnimatorSet;
|
||||
@@ -49,7 +49,7 @@ import android.widget.LinearLayout;
|
||||
import com.b44t.messenger.AndroidUtilities;
|
||||
import com.b44t.messenger.R;
|
||||
import com.b44t.messenger.AnimatorListenerAdapterProxy;
|
||||
import com.b44t.ui.Components.LayoutHelper;
|
||||
import com.b44t.messenger.Components.LayoutHelper;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
@@ -60,7 +60,6 @@ public class ActionBarLayout extends FrameLayout {
|
||||
boolean needPresentFragment(BaseFragment fragment, boolean removeLast, boolean forceWithoutAnimation, ActionBarLayout layout);
|
||||
boolean needAddFragmentToStack(BaseFragment fragment, ActionBarLayout layout);
|
||||
boolean needCloseLastFragment(ActionBarLayout layout);
|
||||
void onRebuildAllFragments(ActionBarLayout layout);
|
||||
}
|
||||
|
||||
public class LinearLayoutContainer extends LinearLayout {
|
||||
@@ -131,7 +130,6 @@ public class ActionBarLayout extends FrameLayout {
|
||||
|
||||
private LinearLayoutContainer containerView;
|
||||
private LinearLayoutContainer containerViewBack;
|
||||
private DrawerLayoutContainer drawerLayoutContainer;
|
||||
private ActionBar currentActionBar;
|
||||
|
||||
private AnimatorSet currentAnimation;
|
||||
@@ -153,16 +151,12 @@ public class ActionBarLayout extends FrameLayout {
|
||||
private int startedTrackingPointerId;
|
||||
private Runnable onCloseAnimationEndRunnable;
|
||||
private Runnable onOpenAnimationEndRunnable;
|
||||
private boolean useAlphaAnimations;
|
||||
private View backgroundView;
|
||||
private boolean removeActionBarExtraHeight;
|
||||
private Runnable animationRunnable;
|
||||
|
||||
private float animationProgress = 0.0f;
|
||||
private long lastFrameTime;
|
||||
|
||||
private String titleOverlayText;
|
||||
|
||||
private ActionBarLayoutDelegate delegate = null;
|
||||
protected Activity parentActivity = null;
|
||||
|
||||
@@ -385,7 +379,6 @@ public class ActionBarLayout extends FrameLayout {
|
||||
lastFragment.actionBar.setOccupyStatusBar(false);
|
||||
}
|
||||
containerViewBack.addView(lastFragment.actionBar);
|
||||
lastFragment.actionBar.setTitleOverlayText(titleOverlayText);
|
||||
}
|
||||
containerViewBack.addView(fragmentView);
|
||||
ViewGroup.LayoutParams layoutParams = fragmentView.getLayoutParams();
|
||||
@@ -678,7 +671,6 @@ public class ActionBarLayout extends FrameLayout {
|
||||
parent.removeView(fragment.actionBar);
|
||||
}
|
||||
containerViewBack.addView(fragment.actionBar);
|
||||
fragment.actionBar.setTitleOverlayText(titleOverlayText);
|
||||
}
|
||||
|
||||
containerViewBack.addView(fragmentView);
|
||||
@@ -702,110 +694,56 @@ public class ActionBarLayout extends FrameLayout {
|
||||
bringChildToFront(containerView);
|
||||
if (!needAnimation) {
|
||||
presentFragmentInternalRemoveOld(removeLast, currentFragment);
|
||||
if (backgroundView != null) {
|
||||
backgroundView.setVisibility(VISIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
if (needAnimation) {
|
||||
if (useAlphaAnimations && fragmentsStack.size() == 1) {
|
||||
presentFragmentInternalRemoveOld(removeLast, currentFragment);
|
||||
|
||||
transitionAnimationStartTime = System.currentTimeMillis();
|
||||
transitionAnimationInProgress = true;
|
||||
onOpenAnimationEndRunnable = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
fragment.onTransitionAnimationEnd(true, false);
|
||||
fragment.onBecomeFullyVisible();
|
||||
}
|
||||
};
|
||||
ArrayList<Animator> animators = new ArrayList<>();
|
||||
animators.add(ObjectAnimator.ofFloat(this, "alpha", 0.0f, 1.0f));
|
||||
if (backgroundView != null) {
|
||||
backgroundView.setVisibility(VISIBLE);
|
||||
animators.add(ObjectAnimator.ofFloat(backgroundView, "alpha", 0.0f, 1.0f));
|
||||
}
|
||||
|
||||
fragment.onTransitionAnimationStart(true, false);
|
||||
currentAnimation = new AnimatorSet();
|
||||
currentAnimation.playTogether(animators);
|
||||
currentAnimation.setInterpolator(accelerateDecelerateInterpolator);
|
||||
currentAnimation.setDuration(200);
|
||||
currentAnimation.addListener(new AnimatorListenerAdapterProxy() {
|
||||
@Override
|
||||
public void onAnimationEnd(Animator animation) {
|
||||
onAnimationEndCheck(false);
|
||||
}
|
||||
});
|
||||
currentAnimation.start();
|
||||
} else {
|
||||
transitionAnimationStartTime = System.currentTimeMillis();
|
||||
transitionAnimationInProgress = true;
|
||||
onOpenAnimationEndRunnable = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (Build.VERSION.SDK_INT > 15) {
|
||||
containerView.setLayerType(LAYER_TYPE_NONE, null);
|
||||
containerViewBack.setLayerType(LAYER_TYPE_NONE, null);
|
||||
}
|
||||
presentFragmentInternalRemoveOld(removeLast, currentFragment);
|
||||
fragment.onTransitionAnimationEnd(true, false);
|
||||
fragment.onBecomeFullyVisible();
|
||||
containerView.setTranslationX(0);
|
||||
}
|
||||
};
|
||||
fragment.onTransitionAnimationStart(true, false);
|
||||
AnimatorSet animation = fragment.onCustomTransitionAnimation(true, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
onAnimationEndCheck(false);
|
||||
}
|
||||
});
|
||||
if (animation == null) {
|
||||
containerView.setAlpha(0.0f);
|
||||
containerView.setTranslationX(48.0f);
|
||||
if (containerView.isKeyboardVisible || containerViewBack.isKeyboardVisible) {
|
||||
waitingForKeyboardCloseRunnable = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (waitingForKeyboardCloseRunnable != this) {
|
||||
return;
|
||||
}
|
||||
startLayoutAnimation(true, true);
|
||||
}
|
||||
};
|
||||
AndroidUtilities.runOnUIThread(waitingForKeyboardCloseRunnable, 200);
|
||||
} else if (fragment.needDelayOpenAnimation()) {
|
||||
delayedOpenAnimationRunnable = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (delayedOpenAnimationRunnable != this) {
|
||||
return;
|
||||
}
|
||||
delayedOpenAnimationRunnable = null;
|
||||
startLayoutAnimation(true, true);
|
||||
}
|
||||
};
|
||||
AndroidUtilities.runOnUIThread(delayedOpenAnimationRunnable, 200);
|
||||
} else {
|
||||
startLayoutAnimation(true, true);
|
||||
}
|
||||
} else {
|
||||
transitionAnimationStartTime = System.currentTimeMillis();
|
||||
transitionAnimationInProgress = true;
|
||||
onOpenAnimationEndRunnable = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (Build.VERSION.SDK_INT > 15) {
|
||||
//containerView.setLayerType(LAYER_TYPE_HARDWARE, null);
|
||||
//containerViewBack.setLayerType(LAYER_TYPE_HARDWARE, null);
|
||||
containerView.setLayerType(LAYER_TYPE_NONE, null);
|
||||
containerViewBack.setLayerType(LAYER_TYPE_NONE, null);
|
||||
}
|
||||
containerView.setAlpha(1.0f);
|
||||
containerView.setTranslationX(0.0f);
|
||||
currentAnimation = animation;
|
||||
presentFragmentInternalRemoveOld(removeLast, currentFragment);
|
||||
fragment.onTransitionAnimationEnd(true, false);
|
||||
fragment.onBecomeFullyVisible();
|
||||
containerView.setTranslationX(0);
|
||||
}
|
||||
};
|
||||
fragment.onTransitionAnimationStart(true, false);
|
||||
{
|
||||
containerView.setAlpha(0.0f);
|
||||
containerView.setTranslationX(48.0f);
|
||||
if (containerView.isKeyboardVisible || containerViewBack.isKeyboardVisible) {
|
||||
waitingForKeyboardCloseRunnable = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (waitingForKeyboardCloseRunnable != this) {
|
||||
return;
|
||||
}
|
||||
startLayoutAnimation(true, true);
|
||||
}
|
||||
};
|
||||
AndroidUtilities.runOnUIThread(waitingForKeyboardCloseRunnable, 200);
|
||||
} else if (fragment.needDelayOpenAnimation()) {
|
||||
delayedOpenAnimationRunnable = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (delayedOpenAnimationRunnable != this) {
|
||||
return;
|
||||
}
|
||||
delayedOpenAnimationRunnable = null;
|
||||
startLayoutAnimation(true, true);
|
||||
}
|
||||
};
|
||||
AndroidUtilities.runOnUIThread(delayedOpenAnimationRunnable, 200);
|
||||
} else {
|
||||
startLayoutAnimation(true, true);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (backgroundView != null) {
|
||||
backgroundView.setAlpha(1.0f);
|
||||
backgroundView.setVisibility(VISIBLE);
|
||||
}
|
||||
fragment.onTransitionAnimationStart(true, false);
|
||||
fragment.onTransitionAnimationEnd(true, false);
|
||||
fragment.onBecomeFullyVisible();
|
||||
@@ -895,7 +833,6 @@ public class ActionBarLayout extends FrameLayout {
|
||||
parent.removeView(previousFragment.actionBar);
|
||||
}
|
||||
containerView.addView(previousFragment.actionBar);
|
||||
previousFragment.actionBar.setTitleOverlayText(titleOverlayText);
|
||||
}
|
||||
containerView.addView(fragmentView);
|
||||
ViewGroup.LayoutParams layoutParams = fragmentView.getLayoutParams();
|
||||
@@ -932,13 +869,8 @@ public class ActionBarLayout extends FrameLayout {
|
||||
previousFragmentFinal.onBecomeFullyVisible();
|
||||
}
|
||||
};
|
||||
AnimatorSet animation = currentFragment.onCustomTransitionAnimation(false, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
onAnimationEndCheck(false);
|
||||
}
|
||||
});
|
||||
if (animation == null) {
|
||||
|
||||
{
|
||||
if (containerView.isKeyboardVisible || containerViewBack.isKeyboardVisible) {
|
||||
waitingForKeyboardCloseRunnable = new Runnable() {
|
||||
@Override
|
||||
@@ -953,12 +885,6 @@ public class ActionBarLayout extends FrameLayout {
|
||||
} else {
|
||||
startLayoutAnimation(false, true);
|
||||
}
|
||||
} else {
|
||||
if (Build.VERSION.SDK_INT > 15) {
|
||||
//containerView.setLayerType(LAYER_TYPE_HARDWARE, null);
|
||||
//containerViewBack.setLayerType(LAYER_TYPE_HARDWARE, null);
|
||||
}
|
||||
currentAnimation = animation;
|
||||
}
|
||||
} else {
|
||||
currentFragment.onTransitionAnimationEnd(false, false);
|
||||
@@ -966,53 +892,8 @@ public class ActionBarLayout extends FrameLayout {
|
||||
previousFragment.onBecomeFullyVisible();
|
||||
}
|
||||
} else {
|
||||
if (useAlphaAnimations) {
|
||||
transitionAnimationStartTime = System.currentTimeMillis();
|
||||
transitionAnimationInProgress = true;
|
||||
|
||||
onCloseAnimationEndRunnable = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
removeFragmentFromStackInternal(currentFragment);
|
||||
setVisibility(GONE);
|
||||
if (backgroundView != null) {
|
||||
backgroundView.setVisibility(GONE);
|
||||
}
|
||||
if (drawerLayoutContainer != null) {
|
||||
drawerLayoutContainer.setAllowOpenDrawer(true, false);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
ArrayList<Animator> animators = new ArrayList<>();
|
||||
animators.add(ObjectAnimator.ofFloat(this, "alpha", 1.0f, 0.0f));
|
||||
if (backgroundView != null) {
|
||||
animators.add(ObjectAnimator.ofFloat(backgroundView, "alpha", 1.0f, 0.0f));
|
||||
}
|
||||
|
||||
currentAnimation = new AnimatorSet();
|
||||
currentAnimation.playTogether(animators);
|
||||
currentAnimation.setInterpolator(accelerateDecelerateInterpolator);
|
||||
currentAnimation.setDuration(200);
|
||||
currentAnimation.addListener(new AnimatorListenerAdapterProxy() {
|
||||
@Override
|
||||
public void onAnimationStart(Animator animation) {
|
||||
transitionAnimationStartTime = System.currentTimeMillis();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAnimationEnd(Animator animation) {
|
||||
onAnimationEndCheck(false);
|
||||
}
|
||||
});
|
||||
currentAnimation.start();
|
||||
} else {
|
||||
removeFragmentFromStackInternal(currentFragment);
|
||||
setVisibility(GONE);
|
||||
if (backgroundView != null) {
|
||||
backgroundView.setVisibility(GONE);
|
||||
}
|
||||
}
|
||||
removeFragmentFromStackInternal(currentFragment);
|
||||
setVisibility(GONE);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1056,7 +937,6 @@ public class ActionBarLayout extends FrameLayout {
|
||||
parent.removeView(previousFragment.actionBar);
|
||||
}
|
||||
containerView.addView(previousFragment.actionBar);
|
||||
previousFragment.actionBar.setTitleOverlayText(titleOverlayText);
|
||||
}
|
||||
containerView.addView(fragmentView);
|
||||
ViewGroup.LayoutParams layoutParams = fragmentView.getLayoutParams();
|
||||
@@ -1078,11 +958,7 @@ public class ActionBarLayout extends FrameLayout {
|
||||
}
|
||||
|
||||
public void removeFragmentFromStack(BaseFragment fragment) {
|
||||
if (useAlphaAnimations && fragmentsStack.size() == 1 && AndroidUtilities.isTablet()) {
|
||||
closeLastFragment(true);
|
||||
} else {
|
||||
removeFragmentFromStackInternal(fragment);
|
||||
}
|
||||
removeFragmentFromStackInternal(fragment);
|
||||
}
|
||||
|
||||
public void removeAllFragments() {
|
||||
@@ -1092,16 +968,6 @@ public class ActionBarLayout extends FrameLayout {
|
||||
}
|
||||
}
|
||||
|
||||
public void rebuildAllFragmentViews(boolean last) {
|
||||
for (int a = 0; a < fragmentsStack.size() - (last ? 0 : 1); a++) {
|
||||
fragmentsStack.get(a).clearViews();
|
||||
fragmentsStack.get(a).setParentLayout(this);
|
||||
}
|
||||
if (delegate != null) {
|
||||
delegate.onRebuildAllFragments(this);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean onKeyUp(int keyCode, KeyEvent event) {
|
||||
if (keyCode == KeyEvent.KEYCODE_MENU && !checkTransitionAnimation() && !startedTracking && currentActionBar != null) {
|
||||
currentActionBar.onMenuButtonPressed();
|
||||
@@ -1184,35 +1050,10 @@ public class ActionBarLayout extends FrameLayout {
|
||||
}
|
||||
}
|
||||
|
||||
public void setUseAlphaAnimations(boolean value) {
|
||||
useAlphaAnimations = value;
|
||||
}
|
||||
|
||||
public void setBackgroundView(View view) {
|
||||
backgroundView = view;
|
||||
}
|
||||
|
||||
public void setDrawerLayoutContainer(DrawerLayoutContainer layout) {
|
||||
drawerLayoutContainer = layout;
|
||||
}
|
||||
|
||||
public DrawerLayoutContainer getDrawerLayoutContainer() {
|
||||
return drawerLayoutContainer;
|
||||
}
|
||||
|
||||
public void setRemoveActionBarExtraHeight(boolean value) {
|
||||
removeActionBarExtraHeight = value;
|
||||
}
|
||||
|
||||
public void setTitleOverlayText(String text) {
|
||||
titleOverlayText = text;
|
||||
for (BaseFragment fragment : fragmentsStack) {
|
||||
if (fragment.actionBar != null) {
|
||||
fragment.actionBar.setTitleOverlayText(titleOverlayText);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasOverlappingRendering() {
|
||||
return false;
|
||||
+2
-2
@@ -21,7 +21,7 @@
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
package com.b44t.ui.ActionBar;
|
||||
package com.b44t.messenger.ActionBar;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.drawable.Drawable;
|
||||
@@ -32,7 +32,7 @@ import android.widget.Toast;
|
||||
import com.b44t.messenger.AndroidUtilities;
|
||||
import com.b44t.messenger.ApplicationLoader;
|
||||
import com.b44t.messenger.R;
|
||||
import com.b44t.ui.Components.LayoutHelper;
|
||||
import com.b44t.messenger.Components.LayoutHelper;
|
||||
|
||||
public class ActionBarMenu extends LinearLayout {
|
||||
|
||||
+3
-11
@@ -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 {
|
||||
|
||||
@@ -466,13 +464,7 @@ public class ActionBarMenuItem extends FrameLayout {
|
||||
}
|
||||
});
|
||||
|
||||
try {
|
||||
Field mCursorDrawableRes = TextView.class.getDeclaredField("mCursorDrawableRes");
|
||||
mCursorDrawableRes.setAccessible(true);
|
||||
mCursorDrawableRes.set(searchField, R.drawable.search_carret);
|
||||
} catch (Exception e) {
|
||||
//nothing to do
|
||||
}
|
||||
|
||||
searchField.setTextIsSelectable(false);
|
||||
if( applyHack ) {
|
||||
searchField.setOnFocusChangeListener(new View.OnFocusChangeListener() {
|
||||
+2
-2
@@ -23,7 +23,7 @@
|
||||
|
||||
//Thanks to https://github.com/JakeWharton/ActionBarSherlock/
|
||||
|
||||
package com.b44t.ui.ActionBar;
|
||||
package com.b44t.messenger.ActionBar;
|
||||
|
||||
import android.animation.Animator;
|
||||
import android.animation.AnimatorSet;
|
||||
@@ -44,7 +44,7 @@ import android.widget.ScrollView;
|
||||
|
||||
import com.b44t.messenger.AndroidUtilities;
|
||||
import com.b44t.messenger.R;
|
||||
import com.b44t.ui.Components.LayoutHelper;
|
||||
import com.b44t.messenger.Components.LayoutHelper;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.HashMap;
|
||||
+1
-1
@@ -21,7 +21,7 @@
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
package com.b44t.ui.ActionBar;
|
||||
package com.b44t.messenger.ActionBar;
|
||||
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Color;
|
||||
+2
-7
@@ -21,9 +21,8 @@
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
package com.b44t.ui.ActionBar;
|
||||
package com.b44t.messenger.ActionBar;
|
||||
|
||||
import android.animation.AnimatorSet;
|
||||
import android.app.Activity;
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
@@ -286,10 +285,6 @@ public class BaseFragment {
|
||||
|
||||
}
|
||||
|
||||
protected AnimatorSet onCustomTransitionAnimation(boolean isOpen, final Runnable callback) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public void onLowMemory() {
|
||||
|
||||
}
|
||||
@@ -312,7 +307,7 @@ public class BaseFragment {
|
||||
}
|
||||
try {
|
||||
visibleDialog = dialog;
|
||||
visibleDialog.setCanceledOnTouchOutside(true);
|
||||
//visibleDialog.setCanceledOnTouchOutside(true); -- we do overwrite this from time to time manually, eg. for showing the setup code. so, not all dialogs should be cancelled when touching outside!
|
||||
visibleDialog.setOnDismissListener(new DialogInterface.OnDismissListener() {
|
||||
@Override
|
||||
public void onDismiss(DialogInterface dialog) {
|
||||
+3
-7
@@ -21,7 +21,7 @@
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
package com.b44t.ui.ActionBar;
|
||||
package com.b44t.messenger.ActionBar;
|
||||
|
||||
import android.animation.Animator;
|
||||
import android.animation.AnimatorSet;
|
||||
@@ -60,7 +60,7 @@ import com.b44t.messenger.AndroidUtilities;
|
||||
import com.b44t.messenger.AnimatorListenerAdapterProxy;
|
||||
import com.b44t.messenger.LocaleController;
|
||||
import com.b44t.messenger.R;
|
||||
import com.b44t.ui.Components.LayoutHelper;
|
||||
import com.b44t.messenger.Components.LayoutHelper;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
@@ -307,11 +307,7 @@ public class BottomSheet extends Dialog {
|
||||
if (containerView != null) {
|
||||
if (!fullWidth) {
|
||||
int widthSpec;
|
||||
if (AndroidUtilities.isTablet()) {
|
||||
widthSpec = MeasureSpec.makeMeasureSpec((int) (Math.min(AndroidUtilities.displaySize.x, AndroidUtilities.displaySize.y) * 0.8f) + backgroundPaddingLeft * 2, MeasureSpec.EXACTLY);
|
||||
} else {
|
||||
widthSpec = MeasureSpec.makeMeasureSpec(isPortrait ? width + backgroundPaddingLeft * 2 : (int) Math.max(width * 0.8f, Math.min(AndroidUtilities.dp(480), width)) + backgroundPaddingLeft * 2, MeasureSpec.EXACTLY);
|
||||
}
|
||||
widthSpec = MeasureSpec.makeMeasureSpec(isPortrait ? width + backgroundPaddingLeft * 2 : (int) Math.max(width * 0.8f, Math.min(AndroidUtilities.dp(480), width)) + backgroundPaddingLeft * 2, MeasureSpec.EXACTLY);
|
||||
containerView.measure(widthSpec, MeasureSpec.makeMeasureSpec(height, MeasureSpec.AT_MOST));
|
||||
} else {
|
||||
containerView.measure(MeasureSpec.makeMeasureSpec(width + backgroundPaddingLeft * 2, MeasureSpec.EXACTLY), MeasureSpec.makeMeasureSpec(height, MeasureSpec.AT_MOST));
|
||||
+1
-1
@@ -21,7 +21,7 @@
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
package com.b44t.ui.ActionBar;
|
||||
package com.b44t.messenger.ActionBar;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Canvas;
|
||||
+9
-14
@@ -21,7 +21,7 @@
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
package com.b44t.ui.ActionBar;
|
||||
package com.b44t.messenger.ActionBar;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.ColorStateList;
|
||||
@@ -39,7 +39,7 @@ import android.os.Build;
|
||||
import com.b44t.messenger.AndroidUtilities;
|
||||
import com.b44t.messenger.ApplicationLoader;
|
||||
import com.b44t.messenger.R;
|
||||
import com.b44t.ui.Components.ChatAttachAlert;
|
||||
import com.b44t.messenger.Components.ChatAttachAlert;
|
||||
|
||||
public class Theme {
|
||||
|
||||
@@ -60,22 +60,17 @@ public class Theme {
|
||||
|
||||
public static final int ATTACH_SHEET_TEXT_COLOR = 0xff757575;
|
||||
|
||||
public static final int DIALOGS_TITLE_TEXT_COLOR = 0xff000000;
|
||||
public static final int DIALOGS_MESSAGE_TEXT_COLOR = 0xff8f8f8f;
|
||||
public static final int DIALOGS_NAME_TEXT_COLOR = 0xff555555;
|
||||
public static final int DIALOGS_SELF_TEXT_COLOR = 0xff00a60e; // from encrypted chat title: 0xff00a60e, alternative: 0xff3c912e
|
||||
public static final int DIALOGS_PRINTING_TEXT_COLOR = 0xff4d83b3;
|
||||
public static final int DIALOGS_DRAFT_TEXT_COLOR = 0xffdd4b39;
|
||||
public static final int CHATLIST_BACKGROUND_COLOR = 0xffffffff;
|
||||
public static final int CHATLIST_DEADDROP_BACKGROUND_COLOR = 0xffd3d3d3;
|
||||
public static final int CHATLIST_TITLE_TEXT_COLOR = 0xff000000;
|
||||
public static final int CHATLIST_MESSAGE_TEXT_COLOR = 0xff8f8f8f;
|
||||
public static final int CHATLIST_NAME_TEXT_COLOR = 0xff555555;
|
||||
public static final int CHATLIST_SELF_TEXT_COLOR = 0xff00a60e; // from encrypted chat title: 0xff00a60e, alternative: 0xff3c912e
|
||||
public static final int CHATLIST_DRAFT_TEXT_COLOR = 0xffdd4b39;
|
||||
|
||||
public static final int CHAT_BOTTOM_OVERLAY_TEXT_COLOR = 0xff7f7f7f;
|
||||
public static final int CHAT_EMPTY_VIEW_TEXT_COLOR = 0xffffffff;
|
||||
|
||||
public static final int STICKERS_SHEET_TITLE_TEXT_COLOR = 0xff212121;
|
||||
public static final int STICKERS_SHEET_SEND_TEXT_COLOR = 0xff3a8ccf;
|
||||
public static final int STICKERS_SHEET_ADD_TEXT_COLOR = 0xff3a8ccf;
|
||||
public static final int STICKERS_SHEET_CLOSE_TEXT_COLOR = 0xff3a8ccf;
|
||||
public static final int STICKERS_SHEET_REMOVE_TEXT_COLOR = 0xffcd5a5a;
|
||||
|
||||
public static final int MSG_SELECTED_BACKGROUND_COLOR = 0x6633b5e5;
|
||||
public static final int MSG_STICKER_NAME_TEXT_COLOR = 0xffffffff;
|
||||
public static final int MSG_IN_TIME_N_FWD_TEXT_COLOR = 0xff9ea7b0;
|
||||
@@ -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
|
||||
|
||||
+8
-19
@@ -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;
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
+7
-13
@@ -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 {
|
||||
|
||||
+3
-3
@@ -21,7 +21,7 @@
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
package com.b44t.ui.Cells;
|
||||
package com.b44t.messenger.Cells;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Paint;
|
||||
@@ -38,8 +38,8 @@ import com.b44t.messenger.LocaleController;
|
||||
import com.b44t.messenger.MediaController;
|
||||
import com.b44t.messenger.MessageObject;
|
||||
import com.b44t.messenger.R;
|
||||
import com.b44t.ui.Components.CheckBoxView;
|
||||
import com.b44t.ui.Components.LayoutHelper;
|
||||
import com.b44t.messenger.Components.CheckBoxView;
|
||||
import com.b44t.messenger.Components.LayoutHelper;
|
||||
|
||||
public class AudioCell extends FrameLayout {
|
||||
|
||||
+1
-1
@@ -21,7 +21,7 @@
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
package com.b44t.ui.Cells;
|
||||
package com.b44t.messenger.Cells;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.drawable.Drawable;
|
||||
+2
-2
@@ -21,7 +21,7 @@
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
package com.b44t.ui.Cells;
|
||||
package com.b44t.messenger.Cells;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Canvas;
|
||||
@@ -35,7 +35,7 @@ import android.view.MotionEvent;
|
||||
import com.b44t.messenger.AndroidUtilities;
|
||||
import com.b44t.messenger.ApplicationLoader;
|
||||
import com.b44t.messenger.MessageObject;
|
||||
import com.b44t.ui.ActionBar.Theme;
|
||||
import com.b44t.messenger.ActionBar.Theme;
|
||||
|
||||
public class ChatActionCell extends BaseCell {
|
||||
|
||||
+89
-168
@@ -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());
|
||||
@@ -1221,7 +1202,6 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||
wasLayout = false;
|
||||
drawNewchatButton = checkNeedDrawNewchatButton(messageObject);
|
||||
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,11 +1314,7 @@ 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));
|
||||
}
|
||||
backgroundWidth = Math.min(displaySize.x - dp(isGroupChat && messageObject.isFromUser() && !messageObject.isOutOwner() ? 102 : 50), dp(270));
|
||||
if (checkNeedDrawNewchatButton(messageObject)) {
|
||||
backgroundWidth -= dp(20);
|
||||
}
|
||||
@@ -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,11 +1385,7 @@ 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)) {
|
||||
maxPhotoWidth -= 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;
|
||||
}
|
||||
@@ -2109,11 +2051,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||
|
||||
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 +2077,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 +2106,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 +2223,23 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||
canvas.restore();
|
||||
}
|
||||
|
||||
if (drawForwardedName && forwardedNameLayout[0] != null && forwardedNameLayout[1] != null) {
|
||||
forwardNameY = dp(10 + (drawNameLayout ? 19 : 0));
|
||||
forwardNamePaint.setColor(Theme.MSG_IN_TIME_N_FWD_TEXT_COLOR);
|
||||
if (allowForwardedName && forwardedNameLayout != null ) {
|
||||
int forwardedNameX = 0;
|
||||
int forwardedNameY = dp(10 + (drawNameLayout ? 19 : 0));
|
||||
forwardedNamePaint.setColor(Theme.MSG_IN_TIME_N_FWD_TEXT_COLOR);
|
||||
if (currentMessageObject.isOutOwner()) {
|
||||
forwardNameX = currentBackgroundDrawable.getBounds().left + dp(11);
|
||||
forwardedNameX = currentBackgroundDrawable.getBounds().left + dp(11);
|
||||
} else {
|
||||
if (mediaBackground) {
|
||||
forwardNameX = currentBackgroundDrawable.getBounds().left + dp(11);
|
||||
forwardedNameX = currentBackgroundDrawable.getBounds().left + dp(11);
|
||||
} else {
|
||||
forwardNameX = currentBackgroundDrawable.getBounds().left + dp(17);
|
||||
forwardedNameX = currentBackgroundDrawable.getBounds().left + dp(17);
|
||||
}
|
||||
}
|
||||
for (int a = 0; a < 2; a++) {
|
||||
canvas.save();
|
||||
canvas.translate(forwardNameX - forwardNameOffsetX[a], forwardNameY + dp(16) * a);
|
||||
forwardedNameLayout[a].draw(canvas);
|
||||
canvas.restore();
|
||||
}
|
||||
canvas.save();
|
||||
canvas.translate(forwardedNameX - forwardedNameOffsetX, forwardedNameY);
|
||||
forwardedNameLayout.draw(canvas);
|
||||
canvas.restore();
|
||||
}
|
||||
|
||||
if (drawTime || !mediaBackground) {
|
||||
+3
-4
@@ -21,21 +21,20 @@
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
package com.b44t.ui.Cells;
|
||||
package com.b44t.messenger.Cells;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Typeface;
|
||||
import android.util.TypedValue;
|
||||
import android.view.Gravity;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.b44t.messenger.AndroidUtilities;
|
||||
import com.b44t.messenger.ApplicationLoader;
|
||||
import com.b44t.messenger.R;
|
||||
import com.b44t.ui.Components.LayoutHelper;
|
||||
import com.b44t.ui.ActionBar.Theme;
|
||||
import com.b44t.messenger.Components.LayoutHelper;
|
||||
import com.b44t.messenger.ActionBar.Theme;
|
||||
|
||||
public class ChatUnreadCell extends FrameLayout {
|
||||
|
||||
+176
-226
@@ -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,32 +65,23 @@ 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 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 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 boolean drawGroupIcon;
|
||||
private int nameMuteLeft;
|
||||
private int nameLockLeft;
|
||||
private int nameLockTop;
|
||||
@@ -122,37 +111,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 +154,32 @@ 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);
|
||||
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 +199,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 +208,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 +216,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.getType()==MrChat.MR_CHAT_GROUP && 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 +317,7 @@ public class DialogCell extends BaseCell {
|
||||
nameLeft += timeWidth;
|
||||
}
|
||||
|
||||
if (drawNameGroup) {
|
||||
if (drawGroupIcon) {
|
||||
nameWidth -= AndroidUtilities.dp(4) + groupDrawable.getIntrinsicWidth();
|
||||
}
|
||||
|
||||
@@ -383,7 +353,7 @@ public class DialogCell extends BaseCell {
|
||||
}
|
||||
}
|
||||
|
||||
if (dialogMuted) {
|
||||
if (chatMuted) {
|
||||
int w = AndroidUtilities.dp(6) + muteDrawable.getIntrinsicWidth();
|
||||
nameWidth -= w;
|
||||
if (LocaleController.isRTL) {
|
||||
@@ -391,6 +361,7 @@ public class DialogCell extends BaseCell {
|
||||
}
|
||||
}
|
||||
|
||||
// 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 +370,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 +397,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 +432,8 @@ public class DialogCell extends BaseCell {
|
||||
messageLeft += w;
|
||||
}
|
||||
drawCount = true;
|
||||
} else {
|
||||
drawCount = false;
|
||||
}
|
||||
|
||||
if (checkMessage) {
|
||||
if (messageString == null) {
|
||||
messageString = "";
|
||||
}
|
||||
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,7 +448,7 @@ public class DialogCell extends BaseCell {
|
||||
if (nameLayout != null && nameLayout.getLineCount() > 0) {
|
||||
left = nameLayout.getLineLeft(0);
|
||||
widthpx = Math.ceil(nameLayout.getLineWidth(0));
|
||||
if (dialogMuted) {
|
||||
if (chatMuted) {
|
||||
nameMuteLeft = (int) (nameLeft + (nameWidth - widthpx) - AndroidUtilities.dp(6) - muteDrawable.getIntrinsicWidth());
|
||||
}
|
||||
if (left == 0) {
|
||||
@@ -486,7 +475,7 @@ public class DialogCell extends BaseCell {
|
||||
nameLeft -= (nameWidth - widthpx);
|
||||
}
|
||||
}
|
||||
if (dialogMuted) {
|
||||
if (chatMuted) {
|
||||
nameMuteLeft = (int) (nameLeft + left + AndroidUtilities.dp(6));
|
||||
}
|
||||
}
|
||||
@@ -502,60 +491,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 +516,15 @@ 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);
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
ContactsController.setupAvatar(this, avatarImage, avatarDrawable, null, m_mrChat);
|
||||
if( currentChatId == MrChat.MR_CHAT_ID_DEADDROP ) {
|
||||
chatMuted = false; // never draw mute icon, the deaddrop is always muted
|
||||
}
|
||||
else {
|
||||
chatMuted = MrMailbox.isDialogMuted(currentChatId);
|
||||
ContactsController.setupAvatar(this, avatarImage, new AvatarDrawable(), null, m_mrChat);
|
||||
}
|
||||
|
||||
if (getMeasuredWidth() != 0 || getMeasuredHeight() != 0) {
|
||||
buildLayout();
|
||||
@@ -594,21 +537,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,7 +593,7 @@ public class DialogCell extends BaseCell {
|
||||
}
|
||||
}
|
||||
|
||||
if (dialogMuted) {
|
||||
if (chatMuted) {
|
||||
setDrawableBounds(muteDrawable, nameMuteLeft, AndroidUtilities.dp(16.5f));
|
||||
muteDrawable.draw(canvas);
|
||||
}
|
||||
@@ -659,20 +601,30 @@ public class DialogCell extends BaseCell {
|
||||
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 +632,6 @@ public class DialogCell extends BaseCell {
|
||||
canvas.drawLine(AndroidUtilities.dp(AndroidUtilities.leftBaseline), getMeasuredHeight() - 1, getMeasuredWidth(), getMeasuredHeight() - 1, linePaint);
|
||||
}
|
||||
}
|
||||
|
||||
avatarImage.draw(canvas);
|
||||
}
|
||||
|
||||
@Override
|
||||
+37
-29
@@ -25,7 +25,7 @@
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
package com.b44t.ui.Cells;
|
||||
package com.b44t.messenger.Cells;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Canvas;
|
||||
@@ -39,8 +39,7 @@ import android.widget.FrameLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.b44t.messenger.AndroidUtilities;
|
||||
import com.b44t.messenger.LocaleController;
|
||||
import com.b44t.ui.Components.LayoutHelper;
|
||||
import com.b44t.messenger.Components.LayoutHelper;
|
||||
|
||||
public class EditTextCell extends FrameLayout {
|
||||
|
||||
@@ -49,14 +48,20 @@ public class EditTextCell extends FrameLayout {
|
||||
private static Paint paint;
|
||||
private boolean needDivider;
|
||||
private boolean useLabel;
|
||||
private boolean multiLine;
|
||||
|
||||
public EditTextCell(Context context) {
|
||||
this(context, true);
|
||||
this(context, true, false);
|
||||
}
|
||||
|
||||
public EditTextCell(Context context, boolean useLabel__) {
|
||||
public EditTextCell(Context context, boolean useLabel) {
|
||||
this(context, useLabel, false);
|
||||
}
|
||||
|
||||
public EditTextCell(Context context, boolean useLabel__, boolean multiLine__) {
|
||||
super(context);
|
||||
useLabel = useLabel__;
|
||||
multiLine = multiLine__;
|
||||
|
||||
if (paint == null) {
|
||||
paint = new Paint();
|
||||
@@ -75,41 +80,44 @@ public class EditTextCell extends FrameLayout {
|
||||
addView(labelTextView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.START | Gravity.TOP,
|
||||
17, 8, 17, 0));
|
||||
|
||||
|
||||
editView = new EditText(context);
|
||||
editView.setTextColor(0xff212121); // ok
|
||||
editView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 18); // ok, normal text is 16
|
||||
editView.setLines(1);
|
||||
editView.setMaxLines(1);
|
||||
editView.setSingleLine(true);
|
||||
editView.setTextColor(0xff212121);
|
||||
editView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 18); // normal text is 16
|
||||
int addImeFlag = 0, addInputType = 0;
|
||||
if( multiLine__ ) {
|
||||
editView.setLines(2);
|
||||
editView.setMaxLines(2);
|
||||
editView.setSingleLine(false);
|
||||
editView.setVerticalScrollBarEnabled(true);
|
||||
editView.setHorizontalScrollBarEnabled(false);
|
||||
editView.setMinimumHeight(AndroidUtilities.dp(100));
|
||||
addInputType = EditorInfo.TYPE_TEXT_FLAG_MULTI_LINE|EditorInfo.TYPE_TEXT_FLAG_CAP_SENTENCES;
|
||||
}
|
||||
else {
|
||||
editView.setLines(1);
|
||||
editView.setMaxLines(1);
|
||||
editView.setSingleLine(true);
|
||||
addInputType = InputType.TYPE_CLASS_TEXT|InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS;
|
||||
addImeFlag = EditorInfo.IME_ACTION_DONE; // just close the keyboard, NEXT would not work as the other entries nay not yet loaded
|
||||
}
|
||||
editView.setHintTextColor(0xffBBBBBB); // was: 0xff979797
|
||||
editView.setGravity(Gravity.START);
|
||||
editView.setInputType(InputType.TYPE_CLASS_TEXT|InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS);
|
||||
editView.setImeOptions(EditorInfo.IME_ACTION_DONE); // just close the keyboard, NEXT would not work as the other entries nay not yet loaded
|
||||
AndroidUtilities.clearCursorDrawable(editView);
|
||||
/*
|
||||
e.setPadding(0, 0, 0, 0);
|
||||
e.setOnEditorActionListener(new TextView.OnEditorActionListener() {
|
||||
@Override
|
||||
public boolean onEditorAction(TextView textView, int i, KeyEvent keyEvent) {
|
||||
if (i == EditorInfo.IME_ACTION_DONE && doneButton != null) {
|
||||
doneButton.performClick();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
});
|
||||
*/
|
||||
editView.setInputType(editView.getInputType()|addInputType);
|
||||
editView.setImeOptions(addImeFlag|EditorInfo.IME_FLAG_NO_EXTRACT_UI);
|
||||
|
||||
addView(editView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.START | Gravity.TOP,
|
||||
17, useLabel? 25 : 25-17, 17, 0));
|
||||
17, useLabel? 25 : 25-17, 17, multiLine?17:0));
|
||||
|
||||
setBackgroundColor(0xffffffff);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
||||
super.onMeasure(widthMeasureSpec, MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(useLabel? 64 : 64-15) + (needDivider ? 1 : 0), MeasureSpec.EXACTLY));
|
||||
int dpheight = multiLine? 49*2 : 49;
|
||||
if( useLabel ) {
|
||||
dpheight += 15;
|
||||
}
|
||||
super.onMeasure(widthMeasureSpec, MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(dpheight)+(needDivider ? 1 : 0), MeasureSpec.EXACTLY));
|
||||
}
|
||||
|
||||
public void setValueHintAndLabel(String value, String hint, String label, boolean divider) {
|
||||
+1
-1
@@ -21,7 +21,7 @@
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
package com.b44t.ui.Cells;
|
||||
package com.b44t.messenger.Cells;
|
||||
|
||||
import android.content.Context;
|
||||
import android.widget.FrameLayout;
|
||||
+2
-3
@@ -21,7 +21,7 @@
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
package com.b44t.ui.Cells;
|
||||
package com.b44t.messenger.Cells;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Typeface;
|
||||
@@ -31,8 +31,7 @@ import android.widget.FrameLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.b44t.messenger.AndroidUtilities;
|
||||
import com.b44t.messenger.LocaleController;
|
||||
import com.b44t.ui.Components.LayoutHelper;
|
||||
import com.b44t.messenger.Components.LayoutHelper;
|
||||
|
||||
public class GreySectionCell extends FrameLayout {
|
||||
private TextView textView;
|
||||
+16
-9
@@ -21,7 +21,7 @@
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
package com.b44t.ui.Cells;
|
||||
package com.b44t.messenger.Cells;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Typeface;
|
||||
@@ -31,21 +31,28 @@ import android.widget.FrameLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.b44t.messenger.AndroidUtilities;
|
||||
import com.b44t.messenger.LocaleController;
|
||||
import com.b44t.ui.Components.LayoutHelper;
|
||||
import com.b44t.messenger.Components.LayoutHelper;
|
||||
|
||||
public class HeaderCell extends FrameLayout {
|
||||
|
||||
private TextView textView;
|
||||
|
||||
static public TextView createTextView(Context context, String text)
|
||||
{
|
||||
TextView ret = new TextView(context);
|
||||
ret.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 15);
|
||||
ret.setTypeface(Typeface.DEFAULT_BOLD);
|
||||
ret.setTextColor(0xff5099c9);
|
||||
ret.setGravity(Gravity.START | Gravity.CENTER_VERTICAL);
|
||||
if( text != null ) {
|
||||
ret.setText(text);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
public HeaderCell(Context context) {
|
||||
super(context);
|
||||
|
||||
textView = new TextView(getContext());
|
||||
textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 15);
|
||||
textView.setTypeface(Typeface.DEFAULT_BOLD);
|
||||
textView.setTextColor(0xff5099c9);
|
||||
textView.setGravity(Gravity.START | Gravity.CENTER_VERTICAL);
|
||||
textView = createTextView(getContext(), null);
|
||||
addView(textView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT, Gravity.START | Gravity.TOP, 17, 15, 17, 0));
|
||||
}
|
||||
|
||||
+5
-5
@@ -21,7 +21,7 @@
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
package com.b44t.ui.Cells;
|
||||
package com.b44t.messenger.Cells;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Rect;
|
||||
@@ -34,10 +34,10 @@ import android.widget.FrameLayout;
|
||||
import com.b44t.messenger.AndroidUtilities;
|
||||
import com.b44t.messenger.MediaController;
|
||||
import com.b44t.messenger.R;
|
||||
import com.b44t.ui.Components.BackupImageView;
|
||||
import com.b44t.ui.Components.CheckBoxView;
|
||||
import com.b44t.ui.Components.LayoutHelper;
|
||||
import com.b44t.ui.PhotoViewer;
|
||||
import com.b44t.messenger.Components.BackupImageView;
|
||||
import com.b44t.messenger.Components.CheckBoxView;
|
||||
import com.b44t.messenger.Components.LayoutHelper;
|
||||
import com.b44t.messenger.PhotoViewer;
|
||||
|
||||
public class PhotoAttachPhotoCell extends FrameLayout {
|
||||
|
||||
+2
-2
@@ -21,7 +21,7 @@
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
package com.b44t.ui.Cells;
|
||||
package com.b44t.messenger.Cells;
|
||||
|
||||
import android.content.Context;
|
||||
import android.text.TextUtils;
|
||||
@@ -32,7 +32,7 @@ import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.b44t.messenger.AndroidUtilities;
|
||||
import com.b44t.ui.Components.LayoutHelper;
|
||||
import com.b44t.messenger.Components.LayoutHelper;
|
||||
|
||||
public class PhotoEditToolCell extends FrameLayout {
|
||||
|
||||
+4
-8
@@ -21,7 +21,7 @@
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
package com.b44t.ui.Cells;
|
||||
package com.b44t.messenger.Cells;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Build;
|
||||
@@ -37,8 +37,8 @@ import android.widget.TextView;
|
||||
import com.b44t.messenger.AndroidUtilities;
|
||||
import com.b44t.messenger.MediaController;
|
||||
import com.b44t.messenger.R;
|
||||
import com.b44t.ui.Components.BackupImageView;
|
||||
import com.b44t.ui.Components.LayoutHelper;
|
||||
import com.b44t.messenger.Components.BackupImageView;
|
||||
import com.b44t.messenger.Components.LayoutHelper;
|
||||
|
||||
public class PhotoPickerAlbumsCell extends FrameLayout {
|
||||
|
||||
@@ -158,11 +158,7 @@ public class PhotoPickerAlbumsCell extends FrameLayout {
|
||||
@Override
|
||||
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
||||
int itemWidth;
|
||||
if (AndroidUtilities.isTablet()) {
|
||||
itemWidth = (AndroidUtilities.dp(490) - ((albumsCount + 1) * AndroidUtilities.dp(4))) / albumsCount;
|
||||
} else {
|
||||
itemWidth = (AndroidUtilities.displaySize.x - ((albumsCount + 1) * AndroidUtilities.dp(4))) / albumsCount;
|
||||
}
|
||||
itemWidth = (AndroidUtilities.displaySize.x - ((albumsCount + 1) * AndroidUtilities.dp(4))) / albumsCount;
|
||||
|
||||
for (int a = 0; a < albumsCount; a++) {
|
||||
LayoutParams layoutParams = (LayoutParams) albumViews[a].getLayoutParams();
|
||||
+4
-4
@@ -21,7 +21,7 @@
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
package com.b44t.ui.Cells;
|
||||
package com.b44t.messenger.Cells;
|
||||
|
||||
import android.animation.Animator;
|
||||
import android.animation.AnimatorSet;
|
||||
@@ -33,9 +33,9 @@ import android.widget.FrameLayout;
|
||||
import com.b44t.messenger.AndroidUtilities;
|
||||
import com.b44t.messenger.AnimatorListenerAdapterProxy;
|
||||
import com.b44t.messenger.R;
|
||||
import com.b44t.ui.Components.BackupImageView;
|
||||
import com.b44t.ui.Components.CheckBoxView;
|
||||
import com.b44t.ui.Components.LayoutHelper;
|
||||
import com.b44t.messenger.Components.BackupImageView;
|
||||
import com.b44t.messenger.Components.CheckBoxView;
|
||||
import com.b44t.messenger.Components.LayoutHelper;
|
||||
|
||||
public class PhotoPickerPhotoCell extends FrameLayout {
|
||||
|
||||
+8
-13
@@ -1,7 +1,6 @@
|
||||
/*******************************************************************************
|
||||
*
|
||||
* Delta Chat Android
|
||||
* (C) 2013-2016 Nikolai Kudashov
|
||||
* (C) 2017 Björn Petersen
|
||||
* Contact: r10s@b44t.com, http://b44t.com
|
||||
*
|
||||
@@ -21,14 +20,12 @@
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
package com.b44t.ui.Cells;
|
||||
package com.b44t.messenger.Cells;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.graphics.PorterDuffColorFilter;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.drawable.BitmapDrawable;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
@@ -42,15 +39,13 @@ import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.b44t.messenger.AndroidUtilities;
|
||||
import com.b44t.messenger.LocaleController;
|
||||
import com.b44t.messenger.MrMailbox;
|
||||
import com.b44t.messenger.ApplicationLoader;
|
||||
import com.b44t.messenger.R;
|
||||
import com.b44t.ui.ActionBar.DrawerLayoutContainer;
|
||||
import com.b44t.ui.Components.LayoutHelper;
|
||||
import com.b44t.ui.ActionBar.Theme;
|
||||
import com.b44t.messenger.Components.LayoutHelper;
|
||||
import com.b44t.messenger.ActionBar.Theme;
|
||||
|
||||
public class DrawerProfileCell extends FrameLayout {
|
||||
public class SettingsProfileCell extends FrameLayout {
|
||||
|
||||
private TextView nameTextView;
|
||||
private TextView subtitleTextView;
|
||||
@@ -58,7 +53,7 @@ public class DrawerProfileCell extends FrameLayout {
|
||||
private Rect destRect = new Rect();
|
||||
private Paint paint = new Paint();
|
||||
|
||||
public DrawerProfileCell(Context context) {
|
||||
public SettingsProfileCell(Context context) {
|
||||
super(context);
|
||||
setBackgroundColor(Theme.ACTION_BAR_COLOR);
|
||||
|
||||
@@ -69,7 +64,7 @@ public class DrawerProfileCell extends FrameLayout {
|
||||
|
||||
nameTextView = new TextView(context);
|
||||
nameTextView.setTextColor(0xffffffff);
|
||||
nameTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, DrawerLayoutContainer.USE_DRAWER? 23 : 26);
|
||||
nameTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 26);
|
||||
nameTextView.setLines(1);
|
||||
nameTextView.setMaxLines(1);
|
||||
nameTextView.setSingleLine(true);
|
||||
@@ -79,7 +74,7 @@ public class DrawerProfileCell extends FrameLayout {
|
||||
|
||||
subtitleTextView = new TextView(context);
|
||||
subtitleTextView.setTextColor(0xffc2e5ff);
|
||||
subtitleTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, DrawerLayoutContainer.USE_DRAWER? 13 : Theme.ACTION_BAR_SUBTITLE_TEXT_SIZE);
|
||||
subtitleTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, Theme.ACTION_BAR_SUBTITLE_TEXT_SIZE);
|
||||
subtitleTextView.setLines(1);
|
||||
subtitleTextView.setMaxLines(1);
|
||||
subtitleTextView.setSingleLine(true);
|
||||
@@ -90,7 +85,7 @@ public class DrawerProfileCell extends FrameLayout {
|
||||
|
||||
@Override
|
||||
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
||||
int mrHeight = DrawerLayoutContainer.USE_DRAWER? 180 : 100/*see also shadow height above*/;
|
||||
int mrHeight = 100/*see also shadow height above*/;
|
||||
if (Build.VERSION.SDK_INT >= 21) {
|
||||
super.onMeasure(widthMeasureSpec, MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(mrHeight) + AndroidUtilities.statusBarHeight, MeasureSpec.EXACTLY));
|
||||
} else {
|
||||
+1
-1
@@ -21,7 +21,7 @@
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
package com.b44t.ui.Cells;
|
||||
package com.b44t.messenger.Cells;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.View;
|
||||
+4
-4
@@ -21,7 +21,7 @@
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
package com.b44t.ui.Cells;
|
||||
package com.b44t.messenger.Cells;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Paint;
|
||||
@@ -36,9 +36,9 @@ import com.b44t.messenger.AndroidUtilities;
|
||||
import com.b44t.messenger.ImageReceiver;
|
||||
import com.b44t.messenger.LocaleController;
|
||||
import com.b44t.messenger.R;
|
||||
import com.b44t.ui.Components.BackupImageView;
|
||||
import com.b44t.ui.Components.CheckBoxView;
|
||||
import com.b44t.ui.Components.LayoutHelper;
|
||||
import com.b44t.messenger.Components.BackupImageView;
|
||||
import com.b44t.messenger.Components.CheckBoxView;
|
||||
import com.b44t.messenger.Components.LayoutHelper;
|
||||
|
||||
public class SharedDocumentCell extends FrameLayout {
|
||||
|
||||
+2
-2
@@ -21,7 +21,7 @@
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
package com.b44t.ui.Cells;
|
||||
package com.b44t.messenger.Cells;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.drawable.Drawable;
|
||||
@@ -31,7 +31,7 @@ import android.widget.ImageView;
|
||||
|
||||
import com.b44t.messenger.AndroidUtilities;
|
||||
import com.b44t.messenger.LocaleController;
|
||||
import com.b44t.ui.ActionBar.SimpleTextView;
|
||||
import com.b44t.messenger.ActionBar.SimpleTextView;
|
||||
|
||||
public class TextCell extends FrameLayout {
|
||||
|
||||
+2
-2
@@ -21,7 +21,7 @@
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
package com.b44t.ui.Cells;
|
||||
package com.b44t.messenger.Cells;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Canvas;
|
||||
@@ -35,7 +35,7 @@ import android.widget.CheckBox;
|
||||
|
||||
import com.b44t.messenger.AndroidUtilities;
|
||||
import com.b44t.messenger.LocaleController;
|
||||
import com.b44t.ui.Components.LayoutHelper;
|
||||
import com.b44t.messenger.Components.LayoutHelper;
|
||||
|
||||
public class TextCheckCell extends FrameLayout {
|
||||
|
||||
+2
-3
@@ -21,7 +21,7 @@
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
package com.b44t.ui.Cells;
|
||||
package com.b44t.messenger.Cells;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Canvas;
|
||||
@@ -32,8 +32,7 @@ import android.widget.FrameLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.b44t.messenger.AndroidUtilities;
|
||||
import com.b44t.messenger.LocaleController;
|
||||
import com.b44t.ui.Components.LayoutHelper;
|
||||
import com.b44t.messenger.Components.LayoutHelper;
|
||||
|
||||
public class TextDetailSettingsCell extends FrameLayout {
|
||||
|
||||
+2
-3
@@ -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 {
|
||||
+2
-4
@@ -21,7 +21,7 @@
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
package com.b44t.ui.Cells;
|
||||
package com.b44t.messenger.Cells;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Canvas;
|
||||
@@ -30,12 +30,10 @@ import android.text.TextUtils;
|
||||
import android.util.TypedValue;
|
||||
import android.view.Gravity;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.b44t.messenger.AndroidUtilities;
|
||||
import com.b44t.messenger.LocaleController;
|
||||
import com.b44t.ui.Components.LayoutHelper;
|
||||
import com.b44t.messenger.Components.LayoutHelper;
|
||||
|
||||
import static com.b44t.messenger.AndroidUtilities.dp;
|
||||
|
||||
+6
-6
@@ -21,7 +21,7 @@
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
package com.b44t.ui.Cells;
|
||||
package com.b44t.messenger.Cells;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.Gravity;
|
||||
@@ -33,11 +33,11 @@ import com.b44t.messenger.ContactsController;
|
||||
import com.b44t.messenger.LocaleController;
|
||||
import com.b44t.messenger.MrContact;
|
||||
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 {
|
||||
|
||||
+3
-3
@@ -21,7 +21,7 @@
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
package com.b44t.ui.Cells;
|
||||
package com.b44t.messenger.Cells;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.drawable.Drawable;
|
||||
@@ -33,8 +33,8 @@ import android.widget.ImageView;
|
||||
import com.b44t.messenger.AndroidUtilities;
|
||||
import com.b44t.messenger.R;
|
||||
import com.b44t.messenger.TLRPC;
|
||||
import com.b44t.ui.Components.BackupImageView;
|
||||
import com.b44t.ui.Components.LayoutHelper;
|
||||
import com.b44t.messenger.Components.BackupImageView;
|
||||
import com.b44t.messenger.Components.LayoutHelper;
|
||||
|
||||
public class WallpaperCell extends FrameLayout {
|
||||
|
||||
+199
-142
@@ -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;
|
||||
@@ -206,15 +191,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 +216,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 +305,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 +324,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,10 +341,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);
|
||||
@@ -443,9 +418,9 @@ 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 )
|
||||
{
|
||||
@@ -461,9 +436,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 +472,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();
|
||||
@@ -505,12 +499,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||
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.setPositiveButton(R.string.OK, null);
|
||||
showDialog(builder.create());
|
||||
actionBar.hideActionMode();
|
||||
updateVisibleRowsFast();
|
||||
@@ -552,7 +541,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||
}
|
||||
});
|
||||
|
||||
if( m_isChatWithDeaddrop && !m_isDeaddropInChatlist ) {
|
||||
if( m_isChatWithDeaddrop /*&& !m_isDeaddropInChatlist*/ ) {
|
||||
actionBar.setTitle(context.getString(R.string.Deaddrop));
|
||||
}
|
||||
else {
|
||||
@@ -614,7 +603,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||
headerItem.addSubItem(ID_SEARCH, context.getString(R.string.Search), 0);
|
||||
|
||||
m_canMute = true;
|
||||
if( m_isChatWithDeaddrop && !m_isDeaddropInChatlist ) {
|
||||
if( m_isChatWithDeaddrop /*&& !m_isDeaddropInChatlist*/ ) {
|
||||
m_canMute = false;
|
||||
}
|
||||
|
||||
@@ -622,15 +611,16 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||
muteMenuEntry = headerItem.addSubItem(ID_MUTE, null, 0);
|
||||
}
|
||||
|
||||
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 ) {
|
||||
if( !m_isChatWithDeaddrop ) {
|
||||
headerItem.addSubItem(ID_SHOW_PROFILE, context.getString(R.string.ViewProfile), 0);
|
||||
}
|
||||
|
||||
if( !m_isChatWithDeaddrop ) {
|
||||
if( m_mrChat.getType()== MrChat.MR_CHAT_GROUP ) {
|
||||
headerItem.addSubItem(ID_LEAVE_GROUP, context.getString(R.string.LeaveGroup), 0);
|
||||
}
|
||||
headerItem.addSubItem(ID_ARCHIVE_CHAT, context.getString(m_mrChat.getArchived()==0? R.string.ArchiveChat : R.string.UnarchiveChat), 0);
|
||||
headerItem.addSubItem(ID_DELETE_CHAT, context.getString(R.string.DeleteChat), 0);
|
||||
}
|
||||
|
||||
@@ -667,11 +657,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 +672,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());
|
||||
}
|
||||
}
|
||||
@@ -860,11 +850,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.getType()==MrChat.MR_CHAT_NORMAL && !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 +1067,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 +1087,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 +1128,6 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||
|
||||
updateBottomOverlay();
|
||||
|
||||
fixLayoutInternal();
|
||||
|
||||
return fragmentView;
|
||||
}
|
||||
|
||||
@@ -1490,7 +1472,7 @@ 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);
|
||||
@@ -1504,7 +1486,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());
|
||||
}
|
||||
@@ -1913,21 +1895,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 +2229,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 +2319,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 +2327,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||
if (avatarContainer != null) {
|
||||
avatarContainer.getViewTreeObserver().removeOnPreDrawListener(this);
|
||||
}
|
||||
return fixLayoutInternal();
|
||||
return true;
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -2375,7 +2341,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 +2358,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 +2423,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 +2443,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);
|
||||
@@ -2702,11 +2665,16 @@ 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) {
|
||||
Toast.makeText(getParentActivity(), ApplicationLoader.applicationContext.getString(R.string.NotYetImplemented), Toast.LENGTH_SHORT).show();
|
||||
querySetupCode(cell.getMessageObject().getId(), null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canPerformActions() {
|
||||
return actionBar != null && !actionBar.isActionModeShowed();
|
||||
@@ -2769,13 +2737,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 +2768,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
|
||||
}
|
||||
|
||||
@@ -2865,6 +2833,19 @@ 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 )
|
||||
{
|
||||
@@ -2932,4 +2913,80 @@ 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)));
|
||||
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());
|
||||
}
|
||||
}
|
||||
+533
-246
File diff suppressed because it is too large
Load Diff
+1
-1
@@ -21,7 +21,7 @@
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
package com.b44t.ui.Components;
|
||||
package com.b44t.messenger.Components;
|
||||
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapShader;
|
||||
+56
-15
@@ -21,7 +21,7 @@
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
package com.b44t.ui.Components;
|
||||
package com.b44t.messenger.Components;
|
||||
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.ColorFilter;
|
||||
@@ -29,38 +29,77 @@ import android.graphics.Paint;
|
||||
import android.graphics.PixelFormat;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Build;
|
||||
import android.text.Layout;
|
||||
import android.text.StaticLayout;
|
||||
import android.text.TextPaint;
|
||||
|
||||
import com.b44t.messenger.AndroidUtilities;
|
||||
|
||||
public class LetterDrawable extends Drawable {
|
||||
public class AvatarDrawable extends Drawable {
|
||||
|
||||
public static Paint paint = new Paint();
|
||||
private static Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG);
|
||||
private static TextPaint namePaint;
|
||||
private static int[] arrColors = {0xffe56555, 0xfff28c48, 0xff8e85ee, 0xff76c84d, 0xff5bb6cc, 0xff549cdd, 0xffd25c99, 0xffb37800}; /* the colors should contrast to typical action bar colors as well as to white (more important, is used as text color)*/
|
||||
|
||||
private int color;
|
||||
private StaticLayout textLayout;
|
||||
private float textWidth;
|
||||
private float textHeight;
|
||||
private float textLeft;
|
||||
private StringBuilder stringBuilder = new StringBuilder(5);
|
||||
|
||||
public LetterDrawable() {
|
||||
public AvatarDrawable() {
|
||||
super();
|
||||
|
||||
if (namePaint == null) {
|
||||
paint.setColor(0xfff0f0f0);
|
||||
namePaint = new TextPaint(Paint.ANTI_ALIAS_FLAG);
|
||||
namePaint.setColor(0xffffffff);
|
||||
namePaint.setTextSize(AndroidUtilities.dp(28));
|
||||
namePaint.setTextSize(AndroidUtilities.dp(20));
|
||||
}
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
private static int getColorIndex(int id) {
|
||||
return Math.abs(id % arrColors.length);
|
||||
}
|
||||
|
||||
public static int getNameColor(String name) {
|
||||
int id = strChecksum(name);
|
||||
return arrColors[getColorIndex(id)];
|
||||
}
|
||||
|
||||
private static int strChecksum(String str) {
|
||||
int ret = 0;
|
||||
if( str!=null ) {
|
||||
int i;
|
||||
for (i = 0; i < str.length(); i++) {
|
||||
ret += (i+1)*str.charAt(i);
|
||||
ret %= 0x00FFFFFF;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
public void setInfoByName(String name) {
|
||||
int id = strChecksum(name);
|
||||
|
||||
color = arrColors[getColorIndex(id)];
|
||||
|
||||
stringBuilder.setLength(0);
|
||||
if (title != null && title.length() > 0) {
|
||||
stringBuilder.append(title.substring(0, 1));
|
||||
if (name != null && name.length() > 0) {
|
||||
stringBuilder.appendCodePoint(name.codePointAt(0));
|
||||
|
||||
for (int a = name.length() - 1; a >= 0; a--) {
|
||||
if (name.charAt(a) == ' ') {
|
||||
if (a != name.length() - 1 && name.charAt(a + 1) != ' ') {
|
||||
if (Build.VERSION.SDK_INT >= 16) {
|
||||
stringBuilder.append("\u200C"); // ZERO WIDTH NON-JOINER - avoids the two letter to melt into a ligature which would be incorrect on the initials
|
||||
}
|
||||
stringBuilder.appendCodePoint(name.codePointAt(a + 1));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (stringBuilder.length() > 0) {
|
||||
@@ -87,23 +126,25 @@ public class LetterDrawable extends Drawable {
|
||||
return;
|
||||
}
|
||||
int size = bounds.width();
|
||||
paint.setColor(color);
|
||||
canvas.save();
|
||||
canvas.drawRect(bounds.left, bounds.top, bounds.right, bounds.bottom, paint);
|
||||
canvas.translate(bounds.left, bounds.top);
|
||||
canvas.drawCircle(size / 2, size / 2, size / 2, paint);
|
||||
|
||||
if (textLayout != null) {
|
||||
canvas.translate(bounds.left + (size - textWidth) / 2 - textLeft, bounds.top + (size - textHeight) / 2);
|
||||
canvas.translate((size - textWidth) / 2 - textLeft, (size - textHeight) / 2);
|
||||
textLayout.draw(canvas);
|
||||
}
|
||||
|
||||
canvas.restore();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAlpha(int alpha) {
|
||||
|
||||
public void setAlpha(int alpha) { // must be present in non-abstract classes derived from Drawable
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setColorFilter(ColorFilter cf) {
|
||||
|
||||
public void setColorFilter(ColorFilter cf) { // must be present in non-abstract classes derived from Drawable
|
||||
}
|
||||
|
||||
@Override
|
||||
+6
-6
@@ -21,7 +21,7 @@
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
package com.b44t.ui.Components;
|
||||
package com.b44t.messenger.Components;
|
||||
|
||||
import android.Manifest;
|
||||
import android.app.Activity;
|
||||
@@ -40,11 +40,11 @@ import com.b44t.messenger.MediaController;
|
||||
import com.b44t.messenger.TLRPC;
|
||||
import com.b44t.messenger.FileLoader;
|
||||
import com.b44t.messenger.UserConfig;
|
||||
import com.b44t.ui.LaunchActivity;
|
||||
import com.b44t.ui.PhotoAlbumPickerActivity;
|
||||
import com.b44t.ui.PhotoCropActivity;
|
||||
import com.b44t.ui.ActionBar.BaseFragment;
|
||||
import com.b44t.ui.PhotoViewer;
|
||||
import com.b44t.messenger.LaunchActivity;
|
||||
import com.b44t.messenger.PhotoAlbumPickerActivity;
|
||||
import com.b44t.messenger.PhotoCropActivity;
|
||||
import com.b44t.messenger.ActionBar.BaseFragment;
|
||||
import com.b44t.messenger.PhotoViewer;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
+1
-1
@@ -21,7 +21,7 @@
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
package com.b44t.ui.Components;
|
||||
package com.b44t.messenger.Components;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Bitmap;
|
||||
+1
-1
@@ -21,7 +21,7 @@
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
package com.b44t.ui.Adapters;
|
||||
package com.b44t.messenger.Components;
|
||||
|
||||
import android.database.DataSetObserver;
|
||||
import android.view.View;
|
||||
+2
-2
@@ -21,14 +21,14 @@
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
package com.b44t.messenger.browser;
|
||||
package com.b44t.messenger.Components;
|
||||
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
|
||||
import com.b44t.ui.LaunchActivity;
|
||||
import com.b44t.messenger.LaunchActivity;
|
||||
|
||||
public class Browser {
|
||||
|
||||
+35
-132
@@ -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;
|
||||
+9
-10
@@ -21,7 +21,7 @@
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
package com.b44t.ui.Components;
|
||||
package com.b44t.messenger.Components;
|
||||
|
||||
import android.Manifest;
|
||||
import android.animation.Animator;
|
||||
@@ -49,19 +49,18 @@ import android.widget.TextView;
|
||||
|
||||
import com.b44t.messenger.AndroidUtilities;
|
||||
import com.b44t.messenger.ApplicationLoader;
|
||||
import com.b44t.messenger.LocaleController;
|
||||
import com.b44t.messenger.MediaController;
|
||||
import com.b44t.messenger.MessageObject;
|
||||
import com.b44t.messenger.NotificationCenter;
|
||||
import com.b44t.messenger.support.widget.LinearLayoutManager;
|
||||
import com.b44t.messenger.aosp.LinearLayoutManager;
|
||||
import com.b44t.messenger.R;
|
||||
import com.b44t.messenger.support.widget.RecyclerView;
|
||||
import com.b44t.messenger.aosp.RecyclerView;
|
||||
import com.b44t.messenger.TLRPC;
|
||||
import com.b44t.ui.ActionBar.BottomSheet;
|
||||
import com.b44t.ui.ActionBar.Theme;
|
||||
import com.b44t.ui.Cells.PhotoAttachPhotoCell;
|
||||
import com.b44t.ui.ChatActivity;
|
||||
import com.b44t.ui.PhotoViewer;
|
||||
import com.b44t.messenger.ActionBar.BottomSheet;
|
||||
import com.b44t.messenger.ActionBar.Theme;
|
||||
import com.b44t.messenger.Cells.PhotoAttachPhotoCell;
|
||||
import com.b44t.messenger.ChatActivity;
|
||||
import com.b44t.messenger.PhotoViewer;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
@@ -757,7 +756,7 @@ public class ChatAttachAlert extends BottomSheet implements NotificationCenter.N
|
||||
}
|
||||
|
||||
private void setUseRevealAnimation(boolean value) {
|
||||
if (!value || value && Build.VERSION.SDK_INT >= 18 && !AndroidUtilities.isTablet()) {
|
||||
if (!value || value && Build.VERSION.SDK_INT >= 18) {
|
||||
useRevealAnimation = value;
|
||||
}
|
||||
}
|
||||
+6
-9
@@ -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 {
|
||||
|
||||
@@ -88,7 +86,6 @@ public class ChatAvatarContainer extends FrameLayout {
|
||||
}
|
||||
|
||||
ProfileActivity fragment = new ProfileActivity(args);
|
||||
fragment.setPlayProfileAnimation(true);
|
||||
parentFragment.presentFragment(fragment);
|
||||
}
|
||||
});
|
||||
+1
-1
@@ -21,7 +21,7 @@
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
package com.b44t.ui.Components;
|
||||
package com.b44t.messenger.Components;
|
||||
|
||||
import android.animation.ObjectAnimator;
|
||||
import android.content.Context;
|
||||
+1
-1
@@ -21,7 +21,7 @@
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
package com.b44t.ui.Components;
|
||||
package com.b44t.messenger.Components;
|
||||
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.drawable.Drawable;
|
||||
+1
-1
@@ -21,7 +21,7 @@
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
package com.b44t.ui.Components;
|
||||
package com.b44t.messenger.Components;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Bitmap;
|
||||
+1
-1
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.b44t.ui.Components;
|
||||
package com.b44t.messenger.Components;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Canvas;
|
||||
+1
-2
@@ -20,7 +20,7 @@
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
package com.b44t.ui.Components;
|
||||
package com.b44t.messenger.Components;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.TypedValue;
|
||||
@@ -32,7 +32,6 @@ import android.widget.ProgressBar;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.b44t.messenger.AndroidUtilities;
|
||||
import com.b44t.messenger.LocaleController;
|
||||
import com.b44t.messenger.R;
|
||||
|
||||
public class EmptyTextProgressView extends FrameLayout {
|
||||
+1
-1
@@ -21,7 +21,7 @@
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
package com.b44t.ui.Components;
|
||||
package com.b44t.messenger.Components;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.Activity;
|
||||
+1
-1
@@ -21,7 +21,7 @@
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
package com.b44t.ui.Components;
|
||||
package com.b44t.messenger.Components;
|
||||
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.LinearLayout;
|
||||
+1
-1
@@ -21,7 +21,7 @@
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
package com.b44t.ui.Components;
|
||||
package com.b44t.messenger.Components;
|
||||
|
||||
import android.graphics.Path;
|
||||
import android.text.StaticLayout;
|
||||
+1
-1
@@ -21,7 +21,7 @@
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
package com.b44t.ui.Components;
|
||||
package com.b44t.messenger.Components;
|
||||
|
||||
import android.animation.Animator;
|
||||
import android.animation.ObjectAnimator;
|
||||
+1
-1
@@ -21,7 +21,7 @@
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
package com.b44t.ui.Components;
|
||||
package com.b44t.messenger.Components;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Canvas;
|
||||
+5
-17
@@ -21,7 +21,7 @@
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
package com.b44t.ui.Components;
|
||||
package com.b44t.messenger.Components;
|
||||
|
||||
import android.animation.Animator;
|
||||
import android.animation.AnimatorSet;
|
||||
@@ -61,13 +61,12 @@ import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.b44t.messenger.AndroidUtilities;
|
||||
import com.b44t.messenger.LocaleController;
|
||||
import com.b44t.messenger.NotificationCenter;
|
||||
import com.b44t.messenger.ApplicationLoader;
|
||||
import com.b44t.messenger.R;
|
||||
import com.b44t.messenger.UserConfig;
|
||||
import com.b44t.messenger.AnimatorListenerAdapterProxy;
|
||||
import com.b44t.ui.ActionBar.Theme;
|
||||
import com.b44t.messenger.ActionBar.Theme;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Locale;
|
||||
@@ -159,7 +158,6 @@ public class PasscodeView extends FrameLayout {
|
||||
passwordEditText.setImeOptions(EditorInfo.IME_ACTION_DONE);
|
||||
passwordEditText.setTypeface(Typeface.DEFAULT);
|
||||
passwordEditText.setBackgroundDrawable(null);
|
||||
AndroidUtilities.clearCursorDrawable(passwordEditText);
|
||||
passwordFrameLayout.addView(passwordEditText);
|
||||
layoutParams = (FrameLayout.LayoutParams) passwordEditText.getLayoutParams();
|
||||
layoutParams.height = LayoutHelper.WRAP_CONTENT;
|
||||
@@ -531,7 +529,7 @@ public class PasscodeView extends FrameLayout {
|
||||
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(getContext());
|
||||
builder.setView(relativeLayout);
|
||||
builder.setNegativeButton(ApplicationLoader.applicationContext.getString(R.string.Cancel), null);
|
||||
builder.setNegativeButton(R.string.Cancel, null);
|
||||
builder.setOnDismissListener(new DialogInterface.OnDismissListener() {
|
||||
@Override
|
||||
public void onDismiss(DialogInterface dialog) {
|
||||
@@ -666,7 +664,7 @@ public class PasscodeView extends FrameLayout {
|
||||
|
||||
LayoutParams layoutParams;
|
||||
|
||||
if (!AndroidUtilities.isTablet() && getContext().getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) {
|
||||
if (getContext().getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) {
|
||||
layoutParams = (LayoutParams) passwordFrameLayout.getLayoutParams();
|
||||
layoutParams.width = UserConfig.passcodeType == 0 ? width / 2 : width;
|
||||
layoutParams.height = AndroidUtilities.dp(140);
|
||||
@@ -682,16 +680,6 @@ public class PasscodeView extends FrameLayout {
|
||||
} else {
|
||||
int top = 0;
|
||||
int left = 0;
|
||||
if (AndroidUtilities.isTablet()) {
|
||||
if (width > AndroidUtilities.dp(498)) {
|
||||
left = (width - AndroidUtilities.dp(498)) / 2;
|
||||
width = AndroidUtilities.dp(498);
|
||||
}
|
||||
if (height > AndroidUtilities.dp(528)) {
|
||||
top = (height - AndroidUtilities.dp(528)) / 2;
|
||||
height = AndroidUtilities.dp(528);
|
||||
}
|
||||
}
|
||||
layoutParams = (LayoutParams) passwordFrameLayout.getLayoutParams();
|
||||
layoutParams.height = height / 3;
|
||||
layoutParams.width = width;
|
||||
@@ -759,7 +747,7 @@ public class PasscodeView extends FrameLayout {
|
||||
getWindowVisibleDisplayFrame(rect);
|
||||
keyboardHeight = usableViewHeight - (rect.bottom - rect.top);
|
||||
|
||||
if (UserConfig.passcodeType == 1 && (AndroidUtilities.isTablet() || getContext().getResources().getConfiguration().orientation != Configuration.ORIENTATION_LANDSCAPE)) {
|
||||
if (UserConfig.passcodeType == 1 && getContext().getResources().getConfiguration().orientation != Configuration.ORIENTATION_LANDSCAPE) {
|
||||
int t = 0;
|
||||
if (passwordFrameLayout.getTag() != null) {
|
||||
t = (Integer) passwordFrameLayout.getTag();
|
||||
+1
-1
@@ -21,7 +21,7 @@
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
package com.b44t.ui.Components;
|
||||
package com.b44t.messenger.Components;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Bitmap;
|
||||
+1
-1
@@ -21,7 +21,7 @@
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
package com.b44t.ui.Components;
|
||||
package com.b44t.messenger.Components;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Canvas;
|
||||
+1
-1
@@ -21,7 +21,7 @@
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
package com.b44t.ui.Components;
|
||||
package com.b44t.messenger.Components;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Canvas;
|
||||
+1
-1
@@ -21,7 +21,7 @@
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
package com.b44t.ui.Components;
|
||||
package com.b44t.messenger.Components;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
+6
-20
@@ -21,7 +21,7 @@
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
package com.b44t.ui.Components;
|
||||
package com.b44t.messenger.Components;
|
||||
|
||||
import android.animation.Animator;
|
||||
import android.animation.AnimatorSet;
|
||||
@@ -49,15 +49,14 @@ import android.widget.TextView;
|
||||
|
||||
import com.b44t.messenger.AndroidUtilities;
|
||||
import com.b44t.messenger.ApplicationLoader;
|
||||
import com.b44t.messenger.LocaleController;
|
||||
import com.b44t.messenger.support.widget.LinearLayoutManager;
|
||||
import com.b44t.messenger.support.widget.RecyclerView;
|
||||
import com.b44t.messenger.aosp.LinearLayoutManager;
|
||||
import com.b44t.messenger.aosp.RecyclerView;
|
||||
import com.b44t.messenger.DispatchQueue;
|
||||
import com.b44t.messenger.R;
|
||||
import com.b44t.messenger.Utilities;
|
||||
import com.b44t.messenger.AnimatorListenerAdapterProxy;
|
||||
import com.b44t.ui.ActionBar.Theme;
|
||||
import com.b44t.ui.Cells.PhotoEditToolCell;
|
||||
import com.b44t.messenger.ActionBar.Theme;
|
||||
import com.b44t.messenger.Cells.PhotoEditToolCell;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.ByteOrder;
|
||||
@@ -2292,7 +2291,7 @@ public class PhotoFilterView extends FrameLayout {
|
||||
}
|
||||
}
|
||||
});
|
||||
editView.addView(valueSeekBar, LayoutHelper.createFrame(AndroidUtilities.isTablet() ? 498 : LayoutHelper.MATCH_PARENT, 60, AndroidUtilities.isTablet() ? Gravity.CENTER_HORIZONTAL | Gravity.TOP : Gravity.START | Gravity.TOP, 14, 10, 14, 0));
|
||||
editView.addView(valueSeekBar, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 60, Gravity.START | Gravity.TOP, 14, 10, 14, 0));
|
||||
|
||||
curveLayout = new FrameLayout(context);
|
||||
editView.addView(curveLayout, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 78, Gravity.CENTER_HORIZONTAL));
|
||||
@@ -2699,19 +2698,6 @@ public class PhotoFilterView extends FrameLayout {
|
||||
layoutParams = (LayoutParams) curvesControl.getLayoutParams();
|
||||
layoutParams.height = viewHeight + AndroidUtilities.dp(28);
|
||||
curvesControl.setLayoutParams(layoutParams);
|
||||
|
||||
if (AndroidUtilities.isTablet()) {
|
||||
int total = AndroidUtilities.dp(86) * 10;
|
||||
layoutParams = (FrameLayout.LayoutParams) recyclerListView.getLayoutParams();
|
||||
if (total < viewWidth) {
|
||||
layoutParams.width = total;
|
||||
layoutParams.leftMargin = (viewWidth - total) / 2;
|
||||
} else {
|
||||
layoutParams.width = LayoutHelper.MATCH_PARENT;
|
||||
layoutParams.leftMargin = 0;
|
||||
}
|
||||
recyclerListView.setLayoutParams(layoutParams);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
+2
-3
@@ -21,7 +21,7 @@
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
package com.b44t.ui.Components;
|
||||
package com.b44t.messenger.Components;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Typeface;
|
||||
@@ -33,9 +33,8 @@ import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.b44t.messenger.AndroidUtilities;
|
||||
import com.b44t.messenger.LocaleController;
|
||||
import com.b44t.messenger.R;
|
||||
import com.b44t.ui.ActionBar.Theme;
|
||||
import com.b44t.messenger.ActionBar.Theme;
|
||||
|
||||
public class PickerBottomLayout extends FrameLayout {
|
||||
|
||||
+1
-1
@@ -21,7 +21,7 @@
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
package com.b44t.ui.Components;
|
||||
package com.b44t.messenger.Components;
|
||||
|
||||
public class Point {
|
||||
public float x;
|
||||
+2
-2
@@ -21,7 +21,7 @@
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
package com.b44t.ui.Components;
|
||||
package com.b44t.messenger.Components;
|
||||
|
||||
import android.animation.ObjectAnimator;
|
||||
import android.content.Context;
|
||||
@@ -34,7 +34,7 @@ import android.graphics.PorterDuffXfermode;
|
||||
import android.view.View;
|
||||
|
||||
import com.b44t.messenger.AndroidUtilities;
|
||||
import com.b44t.ui.ActionBar.Theme;
|
||||
import com.b44t.messenger.ActionBar.Theme;
|
||||
|
||||
public class RadioButton extends View {
|
||||
|
||||
+1
-1
@@ -21,7 +21,7 @@
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
package com.b44t.ui.Components;
|
||||
package com.b44t.messenger.Components;
|
||||
|
||||
public class Rect {
|
||||
|
||||
+2
-2
@@ -21,7 +21,7 @@
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
package com.b44t.ui.Components;
|
||||
package com.b44t.messenger.Components;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.TypedArray;
|
||||
@@ -34,7 +34,7 @@ import android.view.ViewConfiguration;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import com.b44t.messenger.AndroidUtilities;
|
||||
import com.b44t.messenger.support.widget.RecyclerView;
|
||||
import com.b44t.messenger.aosp.RecyclerView;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Method;
|
||||
+1
-1
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.b44t.ui.Components;
|
||||
package com.b44t.messenger.Components;
|
||||
|
||||
import android.content.Context;
|
||||
import android.hardware.SensorManager;
|
||||
+1
-1
@@ -21,7 +21,7 @@
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
package com.b44t.ui.Components;
|
||||
package com.b44t.messenger.Components;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Canvas;
|
||||
+1
-1
@@ -21,7 +21,7 @@
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
package com.b44t.ui.Components;
|
||||
package com.b44t.messenger.Components;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Canvas;
|
||||
+1
-1
@@ -21,7 +21,7 @@
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
package com.b44t.ui.Components;
|
||||
package com.b44t.messenger.Components;
|
||||
|
||||
public class Size {
|
||||
public float width;
|
||||
+1
-1
@@ -21,7 +21,7 @@
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
package com.b44t.ui.Components;
|
||||
package com.b44t.messenger.Components;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Canvas;
|
||||
+1
-1
@@ -21,7 +21,7 @@
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
package com.b44t.ui.Components;
|
||||
package com.b44t.messenger.Components;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Rect;
|
||||
+1
-1
@@ -21,7 +21,7 @@
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
package com.b44t.ui.Components;
|
||||
package com.b44t.messenger.Components;
|
||||
|
||||
import android.os.Build;
|
||||
import android.text.Layout;
|
||||
+1
-1
@@ -21,7 +21,7 @@
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
package com.b44t.ui.Components;
|
||||
package com.b44t.messenger.Components;
|
||||
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.Typeface;
|
||||
+1
-3
@@ -21,17 +21,15 @@
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
package com.b44t.ui.Components;
|
||||
package com.b44t.messenger.Components;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
|
||||
import com.b44t.messenger.AndroidUtilities;
|
||||
import com.b44t.messenger.R;
|
||||
|
||||
public class VideoSeekBarView extends View {
|
||||
+1
-2
@@ -21,9 +21,8 @@
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
package com.b44t.ui.Components;
|
||||
package com.b44t.messenger.Components;
|
||||
|
||||
import android.annotation.TargetApi;
|
||||
import android.content.Context;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.Canvas;
|
||||
+23
-175
@@ -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,43 +20,30 @@
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
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;
|
||||
import android.view.inputmethod.EditorInfo;
|
||||
import android.widget.EditText;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.LinearLayout;
|
||||
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.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.ActionBar.ActionBar;
|
||||
import com.b44t.messenger.ActionBar.ActionBarMenu;
|
||||
import com.b44t.messenger.ActionBar.BaseFragment;
|
||||
import com.b44t.messenger.Cells.HeaderCell;
|
||||
import com.b44t.messenger.Components.LayoutHelper;
|
||||
|
||||
|
||||
public class ContactAddActivity extends BaseFragment implements NotificationCenter.NotificationCenterDelegate, AvatarUpdater.AvatarUpdaterDelegate {
|
||||
public class ContactAddActivity extends BaseFragment implements NotificationCenter.NotificationCenterDelegate {
|
||||
|
||||
private int do_what = 0;
|
||||
public final static int CREATE_CONTACT = 1;
|
||||
@@ -65,11 +51,6 @@ public class ContactAddActivity extends BaseFragment implements NotificationCent
|
||||
|
||||
private EditText nameTextView;
|
||||
private EditText emailTextView;
|
||||
private TLRPC.FileLocation avatar;
|
||||
private TLRPC.InputFile uploadedAvatar;
|
||||
private BackupImageView avatarImage;
|
||||
private AvatarDrawable avatarDrawable;
|
||||
private AvatarUpdater avatarUpdater = new AvatarUpdater();
|
||||
private String nameToSet = null;
|
||||
private int chat_id; // only used for EDIT_NAME in chats
|
||||
private int user_id;
|
||||
@@ -79,16 +60,12 @@ public class ContactAddActivity extends BaseFragment implements NotificationCent
|
||||
|
||||
public ContactAddActivity(Bundle args) {
|
||||
super(args);
|
||||
avatarDrawable = new AvatarDrawable();
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public boolean onFragmentCreate() {
|
||||
NotificationCenter.getInstance().addObserver(this, NotificationCenter.updateInterfaces);
|
||||
avatarUpdater.parentFragment = this;
|
||||
avatarUpdater.delegate = this;
|
||||
avatarUpdater.returnOnly = true;
|
||||
do_what = getArguments().getInt("do_what", 0);
|
||||
user_id = getArguments().getInt("user_id", 0);
|
||||
chat_id = getArguments().getInt("chat_id", 0);
|
||||
@@ -100,8 +77,6 @@ public class ContactAddActivity extends BaseFragment implements NotificationCent
|
||||
public void onFragmentDestroy() {
|
||||
super.onFragmentDestroy();
|
||||
NotificationCenter.getInstance().removeObserver(this, NotificationCenter.updateInterfaces);
|
||||
|
||||
avatarUpdater.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -182,74 +157,22 @@ public class ContactAddActivity extends BaseFragment implements NotificationCent
|
||||
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);
|
||||
nameTextView = new EditText(context);
|
||||
|
||||
avatarImage = new BackupImageView(context);
|
||||
avatarImage.setRoundRadius(AndroidUtilities.dp(32));
|
||||
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 groups (contact photos come from the system's address book)
|
||||
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());
|
||||
}
|
||||
});
|
||||
*/
|
||||
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));
|
||||
}
|
||||
else {
|
||||
nameTextView.setHint(context.getString(R.string.Name));
|
||||
}
|
||||
|
||||
nameTextView = new EditText(context);
|
||||
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, 16);
|
||||
nameTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 18);
|
||||
nameTextView.setHintTextColor(0xff979797);
|
||||
nameTextView.setImeOptions(EditorInfo.IME_FLAG_NO_EXTRACT_UI);
|
||||
nameTextView.setInputType(InputType.TYPE_TEXT_FLAG_CAP_WORDS);
|
||||
@@ -257,36 +180,15 @@ public class ContactAddActivity extends BaseFragment implements NotificationCent
|
||||
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) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterTextChanged(Editable s) {
|
||||
updateAvatar();
|
||||
}
|
||||
});
|
||||
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);
|
||||
emailTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16);
|
||||
emailTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 18);
|
||||
emailTextView.setHintTextColor(0xff979797);
|
||||
emailTextView.setTextColor(0xff212121);
|
||||
emailTextView.setMaxLines(4);
|
||||
@@ -294,70 +196,19 @@ public class ContactAddActivity extends BaseFragment implements NotificationCent
|
||||
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));
|
||||
emailTextView.setHint(context.getString(R.string.EmailAddress));
|
||||
emailTextView.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) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterTextChanged(Editable s) {
|
||||
updateAvatar();
|
||||
}
|
||||
});
|
||||
AndroidUtilities.clearCursorDrawable(emailTextView);
|
||||
linearLayout.addView(emailTextView);
|
||||
LinearLayout.LayoutParams layoutParams2 = (LinearLayout.LayoutParams) emailTextView.getLayoutParams();
|
||||
layoutParams2.width = LayoutHelper.MATCH_PARENT;
|
||||
layoutParams2.height = LayoutHelper.WRAP_CONTENT;
|
||||
layoutParams2.topMargin = AndroidUtilities.dp(16);
|
||||
layoutParams2.leftMargin = AndroidUtilities.dp(16);
|
||||
layoutParams2.rightMargin = AndroidUtilities.dp(16);
|
||||
layoutParams2.gravity = Gravity.CENTER_VERTICAL;
|
||||
emailTextView.setLayoutParams(layoutParams2);
|
||||
linearLayout.addView(emailTextView, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.CENTER_VERTICAL, 18, 1, 18, 0));
|
||||
}
|
||||
|
||||
updateAvatar();
|
||||
|
||||
nameToSet = null;
|
||||
return fragmentView;
|
||||
}
|
||||
|
||||
private void updateAvatar()
|
||||
{
|
||||
String email = null;
|
||||
if( emailTextView != null ) {
|
||||
email = emailTextView.length() > 0? emailTextView.getText().toString() : null;
|
||||
}
|
||||
else if( user_id != 0 ) {
|
||||
email = MrMailbox.getContact(user_id).getAddr();
|
||||
}
|
||||
ContactsController.setupAvatarByStrings(avatarImage, avatarImage.imageReceiver, avatarDrawable,
|
||||
email,
|
||||
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();
|
||||
}
|
||||
|
||||
@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) {
|
||||
@@ -368,9 +219,6 @@ public class ContactAddActivity extends BaseFragment implements NotificationCent
|
||||
|
||||
@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) {
|
||||
@@ -383,7 +231,7 @@ public class ContactAddActivity extends BaseFragment implements NotificationCent
|
||||
|
||||
@Override
|
||||
public void onTransitionAnimationEnd(boolean isOpen, boolean backward) {
|
||||
if (isOpen) {
|
||||
if (isOpen && nameTextView!=null) {
|
||||
nameTextView.requestFocus();
|
||||
AndroidUtilities.showKeyboard(nameTextView);
|
||||
}
|
||||
+93
-22
@@ -23,7 +23,7 @@
|
||||
|
||||
// this file also contains the GroupCreateActivity functionality
|
||||
|
||||
package com.b44t.ui;
|
||||
package com.b44t.messenger;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
@@ -45,6 +45,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 +55,14 @@ 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.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;
|
||||
@@ -291,7 +282,6 @@ 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));
|
||||
|
||||
userSelectEditText.setHint(ApplicationLoader.applicationContext.getString(R.string.Search));
|
||||
@@ -429,7 +419,7 @@ public class ContactsActivity extends BaseFragment implements NotificationCenter
|
||||
}
|
||||
|
||||
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 belonging_chat_id = MrMailbox.createChatByContactId(user.id);
|
||||
@@ -440,7 +430,7 @@ public class ContactsActivity extends BaseFragment implements NotificationCenter
|
||||
}
|
||||
}
|
||||
});
|
||||
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());
|
||||
}
|
||||
@@ -640,4 +630,85 @@ 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;
|
||||
|
||||
public ContactsAdapter(Context context) {
|
||||
mContext = context;
|
||||
contactIds = MrMailbox.getKnownContacts(null);
|
||||
}
|
||||
|
||||
public void setCheckedMap(HashMap<Integer, ?> map) {
|
||||
checkedMap = map;
|
||||
}
|
||||
|
||||
public void setIsScrolling(boolean value) {
|
||||
scrolling = value;
|
||||
}
|
||||
|
||||
public void search(String query) {
|
||||
contactIds = MrMailbox.getKnownContacts(query);
|
||||
lastQuery = query;
|
||||
}
|
||||
|
||||
public void searchAgain() {
|
||||
contactIds = MrMailbox.getKnownContacts(lastQuery);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getItem(int curr_user_index) {
|
||||
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 row) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
return contactIds.length;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(int curr_user_index, View convertView, ViewGroup parent) {
|
||||
if (convertView == null) {
|
||||
convertView = new UserCell(mContext, 1, 1);
|
||||
((UserCell) convertView).setStatusColors(0xffa8a8a8);
|
||||
}
|
||||
|
||||
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) convertView).setData(mrContact, 0);
|
||||
if (checkedMap != null) {
|
||||
((UserCell) convertView).setChecked(checkedMap.containsKey(curr_user_id), !scrolling);
|
||||
}
|
||||
}
|
||||
|
||||
return convertView;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemViewType(int position) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getViewTypeCount() {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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,14 @@ 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) {
|
||||
int chatType = mrChat.getType();
|
||||
if (chatType == MrChat.MR_CHAT_NORMAL) {
|
||||
int[] contact_ids = MrMailbox.getChatContacts(mrChat.getId());
|
||||
if (contact_ids.length == 1) {
|
||||
MrContact mrc = MrMailbox.getContact(contact_ids[0]);
|
||||
@@ -180,16 +181,20 @@ public class ContactsController {
|
||||
tempName = mrc.getDisplayName();
|
||||
}
|
||||
}
|
||||
else if( chatType == MrChat.MR_CHAT_GROUP ) {
|
||||
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 +202,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 +237,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 +293,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 +307,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 +353,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 +363,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) {
|
||||
;
|
||||
|
||||
+11
-15
@@ -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;
|
||||
@@ -368,7 +364,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);
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user