Merge tag '2.9.6' into develop

This commit is contained in:
Geno 2021-01-27 14:00:45 +01:00
commit 3c8a5d138a
284 changed files with 2058 additions and 1030 deletions

1
.gitignore vendored
View File

@ -9,7 +9,6 @@ src/quicksyPlaystore/res/values/push.xml
# https://github.com/github/gitignore/blob/master/Gradle.gitignore # https://github.com/github/gitignore/blob/master/Gradle.gitignore
.gradle/ .gradle/
build/ build/
gradle.properties
captures/ captures/
signing.properties signing.properties
# Ignore Gradle GUI config # Ignore Gradle GUI config

View File

@ -13,8 +13,10 @@ before_script:
- mkdir libs - mkdir libs
- wget -O libs/libwebrtc-m87.aar https://gultsch.de/files/libwebrtc-m87.aar - wget -O libs/libwebrtc-m87.aar https://gultsch.de/files/libwebrtc-m87.aar
script: script:
- ./gradlew assembleConversationsFreeSystemRelease - ./gradlew assembleQuicksyFreeCompatDebug
- ./gradlew assembleQuicksyFreeCompatRelease - ./gradlew assembleQuicksyFreeSystemDebug
- ./gradlew assembleConversationsFreeCompatDebug
- ./gradlew assembleConversationsFreeSystemDebug
before_install: before_install:
- yes | sdkmanager "platforms;android-28" - yes | sdkmanager "platforms;android-28"

View File

@ -1,5 +1,15 @@
# Changelog # Changelog
### Version 2.9.6
* Show call button for offline contacts if they previously announced support
* Back button no longer ends call when call is connected
* bug fixes
### Version 2.9.5
* Quicksy: Automatically receive verification SMS
### Version 2.9.4 ### Version 2.9.4
* minor stability improvements for A/V calls * minor stability improvements for A/V calls

View File

@ -8,7 +8,7 @@ buildscript {
jcenter() jcenter()
} }
dependencies { dependencies {
classpath 'com.android.tools.build:gradle:4.1.1' classpath 'com.android.tools.build:gradle:4.1.2'
} }
} }
@ -26,37 +26,36 @@ configurations {
conversationsFreeCompatImplementation conversationsFreeCompatImplementation
conversationsPlaystoreCompatImplementation conversationsPlaystoreCompatImplementation
conversationsPlaystoreSystemImplementation conversationsPlaystoreSystemImplementation
quicksyPlaystoreCompatImplementation
quicksyPlaystoreSystemImplementation
quicksyFreeCompatImplementation quicksyFreeCompatImplementation
quicksyImplementation quicksyImplementation
} }
ext {
supportLibVersion = '28.0.0'
}
dependencies { dependencies {
implementation 'androidx.viewpager:viewpager:1.0.0'
//should remain that low because later versions introduce dependency to androidx (not sure exactly from what version) //should remain that low because later versions introduce dependency to androidx (not sure exactly from what version)
playstoreImplementation('com.google.firebase:firebase-messaging:17.3.4') { playstoreImplementation('com.google.firebase:firebase-messaging:21.0.1') {
exclude group: 'com.google.firebase', module: 'firebase-core' exclude group: 'com.google.firebase', module: 'firebase-core'
exclude group: 'com.google.firebase', module: 'firebase-analytics' exclude group: 'com.google.firebase', module: 'firebase-analytics'
exclude group: 'com.google.firebase', module: 'firebase-measurement-connector' exclude group: 'com.google.firebase', module: 'firebase-measurement-connector'
} }
conversationsPlaystoreCompatImplementation("com.android.installreferrer:installreferrer:1.1.2") conversationsPlaystoreCompatImplementation("com.android.installreferrer:installreferrer:2.2")
conversationsPlaystoreSystemImplementation("com.android.installreferrer:installreferrer:1.1.2") conversationsPlaystoreSystemImplementation("com.android.installreferrer:installreferrer:2.2")
quicksyPlaystoreCompatImplementation 'com.google.android.gms:play-services-auth-api-phone:17.5.0'
quicksyPlaystoreSystemImplementation 'com.google.android.gms:play-services-auth-api-phone:17.5.0'
implementation 'org.sufficientlysecure:openpgp-api:10.0' implementation 'org.sufficientlysecure:openpgp-api:10.0'
implementation('com.theartofdev.edmodo:android-image-cropper:2.7.+') { implementation 'com.theartofdev.edmodo:android-image-cropper:2.8.0'
exclude group: 'com.android.support', module: 'appcompat-v7' implementation 'androidx.appcompat:appcompat:1.2.0'
exclude group: 'com.android.support', module: 'exifinterface' implementation 'androidx.exifinterface:exifinterface:1.3.2'
} implementation 'androidx.cardview:cardview:1.0.0'
implementation "com.android.support:support-v13:$supportLibVersion" implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'
implementation "com.android.support:appcompat-v7:$supportLibVersion" implementation 'androidx.emoji:emoji:1.1.0'
implementation "com.android.support:exifinterface:$supportLibVersion" implementation 'com.google.android.material:material:1.2.1'
implementation "com.android.support:cardview-v7:$supportLibVersion" compatImplementation 'androidx.emoji:emoji-appcompat:1.1.0'
implementation "com.android.support:support-emoji:$supportLibVersion" conversationsFreeCompatImplementation 'androidx.emoji:emoji-bundled:1.1.0'
implementation "com.android.support:design:$supportLibVersion" quicksyFreeCompatImplementation 'androidx.emoji:emoji-bundled:1.1.0'
compatImplementation "com.android.support:support-emoji-appcompat:$supportLibVersion"
conversationsFreeCompatImplementation "com.android.support:support-emoji-bundled:$supportLibVersion"
quicksyFreeCompatImplementation "com.android.support:support-emoji-bundled:$supportLibVersion"
implementation 'org.bouncycastle:bcmail-jdk15on:1.64' implementation 'org.bouncycastle:bcmail-jdk15on:1.64'
//zxing stopped supporting Java 7 so we have to stick with 3.3.3 //zxing stopped supporting Java 7 so we have to stick with 3.3.3
//https://github.com/zxing/zxing/issues/1170 //https://github.com/zxing/zxing/issues/1170
@ -79,7 +78,7 @@ dependencies {
//okhttp needs to stick with 3.12.x //okhttp needs to stick with 3.12.x
implementation 'com.squareup.okhttp3:okhttp:3.12.12' implementation 'com.squareup.okhttp3:okhttp:3.12.12'
implementation 'com.google.guava:guava:27.1-android' implementation 'com.google.guava:guava:27.1-android'
quicksyImplementation 'io.michaelrocks:libphonenumber-android:8.11.1' quicksyImplementation 'io.michaelrocks:libphonenumber-android:8.12.16'
//implementation fileTree(include: ['libwebrtc-m87.aar'], dir: 'libs') //implementation fileTree(include: ['libwebrtc-m87.aar'], dir: 'libs')
implementation 'org.webrtc:google-webrtc:1.0.32006' implementation 'org.webrtc:google-webrtc:1.0.32006'
} }
@ -96,8 +95,8 @@ android {
defaultConfig { defaultConfig {
minSdkVersion 21 minSdkVersion 21
targetSdkVersion 29 targetSdkVersion 29
versionCode 404 versionCode 407
versionName "2.9.4" versionName "2.9.6"
archivesBaseName += "-$versionName" archivesBaseName += "-$versionName"
applicationId "eu.sum7.conversations" applicationId "eu.sum7.conversations"
resValue "string", "applicationId", applicationId resValue "string", "applicationId", applicationId
@ -152,14 +151,21 @@ android {
} }
sourceSets { sourceSets {
quicksyFreeSystem {
java {
srcDir 'src/quicksyFree/java'
}
}
quicksyFreeCompat { quicksyFreeCompat {
java { java {
srcDir 'src/freeCompat/java' srcDir 'src/freeCompat/java'
srcDir 'src/quicksyFree/java'
} }
} }
quicksyPlaystoreCompat { quicksyPlaystoreCompat {
java { java {
srcDir 'src/playstoreCompat/java' srcDir 'src/playstoreCompat/java'
srcDir 'src/quicksyPlaystore/java'
} }
res { res {
srcDir 'src/playstoreCompat/res' srcDir 'src/playstoreCompat/res'
@ -167,6 +173,9 @@ android {
} }
} }
quicksyPlaystoreSystem { quicksyPlaystoreSystem {
java {
srcDir 'src/quicksyPlaystore/java'
}
res { res {
srcDir 'src/quicksyPlaystore/res' srcDir 'src/quicksyPlaystore/res'
} }

View File

@ -26,6 +26,15 @@
<language>en</language> <language>en</language>
<schema:logo rdf:resource="https://raw.githubusercontent.com/iNPUTmice/Conversations/master/art/ic_launcher.svg"/> <schema:logo rdf:resource="https://raw.githubusercontent.com/iNPUTmice/Conversations/master/art/ic_launcher.svg"/>
<schema:screenshot rdf:resource='https://raw.githubusercontent.com/iNPUTmice/Conversations/master/fastlane/metadata/android/en-US/images/phoneScreenshots/01.png'/>
<schema:screenshot rdf:resource='https://raw.githubusercontent.com/iNPUTmice/Conversations/master/fastlane/metadata/android/en-US/images/phoneScreenshots/02.png'/>
<schema:screenshot rdf:resource='https://raw.githubusercontent.com/iNPUTmice/Conversations/master/fastlane/metadata/android/en-US/images/phoneScreenshots/03.png'/>
<schema:screenshot rdf:resource='https://raw.githubusercontent.com/iNPUTmice/Conversations/master/fastlane/metadata/android/en-US/images/phoneScreenshots/04.png'/>
<schema:screenshot rdf:resource='https://raw.githubusercontent.com/iNPUTmice/Conversations/master/fastlane/metadata/android/en-US/images/phoneScreenshots/05.png'/>
<schema:screenshot rdf:resource='https://raw.githubusercontent.com/iNPUTmice/Conversations/master/fastlane/metadata/android/en-US/images/phoneScreenshots/06.png'/>
<schema:screenshot rdf:resource='https://raw.githubusercontent.com/iNPUTmice/Conversations/master/fastlane/metadata/android/en-US/images/phoneScreenshots/07.png'/>
<schema:screenshot rdf:resource='https://raw.githubusercontent.com/iNPUTmice/Conversations/master/fastlane/metadata/android/en-US/images/phoneScreenshots/08.png'/>
<schema:screenshot rdf:resource='https://raw.githubusercontent.com/iNPUTmice/Conversations/master/fastlane/metadata/android/en-US/images/phoneScreenshots/09.png'/>
<programming-language>Java</programming-language> <programming-language>Java</programming-language>
@ -82,6 +91,28 @@
<xmpp:version>1.1</xmpp:version> <xmpp:version>1.1</xmpp:version>
</xmpp:SupportedXep> </xmpp:SupportedXep>
</implements> </implements>
<implements>
<xmpp:SupportedXep>
<xmpp:xep rdf:resource="https://xmpp.org/extensions/xep-0048.html"/>
<xmpp:status>complete</xmpp:status>
<xmpp:version>1.1</xmpp:version>
</xmpp:SupportedXep>
</implements>
<implements>
<xmpp:SupportedXep>
<xmpp:xep rdf:resource="https://xmpp.org/extensions/xep-0049.html"/>
<xmpp:status>complete</xmpp:status>
<xmpp:version>1.2</xmpp:version>
</xmpp:SupportedXep>
</implements>
<implements>
<xmpp:SupportedXep>
<xmpp:xep rdf:resource="https://xmpp.org/extensions/xep-0054.html"/>
<xmpp:status>partial</xmpp:status>
<xmpp:version>1.2</xmpp:version>
<xmpp:note xml:lang='en'>Avatars only</xmpp:note>
</xmpp:SupportedXep>
</implements>
<implements> <implements>
<xmpp:SupportedXep> <xmpp:SupportedXep>
<xmpp:xep rdf:resource="https://xmpp.org/extensions/xep-0084.html"/> <xmpp:xep rdf:resource="https://xmpp.org/extensions/xep-0084.html"/>
@ -110,6 +141,14 @@
<xmpp:version>1.5.1</xmpp:version> <xmpp:version>1.5.1</xmpp:version>
</xmpp:SupportedXep> </xmpp:SupportedXep>
</implements> </implements>
<implements>
<xmpp:SupportedXep>
<xmpp:xep rdf:resource="https://xmpp.org/extensions/xep-0153.html"/>
<xmpp:status>partial</xmpp:status>
<xmpp:version>1.1</xmpp:version>
<xmpp:note xml:lang='en'>Read only. Publication via XEP-0398</xmpp:note>
</xmpp:SupportedXep>
</implements>
<implements> <implements>
<xmpp:SupportedXep> <xmpp:SupportedXep>
<xmpp:xep rdf:resource="https://xmpp.org/extensions/xep-0163.html"/> <xmpp:xep rdf:resource="https://xmpp.org/extensions/xep-0163.html"/>
@ -123,7 +162,14 @@
<xmpp:xep rdf:resource="https://xmpp.org/extensions/xep-0166.html"/> <xmpp:xep rdf:resource="https://xmpp.org/extensions/xep-0166.html"/>
<xmpp:status>complete</xmpp:status> <xmpp:status>complete</xmpp:status>
<xmpp:version>1.1.2</xmpp:version> <xmpp:version>1.1.2</xmpp:version>
<xmpp:note>File transfer only</xmpp:note> <xmpp:note>File transfer + A/V calls</xmpp:note>
</xmpp:SupportedXep>
</implements>
<implements>
<xmpp:SupportedXep>
<xmpp:xep rdf:resource="https://xmpp.org/extensions/xep-0167.html"/>
<xmpp:status>complete</xmpp:status>
<xmpp:version>1.2.1</xmpp:version>
</xmpp:SupportedXep> </xmpp:SupportedXep>
</implements> </implements>
<implements> <implements>
@ -134,6 +180,13 @@
<xmpp:note>read only</xmpp:note> <xmpp:note>read only</xmpp:note>
</xmpp:SupportedXep> </xmpp:SupportedXep>
</implements> </implements>
<implements>
<xmpp:SupportedXep>
<xmpp:xep rdf:resource="https://xmpp.org/extensions/xep-0176.html"/>
<xmpp:status>complete</xmpp:status>
<xmpp:version>1.1</xmpp:version>
</xmpp:SupportedXep>
</implements>
<implements> <implements>
<xmpp:SupportedXep> <xmpp:SupportedXep>
<xmpp:xep rdf:resource="https://xmpp.org/extensions/xep-0184.html"/> <xmpp:xep rdf:resource="https://xmpp.org/extensions/xep-0184.html"/>
@ -162,6 +215,27 @@
<xmpp:version>2.0.1</xmpp:version> <xmpp:version>2.0.1</xmpp:version>
</xmpp:SupportedXep> </xmpp:SupportedXep>
</implements> </implements>
<implements>
<xmpp:SupportedXep>
<xmpp:xep rdf:resource="https://xmpp.org/extensions/xep-0199.html"/>
<xmpp:status>complete</xmpp:status>
<xmpp:version>2.0.1</xmpp:version>
</xmpp:SupportedXep>
</implements>
<implements>
<xmpp:SupportedXep>
<xmpp:xep rdf:resource="https://xmpp.org/extensions/xep-0215.html"/>
<xmpp:status>complete</xmpp:status>
<xmpp:version>0.7</xmpp:version>
</xmpp:SupportedXep>
</implements>
<implements>
<xmpp:SupportedXep>
<xmpp:xep rdf:resource="https://xmpp.org/extensions/xep-0223.html"/>
<xmpp:status>complete</xmpp:status>
<xmpp:version>1.1</xmpp:version>
</xmpp:SupportedXep>
</implements>
<implements> <implements>
<xmpp:SupportedXep> <xmpp:SupportedXep>
<xmpp:xep rdf:resource="https://xmpp.org/extensions/xep-0234.html"/> <xmpp:xep rdf:resource="https://xmpp.org/extensions/xep-0234.html"/>
@ -213,11 +287,25 @@
</implements> </implements>
<implements> <implements>
<xmpp:SupportedXep> <xmpp:SupportedXep>
<xmpp:xep rdf:resource="https://xmpp.org/extensions/xep-0308.html"/> <xmpp:xep rdf:resource="https://xmpp.org/extensions/xep-0293.html"/>
<xmpp:status>complete</xmpp:status>
<xmpp:version>1.0.1</xmpp:version>
</xmpp:SupportedXep>
</implements>
<implements>
<xmpp:SupportedXep>
<xmpp:xep rdf:resource="https://xmpp.org/extensions/xep-0294.html"/>
<xmpp:status>complete</xmpp:status> <xmpp:status>complete</xmpp:status>
<xmpp:version>1.0</xmpp:version> <xmpp:version>1.0</xmpp:version>
</xmpp:SupportedXep> </xmpp:SupportedXep>
</implements> </implements>
<implements>
<xmpp:SupportedXep>
<xmpp:xep rdf:resource="https://xmpp.org/extensions/xep-0308.html"/>
<xmpp:status>complete</xmpp:status>
<xmpp:version>1.2.0</xmpp:version>
</xmpp:SupportedXep>
</implements>
<implements> <implements>
<xmpp:SupportedXep> <xmpp:SupportedXep>
<xmpp:xep rdf:resource="https://xmpp.org/extensions/xep-0313.html"/> <xmpp:xep rdf:resource="https://xmpp.org/extensions/xep-0313.html"/>
@ -233,6 +321,13 @@
<xmpp:note>opt-in</xmpp:note> <xmpp:note>opt-in</xmpp:note>
</xmpp:SupportedXep> </xmpp:SupportedXep>
</implements> </implements>
<implements>
<xmpp:SupportedXep>
<xmpp:xep rdf:resource="https://xmpp.org/extensions/xep-0320.html"/>
<xmpp:status>complete</xmpp:status>
<xmpp:version>1.0.0</xmpp:version>
</xmpp:SupportedXep>
</implements>
<implements> <implements>
<xmpp:SupportedXep> <xmpp:SupportedXep>
<xmpp:xep rdf:resource="https://xmpp.org/extensions/xep-0333.html"/> <xmpp:xep rdf:resource="https://xmpp.org/extensions/xep-0333.html"/>
@ -240,6 +335,20 @@
<xmpp:version>0.3</xmpp:version> <xmpp:version>0.3</xmpp:version>
</xmpp:SupportedXep> </xmpp:SupportedXep>
</implements> </implements>
<implements>
<xmpp:SupportedXep>
<xmpp:xep rdf:resource="https://xmpp.org/extensions/xep-0338.html"/>
<xmpp:status>complete</xmpp:status>
<xmpp:version>1.0.0</xmpp:version>
</xmpp:SupportedXep>
</implements>
<implements>
<xmpp:SupportedXep>
<xmpp:xep rdf:resource="https://xmpp.org/extensions/xep-0339.html"/>
<xmpp:status>complete</xmpp:status>
<xmpp:version>1.0.0</xmpp:version>
</xmpp:SupportedXep>
</implements>
<implements> <implements>
<xmpp:SupportedXep> <xmpp:SupportedXep>
<xmpp:xep rdf:resource="https://xmpp.org/extensions/xep-0352.html"/> <xmpp:xep rdf:resource="https://xmpp.org/extensions/xep-0352.html"/>
@ -247,6 +356,13 @@
<xmpp:version>0.3.0</xmpp:version> <xmpp:version>0.3.0</xmpp:version>
</xmpp:SupportedXep> </xmpp:SupportedXep>
</implements> </implements>
<implements>
<xmpp:SupportedXep>
<xmpp:xep rdf:resource="https://xmpp.org/extensions/xep-0353.html"/>
<xmpp:status>complete</xmpp:status>
<xmpp:version>0.3.0</xmpp:version>
</xmpp:SupportedXep>
</implements>
<implements> <implements>
<xmpp:SupportedXep> <xmpp:SupportedXep>
<xmpp:xep rdf:resource="https://xmpp.org/extensions/xep-0357.html"/> <xmpp:xep rdf:resource="https://xmpp.org/extensions/xep-0357.html"/>
@ -255,6 +371,13 @@
<xmpp:note>Only available in the version distributed over Google Play</xmpp:note> <xmpp:note>Only available in the version distributed over Google Play</xmpp:note>
</xmpp:SupportedXep> </xmpp:SupportedXep>
</implements> </implements>
<implements>
<xmpp:SupportedXep>
<xmpp:xep rdf:resource="https://xmpp.org/extensions/xep-0363.html"/>
<xmpp:status>complete</xmpp:status>
<xmpp:version>1.0.0</xmpp:version>
</xmpp:SupportedXep>
</implements>
<implements> <implements>
<xmpp:SupportedXep> <xmpp:SupportedXep>
<xmpp:xep rdf:resource="https://xmpp.org/extensions/xep-0368.html"/> <xmpp:xep rdf:resource="https://xmpp.org/extensions/xep-0368.html"/>

3
gradle.properties Normal file
View File

@ -0,0 +1,3 @@
android.useAndroidX=true
android.enableJetifier=true
org.gradle.jvmargs=-Xmx4096m

View File

@ -0,0 +1,3 @@
• Show call button for offline contacts if they previously announced support
• Back button no longer ends call when call is connected
• bug fixes

View File

@ -1,9 +1,10 @@
package eu.siacs.conversations.ui.widget; package eu.siacs.conversations.ui.widget;
import android.content.Context; import android.content.Context;
import android.support.text.emoji.widget.EmojiAppCompatEditText;
import android.util.AttributeSet; import android.util.AttributeSet;
import androidx.emoji.widget.EmojiAppCompatEditText;
public class EmojiWrapperEditText extends EmojiAppCompatEditText { public class EmojiWrapperEditText extends EmojiAppCompatEditText {
public EmojiWrapperEditText(Context context) { public EmojiWrapperEditText(Context context) {

View File

@ -29,7 +29,7 @@
package eu.siacs.conversations.utils; package eu.siacs.conversations.utils;
import android.support.text.emoji.EmojiCompat; import androidx.emoji.text.EmojiCompat;
public class EmojiWrapper { public class EmojiWrapper {

View File

@ -1,7 +1,6 @@
package eu.siacs.conversations.entities; package eu.siacs.conversations.entities;
import com.google.common.base.Preconditions; import com.google.common.base.Preconditions;
import com.google.common.base.Strings;
import com.google.gson.Gson; import com.google.gson.Gson;
import com.google.gson.GsonBuilder; import com.google.gson.GsonBuilder;
import com.google.gson.JsonSyntaxException; import com.google.gson.JsonSyntaxException;

View File

@ -12,10 +12,11 @@ import android.net.Uri;
import android.os.Binder; import android.os.Binder;
import android.os.IBinder; import android.os.IBinder;
import android.provider.OpenableColumns; import android.provider.OpenableColumns;
import android.support.v4.app.NotificationCompat;
import android.support.v4.app.NotificationManagerCompat;
import android.util.Log; import android.util.Log;
import androidx.core.app.NotificationCompat;
import androidx.core.app.NotificationManagerCompat;
import com.google.common.base.Charsets; import com.google.common.base.Charsets;
import com.google.common.base.Stopwatch; import com.google.common.base.Stopwatch;
import com.google.common.io.CountingInputStream; import com.google.common.io.CountingInputStream;
@ -60,7 +61,7 @@ import eu.siacs.conversations.xmpp.Jid;
public class ImportBackupService extends Service { public class ImportBackupService extends Service {
private static final int NOTIFICATION_ID = 21; private static final int NOTIFICATION_ID = 21;
private static AtomicBoolean running = new AtomicBoolean(false); private static final AtomicBoolean running = new AtomicBoolean(false);
private final ImportBackupServiceBinder binder = new ImportBackupServiceBinder(); private final ImportBackupServiceBinder binder = new ImportBackupServiceBinder();
private final SerialSingleThreadExecutor executor = new SerialSingleThreadExecutor(getClass().getSimpleName()); private final SerialSingleThreadExecutor executor = new SerialSingleThreadExecutor(getClass().getSimpleName());
private final Set<OnBackupProcessed> mOnBackupProcessedListeners = Collections.newSetFromMap(new WeakHashMap<>()); private final Set<OnBackupProcessed> mOnBackupProcessedListeners = Collections.newSetFromMap(new WeakHashMap<>());

View File

@ -1,5 +1,10 @@
package eu.siacs.conversations.services; package eu.siacs.conversations.services;
import android.content.Intent;
import android.util.Log;
import eu.siacs.conversations.Config;
public class QuickConversationsService extends AbstractQuickConversationsService { public class QuickConversationsService extends AbstractQuickConversationsService {
QuickConversationsService(XmppConnectionService xmppConnectionService) { QuickConversationsService(XmppConnectionService xmppConnectionService) {
@ -25,4 +30,9 @@ public class QuickConversationsService extends AbstractQuickConversationsService
public void considerSyncBackground(boolean force) { public void considerSyncBackground(boolean force) {
} }
@Override
public void handleSmsReceived(Intent intent) {
Log.d(Config.LOGTAG,"ignoring received SMS");
}
} }

View File

@ -2,17 +2,17 @@ package eu.siacs.conversations.ui;
import android.app.Activity; import android.app.Activity;
import android.content.Intent; import android.content.Intent;
import android.databinding.DataBindingUtil;
import android.graphics.Bitmap; import android.graphics.Bitmap;
import android.graphics.Point; import android.graphics.Point;
import android.os.Bundle; import android.os.Bundle;
import android.support.v7.widget.Toolbar;
import android.util.Log; import android.util.Log;
import android.view.Menu; import android.view.Menu;
import android.view.MenuItem; import android.view.MenuItem;
import android.view.View; import android.view.View;
import android.widget.Toast; import android.widget.Toast;
import androidx.databinding.DataBindingUtil;
import com.google.common.base.Strings; import com.google.common.base.Strings;
import eu.siacs.conversations.Config; import eu.siacs.conversations.Config;
@ -34,7 +34,7 @@ public class EasyOnboardingInviteActivity extends XmppActivity implements EasyOn
public void onCreate(final Bundle bundle) { public void onCreate(final Bundle bundle) {
super.onCreate(bundle); super.onCreate(bundle);
this.binding = DataBindingUtil.setContentView(this, R.layout.activity_easy_invite); this.binding = DataBindingUtil.setContentView(this, R.layout.activity_easy_invite);
setSupportActionBar((Toolbar) binding.toolbar); setSupportActionBar(binding.toolbar);
configureActionBar(getSupportActionBar(), true); configureActionBar(getSupportActionBar(), true);
this.binding.shareButton.setOnClickListener(v -> share()); this.binding.shareButton.setOnClickListener(v -> share());
if (bundle != null && bundle.containsKey("invite")) { if (bundle != null && bundle.containsKey("invite")) {

View File

@ -5,21 +5,22 @@ import android.content.Context;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.content.Intent; import android.content.Intent;
import android.content.ServiceConnection; import android.content.ServiceConnection;
import android.databinding.DataBindingUtil;
import android.net.Uri; import android.net.Uri;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.os.IBinder; import android.os.IBinder;
import android.support.design.widget.Snackbar;
import android.support.v4.content.ContextCompat;
import android.support.v7.app.AlertDialog;
import android.support.v7.widget.Toolbar;
import android.util.Log; import android.util.Log;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.Menu; import android.view.Menu;
import android.view.MenuItem; import android.view.MenuItem;
import android.view.View; import android.view.View;
import androidx.appcompat.app.AlertDialog;
import androidx.core.content.ContextCompat;
import androidx.databinding.DataBindingUtil;
import com.google.android.material.snackbar.Snackbar;
import java.io.IOException; import java.io.IOException;
import java.util.List; import java.util.List;
@ -48,7 +49,7 @@ public class ImportBackupActivity extends ActionBarActivity implements ServiceCo
setTheme(this.mTheme); setTheme(this.mTheme);
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
binding = DataBindingUtil.setContentView(this, R.layout.activity_import_backup); binding = DataBindingUtil.setContentView(this, R.layout.activity_import_backup);
setSupportActionBar((Toolbar) binding.toolbar); setSupportActionBar(binding.toolbar);
setLoadingState(savedInstanceState != null && savedInstanceState.getBoolean("loading_state", false)); setLoadingState(savedInstanceState != null && savedInstanceState.getBoolean("loading_state", false));
this.backupFileAdapter = new BackupFileAdapter(); this.backupFileAdapter = new BackupFileAdapter();
this.binding.list.setAdapter(this.backupFileAdapter); this.binding.list.setAdapter(this.backupFileAdapter);

View File

@ -2,14 +2,14 @@ package eu.siacs.conversations.ui;
import android.content.Intent; import android.content.Intent;
import android.content.pm.ActivityInfo; import android.content.pm.ActivityInfo;
import android.databinding.DataBindingUtil;
import android.os.Bundle; import android.os.Bundle;
import android.support.v7.widget.Toolbar;
import android.text.Editable; import android.text.Editable;
import android.text.TextWatcher; import android.text.TextWatcher;
import android.view.View; import android.view.View;
import android.widget.Toast; import android.widget.Toast;
import androidx.databinding.DataBindingUtil;
import java.security.SecureRandom; import java.security.SecureRandom;
import eu.siacs.conversations.Config; import eu.siacs.conversations.Config;
@ -61,7 +61,7 @@ public class MagicCreateActivity extends XmppActivity implements TextWatcher {
} }
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
this.binding = DataBindingUtil.setContentView(this, R.layout.magic_create); this.binding = DataBindingUtil.setContentView(this, R.layout.magic_create);
setSupportActionBar((Toolbar) this.binding.toolbar); setSupportActionBar(this.binding.toolbar);
configureActionBar(getSupportActionBar(), this.domain == null); configureActionBar(getSupportActionBar(), this.domain == null);
if (username != null && domain != null) { if (username != null && domain != null) {
binding.title.setText(R.string.your_server_invitation); binding.title.setText(R.string.your_server_invitation);

View File

@ -5,9 +5,6 @@ import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
import android.security.KeyChain; import android.security.KeyChain;
import android.security.KeyChainAliasCallback; import android.security.KeyChainAliasCallback;
import android.support.annotation.NonNull;
import android.support.v7.app.ActionBar;
import android.support.v7.app.AlertDialog;
import android.util.Pair; import android.util.Pair;
import android.view.ContextMenu; import android.view.ContextMenu;
import android.view.ContextMenu.ContextMenuInfo; import android.view.ContextMenu.ContextMenuInfo;
@ -18,6 +15,10 @@ import android.widget.AdapterView.AdapterContextMenuInfo;
import android.widget.ListView; import android.widget.ListView;
import android.widget.Toast; import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.appcompat.app.ActionBar;
import androidx.appcompat.app.AlertDialog;
import org.openintents.openpgp.util.OpenPgpApi; import org.openintents.openpgp.util.OpenPgpApi;
import java.util.ArrayList; import java.util.ArrayList;
@ -31,8 +32,8 @@ import eu.siacs.conversations.services.XmppConnectionService;
import eu.siacs.conversations.services.XmppConnectionService.OnAccountUpdate; import eu.siacs.conversations.services.XmppConnectionService.OnAccountUpdate;
import eu.siacs.conversations.ui.adapter.AccountAdapter; import eu.siacs.conversations.ui.adapter.AccountAdapter;
import eu.siacs.conversations.ui.util.MenuDoubleTabUtil; import eu.siacs.conversations.ui.util.MenuDoubleTabUtil;
import eu.siacs.conversations.xmpp.XmppConnection;
import eu.siacs.conversations.xmpp.Jid; import eu.siacs.conversations.xmpp.Jid;
import eu.siacs.conversations.xmpp.XmppConnection;
import static eu.siacs.conversations.utils.PermissionUtils.allGranted; import static eu.siacs.conversations.utils.PermissionUtils.allGranted;
import static eu.siacs.conversations.utils.PermissionUtils.writeGranted; import static eu.siacs.conversations.utils.PermissionUtils.writeGranted;
@ -226,7 +227,7 @@ public class ManageAccountActivity extends XmppActivity implements OnAccountUpda
@Override @Override
public void onRequestPermissionsResult(int requestCode, @NonNull String permissions[], @NonNull int[] grantResults) { public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
if (grantResults.length > 0) { if (grantResults.length > 0) {
if (allGranted(grantResults)) { if (allGranted(grantResults)) {
switch (requestCode) { switch (requestCode) {

View File

@ -2,12 +2,12 @@ package eu.siacs.conversations.ui;
import android.content.Intent; import android.content.Intent;
import android.content.pm.ActivityInfo; import android.content.pm.ActivityInfo;
import android.databinding.DataBindingUtil;
import android.os.Bundle; import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.MenuItem; import android.view.MenuItem;
import androidx.appcompat.app.AppCompatActivity;
import androidx.databinding.DataBindingUtil;
import java.util.List; import java.util.List;
import eu.siacs.conversations.R; import eu.siacs.conversations.R;
@ -66,7 +66,7 @@ public class PickServerActivity extends XmppActivity {
} }
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
ActivityPickServerBinding binding = DataBindingUtil.setContentView(this, R.layout.activity_pick_server); ActivityPickServerBinding binding = DataBindingUtil.setContentView(this, R.layout.activity_pick_server);
setSupportActionBar((Toolbar) binding.toolbar); setSupportActionBar(binding.toolbar);
configureActionBar(getSupportActionBar()); configureActionBar(getSupportActionBar());
binding.useCim.setOnClickListener(v -> { binding.useCim.setOnClickListener(v -> {
final Intent intent = new Intent(this, MagicCreateActivity.class); final Intent intent = new Intent(this, MagicCreateActivity.class);

View File

@ -4,20 +4,19 @@ import android.Manifest;
import android.content.ActivityNotFoundException; import android.content.ActivityNotFoundException;
import android.content.Intent; import android.content.Intent;
import android.content.pm.ActivityInfo; import android.content.pm.ActivityInfo;
import android.content.pm.PackageManager;
import android.databinding.DataBindingUtil;
import android.net.Uri; import android.net.Uri;
import android.os.Bundle; import android.os.Bundle;
import android.security.KeyChain; import android.security.KeyChain;
import android.security.KeyChainAliasCallback; import android.security.KeyChainAliasCallback;
import android.support.annotation.NonNull;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.util.Log; import android.util.Log;
import android.view.Menu; import android.view.Menu;
import android.view.MenuItem; import android.view.MenuItem;
import android.widget.Toast; import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import androidx.databinding.DataBindingUtil;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
@ -120,7 +119,7 @@ public class WelcomeActivity extends XmppActivity implements XmppConnectionServi
} }
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
ActivityWelcomeBinding binding = DataBindingUtil.setContentView(this, R.layout.activity_welcome); ActivityWelcomeBinding binding = DataBindingUtil.setContentView(this, R.layout.activity_welcome);
setSupportActionBar((Toolbar) binding.toolbar); setSupportActionBar(binding.toolbar);
configureActionBar(getSupportActionBar(), false); configureActionBar(getSupportActionBar(), false);
binding.registerNewAccount.setOnClickListener(v -> { binding.registerNewAccount.setOnClickListener(v -> {
final Intent intent = new Intent(this, PickServerActivity.class); final Intent intent = new Intent(this, PickServerActivity.class);

View File

@ -1,13 +1,10 @@
package eu.siacs.conversations.ui.adapter; package eu.siacs.conversations.ui.adapter;
import android.content.res.Resources; import android.content.res.Resources;
import android.databinding.DataBindingUtil;
import android.graphics.Bitmap; import android.graphics.Bitmap;
import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.os.AsyncTask; import android.os.AsyncTask;
import android.support.annotation.NonNull;
import android.support.v7.widget.RecyclerView;
import android.text.format.DateUtils; import android.text.format.DateUtils;
import android.util.DisplayMetrics; import android.util.DisplayMetrics;
import android.view.LayoutInflater; import android.view.LayoutInflater;
@ -15,6 +12,10 @@ import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.ImageView; import android.widget.ImageView;
import androidx.annotation.NonNull;
import androidx.databinding.DataBindingUtil;
import androidx.recyclerview.widget.RecyclerView;
import java.lang.ref.WeakReference; import java.lang.ref.WeakReference;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;

View File

@ -26,20 +26,20 @@
<android.support.design.widget.CoordinatorLayout <androidx.coordinatorlayout.widget.CoordinatorLayout
android:id="@+id/coordinator" android:id="@+id/coordinator"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="?attr/color_background_primary"> android:background="?attr/color_background_primary">
<android.support.v7.widget.RecyclerView <androidx.recyclerview.widget.RecyclerView
android:id="@+id/list" android:id="@+id/list"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="?attr/color_background_primary" android:background="?attr/color_background_primary"
android:orientation="vertical" android:orientation="vertical"
app:layoutManager="android.support.v7.widget.LinearLayoutManager" /> app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" />
</android.support.design.widget.CoordinatorLayout> </androidx.coordinatorlayout.widget.CoordinatorLayout>
</LinearLayout> </LinearLayout>
</layout> </layout>

View File

@ -22,7 +22,7 @@
android:text="@string/restore_warning" android:text="@string/restore_warning"
android:textAppearance="@style/TextAppearance.Conversations.Body1"/> android:textAppearance="@style/TextAppearance.Conversations.Body1"/>
<android.support.design.widget.TextInputLayout <com.google.android.material.textfield.TextInputLayout
android:id="@+id/account_password_layout" android:id="@+id/account_password_layout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -42,6 +42,6 @@
android:textColor="?attr/edit_text_color" android:textColor="?attr/edit_text_color"
style="@style/Widget.Conversations.EditText"/> style="@style/Widget.Conversations.EditText"/>
</android.support.design.widget.TextInputLayout> </com.google.android.material.textfield.TextInputLayout>
</LinearLayout> </LinearLayout>
</layout> </layout>

View File

@ -5,4 +5,13 @@
<string name="create_new_account">Създаване не нов профил</string> <string name="create_new_account">Създаване не нов профил</string>
<string name="do_you_have_an_account">Имате ли вече XMPP профил? Това може да се случи, ако вече използвате друг клиент на XMPP или сте използвали преди това Conversations. Ако не, можете да създадете нов XMPP профил в момента.\nСъвет: Някои доставчици на имейл също предоставят XMPP профили. <string name="do_you_have_an_account">Имате ли вече XMPP профил? Това може да се случи, ако вече използвате друг клиент на XMPP или сте използвали преди това Conversations. Ако не, можете да създадете нов XMPP профил в момента.\nСъвет: Някои доставчици на имейл също предоставят XMPP профили.
 </string>  </string>
<string name="server_select_text">XMPP е мрежа за общуване чрез мигновени съобщения, която не е обвързана с конкретен доставчик. Можете да използвате клиента с всеки сървър, който работи с XMPP.\nЗа Ваше удобство, ние предоставяме лесен начин да си създадете профил в conversations.im¹ — сървър, пригоден да работи добре с Conversations.</string>
<string name="magic_create_text_on_x">Бяхте поканен(а) в %1$s. Ще Ви преведем през процеса на създаване на акаунт.\nИзбирайки %1$s за доставчик, Вие ще можете да общувате и с потребители на други доставчици, като им предоставите своя пълен адрес за XMPP.</string>
<string name="magic_create_text_fixed">Бяхте поканен(а) в %1$s. Вече Ви избрахме потребителско име. Ще Ви преведем през процеса на създаване на акаунт.\nЩе можете да общувате и с потребители на други доставчици, като им предоставите своя пълен адрес за XMPP.</string>
<string name="your_server_invitation">Вашата покана за сървъра</string>
<string name="improperly_formatted_provisioning">Неправилно форматиран код за достъп</string>
<string name="tap_share_button_send_invite">Докоснете бутона за споделяне, за да изпратите на контакта си покана за %1$s.</string>
<string name="if_contact_is_nearby_use_qr">Ако контактът Ви е наблизо, може да сканира кода по-долу, за да приеме поканата Ви.</string>
<string name="easy_invite_share_text">Присъедини се в %1$s и си пиши с мен: %2$s</string>
<string name="share_invite_with">Споделяне на поканата чрез…</string>
</resources> </resources>

View File

@ -2,4 +2,16 @@
<resources> <resources>
<string name="pick_a_server">Triï el seu proveïdor de XMPP <string name="pick_a_server">Triï el seu proveïdor de XMPP
</string> </string>
<string name="use_conversations.im">Fer servir conversations.im</string>
<string name="create_new_account">Crear un compte nou</string>
<string name="do_you_have_an_account">Ja tens un compte XMPP? Aquest podria ser el cas si ja estàs usant un client XMPP diferent o has usat Converses abans. Si no, pots crear un nou compte XMPP ara mateix.\nPista: Alguns proveïdors de correu electrònic també proporcionen comptes XMPP.</string>
<string name="server_select_text">XMPP és una xarxa de missatgeria instantània independent del proveïdor. Pots usar aquest client amb qualsevol servidor XMPP que triïs. No obstant això, per a la teva conveniència, hem fet fàcil la creació d\'un compte en Conversaciones.im¹; un proveïdor especialment adequat per a l\'ús amb Conversations.</string>
<string name="magic_create_text_on_x">Has estat convidat a %1$s. Et guiarem a través del procés de creació d\'un compte.\nEn triar%1$s com a proveïdor podràs comunicar-se amb els usuaris d\'altres proveïdors donant-los la seva adreça XMPP completa.</string>
<string name="magic_create_text_fixed">Has estat convidat a %1$s . Ja s\'ha triat un nom d\'usuari per a tu. Et guiarem en el procés de creació d\'un compte. Podràs comunicar-te amb usuaris d\'altres proveïdors donant-los la teva adreça XMPP completa.</string>
<string name="your_server_invitation">La teva invitació al servidor</string>
<string name="improperly_formatted_provisioning">Codi d\'aprovisionament mal formatat</string>
<string name="tap_share_button_send_invite">Toca el botó de compartir per a enviar al teu contacte una invitació a %1$s .</string>
<string name="if_contact_is_nearby_use_qr">Si el teu contacte està a prop, també pot escanejar el codi de baix per a acceptar la teva invitació.</string>
<string name="easy_invite_share_text">Uneix-te %1$s i xerra amb mi: %2$s</string>
<string name="share_invite_with">Comparteix la invitació amb...</string>
</resources> </resources>

View File

@ -9,4 +9,8 @@
<string name="magic_create_text_fixed">Has sido invitado a %1$s. Un nombre de usuario ya ha sido escogido para ti. Te guiaremos durante el proceso de creación de la cuenta.\nPodrás comunicarte con otros usuarios de otros servidores proporcionándoles tu dirección XMPP completa. </string> <string name="magic_create_text_fixed">Has sido invitado a %1$s. Un nombre de usuario ya ha sido escogido para ti. Te guiaremos durante el proceso de creación de la cuenta.\nPodrás comunicarte con otros usuarios de otros servidores proporcionándoles tu dirección XMPP completa. </string>
<string name="your_server_invitation">Tu invitación al servidor</string> <string name="your_server_invitation">Tu invitación al servidor</string>
<string name="improperly_formatted_provisioning">Código de abastecimiento formateado incorrectamente</string> <string name="improperly_formatted_provisioning">Código de abastecimiento formateado incorrectamente</string>
<string name="tap_share_button_send_invite">Pulsa el botón de compartir para enviar a tu contacto una invitación a %1$s.</string>
<string name="if_contact_is_nearby_use_qr">Si tu contacto está cerca, también puede escanear el código mostrado debajo para aceptar tu invitación.</string>
<string name="easy_invite_share_text">Únete a %1$s y chatea conmigo: %2$s</string>
<string name="share_invite_with">Compartir invitación con...</string>
</resources> </resources>

View File

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="pick_a_server">Pilih XMPP server anda</string>
<string name="use_conversations.im">Gunakan conversations.im</string>
<string name="create_new_account">Buat akun baru</string>
<string name="do_you_have_an_account">Anda sudah memiliki akun XMPP? Ini mungkin terjadi jika Anda sudah menggunakan aplikasi XMPP yang berbeda atau pernah menggunakan Conversations sebelumnya. Jika tidak, Anda dapat membuat akun XMPP baru. \ NPetunjuk: Beberapa penyedia layanan email juga menyediakan akun XMPP.</string>
<string name="server_select_text">XMPP adalah jaringan penyedia pesan instan independen. Anda dapat menggunakan aplikasi ini dengan server XMPP pilihan Anda. \ NNamun demi kenyamanan Anda, kami permudah untuk membuat akun di Conversations.im¹; provider yang sangat cocok digunakan dengan Conversations.</string>
<string name="magic_create_text_on_x">Anda telah diundang ke %1$s. Kami akan memandu Anda melalui proses pembuatan akun. \nSaat memilih %1$s sebagai penyedia, Anda akan dapat berkomunikasi dengan pengguna provider lain dengan memberikan alamat XMPP lengkap Anda kepada mereka.</string>
<string name="magic_create_text_fixed">Anda telah diundang ke%1$s. Username telah dipilihkan untuk Anda. Kami akan memandu Anda melalui proses pembuatan akun. \nAnda dapat berkomunikasi dengan pengguna provider lain dengan memberi mereka alamat XMPP lengkap Anda.</string>
<string name="your_server_invitation">Undangan server Anda</string>
<string name="improperly_formatted_provisioning">Kode provisioning tidak diformat dengan benar</string>
<string name="tap_share_button_send_invite">Klik tombol bagikan untuk mengirim undangan ke kontak Anda %1$s.</string>
<string name="if_contact_is_nearby_use_qr">Jika kontak Anda di dekat Anda, mereka juga dapat memindai kode di bawah ini untuk menerima undangan Anda</string>
<string name="easy_invite_share_text">Bergabung %1$s dan mengobrol dengan saya: %2$s</string>
<string name="share_invite_with">Bagikan undangan dengan...</string>
</resources>

View File

@ -2,14 +2,9 @@ package eu.siacs.conversations.ui.service;
import android.content.Context; import android.content.Context;
import android.os.Build; import android.os.Build;
import android.support.text.emoji.EmojiCompat; import androidx.emoji.text.EmojiCompat;
import android.support.text.emoji.FontRequestEmojiCompatConfig; import androidx.emoji.text.FontRequestEmojiCompatConfig;
import android.support.text.emoji.bundled.BundledEmojiCompatConfig; import androidx.emoji.bundled.BundledEmojiCompatConfig;
import android.support.v4.provider.FontRequest;
import android.util.Log;
import eu.siacs.conversations.Config;
import eu.siacs.conversations.R;
public class EmojiService { public class EmojiService {

View File

@ -266,7 +266,7 @@
</service> </service>
<provider <provider
android:name="android.support.v4.content.FileProvider" android:name="androidx.core.content.FileProvider"
android:authorities="${applicationId}.files" android:authorities="${applicationId}.files"
android:exported="false" android:exported="false"
android:grantUriPermissions="true"> android:grantUriPermissions="true">

View File

@ -6,8 +6,8 @@ import android.net.Uri;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import eu.siacs.conversations.xmpp.chatstate.ChatState;
import eu.siacs.conversations.xmpp.Jid; import eu.siacs.conversations.xmpp.Jid;
import eu.siacs.conversations.xmpp.chatstate.ChatState;
public final class Config { public final class Config {
private static final int UNENCRYPTED = 1; private static final int UNENCRYPTED = 1;

View File

@ -2,9 +2,10 @@ package eu.siacs.conversations.crypto;
import android.app.PendingIntent; import android.app.PendingIntent;
import android.content.Intent; import android.content.Intent;
import android.support.annotation.StringRes;
import android.util.Log; import android.util.Log;
import androidx.annotation.StringRes;
import org.openintents.openpgp.OpenPgpError; import org.openintents.openpgp.OpenPgpError;
import org.openintents.openpgp.OpenPgpSignatureResult; import org.openintents.openpgp.OpenPgpSignatureResult;
import org.openintents.openpgp.util.OpenPgpApi; import org.openintents.openpgp.util.OpenPgpApi;
@ -30,8 +31,8 @@ import eu.siacs.conversations.services.XmppConnectionService;
import eu.siacs.conversations.ui.UiCallback; import eu.siacs.conversations.ui.UiCallback;
public class PgpEngine { public class PgpEngine {
private OpenPgpApi api; private final OpenPgpApi api;
private XmppConnectionService mXmppConnectionService; private final XmppConnectionService mXmppConnectionService;
public PgpEngine(OpenPgpApi api, XmppConnectionService service) { public PgpEngine(OpenPgpApi api, XmppConnectionService service) {
this.api = api; this.api = api;

View File

@ -2,18 +2,19 @@ package eu.siacs.conversations.crypto.axolotl;
import android.os.Bundle; import android.os.Bundle;
import android.security.KeyChain; import android.security.KeyChain;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.util.Log; import android.util.Log;
import android.util.Pair; import android.util.Pair;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import org.bouncycastle.jce.provider.BouncyCastleProvider; import org.bouncycastle.jce.provider.BouncyCastleProvider;
import org.whispersystems.libsignal.SignalProtocolAddress;
import org.whispersystems.libsignal.IdentityKey; import org.whispersystems.libsignal.IdentityKey;
import org.whispersystems.libsignal.IdentityKeyPair; import org.whispersystems.libsignal.IdentityKeyPair;
import org.whispersystems.libsignal.InvalidKeyException; import org.whispersystems.libsignal.InvalidKeyException;
import org.whispersystems.libsignal.InvalidKeyIdException; import org.whispersystems.libsignal.InvalidKeyIdException;
import org.whispersystems.libsignal.SessionBuilder; import org.whispersystems.libsignal.SessionBuilder;
import org.whispersystems.libsignal.SignalProtocolAddress;
import org.whispersystems.libsignal.UntrustedIdentityException; import org.whispersystems.libsignal.UntrustedIdentityException;
import org.whispersystems.libsignal.ecc.ECPublicKey; import org.whispersystems.libsignal.ecc.ECPublicKey;
import org.whispersystems.libsignal.state.PreKeyBundle; import org.whispersystems.libsignal.state.PreKeyBundle;
@ -48,12 +49,12 @@ import eu.siacs.conversations.services.XmppConnectionService;
import eu.siacs.conversations.utils.CryptoHelper; import eu.siacs.conversations.utils.CryptoHelper;
import eu.siacs.conversations.utils.SerialSingleThreadExecutor; import eu.siacs.conversations.utils.SerialSingleThreadExecutor;
import eu.siacs.conversations.xml.Element; import eu.siacs.conversations.xml.Element;
import eu.siacs.conversations.xmpp.Jid;
import eu.siacs.conversations.xmpp.OnAdvancedStreamFeaturesLoaded; import eu.siacs.conversations.xmpp.OnAdvancedStreamFeaturesLoaded;
import eu.siacs.conversations.xmpp.OnIqPacketReceived; import eu.siacs.conversations.xmpp.OnIqPacketReceived;
import eu.siacs.conversations.xmpp.pep.PublishOptions; import eu.siacs.conversations.xmpp.pep.PublishOptions;
import eu.siacs.conversations.xmpp.stanzas.IqPacket; import eu.siacs.conversations.xmpp.stanzas.IqPacket;
import eu.siacs.conversations.xmpp.stanzas.MessagePacket; import eu.siacs.conversations.xmpp.stanzas.MessagePacket;
import eu.siacs.conversations.xmpp.Jid;
public class AxolotlService implements OnAdvancedStreamFeaturesLoaded { public class AxolotlService implements OnAdvancedStreamFeaturesLoaded {
@ -85,9 +86,9 @@ public class AxolotlService implements OnAdvancedStreamFeaturesLoaded {
private int numPublishTriesOnEmptyPep = 0; private int numPublishTriesOnEmptyPep = 0;
private boolean pepBroken = false; private boolean pepBroken = false;
private int lastDeviceListNotificationHash = 0; private int lastDeviceListNotificationHash = 0;
private Set<XmppAxolotlSession> postponedSessions = new HashSet<>(); //sessions stored here will receive after mam catchup treatment private final Set<XmppAxolotlSession> postponedSessions = new HashSet<>(); //sessions stored here will receive after mam catchup treatment
private Set<SignalProtocolAddress> postponedHealing = new HashSet<>(); //addresses stored here will need a healing notification after mam catchup private final Set<SignalProtocolAddress> postponedHealing = new HashSet<>(); //addresses stored here will need a healing notification after mam catchup
private AtomicBoolean changeAccessMode = new AtomicBoolean(false); private final AtomicBoolean changeAccessMode = new AtomicBoolean(false);
public AxolotlService(Account account, XmppConnectionService connectionService) { public AxolotlService(Account account, XmppConnectionService connectionService) {
if (account == null || connectionService == null) { if (account == null || connectionService == null) {

View File

@ -3,15 +3,15 @@ package eu.siacs.conversations.crypto.axolotl;
import android.util.Log; import android.util.Log;
import android.util.LruCache; import android.util.LruCache;
import org.whispersystems.libsignal.SignalProtocolAddress;
import org.whispersystems.libsignal.IdentityKey; import org.whispersystems.libsignal.IdentityKey;
import org.whispersystems.libsignal.IdentityKeyPair; import org.whispersystems.libsignal.IdentityKeyPair;
import org.whispersystems.libsignal.InvalidKeyIdException; import org.whispersystems.libsignal.InvalidKeyIdException;
import org.whispersystems.libsignal.SignalProtocolAddress;
import org.whispersystems.libsignal.ecc.Curve; import org.whispersystems.libsignal.ecc.Curve;
import org.whispersystems.libsignal.ecc.ECKeyPair; import org.whispersystems.libsignal.ecc.ECKeyPair;
import org.whispersystems.libsignal.state.SignalProtocolStore;
import org.whispersystems.libsignal.state.PreKeyRecord; import org.whispersystems.libsignal.state.PreKeyRecord;
import org.whispersystems.libsignal.state.SessionRecord; import org.whispersystems.libsignal.state.SessionRecord;
import org.whispersystems.libsignal.state.SignalProtocolStore;
import org.whispersystems.libsignal.state.SignedPreKeyRecord; import org.whispersystems.libsignal.state.SignedPreKeyRecord;
import org.whispersystems.libsignal.util.KeyHelper; import org.whispersystems.libsignal.util.KeyHelper;

View File

@ -1,10 +1,10 @@
package eu.siacs.conversations.crypto.axolotl; package eu.siacs.conversations.crypto.axolotl;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.util.Log; import android.util.Log;
import org.whispersystems.libsignal.SignalProtocolAddress; import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import org.whispersystems.libsignal.DuplicateMessageException; import org.whispersystems.libsignal.DuplicateMessageException;
import org.whispersystems.libsignal.IdentityKey; import org.whispersystems.libsignal.IdentityKey;
import org.whispersystems.libsignal.InvalidKeyException; import org.whispersystems.libsignal.InvalidKeyException;
@ -14,6 +14,7 @@ import org.whispersystems.libsignal.InvalidVersionException;
import org.whispersystems.libsignal.LegacyMessageException; import org.whispersystems.libsignal.LegacyMessageException;
import org.whispersystems.libsignal.NoSessionException; import org.whispersystems.libsignal.NoSessionException;
import org.whispersystems.libsignal.SessionCipher; import org.whispersystems.libsignal.SessionCipher;
import org.whispersystems.libsignal.SignalProtocolAddress;
import org.whispersystems.libsignal.UntrustedIdentityException; import org.whispersystems.libsignal.UntrustedIdentityException;
import org.whispersystems.libsignal.protocol.CiphertextMessage; import org.whispersystems.libsignal.protocol.CiphertextMessage;
import org.whispersystems.libsignal.protocol.PreKeySignalMessage; import org.whispersystems.libsignal.protocol.PreKeySignalMessage;

View File

@ -27,9 +27,9 @@ import eu.siacs.conversations.services.AvatarService;
import eu.siacs.conversations.services.XmppConnectionService; import eu.siacs.conversations.services.XmppConnectionService;
import eu.siacs.conversations.utils.UIHelper; import eu.siacs.conversations.utils.UIHelper;
import eu.siacs.conversations.utils.XmppUri; import eu.siacs.conversations.utils.XmppUri;
import eu.siacs.conversations.xmpp.Jid;
import eu.siacs.conversations.xmpp.XmppConnection; import eu.siacs.conversations.xmpp.XmppConnection;
import eu.siacs.conversations.xmpp.jingle.RtpCapability; import eu.siacs.conversations.xmpp.jingle.RtpCapability;
import eu.siacs.conversations.xmpp.Jid;
public class Account extends AbstractEntity implements AvatarService.Avatarable { public class Account extends AbstractEntity implements AvatarService.Avatarable {

View File

@ -1,8 +1,9 @@
package eu.siacs.conversations.entities; package eu.siacs.conversations.entities;
import android.content.Context; import android.content.Context;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable; import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import java.lang.ref.WeakReference; import java.lang.ref.WeakReference;
import java.util.ArrayList; import java.util.ArrayList;
@ -21,7 +22,7 @@ import eu.siacs.conversations.xmpp.Jid;
public class Bookmark extends Element implements ListItem { public class Bookmark extends Element implements ListItem {
private Account account; private final Account account;
private WeakReference<Conversation> conversation; private WeakReference<Conversation> conversation;
private Jid jid; private Jid jid;

View File

@ -4,9 +4,12 @@ import android.content.ContentValues;
import android.content.Context; import android.content.Context;
import android.database.Cursor; import android.database.Cursor;
import android.net.Uri; import android.net.Uri;
import android.support.annotation.NonNull;
import android.text.TextUtils; import android.text.TextUtils;
import androidx.annotation.NonNull;
import com.google.common.base.Strings;
import org.json.JSONArray; import org.json.JSONArray;
import org.json.JSONException; import org.json.JSONException;
import org.json.JSONObject; import org.json.JSONObject;
@ -16,6 +19,7 @@ import java.util.Collection;
import java.util.HashSet; import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Locale; import java.util.Locale;
import java.util.Objects;
import eu.siacs.conversations.Config; import eu.siacs.conversations.Config;
import eu.siacs.conversations.R; import eu.siacs.conversations.R;
@ -25,8 +29,9 @@ import eu.siacs.conversations.services.QuickConversationsService;
import eu.siacs.conversations.utils.JidHelper; import eu.siacs.conversations.utils.JidHelper;
import eu.siacs.conversations.utils.UIHelper; import eu.siacs.conversations.utils.UIHelper;
import eu.siacs.conversations.xml.Element; import eu.siacs.conversations.xml.Element;
import eu.siacs.conversations.xmpp.pep.Avatar;
import eu.siacs.conversations.xmpp.Jid; import eu.siacs.conversations.xmpp.Jid;
import eu.siacs.conversations.xmpp.jingle.RtpCapability;
import eu.siacs.conversations.xmpp.pep.Avatar;
public class Contact implements ListItem, Blockable { public class Contact implements ListItem, Blockable {
public static final String TABLENAME = "contacts"; public static final String TABLENAME = "contacts";
@ -44,6 +49,7 @@ public class Contact implements ListItem, Blockable {
public static final String LAST_PRESENCE = "last_presence"; public static final String LAST_PRESENCE = "last_presence";
public static final String LAST_TIME = "last_time"; public static final String LAST_TIME = "last_time";
public static final String GROUPS = "groups"; public static final String GROUPS = "groups";
public static final String RTP_CAPABILITY = "rtpCapability";
private String accountUuid; private String accountUuid;
private String systemName; private String systemName;
private String serverName; private String serverName;
@ -62,11 +68,12 @@ public class Contact implements ListItem, Blockable {
private boolean mActive = false; private boolean mActive = false;
private long mLastseen = 0; private long mLastseen = 0;
private String mLastPresence = null; private String mLastPresence = null;
private RtpCapability.Capability rtpCapability;
public Contact(final String account, final String systemName, final String serverName, final String presenceName, public Contact(final String account, final String systemName, final String serverName, final String presenceName,
final Jid jid, final int subscription, final String photoUri, final Jid jid, final int subscription, final String photoUri,
final Uri systemAccount, final String keys, final String avatar, final long lastseen, final Uri systemAccount, final String keys, final String avatar, final long lastseen,
final String presence, final String groups) { final String presence, final String groups, final RtpCapability.Capability rtpCapability) {
this.accountUuid = account; this.accountUuid = account;
this.systemName = systemName; this.systemName = systemName;
this.serverName = serverName; this.serverName = serverName;
@ -94,6 +101,7 @@ public class Contact implements ListItem, Blockable {
} }
this.mLastseen = lastseen; this.mLastseen = lastseen;
this.mLastPresence = presence; this.mLastPresence = presence;
this.rtpCapability = rtpCapability;
} }
public Contact(final Jid jid) { public Contact(final Jid jid) {
@ -127,10 +135,17 @@ public class Contact implements ListItem, Blockable {
cursor.getString(cursor.getColumnIndex(AVATAR)), cursor.getString(cursor.getColumnIndex(AVATAR)),
cursor.getLong(cursor.getColumnIndex(LAST_TIME)), cursor.getLong(cursor.getColumnIndex(LAST_TIME)),
cursor.getString(cursor.getColumnIndex(LAST_PRESENCE)), cursor.getString(cursor.getColumnIndex(LAST_PRESENCE)),
cursor.getString(cursor.getColumnIndex(GROUPS))); cursor.getString(cursor.getColumnIndex(GROUPS)),
RtpCapability.Capability.of(cursor.getString(cursor.getColumnIndex(RTP_CAPABILITY))));
} }
public String getDisplayName() { public String getDisplayName() {
if (isSelf()) {
final String displayName = account.getDisplayName();
if (!Strings.isNullOrEmpty(displayName)) {
return displayName;
}
}
if (Config.X509_VERIFICATION && !TextUtils.isEmpty(this.commonName)) { if (Config.X509_VERIFICATION && !TextUtils.isEmpty(this.commonName)) {
return this.commonName; return this.commonName;
} else if (!TextUtils.isEmpty(this.systemName)) { } else if (!TextUtils.isEmpty(this.systemName)) {
@ -226,6 +241,7 @@ public class Contact implements ListItem, Blockable {
values.put(LAST_PRESENCE, mLastPresence); values.put(LAST_PRESENCE, mLastPresence);
values.put(LAST_TIME, mLastseen); values.put(LAST_TIME, mLastseen);
values.put(GROUPS, groups.toString()); values.put(GROUPS, groups.toString());
values.put(RTP_CAPABILITY, rtpCapability == null ? null : rtpCapability.toString());
return values; return values;
} }
} }
@ -565,7 +581,18 @@ public class Contact implements ListItem, Blockable {
return (avatar != null && avatar.getFilename() != null) || presenceName != null; return (avatar != null && avatar.getFilename() != null) || presenceName != null;
} }
public final class Options { public boolean refreshRtpCapability() {
final RtpCapability.Capability previous = this.rtpCapability;
this.rtpCapability = RtpCapability.check(this, false);
return !Objects.equals(previous, this.rtpCapability);
}
public RtpCapability.Capability getRtpCapability() {
return this.rtpCapability;
}
public static final class Options {
public static final int TO = 0; public static final int TO = 0;
public static final int FROM = 1; public static final int FROM = 1;
public static final int ASKING = 2; public static final int ASKING = 2;

View File

@ -2,10 +2,11 @@ package eu.siacs.conversations.entities;
import android.content.ContentValues; import android.content.ContentValues;
import android.database.Cursor; import android.database.Cursor;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.text.TextUtils; import android.text.TextUtils;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.google.common.collect.ComparisonChain; import com.google.common.collect.ComparisonChain;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
@ -28,9 +29,9 @@ import eu.siacs.conversations.services.AvatarService;
import eu.siacs.conversations.services.QuickConversationsService; import eu.siacs.conversations.services.QuickConversationsService;
import eu.siacs.conversations.utils.JidHelper; import eu.siacs.conversations.utils.JidHelper;
import eu.siacs.conversations.utils.UIHelper; import eu.siacs.conversations.utils.UIHelper;
import eu.siacs.conversations.xmpp.Jid;
import eu.siacs.conversations.xmpp.chatstate.ChatState; import eu.siacs.conversations.xmpp.chatstate.ChatState;
import eu.siacs.conversations.xmpp.mam.MamReference; import eu.siacs.conversations.xmpp.mam.MamReference;
import eu.siacs.conversations.xmpp.Jid;
import static eu.siacs.conversations.entities.Bookmark.printableValue; import static eu.siacs.conversations.entities.Bookmark.printableValue;
@ -68,12 +69,12 @@ public class Conversation extends AbstractEntity implements Blockable, Comparabl
public AtomicBoolean messagesLoaded = new AtomicBoolean(true); public AtomicBoolean messagesLoaded = new AtomicBoolean(true);
protected Account account = null; protected Account account = null;
private String draftMessage; private String draftMessage;
private String name; private final String name;
private String contactUuid; private final String contactUuid;
private String accountUuid; private final String accountUuid;
private Jid contactJid; private Jid contactJid;
private int status; private int status;
private long created; private final long created;
private int mode; private int mode;
private JSONObject attributes; private JSONObject attributes;
private Jid nextCounterpart; private Jid nextCounterpart;
@ -487,7 +488,7 @@ public class Conversation extends AbstractEntity implements Blockable, Comparabl
public void setLastClearHistory(long time, String reference) { public void setLastClearHistory(long time, String reference) {
if (reference != null) { if (reference != null) {
setAttribute(ATTRIBUTE_LAST_CLEAR_HISTORY, String.valueOf(time) + ":" + reference); setAttribute(ATTRIBUTE_LAST_CLEAR_HISTORY, time + ":" + reference);
} else { } else {
setAttribute(ATTRIBUTE_LAST_CLEAR_HISTORY, time); setAttribute(ATTRIBUTE_LAST_CLEAR_HISTORY, time);
} }

View File

@ -1,9 +1,10 @@
package eu.siacs.conversations.entities; package eu.siacs.conversations.entities;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.text.TextUtils; import android.text.TextUtils;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.HashSet; import java.util.HashSet;
@ -17,11 +18,11 @@ import eu.siacs.conversations.services.AvatarService;
import eu.siacs.conversations.services.MessageArchiveService; import eu.siacs.conversations.services.MessageArchiveService;
import eu.siacs.conversations.utils.JidHelper; import eu.siacs.conversations.utils.JidHelper;
import eu.siacs.conversations.utils.UIHelper; import eu.siacs.conversations.utils.UIHelper;
import eu.siacs.conversations.xmpp.Jid;
import eu.siacs.conversations.xmpp.chatstate.ChatState; import eu.siacs.conversations.xmpp.chatstate.ChatState;
import eu.siacs.conversations.xmpp.forms.Data; import eu.siacs.conversations.xmpp.forms.Data;
import eu.siacs.conversations.xmpp.forms.Field; import eu.siacs.conversations.xmpp.forms.Field;
import eu.siacs.conversations.xmpp.pep.Avatar; import eu.siacs.conversations.xmpp.pep.Avatar;
import eu.siacs.conversations.xmpp.Jid;
public class MucOptions { public class MucOptions {
@ -37,7 +38,7 @@ public class MucOptions {
private final Conversation conversation; private final Conversation conversation;
public OnRenameListener onRenameListener = null; public OnRenameListener onRenameListener = null;
private boolean mAutoPushConfiguration = true; private boolean mAutoPushConfiguration = true;
private Account account; private final Account account;
private ServiceDiscoveryResult serviceDiscoveryResult; private ServiceDiscoveryResult serviceDiscoveryResult;
private boolean isOnline = false; private boolean isOnline = false;
private Error error = Error.NONE; private Error error = Error.NONE;
@ -158,11 +159,8 @@ public class MucOptions {
} }
public boolean allowInvites() { public boolean allowInvites() {
final Field allowInvitesField = getRoomInfoForm().getFieldByName("muc#roomconfig_allowinvites"); final Field field = getRoomInfoForm().getFieldByName("muc#roomconfig_allowinvites");
final boolean allowInvites = allowInvitesField != null && "1".equals(allowInvitesField.getValue()); return field != null && "1".equals(field.getValue());
final Field allowMemberInvitesField = getRoomInfoForm().getFieldByName("muc#roomconfig_allowmemberinvites");
final boolean allowMemberInvites = allowMemberInvitesField != null && "1".equals(allowMemberInvitesField.getValue());
return allowInvites || allowMemberInvites;
} }
public boolean canChangeSubject() { public boolean canChangeSubject() {
@ -636,8 +634,8 @@ public class MucOptions {
OUTCAST(0, R.string.outcast), OUTCAST(0, R.string.outcast),
NONE(1, R.string.no_affiliation); NONE(1, R.string.no_affiliation);
private int resId; private final int resId;
private int rank; private final int rank;
Affiliation(int rank, int resId) { Affiliation(int rank, int resId) {
this.resId = resId; this.resId = resId;
@ -679,8 +677,8 @@ public class MucOptions {
PARTICIPANT(R.string.participant, 2), PARTICIPANT(R.string.participant, 2),
NONE(R.string.no_role, 0); NONE(R.string.no_role, 0);
private int resId; private final int resId;
private int rank; private final int rank;
Role(int resId, int rank) { Role(int resId, int rank) {
this.resId = resId; this.resId = resId;
@ -747,7 +745,7 @@ public class MucOptions {
private Jid fullJid; private Jid fullJid;
private long pgpKeyId = 0; private long pgpKeyId = 0;
private Avatar avatar; private Avatar avatar;
private MucOptions options; private final MucOptions options;
private ChatState chatState = Config.DEFAULT_CHAT_STATE; private ChatState chatState = Config.DEFAULT_CHAT_STATE;
public User(MucOptions options, Jid fullJid) { public User(MucOptions options, Jid fullJid) {
@ -858,7 +856,7 @@ public class MucOptions {
@Override @Override
public String toString() { public String toString() {
return "[fulljid:" + String.valueOf(fullJid) + ",realjid:" + String.valueOf(realJid) + ",affiliation" + affiliation.toString() + "]"; return "[fulljid:" + fullJid + ",realjid:" + realJid + ",affiliation" + affiliation.toString() + "]";
} }
public boolean realJidMatchesAccount() { public boolean realJidMatchesAccount() {

View File

@ -1,13 +1,12 @@
package eu.siacs.conversations.entities; package eu.siacs.conversations.entities;
import android.support.annotation.NonNull; import androidx.annotation.NonNull;
import java.lang.Comparable;
import java.util.Locale; import java.util.Locale;
import eu.siacs.conversations.xml.Element; import eu.siacs.conversations.xml.Element;
public class Presence implements Comparable { public class Presence implements Comparable<Presence> {
public enum Status { public enum Status {
CHAT, ONLINE, AWAY, XA, DND, OFFLINE; CHAT, ONLINE, AWAY, XA, DND, OFFLINE;
@ -64,8 +63,8 @@ public class Presence implements Comparable {
return new Presence(Status.fromShowString(show), ver, hash, node, message); return new Presence(Status.fromShowString(show), ver, hash, node, message);
} }
public int compareTo(@NonNull Object other) { public int compareTo(@NonNull Presence other) {
return this.status.compareTo(((Presence)other).status); return this.status.compareTo(other.status);
} }
public Status getStatus() { public Status getStatus() {

View File

@ -136,6 +136,9 @@ public class Presences {
public boolean anySupport(final String namespace) { public boolean anySupport(final String namespace) {
synchronized (this.presences) { synchronized (this.presences) {
if (this.presences.size() == 0) {
return true;
}
for (Presence presence : this.presences.values()) { for (Presence presence : this.presences.values()) {
ServiceDiscoveryResult disco = presence.getServiceDiscoveryResult(); ServiceDiscoveryResult disco = presence.getServiceDiscoveryResult();
if (disco != null && disco.getFeatures().contains(namespace)) { if (disco != null && disco.getFeatures().contains(namespace)) {

View File

@ -1,6 +1,6 @@
package eu.siacs.conversations.entities; package eu.siacs.conversations.entities;
import android.support.annotation.DrawableRes; import androidx.annotation.DrawableRes;
import com.google.common.base.Strings; import com.google.common.base.Strings;

View File

@ -2,26 +2,23 @@ package eu.siacs.conversations.entities;
import android.content.ContentValues; import android.content.ContentValues;
import android.database.Cursor; import android.database.Cursor;
import android.support.annotation.NonNull;
import android.util.Base64; import android.util.Base64;
import android.util.Log;
import androidx.annotation.NonNull;
import com.google.common.base.Strings; import com.google.common.base.Strings;
import java.io.UnsupportedEncodingException;
import java.lang.Comparable;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import org.json.JSONArray; import org.json.JSONArray;
import org.json.JSONException; import org.json.JSONException;
import org.json.JSONObject; import org.json.JSONObject;
import eu.siacs.conversations.Config; import java.nio.charset.StandardCharsets;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import eu.siacs.conversations.xml.Element; import eu.siacs.conversations.xml.Element;
import eu.siacs.conversations.xml.Namespace; import eu.siacs.conversations.xml.Namespace;
import eu.siacs.conversations.xmpp.forms.Data; import eu.siacs.conversations.xmpp.forms.Data;
@ -242,11 +239,7 @@ public class ServiceDiscoveryResult {
return null; return null;
} }
try { return md.digest(s.toString().getBytes(StandardCharsets.UTF_8));
return md.digest(s.toString().getBytes("UTF-8"));
} catch (UnsupportedEncodingException e) {
return null;
}
} }
private JSONObject toJSON() { private JSONObject toJSON() {

View File

@ -2,7 +2,7 @@ package eu.siacs.conversations.entities;
public class TransferablePlaceholder implements Transferable { public class TransferablePlaceholder implements Transferable {
private int status; private final int status;
public TransferablePlaceholder(int status) { public TransferablePlaceholder(int status) {
this.status = status; this.status = status;

View File

@ -29,12 +29,12 @@ import eu.siacs.conversations.entities.Conversation;
import eu.siacs.conversations.entities.DownloadableFile; import eu.siacs.conversations.entities.DownloadableFile;
import eu.siacs.conversations.services.MessageArchiveService; import eu.siacs.conversations.services.MessageArchiveService;
import eu.siacs.conversations.services.XmppConnectionService; import eu.siacs.conversations.services.XmppConnectionService;
import eu.siacs.conversations.xml.Namespace;
import eu.siacs.conversations.xml.Element; import eu.siacs.conversations.xml.Element;
import eu.siacs.conversations.xml.Namespace;
import eu.siacs.conversations.xmpp.Jid;
import eu.siacs.conversations.xmpp.forms.Data; import eu.siacs.conversations.xmpp.forms.Data;
import eu.siacs.conversations.xmpp.pep.Avatar; import eu.siacs.conversations.xmpp.pep.Avatar;
import eu.siacs.conversations.xmpp.stanzas.IqPacket; import eu.siacs.conversations.xmpp.stanzas.IqPacket;
import eu.siacs.conversations.xmpp.Jid;
public class IqGenerator extends AbstractGenerator { public class IqGenerator extends AbstractGenerator {
@ -430,7 +430,7 @@ public class IqGenerator extends AbstractGenerator {
ByteBuffer bb = ByteBuffer.wrap(new byte[16]); ByteBuffer bb = ByteBuffer.wrap(new byte[16]);
bb.putLong(uuid.getMostSignificantBits()); bb.putLong(uuid.getMostSignificantBits());
bb.putLong(uuid.getLeastSignificantBits()); bb.putLong(uuid.getLeastSignificantBits());
return Base64.encodeToString(bb.array(), Base64.URL_SAFE | Base64.NO_PADDING | Base64.NO_WRAP) + name.substring(pos, name.length()); return Base64.encodeToString(bb.array(), Base64.URL_SAFE | Base64.NO_PADDING | Base64.NO_WRAP) + name.substring(pos);
} catch (Exception e) { } catch (Exception e) {
return name; return name;
} }

View File

@ -1,9 +1,10 @@
package eu.siacs.conversations.http; package eu.siacs.conversations.http;
import android.os.PowerManager; import android.os.PowerManager;
import android.support.annotation.Nullable;
import android.util.Log; import android.util.Log;
import androidx.annotation.Nullable;
import com.google.common.base.Strings; import com.google.common.base.Strings;
import com.google.common.io.ByteStreams; import com.google.common.io.ByteStreams;
@ -328,7 +329,7 @@ public class HttpDownloadConnection implements Transferable {
private long retrieveFileSize() throws IOException { private long retrieveFileSize() throws IOException {
try { try {
Log.d(Config.LOGTAG, "retrieve file size. interactive:" + String.valueOf(interactive)); Log.d(Config.LOGTAG, "retrieve file size. interactive:" + interactive);
changeStatus(STATUS_CHECKING); changeStatus(STATUS_CHECKING);
HttpURLConnection connection; HttpURLConnection connection;
final String hostname = mUrl.getHost(); final String hostname = mUrl.getHost();

View File

@ -42,12 +42,12 @@ import eu.siacs.conversations.parser.IqParser;
import eu.siacs.conversations.services.XmppConnectionService; import eu.siacs.conversations.services.XmppConnectionService;
import eu.siacs.conversations.xml.Element; import eu.siacs.conversations.xml.Element;
import eu.siacs.conversations.xml.Namespace; import eu.siacs.conversations.xml.Namespace;
import eu.siacs.conversations.xmpp.stanzas.IqPacket;
import eu.siacs.conversations.xmpp.Jid; import eu.siacs.conversations.xmpp.Jid;
import eu.siacs.conversations.xmpp.stanzas.IqPacket;
public class SlotRequester { public class SlotRequester {
private XmppConnectionService service; private final XmppConnectionService service;
public SlotRequester(XmppConnectionService service) { public SlotRequester(XmppConnectionService service) {
this.service = service; this.service = service;

View File

@ -3,7 +3,6 @@ package eu.siacs.conversations.parser;
import java.text.ParseException; import java.text.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Locale; import java.util.Locale;
@ -15,8 +14,8 @@ import eu.siacs.conversations.entities.MucOptions;
import eu.siacs.conversations.services.XmppConnectionService; import eu.siacs.conversations.services.XmppConnectionService;
import eu.siacs.conversations.xml.Element; import eu.siacs.conversations.xml.Element;
import eu.siacs.conversations.xmpp.InvalidJid; import eu.siacs.conversations.xmpp.InvalidJid;
import eu.siacs.conversations.xmpp.stanzas.AbstractStanza;
import eu.siacs.conversations.xmpp.Jid; import eu.siacs.conversations.xmpp.Jid;
import eu.siacs.conversations.xmpp.stanzas.AbstractStanza;
public abstract class AbstractParser { public abstract class AbstractParser {
@ -82,7 +81,7 @@ public abstract class AbstractParser {
} else { } else {
ms = 0; ms = 0;
} }
timestamp = timestamp.substring(0,19)+timestamp.substring(timestamp.length() -5,timestamp.length()); timestamp = timestamp.substring(0,19)+timestamp.substring(timestamp.length() -5);
dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ",Locale.US); dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ",Locale.US);
return Math.min(dateFormat.parse(timestamp).getTime()+ms, System.currentTimeMillis()); return Math.min(dateFormat.parse(timestamp).getTime()+ms, System.currentTimeMillis());
} }

View File

@ -1,10 +1,11 @@
package eu.siacs.conversations.parser; package eu.siacs.conversations.parser;
import android.support.annotation.NonNull;
import android.text.TextUtils; import android.text.TextUtils;
import android.util.Log; import android.util.Log;
import android.util.Pair; import android.util.Pair;
import androidx.annotation.NonNull;
import com.google.common.base.CharMatcher; import com.google.common.base.CharMatcher;
import com.google.common.io.BaseEncoding; import com.google.common.io.BaseEncoding;
@ -35,11 +36,11 @@ import eu.siacs.conversations.services.XmppConnectionService;
import eu.siacs.conversations.xml.Element; import eu.siacs.conversations.xml.Element;
import eu.siacs.conversations.xml.Namespace; import eu.siacs.conversations.xml.Namespace;
import eu.siacs.conversations.xmpp.InvalidJid; import eu.siacs.conversations.xmpp.InvalidJid;
import eu.siacs.conversations.xmpp.Jid;
import eu.siacs.conversations.xmpp.OnIqPacketReceived; import eu.siacs.conversations.xmpp.OnIqPacketReceived;
import eu.siacs.conversations.xmpp.OnUpdateBlocklist; import eu.siacs.conversations.xmpp.OnUpdateBlocklist;
import eu.siacs.conversations.xmpp.forms.Data; import eu.siacs.conversations.xmpp.forms.Data;
import eu.siacs.conversations.xmpp.stanzas.IqPacket; import eu.siacs.conversations.xmpp.stanzas.IqPacket;
import eu.siacs.conversations.xmpp.Jid;
public class IqParser extends AbstractParser implements OnIqPacketReceived { public class IqParser extends AbstractParser implements OnIqPacketReceived {

View File

@ -38,17 +38,17 @@ import eu.siacs.conversations.services.MessageArchiveService;
import eu.siacs.conversations.services.QuickConversationsService; import eu.siacs.conversations.services.QuickConversationsService;
import eu.siacs.conversations.services.XmppConnectionService; import eu.siacs.conversations.services.XmppConnectionService;
import eu.siacs.conversations.utils.CryptoHelper; import eu.siacs.conversations.utils.CryptoHelper;
import eu.siacs.conversations.xml.Element;
import eu.siacs.conversations.xml.LocalizedContent; import eu.siacs.conversations.xml.LocalizedContent;
import eu.siacs.conversations.xml.Namespace; import eu.siacs.conversations.xml.Namespace;
import eu.siacs.conversations.xml.Element;
import eu.siacs.conversations.xmpp.InvalidJid; import eu.siacs.conversations.xmpp.InvalidJid;
import eu.siacs.conversations.xmpp.Jid;
import eu.siacs.conversations.xmpp.OnMessagePacketReceived; import eu.siacs.conversations.xmpp.OnMessagePacketReceived;
import eu.siacs.conversations.xmpp.chatstate.ChatState; import eu.siacs.conversations.xmpp.chatstate.ChatState;
import eu.siacs.conversations.xmpp.jingle.JingleConnectionManager; import eu.siacs.conversations.xmpp.jingle.JingleConnectionManager;
import eu.siacs.conversations.xmpp.jingle.JingleRtpConnection; import eu.siacs.conversations.xmpp.jingle.JingleRtpConnection;
import eu.siacs.conversations.xmpp.pep.Avatar; import eu.siacs.conversations.xmpp.pep.Avatar;
import eu.siacs.conversations.xmpp.stanzas.MessagePacket; import eu.siacs.conversations.xmpp.stanzas.MessagePacket;
import eu.siacs.conversations.xmpp.Jid;
public class MessageParser extends AbstractParser implements OnMessagePacketReceived { public class MessageParser extends AbstractParser implements OnMessagePacketReceived {

View File

@ -5,7 +5,6 @@ import android.util.Log;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import eu.siacs.conversations.Config; import eu.siacs.conversations.Config;
import eu.siacs.conversations.crypto.PgpEngine; import eu.siacs.conversations.crypto.PgpEngine;
import eu.siacs.conversations.crypto.axolotl.AxolotlService; import eu.siacs.conversations.crypto.axolotl.AxolotlService;
@ -22,10 +21,10 @@ import eu.siacs.conversations.utils.XmppUri;
import eu.siacs.conversations.xml.Element; import eu.siacs.conversations.xml.Element;
import eu.siacs.conversations.xml.Namespace; import eu.siacs.conversations.xml.Namespace;
import eu.siacs.conversations.xmpp.InvalidJid; import eu.siacs.conversations.xmpp.InvalidJid;
import eu.siacs.conversations.xmpp.Jid;
import eu.siacs.conversations.xmpp.OnPresencePacketReceived; import eu.siacs.conversations.xmpp.OnPresencePacketReceived;
import eu.siacs.conversations.xmpp.pep.Avatar; import eu.siacs.conversations.xmpp.pep.Avatar;
import eu.siacs.conversations.xmpp.stanzas.PresencePacket; import eu.siacs.conversations.xmpp.stanzas.PresencePacket;
import eu.siacs.conversations.xmpp.Jid;
public class PresenceParser extends AbstractParser implements public class PresenceParser extends AbstractParser implements
OnPresencePacketReceived { OnPresencePacketReceived {

View File

@ -11,11 +11,12 @@ import android.os.SystemClock;
import android.util.Base64; import android.util.Base64;
import android.util.Log; import android.util.Log;
import org.json.JSONException;
import org.json.JSONObject; import org.json.JSONObject;
import org.whispersystems.libsignal.SignalProtocolAddress;
import org.whispersystems.libsignal.IdentityKey; import org.whispersystems.libsignal.IdentityKey;
import org.whispersystems.libsignal.IdentityKeyPair; import org.whispersystems.libsignal.IdentityKeyPair;
import org.whispersystems.libsignal.InvalidKeyException; import org.whispersystems.libsignal.InvalidKeyException;
import org.whispersystems.libsignal.SignalProtocolAddress;
import org.whispersystems.libsignal.state.PreKeyRecord; import org.whispersystems.libsignal.state.PreKeyRecord;
import org.whispersystems.libsignal.state.SessionRecord; import org.whispersystems.libsignal.state.SessionRecord;
import org.whispersystems.libsignal.state.SignedPreKeyRecord; import org.whispersystems.libsignal.state.SignedPreKeyRecord;
@ -36,8 +37,6 @@ import java.util.Set;
import java.util.UUID; import java.util.UUID;
import java.util.concurrent.CopyOnWriteArrayList; import java.util.concurrent.CopyOnWriteArrayList;
import org.json.JSONException;
import eu.siacs.conversations.Config; import eu.siacs.conversations.Config;
import eu.siacs.conversations.crypto.axolotl.AxolotlService; import eu.siacs.conversations.crypto.axolotl.AxolotlService;
import eu.siacs.conversations.crypto.axolotl.FingerprintStatus; import eu.siacs.conversations.crypto.axolotl.FingerprintStatus;
@ -57,15 +56,15 @@ import eu.siacs.conversations.utils.FtsUtils;
import eu.siacs.conversations.utils.MimeUtils; import eu.siacs.conversations.utils.MimeUtils;
import eu.siacs.conversations.utils.Resolver; import eu.siacs.conversations.utils.Resolver;
import eu.siacs.conversations.xmpp.InvalidJid; import eu.siacs.conversations.xmpp.InvalidJid;
import eu.siacs.conversations.xmpp.mam.MamReference;
import eu.siacs.conversations.xmpp.Jid; import eu.siacs.conversations.xmpp.Jid;
import eu.siacs.conversations.xmpp.mam.MamReference;
public class DatabaseBackend extends SQLiteOpenHelper { public class DatabaseBackend extends SQLiteOpenHelper {
private static final String DATABASE_NAME = "history"; private static final String DATABASE_NAME = "history";
private static final int DATABASE_VERSION = 48; private static final int DATABASE_VERSION = 48;
private static DatabaseBackend instance = null; private static DatabaseBackend instance = null;
private static String CREATE_CONTATCS_STATEMENT = "create table " private static final String CREATE_CONTATCS_STATEMENT = "create table "
+ Contact.TABLENAME + "(" + Contact.ACCOUNT + " TEXT, " + Contact.TABLENAME + "(" + Contact.ACCOUNT + " TEXT, "
+ Contact.SERVERNAME + " TEXT, " + Contact.SYSTEMNAME + " TEXT," + Contact.SERVERNAME + " TEXT, " + Contact.SYSTEMNAME + " TEXT,"
+ Contact.PRESENCE_NAME + " TEXT," + Contact.PRESENCE_NAME + " TEXT,"
@ -73,12 +72,13 @@ public class DatabaseBackend extends SQLiteOpenHelper {
+ Contact.PHOTOURI + " TEXT," + Contact.OPTIONS + " NUMBER," + Contact.PHOTOURI + " TEXT," + Contact.OPTIONS + " NUMBER,"
+ Contact.SYSTEMACCOUNT + " NUMBER, " + Contact.AVATAR + " TEXT, " + Contact.SYSTEMACCOUNT + " NUMBER, " + Contact.AVATAR + " TEXT, "
+ Contact.LAST_PRESENCE + " TEXT, " + Contact.LAST_TIME + " NUMBER, " + Contact.LAST_PRESENCE + " TEXT, " + Contact.LAST_TIME + " NUMBER, "
+ Contact.RTP_CAPABILITY + " TEXT,"
+ Contact.GROUPS + " TEXT, FOREIGN KEY(" + Contact.ACCOUNT + ") REFERENCES " + Contact.GROUPS + " TEXT, FOREIGN KEY(" + Contact.ACCOUNT + ") REFERENCES "
+ Account.TABLENAME + "(" + Account.UUID + Account.TABLENAME + "(" + Account.UUID
+ ") ON DELETE CASCADE, UNIQUE(" + Contact.ACCOUNT + ", " + ") ON DELETE CASCADE, UNIQUE(" + Contact.ACCOUNT + ", "
+ Contact.JID + ") ON CONFLICT REPLACE);"; + Contact.JID + ") ON CONFLICT REPLACE);";
private static String CREATE_DISCOVERY_RESULTS_STATEMENT = "create table " private static final String CREATE_DISCOVERY_RESULTS_STATEMENT = "create table "
+ ServiceDiscoveryResult.TABLENAME + "(" + ServiceDiscoveryResult.TABLENAME + "("
+ ServiceDiscoveryResult.HASH + " TEXT, " + ServiceDiscoveryResult.HASH + " TEXT, "
+ ServiceDiscoveryResult.VER + " TEXT, " + ServiceDiscoveryResult.VER + " TEXT, "
@ -86,7 +86,7 @@ public class DatabaseBackend extends SQLiteOpenHelper {
+ "UNIQUE(" + ServiceDiscoveryResult.HASH + ", " + "UNIQUE(" + ServiceDiscoveryResult.HASH + ", "
+ ServiceDiscoveryResult.VER + ") ON CONFLICT REPLACE);"; + ServiceDiscoveryResult.VER + ") ON CONFLICT REPLACE);";
private static String CREATE_PRESENCE_TEMPLATES_STATEMENT = "CREATE TABLE " private static final String CREATE_PRESENCE_TEMPLATES_STATEMENT = "CREATE TABLE "
+ PresenceTemplate.TABELNAME + "(" + PresenceTemplate.TABELNAME + "("
+ PresenceTemplate.UUID + " TEXT, " + PresenceTemplate.UUID + " TEXT, "
+ PresenceTemplate.LAST_USED + " NUMBER," + PresenceTemplate.LAST_USED + " NUMBER,"
@ -94,7 +94,7 @@ public class DatabaseBackend extends SQLiteOpenHelper {
+ PresenceTemplate.STATUS + " TEXT," + PresenceTemplate.STATUS + " TEXT,"
+ "UNIQUE(" + PresenceTemplate.MESSAGE + "," + PresenceTemplate.STATUS + ") ON CONFLICT REPLACE);"; + "UNIQUE(" + PresenceTemplate.MESSAGE + "," + PresenceTemplate.STATUS + ") ON CONFLICT REPLACE);";
private static String CREATE_PREKEYS_STATEMENT = "CREATE TABLE " private static final String CREATE_PREKEYS_STATEMENT = "CREATE TABLE "
+ SQLiteAxolotlStore.PREKEY_TABLENAME + "(" + SQLiteAxolotlStore.PREKEY_TABLENAME + "("
+ SQLiteAxolotlStore.ACCOUNT + " TEXT, " + SQLiteAxolotlStore.ACCOUNT + " TEXT, "
+ SQLiteAxolotlStore.ID + " INTEGER, " + SQLiteAxolotlStore.ID + " INTEGER, "
@ -106,7 +106,7 @@ public class DatabaseBackend extends SQLiteOpenHelper {
+ ") ON CONFLICT REPLACE" + ") ON CONFLICT REPLACE"
+ ");"; + ");";
private static String CREATE_SIGNED_PREKEYS_STATEMENT = "CREATE TABLE " private static final String CREATE_SIGNED_PREKEYS_STATEMENT = "CREATE TABLE "
+ SQLiteAxolotlStore.SIGNED_PREKEY_TABLENAME + "(" + SQLiteAxolotlStore.SIGNED_PREKEY_TABLENAME + "("
+ SQLiteAxolotlStore.ACCOUNT + " TEXT, " + SQLiteAxolotlStore.ACCOUNT + " TEXT, "
+ SQLiteAxolotlStore.ID + " INTEGER, " + SQLiteAxolotlStore.ID + " INTEGER, "
@ -118,7 +118,7 @@ public class DatabaseBackend extends SQLiteOpenHelper {
+ ") ON CONFLICT REPLACE" + + ") ON CONFLICT REPLACE" +
");"; ");";
private static String CREATE_SESSIONS_STATEMENT = "CREATE TABLE " private static final String CREATE_SESSIONS_STATEMENT = "CREATE TABLE "
+ SQLiteAxolotlStore.SESSION_TABLENAME + "(" + SQLiteAxolotlStore.SESSION_TABLENAME + "("
+ SQLiteAxolotlStore.ACCOUNT + " TEXT, " + SQLiteAxolotlStore.ACCOUNT + " TEXT, "
+ SQLiteAxolotlStore.NAME + " TEXT, " + SQLiteAxolotlStore.NAME + " TEXT, "
@ -132,7 +132,7 @@ public class DatabaseBackend extends SQLiteOpenHelper {
+ ") ON CONFLICT REPLACE" + ") ON CONFLICT REPLACE"
+ ");"; + ");";
private static String CREATE_IDENTITIES_STATEMENT = "CREATE TABLE " private static final String CREATE_IDENTITIES_STATEMENT = "CREATE TABLE "
+ SQLiteAxolotlStore.IDENTITIES_TABLENAME + "(" + SQLiteAxolotlStore.IDENTITIES_TABLENAME + "("
+ SQLiteAxolotlStore.ACCOUNT + " TEXT, " + SQLiteAxolotlStore.ACCOUNT + " TEXT, "
+ SQLiteAxolotlStore.NAME + " TEXT, " + SQLiteAxolotlStore.NAME + " TEXT, "
@ -151,9 +151,9 @@ public class DatabaseBackend extends SQLiteOpenHelper {
+ ") ON CONFLICT IGNORE" + ") ON CONFLICT IGNORE"
+ ");"; + ");";
private static String RESOLVER_RESULTS_TABLENAME = "resolver_results"; private static final String RESOLVER_RESULTS_TABLENAME = "resolver_results";
private static String CREATE_RESOLVER_RESULTS_TABLE = "create table " + RESOLVER_RESULTS_TABLENAME + "(" private static final String CREATE_RESOLVER_RESULTS_TABLE = "create table " + RESOLVER_RESULTS_TABLENAME + "("
+ Resolver.Result.DOMAIN + " TEXT," + Resolver.Result.DOMAIN + " TEXT,"
+ Resolver.Result.HOSTNAME + " TEXT," + Resolver.Result.HOSTNAME + " TEXT,"
+ Resolver.Result.IP + " BLOB," + Resolver.Result.IP + " BLOB,"
@ -165,16 +165,16 @@ public class DatabaseBackend extends SQLiteOpenHelper {
+ "UNIQUE(" + Resolver.Result.DOMAIN + ") ON CONFLICT REPLACE" + "UNIQUE(" + Resolver.Result.DOMAIN + ") ON CONFLICT REPLACE"
+ ");"; + ");";
private static String CREATE_MESSAGE_TIME_INDEX = "create INDEX message_time_index ON " + Message.TABLENAME + "(" + Message.TIME_SENT + ")"; private static final String CREATE_MESSAGE_TIME_INDEX = "create INDEX message_time_index ON " + Message.TABLENAME + "(" + Message.TIME_SENT + ")";
private static String CREATE_MESSAGE_CONVERSATION_INDEX = "create INDEX message_conversation_index ON " + Message.TABLENAME + "(" + Message.CONVERSATION + ")"; private static final String CREATE_MESSAGE_CONVERSATION_INDEX = "create INDEX message_conversation_index ON " + Message.TABLENAME + "(" + Message.CONVERSATION + ")";
private static String CREATE_MESSAGE_DELETED_INDEX = "create index message_deleted_index ON " + Message.TABLENAME + "(" + Message.DELETED + ")"; private static final String CREATE_MESSAGE_DELETED_INDEX = "create index message_deleted_index ON " + Message.TABLENAME + "(" + Message.DELETED + ")";
private static String CREATE_MESSAGE_RELATIVE_FILE_PATH_INDEX = "create INDEX message_file_path_index ON " + Message.TABLENAME + "(" + Message.RELATIVE_FILE_PATH + ")"; private static final String CREATE_MESSAGE_RELATIVE_FILE_PATH_INDEX = "create INDEX message_file_path_index ON " + Message.TABLENAME + "(" + Message.RELATIVE_FILE_PATH + ")";
private static String CREATE_MESSAGE_TYPE_INDEX = "create INDEX message_type_index ON " + Message.TABLENAME + "(" + Message.TYPE + ")"; private static final String CREATE_MESSAGE_TYPE_INDEX = "create INDEX message_type_index ON " + Message.TABLENAME + "(" + Message.TYPE + ")";
private static String CREATE_MESSAGE_INDEX_TABLE = "CREATE VIRTUAL TABLE messages_index USING FTS4(uuid TEXT PRIMARY KEY, body TEXT)"; private static final String CREATE_MESSAGE_INDEX_TABLE = "CREATE VIRTUAL TABLE messages_index USING FTS4(uuid TEXT PRIMARY KEY, body TEXT)";
private static String CREATE_MESSAGE_INSERT_TRIGGER = "CREATE TRIGGER after_message_insert AFTER INSERT ON " + Message.TABLENAME + " BEGIN INSERT INTO messages_index (uuid,body) VALUES (new.uuid,new.body); END;"; private static final String CREATE_MESSAGE_INSERT_TRIGGER = "CREATE TRIGGER after_message_insert AFTER INSERT ON " + Message.TABLENAME + " BEGIN INSERT INTO messages_index (uuid,body) VALUES (new.uuid,new.body); END;";
private static String CREATE_MESSAGE_UPDATE_TRIGGER = "CREATE TRIGGER after_message_update UPDATE of uuid,body ON " + Message.TABLENAME + " BEGIN update messages_index set body=new.body,uuid=new.uuid WHERE uuid=old.uuid; END;"; private static final String CREATE_MESSAGE_UPDATE_TRIGGER = "CREATE TRIGGER after_message_update UPDATE of uuid,body ON " + Message.TABLENAME + " BEGIN update messages_index set body=new.body,uuid=new.uuid WHERE uuid=old.uuid; END;";
private static String COPY_PREEXISTING_ENTRIES = "INSERT into messages_index(uuid,body) select uuid,body FROM " + Message.TABLENAME + ";"; private static final String COPY_PREEXISTING_ENTRIES = "INSERT into messages_index(uuid,body) select uuid,body FROM " + Message.TABLENAME + ";";
private DatabaseBackend(Context context) { private DatabaseBackend(Context context) {
super(context, DATABASE_NAME, null, DATABASE_VERSION); super(context, DATABASE_NAME, null, DATABASE_VERSION);
@ -563,6 +563,9 @@ public class DatabaseBackend extends SQLiteOpenHelper {
if (oldVersion < 48 && newVersion >= 48) { if (oldVersion < 48 && newVersion >= 48) {
db.execSQL("ALTER TABLE " + Contact.TABLENAME + " ADD COLUMN " + Contact.PRESENCE_NAME + " TEXT"); db.execSQL("ALTER TABLE " + Contact.TABLENAME + " ADD COLUMN " + Contact.PRESENCE_NAME + " TEXT");
} }
if (oldVersion < 48 && newVersion >= 48) {
db.execSQL("ALTER TABLE " + Contact.TABLENAME + " ADD COLUMN " + Contact.RTP_CAPABILITY + " TEXT");
}
} }
private void canonicalizeJids(SQLiteDatabase db) { private void canonicalizeJids(SQLiteDatabase db) {
@ -633,7 +636,7 @@ public class DatabaseBackend extends SQLiteOpenHelper {
continue; continue;
} }
String updateArgs[] = { String[] updateArgs = {
newServer, newServer,
cursor.getString(cursor.getColumnIndex(Account.UUID)), cursor.getString(cursor.getColumnIndex(Account.UUID)),
}; };
@ -872,7 +875,7 @@ public class DatabaseBackend extends SQLiteOpenHelper {
SQLiteDatabase db = this.getReadableDatabase(); SQLiteDatabase db = this.getReadableDatabase();
final String SQL = "select uuid,relativeFilePath from messages where type in (1,2,5) and deleted=0 and "+Message.RELATIVE_FILE_PATH+" is not null and conversationUuid=(select uuid from conversations where accountUuid=? and (contactJid=? or contactJid like ?)) order by timeSent desc"; final String SQL = "select uuid,relativeFilePath from messages where type in (1,2,5) and deleted=0 and "+Message.RELATIVE_FILE_PATH+" is not null and conversationUuid=(select uuid from conversations where accountUuid=? and (contactJid=? or contactJid like ?)) order by timeSent desc";
final String[] args = {account, jid.toString(), jid.toString() + "/%"}; final String[] args = {account, jid.toString(), jid.toString() + "/%"};
Cursor cursor = db.rawQuery(SQL + (limit > 0 ? " limit " + String.valueOf(limit) : ""), args); Cursor cursor = db.rawQuery(SQL + (limit > 0 ? " limit " + limit : ""), args);
List<FilePath> filesPaths = new ArrayList<>(); List<FilePath> filesPaths = new ArrayList<>();
while (cursor.moveToNext()) { while (cursor.moveToNext()) {
filesPaths.add(new FilePath(cursor.getString(0), cursor.getString(1))); filesPaths.add(new FilePath(cursor.getString(0), cursor.getString(1)));
@ -1005,7 +1008,7 @@ public class DatabaseBackend extends SQLiteOpenHelper {
public void readRoster(Roster roster) { public void readRoster(Roster roster) {
SQLiteDatabase db = this.getReadableDatabase(); SQLiteDatabase db = this.getReadableDatabase();
Cursor cursor; Cursor cursor;
String args[] = {roster.getAccount().getUuid()}; String[] args = {roster.getAccount().getUuid()};
cursor = db.query(Contact.TABLENAME, null, Contact.ACCOUNT + "=?", args, null, null, null); cursor = db.query(Contact.TABLENAME, null, Contact.ACCOUNT + "=?", args, null, null, null);
while (cursor.moveToNext()) { while (cursor.moveToNext()) {
roster.initContact(Contact.fromCursor(cursor)); roster.initContact(Contact.fromCursor(cursor));

View File

@ -20,8 +20,6 @@ import android.os.Environment;
import android.os.ParcelFileDescriptor; import android.os.ParcelFileDescriptor;
import android.provider.MediaStore; import android.provider.MediaStore;
import android.provider.OpenableColumns; import android.provider.OpenableColumns;
import android.support.annotation.RequiresApi;
import android.support.v4.content.FileProvider;
import android.system.Os; import android.system.Os;
import android.system.StructStat; import android.system.StructStat;
import android.util.Base64; import android.util.Base64;
@ -30,6 +28,9 @@ import android.util.DisplayMetrics;
import android.util.Log; import android.util.Log;
import android.util.LruCache; import android.util.LruCache;
import androidx.annotation.RequiresApi;
import androidx.core.content.FileProvider;
import java.io.ByteArrayOutputStream; import java.io.ByteArrayOutputStream;
import java.io.Closeable; import java.io.Closeable;
import java.io.File; import java.io.File;
@ -277,7 +278,6 @@ public class FileBackend {
} finally { } finally {
if (bitmap != null) { if (bitmap != null) {
bitmap.recycle(); bitmap.recycle();
;
} }
} }
} }
@ -982,9 +982,9 @@ public class FileBackend {
public Uri getTakePhotoUri() { public Uri getTakePhotoUri() {
File file; File file;
if (Config.ONLY_INTERNAL_STORAGE) { if (Config.ONLY_INTERNAL_STORAGE) {
file = new File(mXmppConnectionService.getCacheDir().getAbsolutePath(), "Camera/IMG_" + this.IMAGE_DATE_FORMAT.format(new Date()) + ".jpg"); file = new File(mXmppConnectionService.getCacheDir().getAbsolutePath(), "Camera/IMG_" + IMAGE_DATE_FORMAT.format(new Date()) + ".jpg");
} else { } else {
file = new File(getTakePhotoPath() + "IMG_" + this.IMAGE_DATE_FORMAT.format(new Date()) + ".jpg"); file = new File(getTakePhotoPath() + "IMG_" + IMAGE_DATE_FORMAT.format(new Date()) + ".jpg");
} }
file.getParentFile().mkdirs(); file.getParentFile().mkdirs();
return getUriForFile(mXmppConnectionService, file); return getUriForFile(mXmppConnectionService, file);
@ -1408,9 +1408,6 @@ public class FileBackend {
return null; return null;
} }
Bitmap bm = cropCenter(getAvatarUri(avatar), size, size); Bitmap bm = cropCenter(getAvatarUri(avatar), size, size);
if (bm == null) {
return null;
}
return bm; return bm;
} }
@ -1447,7 +1444,7 @@ public class FileBackend {
} }
public static class FileCopyException extends Exception { public static class FileCopyException extends Exception {
private int resId; private final int resId;
private FileCopyException(int resId) { private FileCopyException(int resId) {
this.resId = resId; this.resId = resId;

View File

@ -1,5 +1,5 @@
package eu.siacs.conversations.persistance; package eu.siacs.conversations.persistance;
public interface OnPhoneContactsMerged { public interface OnPhoneContactsMerged {
public void phoneContactsMerged(); void phoneContactsMerged();
} }

View File

@ -1,9 +1,14 @@
package eu.siacs.conversations.services; package eu.siacs.conversations.services;
import android.content.Intent;
import eu.siacs.conversations.BuildConfig; import eu.siacs.conversations.BuildConfig;
public abstract class AbstractQuickConversationsService { public abstract class AbstractQuickConversationsService {
public static final String SMS_RETRIEVED_ACTION = "com.google.android.gms.auth.api.phone.SMS_RETRIEVED";
protected final XmppConnectionService service; protected final XmppConnectionService service;
public AbstractQuickConversationsService(XmppConnectionService service) { public AbstractQuickConversationsService(XmppConnectionService service) {
@ -25,4 +30,6 @@ public abstract class AbstractQuickConversationsService {
public abstract boolean isSynchronizing(); public abstract boolean isSynchronizing();
public abstract void considerSyncBackground(boolean force); public abstract void considerSyncBackground(boolean force);
public abstract void handleSmsReceived(Intent intent);
} }

View File

@ -20,9 +20,10 @@ import android.media.AudioManager;
import android.media.AudioRecord; import android.media.AudioRecord;
import android.media.MediaRecorder; import android.media.MediaRecorder;
import android.os.Build; import android.os.Build;
import android.support.annotation.Nullable;
import android.util.Log; import android.util.Log;
import androidx.annotation.Nullable;
import org.webrtc.ThreadUtils; import org.webrtc.ThreadUtils;
import java.util.Collections; import java.util.Collections;
@ -47,7 +48,7 @@ public class AppRTCAudioManager {
// Handles all tasks related to Bluetooth headset devices. // Handles all tasks related to Bluetooth headset devices.
private final AppRTCBluetoothManager bluetoothManager; private final AppRTCBluetoothManager bluetoothManager;
@Nullable @Nullable
private AudioManager audioManager; private final AudioManager audioManager;
@Nullable @Nullable
private AudioManagerEvents audioManagerEvents; private AudioManagerEvents audioManagerEvents;
private AudioManagerState amState; private AudioManagerState amState;
@ -78,7 +79,7 @@ public class AppRTCAudioManager {
// avoid duplicate elements. // avoid duplicate elements.
private Set<AudioDevice> audioDevices = new HashSet<>(); private Set<AudioDevice> audioDevices = new HashSet<>();
// Broadcast receiver for wired headset intent broadcasts. // Broadcast receiver for wired headset intent broadcasts.
private BroadcastReceiver wiredHeadsetReceiver; private final BroadcastReceiver wiredHeadsetReceiver;
// Callback method for changes in audio focus. // Callback method for changes in audio focus.
@Nullable @Nullable
private AudioManager.OnAudioFocusChangeListener audioFocusChangeListener; private AudioManager.OnAudioFocusChangeListener audioFocusChangeListener;

View File

@ -23,14 +23,15 @@ import android.media.AudioManager;
import android.os.Handler; import android.os.Handler;
import android.os.Looper; import android.os.Looper;
import android.os.Process; import android.os.Process;
import android.support.annotation.Nullable;
import android.util.Log; import android.util.Log;
import androidx.annotation.Nullable;
import org.webrtc.ThreadUtils;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
import org.webrtc.ThreadUtils;
import eu.siacs.conversations.Config; import eu.siacs.conversations.Config;
import eu.siacs.conversations.utils.AppRTCUtils; import eu.siacs.conversations.utils.AppRTCUtils;

View File

@ -15,9 +15,10 @@ import android.hardware.SensorEvent;
import android.hardware.SensorEventListener; import android.hardware.SensorEventListener;
import android.hardware.SensorManager; import android.hardware.SensorManager;
import android.os.Build; import android.os.Build;
import android.support.annotation.Nullable;
import android.util.Log; import android.util.Log;
import androidx.annotation.Nullable;
import org.webrtc.ThreadUtils; import org.webrtc.ThreadUtils;
import eu.siacs.conversations.Config; import eu.siacs.conversations.Config;

View File

@ -6,19 +6,18 @@ import android.net.Uri;
import android.os.Build; import android.os.Build;
import android.os.ParcelFileDescriptor; import android.os.ParcelFileDescriptor;
import android.preference.PreferenceManager; import android.preference.PreferenceManager;
import android.support.annotation.RequiresApi;
import android.util.Log; import android.util.Log;
import androidx.annotation.RequiresApi;
import net.ypresto.androidtranscoder.MediaTranscoder; import net.ypresto.androidtranscoder.MediaTranscoder;
import net.ypresto.androidtranscoder.format.MediaFormatStrategy; import net.ypresto.androidtranscoder.format.MediaFormatStrategy;
import net.ypresto.androidtranscoder.format.MediaFormatStrategyPresets;
import java.io.File; import java.io.File;
import java.io.FileDescriptor; import java.io.FileDescriptor;
import java.io.FileNotFoundException; import java.io.FileNotFoundException;
import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future; import java.util.concurrent.Future;
import java.util.concurrent.atomic.AtomicInteger;
import eu.siacs.conversations.Config; import eu.siacs.conversations.Config;
import eu.siacs.conversations.R; import eu.siacs.conversations.R;

View File

@ -12,15 +12,15 @@ import android.graphics.Typeface;
import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.net.Uri; import android.net.Uri;
import android.support.annotation.ColorInt;
import android.support.annotation.Nullable;
import android.support.v4.content.res.ResourcesCompat;
import android.text.TextUtils; import android.text.TextUtils;
import android.util.DisplayMetrics; import android.util.DisplayMetrics;
import android.util.Log; import android.util.Log;
import android.util.LruCache; import android.util.LruCache;
import java.util.ArrayList; import androidx.annotation.ColorInt;
import androidx.annotation.Nullable;
import androidx.core.content.res.ResourcesCompat;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import java.util.List; import java.util.List;
@ -40,9 +40,9 @@ import eu.siacs.conversations.entities.MucOptions;
import eu.siacs.conversations.entities.RawBlockable; import eu.siacs.conversations.entities.RawBlockable;
import eu.siacs.conversations.entities.Room; import eu.siacs.conversations.entities.Room;
import eu.siacs.conversations.utils.UIHelper; import eu.siacs.conversations.utils.UIHelper;
import eu.siacs.conversations.xmpp.Jid;
import eu.siacs.conversations.xmpp.OnAdvancedStreamFeaturesLoaded; import eu.siacs.conversations.xmpp.OnAdvancedStreamFeaturesLoaded;
import eu.siacs.conversations.xmpp.XmppConnection; import eu.siacs.conversations.xmpp.XmppConnection;
import eu.siacs.conversations.xmpp.Jid;
public class AvatarService implements OnAdvancedStreamFeaturesLoaded { public class AvatarService implements OnAdvancedStreamFeaturesLoaded {
@ -519,7 +519,7 @@ public class AvatarService implements OnAdvancedStreamFeaturesLoaded {
this.sizes.add(size); this.sizes.add(size);
} }
return PREFIX_ACCOUNT + "_" + account.getUuid() + "_" return PREFIX_ACCOUNT + "_" + account.getUuid() + "_"
+ String.valueOf(size); + size;
} }
/*public Bitmap get(String name, int size) { /*public Bitmap get(String name, int size) {

View File

@ -13,9 +13,10 @@ import android.net.Uri;
import android.os.CancellationSignal; import android.os.CancellationSignal;
import android.os.IBinder; import android.os.IBinder;
import android.os.ParcelFileDescriptor; import android.os.ParcelFileDescriptor;
import android.support.annotation.Nullable;
import android.util.Log; import android.util.Log;
import androidx.annotation.Nullable;
import com.google.zxing.BarcodeFormat; import com.google.zxing.BarcodeFormat;
import com.google.zxing.EncodeHintType; import com.google.zxing.EncodeHintType;
import com.google.zxing.common.BitMatrix; import com.google.zxing.common.BitMatrix;

View File

@ -1,8 +1,9 @@
package eu.siacs.conversations.services; package eu.siacs.conversations.services;
import android.support.annotation.NonNull;
import android.util.Log; import android.util.Log;
import androidx.annotation.NonNull;
import com.google.common.cache.Cache; import com.google.common.cache.Cache;
import com.google.common.cache.CacheBuilder; import com.google.common.cache.CacheBuilder;
@ -22,6 +23,7 @@ import eu.siacs.conversations.entities.Room;
import eu.siacs.conversations.http.HttpConnectionManager; import eu.siacs.conversations.http.HttpConnectionManager;
import eu.siacs.conversations.http.services.MuclumbusService; import eu.siacs.conversations.http.services.MuclumbusService;
import eu.siacs.conversations.parser.IqParser; import eu.siacs.conversations.parser.IqParser;
import eu.siacs.conversations.xmpp.Jid;
import eu.siacs.conversations.xmpp.OnIqPacketReceived; import eu.siacs.conversations.xmpp.OnIqPacketReceived;
import eu.siacs.conversations.xmpp.XmppConnection; import eu.siacs.conversations.xmpp.XmppConnection;
import eu.siacs.conversations.xmpp.stanzas.IqPacket; import eu.siacs.conversations.xmpp.stanzas.IqPacket;
@ -32,7 +34,6 @@ import retrofit2.Callback;
import retrofit2.Response; import retrofit2.Response;
import retrofit2.Retrofit; import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory; import retrofit2.converter.gson.GsonConverterFactory;
import eu.siacs.conversations.xmpp.Jid;
public class ChannelDiscoveryService { public class ChannelDiscoveryService {

View File

@ -5,7 +5,6 @@ import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
import android.preference.PreferenceManager; import android.preference.PreferenceManager;
import android.support.v4.content.ContextCompat;
import android.util.Log; import android.util.Log;
import com.google.common.base.Strings; import com.google.common.base.Strings;

View File

@ -11,9 +11,10 @@ import android.database.DatabaseUtils;
import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteDatabase;
import android.net.Uri; import android.net.Uri;
import android.os.IBinder; import android.os.IBinder;
import android.support.v4.app.NotificationCompat;
import android.util.Log; import android.util.Log;
import androidx.core.app.NotificationCompat;
import com.google.common.base.Strings; import com.google.common.base.Strings;
import java.io.DataOutputStream; import java.io.DataOutputStream;

View File

@ -34,11 +34,12 @@ import android.content.Intent;
import android.net.Uri; import android.net.Uri;
import android.os.Handler; import android.os.Handler;
import android.preference.PreferenceManager; import android.preference.PreferenceManager;
import android.support.v7.app.AppCompatActivity;
import android.util.Base64; import android.util.Base64;
import android.util.Log; import android.util.Log;
import android.util.SparseArray; import android.util.SparseArray;
import androidx.appcompat.app.AppCompatActivity;
import org.json.JSONArray; import org.json.JSONArray;
import org.json.JSONException; import org.json.JSONException;
import org.json.JSONObject; import org.json.JSONObject;
@ -114,14 +115,14 @@ public class MemorizingTrustManager {
static String KEYSTORE_DIR = "KeyStore"; static String KEYSTORE_DIR = "KeyStore";
static String KEYSTORE_FILE = "KeyStore.bks"; static String KEYSTORE_FILE = "KeyStore.bks";
private static int decisionId = 0; private static int decisionId = 0;
private static SparseArray<MTMDecision> openDecisions = new SparseArray<MTMDecision>(); private static final SparseArray<MTMDecision> openDecisions = new SparseArray<MTMDecision>();
Context master; Context master;
AppCompatActivity foregroundAct; AppCompatActivity foregroundAct;
NotificationManager notificationManager; NotificationManager notificationManager;
Handler masterHandler; Handler masterHandler;
private File keyStoreFile; private File keyStoreFile;
private KeyStore appKeyStore; private KeyStore appKeyStore;
private X509TrustManager defaultTrustManager; private final X509TrustManager defaultTrustManager;
private X509TrustManager appTrustManager; private X509TrustManager appTrustManager;
private String poshCacheDir; private String poshCacheDir;
@ -699,7 +700,7 @@ public class MemorizingTrustManager {
Object name = altName.get(1); Object name = altName.get(1);
if (name instanceof String) { if (name instanceof String) {
si.append("["); si.append("[");
si.append((Integer) altName.get(0)); si.append(altName.get(0));
si.append("] "); si.append("] ");
si.append(name); si.append(name);
si.append("\n"); si.append("\n");

View File

@ -18,11 +18,11 @@ import eu.siacs.conversations.entities.Conversational;
import eu.siacs.conversations.entities.ReceiptRequest; import eu.siacs.conversations.entities.ReceiptRequest;
import eu.siacs.conversations.generator.AbstractGenerator; import eu.siacs.conversations.generator.AbstractGenerator;
import eu.siacs.conversations.xml.Element; import eu.siacs.conversations.xml.Element;
import eu.siacs.conversations.xmpp.Jid;
import eu.siacs.conversations.xmpp.OnAdvancedStreamFeaturesLoaded; import eu.siacs.conversations.xmpp.OnAdvancedStreamFeaturesLoaded;
import eu.siacs.conversations.xmpp.mam.MamReference; import eu.siacs.conversations.xmpp.mam.MamReference;
import eu.siacs.conversations.xmpp.stanzas.IqPacket; import eu.siacs.conversations.xmpp.stanzas.IqPacket;
import eu.siacs.conversations.xmpp.stanzas.MessagePacket; import eu.siacs.conversations.xmpp.stanzas.MessagePacket;
import eu.siacs.conversations.xmpp.Jid;
public class MessageArchiveService implements OnAdvancedStreamFeaturesLoaded { public class MessageArchiveService implements OnAdvancedStreamFeaturesLoaded {
@ -89,7 +89,7 @@ public class MessageArchiveService implements OnAdvancedStreamFeaturesLoaded {
return null; return null;
} }
}; }
MessageArchiveService(final XmppConnectionService service) { MessageArchiveService(final XmppConnectionService service) {
this.mXmppConnectionService = service; this.mXmppConnectionService = service;
@ -370,7 +370,7 @@ public class MessageArchiveService implements OnAdvancedStreamFeaturesLoaded {
done = done || (query.getActualMessageCount() == 0 && !query.isCatchup()); done = done || (query.getActualMessageCount() == 0 && !query.isCatchup());
this.finalizeQuery(query, done); this.finalizeQuery(query, done);
Log.d(Config.LOGTAG, query.getAccount().getJid().asBareJid() + ": finished mam after " + query.getTotalCount() + "(" + query.getActualMessageCount() + ") messages. messages left=" + Boolean.toString(!done) + " count=" + count); Log.d(Config.LOGTAG, query.getAccount().getJid().asBareJid() + ": finished mam after " + query.getTotalCount() + "(" + query.getActualMessageCount() + ") messages. messages left=" + !done + " count=" + count);
if (query.isCatchup() && query.getActualMessageCount() > 0) { if (query.isCatchup() && query.getActualMessageCount() > 0) {
mXmppConnectionService.getNotificationService().finishBacklog(true, query.getAccount()); mXmppConnectionService.getNotificationService().finishBacklog(true, query.getAccount());
} }
@ -459,10 +459,10 @@ public class MessageArchiveService implements OnAdvancedStreamFeaturesLoaded {
private int actualCount = 0; private int actualCount = 0;
private int actualInThisQuery = 0; private int actualInThisQuery = 0;
private long start; private long start;
private long end; private final long end;
private String queryId; private final String queryId;
private String reference = null; private String reference = null;
private Account account; private final Account account;
private Conversation conversation; private Conversation conversation;
private PagingOrder pagingOrder = PagingOrder.NORMAL; private PagingOrder pagingOrder = PagingOrder.NORMAL;
private XmppConnectionService.OnMoreMessagesLoaded callback = null; private XmppConnectionService.OnMoreMessagesLoaded callback = null;
@ -649,7 +649,7 @@ public class MessageArchiveService implements OnAdvancedStreamFeaturesLoaded {
} }
builder.append(this.reference); builder.append(this.reference);
} }
builder.append(", catchup=").append(Boolean.toString(catchup)); builder.append(", catchup=").append(catchup);
builder.append(", ns=").append(version.namespace); builder.append(", ns=").append(version.namespace);
return builder.toString(); return builder.toString();
} }

View File

@ -17,20 +17,21 @@ import android.net.Uri;
import android.os.Build; import android.os.Build;
import android.os.SystemClock; import android.os.SystemClock;
import android.preference.PreferenceManager; import android.preference.PreferenceManager;
import android.support.annotation.RequiresApi;
import android.support.v4.app.NotificationCompat;
import android.support.v4.app.NotificationCompat.BigPictureStyle;
import android.support.v4.app.NotificationCompat.Builder;
import android.support.v4.app.NotificationManagerCompat;
import android.support.v4.app.Person;
import android.support.v4.app.RemoteInput;
import android.support.v4.content.ContextCompat;
import android.support.v4.graphics.drawable.IconCompat;
import android.text.SpannableString; import android.text.SpannableString;
import android.text.style.StyleSpan; import android.text.style.StyleSpan;
import android.util.DisplayMetrics; import android.util.DisplayMetrics;
import android.util.Log; import android.util.Log;
import androidx.annotation.RequiresApi;
import androidx.core.app.NotificationCompat;
import androidx.core.app.NotificationCompat.BigPictureStyle;
import androidx.core.app.NotificationCompat.Builder;
import androidx.core.app.NotificationManagerCompat;
import androidx.core.app.Person;
import androidx.core.app.RemoteInput;
import androidx.core.content.ContextCompat;
import androidx.core.graphics.drawable.IconCompat;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
@ -662,7 +663,7 @@ public class NotificationService {
private Builder buildMultipleConversation(final boolean notify, final boolean quietHours) { private Builder buildMultipleConversation(final boolean notify, final boolean quietHours) {
final Builder mBuilder = new NotificationCompat.Builder(mXmppConnectionService, quietHours ? "quiet_hours" : (notify ? "messages" : "silent_messages")); final Builder mBuilder = new NotificationCompat.Builder(mXmppConnectionService, quietHours ? "quiet_hours" : (notify ? "messages" : "silent_messages"));
final NotificationCompat.InboxStyle style = new NotificationCompat.InboxStyle(); final NotificationCompat.InboxStyle style = new NotificationCompat.InboxStyle();
style.setBigContentTitle(mXmppConnectionService.getString(R.string.x_unread_conversations, notifications.size())); style.setBigContentTitle(mXmppConnectionService.getResources().getQuantityString(R.plurals.x_unread_conversations, notifications.size(), notifications.size()));
final StringBuilder names = new StringBuilder(); final StringBuilder names = new StringBuilder();
Conversation conversation = null; Conversation conversation = null;
for (final ArrayList<Message> messages : notifications.values()) { for (final ArrayList<Message> messages : notifications.values()) {
@ -687,8 +688,9 @@ public class NotificationService {
if (names.length() >= 2) { if (names.length() >= 2) {
names.delete(names.length() - 2, names.length()); names.delete(names.length() - 2, names.length());
} }
mBuilder.setContentTitle(mXmppConnectionService.getString(R.string.x_unread_conversations, notifications.size())); final String contentTitle = mXmppConnectionService.getResources().getQuantityString(R.plurals.x_unread_conversations, notifications.size(), notifications.size());
mBuilder.setTicker(mXmppConnectionService.getString(R.string.x_unread_conversations, notifications.size())); mBuilder.setContentTitle(contentTitle);
mBuilder.setTicker(contentTitle);
mBuilder.setContentText(names.toString()); mBuilder.setContentText(names.toString());
mBuilder.setStyle(style); mBuilder.setStyle(style);
if (conversation != null) { if (conversation != null) {

View File

@ -8,9 +8,10 @@ import android.graphics.Bitmap;
import android.graphics.drawable.Icon; import android.graphics.drawable.Icon;
import android.net.Uri; import android.net.Uri;
import android.os.Build; import android.os.Build;
import android.support.annotation.NonNull;
import android.util.Log; import android.util.Log;
import androidx.annotation.NonNull;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;

View File

@ -32,10 +32,6 @@ import android.os.SystemClock;
import android.preference.PreferenceManager; import android.preference.PreferenceManager;
import android.provider.ContactsContract; import android.provider.ContactsContract;
import android.security.KeyChain; import android.security.KeyChain;
import android.support.annotation.BoolRes;
import android.support.annotation.IntegerRes;
import android.support.v4.app.RemoteInput;
import android.support.v4.content.ContextCompat;
import android.telephony.PhoneStateListener; import android.telephony.PhoneStateListener;
import android.telephony.TelephonyManager; import android.telephony.TelephonyManager;
import android.text.TextUtils; import android.text.TextUtils;
@ -44,6 +40,11 @@ import android.util.Log;
import android.util.LruCache; import android.util.LruCache;
import android.util.Pair; import android.util.Pair;
import androidx.annotation.BoolRes;
import androidx.annotation.IntegerRes;
import androidx.core.app.RemoteInput;
import androidx.core.content.ContextCompat;
import com.google.common.base.Objects; import com.google.common.base.Objects;
import com.google.common.base.Strings; import com.google.common.base.Strings;
@ -135,6 +136,7 @@ import eu.siacs.conversations.utils.WakeLockHelper;
import eu.siacs.conversations.utils.XmppUri; import eu.siacs.conversations.utils.XmppUri;
import eu.siacs.conversations.xml.Element; import eu.siacs.conversations.xml.Element;
import eu.siacs.conversations.xml.Namespace; import eu.siacs.conversations.xml.Namespace;
import eu.siacs.conversations.xmpp.Jid;
import eu.siacs.conversations.xmpp.OnBindListener; import eu.siacs.conversations.xmpp.OnBindListener;
import eu.siacs.conversations.xmpp.OnContactStatusChanged; import eu.siacs.conversations.xmpp.OnContactStatusChanged;
import eu.siacs.conversations.xmpp.OnIqPacketReceived; import eu.siacs.conversations.xmpp.OnIqPacketReceived;
@ -159,7 +161,6 @@ import eu.siacs.conversations.xmpp.stanzas.IqPacket;
import eu.siacs.conversations.xmpp.stanzas.MessagePacket; import eu.siacs.conversations.xmpp.stanzas.MessagePacket;
import eu.siacs.conversations.xmpp.stanzas.PresencePacket; import eu.siacs.conversations.xmpp.stanzas.PresencePacket;
import me.leolin.shortcutbadger.ShortcutBadger; import me.leolin.shortcutbadger.ShortcutBadger;
import eu.siacs.conversations.xmpp.Jid;
public class XmppConnectionService extends Service { public class XmppConnectionService extends Service {
@ -206,21 +207,21 @@ public class XmppConnectionService extends Service {
} }
}; };
public DatabaseBackend databaseBackend; public DatabaseBackend databaseBackend;
private ReplacingSerialSingleThreadExecutor mContactMergerExecutor = new ReplacingSerialSingleThreadExecutor("ContactMerger"); private final ReplacingSerialSingleThreadExecutor mContactMergerExecutor = new ReplacingSerialSingleThreadExecutor("ContactMerger");
private long mLastActivity = 0; private long mLastActivity = 0;
private FileBackend fileBackend = new FileBackend(this); private final FileBackend fileBackend = new FileBackend(this);
private MemorizingTrustManager mMemorizingTrustManager; private MemorizingTrustManager mMemorizingTrustManager;
private NotificationService mNotificationService = new NotificationService(this); private final NotificationService mNotificationService = new NotificationService(this);
private ChannelDiscoveryService mChannelDiscoveryService = new ChannelDiscoveryService(this); private final ChannelDiscoveryService mChannelDiscoveryService = new ChannelDiscoveryService(this);
private ShortcutService mShortcutService = new ShortcutService(this); private final ShortcutService mShortcutService = new ShortcutService(this);
private AtomicBoolean mInitialAddressbookSyncCompleted = new AtomicBoolean(false); private final AtomicBoolean mInitialAddressbookSyncCompleted = new AtomicBoolean(false);
private AtomicBoolean mForceForegroundService = new AtomicBoolean(false); private final AtomicBoolean mForceForegroundService = new AtomicBoolean(false);
private AtomicBoolean mForceDuringOnCreate = new AtomicBoolean(false); private final AtomicBoolean mForceDuringOnCreate = new AtomicBoolean(false);
private AtomicReference<OngoingCall> ongoingCall = new AtomicReference<>(); private final AtomicReference<OngoingCall> ongoingCall = new AtomicReference<>();
private OnMessagePacketReceived mMessageParser = new MessageParser(this); private final OnMessagePacketReceived mMessageParser = new MessageParser(this);
private OnPresencePacketReceived mPresenceParser = new PresenceParser(this); private final OnPresencePacketReceived mPresenceParser = new PresenceParser(this);
private IqParser mIqParser = new IqParser(this); private final IqParser mIqParser = new IqParser(this);
private MessageGenerator mMessageGenerator = new MessageGenerator(this); private final MessageGenerator mMessageGenerator = new MessageGenerator(this);
public OnContactStatusChanged onContactStatusChanged = (contact, online) -> { public OnContactStatusChanged onContactStatusChanged = (contact, online) -> {
Conversation conversation = find(getConversations(), contact); Conversation conversation = find(getConversations(), contact);
if (conversation != null) { if (conversation != null) {
@ -231,14 +232,14 @@ public class XmppConnectionService extends Service {
} }
} }
}; };
private PresenceGenerator mPresenceGenerator = new PresenceGenerator(this); private final PresenceGenerator mPresenceGenerator = new PresenceGenerator(this);
private List<Account> accounts; private List<Account> accounts;
private JingleConnectionManager mJingleConnectionManager = new JingleConnectionManager(this); private final JingleConnectionManager mJingleConnectionManager = new JingleConnectionManager(this);
private HttpConnectionManager mHttpConnectionManager = new HttpConnectionManager(this); private final HttpConnectionManager mHttpConnectionManager = new HttpConnectionManager(this);
private AvatarService mAvatarService = new AvatarService(this); private final AvatarService mAvatarService = new AvatarService(this);
private MessageArchiveService mMessageArchiveService = new MessageArchiveService(this); private final MessageArchiveService mMessageArchiveService = new MessageArchiveService(this);
private PushManagementService mPushManagementService = new PushManagementService(this); private final PushManagementService mPushManagementService = new PushManagementService(this);
private QuickConversationsService mQuickConversationsService = new QuickConversationsService(this); private final QuickConversationsService mQuickConversationsService = new QuickConversationsService(this);
private final ConversationsFileObserver fileObserver = new ConversationsFileObserver( private final ConversationsFileObserver fileObserver = new ConversationsFileObserver(
Environment.getExternalStorageDirectory().getAbsolutePath() Environment.getExternalStorageDirectory().getAbsolutePath()
) { ) {
@ -357,10 +358,10 @@ public class XmppConnectionService extends Service {
syncDirtyContacts(account); syncDirtyContacts(account);
} }
}; };
private AtomicLong mLastExpiryRun = new AtomicLong(0); private final AtomicLong mLastExpiryRun = new AtomicLong(0);
private SecureRandom mRandom; private SecureRandom mRandom;
private LruCache<Pair<String, String>, ServiceDiscoveryResult> discoCache = new LruCache<>(20); private final LruCache<Pair<String, String>, ServiceDiscoveryResult> discoCache = new LruCache<>(20);
private OnStatusChanged statusListener = new OnStatusChanged() { private final OnStatusChanged statusListener = new OnStatusChanged() {
@Override @Override
public void onStatusChanged(final Account account) { public void onStatusChanged(final Account account) {
@ -459,8 +460,8 @@ public class XmppConnectionService extends Service {
private WakeLock wakeLock; private WakeLock wakeLock;
private PowerManager pm; private PowerManager pm;
private LruCache<String, Bitmap> mBitmapCache; private LruCache<String, Bitmap> mBitmapCache;
private BroadcastReceiver mInternalEventReceiver = new InternalEventReceiver(); private final BroadcastReceiver mInternalEventReceiver = new InternalEventReceiver();
private BroadcastReceiver mInternalScreenEventReceiver = new InternalEventReceiver(); private final BroadcastReceiver mInternalScreenEventReceiver = new InternalEventReceiver();
private static String generateFetchKey(Account account, final Avatar avatar) { private static String generateFetchKey(Account account, final Avatar avatar) {
return account.getJid().asBareJid() + "_" + avatar.owner + "_" + avatar.sha1sum; return account.getJid().asBareJid() + "_" + avatar.owner + "_" + avatar.sha1sum;
@ -633,6 +634,9 @@ public class XmppConnectionService extends Service {
if (action != null) { if (action != null) {
final String uuid = intent.getStringExtra("uuid"); final String uuid = intent.getStringExtra("uuid");
switch (action) { switch (action) {
case QuickConversationsService.SMS_RETRIEVED_ACTION:
mQuickConversationsService.handleSmsReceived(intent);
break;
case ConnectivityManager.CONNECTIVITY_ACTION: case ConnectivityManager.CONNECTIVITY_ACTION:
if (hasInternetConnection()) { if (hasInternetConnection()) {
if (Config.POST_CONNECTIVITY_CHANGE_PING_INTERVAL > 0) { if (Config.POST_CONNECTIVITY_CHANGE_PING_INTERVAL > 0) {
@ -796,7 +800,7 @@ public class XmppConnectionService extends Service {
for (Account account : pingCandidates) { for (Account account : pingCandidates) {
final boolean lowTimeout = isInLowPingTimeoutMode(account); final boolean lowTimeout = isInLowPingTimeoutMode(account);
account.getXmppConnection().sendPing(); account.getXmppConnection().sendPing();
Log.d(Config.LOGTAG, account.getJid().asBareJid() + " send ping (action=" + action + ",lowTimeout=" + Boolean.toString(lowTimeout) + ")"); Log.d(Config.LOGTAG, account.getJid().asBareJid() + " send ping (action=" + action + ",lowTimeout=" + lowTimeout + ")");
scheduleWakeUpCall(lowTimeout ? Config.LOW_PING_TIMEOUT : Config.PING_TIMEOUT, account.getUuid().hashCode()); scheduleWakeUpCall(lowTimeout ? Config.LOW_PING_TIMEOUT : Config.PING_TIMEOUT, account.getUuid().hashCode());
} }
} }
@ -1284,17 +1288,20 @@ public class XmppConnectionService extends Service {
final OngoingCall ongoing = ongoingCall.get(); final OngoingCall ongoing = ongoingCall.get();
if (force || mForceDuringOnCreate.get() || mForceForegroundService.get() || ongoing != null || (Compatibility.keepForegroundService(this) && hasEnabledAccounts())) { if (force || mForceDuringOnCreate.get() || mForceForegroundService.get() || ongoing != null || (Compatibility.keepForegroundService(this) && hasEnabledAccounts())) {
final Notification notification; final Notification notification;
final int id;
if (ongoing != null) { if (ongoing != null) {
notification = this.mNotificationService.getOngoingCallNotification(ongoing.id, ongoing.media); notification = this.mNotificationService.getOngoingCallNotification(ongoing.id, ongoing.media);
startForeground(NotificationService.ONGOING_CALL_NOTIFICATION_ID, notification); id = NotificationService.ONGOING_CALL_NOTIFICATION_ID;
startForeground(id, notification);
mNotificationService.cancel(NotificationService.FOREGROUND_NOTIFICATION_ID); mNotificationService.cancel(NotificationService.FOREGROUND_NOTIFICATION_ID);
} else { } else {
notification = this.mNotificationService.createForegroundNotification(); notification = this.mNotificationService.createForegroundNotification();
startForeground(NotificationService.FOREGROUND_NOTIFICATION_ID, notification); id = NotificationService.FOREGROUND_NOTIFICATION_ID;
startForeground(id, notification);
} }
if (!mForceForegroundService.get()) { if (!mForceForegroundService.get()) {
mNotificationService.notify(NotificationService.FOREGROUND_NOTIFICATION_ID, notification); mNotificationService.notify(id, notification);
} }
status = true; status = true;
} else { } else {
@ -1833,7 +1840,7 @@ public class XmppConnectionService extends Service {
} }
}); });
} else { } else {
Log.d(Config.LOGTAG, account.getJid().asBareJid() + ": error publishing bookmarks (retry=" + Boolean.toString(retry) + ") " + response); Log.d(Config.LOGTAG, account.getJid().asBareJid() + ": error publishing bookmarks (retry=" + retry + ") " + response);
} }
}); });
} }
@ -4545,6 +4552,10 @@ public class XmppConnectionService extends Service {
final ServiceDiscoveryResult disco = getCachedServiceDiscoveryResult(key); final ServiceDiscoveryResult disco = getCachedServiceDiscoveryResult(key);
if (disco != null) { if (disco != null) {
presence.setServiceDiscoveryResult(disco); presence.setServiceDiscoveryResult(disco);
final Contact contact = account.getRoster().getContact(jid);
if (contact.refreshRtpCapability()) {
syncRoster(account);
}
} else { } else {
if (account.inProgressDiscoFetches.contains(key)) { if (account.inProgressDiscoFetches.contains(key)) {
Log.d(Config.LOGTAG, account.getJid().asBareJid() + ": skipping duplicate disco request for " + key.second + " to " + jid); Log.d(Config.LOGTAG, account.getJid().asBareJid() + ": skipping duplicate disco request for " + key.second + " to " + jid);
@ -4578,12 +4589,21 @@ public class XmppConnectionService extends Service {
} }
private void injectServiceDiscoveryResult(Roster roster, String hash, String ver, ServiceDiscoveryResult disco) { private void injectServiceDiscoveryResult(Roster roster, String hash, String ver, ServiceDiscoveryResult disco) {
boolean rosterNeedsSync = false;
for (final Contact contact : roster.getContacts()) { for (final Contact contact : roster.getContacts()) {
boolean serviceDiscoverySet = false;
for (final Presence presence : contact.getPresences().getPresences()) { for (final Presence presence : contact.getPresences().getPresences()) {
if (hash.equals(presence.getHash()) && ver.equals(presence.getVer())) { if (hash.equals(presence.getHash()) && ver.equals(presence.getVer())) {
presence.setServiceDiscoveryResult(disco); presence.setServiceDiscoveryResult(disco);
serviceDiscoverySet = true;
} }
} }
if (serviceDiscoverySet) {
rosterNeedsSync |= contact.refreshRtpCapability();
}
}
if (rosterNeedsSync) {
syncRoster(roster.getAccount());
} }
} }

View File

@ -1,8 +1,8 @@
package eu.siacs.conversations.ui; package eu.siacs.conversations.ui;
import android.os.Bundle; import android.os.Bundle;
import android.preference.PreferenceManager;
import android.support.v7.app.AppCompatActivity; import androidx.appcompat.app.AppCompatActivity;
import eu.siacs.conversations.R; import eu.siacs.conversations.R;
import eu.siacs.conversations.utils.ThemeHelper; import eu.siacs.conversations.utils.ThemeHelper;

View File

@ -1,9 +1,7 @@
package eu.siacs.conversations.ui; package eu.siacs.conversations.ui;
import android.content.Context; import android.content.Context;
import android.databinding.DataBindingUtil;
import android.os.Bundle; import android.os.Bundle;
import android.support.v7.widget.Toolbar;
import android.text.Editable; import android.text.Editable;
import android.text.TextWatcher; import android.text.TextWatcher;
import android.view.KeyEvent; import android.view.KeyEvent;
@ -16,6 +14,8 @@ import android.widget.EditText;
import android.widget.ListView; import android.widget.ListView;
import android.widget.TextView; import android.widget.TextView;
import androidx.databinding.DataBindingUtil;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -92,7 +92,7 @@ public abstract class AbstractSearchableListItemActivity extends XmppActivity im
public void onCreate(final Bundle savedInstanceState) { public void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
this.binding = DataBindingUtil.setContentView(this,R.layout.activity_choose_contact); this.binding = DataBindingUtil.setContentView(this,R.layout.activity_choose_contact);
setSupportActionBar((Toolbar) binding.toolbar); setSupportActionBar(binding.toolbar);
configureActionBar(getSupportActionBar()); configureActionBar(getSupportActionBar());
this.binding.chooseContactList.setFastScrollEnabled(true); this.binding.chooseContactList.setFastScrollEnabled(true);
mListItemsAdapter = new ListItemAdapter(this, listItems); mListItemsAdapter = new ListItemAdapter(this, listItems);

View File

@ -1,8 +1,11 @@
package eu.siacs.conversations.ui; package eu.siacs.conversations.ui;
import android.support.v7.app.ActionBar;
import android.support.v7.app.AppCompatActivity;
import android.view.MenuItem; import android.view.MenuItem;
import android.view.View;
import androidx.appcompat.app.ActionBar;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
public abstract class ActionBarActivity extends AppCompatActivity { public abstract class ActionBarActivity extends AppCompatActivity {
@ -17,6 +20,10 @@ public abstract class ActionBarActivity extends AppCompatActivity {
} }
} }
public void setSupportActionBar(View toolbar) {
super.setSupportActionBar((Toolbar) toolbar);
}
@Override @Override
public boolean onOptionsItemSelected(final MenuItem item) { public boolean onOptionsItemSelected(final MenuItem item) {
switch (item.getItemId()) { switch (item.getItemId()) {

View File

@ -1,17 +1,17 @@
package eu.siacs.conversations.ui; package eu.siacs.conversations.ui;
import android.databinding.DataBindingUtil;
import android.support.annotation.StringRes;
import android.support.v7.app.AlertDialog;
import android.view.View; import android.view.View;
import android.widget.Toast; import android.widget.Toast;
import androidx.annotation.StringRes;
import androidx.appcompat.app.AlertDialog;
import androidx.databinding.DataBindingUtil;
import eu.siacs.conversations.R; import eu.siacs.conversations.R;
import eu.siacs.conversations.databinding.DialogBlockContactBinding; import eu.siacs.conversations.databinding.DialogBlockContactBinding;
import eu.siacs.conversations.entities.Blockable; import eu.siacs.conversations.entities.Blockable;
import eu.siacs.conversations.entities.Conversation; import eu.siacs.conversations.entities.Conversation;
import eu.siacs.conversations.ui.util.JidDialog; import eu.siacs.conversations.ui.util.JidDialog;
import eu.siacs.conversations.xmpp.Jid;
public final class BlockContactDialog { public final class BlockContactDialog {
public static void show(final XmppActivity xmppActivity, final Blockable blockable) { public static void show(final XmppActivity xmppActivity, final Blockable blockable) {

View File

@ -1,11 +1,12 @@
package eu.siacs.conversations.ui; package eu.siacs.conversations.ui;
import android.os.Bundle; import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentTransaction;
import android.text.Editable; import android.text.Editable;
import android.widget.Toast; import android.widget.Toast;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentTransaction;
import java.util.Collections; import java.util.Collections;
import eu.siacs.conversations.R; import eu.siacs.conversations.R;
@ -14,8 +15,8 @@ import eu.siacs.conversations.entities.Blockable;
import eu.siacs.conversations.entities.ListItem; import eu.siacs.conversations.entities.ListItem;
import eu.siacs.conversations.entities.RawBlockable; import eu.siacs.conversations.entities.RawBlockable;
import eu.siacs.conversations.ui.interfaces.OnBackendConnected; import eu.siacs.conversations.ui.interfaces.OnBackendConnected;
import eu.siacs.conversations.xmpp.OnUpdateBlocklist;
import eu.siacs.conversations.xmpp.Jid; import eu.siacs.conversations.xmpp.Jid;
import eu.siacs.conversations.xmpp.OnUpdateBlocklist;
public class BlocklistActivity extends AbstractSearchableListItemActivity implements OnUpdateBlocklist { public class BlocklistActivity extends AbstractSearchableListItemActivity implements OnUpdateBlocklist {

View File

@ -2,12 +2,13 @@ package eu.siacs.conversations.ui;
import android.content.Intent; import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
import android.support.design.widget.TextInputLayout;
import android.view.View; import android.view.View;
import android.widget.Button; import android.widget.Button;
import android.widget.EditText; import android.widget.EditText;
import android.widget.Toast; import android.widget.Toast;
import com.google.android.material.textfield.TextInputLayout;
import eu.siacs.conversations.R; import eu.siacs.conversations.R;
import eu.siacs.conversations.entities.Account; import eu.siacs.conversations.entities.Account;
import eu.siacs.conversations.services.XmppConnectionService; import eu.siacs.conversations.services.XmppConnectionService;
@ -16,7 +17,7 @@ import eu.siacs.conversations.ui.widget.DisabledActionModeCallback;
public class ChangePasswordActivity extends XmppActivity implements XmppConnectionService.OnAccountPasswordChanged { public class ChangePasswordActivity extends XmppActivity implements XmppConnectionService.OnAccountPasswordChanged {
private Button mChangePasswordButton; private Button mChangePasswordButton;
private View.OnClickListener mOnChangePasswordButtonClicked = new View.OnClickListener() { private final View.OnClickListener mOnChangePasswordButtonClicked = new View.OnClickListener() {
@Override @Override
public void onClick(View view) { public void onClick(View view) {
if (mAccount != null) { if (mAccount != null) {

View File

@ -4,11 +4,9 @@ import android.app.AlertDialog;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.databinding.DataBindingUtil;
import android.net.Uri; import android.net.Uri;
import android.os.Bundle; import android.os.Bundle;
import android.preference.PreferenceManager; import android.preference.PreferenceManager;
import android.support.v7.widget.Toolbar;
import android.text.Html; import android.text.Html;
import android.text.method.LinkMovementMethod; import android.text.method.LinkMovementMethod;
import android.view.KeyEvent; import android.view.KeyEvent;
@ -20,6 +18,8 @@ import android.widget.EditText;
import android.widget.TextView; import android.widget.TextView;
import android.widget.Toast; import android.widget.Toast;
import androidx.databinding.DataBindingUtil;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.concurrent.atomic.AtomicReference; import java.util.concurrent.atomic.AtomicReference;
@ -77,7 +77,7 @@ public class ChannelDiscoveryActivity extends XmppActivity implements MenuItem.O
protected void onCreate(final Bundle savedInstanceState) { protected void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
binding = DataBindingUtil.setContentView(this, R.layout.activity_channel_discovery); binding = DataBindingUtil.setContentView(this, R.layout.activity_channel_discovery);
setSupportActionBar((Toolbar) binding.toolbar); setSupportActionBar(binding.toolbar);
configureActionBar(getSupportActionBar(), true); configureActionBar(getSupportActionBar(), true);
binding.list.setAdapter(this.adapter); binding.list.setAdapter(this.adapter);
this.adapter.setOnChannelSearchResultSelectedListener(this); this.adapter.setOnChannelSearchResultSelectedListener(this);

View File

@ -5,11 +5,6 @@ import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.StringRes;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentTransaction;
import android.support.v7.app.ActionBar;
import android.view.ActionMode; import android.view.ActionMode;
import android.view.KeyEvent; import android.view.KeyEvent;
import android.view.Menu; import android.view.Menu;
@ -21,6 +16,12 @@ import android.widget.AdapterView;
import android.widget.ListView; import android.widget.ListView;
import android.widget.TextView; import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.StringRes;
import androidx.appcompat.app.ActionBar;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentTransaction;
import com.google.common.base.Strings; import com.google.common.base.Strings;
import java.util.ArrayList; import java.util.ArrayList;
@ -50,15 +51,15 @@ public class ChooseContactActivity extends AbstractSearchableListItemActivity im
public static final String EXTRA_SHOW_ENTER_JID = "extra_show_enter_jid"; public static final String EXTRA_SHOW_ENTER_JID = "extra_show_enter_jid";
public static final String EXTRA_CONVERSATION = "extra_conversation"; public static final String EXTRA_CONVERSATION = "extra_conversation";
private static final String EXTRA_FILTERED_CONTACTS = "extra_filtered_contacts"; private static final String EXTRA_FILTERED_CONTACTS = "extra_filtered_contacts";
private List<String> mActivatedAccounts = new ArrayList<>(); private final List<String> mActivatedAccounts = new ArrayList<>();
private Set<String> selected = new HashSet<>(); private final Set<String> selected = new HashSet<>();
private Set<String> filterContacts; private Set<String> filterContacts;
private boolean showEnterJid = false; private boolean showEnterJid = false;
private boolean startSearching = false; private boolean startSearching = false;
private boolean multiple = false; private boolean multiple = false;
private PendingItem<ActivityResult> postponedActivityResult = new PendingItem<>(); private final PendingItem<ActivityResult> postponedActivityResult = new PendingItem<>();
public static Intent create(Activity activity, Conversation conversation) { public static Intent create(Activity activity, Conversation conversation) {
final Intent intent = new Intent(activity, ChooseContactActivity.class); final Intent intent = new Intent(activity, ChooseContactActivity.class);
@ -380,7 +381,7 @@ public class ChooseContactActivity extends AbstractSearchableListItemActivity im
} }
@Override @Override
public void onRequestPermissionsResult(int requestCode, @NonNull String permissions[], @NonNull int[] grantResults) { public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
ScanActivity.onRequestPermissionResult(this, requestCode, grantResults); ScanActivity.onRequestPermissionResult(this, requestCode, grantResults);
} }

View File

@ -3,10 +3,7 @@ package eu.siacs.conversations.ui;
import android.app.PendingIntent; import android.app.PendingIntent;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.databinding.DataBindingUtil;
import android.os.Bundle; import android.os.Bundle;
import android.support.v7.app.AlertDialog;
import android.support.v7.widget.Toolbar;
import android.text.Editable; import android.text.Editable;
import android.text.SpannableStringBuilder; import android.text.SpannableStringBuilder;
import android.text.TextWatcher; import android.text.TextWatcher;
@ -16,6 +13,9 @@ import android.view.View;
import android.view.View.OnClickListener; import android.view.View.OnClickListener;
import android.widget.Toast; import android.widget.Toast;
import androidx.appcompat.app.AlertDialog;
import androidx.databinding.DataBindingUtil;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
@ -48,8 +48,8 @@ import eu.siacs.conversations.utils.EmojiWrapper;
import eu.siacs.conversations.utils.StringUtils; import eu.siacs.conversations.utils.StringUtils;
import eu.siacs.conversations.utils.StylingHelper; import eu.siacs.conversations.utils.StylingHelper;
import eu.siacs.conversations.utils.XmppUri; import eu.siacs.conversations.utils.XmppUri;
import me.drakeet.support.toast.ToastCompat;
import eu.siacs.conversations.xmpp.Jid; import eu.siacs.conversations.xmpp.Jid;
import me.drakeet.support.toast.ToastCompat;
import static eu.siacs.conversations.entities.Bookmark.printableValue; import static eu.siacs.conversations.entities.Bookmark.printableValue;
import static eu.siacs.conversations.utils.StringUtils.changed; import static eu.siacs.conversations.utils.StringUtils.changed;
@ -65,7 +65,7 @@ public class ConferenceDetailsActivity extends XmppActivity implements OnConvers
private boolean mAdvancedMode = false; private boolean mAdvancedMode = false;
private UiCallback<Conversation> renameCallback = new UiCallback<Conversation>() { private final UiCallback<Conversation> renameCallback = new UiCallback<Conversation>() {
@Override @Override
public void success(Conversation object) { public void success(Conversation object) {
displayToast(getString(R.string.your_nick_has_been_changed)); displayToast(getString(R.string.your_nick_has_been_changed));
@ -86,7 +86,7 @@ public class ConferenceDetailsActivity extends XmppActivity implements OnConvers
} }
}; };
private OnClickListener mNotifyStatusClickListener = new OnClickListener() { private final OnClickListener mNotifyStatusClickListener = new OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
AlertDialog.Builder builder = new AlertDialog.Builder(ConferenceDetailsActivity.this); AlertDialog.Builder builder = new AlertDialog.Builder(ConferenceDetailsActivity.this);
@ -118,7 +118,7 @@ public class ConferenceDetailsActivity extends XmppActivity implements OnConvers
} }
}; };
private OnClickListener mChangeConferenceSettings = new OnClickListener() { private final OnClickListener mChangeConferenceSettings = new OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
final MucOptions mucOptions = mConversation.getMucOptions(); final MucOptions mucOptions = mConversation.getMucOptions();
@ -160,7 +160,7 @@ public class ConferenceDetailsActivity extends XmppActivity implements OnConvers
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
this.binding = DataBindingUtil.setContentView(this, R.layout.activity_muc_details); this.binding = DataBindingUtil.setContentView(this, R.layout.activity_muc_details);
this.binding.changeConferenceButton.setOnClickListener(this.mChangeConferenceSettings); this.binding.changeConferenceButton.setOnClickListener(this.mChangeConferenceSettings);
setSupportActionBar((Toolbar) binding.toolbar); setSupportActionBar(binding.toolbar);
configureActionBar(getSupportActionBar()); configureActionBar(getSupportActionBar());
this.binding.editNickButton.setOnClickListener(v -> quickEdit(mConversation.getMucOptions().getActualNick(), this.binding.editNickButton.setOnClickListener(v -> quickEdit(mConversation.getMucOptions().getActualNick(),
R.string.nickname, R.string.nickname,

View File

@ -6,7 +6,6 @@ import android.content.DialogInterface;
import android.content.Intent; import android.content.Intent;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.content.pm.PackageManager; import android.content.pm.PackageManager;
import android.databinding.DataBindingUtil;
import android.net.Uri; import android.net.Uri;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
@ -14,9 +13,6 @@ import android.preference.PreferenceManager;
import android.provider.ContactsContract.CommonDataKinds; import android.provider.ContactsContract.CommonDataKinds;
import android.provider.ContactsContract.Contacts; import android.provider.ContactsContract.Contacts;
import android.provider.ContactsContract.Intents; import android.provider.ContactsContract.Intents;
import android.support.annotation.NonNull;
import android.support.v7.app.AlertDialog;
import android.support.v7.widget.Toolbar;
import android.text.Spannable; import android.text.Spannable;
import android.text.SpannableString; import android.text.SpannableString;
import android.text.style.RelativeSizeSpan; import android.text.style.RelativeSizeSpan;
@ -30,6 +26,10 @@ import android.widget.CompoundButton.OnCheckedChangeListener;
import android.widget.TextView; import android.widget.TextView;
import android.widget.Toast; import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AlertDialog;
import androidx.databinding.DataBindingUtil;
import org.openintents.openpgp.util.OpenPgpUtils; import org.openintents.openpgp.util.OpenPgpUtils;
import java.util.Collection; import java.util.Collection;
@ -73,14 +73,14 @@ public class ContactDetailsActivity extends OmemoActivity implements OnAccountUp
private MediaAdapter mMediaAdapter; private MediaAdapter mMediaAdapter;
private Contact contact; private Contact contact;
private DialogInterface.OnClickListener removeFromRoster = new DialogInterface.OnClickListener() { private final DialogInterface.OnClickListener removeFromRoster = new DialogInterface.OnClickListener() {
@Override @Override
public void onClick(DialogInterface dialog, int which) { public void onClick(DialogInterface dialog, int which) {
xmppConnectionService.deleteContactOnServer(contact); xmppConnectionService.deleteContactOnServer(contact);
} }
}; };
private OnCheckedChangeListener mOnSendCheckedChange = new OnCheckedChangeListener() { private final OnCheckedChangeListener mOnSendCheckedChange = new OnCheckedChangeListener() {
@Override @Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
@ -96,7 +96,7 @@ public class ContactDetailsActivity extends OmemoActivity implements OnAccountUp
} }
} }
}; };
private OnCheckedChangeListener mOnReceiveCheckedChange = new OnCheckedChangeListener() { private final OnCheckedChangeListener mOnReceiveCheckedChange = new OnCheckedChangeListener() {
@Override @Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
@ -197,7 +197,7 @@ public class ContactDetailsActivity extends OmemoActivity implements OnAccountUp
this.messageFingerprint = getIntent().getStringExtra("fingerprint"); this.messageFingerprint = getIntent().getStringExtra("fingerprint");
this.binding = DataBindingUtil.setContentView(this, R.layout.activity_contact_details); this.binding = DataBindingUtil.setContentView(this, R.layout.activity_contact_details);
setSupportActionBar((Toolbar) binding.toolbar); setSupportActionBar(binding.toolbar);
configureActionBar(getSupportActionBar()); configureActionBar(getSupportActionBar());
binding.showInactiveDevices.setOnClickListener(v -> { binding.showInactiveDevices.setOnClickListener(v -> {
showInactiveOmemo = !showInactiveOmemo; showInactiveOmemo = !showInactiveOmemo;
@ -232,7 +232,7 @@ public class ContactDetailsActivity extends OmemoActivity implements OnAccountUp
} }
@Override @Override
public void onRequestPermissionsResult(int requestCode, @NonNull String permissions[], @NonNull int[] grantResults) { public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
if (grantResults.length > 0) if (grantResults.length > 0)
if (grantResults[0] == PackageManager.PERMISSION_GRANTED) { if (grantResults[0] == PackageManager.PERMISSION_GRANTED) {
if (requestCode == REQUEST_SYNC_CONTACTS && xmppConnectionServiceBound) { if (requestCode == REQUEST_SYNC_CONTACTS && xmppConnectionServiceBound) {
@ -371,22 +371,14 @@ public class ContactDetailsActivity extends OmemoActivity implements OnAccountUp
binding.detailsSendPresence.setText(R.string.send_presence_updates); binding.detailsSendPresence.setText(R.string.send_presence_updates);
} else { } else {
binding.detailsSendPresence.setText(R.string.preemptively_grant); binding.detailsSendPresence.setText(R.string.preemptively_grant);
if (contact.getOption(Contact.Options.PREEMPTIVE_GRANT)) { binding.detailsSendPresence.setChecked(contact.getOption(Contact.Options.PREEMPTIVE_GRANT));
binding.detailsSendPresence.setChecked(true);
} else {
binding.detailsSendPresence.setChecked(false);
}
} }
if (contact.getOption(Contact.Options.TO)) { if (contact.getOption(Contact.Options.TO)) {
binding.detailsReceivePresence.setText(R.string.receive_presence_updates); binding.detailsReceivePresence.setText(R.string.receive_presence_updates);
binding.detailsReceivePresence.setChecked(true); binding.detailsReceivePresence.setChecked(true);
} else { } else {
binding.detailsReceivePresence.setText(R.string.ask_for_presence_updates); binding.detailsReceivePresence.setText(R.string.ask_for_presence_updates);
if (contact.getOption(Contact.Options.ASKING)) { binding.detailsReceivePresence.setChecked(contact.getOption(Contact.Options.ASKING));
binding.detailsReceivePresence.setChecked(true);
} else {
binding.detailsReceivePresence.setChecked(false);
}
} }
if (contact.getAccount().isOnlineAndConnected()) { if (contact.getAccount().isOnlineAndConnected()) {
binding.detailsReceivePresence.setEnabled(true); binding.detailsReceivePresence.setEnabled(true);
@ -476,8 +468,8 @@ public class ContactDetailsActivity extends OmemoActivity implements OnAccountUp
if (Config.supportOpenPgp() && contact.getPgpKeyId() != 0) { if (Config.supportOpenPgp() && contact.getPgpKeyId() != 0) {
hasKeys = true; hasKeys = true;
View view = inflater.inflate(R.layout.contact_key, binding.detailsContactKeys, false); View view = inflater.inflate(R.layout.contact_key, binding.detailsContactKeys, false);
TextView key = (TextView) view.findViewById(R.id.key); TextView key = view.findViewById(R.id.key);
TextView keyType = (TextView) view.findViewById(R.id.key_type); TextView keyType = view.findViewById(R.id.key_type);
keyType.setText(R.string.openpgp_key_id); keyType.setText(R.string.openpgp_key_id);
if ("pgp".equals(messageFingerprint)) { if ("pgp".equals(messageFingerprint)) {
keyType.setTextAppearance(this, R.style.TextAppearance_Conversations_Caption_Highlight); keyType.setTextAppearance(this, R.style.TextAppearance_Conversations_Caption_Highlight);

View File

@ -2,8 +2,9 @@ package eu.siacs.conversations.ui;
import android.content.Intent; import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity; import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
public class ConversationActivity extends AppCompatActivity { public class ConversationActivity extends AppCompatActivity {

View File

@ -3,36 +3,28 @@ package eu.siacs.conversations.ui;
import android.Manifest; import android.Manifest;
import android.annotation.SuppressLint; import android.annotation.SuppressLint;
import android.app.Activity; import android.app.Activity;
import android.app.FragmentManager;
import android.content.SharedPreferences;
import android.content.pm.PackageManager;
import android.databinding.DataBindingUtil;
import android.net.Uri;
import android.os.Build;
import android.preference.PreferenceManager;
import android.provider.MediaStore;
import android.support.annotation.IdRes;
import android.support.annotation.NonNull;
import android.support.annotation.StringRes;
import android.support.v7.app.AlertDialog;
import android.app.Fragment; import android.app.Fragment;
import android.app.FragmentManager;
import android.app.PendingIntent; import android.app.PendingIntent;
import android.content.Context; import android.content.Context;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.content.Intent; import android.content.Intent;
import android.content.IntentSender.SendIntentException; import android.content.IntentSender.SendIntentException;
import android.content.SharedPreferences;
import android.content.pm.PackageManager;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler; import android.os.Handler;
import android.os.SystemClock; import android.os.SystemClock;
import android.support.v13.view.inputmethod.InputConnectionCompat; import android.preference.PreferenceManager;
import android.support.v13.view.inputmethod.InputContentInfoCompat; import android.provider.MediaStore;
import android.text.Editable; import android.text.Editable;
import android.text.TextUtils; import android.text.TextUtils;
import android.util.Log; import android.util.Log;
import android.view.ContextMenu; import android.view.ContextMenu;
import android.view.ContextMenu.ContextMenuInfo; import android.view.ContextMenu.ContextMenuInfo;
import android.view.Gravity; import android.view.Gravity;
import android.view.KeyEvent;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.Menu; import android.view.Menu;
import android.view.MenuInflater; import android.view.MenuInflater;
@ -53,6 +45,14 @@ import android.widget.PopupMenu;
import android.widget.TextView.OnEditorActionListener; import android.widget.TextView.OnEditorActionListener;
import android.widget.Toast; import android.widget.Toast;
import androidx.annotation.IdRes;
import androidx.annotation.NonNull;
import androidx.annotation.StringRes;
import androidx.appcompat.app.AlertDialog;
import androidx.core.view.inputmethod.InputConnectionCompat;
import androidx.core.view.inputmethod.InputContentInfoCompat;
import androidx.databinding.DataBindingUtil;
import com.google.common.base.Optional; import com.google.common.base.Optional;
import java.util.ArrayList; import java.util.ArrayList;
@ -118,6 +118,7 @@ import eu.siacs.conversations.utils.StylingHelper;
import eu.siacs.conversations.utils.TimeFrameUtils; import eu.siacs.conversations.utils.TimeFrameUtils;
import eu.siacs.conversations.utils.UIHelper; import eu.siacs.conversations.utils.UIHelper;
import eu.siacs.conversations.xml.Namespace; import eu.siacs.conversations.xml.Namespace;
import eu.siacs.conversations.xmpp.Jid;
import eu.siacs.conversations.xmpp.XmppConnection; import eu.siacs.conversations.xmpp.XmppConnection;
import eu.siacs.conversations.xmpp.chatstate.ChatState; import eu.siacs.conversations.xmpp.chatstate.ChatState;
import eu.siacs.conversations.xmpp.jingle.AbstractJingleConnection; import eu.siacs.conversations.xmpp.jingle.AbstractJingleConnection;
@ -126,7 +127,6 @@ import eu.siacs.conversations.xmpp.jingle.JingleFileTransferConnection;
import eu.siacs.conversations.xmpp.jingle.Media; import eu.siacs.conversations.xmpp.jingle.Media;
import eu.siacs.conversations.xmpp.jingle.OngoingRtpSession; import eu.siacs.conversations.xmpp.jingle.OngoingRtpSession;
import eu.siacs.conversations.xmpp.jingle.RtpCapability; import eu.siacs.conversations.xmpp.jingle.RtpCapability;
import eu.siacs.conversations.xmpp.Jid;
import static eu.siacs.conversations.ui.XmppActivity.EXTRA_ACCOUNT; import static eu.siacs.conversations.ui.XmppActivity.EXTRA_ACCOUNT;
import static eu.siacs.conversations.ui.XmppActivity.REQUEST_INVITE_TO_CONVERSATION; import static eu.siacs.conversations.ui.XmppActivity.REQUEST_INVITE_TO_CONVERSATION;
@ -849,7 +849,7 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke
case ATTACHMENT_CHOICE_LOCATION: case ATTACHMENT_CHOICE_LOCATION:
double latitude = data.getDoubleExtra("latitude", 0); double latitude = data.getDoubleExtra("latitude", 0);
double longitude = data.getDoubleExtra("longitude", 0); double longitude = data.getDoubleExtra("longitude", 0);
Uri geo = Uri.parse("geo:" + String.valueOf(latitude) + "," + String.valueOf(longitude)); Uri geo = Uri.parse("geo:" + latitude + "," + longitude);
mediaPreviewAdapter.addMediaPreviews(Attachment.of(getActivity(), geo, Attachment.Type.LOCATION)); mediaPreviewAdapter.addMediaPreviews(Attachment.of(getActivity(), geo, Attachment.Type.LOCATION));
toggleInputMethod(); toggleInputMethod();
break; break;
@ -1121,8 +1121,9 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke
MenuItem cancelTransmission = menu.findItem(R.id.cancel_transmission); MenuItem cancelTransmission = menu.findItem(R.id.cancel_transmission);
MenuItem deleteFile = menu.findItem(R.id.delete_file); MenuItem deleteFile = menu.findItem(R.id.delete_file);
MenuItem showErrorMessage = menu.findItem(R.id.show_error_message); MenuItem showErrorMessage = menu.findItem(R.id.show_error_message);
final boolean unInitiatedButKnownSize = MessageUtils.unInitiatedButKnownSize(m);
final boolean showError = m.getStatus() == Message.STATUS_SEND_FAILED && m.getErrorMessage() != null && !Message.ERROR_MESSAGE_CANCELLED.equals(m.getErrorMessage()); final boolean showError = m.getStatus() == Message.STATUS_SEND_FAILED && m.getErrorMessage() != null && !Message.ERROR_MESSAGE_CANCELLED.equals(m.getErrorMessage());
if (!m.isFileOrImage() && !encrypted && !m.isGeoUri() && !m.treatAsDownloadable()) { if (!m.isFileOrImage() && !encrypted && !m.isGeoUri() && !m.treatAsDownloadable() && !unInitiatedButKnownSize && t == null) {
copyMessage.setVisible(true); copyMessage.setVisible(true);
quoteMessage.setVisible(!showError && MessageUtils.prepareQuote(m).length() > 0); quoteMessage.setVisible(!showError && MessageUtils.prepareQuote(m).length() > 0);
String body = m.getMergedBody().toString(); String body = m.getMergedBody().toString();
@ -1143,7 +1144,7 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke
&& m.getConversation() instanceof Conversation) { && m.getConversation() instanceof Conversation) {
correctMessage.setVisible(true); correctMessage.setVisible(true);
} }
if ((m.isFileOrImage() && !deleted && !receiving) || (m.getType() == Message.TYPE_TEXT && !m.treatAsDownloadable())) { if ((m.isFileOrImage() && !deleted && !receiving) || (m.getType() == Message.TYPE_TEXT && !m.treatAsDownloadable()) && !unInitiatedButKnownSize && t == null) {
shareWith.setVisible(true); shareWith.setVisible(true);
} }
if (m.getStatus() == Message.STATUS_SEND_FAILED) { if (m.getStatus() == Message.STATUS_SEND_FAILED) {
@ -1152,6 +1153,7 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke
if (m.hasFileOnRemoteHost() if (m.hasFileOnRemoteHost()
|| m.isGeoUri() || m.isGeoUri()
|| m.treatAsDownloadable() || m.treatAsDownloadable()
|| unInitiatedButKnownSize
|| t instanceof HttpDownloadConnection) { || t instanceof HttpDownloadConnection) {
copyUrl.setVisible(true); copyUrl.setVisible(true);
} }
@ -2098,7 +2100,7 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke
} }
stopScrolling(); stopScrolling();
Log.d(Config.LOGTAG, "reInit(hasExtras=" + Boolean.toString(hasExtras) + ")"); Log.d(Config.LOGTAG, "reInit(hasExtras=" + hasExtras + ")");
if (this.conversation.isRead() && hasExtras) { if (this.conversation.isRead() && hasExtras) {
Log.d(Config.LOGTAG, "trimming conversation"); Log.d(Config.LOGTAG, "trimming conversation");
@ -2120,7 +2122,7 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke
refresh(false); refresh(false);
activity.invalidateOptionsMenu(); activity.invalidateOptionsMenu();
this.conversation.messagesLoaded.set(true); this.conversation.messagesLoaded.set(true);
Log.d(Config.LOGTAG, "scrolledToBottomAndNoPending=" + Boolean.toString(scrolledToBottomAndNoPending)); Log.d(Config.LOGTAG, "scrolledToBottomAndNoPending=" + scrolledToBottomAndNoPending);
if (hasExtras || scrolledToBottomAndNoPending) { if (hasExtras || scrolledToBottomAndNoPending) {
resetUnreadMessagesCount(); resetUnreadMessagesCount();

View File

@ -39,21 +39,21 @@ import android.content.ActivityNotFoundException;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.pm.PackageManager; import android.content.pm.PackageManager;
import android.databinding.DataBindingUtil;
import android.net.Uri; import android.net.Uri;
import android.os.Bundle; import android.os.Bundle;
import android.provider.Settings; import android.provider.Settings;
import android.support.annotation.IdRes;
import android.support.annotation.NonNull;
import android.support.v7.app.ActionBar;
import android.support.v7.app.AlertDialog;
import android.support.v7.widget.Toolbar;
import android.util.Log; import android.util.Log;
import android.view.KeyEvent; import android.view.KeyEvent;
import android.view.Menu; import android.view.Menu;
import android.view.MenuItem; import android.view.MenuItem;
import android.widget.Toast; import android.widget.Toast;
import androidx.annotation.IdRes;
import androidx.annotation.NonNull;
import androidx.appcompat.app.ActionBar;
import androidx.appcompat.app.AlertDialog;
import androidx.databinding.DataBindingUtil;
import org.openintents.openpgp.util.OpenPgpApi; import org.openintents.openpgp.util.OpenPgpApi;
import java.util.Arrays; import java.util.Arrays;
@ -76,13 +76,12 @@ import eu.siacs.conversations.ui.util.ActivityResult;
import eu.siacs.conversations.ui.util.ConversationMenuConfigurator; import eu.siacs.conversations.ui.util.ConversationMenuConfigurator;
import eu.siacs.conversations.ui.util.MenuDoubleTabUtil; import eu.siacs.conversations.ui.util.MenuDoubleTabUtil;
import eu.siacs.conversations.ui.util.PendingItem; import eu.siacs.conversations.ui.util.PendingItem;
import eu.siacs.conversations.utils.AccountUtils;
import eu.siacs.conversations.utils.EmojiWrapper; import eu.siacs.conversations.utils.EmojiWrapper;
import eu.siacs.conversations.utils.ExceptionHelper; import eu.siacs.conversations.utils.ExceptionHelper;
import eu.siacs.conversations.utils.SignupUtils; import eu.siacs.conversations.utils.SignupUtils;
import eu.siacs.conversations.utils.XmppUri; import eu.siacs.conversations.utils.XmppUri;
import eu.siacs.conversations.xmpp.OnUpdateBlocklist;
import eu.siacs.conversations.xmpp.Jid; import eu.siacs.conversations.xmpp.Jid;
import eu.siacs.conversations.xmpp.OnUpdateBlocklist;
import static eu.siacs.conversations.ui.ConversationFragment.REQUEST_DECRYPT_PGP; import static eu.siacs.conversations.ui.ConversationFragment.REQUEST_DECRYPT_PGP;
@ -98,7 +97,7 @@ public class ConversationsActivity extends XmppActivity implements OnConversatio
public static final String EXTRA_POST_INIT_ACTION = "post_init_action"; public static final String EXTRA_POST_INIT_ACTION = "post_init_action";
public static final String POST_ACTION_RECORD_VOICE = "record_voice"; public static final String POST_ACTION_RECORD_VOICE = "record_voice";
private static List<String> VIEW_AND_SHARE_ACTIONS = Arrays.asList( private static final List<String> VIEW_AND_SHARE_ACTIONS = Arrays.asList(
ACTION_VIEW_CONVERSATION, ACTION_VIEW_CONVERSATION,
Intent.ACTION_SEND, Intent.ACTION_SEND,
Intent.ACTION_SEND_MULTIPLE Intent.ACTION_SEND_MULTIPLE
@ -115,7 +114,7 @@ public class ConversationsActivity extends XmppActivity implements OnConversatio
private final PendingItem<ActivityResult> postponedActivityResult = new PendingItem<>(); private final PendingItem<ActivityResult> postponedActivityResult = new PendingItem<>();
private ActivityConversationsBinding binding; private ActivityConversationsBinding binding;
private boolean mActivityPaused = true; private boolean mActivityPaused = true;
private AtomicBoolean mRedirectInProcess = new AtomicBoolean(false); private final AtomicBoolean mRedirectInProcess = new AtomicBoolean(false);
private static boolean isViewOrShareIntent(Intent i) { private static boolean isViewOrShareIntent(Intent i) {
Log.d(Config.LOGTAG, "action: " + (i == null ? null : i.getAction())); Log.d(Config.LOGTAG, "action: " + (i == null ? null : i.getAction()));
@ -360,7 +359,7 @@ public class ConversationsActivity extends XmppActivity implements OnConversatio
ConversationMenuConfigurator.reloadFeatures(this); ConversationMenuConfigurator.reloadFeatures(this);
OmemoSetting.load(this); OmemoSetting.load(this);
this.binding = DataBindingUtil.setContentView(this, R.layout.activity_conversations); this.binding = DataBindingUtil.setContentView(this, R.layout.activity_conversations);
setSupportActionBar((Toolbar) binding.toolbar); setSupportActionBar(binding.toolbar);
configureActionBar(getSupportActionBar()); configureActionBar(getSupportActionBar());
this.getFragmentManager().addOnBackStackChangedListener(this::invalidateActionBarTitle); this.getFragmentManager().addOnBackStackChangedListener(this::invalidateActionBarTitle);
this.getFragmentManager().addOnBackStackChangedListener(this::showDialogsIfMainIsOverview); this.getFragmentManager().addOnBackStackChangedListener(this::showDialogsIfMainIsOverview);
@ -538,6 +537,7 @@ public class ConversationsActivity extends XmppActivity implements OnConversatio
@Override @Override
protected void onNewIntent(final Intent intent) { protected void onNewIntent(final Intent intent) {
super.onNewIntent(intent);
if (isViewOrShareIntent(intent)) { if (isViewOrShareIntent(intent)) {
if (xmppConnectionService != null) { if (xmppConnectionService != null) {
clearPendingViewIntent(); clearPendingViewIntent();
@ -661,7 +661,7 @@ public class ConversationsActivity extends XmppActivity implements OnConversatio
if (!mActivityPaused && pendingViewIntent.peek() == null) { if (!mActivityPaused && pendingViewIntent.peek() == null) {
xmppConnectionService.sendReadMarker(conversation, upToUuid); xmppConnectionService.sendReadMarker(conversation, upToUuid);
} else { } else {
Log.d(Config.LOGTAG, "ignoring read callback. mActivityPaused=" + Boolean.toString(mActivityPaused)); Log.d(Config.LOGTAG, "ignoring read callback. mActivityPaused=" + mActivityPaused);
} }
} }

View File

@ -33,14 +33,9 @@ import android.app.Activity;
import android.app.AlertDialog; import android.app.AlertDialog;
import android.app.Fragment; import android.app.Fragment;
import android.content.Intent; import android.content.Intent;
import android.databinding.DataBindingUtil;
import android.graphics.Canvas; import android.graphics.Canvas;
import android.graphics.Paint; import android.graphics.Paint;
import android.os.Bundle; import android.os.Bundle;
import android.support.design.widget.Snackbar;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.helper.ItemTouchHelper;
import android.util.Log; import android.util.Log;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.Menu; import android.view.Menu;
@ -50,6 +45,12 @@ import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.Toast; import android.widget.Toast;
import androidx.databinding.DataBindingUtil;
import androidx.recyclerview.widget.ItemTouchHelper;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.google.android.material.snackbar.Snackbar;
import com.google.common.collect.Collections2; import com.google.common.collect.Collections2;
import java.util.ArrayList; import java.util.ArrayList;
@ -74,8 +75,8 @@ import eu.siacs.conversations.utils.AccountUtils;
import eu.siacs.conversations.utils.EasyOnboardingInvite; import eu.siacs.conversations.utils.EasyOnboardingInvite;
import eu.siacs.conversations.utils.ThemeHelper; import eu.siacs.conversations.utils.ThemeHelper;
import static android.support.v7.widget.helper.ItemTouchHelper.LEFT; import static androidx.recyclerview.widget.ItemTouchHelper.LEFT;
import static android.support.v7.widget.helper.ItemTouchHelper.RIGHT; import static androidx.recyclerview.widget.ItemTouchHelper.RIGHT;
public class ConversationsOverviewFragment extends XmppFragment { public class ConversationsOverviewFragment extends XmppFragment {
@ -88,9 +89,9 @@ public class ConversationsOverviewFragment extends XmppFragment {
private ConversationAdapter conversationsAdapter; private ConversationAdapter conversationsAdapter;
private XmppActivity activity; private XmppActivity activity;
private float mSwipeEscapeVelocity = 0f; private float mSwipeEscapeVelocity = 0f;
private PendingActionHelper pendingActionHelper = new PendingActionHelper(); private final PendingActionHelper pendingActionHelper = new PendingActionHelper();
private ItemTouchHelper.SimpleCallback callback = new ItemTouchHelper.SimpleCallback(0,LEFT|RIGHT) { private final ItemTouchHelper.SimpleCallback callback = new ItemTouchHelper.SimpleCallback(0,LEFT|RIGHT) {
@Override @Override
public boolean onMove(RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder, RecyclerView.ViewHolder target) { public boolean onMove(RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder, RecyclerView.ViewHolder target) {
//todo maybe we can manually changing the position of the conversation //todo maybe we can manually changing the position of the conversation

View File

@ -2,13 +2,14 @@ package eu.siacs.conversations.ui;
import android.app.Dialog; import android.app.Dialog;
import android.content.Context; import android.content.Context;
import android.databinding.DataBindingUtil;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v4.app.DialogFragment;
import android.support.v7.app.AlertDialog;
import android.widget.Spinner; import android.widget.Spinner;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AlertDialog;
import androidx.databinding.DataBindingUtil;
import androidx.fragment.app.DialogFragment;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;

View File

@ -4,11 +4,7 @@ import android.app.Activity;
import android.app.Dialog; import android.app.Dialog;
import android.content.Context; import android.content.Context;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.databinding.DataBindingUtil;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v4.app.DialogFragment;
import android.support.v7.app.AlertDialog;
import android.text.Editable; import android.text.Editable;
import android.text.TextUtils; import android.text.TextUtils;
import android.text.TextWatcher; import android.text.TextWatcher;
@ -16,6 +12,11 @@ import android.view.View;
import android.widget.AdapterView; import android.widget.AdapterView;
import android.widget.Button; import android.widget.Button;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AlertDialog;
import androidx.databinding.DataBindingUtil;
import androidx.fragment.app.DialogFragment;
import java.security.SecureRandom; import java.security.SecureRandom;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
@ -29,8 +30,8 @@ import eu.siacs.conversations.ui.adapter.KnownHostsAdapter;
import eu.siacs.conversations.ui.interfaces.OnBackendConnected; import eu.siacs.conversations.ui.interfaces.OnBackendConnected;
import eu.siacs.conversations.ui.util.DelayedHintHelper; import eu.siacs.conversations.ui.util.DelayedHintHelper;
import eu.siacs.conversations.utils.CryptoHelper; import eu.siacs.conversations.utils.CryptoHelper;
import eu.siacs.conversations.xmpp.XmppConnection;
import eu.siacs.conversations.xmpp.Jid; import eu.siacs.conversations.xmpp.Jid;
import eu.siacs.conversations.xmpp.XmppConnection;
public class CreatePublicChannelDialog extends DialogFragment implements OnBackendConnected { public class CreatePublicChannelDialog extends DialogFragment implements OnBackendConnected {

View File

@ -6,7 +6,6 @@ import android.content.ActivityNotFoundException;
import android.content.Intent; import android.content.Intent;
import android.content.IntentSender; import android.content.IntentSender;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.databinding.DataBindingUtil;
import android.graphics.Bitmap; import android.graphics.Bitmap;
import android.net.Uri; import android.net.Uri;
import android.os.Build; import android.os.Build;
@ -16,11 +15,6 @@ import android.preference.PreferenceManager;
import android.provider.Settings; import android.provider.Settings;
import android.security.KeyChain; import android.security.KeyChain;
import android.security.KeyChainAliasCallback; import android.security.KeyChainAliasCallback;
import android.support.design.widget.TextInputLayout;
import android.support.v7.app.ActionBar;
import android.support.v7.app.AlertDialog;
import android.support.v7.app.AlertDialog.Builder;
import android.support.v7.widget.Toolbar;
import android.text.Editable; import android.text.Editable;
import android.text.TextUtils; import android.text.TextUtils;
import android.text.TextWatcher; import android.text.TextWatcher;
@ -34,6 +28,12 @@ import android.widget.EditText;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.Toast; import android.widget.Toast;
import androidx.appcompat.app.ActionBar;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AlertDialog.Builder;
import androidx.databinding.DataBindingUtil;
import com.google.android.material.textfield.TextInputLayout;
import com.google.common.base.CharMatcher; import com.google.common.base.CharMatcher;
import org.openintents.openpgp.util.OpenPgpUtils; import org.openintents.openpgp.util.OpenPgpUtils;
@ -42,7 +42,6 @@ import java.net.URL;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
import eu.siacs.conversations.Config; import eu.siacs.conversations.Config;
@ -65,7 +64,6 @@ import eu.siacs.conversations.ui.util.AvatarWorkerTask;
import eu.siacs.conversations.ui.util.MenuDoubleTabUtil; import eu.siacs.conversations.ui.util.MenuDoubleTabUtil;
import eu.siacs.conversations.ui.util.PendingItem; import eu.siacs.conversations.ui.util.PendingItem;
import eu.siacs.conversations.ui.util.SoftKeyboardUtils; import eu.siacs.conversations.ui.util.SoftKeyboardUtils;
import eu.siacs.conversations.utils.CharSequenceUtils;
import eu.siacs.conversations.utils.CryptoHelper; import eu.siacs.conversations.utils.CryptoHelper;
import eu.siacs.conversations.utils.Resolver; import eu.siacs.conversations.utils.Resolver;
import eu.siacs.conversations.utils.SignupUtils; import eu.siacs.conversations.utils.SignupUtils;
@ -319,7 +317,7 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
} }
}; };
private View.OnFocusChangeListener mEditTextFocusListener = new View.OnFocusChangeListener() { private final View.OnFocusChangeListener mEditTextFocusListener = new View.OnFocusChangeListener() {
@Override @Override
public void onFocusChange(View view, boolean b) { public void onFocusChange(View view, boolean b) {
EditText et = (EditText) view; EditText et = (EditText) view;
@ -599,7 +597,7 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
this.mSavedInstanceInit = savedInstanceState.getBoolean("initMode", false); this.mSavedInstanceInit = savedInstanceState.getBoolean("initMode", false);
} }
this.binding = DataBindingUtil.setContentView(this, R.layout.activity_edit_account); this.binding = DataBindingUtil.setContentView(this, R.layout.activity_edit_account);
setSupportActionBar((Toolbar) binding.toolbar); setSupportActionBar(binding.toolbar);
binding.accountJid.addTextChangedListener(this.mTextWatcher); binding.accountJid.addTextChangedListener(this.mTextWatcher);
binding.accountJid.setOnFocusChangeListener(this.mEditTextFocusListener); binding.accountJid.setOnFocusChangeListener(this.mEditTextFocusListener);
this.binding.accountPassword.addTextChangedListener(this.mTextWatcher); this.binding.accountPassword.addTextChangedListener(this.mTextWatcher);

View File

@ -2,16 +2,17 @@ package eu.siacs.conversations.ui;
import android.app.Activity; import android.app.Activity;
import android.app.Dialog; import android.app.Dialog;
import android.databinding.DataBindingUtil;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v4.app.DialogFragment;
import android.support.v7.app.AlertDialog;
import android.text.Editable; import android.text.Editable;
import android.text.TextWatcher; import android.text.TextWatcher;
import android.view.View; import android.view.View;
import android.widget.ArrayAdapter; import android.widget.ArrayAdapter;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AlertDialog;
import androidx.databinding.DataBindingUtil;
import androidx.fragment.app.DialogFragment;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collection; import java.util.Collection;

View File

@ -2,18 +2,18 @@ package eu.siacs.conversations.ui;
import android.app.Activity; import android.app.Activity;
import android.app.Dialog; import android.app.Dialog;
import android.databinding.DataBindingUtil;
import android.support.annotation.NonNull;
import android.support.design.widget.TextInputLayout;
import android.support.v4.app.DialogFragment;
import android.content.Context; import android.content.Context;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.os.Bundle; import android.os.Bundle;
import android.support.v7.app.AlertDialog;
import android.view.KeyEvent;
import android.widget.AutoCompleteTextView; import android.widget.AutoCompleteTextView;
import android.widget.Spinner; import android.widget.Spinner;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AlertDialog;
import androidx.databinding.DataBindingUtil;
import androidx.fragment.app.DialogFragment;
import com.google.android.material.textfield.TextInputLayout;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;

View File

@ -14,11 +14,12 @@ import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.preference.PreferenceManager; import android.preference.PreferenceManager;
import android.provider.Settings; import android.provider.Settings;
import android.support.annotation.BoolRes;
import android.support.annotation.NonNull;
import android.util.Log; import android.util.Log;
import android.view.MenuItem; import android.view.MenuItem;
import androidx.annotation.BoolRes;
import androidx.annotation.NonNull;
import org.osmdroid.api.IGeoPoint; import org.osmdroid.api.IGeoPoint;
import org.osmdroid.api.IMapController; import org.osmdroid.api.IMapController;
import org.osmdroid.config.Configuration; import org.osmdroid.config.Configuration;

View File

@ -2,18 +2,17 @@ package eu.siacs.conversations.ui;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.databinding.DataBindingUtil;
import android.os.Bundle; import android.os.Bundle;
import android.support.v7.widget.Toolbar;
import androidx.databinding.DataBindingUtil;
import java.util.List; import java.util.List;
import eu.siacs.conversations.R; import eu.siacs.conversations.R;
import eu.siacs.conversations.databinding.ActivityMediaBrowserBinding;
import eu.siacs.conversations.entities.Account; import eu.siacs.conversations.entities.Account;
import eu.siacs.conversations.entities.Contact; import eu.siacs.conversations.entities.Contact;
import eu.siacs.conversations.entities.Conversation; import eu.siacs.conversations.entities.Conversation;
import eu.siacs.conversations.databinding.ActivityMediaBrowserBinding;
import eu.siacs.conversations.ui.adapter.MediaAdapter; import eu.siacs.conversations.ui.adapter.MediaAdapter;
import eu.siacs.conversations.ui.interfaces.OnMediaLoaded; import eu.siacs.conversations.ui.interfaces.OnMediaLoaded;
import eu.siacs.conversations.ui.util.Attachment; import eu.siacs.conversations.ui.util.Attachment;
@ -30,7 +29,7 @@ public class MediaBrowserActivity extends XmppActivity implements OnMediaLoaded
protected void onCreate(final Bundle savedInstanceState) { protected void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
this.binding = DataBindingUtil.setContentView(this,R.layout.activity_media_browser); this.binding = DataBindingUtil.setContentView(this,R.layout.activity_media_browser);
setSupportActionBar((Toolbar) binding.toolbar); setSupportActionBar(binding.toolbar);
configureActionBar(getSupportActionBar()); configureActionBar(getSupportActionBar());
mMediaAdapter = new MediaAdapter(this, R.dimen.media_size); mMediaAdapter = new MediaAdapter(this, R.dimen.media_size);
this.binding.media.setAdapter(mMediaAdapter); this.binding.media.setAdapter(mMediaAdapter);

View File

@ -28,11 +28,10 @@ import android.content.DialogInterface;
import android.content.DialogInterface.OnCancelListener; import android.content.DialogInterface.OnCancelListener;
import android.content.DialogInterface.OnClickListener; import android.content.DialogInterface.OnClickListener;
import android.content.Intent; import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle; import android.os.Bundle;
import android.preference.PreferenceManager;
import android.support.v7.app.AlertDialog; import androidx.appcompat.app.AlertDialog;
import android.support.v7.app.AppCompatActivity; import androidx.appcompat.app.AppCompatActivity;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;

View File

@ -2,9 +2,7 @@ package eu.siacs.conversations.ui;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.databinding.DataBindingUtil;
import android.os.Bundle; import android.os.Bundle;
import android.support.v7.widget.Toolbar;
import android.text.Editable; import android.text.Editable;
import android.text.TextUtils; import android.text.TextUtils;
import android.text.TextWatcher; import android.text.TextWatcher;
@ -15,6 +13,8 @@ import android.view.inputmethod.InputMethodManager;
import android.widget.EditText; import android.widget.EditText;
import android.widget.Toast; import android.widget.Toast;
import androidx.databinding.DataBindingUtil;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.Locale; import java.util.Locale;
@ -90,7 +90,7 @@ public class MucUsersActivity extends XmppActivity implements XmppConnectionServ
protected void onCreate(final Bundle savedInstanceState) { protected void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
ActivityMucUsersBinding binding = DataBindingUtil.setContentView(this, R.layout.activity_muc_users); ActivityMucUsersBinding binding = DataBindingUtil.setContentView(this, R.layout.activity_muc_users);
setSupportActionBar((Toolbar) binding.toolbar); setSupportActionBar(binding.toolbar);
configureActionBar(getSupportActionBar(), true); configureActionBar(getSupportActionBar(), true);
this.userAdapter = new UserAdapter(getPreferences().getBoolean("advanced_muc_mode", false)); this.userAdapter = new UserAdapter(getPreferences().getBoolean("advanced_muc_mode", false));
binding.list.setAdapter(this.userAdapter); binding.list.setAdapter(this.userAdapter);

View File

@ -1,22 +1,15 @@
package eu.siacs.conversations.ui; package eu.siacs.conversations.ui;
import android.databinding.DataBindingUtil;
import android.net.Uri;
import android.support.v7.app.AlertDialog;
import android.content.Intent; import android.content.Intent;
import android.os.Bundle;
import android.support.v4.content.ContextCompat;
import android.view.ContextMenu; import android.view.ContextMenu;
import android.view.MenuItem; import android.view.MenuItem;
import android.view.View; import android.view.View;
import android.widget.CompoundButton; import android.widget.CompoundButton;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast; import android.widget.Toast;
import java.security.cert.X509Certificate; import androidx.appcompat.app.AlertDialog;
import java.util.Arrays; import androidx.databinding.DataBindingUtil;
import eu.siacs.conversations.Config; import eu.siacs.conversations.Config;
import eu.siacs.conversations.R; import eu.siacs.conversations.R;
@ -211,7 +204,7 @@ public abstract class OmemoActivity extends XmppActivity {
} }
@Override @Override
public void onRequestPermissionsResult(int requestCode, String permissions[], int[] grantResults) { public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
ScanActivity.onRequestPermissionResult(this, requestCode, grantResults); ScanActivity.onRequestPermissionResult(this, requestCode, grantResults);
} }
} }

View File

@ -30,16 +30,16 @@
package eu.siacs.conversations.ui; package eu.siacs.conversations.ui;
import android.content.Intent; import android.content.Intent;
import android.databinding.DataBindingUtil;
import android.graphics.Bitmap; import android.graphics.Bitmap;
import android.net.Uri; import android.net.Uri;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.StringRes;
import android.support.v7.widget.Toolbar;
import android.util.Log; import android.util.Log;
import android.view.View; import android.view.View;
import android.widget.Toast; import android.widget.Toast;
import androidx.annotation.StringRes;
import androidx.databinding.DataBindingUtil;
import com.theartofdev.edmodo.cropper.CropImage; import com.theartofdev.edmodo.cropper.CropImage;
import eu.siacs.conversations.Config; import eu.siacs.conversations.Config;
@ -91,7 +91,7 @@ public class PublishGroupChatProfilePictureActivity extends XmppActivity impleme
public void onCreate(Bundle savedInstanceState) { public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
this.binding = DataBindingUtil.setContentView(this, R.layout.activity_publish_profile_picture); this.binding = DataBindingUtil.setContentView(this, R.layout.activity_publish_profile_picture);
setSupportActionBar((Toolbar) this.binding.toolbar); setSupportActionBar(this.binding.toolbar);
configureActionBar(getSupportActionBar()); configureActionBar(getSupportActionBar());
this.binding.cancelButton.setOnClickListener((v) -> this.finish()); this.binding.cancelButton.setOnClickListener((v) -> this.finish());
this.binding.secondaryHint.setVisibility(View.GONE); this.binding.secondaryHint.setVisibility(View.GONE);

View File

@ -6,7 +6,6 @@ import android.graphics.Bitmap;
import android.net.Uri; import android.net.Uri;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.StringRes;
import android.util.Log; import android.util.Log;
import android.view.View; import android.view.View;
import android.view.View.OnLongClickListener; import android.view.View.OnLongClickListener;
@ -15,6 +14,8 @@ import android.widget.ImageView;
import android.widget.TextView; import android.widget.TextView;
import android.widget.Toast; import android.widget.Toast;
import androidx.annotation.StringRes;
import com.theartofdev.edmodo.cropper.CropImage; import com.theartofdev.edmodo.cropper.CropImage;
import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicBoolean;
@ -40,8 +41,8 @@ public class PublishProfilePictureActivity extends XmppActivity implements XmppC
private Account account; private Account account;
private boolean support = false; private boolean support = false;
private boolean publishing = false; private boolean publishing = false;
private AtomicBoolean handledExternalUri = new AtomicBoolean(false); private final AtomicBoolean handledExternalUri = new AtomicBoolean(false);
private OnLongClickListener backToDefaultListener = new OnLongClickListener() { private final OnLongClickListener backToDefaultListener = new OnLongClickListener() {
@Override @Override
public boolean onLongClick(View v) { public boolean onLongClick(View v) {

View File

@ -1,10 +1,8 @@
package eu.siacs.conversations.ui; package eu.siacs.conversations.ui;
import android.annotation.SuppressLint;
import android.app.Activity; import android.app.Activity;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.databinding.DataBindingUtil;
import android.media.MediaRecorder; import android.media.MediaRecorder;
import android.net.Uri; import android.net.Uri;
import android.os.Bundle; import android.os.Bundle;
@ -16,6 +14,8 @@ import android.view.View;
import android.view.WindowManager; import android.view.WindowManager;
import android.widget.Toast; import android.widget.Toast;
import androidx.databinding.DataBindingUtil;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
@ -40,10 +40,10 @@ public class RecordingActivity extends Activity implements View.OnClickListener
private MediaRecorder mRecorder; private MediaRecorder mRecorder;
private long mStartTime = 0; private long mStartTime = 0;
private CountDownLatch outputFileWrittenLatch = new CountDownLatch(1); private final CountDownLatch outputFileWrittenLatch = new CountDownLatch(1);
private Handler mHandler = new Handler(); private final Handler mHandler = new Handler();
private Runnable mTickExecutor = new Runnable() { private final Runnable mTickExecutor = new Runnable() {
@Override @Override
public void run() { public void run() {
tick(); tick();

View File

@ -7,15 +7,11 @@ import android.content.ActivityNotFoundException;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.pm.PackageManager; import android.content.pm.PackageManager;
import android.databinding.DataBindingUtil;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler; import android.os.Handler;
import android.os.PowerManager; import android.os.PowerManager;
import android.os.SystemClock; import android.os.SystemClock;
import android.support.annotation.NonNull;
import android.support.annotation.RequiresApi;
import android.support.annotation.StringRes;
import android.util.Log; import android.util.Log;
import android.util.Rational; import android.util.Rational;
import android.view.Menu; import android.view.Menu;
@ -24,6 +20,11 @@ import android.view.View;
import android.view.WindowManager; import android.view.WindowManager;
import android.widget.Toast; import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.annotation.RequiresApi;
import androidx.annotation.StringRes;
import androidx.databinding.DataBindingUtil;
import com.google.common.base.Optional; import com.google.common.base.Optional;
import com.google.common.base.Preconditions; import com.google.common.base.Preconditions;
import com.google.common.base.Throwables; import com.google.common.base.Throwables;
@ -55,12 +56,12 @@ import eu.siacs.conversations.ui.util.MainThreadExecutor;
import eu.siacs.conversations.utils.PermissionUtils; import eu.siacs.conversations.utils.PermissionUtils;
import eu.siacs.conversations.utils.TimeFrameUtils; import eu.siacs.conversations.utils.TimeFrameUtils;
import eu.siacs.conversations.xml.Namespace; import eu.siacs.conversations.xml.Namespace;
import eu.siacs.conversations.xmpp.Jid;
import eu.siacs.conversations.xmpp.jingle.AbstractJingleConnection; import eu.siacs.conversations.xmpp.jingle.AbstractJingleConnection;
import eu.siacs.conversations.xmpp.jingle.JingleConnectionManager; import eu.siacs.conversations.xmpp.jingle.JingleConnectionManager;
import eu.siacs.conversations.xmpp.jingle.JingleRtpConnection; import eu.siacs.conversations.xmpp.jingle.JingleRtpConnection;
import eu.siacs.conversations.xmpp.jingle.Media; import eu.siacs.conversations.xmpp.jingle.Media;
import eu.siacs.conversations.xmpp.jingle.RtpEndUserState; import eu.siacs.conversations.xmpp.jingle.RtpEndUserState;
import eu.siacs.conversations.xmpp.Jid;
import static eu.siacs.conversations.utils.PermissionUtils.getFirstDenied; import static eu.siacs.conversations.utils.PermissionUtils.getFirstDenied;
import static java.util.Arrays.asList; import static java.util.Arrays.asList;
@ -99,8 +100,8 @@ public class RtpSessionActivity extends XmppActivity implements XmppConnectionSe
private ActivityRtpSessionBinding binding; private ActivityRtpSessionBinding binding;
private PowerManager.WakeLock mProximityWakeLock; private PowerManager.WakeLock mProximityWakeLock;
private Handler mHandler = new Handler(); private final Handler mHandler = new Handler();
private Runnable mTickExecutor = new Runnable() { private final Runnable mTickExecutor = new Runnable() {
@Override @Override
public void run() { public void run() {
updateCallDuration(); updateCallDuration();
@ -457,19 +458,22 @@ public class RtpSessionActivity extends XmppActivity implements XmppConnectionSe
@Override @Override
public void onBackPressed() { public void onBackPressed() {
super.onBackPressed(); if (isConnected()) {
if (switchToPictureInPicture()) {
return;
}
} else {
endCall(); endCall();
} }
super.onBackPressed();
}
@Override @Override
public void onUserLeaveHint() { public void onUserLeaveHint() {
super.onUserLeaveHint(); super.onUserLeaveHint();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O && deviceSupportsPictureInPicture()) { if (switchToPictureInPicture()) {
if (shouldBePictureInPicture()) {
startPictureInPicture();
return; return;
} }
}
//TODO apparently this method is not getting called on Android 10 when using the task switcher //TODO apparently this method is not getting called on Android 10 when using the task switcher
final boolean emptyReference = rtpConnectionReference == null || rtpConnectionReference.get() == null; final boolean emptyReference = rtpConnectionReference == null || rtpConnectionReference.get() == null;
if (emptyReference && xmppConnectionService != null) { if (emptyReference && xmppConnectionService != null) {
@ -477,6 +481,21 @@ public class RtpSessionActivity extends XmppActivity implements XmppConnectionSe
} }
} }
private boolean isConnected() {
final JingleRtpConnection connection = this.rtpConnectionReference != null ? this.rtpConnectionReference.get() : null;
return connection != null && connection.getEndUserState() == RtpEndUserState.CONNECTED;
}
private boolean switchToPictureInPicture() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O && deviceSupportsPictureInPicture()) {
if (shouldBePictureInPicture()) {
startPictureInPicture();
return true;
}
}
return false;
}
@RequiresApi(api = Build.VERSION_CODES.O) @RequiresApi(api = Build.VERSION_CODES.O)
private void startPictureInPicture() { private void startPictureInPicture() {
try { try {

View File

@ -17,18 +17,6 @@
package eu.siacs.conversations.ui; package eu.siacs.conversations.ui;
import java.util.EnumMap;
import java.util.Map;
import com.google.zxing.BinaryBitmap;
import com.google.zxing.DecodeHintType;
import com.google.zxing.PlanarYUVLuminanceSource;
import com.google.zxing.ReaderException;
import com.google.zxing.Result;
import com.google.zxing.ResultPointCallback;
import com.google.zxing.common.HybridBinarizer;
import com.google.zxing.qrcode.QRCodeReader;
import android.Manifest; import android.Manifest;
import android.app.Activity; import android.app.Activity;
import android.content.Context; import android.content.Context;
@ -45,8 +33,6 @@ import android.os.Handler;
import android.os.HandlerThread; import android.os.HandlerThread;
import android.os.Process; import android.os.Process;
import android.os.Vibrator; import android.os.Vibrator;
import android.support.v4.app.ActivityCompat;
import android.support.v4.content.ContextCompat;
import android.util.Log; import android.util.Log;
import android.view.KeyEvent; import android.view.KeyEvent;
import android.view.Surface; import android.view.Surface;
@ -56,6 +42,21 @@ import android.view.View;
import android.view.WindowManager; import android.view.WindowManager;
import android.widget.Toast; import android.widget.Toast;
import androidx.core.app.ActivityCompat;
import androidx.core.content.ContextCompat;
import com.google.zxing.BinaryBitmap;
import com.google.zxing.DecodeHintType;
import com.google.zxing.PlanarYUVLuminanceSource;
import com.google.zxing.ReaderException;
import com.google.zxing.Result;
import com.google.zxing.ResultPointCallback;
import com.google.zxing.common.HybridBinarizer;
import com.google.zxing.qrcode.QRCodeReader;
import java.util.EnumMap;
import java.util.Map;
import eu.siacs.conversations.Config; import eu.siacs.conversations.Config;
import eu.siacs.conversations.R; import eu.siacs.conversations.R;
import eu.siacs.conversations.ui.service.CameraManager; import eu.siacs.conversations.ui.service.CameraManager;
@ -73,7 +74,7 @@ public final class ScanActivity extends Activity implements SurfaceTextureListen
private static final long VIBRATE_DURATION = 50L; private static final long VIBRATE_DURATION = 50L;
private static final long AUTO_FOCUS_INTERVAL_MS = 2500L; private static final long AUTO_FOCUS_INTERVAL_MS = 2500L;
private static boolean DISABLE_CONTINUOUS_AUTOFOCUS = Build.MODEL.equals("GT-I9100") // Galaxy S2 private static final boolean DISABLE_CONTINUOUS_AUTOFOCUS = Build.MODEL.equals("GT-I9100") // Galaxy S2
|| Build.MODEL.equals("SGH-T989") // Galaxy S2 || Build.MODEL.equals("SGH-T989") // Galaxy S2
|| Build.MODEL.equals("SGH-T989D") // Galaxy S2 X || Build.MODEL.equals("SGH-T989D") // Galaxy S2 X
|| Build.MODEL.equals("SAMSUNG-SGH-I727") // Galaxy S2 Skyrocket || Build.MODEL.equals("SAMSUNG-SGH-I727") // Galaxy S2 Skyrocket

View File

@ -30,9 +30,7 @@
package eu.siacs.conversations.ui; package eu.siacs.conversations.ui;
import android.content.Intent; import android.content.Intent;
import android.databinding.DataBindingUtil;
import android.os.Bundle; import android.os.Bundle;
import android.support.v7.widget.Toolbar;
import android.text.Editable; import android.text.Editable;
import android.text.InputType; import android.text.InputType;
import android.text.TextWatcher; import android.text.TextWatcher;
@ -44,6 +42,8 @@ import android.view.View;
import android.widget.AdapterView; import android.widget.AdapterView;
import android.widget.EditText; import android.widget.EditText;
import androidx.databinding.DataBindingUtil;
import com.google.common.base.Strings; import com.google.common.base.Strings;
import java.lang.ref.WeakReference; import java.lang.ref.WeakReference;
@ -61,10 +61,10 @@ import eu.siacs.conversations.ui.adapter.MessageAdapter;
import eu.siacs.conversations.ui.interfaces.OnSearchResultsAvailable; import eu.siacs.conversations.ui.interfaces.OnSearchResultsAvailable;
import eu.siacs.conversations.ui.util.ChangeWatcher; import eu.siacs.conversations.ui.util.ChangeWatcher;
import eu.siacs.conversations.ui.util.DateSeparator; import eu.siacs.conversations.ui.util.DateSeparator;
import eu.siacs.conversations.ui.util.StyledAttributes;
import eu.siacs.conversations.ui.util.ListViewUtils; import eu.siacs.conversations.ui.util.ListViewUtils;
import eu.siacs.conversations.ui.util.PendingItem; import eu.siacs.conversations.ui.util.PendingItem;
import eu.siacs.conversations.ui.util.ShareUtil; import eu.siacs.conversations.ui.util.ShareUtil;
import eu.siacs.conversations.ui.util.StyledAttributes;
import eu.siacs.conversations.utils.FtsUtils; import eu.siacs.conversations.utils.FtsUtils;
import eu.siacs.conversations.utils.MessageUtils; import eu.siacs.conversations.utils.MessageUtils;
@ -95,7 +95,7 @@ public class SearchActivity extends XmppActivity implements TextWatcher, OnSearc
} }
super.onCreate(bundle); super.onCreate(bundle);
this.binding = DataBindingUtil.setContentView(this, R.layout.activity_search); this.binding = DataBindingUtil.setContentView(this, R.layout.activity_search);
setSupportActionBar((Toolbar) this.binding.toolbar); setSupportActionBar(this.binding.toolbar);
configureActionBar(getSupportActionBar()); configureActionBar(getSupportActionBar());
this.messageListAdapter = new MessageAdapter(this, this.messages); this.messageListAdapter = new MessageAdapter(this, this.messages);
this.messageListAdapter.setOnContactPictureClicked(this); this.messageListAdapter.setOnContactPictureClicked(this);

View File

@ -1,19 +1,15 @@
package eu.siacs.conversations.ui; package eu.siacs.conversations.ui;
import android.preference.CheckBoxPreference;
import android.support.annotation.NonNull;
import android.support.v4.content.ContextCompat;
import android.support.v7.app.AlertDialog;
import android.app.FragmentManager; import android.app.FragmentManager;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.content.Intent; import android.content.Intent;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.content.SharedPreferences.OnSharedPreferenceChangeListener; import android.content.SharedPreferences.OnSharedPreferenceChangeListener;
import android.content.pm.PackageManager; import android.content.pm.PackageManager;
import android.net.Uri; import android.net.Uri;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.preference.CheckBoxPreference;
import android.preference.ListPreference; import android.preference.ListPreference;
import android.preference.Preference; import android.preference.Preference;
import android.preference.PreferenceCategory; import android.preference.PreferenceCategory;
@ -23,6 +19,10 @@ import android.provider.MediaStore;
import android.util.Log; import android.util.Log;
import android.widget.Toast; import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AlertDialog;
import androidx.core.content.ContextCompat;
import java.io.File; import java.io.File;
import java.security.KeyStoreException; import java.security.KeyStoreException;
import java.util.ArrayList; import java.util.ArrayList;
@ -188,11 +188,7 @@ public class SettingsActivity extends XmppActivity implements
} else if (selectedItems.contains(indexSelected)) { } else if (selectedItems.contains(indexSelected)) {
selectedItems.remove(Integer.valueOf(indexSelected)); selectedItems.remove(Integer.valueOf(indexSelected));
} }
if (selectedItems.size() > 0) ((AlertDialog) dialog).getButton(DialogInterface.BUTTON_POSITIVE).setEnabled(selectedItems.size() > 0);
((AlertDialog) dialog).getButton(DialogInterface.BUTTON_POSITIVE).setEnabled(true);
else {
((AlertDialog) dialog).getButton(DialogInterface.BUTTON_POSITIVE).setEnabled(false);
}
}); });
dialogBuilder.setPositiveButton( dialogBuilder.setPositiveButton(

View File

@ -3,16 +3,17 @@ package eu.siacs.conversations.ui;
import android.Manifest; import android.Manifest;
import android.content.Intent; import android.content.Intent;
import android.content.pm.PackageManager; import android.content.pm.PackageManager;
import android.databinding.DataBindingUtil;
import android.location.Location; import android.location.Location;
import android.location.LocationListener; import android.location.LocationListener;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.design.widget.Snackbar;
import android.support.v7.widget.Toolbar;
import android.view.View; import android.view.View;
import androidx.annotation.NonNull;
import androidx.databinding.DataBindingUtil;
import com.google.android.material.snackbar.Snackbar;
import org.osmdroid.api.IGeoPoint; import org.osmdroid.api.IGeoPoint;
import org.osmdroid.util.GeoPoint; import org.osmdroid.util.GeoPoint;
@ -54,7 +55,7 @@ public class ShareLocationActivity extends LocationActivity implements LocationL
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
this.binding = DataBindingUtil.setContentView(this,R.layout.activity_share_location); this.binding = DataBindingUtil.setContentView(this,R.layout.activity_share_location);
setSupportActionBar((Toolbar) binding.toolbar); setSupportActionBar(binding.toolbar);
configureActionBar(getSupportActionBar()); configureActionBar(getSupportActionBar());
setupMapView(binding.map, LocationProvider.getGeoPoint(this)); setupMapView(binding.map, LocationProvider.getGeoPoint(this));

View File

@ -4,13 +4,14 @@ import android.content.Intent;
import android.content.pm.PackageManager; import android.content.pm.PackageManager;
import android.net.Uri; import android.net.Uri;
import android.os.Bundle; import android.os.Bundle;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.Log; import android.util.Log;
import android.view.Menu; import android.view.Menu;
import android.view.MenuItem; import android.view.MenuItem;
import android.widget.Toast; import android.widget.Toast;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -44,7 +45,7 @@ public class ShareWithActivity extends XmppActivity implements XmppConnectionSer
private static final int REQUEST_START_NEW_CONVERSATION = 0x0501; private static final int REQUEST_START_NEW_CONVERSATION = 0x0501;
private ConversationAdapter mAdapter; private ConversationAdapter mAdapter;
private List<Conversation> mConversations = new ArrayList<>(); private final List<Conversation> mConversations = new ArrayList<>();
protected void onActivityResult(int requestCode, int resultCode, final Intent data) { protected void onActivityResult(int requestCode, int resultCode, final Intent data) {
@ -63,7 +64,7 @@ public class ShareWithActivity extends XmppActivity implements XmppConnectionSer
} }
@Override @Override
public void onRequestPermissionsResult(int requestCode, String permissions[], int[] grantResults) { public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
if (grantResults.length > 0) if (grantResults.length > 0)
if (grantResults[0] == PackageManager.PERMISSION_GRANTED) { if (grantResults[0] == PackageManager.PERMISSION_GRANTED) {
if (requestCode == REQUEST_STORAGE_PERMISSION) { if (requestCode == REQUEST_STORAGE_PERMISSION) {

Some files were not shown because too many files have changed in this diff Show More