aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsteckbrief <steckbrief@chefmail.de>2015-12-10 20:37:34 +0100
committersteckbrief <steckbrief@chefmail.de>2015-12-10 20:37:34 +0100
commit3b1723dcf19dc6e3390df63a71df903d9cb7dd94 (patch)
treea912db2e2204645fc3138cce62bb75a8d1a9b7d3
parentaa6a2e1c182858e7bcc077f5220546e08df12ec1 (diff)
parenta7454223008c78dcf5e0ff727bca64241f99daa1 (diff)
Merge remote-tracking branch 'remotes/origin/trz/rename' into trz/rebase
-rw-r--r--README.md353
-rw-r--r--build.gradle1
-rw-r--r--libs/SwipyRefreshLayout/build.gradle2
-rw-r--r--libs/thedevstacklogcat/.gitignore1
-rw-r--r--libs/thedevstacklogcat/build.gradle25
-rw-r--r--libs/thedevstacklogcat/proguard-rules.pro17
-rw-r--r--libs/thedevstacklogcat/src/androidTest/java/de/thedevstack/android/logcat/ApplicationTest.java13
-rw-r--r--libs/thedevstacklogcat/src/main/AndroidManifest.xml4
-rw-r--r--libs/thedevstacklogcat/src/main/java/de/thedevstack/android/logcat/Logging.java (renamed from src/main/java/de/thedevstack/conversationsplus/utils/Logging.java)30
-rw-r--r--libs/thedevstacklogcat/src/main/java/de/thedevstack/android/logcat/adapters/LogCatArrayAdapter.java (renamed from src/main/java/de/thedevstack/android/logcat/adapters/LogCatArrayAdapter.java)0
-rw-r--r--libs/thedevstacklogcat/src/main/java/de/thedevstack/android/logcat/tasks/ReadLogCatAsyncTask.java (renamed from src/main/java/de/thedevstack/android/logcat/tasks/ReadLogCatAsyncTask.java)52
-rw-r--r--libs/thedevstacklogcat/src/main/java/de/thedevstack/android/logcat/ui/LogCatOutputCopyOnClickListener.java (renamed from src/main/java/de/thedevstack/android/logcat/ui/LogCatOutputCopyOnClickListener.java)11
-rw-r--r--libs/thedevstacklogcat/src/main/res/values/strings.xml3
-rw-r--r--libs/thedevstacklogcat/src/test/java/de/thedevstack/android/logcat/ExampleUnitTest.java15
-rw-r--r--settings.gradle2
-rw-r--r--src/main/AndroidManifest.xml2
-rw-r--r--src/main/java/de/thedevstack/conversationsplus/ui/LogCatOutputActivity.java (renamed from src/main/java/de/thedevstack/android/logcat/ui/LogCatOutputActivity.java)5
-rw-r--r--src/main/java/de/thedevstack/conversationsplus/ui/dialogs/MessageDetailsDialog.java3
-rw-r--r--src/main/java/de/thedevstack/conversationsplus/ui/preferences/LogInformationPreference.java2
-rw-r--r--src/main/java/de/thedevstack/conversationsplus/utils/AvatarUtil.java2
-rw-r--r--src/main/java/de/thedevstack/conversationsplus/utils/ImageUtil.java3
-rw-r--r--src/main/java/de/tzur/conversations/Settings.java2
-rw-r--r--src/main/java/eu/siacs/conversations/crypto/OtrService.java2
-rw-r--r--src/main/java/eu/siacs/conversations/entities/DownloadableFile.java4
-rw-r--r--src/main/java/eu/siacs/conversations/http/HttpDownloadConnection.java2
-rw-r--r--src/main/java/eu/siacs/conversations/http/HttpUploadConnection.java2
-rw-r--r--src/main/java/eu/siacs/conversations/parser/IqParser.java4
-rw-r--r--src/main/java/eu/siacs/conversations/parser/MessageParser.java2
-rw-r--r--src/main/java/eu/siacs/conversations/persistance/DatabaseBackend.java3
-rw-r--r--src/main/java/eu/siacs/conversations/persistance/FileBackend.java2
-rw-r--r--src/main/java/eu/siacs/conversations/services/MessageArchiveService.java4
-rw-r--r--src/main/java/eu/siacs/conversations/services/XmppConnectionService.java3
-rw-r--r--src/main/java/eu/siacs/conversations/ui/StartConversationActivity.java3
-rw-r--r--src/main/java/eu/siacs/conversations/ui/XmppActivity.java2
-rw-r--r--src/main/java/eu/siacs/conversations/ui/adapter/ConversationAdapter.java2
-rw-r--r--src/main/java/eu/siacs/conversations/ui/listeners/ConversationSwipeRefreshListener.java49
-rw-r--r--src/main/java/eu/siacs/conversations/utils/DNSHelper.java26
-rw-r--r--src/main/java/eu/siacs/conversations/utils/ExceptionHelper.java3
-rw-r--r--src/main/java/eu/siacs/conversations/utils/ExifHelper.java2
-rw-r--r--src/main/java/eu/siacs/conversations/utils/PRNGFixes.java3
-rw-r--r--src/main/java/eu/siacs/conversations/xml/Element.java4
-rw-r--r--src/main/java/eu/siacs/conversations/xml/XmlReader.java11
-rw-r--r--src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java3
-rw-r--r--src/main/java/eu/siacs/conversations/xmpp/jingle/JingleConnection.java2
-rw-r--r--src/main/java/eu/siacs/conversations/xmpp/jingle/JingleConnectionManager.java4
-rw-r--r--src/main/java/eu/siacs/conversations/xmpp/jingle/JingleInbandTransport.java2
-rw-r--r--src/main/java/eu/siacs/conversations/xmpp/jingle/JingleSocks5Transport.java3
47 files changed, 280 insertions, 415 deletions
diff --git a/README.md b/README.md
index 9e7ffd2f..d1a37a6c 100644
--- a/README.md
+++ b/README.md
@@ -1,335 +1,26 @@
-# Conversations
+# Conversations+
-Conversations: the very last word in instant messaging
-
-[![Google Play](http://developer.android.com/images/brand/en_generic_rgb_wo_60.png)](https://play.google.com/store/apps/details?id=eu.siacs.conversations) [![Amazon App Store](https://images-na.ssl-images-amazon.com/images/G/01/AmazonMobileApps/amazon-apps-store-us-black.png)](http://www.amazon.com/dp/B00WD35AAC/)
-
-![screenshots](https://raw.githubusercontent.com/siacs/Conversations/master/screenshots.png)
-
-## Design principles
-
-* Be as beautiful and easy to use as possible without sacrificing security or
- privacy
-* Rely on existing, well established protocols (XMPP)
-* Do not require a Google Account or specifically Google Cloud Messaging (GCM)
-* Require as few permissions as possible
+Conversations+: the improved version of [Conversations](https://github.com/siacs/Conversations/)
## Features
-* End-to-end encryption with either [OTR](https://otr.cypherpunks.ca/) or [OpenPGP](http://www.openpgp.org/about_openpgp/)
-* Send and receive images as well as other kind of files
-* Share your location via an external [plug-in](https://play.google.com/store/apps/details?id=eu.siacs.conversations.sharelocation)
-* Indication when your contact has read your message
-* Intuitive UI that follows Android Design guidelines
-* Pictures / Avatars for your Contacts
-* Syncs with desktop client
-* Conferences (with support for bookmarks)
-* Address book integration
-* Multiple accounts / unified inbox
-* Very low impact on battery life
-
-
-### XMPP Features
-
-Conversations works with every XMPP server out there. However XMPP is an
-extensible protocol. These extensions are standardized as well in so called
-XEP's. Conversations supports a couple of these to make the overall user
-experience better. There is a chance that your current XMPP server does not
-support these extensions; therefore to get the most out of Conversations you
-should consider either switching to an XMPP server that does or — even better —
-run your own XMPP server for you and your friends. These XEP's are:
-
-* XEP-0065: SOCKS5 Bytestreams (or mod_proxy65). Will be used to transfer
- files if both parties are behind a firewall (NAT).
-* XEP-0163: Personal Eventing Protocol for avatars
-* XEP-0191: Blocking command lets you blacklist spammers or block contacts
- without removing them from your roster.
-* XEP-0198: Stream Management allows XMPP to survive small network outages and
- changes of the underlying TCP connection.
-* XEP-0280: Message Carbons which automatically syncs the messages you send to
- your desktop client and thus allows you to switch seamlessly from your mobile
- client to your desktop client and back within one conversation.
-* XEP-0237: Roster Versioning mainly to save bandwidth on poor mobile connections
-* XEP-0313: Message Archive Management synchronize message history with the
- server. Catch up with messages that were sent while Conversations was
- offline.
-* XEP-0352: Client State Indication lets the server know whether or not
- Conversations is in the background. Allows the server to save bandwidth by
- withholding unimportant packages.
-* XEP-xxxx: HttpUpload allows you to share files in conferences and with offline
- contacts. Requires an [additional component](https://github.com/siacs/HttpUploadComponent)
- on your server.
-
-## Team
-
-#### Head of Development
-
-* [Daniel Gultsch](https://github.com/inputmice)
-
-#### Code Contributions
-
-(In order of appearance)
-
-* [Rene Treffer](https://github.com/rtreffer) ([PRs](https://github.com/siacs/Conversations/pulls?utf8=%E2%9C%93&q=is%3Apr+author%3Artreffer+is%3Amerged))
-* [Andreas Straub](https://github.com/strb) ([PRs](https://github.com/siacs/Conversations/pulls?utf8=%E2%9C%93&q=is%3Apr+author%3Astrb+is%3Amerged))
-* [Alethea Butler](https://github.com/alethea) ([PRs](https://github.com/siacs/Conversations/pulls?utf8=%E2%9C%93&q=is%3Apr+author%3Aalethea+is%3Amerged))
-* [M. Dietrich](https://github.com/emdete) ([PRs](https://github.com/siacs/Conversations/pulls?utf8=%E2%9C%93&q=is%3Apr+author%3Aemdete+is%3Amerged))
-* [betheg](https://github.com/betheg) ([PRs](https://github.com/siacs/Conversations/pulls?utf8=%E2%9C%93&q=is%3Apr+author%3Abetheg+is%3Amerged))
-* [Sam Whited](https://github.com/SamWhited) ([PRs](https://github.com/siacs/Conversations/pulls?utf8=%E2%9C%93&q=is%3Apr+author%3ASamWhited+is%3Amerged))
-* [BrianBlade](https://github.com/BrianBlade) ([PRs](https://github.com/siacs/Conversations/pulls?utf8=%E2%9C%93&q=is%3Apr+author%3ABrianBlade+is%3Amerged))
-
-#### Logo
-* [Ilia Rostovtsev](https://github.com/qooob) (Progress)
-* [Diego Turtulici](http://efesto.eigenlab.org/~diesys) (Original)
-
-#### Translations
-Translations are managed on [Transifex](https://www.transifex.com/projects/p/conversations/)
-
-## FAQ
-
-### General
-
-#### How do I install Conversations?
-
-Conversations is entirely open source and licensed under GPLv3. So if you are a
-software developer you can check out the sources from GitHub and use ant to
-build your apk file.
-
-The more convenient way — which not only gives you automatic updates but also
-supports the further development of Conversations — is to buy the App in the
-Google [Play Store](https://play.google.com/store/apps/details?id=eu.siacs.conversations).
-
-Buying the App from the Play Store will also give you access to our [beta test](#beta).
-
-#### I don't have a Google Account but I would still like to make a contribution
-
-I accept donations over PayPal, Bitcoin and Flattr. For donations via PayPal you
-can use the email address `donate@siacs.eu` or the button below.
-
-[![Donate with PayPal](https://www.paypalobjects.com/en_US/i/btn/btn_donate_LG.gif)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=CW3SYT3KG5PDL)
-
-**Disclaimer:** I'm not a huge fan of PayPal and their business policies. For
-larger contributions please get in touch with me beforehand and we can talk
-about bank transfer (SEPA).
-
-My Bitcoin Address is: `1NxSU1YxYzJVDpX1rcESAA3NJki7kRgeeu`
-
-
-[![Flattr this!](http://api.flattr.com/button/flattr-badge-large.png)](https://flattr.com/submit/auto?user_id=inputmice&url=http%3A%2F%2Fconversations.siacs.eu&title=Conversations&tags=github&category=software)
-
-#### How do I create an account?
-
-XMPP, like email, is a federated protocol which means that there is not one
-company you can create an 'official XMPP account' with. Instead there are
-hundreds, or even thousands, of provider out there. To find one use a web search
-engine of your choice. Or maybe your university has one. Or you can run your
-own. Or ask a friend to run one. Once you've found one, you can use
-Conversations to create an account. Just select 'register new account on server'
-within the create account dialog.
-
-#### Where can I set up a custom hostname / port
-Conversations will automatically look up the SRV records for your domain name
-which can point to any hostname port combination. If your server doesn’t provide
-those please contact your admin and have them read
-[this](http://prosody.im/doc/dns#srv_records)
-
-#### Conversations doesn't work for me. Where can I get help?
-
-You can join our conference room on `conversations@conference.siacs.eu`.
-A lot of people in there are able to answer basic questions about the usage of
-Conversations or can provide you with tips on running your own XMPP server. If
-you found a bug or your app crashes please read the Developer / Report Bugs
-section of this document.
-
-#### I need professional support with Conversations or setting up my server
-
-I'm available for hire. Contact me at `inputmice@siacs.eu`.
-
-#### How does the address book integration work?
-
-The address book integration was designed to protect your privacy. Conversations
-neither uploads contacts from your address book to your server nor fills your
-address book with unnecessary contacts from your online roster. If you manually
-add a Jabber ID to your phones address book Conversations will use the name and
-the profile picture of this contact. To make the process of adding Jabber IDs to
-your address book easier you can click on the profile picture in the contact
-details within Conversations. This will start an "add to address book" intent
-with the JID as the payload. This doesn't require Conversations to have write
-permissions on your address book but also doesn't require you to copy/paste a
-JID from one app to another.
-
-#### I get 'delivery failed' on my messages
-
-If you get delivery failed on images it's probably because the recipient lost
-network connectivity during reception. In that case you can try it again at a
-later time.
-
-For text messages the answer to your question is a little bit more complex.
-When you see 'delivery failed' on text messages, it is always something that is
-being reported by the server. The most common reason for this is that the
-recipient failed to resume a connection. When a client loses connectivity for a
-short time the client usually has a five minute window to pick up that
-connection again. When the client fails to do so because the network
-connectivity is out for longer than that all messages sent to that client will
-be returned to the sender resulting in a delivery failed.
-
-Other less common reasons are that the message you sent didn't meet some
-criteria enforced by the server (too large, too many). Another reason could be
-that the recipient is offline and the server doesn't provide offline storage.
-
-Usually you are able to distinguish between these two groups in the fact that
-the first one happens always after some time and the second one happens almost
-instantly.
-
-#### Where can I see the status of my contacts? How can I set a status or priority?
-
-Statuses are a horrible metric. Setting them manually to a proper value rarely
-works because users are either lazy or just forget about them. Setting them
-automatically does not provide quality results either. Keyboard or mouse
-activity as indicator for example fails when the user is just looking at
-something (reading an article, watching a movie). Furthermore automatic setting
-of status always implies an impact on your privacy (are you sure you want
-everybody in your contact list to know that you have been using your computer at
-4am‽).
-
-In the past status has been used to judge the likelihood of whether or not your
-messages are being read. This is no longer necessary. With Chat Markers
-(XEP-0333, supported by Conversations since 0.4) we have the ability to **know**
-whether or not your messages are being read. Similar things can be said for
-priorities. In the past priorities have been used (by servers, not by clients!)
-to route your messages to one specific client. With carbon messages (XEP-0280,
-supported by Conversations since 0.1) this is no longer necessary. Using
-priorities to route OTR messages isn't practical either because they are not
-changeable on the fly. Metrics like last active client (the client which sent
-the last message) are much better.
-
-Unfortunately these modern replacements for legacy XMPP features are not widely
-adopted. However Conversations should be an instant messenger for the future and
-instead of making Conversations compatible with the past we should work on
-implementing new, improved technologies and getting them into other XMPP clients
-as well.
-
-Making these status and priority optional isn't a solution either because
-Conversations is trying to get rid of old behaviours and set an example for
-other clients.
-
-#### Conversations is missing a certain feature
-
-I'm open for new feature suggestions. You can use the [issue tracker][issues] on
-GitHub. Please take some time to browse through the issues to see if someone
-else already suggested it. Be assured that I read each and every ticket. If I
-like it I will leave it open until it's implemented. If I don't like it I will
-close it (usually with a short comment). If I don't comment on an feature
-request that's probably a good sign because this means I agree with you.
-Commenting with +1 on either open or closed issues won't change my mind, nor
-will it accelerate the development.
-
-#### You closed my feature request but I want it really really badly
-
-Just write it yourself and send me a pull request. If I like it I will happily
-merge it if I don't at least you and like minded people get to enjoy it.
-
-#### I need a feature and I need it now!
-
-I am available for hire. Contact me via XMPP: `inputmice@siacs.eu`
-
-### Security
-
-#### Why are there two end-to-end encryption methods and which one should I choose?
-
-In most cases OTR should be the encryption method of choice. It works out of the
-box with most contacts as long as they are online. However PGP can, in some
-cases, (message carbons to multiple clients) be more flexible.
-
-#### How do I use OpenPGP
-
-Before you continue reading you should note that the OpenPGP support in
-Conversations is experimental. This is not because it will make the app unstable
-but because the fundamental concepts of PGP aren't ready for widespread use.
-The way PGP works is that you trust Key IDs instead of JID's or email addresses.
-So in theory your contact list should consist of Public-Key-IDs instead of
-JID's. But of course no email or XMPP client out there implements these
-concepts. Plus PGP in the context of instant messaging has a couple of
-downsides: It is vulnerable to replay attacks, it is rather verbose, and
-decrypting and encrypting takes longer than OTR. It is however asynchronous and
-works well with message carbons.
-
-To use OpenPGP you have to install the open source app
-[OpenKeychain](http://www.openkeychain.org) and then long press on the account in
-manage accounts and choose renew PGP announcement from the contextual menu.
-
-#### How does the encryption for conferences work?
-
-For conferences the only supported encryption method is OpenPGP (OTR does not
-work with multiple participants). Every participant has to announce their
-OpenPGP key (see answer above). If you would like to send encrypted messages to
-a conference you have to make sure that you have every participant's public key
-in your OpenKeychain. Right now there is no check in Conversations to ensure
-that. You have to take care of that yourself. Go to the conference details and
-touch every key id (The hexadecimal number below a contact). This will send you
-to OpenKeychain which will assist you on adding the key. This works best in
-very small conferences with contacts you are already using OpenPGP with. This
-feature is regarded experimental. Conversations is the only client that uses
-XEP-0027 with conferences. (The XEP neither specifically allows nor disallows
-this.)
-
-### Development
-
-<a name="beta"></a>
-#### Beta testing
-If you bought the App on [Google Play](https://play.google.com/store/apps/details?id=eu.siacs.conversations)
-you can get access to the latest beta version by joining the
-[Conversations Beta Testers](https://plus.google.com/communities/107649347599361240873)
-community on Google+ and then using [this link](https://play.google.com/apps/testing/eu.siacs.conversations)
-to sign up for the beta test.
-
-#### How do I build Conversations
-
-Make sure to have ANDROID_HOME point to your Android SDK
-
- git clone https://github.com/siacs/Conversations.git
- cd Conversations
- ./gradlew build
-
-
-[![Build Status](https://travis-ci.org/siacs/Conversations.svg?branch=development)](https://travis-ci.org/siacs/Conversations)
-
-### How do I update/add external libraries?
-
-If the library you want to update is in Maven Central or JCenter (or has its own
-Maven repo), add it or update its version in `build.gradle`. If the library is
-in the `libs/` directory, you can update it using a subtree merge by doing the
-following (using `minidns` as an example):
-
- git remote add minidns https://github.com/rtreffer/minidns.git
- git fetch minidns
- git merge -s subtree minidns master
-
-To add a new dependency to the `libs/` directory (replacing "name", "branch" and
-"url" as necessary):
-
- git remote add name url
- git merge -s ours --no-commit name/branch
- git read-tree --prefix=libs/name -u name/branch
- git commit -m "Subtree merged in name"
-
-#### How do I debug Conversations
-
-If something goes wrong Conversations usually exposes very little information in
-the UI (other than the fact that something didn't work). However with adb
-(android debug bridge) you squeeze some more information out of Conversations.
-These information are especially useful if you are experiencing trouble with
-your connection or with file transfer.
-
- adb -d logcat -v time -s conversations
-
-#### I found a bug
-
-Please report it to our [issue tracker][issues]. If your app crashes please
-provide a stack trace. If you are experiencing misbehaviour please provide
-detailed steps to reproduce. Always mention whether you are running the latest
-Play Store version or the current HEAD. If you are having problems connecting to
-your XMPP server your file transfer doesn’t work as expected please always
-include a logcat debug output with your issue (see above).
-
-[issues]: https://github.com/siacs/Conversations/issues
+Of course Conversations+ supports [all features of Conversations](https://github.com/siacs/Conversations/#features) and in addition:
+
+* smileys like Whatsapp
+* change of LED notification color
+* online status in contact and conversation list
+* Manual loading of last messages from MAM
+* Sending of original images
+
+## Modifications
+
+* unread count badges take care of setting "Conference notifications"
+* swipe to end conversation only in one direction
+* replace ASCII-smileys
+* Swipe to refresh for loading archived messages using MAM
+* settings
+ * confirmation for received and/or read messages
+ * automatically download picture links
+ * automatically download only when wifi enabled
+ * sending original or resized images
+* bugfixes and code improvements \ No newline at end of file
diff --git a/build.gradle b/build.gradle
index e56f3e4a..fb67b7f0 100644
--- a/build.gradle
+++ b/build.gradle
@@ -39,6 +39,7 @@ dependencies {
compile project(':libs:emojicon')
compile project(':libs:colorpicker')
compile project(':libs:SwipyRefreshLayout')
+ compile project(':libs:thedevstacklogcat')
}
android {
diff --git a/libs/SwipyRefreshLayout/build.gradle b/libs/SwipyRefreshLayout/build.gradle
index 68a75ec9..79f47d55 100644
--- a/libs/SwipyRefreshLayout/build.gradle
+++ b/libs/SwipyRefreshLayout/build.gradle
@@ -20,5 +20,5 @@ android {
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
- compile 'com.android.support:appcompat-v7:22.0.+'
+ compile 'com.android.support:appcompat-v7:22.2.1'
}
diff --git a/libs/thedevstacklogcat/.gitignore b/libs/thedevstacklogcat/.gitignore
new file mode 100644
index 00000000..796b96d1
--- /dev/null
+++ b/libs/thedevstacklogcat/.gitignore
@@ -0,0 +1 @@
+/build
diff --git a/libs/thedevstacklogcat/build.gradle b/libs/thedevstacklogcat/build.gradle
new file mode 100644
index 00000000..27db48ea
--- /dev/null
+++ b/libs/thedevstacklogcat/build.gradle
@@ -0,0 +1,25 @@
+apply plugin: 'com.android.library'
+
+android {
+ compileSdkVersion 22
+ buildToolsVersion "22.0.1"
+
+ defaultConfig {
+ minSdkVersion 14
+ targetSdkVersion 22
+ versionCode 1
+ versionName "1.0"
+ }
+ buildTypes {
+ release {
+ minifyEnabled false
+ proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
+ }
+ }
+}
+
+dependencies {
+ compile fileTree(dir: 'libs', include: ['*.jar'])
+ testCompile 'junit:junit:4.12'
+ compile 'com.android.support:appcompat-v7:22.2.1'
+}
diff --git a/libs/thedevstacklogcat/proguard-rules.pro b/libs/thedevstacklogcat/proguard-rules.pro
new file mode 100644
index 00000000..077398be
--- /dev/null
+++ b/libs/thedevstacklogcat/proguard-rules.pro
@@ -0,0 +1,17 @@
+# Add project specific ProGuard rules here.
+# By default, the flags in this file are appended to flags specified
+# in C:\Users\tzur\AppData\Local\Android\Sdk/tools/proguard/proguard-android.txt
+# You can edit the include path and order by changing the proguardFiles
+# directive in build.gradle.
+#
+# For more details, see
+# http://developer.android.com/guide/developing/tools/proguard.html
+
+# Add any project specific keep options here:
+
+# If your project uses WebView with JS, uncomment the following
+# and specify the fully qualified class name to the JavaScript interface
+# class:
+#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
+# public *;
+#}
diff --git a/libs/thedevstacklogcat/src/androidTest/java/de/thedevstack/android/logcat/ApplicationTest.java b/libs/thedevstacklogcat/src/androidTest/java/de/thedevstack/android/logcat/ApplicationTest.java
new file mode 100644
index 00000000..2e381ee7
--- /dev/null
+++ b/libs/thedevstacklogcat/src/androidTest/java/de/thedevstack/android/logcat/ApplicationTest.java
@@ -0,0 +1,13 @@
+package de.thedevstack.android.logcat;
+
+import android.app.Application;
+import android.test.ApplicationTestCase;
+
+/**
+ * <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a>
+ */
+public class ApplicationTest extends ApplicationTestCase<Application> {
+ public ApplicationTest() {
+ super(Application.class);
+ }
+} \ No newline at end of file
diff --git a/libs/thedevstacklogcat/src/main/AndroidManifest.xml b/libs/thedevstacklogcat/src/main/AndroidManifest.xml
new file mode 100644
index 00000000..59448708
--- /dev/null
+++ b/libs/thedevstacklogcat/src/main/AndroidManifest.xml
@@ -0,0 +1,4 @@
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="de.thedevstack.android.logcat">
+
+</manifest>
diff --git a/src/main/java/de/thedevstack/conversationsplus/utils/Logging.java b/libs/thedevstacklogcat/src/main/java/de/thedevstack/android/logcat/Logging.java
index 40ec66a0..6af7a70e 100644
--- a/src/main/java/de/thedevstack/conversationsplus/utils/Logging.java
+++ b/libs/thedevstacklogcat/src/main/java/de/thedevstack/android/logcat/Logging.java
@@ -1,12 +1,36 @@
-package de.thedevstack.conversationsplus.utils;
+package de.thedevstack.android.logcat;
import android.util.Log;
/**
- * Created by tzur on 20.11.2015.
+ * Utility class to prefix every log tag.
+ * This can be used for better filtering in the log cat output activity.
*/
public class Logging {
- protected static final String LOG_TAG_PREFIX = "thedevstack.";
+ /**
+ * The prefix for every log tag.
+ */
+ protected static String LOG_TAG_PREFIX = "thedevstack.";
+
+ /**
+ * Changes the default log tag prefix.
+ * The default value is <code>thedevstack.</code>
+ * @param logTagPrefix the new log tag prefix to use
+ */
+ public static void initLogTagPrefix(String logTagPrefix) {
+ if (null != logTagPrefix) {
+ LOG_TAG_PREFIX = logTagPrefix;
+ }
+ }
+
+ /**
+ * Returns the current log tag prefix.
+ * @return value of Logging.LOG_TAG_PREFIX
+ */
+ public static String getLogTagPrefix() {
+ return LOG_TAG_PREFIX;
+ }
+
/**
* Send a {@link Log#VERBOSE} log message.
* @param tag Used to identify the source of a log message. It usually identifies
diff --git a/src/main/java/de/thedevstack/android/logcat/adapters/LogCatArrayAdapter.java b/libs/thedevstacklogcat/src/main/java/de/thedevstack/android/logcat/adapters/LogCatArrayAdapter.java
index c8a96ea3..c8a96ea3 100644
--- a/src/main/java/de/thedevstack/android/logcat/adapters/LogCatArrayAdapter.java
+++ b/libs/thedevstacklogcat/src/main/java/de/thedevstack/android/logcat/adapters/LogCatArrayAdapter.java
diff --git a/src/main/java/de/thedevstack/android/logcat/tasks/ReadLogCatAsyncTask.java b/libs/thedevstacklogcat/src/main/java/de/thedevstack/android/logcat/tasks/ReadLogCatAsyncTask.java
index b9fa450b..1136faf8 100644
--- a/src/main/java/de/thedevstack/android/logcat/tasks/ReadLogCatAsyncTask.java
+++ b/libs/thedevstacklogcat/src/main/java/de/thedevstack/android/logcat/tasks/ReadLogCatAsyncTask.java
@@ -1,7 +1,6 @@
package de.thedevstack.android.logcat.tasks;
import android.os.AsyncTask;
-import de.thedevstack.conversationsplus.utils.Logging;
import android.widget.ArrayAdapter;
import java.io.BufferedReader;
@@ -9,20 +8,46 @@ import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
-import de.thedevstack.conversationsplus.utils.StreamUtil;
+import de.thedevstack.android.logcat.Logging;
/**
- * Created by tzur on 20.11.2015.
+ * Task to read the logcat of the App.
+ * The command <code>logcat -d -v time</code> is used to load the logs.
+ * This reader uses a white list to restrict the messages to display, otherwise it might be flooded with useless log messages.
+ * The white list checks if a log messages contains one of the following strings:
+ * <ul>
+ * <li>{@value Logging#LOG_TAG_PREFIX}</li>
+ * <li><code>E/</code> - for every error message</li>
+ * <li><code>W/</code> - for every warning message</li>
+ * </ul>
*/
public class ReadLogCatAsyncTask extends AsyncTask<Void, Void, String[]> {
+ /**
+ * The array adapter to publish the log messages to.
+ */
private final ArrayAdapter<String> arrayAdapter;
+ /**
+ * The command to execute logcat.
+ */
private static final String[] LOG_CAT_CMD = { "logcat", "-d", "-v", "time"};
- private static final String[] WHITE_LIST = { "thedevstack.", "E/", "W/" };
- private static final String[] BLACK_LIST = { "D/TextLayoutCache" };
+ /**
+ * The white list to filter log messages.
+ */
+ private static final String[] WHITE_LIST = { Logging.getLogTagPrefix(), "E/", "W/" };
+ /**
+ * Initializes the Task with the array adapter to publish the log messages to.
+ * @param arrayAdapter the array adapter
+ */
public ReadLogCatAsyncTask(ArrayAdapter<String> arrayAdapter) {
this.arrayAdapter = arrayAdapter;
}
+
+ /**
+ * Executes the logcat command, reads the output of the command and returns all log messages.
+ * @param params no params will be passed. (interface compliance)
+ * @return the array of log messages
+ */
@Override
protected String[] doInBackground(Void... params) {
ArrayList<String> logCatOutput = new ArrayList<>();
@@ -34,16 +59,24 @@ public class ReadLogCatAsyncTask extends AsyncTask<Void, Void, String[]> {
while ((line = bufferedReader.readLine()) != null) {
logCatOutput.add(line);
}
- bufferedReader.close();
} catch (IOException e) {
Logging.e("ReadLogCat", "error while retrieving information from logcat: " + e.getMessage(), e);
} finally {
- StreamUtil.close(bufferedReader);
+ if (null != bufferedReader) {
+ try {
+ bufferedReader.close();
+ } catch (IOException e) {
+ }
+ }
}
logCatOutput.trimToSize();
return logCatOutput.toArray(new String[0]);
}
+ /**
+ * Clears the array adapter and adds the filtered log messages.
+ * @param items all log messages
+ */
@Override
protected void onPostExecute(String[] items) {
this.arrayAdapter.clear();
@@ -56,6 +89,11 @@ public class ReadLogCatAsyncTask extends AsyncTask<Void, Void, String[]> {
}
}
+ /**
+ * Checks whether a log message contains a white listed string or not.
+ * @param item the item to filter
+ * @return <code>true</code> if the string should be filtered (removed from the list) <code>false</code> otherwise.
+ */
protected boolean filter(String item) {
for (String whiteListed : ReadLogCatAsyncTask.WHITE_LIST) {
if (item.contains(whiteListed)) {
diff --git a/src/main/java/de/thedevstack/android/logcat/ui/LogCatOutputCopyOnClickListener.java b/libs/thedevstacklogcat/src/main/java/de/thedevstack/android/logcat/ui/LogCatOutputCopyOnClickListener.java
index 1a37555a..6568a2c5 100644
--- a/src/main/java/de/thedevstack/android/logcat/ui/LogCatOutputCopyOnClickListener.java
+++ b/libs/thedevstacklogcat/src/main/java/de/thedevstack/android/logcat/ui/LogCatOutputCopyOnClickListener.java
@@ -9,9 +9,6 @@ import android.widget.Toast;
import java.util.ArrayList;
import de.thedevstack.android.logcat.adapters.LogCatArrayAdapter;
-import de.thedevstack.conversationsplus.ConversationsPlusApplication;
-
-import eu.siacs.conversations.R;
/**
* Created by tzur on 20.11.2015.
@@ -19,10 +16,12 @@ import eu.siacs.conversations.R;
public class LogCatOutputCopyOnClickListener implements View.OnClickListener {
private final LogCatArrayAdapter logCatOutputAdapter;
private final Context context;
+ private final int resIdForToast;
- public LogCatOutputCopyOnClickListener(Context context, LogCatArrayAdapter logCatOutputAdapter) {
+ public LogCatOutputCopyOnClickListener(Context context, LogCatArrayAdapter logCatOutputAdapter, int resIdForToast) {
this.logCatOutputAdapter = logCatOutputAdapter;
this.context = context;
+ this.resIdForToast = resIdForToast;
}
@Override
@@ -34,10 +33,10 @@ public class LogCatOutputCopyOnClickListener implements View.OnClickListener {
sb.append(item);
sb.append("\n");
}
- ClipboardManager clipboard = (ClipboardManager) ConversationsPlusApplication.getInstance().getSystemService(Context.CLIPBOARD_SERVICE);
+ ClipboardManager clipboard = (ClipboardManager) this.context.getSystemService(Context.CLIPBOARD_SERVICE);
ClipData clip = ClipData.newPlainText("c+logcat", sb.toString());
clipboard.setPrimaryClip(clip);
- Toast.makeText(this.context, R.string.cplus_copied_to_clipboard, Toast.LENGTH_LONG).show();
+ Toast.makeText(this.context, this.context.getText(this.resIdForToast), Toast.LENGTH_LONG).show();
}
}
}
diff --git a/libs/thedevstacklogcat/src/main/res/values/strings.xml b/libs/thedevstacklogcat/src/main/res/values/strings.xml
new file mode 100644
index 00000000..45f5e7fd
--- /dev/null
+++ b/libs/thedevstacklogcat/src/main/res/values/strings.xml
@@ -0,0 +1,3 @@
+<resources>
+ <string name="thedevstack_logcat_copy">Copy</string>
+</resources>
diff --git a/libs/thedevstacklogcat/src/test/java/de/thedevstack/android/logcat/ExampleUnitTest.java b/libs/thedevstacklogcat/src/test/java/de/thedevstack/android/logcat/ExampleUnitTest.java
new file mode 100644
index 00000000..1d2bc545
--- /dev/null
+++ b/libs/thedevstacklogcat/src/test/java/de/thedevstack/android/logcat/ExampleUnitTest.java
@@ -0,0 +1,15 @@
+package de.thedevstack.android.logcat;
+
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+/**
+ * To work on unit tests, switch the Test Artifact in the Build Variants view.
+ */
+public class ExampleUnitTest {
+ @Test
+ public void addition_isCorrect() throws Exception {
+ assertEquals(4, 2 + 2);
+ }
+} \ No newline at end of file
diff --git a/settings.gradle b/settings.gradle
index 8a0916ed..f2ffef35 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -1,4 +1,4 @@
-include ':libs:MemorizingTrustManager', ':libs:emojicon', ':libs:colorpicker', ':libs:SwipyRefreshLayout'
+include ':libs:MemorizingTrustManager', ':libs:emojicon', ':libs:colorpicker', ':libs:SwipyRefreshLayout', ':libs:thedevstacklogcat'
include ':libs:openpgp-api-lib'
rootProject.name = 'Conversations'
diff --git a/src/main/AndroidManifest.xml b/src/main/AndroidManifest.xml
index 68aa2148..be7aac5a 100644
--- a/src/main/AndroidManifest.xml
+++ b/src/main/AndroidManifest.xml
@@ -145,7 +145,7 @@
android:value="eu.siacs.conversations.ui.SettingsActivity" />
</activity>
<activity
- android:name="de.thedevstack.android.logcat.ui.LogCatOutputActivity"
+ android:name="de.thedevstack.conversationsplus.ui.LogCatOutputActivity"
android:label="@string/title_activity_loginformation"
android:parentActivityName="de.thedevstack.conversationsplus.ui.SettingsActivity" >
<meta-data
diff --git a/src/main/java/de/thedevstack/android/logcat/ui/LogCatOutputActivity.java b/src/main/java/de/thedevstack/conversationsplus/ui/LogCatOutputActivity.java
index 477cfc48..733da0cc 100644
--- a/src/main/java/de/thedevstack/android/logcat/ui/LogCatOutputActivity.java
+++ b/src/main/java/de/thedevstack/conversationsplus/ui/LogCatOutputActivity.java
@@ -1,4 +1,4 @@
-package de.thedevstack.android.logcat.ui;
+package de.thedevstack.conversationsplus.ui;
import android.app.Activity;
import android.os.Bundle;
@@ -7,6 +7,7 @@ import android.widget.ListView;
import de.thedevstack.android.logcat.adapters.LogCatArrayAdapter;
import de.thedevstack.android.logcat.tasks.ReadLogCatAsyncTask;
+import de.thedevstack.android.logcat.ui.LogCatOutputCopyOnClickListener;
import eu.siacs.conversations.R;
@@ -23,6 +24,6 @@ public class LogCatOutputActivity extends Activity {
lv.setAdapter(logCatOutputAdapter);
new ReadLogCatAsyncTask(logCatOutputAdapter).execute();
Button copyButton = (Button) findViewById(R.id.actLogOutputCopyButton);
- copyButton.setOnClickListener(new LogCatOutputCopyOnClickListener(this, logCatOutputAdapter));
+ copyButton.setOnClickListener(new LogCatOutputCopyOnClickListener(this, logCatOutputAdapter, R.string.cplus_copied_to_clipboard));
}
}
diff --git a/src/main/java/de/thedevstack/conversationsplus/ui/dialogs/MessageDetailsDialog.java b/src/main/java/de/thedevstack/conversationsplus/ui/dialogs/MessageDetailsDialog.java
index 7d82223c..b1b2298b 100644
--- a/src/main/java/de/thedevstack/conversationsplus/ui/dialogs/MessageDetailsDialog.java
+++ b/src/main/java/de/thedevstack/conversationsplus/ui/dialogs/MessageDetailsDialog.java
@@ -2,12 +2,13 @@ package de.thedevstack.conversationsplus.ui.dialogs;
import android.app.Activity;
import android.text.format.DateFormat;
-import de.thedevstack.conversationsplus.utils.Logging;
import android.view.View;
import android.widget.TextView;
import java.util.Date;
+import de.thedevstack.android.logcat.Logging;
+
import eu.siacs.conversations.R;
import eu.siacs.conversations.entities.Conversation;
import eu.siacs.conversations.entities.Message;
diff --git a/src/main/java/de/thedevstack/conversationsplus/ui/preferences/LogInformationPreference.java b/src/main/java/de/thedevstack/conversationsplus/ui/preferences/LogInformationPreference.java
index 65b3b1b3..5dcfc607 100644
--- a/src/main/java/de/thedevstack/conversationsplus/ui/preferences/LogInformationPreference.java
+++ b/src/main/java/de/thedevstack/conversationsplus/ui/preferences/LogInformationPreference.java
@@ -5,7 +5,7 @@ import android.content.Intent;
import android.preference.Preference;
import android.util.AttributeSet;
-import de.thedevstack.android.logcat.ui.LogCatOutputActivity;
+import de.thedevstack.conversationsplus.ui.LogCatOutputActivity;
/**
* Created by tzur on 07.10.2015.
diff --git a/src/main/java/de/thedevstack/conversationsplus/utils/AvatarUtil.java b/src/main/java/de/thedevstack/conversationsplus/utils/AvatarUtil.java
index 6b080202..401c77fc 100644
--- a/src/main/java/de/thedevstack/conversationsplus/utils/AvatarUtil.java
+++ b/src/main/java/de/thedevstack/conversationsplus/utils/AvatarUtil.java
@@ -4,7 +4,6 @@ import android.graphics.Bitmap;
import android.net.Uri;
import android.util.Base64;
import android.util.Base64OutputStream;
-import de.thedevstack.conversationsplus.utils.Logging;
import java.io.ByteArrayOutputStream;
import java.io.File;
@@ -16,6 +15,7 @@ import java.security.DigestOutputStream;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
+import de.thedevstack.android.logcat.Logging;
import de.thedevstack.conversationsplus.ConversationsPlusApplication;
import eu.siacs.conversations.Config;
diff --git a/src/main/java/de/thedevstack/conversationsplus/utils/ImageUtil.java b/src/main/java/de/thedevstack/conversationsplus/utils/ImageUtil.java
index 802c7ffb..204f56c4 100644
--- a/src/main/java/de/thedevstack/conversationsplus/utils/ImageUtil.java
+++ b/src/main/java/de/thedevstack/conversationsplus/utils/ImageUtil.java
@@ -7,7 +7,6 @@ import android.graphics.Matrix;
import android.graphics.RectF;
import android.media.ExifInterface;
import android.net.Uri;
-import de.thedevstack.conversationsplus.utils.Logging;
import android.util.LruCache;
import java.io.File;
@@ -15,6 +14,8 @@ import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
+import de.thedevstack.android.logcat.Logging;
+
import eu.siacs.conversations.entities.Message;
import eu.siacs.conversations.persistance.FileBackend;
import eu.siacs.conversations.utils.ExifHelper;
diff --git a/src/main/java/de/tzur/conversations/Settings.java b/src/main/java/de/tzur/conversations/Settings.java
index b8922f0a..2484a88f 100644
--- a/src/main/java/de/tzur/conversations/Settings.java
+++ b/src/main/java/de/tzur/conversations/Settings.java
@@ -1,8 +1,8 @@
package de.tzur.conversations;
import android.content.SharedPreferences;
-import de.thedevstack.conversationsplus.utils.Logging;
+import de.thedevstack.android.logcat.Logging;
import de.thedevstack.conversationsplus.ConversationsPlusApplication;
/**
diff --git a/src/main/java/eu/siacs/conversations/crypto/OtrService.java b/src/main/java/eu/siacs/conversations/crypto/OtrService.java
index 5d8ed668..40915981 100644
--- a/src/main/java/eu/siacs/conversations/crypto/OtrService.java
+++ b/src/main/java/eu/siacs/conversations/crypto/OtrService.java
@@ -14,7 +14,7 @@ import java.security.spec.InvalidKeySpecException;
import org.json.JSONException;
import org.json.JSONObject;
-import de.thedevstack.conversationsplus.utils.Logging;
+import de.thedevstack.android.logcat.Logging;
import eu.siacs.conversations.Config;
import de.thedevstack.conversationsplus.ConversationsPlusPreferences;
diff --git a/src/main/java/eu/siacs/conversations/entities/DownloadableFile.java b/src/main/java/eu/siacs/conversations/entities/DownloadableFile.java
index fdda6d0e..c6a7d3d7 100644
--- a/src/main/java/eu/siacs/conversations/entities/DownloadableFile.java
+++ b/src/main/java/eu/siacs/conversations/entities/DownloadableFile.java
@@ -19,11 +19,11 @@ import javax.crypto.NoSuchPaddingException;
import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.SecretKeySpec;
+import de.thedevstack.android.logcat.Logging;
+
import eu.siacs.conversations.Config;
import eu.siacs.conversations.utils.MimeUtils;
-import de.thedevstack.conversationsplus.utils.Logging;
-
public class DownloadableFile extends File {
private static final long serialVersionUID = 2247012619505115863L;
diff --git a/src/main/java/eu/siacs/conversations/http/HttpDownloadConnection.java b/src/main/java/eu/siacs/conversations/http/HttpDownloadConnection.java
index 8c062c91..5f0d3436 100644
--- a/src/main/java/eu/siacs/conversations/http/HttpDownloadConnection.java
+++ b/src/main/java/eu/siacs/conversations/http/HttpDownloadConnection.java
@@ -3,7 +3,6 @@ package eu.siacs.conversations.http;
import android.content.Intent;
import android.net.Uri;
import android.os.SystemClock;
-import de.thedevstack.conversationsplus.utils.Logging;
import java.io.BufferedInputStream;
import java.io.IOException;
@@ -16,6 +15,7 @@ import java.util.Arrays;
import javax.net.ssl.HttpsURLConnection;
import javax.net.ssl.SSLHandshakeException;
+import de.thedevstack.android.logcat.Logging;
import de.thedevstack.conversationsplus.ConversationsPlusPreferences;
import eu.siacs.conversations.Config;
diff --git a/src/main/java/eu/siacs/conversations/http/HttpUploadConnection.java b/src/main/java/eu/siacs/conversations/http/HttpUploadConnection.java
index 5a5d8898..dc2c35d7 100644
--- a/src/main/java/eu/siacs/conversations/http/HttpUploadConnection.java
+++ b/src/main/java/eu/siacs/conversations/http/HttpUploadConnection.java
@@ -1,7 +1,6 @@
package eu.siacs.conversations.http;
import android.app.PendingIntent;
-import de.thedevstack.conversationsplus.utils.Logging;
import java.io.IOException;
import java.io.InputStream;
@@ -12,6 +11,7 @@ import java.net.URL;
import javax.net.ssl.HttpsURLConnection;
+import de.thedevstack.android.logcat.Logging;
import de.thedevstack.conversationsplus.utils.StreamUtil;
import eu.siacs.conversations.Config;
diff --git a/src/main/java/eu/siacs/conversations/parser/IqParser.java b/src/main/java/eu/siacs/conversations/parser/IqParser.java
index fec83e5f..241daabb 100644
--- a/src/main/java/eu/siacs/conversations/parser/IqParser.java
+++ b/src/main/java/eu/siacs/conversations/parser/IqParser.java
@@ -1,10 +1,10 @@
package eu.siacs.conversations.parser;
-import de.thedevstack.conversationsplus.utils.Logging;
-
import java.util.ArrayList;
import java.util.Collection;
+import de.thedevstack.android.logcat.Logging;
+
import eu.siacs.conversations.Config;
import eu.siacs.conversations.entities.Account;
import eu.siacs.conversations.entities.Contact;
diff --git a/src/main/java/eu/siacs/conversations/parser/MessageParser.java b/src/main/java/eu/siacs/conversations/parser/MessageParser.java
index 7e7bb2fa..cb64630d 100644
--- a/src/main/java/eu/siacs/conversations/parser/MessageParser.java
+++ b/src/main/java/eu/siacs/conversations/parser/MessageParser.java
@@ -1,11 +1,11 @@
package eu.siacs.conversations.parser;
-import de.thedevstack.conversationsplus.utils.Logging;
import android.util.Pair;
import net.java.otr4j.session.Session;
import net.java.otr4j.session.SessionStatus;
+import de.thedevstack.android.logcat.Logging;
import de.thedevstack.conversationsplus.ConversationsPlusPreferences;
import de.thedevstack.conversationsplus.utils.AvatarUtil;
diff --git a/src/main/java/eu/siacs/conversations/persistance/DatabaseBackend.java b/src/main/java/eu/siacs/conversations/persistance/DatabaseBackend.java
index c6701900..50f6d4d4 100644
--- a/src/main/java/eu/siacs/conversations/persistance/DatabaseBackend.java
+++ b/src/main/java/eu/siacs/conversations/persistance/DatabaseBackend.java
@@ -4,6 +4,8 @@ import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;
+import de.thedevstack.android.logcat.Logging;
+
import eu.siacs.conversations.Config;
import eu.siacs.conversations.entities.Account;
import eu.siacs.conversations.entities.Contact;
@@ -18,7 +20,6 @@ import android.database.Cursor;
import android.database.sqlite.SQLiteCantOpenDatabaseException;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
-import de.thedevstack.conversationsplus.utils.Logging;
public class DatabaseBackend extends SQLiteOpenHelper {
diff --git a/src/main/java/eu/siacs/conversations/persistance/FileBackend.java b/src/main/java/eu/siacs/conversations/persistance/FileBackend.java
index 301140e9..8e09131f 100644
--- a/src/main/java/eu/siacs/conversations/persistance/FileBackend.java
+++ b/src/main/java/eu/siacs/conversations/persistance/FileBackend.java
@@ -16,9 +16,9 @@ import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.net.Uri;
import android.os.Environment;
-import de.thedevstack.conversationsplus.utils.Logging;
import android.webkit.MimeTypeMap;
+import de.thedevstack.android.logcat.Logging;
import de.thedevstack.conversationsplus.ConversationsPlusApplication;
import de.thedevstack.conversationsplus.exceptions.FileCopyException;
import de.thedevstack.conversationsplus.utils.ImageUtil;
diff --git a/src/main/java/eu/siacs/conversations/services/MessageArchiveService.java b/src/main/java/eu/siacs/conversations/services/MessageArchiveService.java
index 58d59288..e86ca573 100644
--- a/src/main/java/eu/siacs/conversations/services/MessageArchiveService.java
+++ b/src/main/java/eu/siacs/conversations/services/MessageArchiveService.java
@@ -1,13 +1,13 @@
package eu.siacs.conversations.services;
-import de.thedevstack.conversationsplus.utils.Logging;
-
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
+import de.thedevstack.android.logcat.Logging;
+
import eu.siacs.conversations.Config;
import eu.siacs.conversations.R;
import eu.siacs.conversations.entities.Account;
diff --git a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java
index 8d3bd7ce..0a32755d 100644
--- a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java
+++ b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java
@@ -21,7 +21,6 @@ import android.os.PowerManager;
import android.os.PowerManager.WakeLock;
import android.os.SystemClock;
import android.provider.ContactsContract;
-import de.thedevstack.conversationsplus.utils.Logging;
import net.java.otr4j.OtrException;
import net.java.otr4j.session.Session;
@@ -50,6 +49,8 @@ import java.util.Map;
import java.util.concurrent.CopyOnWriteArrayList;
import de.duenndns.ssl.MemorizingTrustManager;
+
+import de.thedevstack.android.logcat.Logging;
import de.thedevstack.conversationsplus.ConversationsPlusApplication;
import de.thedevstack.conversationsplus.ConversationsPlusPreferences;
import de.thedevstack.conversationsplus.exceptions.FileCopyException;
diff --git a/src/main/java/eu/siacs/conversations/ui/StartConversationActivity.java b/src/main/java/eu/siacs/conversations/ui/StartConversationActivity.java
index bd17e545..c52d1d4d 100644
--- a/src/main/java/eu/siacs/conversations/ui/StartConversationActivity.java
+++ b/src/main/java/eu/siacs/conversations/ui/StartConversationActivity.java
@@ -24,7 +24,6 @@ import android.support.v13.app.FragmentPagerAdapter;
import android.support.v4.view.ViewPager;
import android.text.Editable;
import android.text.TextWatcher;
-import de.thedevstack.conversationsplus.utils.Logging;
import android.view.ContextMenu;
import android.view.ContextMenu.ContextMenuInfo;
import android.view.KeyEvent;
@@ -52,7 +51,9 @@ import java.util.Arrays;
import java.util.Collections;
import java.util.List;
+import de.thedevstack.android.logcat.Logging;
import de.thedevstack.conversationsplus.ConversationsPlusPreferences;
+
import eu.siacs.conversations.Config;
import eu.siacs.conversations.R;
import eu.siacs.conversations.entities.Account;
diff --git a/src/main/java/eu/siacs/conversations/ui/XmppActivity.java b/src/main/java/eu/siacs/conversations/ui/XmppActivity.java
index 2acce0f8..67bddd37 100644
--- a/src/main/java/eu/siacs/conversations/ui/XmppActivity.java
+++ b/src/main/java/eu/siacs/conversations/ui/XmppActivity.java
@@ -37,7 +37,6 @@ import android.os.IBinder;
import android.os.SystemClock;
import android.text.InputType;
import android.util.DisplayMetrics;
-import de.thedevstack.conversationsplus.utils.Logging;
import android.view.MenuItem;
import android.view.View;
import android.view.inputmethod.InputMethodManager;
@@ -62,6 +61,7 @@ import java.util.Hashtable;
import java.util.List;
import java.util.concurrent.RejectedExecutionException;
+import de.thedevstack.android.logcat.Logging;
import de.thedevstack.conversationsplus.ConversationsPlusPreferences;
import de.thedevstack.conversationsplus.utils.ImageUtil;
diff --git a/src/main/java/eu/siacs/conversations/ui/adapter/ConversationAdapter.java b/src/main/java/eu/siacs/conversations/ui/adapter/ConversationAdapter.java
index 57951874..16c95dcd 100644
--- a/src/main/java/eu/siacs/conversations/ui/adapter/ConversationAdapter.java
+++ b/src/main/java/eu/siacs/conversations/ui/adapter/ConversationAdapter.java
@@ -7,7 +7,6 @@ import android.graphics.Typeface;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.os.AsyncTask;
-import de.thedevstack.conversationsplus.utils.Logging;
import android.util.Pair;
import android.view.LayoutInflater;
import android.view.View;
@@ -20,6 +19,7 @@ import java.lang.ref.WeakReference;
import java.util.List;
import java.util.concurrent.RejectedExecutionException;
+import de.thedevstack.android.logcat.Logging;
import de.thedevstack.conversationsplus.ConversationsPlusPreferences;
import de.thedevstack.conversationsplus.ui.listeners.ShowResourcesListDialogListener;
import de.tzur.conversations.Settings;
diff --git a/src/main/java/eu/siacs/conversations/ui/listeners/ConversationSwipeRefreshListener.java b/src/main/java/eu/siacs/conversations/ui/listeners/ConversationSwipeRefreshListener.java
index f2b5ca22..e698c9b2 100644
--- a/src/main/java/eu/siacs/conversations/ui/listeners/ConversationSwipeRefreshListener.java
+++ b/src/main/java/eu/siacs/conversations/ui/listeners/ConversationSwipeRefreshListener.java
@@ -1,8 +1,5 @@
package eu.siacs.conversations.ui.listeners;
-import de.thedevstack.conversationsplus.R;
-import de.thedevstack.conversationsplus.services.MessageArchiveService;
-import de.thedevstack.conversationsplus.utils.Logging;
import android.widget.ListView;
import com.orangegangsters.github.swipyrefreshlayout.library.SwipyRefreshLayout;
@@ -10,8 +7,13 @@ import com.orangegangsters.github.swipyrefreshlayout.library.SwipyRefreshLayoutD
import java.util.List;
+import de.thedevstack.android.logcat.Logging;
+
import eu.siacs.conversations.Config;
+import eu.siacs.conversations.R;
+import eu.siacs.conversations.entities.Conversation;
import eu.siacs.conversations.entities.Message;
+import eu.siacs.conversations.services.MessageArchiveService;
import eu.siacs.conversations.ui.ConversationActivity;
import eu.siacs.conversations.ui.ConversationFragment;
import eu.siacs.conversations.ui.adapter.MessageAdapter;
@@ -36,7 +38,7 @@ public class ConversationSwipeRefreshListener implements SwipyRefreshLayout.OnRe
Logging.d(Config.LOGTAG, "Refresh direction " + direction);
synchronized (this.messageList) {
long timestamp;
- if (SwipyRefreshLayoutDirection.TOP == direction) {
+ if (SwipyRefreshLayoutDirection.TOP == direction) { // Load history -> messages sent/received before first message in database
if (messageList.isEmpty()) {
timestamp = System.currentTimeMillis();
} else {
@@ -45,28 +47,47 @@ public class ConversationSwipeRefreshListener implements SwipyRefreshLayout.OnRe
ConversationActivity activity = (ConversationActivity) fragment.getActivity();
this.listener.setLoadHistory(true);
activity.xmppConnectionService.loadMoreMessages(activity.getSelectedConversation(), timestamp, this.listener);
- } else if (SwipyRefreshLayoutDirection.BOTTOM == direction) {
+ } else if (SwipyRefreshLayoutDirection.BOTTOM == direction) { // load messages sent/received between last received or last session establishment and now
Logging.d("mam", "loading missing messages from mam (last session establishing or last received message)");
final ConversationActivity activity = (ConversationActivity) fragment.getActivity();
- long lastSessionEstablished = activity.getSelectedConversation().getAccount().getXmppConnection().getLastSessionEstablished();
- int lastMessageIndex = this.messageList.size() - 1;
- long lastReceivedMessage = (0 <= lastMessageIndex) ? this.messageList.get(lastMessageIndex).getTimeSent() : Long.MAX_VALUE;
+ long lastSessionEstablished = this.getTimestampOfLastSessionEstablished(activity.getSelectedConversation());
+ long lastReceivedMessage = this.getTimestampOfLastReceivedOrTransmittedMessage();
long startTimestamp = Math.min(lastSessionEstablished, lastReceivedMessage);
MessageArchiveService.Query query = activity.xmppConnectionService.getMessageArchiveService().query(activity.getSelectedConversation(), startTimestamp, System.currentTimeMillis());
if (query != null) {
this.listener.setLoadHistory(false);
query.setCallback(this.listener);
} else {
- activity.runOnUiThread(new Runnable() {
- @Override
- public void run() {
- listener.onMoreMessagesLoaded(0, activity.getSelectedConversation());
- }
- });
+ Logging.d("mam", "no query built - no messages loaded");
+ this.listener.onMoreMessagesLoaded(0, activity.getSelectedConversation());
+ this.listener.informUser(R.string.no_more_history_on_server);
}
this.listener.informUser(R.string.fetching_history_from_server);
}
}
Logging.d(Config.LOGTAG, "End Refresh swipe container");
}
+
+ private long getTimestampOfLastReceivedOrTransmittedMessage() {
+ long lastReceivedOrTransmittedMessage = Long.MAX_VALUE;
+ if (null != this.messageList
+ && !this.messageList.isEmpty()) {
+ int lastMessageIndex = this.messageList.size() - 1;
+ if (0 <= lastMessageIndex && this.messageList.size() > lastMessageIndex) {
+ lastReceivedOrTransmittedMessage = this.messageList.get(lastMessageIndex).getTimeSent();
+ }
+ }
+
+ return lastReceivedOrTransmittedMessage;
+ }
+
+ private long getTimestampOfLastSessionEstablished(Conversation conversation) {
+ long lastSessionEstablished = Long.MAX_VALUE;
+ if (null != conversation
+ && null != conversation.getAccount()
+ && null != conversation.getAccount().getXmppConnection()) {
+ lastSessionEstablished = conversation.getAccount().getXmppConnection().getLastSessionEstablished();
+ }
+ return lastSessionEstablished;
+ }
}
diff --git a/src/main/java/eu/siacs/conversations/utils/DNSHelper.java b/src/main/java/eu/siacs/conversations/utils/DNSHelper.java
index d5271903..f755b74b 100644
--- a/src/main/java/eu/siacs/conversations/utils/DNSHelper.java
+++ b/src/main/java/eu/siacs/conversations/utils/DNSHelper.java
@@ -1,5 +1,16 @@
package eu.siacs.conversations.utils;
+import java.io.IOException;
+import java.net.InetAddress;
+import java.net.SocketTimeoutException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Random;
+import java.util.TreeMap;
+import java.util.regex.Pattern;
+
+import android.os.Bundle;
+
import de.measite.minidns.Client;
import de.measite.minidns.DNSMessage;
import de.measite.minidns.Record;
@@ -10,20 +21,11 @@ import de.measite.minidns.record.A;
import de.measite.minidns.record.AAAA;
import de.measite.minidns.record.Data;
import de.measite.minidns.util.NameUtil;
-import eu.siacs.conversations.Config;
-import eu.siacs.conversations.xmpp.jid.Jid;
-import java.io.IOException;
-import java.net.InetAddress;
-import java.net.SocketTimeoutException;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Random;
-import java.util.TreeMap;
-import java.util.regex.Pattern;
+import de.thedevstack.android.logcat.Logging;
-import android.os.Bundle;
-import de.thedevstack.conversationsplus.utils.Logging;
+import eu.siacs.conversations.Config;
+import eu.siacs.conversations.xmpp.jid.Jid;
public class DNSHelper {
diff --git a/src/main/java/eu/siacs/conversations/utils/ExceptionHelper.java b/src/main/java/eu/siacs/conversations/utils/ExceptionHelper.java
index 92708cd0..b0a0455d 100644
--- a/src/main/java/eu/siacs/conversations/utils/ExceptionHelper.java
+++ b/src/main/java/eu/siacs/conversations/utils/ExceptionHelper.java
@@ -6,7 +6,9 @@ import java.io.IOException;
import java.io.InputStreamReader;
import java.util.List;
+import de.thedevstack.android.logcat.Logging;
import de.thedevstack.conversationsplus.ConversationsPlusPreferences;
+
import eu.siacs.conversations.Config;
import eu.siacs.conversations.R;
import eu.siacs.conversations.entities.Account;
@@ -26,7 +28,6 @@ import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.preference.PreferenceManager;
import android.text.format.DateUtils;
-import de.thedevstack.conversationsplus.utils.Logging;
public class ExceptionHelper {
public static void init(Context context) {
diff --git a/src/main/java/eu/siacs/conversations/utils/ExifHelper.java b/src/main/java/eu/siacs/conversations/utils/ExifHelper.java
index 9e987cc5..eac2d0f0 100644
--- a/src/main/java/eu/siacs/conversations/utils/ExifHelper.java
+++ b/src/main/java/eu/siacs/conversations/utils/ExifHelper.java
@@ -16,7 +16,7 @@
package eu.siacs.conversations.utils;
-import de.thedevstack.conversationsplus.utils.Logging;
+import de.thedevstack.android.logcat.Logging;
import java.io.IOException;
import java.io.InputStream;
diff --git a/src/main/java/eu/siacs/conversations/utils/PRNGFixes.java b/src/main/java/eu/siacs/conversations/utils/PRNGFixes.java
index 741afb35..5faa1fa7 100644
--- a/src/main/java/eu/siacs/conversations/utils/PRNGFixes.java
+++ b/src/main/java/eu/siacs/conversations/utils/PRNGFixes.java
@@ -2,7 +2,6 @@ package eu.siacs.conversations.utils;
import android.os.Build;
import android.os.Process;
-import de.thedevstack.conversationsplus.utils.Logging;
import java.io.ByteArrayOutputStream;
import java.io.DataInputStream;
@@ -19,6 +18,8 @@ import java.security.SecureRandom;
import java.security.SecureRandomSpi;
import java.security.Security;
+import de.thedevstack.android.logcat.Logging;
+
/**
* Fixes for the output of the default PRNG having low entropy.
*
diff --git a/src/main/java/eu/siacs/conversations/xml/Element.java b/src/main/java/eu/siacs/conversations/xml/Element.java
index 6875364a..1c60d321 100644
--- a/src/main/java/eu/siacs/conversations/xml/Element.java
+++ b/src/main/java/eu/siacs/conversations/xml/Element.java
@@ -1,11 +1,11 @@
package eu.siacs.conversations.xml;
-import de.thedevstack.conversationsplus.utils.Logging;
-
import java.util.ArrayList;
import java.util.Hashtable;
import java.util.List;
+import de.thedevstack.android.logcat.Logging;
+
import eu.siacs.conversations.Config;
import eu.siacs.conversations.utils.XmlHelper;
import eu.siacs.conversations.xmpp.jid.InvalidJidException;
diff --git a/src/main/java/eu/siacs/conversations/xml/XmlReader.java b/src/main/java/eu/siacs/conversations/xml/XmlReader.java
index 0c8acfcd..5375d60d 100644
--- a/src/main/java/eu/siacs/conversations/xml/XmlReader.java
+++ b/src/main/java/eu/siacs/conversations/xml/XmlReader.java
@@ -1,5 +1,9 @@
package eu.siacs.conversations.xml;
+import android.os.PowerManager;
+import android.os.PowerManager.WakeLock;
+import android.util.Xml;
+
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
@@ -7,12 +11,9 @@ import java.io.InputStreamReader;
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
-import eu.siacs.conversations.Config;
+import de.thedevstack.android.logcat.Logging;
-import android.os.PowerManager;
-import android.os.PowerManager.WakeLock;
-import de.thedevstack.conversationsplus.utils.Logging;
-import android.util.Xml;
+import eu.siacs.conversations.Config;
public class XmlReader {
private XmlPullParser parser;
diff --git a/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java b/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java
index 982806cf..39e3fa50 100644
--- a/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java
+++ b/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java
@@ -6,7 +6,6 @@ import android.os.Parcelable;
import android.os.PowerManager;
import android.os.PowerManager.WakeLock;
import android.os.SystemClock;
-import de.thedevstack.conversationsplus.utils.Logging;
import android.util.Pair;
import android.util.SparseArray;
@@ -43,6 +42,8 @@ import javax.net.ssl.SSLSocket;
import javax.net.ssl.SSLSocketFactory;
import javax.net.ssl.X509TrustManager;
+import de.thedevstack.android.logcat.Logging;
+
import eu.siacs.conversations.Config;
import eu.siacs.conversations.crypto.sasl.DigestMd5;
import eu.siacs.conversations.crypto.sasl.Plain;
diff --git a/src/main/java/eu/siacs/conversations/xmpp/jingle/JingleConnection.java b/src/main/java/eu/siacs/conversations/xmpp/jingle/JingleConnection.java
index cf969dc0..731d49e4 100644
--- a/src/main/java/eu/siacs/conversations/xmpp/jingle/JingleConnection.java
+++ b/src/main/java/eu/siacs/conversations/xmpp/jingle/JingleConnection.java
@@ -12,8 +12,8 @@ import android.content.Intent;
import android.net.Uri;
import android.os.SystemClock;
+import de.thedevstack.android.logcat.Logging;
import de.thedevstack.conversationsplus.ConversationsPlusPreferences;
-import de.thedevstack.conversationsplus.utils.Logging;
import eu.siacs.conversations.Config;
import eu.siacs.conversations.entities.Account;
diff --git a/src/main/java/eu/siacs/conversations/xmpp/jingle/JingleConnectionManager.java b/src/main/java/eu/siacs/conversations/xmpp/jingle/JingleConnectionManager.java
index 3353beb1..b1146543 100644
--- a/src/main/java/eu/siacs/conversations/xmpp/jingle/JingleConnectionManager.java
+++ b/src/main/java/eu/siacs/conversations/xmpp/jingle/JingleConnectionManager.java
@@ -6,7 +6,9 @@ import java.util.HashMap;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;
import android.annotation.SuppressLint;
-import de.thedevstack.conversationsplus.utils.Logging;
+
+import de.thedevstack.android.logcat.Logging;
+
import eu.siacs.conversations.Config;
import eu.siacs.conversations.entities.Account;
import eu.siacs.conversations.entities.Transferable;
diff --git a/src/main/java/eu/siacs/conversations/xmpp/jingle/JingleInbandTransport.java b/src/main/java/eu/siacs/conversations/xmpp/jingle/JingleInbandTransport.java
index 3b4bc4d8..b200c4e0 100644
--- a/src/main/java/eu/siacs/conversations/xmpp/jingle/JingleInbandTransport.java
+++ b/src/main/java/eu/siacs/conversations/xmpp/jingle/JingleInbandTransport.java
@@ -8,8 +8,8 @@ import java.security.NoSuchAlgorithmException;
import java.util.Arrays;
import android.util.Base64;
-import de.thedevstack.conversationsplus.utils.Logging;
+import de.thedevstack.android.logcat.Logging;
import de.thedevstack.conversationsplus.utils.StreamUtil;
import eu.siacs.conversations.Config;
diff --git a/src/main/java/eu/siacs/conversations/xmpp/jingle/JingleSocks5Transport.java b/src/main/java/eu/siacs/conversations/xmpp/jingle/JingleSocks5Transport.java
index 29d77417..41cf4d96 100644
--- a/src/main/java/eu/siacs/conversations/xmpp/jingle/JingleSocks5Transport.java
+++ b/src/main/java/eu/siacs/conversations/xmpp/jingle/JingleSocks5Transport.java
@@ -1,7 +1,5 @@
package eu.siacs.conversations.xmpp.jingle;
-import de.thedevstack.conversationsplus.utils.Logging;
-
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
@@ -14,6 +12,7 @@ import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.Arrays;
+import de.thedevstack.android.logcat.Logging;
import de.thedevstack.conversationsplus.utils.StreamUtil;
import eu.siacs.conversations.Config;