From 2c749c8d95ea7f632e7477640de278303fcf135b Mon Sep 17 00:00:00 2001 From: kosyak Date: Sat, 18 May 2024 11:06:02 +0200 Subject: [PATCH] Revert "after merge imports optimiztion" This reverts commit 999a45dc511ba63ea855e0be6e1fa48fb9399f4d. --- .../de/gultsch/minidns/AndroidDNSClient.java | 13 ++--- .../java/de/gultsch/minidns/DNSSocket.java | 7 +-- .../de/gultsch/minidns/NetworkDataSource.java | 13 ++--- .../java/eu/siacs/conversations/Config.java | 8 ++-- .../android/JabberIdContact.java | 8 ++-- .../conversations/crypto/OmemoSetting.java | 3 ++ .../crypto/sasl/ChannelBinding.java | 8 ++-- .../crypto/sasl/SaslMechanism.java | 10 ++-- .../crypto/sasl/ScramSha256.java | 4 ++ .../crypto/sasl/ScramSha512.java | 4 ++ .../conversations/entities/Conversation.java | 8 +++- .../siacs/conversations/entities/Message.java | 1 + .../generator/AbstractGenerator.java | 18 +++---- .../http/HttpDownloadConnection.java | 4 +- .../medialib/activities/EditActivity.kt | 30 ++---------- .../medialib/dialogs/ColorPickerDialog.kt | 11 +---- .../dialogs/CustomAspectRatioDialog.kt | 1 + .../medialib/dialogs/ResizeDialog.kt | 6 +-- .../medialib/extensions/Activity.kt | 5 ++ .../medialib/extensions/Context.kt | 10 ++-- .../medialib/extensions/EditText.kt | 5 ++ .../conversations/medialib/extensions/View.kt | 1 + .../conversations/medialib/helpers/Config.kt | 2 +- .../helpers/FilterThumbnailsManager.kt | 1 + .../medialib/views/ColorPickerSquare.kt | 8 +--- .../medialib/views/EditorDrawCanvas.kt | 6 +-- .../conversations/parser/PresenceParser.java | 10 ++-- .../persistance/DatabaseBackend.java | 1 + .../services/AbstractConnectionManager.java | 4 +- .../AbstractQuickConversationsService.java | 4 +- .../services/AppRTCAudioManager.java | 8 ++-- .../services/CallIntegration.java | 14 +++--- .../CallIntegrationConnectionService.java | 22 ++++----- .../services/ChannelDiscoveryService.java | 42 ++++++++-------- .../services/MemorizingTrustManager.java | 20 ++++---- .../services/NotificationService.java | 31 ++++++------ .../services/ShortcutService.java | 1 + .../services/UnifiedPushBroker.java | 13 +++-- .../siacs/conversations/ui/AboutActivity.java | 4 +- .../AbstractSearchableListItemActivity.java | 1 + .../eu/siacs/conversations/ui/Activities.java | 1 - .../conversations/ui/BlockContactDialog.java | 1 + ...hooseAccountForProfilePictureActivity.java | 6 +-- .../ui/ChooseContactActivity.java | 1 + .../ui/ConferenceDetailsActivity.java | 7 +-- .../ui/ContactDetailsActivity.java | 8 +++- .../ui/ConversationActivity.java | 2 + .../ui/ConversationFragment.java | 21 ++++++++ .../ui/ConversationsActivity.java | 1 + .../ui/ConversationsOverviewFragment.java | 10 ++-- .../ui/CreatePrivateGroupChatDialog.java | 1 + .../conversations/ui/EditAccountActivity.java | 15 +++--- .../conversations/ui/EnterJidDialog.java | 10 ++-- .../ui/ExtendedFabSizeChanger.java | 1 - .../ui/JoinConferenceDialog.java | 1 + .../conversations/ui/LocationActivity.java | 3 ++ .../conversations/ui/MucUsersActivity.java | 2 + .../siacs/conversations/ui/OmemoActivity.java | 1 + ...ublishGroupChatProfilePictureActivity.java | 8 ++-- .../conversations/ui/RecordingActivity.java | 3 +- .../conversations/ui/RtpSessionActivity.java | 14 +++++- .../siacs/conversations/ui/ScanActivity.java | 1 + .../conversations/ui/SearchActivity.java | 8 ++-- .../conversations/ui/SendLogActivity.java | 1 + .../ui/ShareLocationActivity.java | 10 ++-- .../conversations/ui/ShareWithActivity.java | 4 ++ .../ui/ShowLocationActivity.java | 8 ++-- .../ui/StartConversationActivity.java | 11 +++++ .../conversations/ui/TrustKeysActivity.java | 19 ++++---- .../conversations/ui/UriHandlerActivity.java | 11 +++-- .../siacs/conversations/ui/XmppActivity.java | 8 ++++ .../ui/activity/SettingsActivity.java | 4 +- .../ui/adapter/AccountAdapter.java | 5 +- .../adapter/ChannelSearchResultAdapter.java | 4 +- .../ui/adapter/ConversationAdapter.java | 10 +++- .../ui/adapter/KnownHostsAdapter.java | 4 +- .../ui/adapter/ListItemAdapter.java | 4 +- .../ui/adapter/MediaAdapter.java | 12 ++--- .../ui/adapter/MediaPreviewAdapter.java | 10 +++- .../settings/BackupSettingsFragment.java | 4 +- .../settings/SecuritySettingsFragment.java | 8 ++-- .../fragment/settings/UpSettingsFragment.java | 8 ++-- .../conversations/ui/service/AudioPlayer.java | 8 ++-- .../conversations/ui/text/FixedURLSpan.java | 1 + .../conversations/ui/util/Attachment.java | 6 +-- .../ui/util/MucDetailsContextMenuHelper.java | 2 + .../conversations/ui/util/MyLinkify.java | 1 + .../ui/util/PresenceSelector.java | 2 + .../siacs/conversations/ui/util/ViewUtil.java | 3 ++ .../conversations/utils/AccountUtils.java | 1 + .../conversations/utils/ExceptionHelper.java | 18 +++---- .../siacs/conversations/utils/FileUtils.java | 1 + .../utils/IrregularUnicodeDetector.java | 1 + .../siacs/conversations/utils/SSLSockets.java | 6 +-- .../conversations/utils/StylingHelper.java | 3 ++ .../conversations/utils/ThemeHelper.java | 1 + .../siacs/conversations/utils/XmlHelper.java | 4 +- .../worker/ExportBackupWorker.java | 24 +++++----- .../conversations/xmpp/XmppConnection.java | 42 ++++++++++++++++ .../xmpp/jingle/AbstractContentMap.java | 8 ++-- .../xmpp/jingle/AbstractJingleConnection.java | 12 ++--- .../xmpp/jingle/DirectConnectionUtils.java | 5 ++ .../xmpp/jingle/FileTransferContentMap.java | 11 +++-- .../conversations/xmpp/jingle/IceServers.java | 12 ++--- .../xmpp/jingle/JingleConnectionManager.java | 26 +++++----- .../jingle/JingleFileTransferConnection.java | 48 +++++++++---------- .../xmpp/jingle/JingleRtpConnection.java | 34 ++++++------- .../xmpp/jingle/OngoingRtpSession.java | 4 +- .../xmpp/jingle/RtpCapability.java | 1 + .../xmpp/jingle/RtpContentMap.java | 16 +++---- .../xmpp/jingle/SessionDescription.java | 12 ++--- .../xmpp/jingle/ToneManager.java | 8 ++-- .../xmpp/jingle/TrackWrapper.java | 4 +- .../xmpp/jingle/WebRTCWrapper.java | 9 ++-- .../xmpp/jingle/stanzas/Content.java | 6 +-- .../stanzas/FileTransferDescription.java | 4 +- .../jingle/stanzas/IceUdpTransportInfo.java | 13 ++--- .../xmpp/jingle/stanzas/JinglePacket.java | 4 +- .../xmpp/jingle/stanzas/Reason.java | 1 + .../SocksByteStreamsTransportInfo.java | 6 +-- .../InbandBytestreamsTransport.java | 18 +++---- .../transports/SocksByteStreamsTransport.java | 22 ++++----- .../xmpp/jingle/transports/Transport.java | 6 +-- .../WebRTCDataChannelTransport.java | 20 ++++---- 124 files changed, 618 insertions(+), 457 deletions(-) diff --git a/src/main/java/de/gultsch/minidns/AndroidDNSClient.java b/src/main/java/de/gultsch/minidns/AndroidDNSClient.java index b02025c59..2c3731871 100644 --- a/src/main/java/de/gultsch/minidns/AndroidDNSClient.java +++ b/src/main/java/de/gultsch/minidns/AndroidDNSClient.java @@ -14,18 +14,19 @@ import com.google.common.base.Strings; import com.google.common.collect.Collections2; import com.google.common.collect.ImmutableList; +import de.measite.minidns.AbstractDNSClient; +import de.measite.minidns.DNSMessage; +import de.measite.minidns.Record; +import de.measite.minidns.record.Data; + +import eu.siacs.conversations.Config; + import java.io.IOException; import java.net.InetAddress; import java.time.Duration; import java.util.Collections; import java.util.List; -import de.measite.minidns.AbstractDNSClient; -import de.measite.minidns.DNSMessage; -import de.measite.minidns.Record; -import de.measite.minidns.record.Data; -import eu.siacs.conversations.Config; - public class AndroidDNSClient extends AbstractDNSClient { private static final long DNS_MAX_TTL = 86_400L; diff --git a/src/main/java/de/gultsch/minidns/DNSSocket.java b/src/main/java/de/gultsch/minidns/DNSSocket.java index f2438b78a..e3d86b80c 100644 --- a/src/main/java/de/gultsch/minidns/DNSSocket.java +++ b/src/main/java/de/gultsch/minidns/DNSSocket.java @@ -7,6 +7,10 @@ import com.google.common.base.Strings; import com.google.common.util.concurrent.ListenableFuture; import com.google.common.util.concurrent.SettableFuture; +import de.measite.minidns.DNSMessage; + +import eu.siacs.conversations.Config; + import org.conscrypt.OkHostnameVerifier; import java.io.Closeable; @@ -32,9 +36,6 @@ import javax.net.ssl.SSLSession; import javax.net.ssl.SSLSocket; import javax.net.ssl.SSLSocketFactory; -import de.measite.minidns.DNSMessage; -import eu.siacs.conversations.Config; - final class DNSSocket implements Closeable { public static final int QUERY_TIMEOUT = 5_000; diff --git a/src/main/java/de/gultsch/minidns/NetworkDataSource.java b/src/main/java/de/gultsch/minidns/NetworkDataSource.java index 3c997ec68..67a8f8c33 100644 --- a/src/main/java/de/gultsch/minidns/NetworkDataSource.java +++ b/src/main/java/de/gultsch/minidns/NetworkDataSource.java @@ -11,6 +11,13 @@ import com.google.common.cache.LoadingCache; import com.google.common.cache.RemovalListener; import com.google.common.collect.ImmutableList; +import de.measite.minidns.DNSMessage; +import de.measite.minidns.MiniDNSException; +import de.measite.minidns.source.DNSDataSource; +import de.measite.minidns.util.MultipleIoException; + +import eu.siacs.conversations.Config; + import java.io.IOException; import java.net.DatagramPacket; import java.net.DatagramSocket; @@ -21,12 +28,6 @@ import java.util.Map; import java.util.concurrent.ExecutionException; import java.util.concurrent.TimeUnit; -import de.measite.minidns.DNSMessage; -import de.measite.minidns.MiniDNSException; -import de.measite.minidns.source.DNSDataSource; -import de.measite.minidns.util.MultipleIoException; -import eu.siacs.conversations.Config; - public class NetworkDataSource extends DNSDataSource { private static final LoadingCache socketCache = diff --git a/src/main/java/eu/siacs/conversations/Config.java b/src/main/java/eu/siacs/conversations/Config.java index 0113d90f0..134afdbf7 100644 --- a/src/main/java/eu/siacs/conversations/Config.java +++ b/src/main/java/eu/siacs/conversations/Config.java @@ -3,15 +3,15 @@ package eu.siacs.conversations; import android.graphics.Bitmap; import android.net.Uri; +import eu.siacs.conversations.crypto.XmppDomainVerifier; +import eu.siacs.conversations.xmpp.Jid; +import eu.siacs.conversations.xmpp.chatstate.ChatState; + import java.util.Arrays; import java.util.Collections; import java.util.List; import java.util.Locale; -import eu.siacs.conversations.crypto.XmppDomainVerifier; -import eu.siacs.conversations.xmpp.Jid; -import eu.siacs.conversations.xmpp.chatstate.ChatState; - public final class Config { private static final int UNENCRYPTED = 1; private static final int OPENPGP = 2; diff --git a/src/main/java/eu/siacs/conversations/android/JabberIdContact.java b/src/main/java/eu/siacs/conversations/android/JabberIdContact.java index 4050e1b93..32d5a53e7 100644 --- a/src/main/java/eu/siacs/conversations/android/JabberIdContact.java +++ b/src/main/java/eu/siacs/conversations/android/JabberIdContact.java @@ -8,14 +8,14 @@ import android.os.Build; import android.provider.ContactsContract; import android.util.Log; -import java.util.Collections; -import java.util.HashMap; -import java.util.Map; - import eu.siacs.conversations.Config; import eu.siacs.conversations.services.QuickConversationsService; import eu.siacs.conversations.xmpp.Jid; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; + public class JabberIdContact extends AbstractPhoneContact { private static final String[] PROJECTION = diff --git a/src/main/java/eu/siacs/conversations/crypto/OmemoSetting.java b/src/main/java/eu/siacs/conversations/crypto/OmemoSetting.java index ba2d484a8..b173108c1 100644 --- a/src/main/java/eu/siacs/conversations/crypto/OmemoSetting.java +++ b/src/main/java/eu/siacs/conversations/crypto/OmemoSetting.java @@ -31,11 +31,14 @@ package eu.siacs.conversations.crypto; import android.content.Context; +import android.content.SharedPreferences; +import android.preference.PreferenceManager; import com.google.common.base.Strings; import eu.siacs.conversations.AppSettings; import eu.siacs.conversations.Config; +import eu.siacs.conversations.R; import eu.siacs.conversations.entities.Message; public class OmemoSetting { diff --git a/src/main/java/eu/siacs/conversations/crypto/sasl/ChannelBinding.java b/src/main/java/eu/siacs/conversations/crypto/sasl/ChannelBinding.java index 03e255c5d..3cbaaeeb9 100644 --- a/src/main/java/eu/siacs/conversations/crypto/sasl/ChannelBinding.java +++ b/src/main/java/eu/siacs/conversations/crypto/sasl/ChannelBinding.java @@ -10,15 +10,15 @@ import com.google.common.collect.BiMap; import com.google.common.collect.Collections2; import com.google.common.collect.ImmutableBiMap; -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; - import eu.siacs.conversations.Config; import eu.siacs.conversations.utils.SSLSockets; import eu.siacs.conversations.xml.Element; import eu.siacs.conversations.xml.Namespace; +import java.util.Arrays; +import java.util.Collection; +import java.util.Collections; + public enum ChannelBinding { NONE, TLS_EXPORTER, diff --git a/src/main/java/eu/siacs/conversations/crypto/sasl/SaslMechanism.java b/src/main/java/eu/siacs/conversations/crypto/sasl/SaslMechanism.java index 2af67c111..93c722e37 100644 --- a/src/main/java/eu/siacs/conversations/crypto/sasl/SaslMechanism.java +++ b/src/main/java/eu/siacs/conversations/crypto/sasl/SaslMechanism.java @@ -6,17 +6,17 @@ import com.google.common.base.Preconditions; import com.google.common.base.Strings; import com.google.common.collect.Collections2; -import java.util.Collection; -import java.util.Collections; - -import javax.net.ssl.SSLSocket; - import eu.siacs.conversations.Config; import eu.siacs.conversations.entities.Account; import eu.siacs.conversations.utils.SSLSockets; import eu.siacs.conversations.xml.Element; import eu.siacs.conversations.xml.Namespace; +import java.util.Collection; +import java.util.Collections; + +import javax.net.ssl.SSLSocket; + public abstract class SaslMechanism { protected final Account account; diff --git a/src/main/java/eu/siacs/conversations/crypto/sasl/ScramSha256.java b/src/main/java/eu/siacs/conversations/crypto/sasl/ScramSha256.java index 521a04198..b330f1fe7 100644 --- a/src/main/java/eu/siacs/conversations/crypto/sasl/ScramSha256.java +++ b/src/main/java/eu/siacs/conversations/crypto/sasl/ScramSha256.java @@ -3,6 +3,10 @@ package eu.siacs.conversations.crypto.sasl; import com.google.common.hash.HashFunction; import com.google.common.hash.Hashing; +import org.bouncycastle.crypto.Digest; +import org.bouncycastle.crypto.digests.SHA256Digest; +import org.bouncycastle.crypto.macs.HMac; + import eu.siacs.conversations.entities.Account; public class ScramSha256 extends ScramMechanism { diff --git a/src/main/java/eu/siacs/conversations/crypto/sasl/ScramSha512.java b/src/main/java/eu/siacs/conversations/crypto/sasl/ScramSha512.java index 40ad5f3a3..e6dcf2efd 100644 --- a/src/main/java/eu/siacs/conversations/crypto/sasl/ScramSha512.java +++ b/src/main/java/eu/siacs/conversations/crypto/sasl/ScramSha512.java @@ -3,6 +3,10 @@ package eu.siacs.conversations.crypto.sasl; import com.google.common.hash.HashFunction; import com.google.common.hash.Hashing; +import org.bouncycastle.crypto.Digest; +import org.bouncycastle.crypto.digests.SHA512Digest; +import org.bouncycastle.crypto.macs.HMac; + import eu.siacs.conversations.entities.Account; public class ScramSha512 extends ScramMechanism { diff --git a/src/main/java/eu/siacs/conversations/entities/Conversation.java b/src/main/java/eu/siacs/conversations/entities/Conversation.java index d9a7bf1c8..f71deb695 100644 --- a/src/main/java/eu/siacs/conversations/entities/Conversation.java +++ b/src/main/java/eu/siacs/conversations/entities/Conversation.java @@ -1,7 +1,5 @@ package eu.siacs.conversations.entities; -import static eu.siacs.conversations.entities.Bookmark.printableValue; - import android.content.ContentValues; import android.content.Context; import android.content.DialogInterface; @@ -12,6 +10,7 @@ import android.graphics.Bitmap; import android.graphics.Canvas; import android.graphics.Rect; import android.graphics.drawable.BitmapDrawable; +import android.graphics.drawable.Drawable; import android.net.Uri; import android.os.Build; import android.telephony.PhoneNumberUtils; @@ -25,6 +24,7 @@ import android.text.TextUtils; import android.text.TextWatcher; import android.text.util.Linkify; import android.util.DisplayMetrics; +import android.util.LruCache; import android.util.Pair; import android.util.SparseArray; import android.view.Gravity; @@ -82,6 +82,7 @@ import java.time.format.FormatStyle; import java.util.ArrayList; import java.util.Collections; import java.util.HashSet; +import java.util.Iterator; import java.util.List; import java.util.ListIterator; import java.util.Objects; @@ -110,6 +111,7 @@ import eu.siacs.conversations.databinding.CommandTextFieldBinding; import eu.siacs.conversations.databinding.CommandUnknownBinding; import eu.siacs.conversations.databinding.CommandWebviewBinding; import eu.siacs.conversations.databinding.DialogQuickeditBinding; +import eu.siacs.conversations.http.HttpConnectionManager; import eu.siacs.conversations.persistance.DatabaseBackend; import eu.siacs.conversations.services.AvatarService; import eu.siacs.conversations.services.QuickConversationsService; @@ -133,6 +135,8 @@ import eu.siacs.conversations.xmpp.stanzas.IqPacket; import io.michaelrocks.libphonenumber.android.NumberParseException; import me.saket.bettermovementmethod.BetterLinkMovementMethod; +import static eu.siacs.conversations.entities.Bookmark.printableValue; + public class Conversation extends AbstractEntity implements Blockable, Comparable, Conversational, AvatarService.Avatarable { public static final String TABLENAME = "conversations"; diff --git a/src/main/java/eu/siacs/conversations/entities/Message.java b/src/main/java/eu/siacs/conversations/entities/Message.java index 0ff414588..863141338 100644 --- a/src/main/java/eu/siacs/conversations/entities/Message.java +++ b/src/main/java/eu/siacs/conversations/entities/Message.java @@ -4,6 +4,7 @@ import android.content.ContentValues; import android.database.Cursor; import android.graphics.Color; import android.text.SpannableStringBuilder; +import android.text.TextUtils; import android.util.Log; import androidx.annotation.Nullable; diff --git a/src/main/java/eu/siacs/conversations/generator/AbstractGenerator.java b/src/main/java/eu/siacs/conversations/generator/AbstractGenerator.java index 539de064f..905b08286 100644 --- a/src/main/java/eu/siacs/conversations/generator/AbstractGenerator.java +++ b/src/main/java/eu/siacs/conversations/generator/AbstractGenerator.java @@ -2,6 +2,15 @@ package eu.siacs.conversations.generator; import android.util.Base64; +import eu.siacs.conversations.BuildConfig; +import eu.siacs.conversations.Config; +import eu.siacs.conversations.R; +import eu.siacs.conversations.crypto.axolotl.AxolotlService; +import eu.siacs.conversations.entities.Account; +import eu.siacs.conversations.services.XmppConnectionService; +import eu.siacs.conversations.xml.Namespace; +import eu.siacs.conversations.xmpp.XmppConnection; + import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import java.text.SimpleDateFormat; @@ -12,15 +21,6 @@ import java.util.List; import java.util.Locale; import java.util.TimeZone; -import eu.siacs.conversations.BuildConfig; -import eu.siacs.conversations.Config; -import eu.siacs.conversations.R; -import eu.siacs.conversations.crypto.axolotl.AxolotlService; -import eu.siacs.conversations.entities.Account; -import eu.siacs.conversations.services.XmppConnectionService; -import eu.siacs.conversations.xml.Namespace; -import eu.siacs.conversations.xmpp.XmppConnection; - public abstract class AbstractGenerator { private static final SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'", Locale.US); diff --git a/src/main/java/eu/siacs/conversations/http/HttpDownloadConnection.java b/src/main/java/eu/siacs/conversations/http/HttpDownloadConnection.java index 5e6efee10..88e5f801f 100644 --- a/src/main/java/eu/siacs/conversations/http/HttpDownloadConnection.java +++ b/src/main/java/eu/siacs/conversations/http/HttpDownloadConnection.java @@ -1,7 +1,5 @@ package eu.siacs.conversations.http; -import static eu.siacs.conversations.http.HttpConnectionManager.EXECUTOR; - import android.util.Log; import androidx.annotation.Nullable; @@ -35,6 +33,8 @@ import okhttp3.OkHttpClient; import okhttp3.Request; import okhttp3.Response; +import static eu.siacs.conversations.http.HttpConnectionManager.EXECUTOR; + public class HttpDownloadConnection implements Transferable { private final Message message; diff --git a/src/main/java/eu/siacs/conversations/medialib/activities/EditActivity.kt b/src/main/java/eu/siacs/conversations/medialib/activities/EditActivity.kt index aa3beb9e9..83a21498b 100644 --- a/src/main/java/eu/siacs/conversations/medialib/activities/EditActivity.kt +++ b/src/main/java/eu/siacs/conversations/medialib/activities/EditActivity.kt @@ -33,35 +33,11 @@ import eu.siacs.conversations.medialib.adapters.FiltersAdapter import eu.siacs.conversations.medialib.dialogs.ColorPickerDialog import eu.siacs.conversations.medialib.dialogs.OtherAspectRatioDialog import eu.siacs.conversations.medialib.dialogs.ResizeDialog -import eu.siacs.conversations.medialib.extensions.applyColorFilter -import eu.siacs.conversations.medialib.extensions.beGone -import eu.siacs.conversations.medialib.extensions.beVisible -import eu.siacs.conversations.medialib.extensions.beVisibleIf -import eu.siacs.conversations.medialib.extensions.config -import eu.siacs.conversations.medialib.extensions.copyNonDimensionAttributesTo -import eu.siacs.conversations.medialib.extensions.ensureBackgroundThread -import eu.siacs.conversations.medialib.extensions.getCompressionFormat -import eu.siacs.conversations.medialib.extensions.getRealPathFromURI -import eu.siacs.conversations.medialib.extensions.isGone -import eu.siacs.conversations.medialib.extensions.isNougatPlus -import eu.siacs.conversations.medialib.extensions.isVisible -import eu.siacs.conversations.medialib.extensions.onGlobalLayout -import eu.siacs.conversations.medialib.extensions.onSeekBarChangeListener -import eu.siacs.conversations.medialib.extensions.showErrorToast -import eu.siacs.conversations.medialib.extensions.toast -import eu.siacs.conversations.medialib.helpers.ASPECT_RATIO_FOUR_THREE -import eu.siacs.conversations.medialib.helpers.ASPECT_RATIO_FREE -import eu.siacs.conversations.medialib.helpers.ASPECT_RATIO_ONE_ONE -import eu.siacs.conversations.medialib.helpers.ASPECT_RATIO_OTHER -import eu.siacs.conversations.medialib.helpers.ASPECT_RATIO_SIXTEEN_NINE -import eu.siacs.conversations.medialib.helpers.FilterThumbnailsManager -import eu.siacs.conversations.medialib.helpers.REAL_FILE_PATH +import eu.siacs.conversations.medialib.extensions.* +import eu.siacs.conversations.medialib.helpers.* import eu.siacs.conversations.medialib.models.FilterItem import eu.siacs.conversations.utils.ThemeHelper -import java.io.File -import java.io.FileOutputStream -import java.io.InputStream -import java.io.OutputStream +import java.io.* import java.lang.Float.max import java.util.UUID diff --git a/src/main/java/eu/siacs/conversations/medialib/dialogs/ColorPickerDialog.kt b/src/main/java/eu/siacs/conversations/medialib/dialogs/ColorPickerDialog.kt index 602ee2772..34979a54a 100644 --- a/src/main/java/eu/siacs/conversations/medialib/dialogs/ColorPickerDialog.kt +++ b/src/main/java/eu/siacs/conversations/medialib/dialogs/ColorPickerDialog.kt @@ -13,16 +13,7 @@ import androidx.appcompat.app.AlertDialog import com.google.android.material.dialog.MaterialAlertDialogBuilder import eu.siacs.conversations.R import eu.siacs.conversations.databinding.DialogColorPickerBinding -import eu.siacs.conversations.medialib.extensions.beVisible -import eu.siacs.conversations.medialib.extensions.config -import eu.siacs.conversations.medialib.extensions.copyToClipboard -import eu.siacs.conversations.medialib.extensions.isQPlus -import eu.siacs.conversations.medialib.extensions.onGlobalLayout -import eu.siacs.conversations.medialib.extensions.onTextChangeListener -import eu.siacs.conversations.medialib.extensions.setFillWithStroke -import eu.siacs.conversations.medialib.extensions.setupDialogStuff -import eu.siacs.conversations.medialib.extensions.toHex -import eu.siacs.conversations.medialib.extensions.value +import eu.siacs.conversations.medialib.extensions.* import eu.siacs.conversations.medialib.views.ColorPickerSquare import java.util.LinkedList diff --git a/src/main/java/eu/siacs/conversations/medialib/dialogs/CustomAspectRatioDialog.kt b/src/main/java/eu/siacs/conversations/medialib/dialogs/CustomAspectRatioDialog.kt index 785fd833f..1b718d3a3 100644 --- a/src/main/java/eu/siacs/conversations/medialib/dialogs/CustomAspectRatioDialog.kt +++ b/src/main/java/eu/siacs/conversations/medialib/dialogs/CustomAspectRatioDialog.kt @@ -3,6 +3,7 @@ package eu.siacs.conversations.medialib.dialogs import android.app.Activity import android.widget.EditText import androidx.appcompat.app.AlertDialog +import androidx.appcompat.app.AppCompatActivity import com.google.android.material.dialog.MaterialAlertDialogBuilder import eu.siacs.conversations.R import eu.siacs.conversations.databinding.DialogCustomAspectRatioBinding diff --git a/src/main/java/eu/siacs/conversations/medialib/dialogs/ResizeDialog.kt b/src/main/java/eu/siacs/conversations/medialib/dialogs/ResizeDialog.kt index df715249a..c72548d96 100644 --- a/src/main/java/eu/siacs/conversations/medialib/dialogs/ResizeDialog.kt +++ b/src/main/java/eu/siacs/conversations/medialib/dialogs/ResizeDialog.kt @@ -7,11 +7,7 @@ import androidx.appcompat.app.AlertDialog import com.google.android.material.dialog.MaterialAlertDialogBuilder import eu.siacs.conversations.R import eu.siacs.conversations.databinding.DialogResizeImageBinding -import eu.siacs.conversations.medialib.extensions.onTextChangeListener -import eu.siacs.conversations.medialib.extensions.setupDialogStuff -import eu.siacs.conversations.medialib.extensions.showKeyboard -import eu.siacs.conversations.medialib.extensions.toast -import eu.siacs.conversations.medialib.extensions.value +import eu.siacs.conversations.medialib.extensions.* class ResizeDialog(val activity: Activity, val size: Point, val callback: (newSize: Point) -> Unit) { init { diff --git a/src/main/java/eu/siacs/conversations/medialib/extensions/Activity.kt b/src/main/java/eu/siacs/conversations/medialib/extensions/Activity.kt index 61ef62772..401c5fa16 100644 --- a/src/main/java/eu/siacs/conversations/medialib/extensions/Activity.kt +++ b/src/main/java/eu/siacs/conversations/medialib/extensions/Activity.kt @@ -3,6 +3,11 @@ package eu.siacs.conversations.medialib.extensions import android.app.Activity import android.view.View import androidx.appcompat.app.AlertDialog +import eu.siacs.conversations.R +import eu.siacs.conversations.medialib.models.FileDirItem +import java.io.File +import java.io.FileNotFoundException +import java.io.OutputStream fun Activity.setupDialogStuff( view: View, diff --git a/src/main/java/eu/siacs/conversations/medialib/extensions/Context.kt b/src/main/java/eu/siacs/conversations/medialib/extensions/Context.kt index 28fc030ea..79d691f25 100644 --- a/src/main/java/eu/siacs/conversations/medialib/extensions/Context.kt +++ b/src/main/java/eu/siacs/conversations/medialib/extensions/Context.kt @@ -1,11 +1,7 @@ package eu.siacs.conversations.medialib.extensions import android.app.Activity -import android.content.ClipData -import android.content.ClipboardManager -import android.content.ContentUris -import android.content.Context -import android.content.Intent +import android.content.* import android.media.MediaScannerConnection import android.net.Uri import android.os.Environment @@ -19,8 +15,8 @@ import eu.siacs.conversations.R import eu.siacs.conversations.medialib.helpers.Config import java.io.File import java.text.SimpleDateFormat -import java.util.Date -import java.util.Locale +import java.util.* +import java.util.regex.Pattern val Context.config: Config get() = Config.newInstance(applicationContext) diff --git a/src/main/java/eu/siacs/conversations/medialib/extensions/EditText.kt b/src/main/java/eu/siacs/conversations/medialib/extensions/EditText.kt index 85ddd324f..b63b104ad 100644 --- a/src/main/java/eu/siacs/conversations/medialib/extensions/EditText.kt +++ b/src/main/java/eu/siacs/conversations/medialib/extensions/EditText.kt @@ -1,8 +1,13 @@ package eu.siacs.conversations.medialib.extensions import android.text.Editable +import android.text.Spannable +import android.text.SpannableString import android.text.TextWatcher +import android.text.style.BackgroundColorSpan import android.widget.EditText +import android.widget.TextView +import androidx.core.graphics.ColorUtils val EditText.value: String get() = text.toString().trim() diff --git a/src/main/java/eu/siacs/conversations/medialib/extensions/View.kt b/src/main/java/eu/siacs/conversations/medialib/extensions/View.kt index a73363bf3..91758a551 100644 --- a/src/main/java/eu/siacs/conversations/medialib/extensions/View.kt +++ b/src/main/java/eu/siacs/conversations/medialib/extensions/View.kt @@ -1,5 +1,6 @@ package eu.siacs.conversations.medialib.extensions +import android.view.HapticFeedbackConstants import android.view.View import android.view.ViewTreeObserver diff --git a/src/main/java/eu/siacs/conversations/medialib/helpers/Config.kt b/src/main/java/eu/siacs/conversations/medialib/helpers/Config.kt index b7562a847..04121f567 100644 --- a/src/main/java/eu/siacs/conversations/medialib/helpers/Config.kt +++ b/src/main/java/eu/siacs/conversations/medialib/helpers/Config.kt @@ -3,7 +3,7 @@ package eu.siacs.conversations.medialib.helpers import android.content.Context import android.graphics.Color import eu.siacs.conversations.R -import java.util.LinkedList +import java.util.* class Config(private val context: Context) { protected val prefs = context.getSharedPreferences("media_config_prefs", Context.MODE_PRIVATE) diff --git a/src/main/java/eu/siacs/conversations/medialib/helpers/FilterThumbnailsManager.kt b/src/main/java/eu/siacs/conversations/medialib/helpers/FilterThumbnailsManager.kt index 390192dd7..7501d1a89 100644 --- a/src/main/java/eu/siacs/conversations/medialib/helpers/FilterThumbnailsManager.kt +++ b/src/main/java/eu/siacs/conversations/medialib/helpers/FilterThumbnailsManager.kt @@ -2,6 +2,7 @@ package eu.siacs.conversations.medialib.helpers import android.graphics.Bitmap import eu.siacs.conversations.medialib.models.FilterItem +import java.util.* class FilterThumbnailsManager { private var filterThumbnails = ArrayList(10) diff --git a/src/main/java/eu/siacs/conversations/medialib/views/ColorPickerSquare.kt b/src/main/java/eu/siacs/conversations/medialib/views/ColorPickerSquare.kt index 1babad6e9..9cc6d37ab 100644 --- a/src/main/java/eu/siacs/conversations/medialib/views/ColorPickerSquare.kt +++ b/src/main/java/eu/siacs/conversations/medialib/views/ColorPickerSquare.kt @@ -2,13 +2,7 @@ package eu.siacs.conversations.medialib.views import android.annotation.SuppressLint import android.content.Context -import android.graphics.Canvas -import android.graphics.Color -import android.graphics.ComposeShader -import android.graphics.LinearGradient -import android.graphics.Paint -import android.graphics.PorterDuff -import android.graphics.Shader +import android.graphics.* import android.graphics.Shader.TileMode import android.util.AttributeSet import android.view.View diff --git a/src/main/java/eu/siacs/conversations/medialib/views/EditorDrawCanvas.kt b/src/main/java/eu/siacs/conversations/medialib/views/EditorDrawCanvas.kt index 474a52853..7e55ee5f3 100644 --- a/src/main/java/eu/siacs/conversations/medialib/views/EditorDrawCanvas.kt +++ b/src/main/java/eu/siacs/conversations/medialib/views/EditorDrawCanvas.kt @@ -1,11 +1,7 @@ package eu.siacs.conversations.medialib.views import android.content.Context -import android.graphics.Bitmap -import android.graphics.Canvas -import android.graphics.Color -import android.graphics.Paint -import android.graphics.Path +import android.graphics.* import android.util.AttributeSet import android.view.MotionEvent import android.view.View diff --git a/src/main/java/eu/siacs/conversations/parser/PresenceParser.java b/src/main/java/eu/siacs/conversations/parser/PresenceParser.java index 43c850caf..e2bab7860 100644 --- a/src/main/java/eu/siacs/conversations/parser/PresenceParser.java +++ b/src/main/java/eu/siacs/conversations/parser/PresenceParser.java @@ -2,11 +2,6 @@ package eu.siacs.conversations.parser; import android.util.Log; -import org.openintents.openpgp.util.OpenPgpUtils; - -import java.util.ArrayList; -import java.util.List; - import eu.siacs.conversations.Config; import eu.siacs.conversations.crypto.PgpEngine; import eu.siacs.conversations.crypto.axolotl.AxolotlService; @@ -28,6 +23,11 @@ import eu.siacs.conversations.xmpp.OnPresencePacketReceived; import eu.siacs.conversations.xmpp.pep.Avatar; import eu.siacs.conversations.xmpp.stanzas.PresencePacket; +import org.openintents.openpgp.util.OpenPgpUtils; + +import java.util.ArrayList; +import java.util.List; + public class PresenceParser extends AbstractParser implements OnPresencePacketReceived { public PresenceParser(XmppConnectionService service) { diff --git a/src/main/java/eu/siacs/conversations/persistance/DatabaseBackend.java b/src/main/java/eu/siacs/conversations/persistance/DatabaseBackend.java index 96698e1c8..41ab36dff 100644 --- a/src/main/java/eu/siacs/conversations/persistance/DatabaseBackend.java +++ b/src/main/java/eu/siacs/conversations/persistance/DatabaseBackend.java @@ -34,6 +34,7 @@ import java.security.cert.CertificateException; import java.security.cert.CertificateFactory; import java.security.cert.X509Certificate; import java.util.ArrayList; +import java.util.Collections; import java.util.HashMap; import java.util.HashSet; import java.util.List; diff --git a/src/main/java/eu/siacs/conversations/services/AbstractConnectionManager.java b/src/main/java/eu/siacs/conversations/services/AbstractConnectionManager.java index e1a0b490d..747189ff7 100644 --- a/src/main/java/eu/siacs/conversations/services/AbstractConnectionManager.java +++ b/src/main/java/eu/siacs/conversations/services/AbstractConnectionManager.java @@ -1,7 +1,5 @@ package eu.siacs.conversations.services; -import static eu.siacs.conversations.entities.Transferable.VALID_CRYPTO_EXTENSIONS; - import android.content.Context; import android.net.ConnectivityManager; import android.net.Network; @@ -41,6 +39,8 @@ import okio.BufferedSink; import okio.Okio; import okio.Source; +import static eu.siacs.conversations.entities.Transferable.VALID_CRYPTO_EXTENSIONS; + public class AbstractConnectionManager { private static final int UI_REFRESH_THRESHOLD = 250; diff --git a/src/main/java/eu/siacs/conversations/services/AbstractQuickConversationsService.java b/src/main/java/eu/siacs/conversations/services/AbstractQuickConversationsService.java index 23a62ab48..8f6c3c1f2 100644 --- a/src/main/java/eu/siacs/conversations/services/AbstractQuickConversationsService.java +++ b/src/main/java/eu/siacs/conversations/services/AbstractQuickConversationsService.java @@ -7,10 +7,10 @@ import android.content.pm.PackageManager; import com.google.common.collect.Iterables; -import java.util.Arrays; - import eu.siacs.conversations.BuildConfig; +import java.util.Arrays; + public abstract class AbstractQuickConversationsService { public static final String SMS_RETRIEVED_ACTION = diff --git a/src/main/java/eu/siacs/conversations/services/AppRTCAudioManager.java b/src/main/java/eu/siacs/conversations/services/AppRTCAudioManager.java index 639bde1a5..21e2389c3 100644 --- a/src/main/java/eu/siacs/conversations/services/AppRTCAudioManager.java +++ b/src/main/java/eu/siacs/conversations/services/AppRTCAudioManager.java @@ -24,6 +24,10 @@ import androidx.core.content.ContextCompat; import com.google.common.collect.ImmutableSet; +import eu.siacs.conversations.Config; +import eu.siacs.conversations.utils.AppRTCUtils; +import eu.siacs.conversations.xmpp.jingle.JingleConnectionManager; + import org.webrtc.ThreadUtils; import java.util.HashSet; @@ -31,10 +35,6 @@ import java.util.Set; import java.util.concurrent.ScheduledFuture; import java.util.concurrent.TimeUnit; -import eu.siacs.conversations.Config; -import eu.siacs.conversations.utils.AppRTCUtils; -import eu.siacs.conversations.xmpp.jingle.JingleConnectionManager; - /** AppRTCAudioManager manages all audio related parts of the AppRTC demo. */ public class AppRTCAudioManager { diff --git a/src/main/java/eu/siacs/conversations/services/CallIntegration.java b/src/main/java/eu/siacs/conversations/services/CallIntegration.java index 1a2859bdb..28cdb36e5 100644 --- a/src/main/java/eu/siacs/conversations/services/CallIntegration.java +++ b/src/main/java/eu/siacs/conversations/services/CallIntegration.java @@ -20,13 +20,6 @@ import com.google.common.collect.ImmutableSet; import com.google.common.collect.Iterables; import com.google.common.collect.Lists; -import java.util.Arrays; -import java.util.Collections; -import java.util.List; -import java.util.Set; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.atomic.AtomicBoolean; - import eu.siacs.conversations.Config; import eu.siacs.conversations.R; import eu.siacs.conversations.ui.util.MainThreadExecutor; @@ -34,6 +27,13 @@ import eu.siacs.conversations.xmpp.Jid; import eu.siacs.conversations.xmpp.jingle.JingleConnectionManager; import eu.siacs.conversations.xmpp.jingle.Media; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import java.util.Set; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicBoolean; + public class CallIntegration extends Connection { private static final List BROKEN_DEVICE_MODELS = diff --git a/src/main/java/eu/siacs/conversations/services/CallIntegrationConnectionService.java b/src/main/java/eu/siacs/conversations/services/CallIntegrationConnectionService.java index b2779be76..95f1f6785 100644 --- a/src/main/java/eu/siacs/conversations/services/CallIntegrationConnectionService.java +++ b/src/main/java/eu/siacs/conversations/services/CallIntegrationConnectionService.java @@ -28,17 +28,6 @@ import com.google.common.collect.ImmutableSet; import com.google.common.util.concurrent.ListenableFuture; import com.google.common.util.concurrent.SettableFuture; -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; -import java.util.Set; -import java.util.UUID; -import java.util.concurrent.ExecutionException; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.TimeoutException; - import eu.siacs.conversations.Config; import eu.siacs.conversations.R; import eu.siacs.conversations.entities.Account; @@ -51,6 +40,17 @@ import eu.siacs.conversations.xmpp.jingle.Media; import eu.siacs.conversations.xmpp.jingle.RtpEndUserState; import eu.siacs.conversations.xmpp.jingle.stanzas.Reason; +import java.util.Arrays; +import java.util.Collection; +import java.util.Collections; +import java.util.Set; +import java.util.UUID; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.TimeoutException; + public class CallIntegrationConnectionService extends ConnectionService { private static final String EXTRA_ADDRESS = "eu.siacs.conversations.address"; diff --git a/src/main/java/eu/siacs/conversations/services/ChannelDiscoveryService.java b/src/main/java/eu/siacs/conversations/services/ChannelDiscoveryService.java index 95e4dc494..3ca6bfde4 100644 --- a/src/main/java/eu/siacs/conversations/services/ChannelDiscoveryService.java +++ b/src/main/java/eu/siacs/conversations/services/ChannelDiscoveryService.java @@ -11,6 +11,28 @@ import com.google.common.base.Strings; import com.google.common.cache.Cache; import com.google.common.cache.CacheBuilder; +import eu.siacs.conversations.Config; +import eu.siacs.conversations.crypto.TrustManagers; +import eu.siacs.conversations.entities.Account; +import eu.siacs.conversations.entities.Room; +import eu.siacs.conversations.http.HttpConnectionManager; +import eu.siacs.conversations.http.services.MuclumbusService; +import eu.siacs.conversations.parser.IqParser; +import eu.siacs.conversations.utils.TLSSocketFactory; +import eu.siacs.conversations.xmpp.Jid; +import eu.siacs.conversations.xmpp.OnIqPacketReceived; +import eu.siacs.conversations.xmpp.XmppConnection; +import eu.siacs.conversations.xmpp.stanzas.IqPacket; + +import okhttp3.OkHttpClient; +import okhttp3.ResponseBody; + +import retrofit2.Call; +import retrofit2.Callback; +import retrofit2.Response; +import retrofit2.Retrofit; +import retrofit2.converter.gson.GsonConverterFactory; + import java.io.IOException; import java.security.KeyManagementException; import java.security.KeyStoreException; @@ -28,26 +50,6 @@ import java.util.concurrent.atomic.AtomicInteger; import javax.net.ssl.SSLSocketFactory; import javax.net.ssl.X509TrustManager; -import eu.siacs.conversations.Config; -import eu.siacs.conversations.crypto.TrustManagers; -import eu.siacs.conversations.entities.Account; -import eu.siacs.conversations.entities.Room; -import eu.siacs.conversations.http.HttpConnectionManager; -import eu.siacs.conversations.http.services.MuclumbusService; -import eu.siacs.conversations.parser.IqParser; -import eu.siacs.conversations.utils.TLSSocketFactory; -import eu.siacs.conversations.xmpp.Jid; -import eu.siacs.conversations.xmpp.OnIqPacketReceived; -import eu.siacs.conversations.xmpp.XmppConnection; -import eu.siacs.conversations.xmpp.stanzas.IqPacket; -import okhttp3.OkHttpClient; -import okhttp3.ResponseBody; -import retrofit2.Call; -import retrofit2.Callback; -import retrofit2.Response; -import retrofit2.Retrofit; -import retrofit2.converter.gson.GsonConverterFactory; - public class ChannelDiscoveryService { private final XmppConnectionService service; diff --git a/src/main/java/eu/siacs/conversations/services/MemorizingTrustManager.java b/src/main/java/eu/siacs/conversations/services/MemorizingTrustManager.java index baaf0dbcd..d05fa4ac3 100644 --- a/src/main/java/eu/siacs/conversations/services/MemorizingTrustManager.java +++ b/src/main/java/eu/siacs/conversations/services/MemorizingTrustManager.java @@ -48,6 +48,17 @@ import com.google.common.base.Preconditions; import com.google.common.io.ByteStreams; import com.google.common.io.CharStreams; +import eu.siacs.conversations.Config; +import eu.siacs.conversations.R; +import eu.siacs.conversations.crypto.BundledTrustManager; +import eu.siacs.conversations.crypto.CombiningTrustManager; +import eu.siacs.conversations.crypto.TrustManagers; +import eu.siacs.conversations.crypto.XmppDomainVerifier; +import eu.siacs.conversations.entities.MTMDecision; +import eu.siacs.conversations.http.HttpConnectionManager; +import eu.siacs.conversations.persistance.FileBackend; +import eu.siacs.conversations.ui.MemorizingActivity; + import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; @@ -80,15 +91,6 @@ import javax.net.ssl.TrustManager; import javax.net.ssl.TrustManagerFactory; import javax.net.ssl.X509TrustManager; -import eu.siacs.conversations.Config; -import eu.siacs.conversations.R; -import eu.siacs.conversations.crypto.TrustManagers; -import eu.siacs.conversations.crypto.XmppDomainVerifier; -import eu.siacs.conversations.entities.MTMDecision; -import eu.siacs.conversations.http.HttpConnectionManager; -import eu.siacs.conversations.persistance.FileBackend; -import eu.siacs.conversations.ui.MemorizingActivity; - /** * A X509 trust manager implementation which asks the user about invalid certificates and memorizes * their decision. diff --git a/src/main/java/eu/siacs/conversations/services/NotificationService.java b/src/main/java/eu/siacs/conversations/services/NotificationService.java index 27dd63475..7027ee2cc 100644 --- a/src/main/java/eu/siacs/conversations/services/NotificationService.java +++ b/src/main/java/eu/siacs/conversations/services/NotificationService.java @@ -42,6 +42,7 @@ import androidx.core.content.ContextCompat; import androidx.core.content.pm.ShortcutInfoCompat; import androidx.core.graphics.drawable.IconCompat; +import com.google.android.material.color.MaterialColors; import com.google.common.base.Joiner; import com.google.common.base.Optional; import com.google.common.base.Splitter; @@ -50,21 +51,6 @@ import com.google.common.collect.ImmutableMap; import com.google.common.collect.Iterables; import com.google.common.primitives.Ints; -import java.io.File; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.HashMap; -import java.util.Iterator; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.concurrent.atomic.AtomicInteger; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - import eu.siacs.conversations.AppSettings; import eu.siacs.conversations.Config; import eu.siacs.conversations.R; @@ -87,6 +73,21 @@ import eu.siacs.conversations.xmpp.XmppConnection; import eu.siacs.conversations.xmpp.jingle.AbstractJingleConnection; import eu.siacs.conversations.xmpp.jingle.Media; +import java.io.File; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.HashMap; +import java.util.Iterator; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.concurrent.atomic.AtomicInteger; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + public class NotificationService { public static final Object CATCHUP_LOCK = new Object(); diff --git a/src/main/java/eu/siacs/conversations/services/ShortcutService.java b/src/main/java/eu/siacs/conversations/services/ShortcutService.java index 8cb67cfdd..41fdbf754 100644 --- a/src/main/java/eu/siacs/conversations/services/ShortcutService.java +++ b/src/main/java/eu/siacs/conversations/services/ShortcutService.java @@ -11,6 +11,7 @@ import android.os.Build; import android.util.Log; import androidx.annotation.NonNull; +import androidx.annotation.RequiresApi; import androidx.core.content.pm.ShortcutInfoCompat; import androidx.core.graphics.drawable.IconCompat; diff --git a/src/main/java/eu/siacs/conversations/services/UnifiedPushBroker.java b/src/main/java/eu/siacs/conversations/services/UnifiedPushBroker.java index ed54c379b..4aab05cee 100644 --- a/src/main/java/eu/siacs/conversations/services/UnifiedPushBroker.java +++ b/src/main/java/eu/siacs/conversations/services/UnifiedPushBroker.java @@ -23,13 +23,6 @@ import com.google.common.util.concurrent.Futures; import com.google.common.util.concurrent.ListenableFuture; import com.google.common.util.concurrent.MoreExecutors; -import java.nio.charset.StandardCharsets; -import java.text.ParseException; -import java.util.List; -import java.util.concurrent.Executors; -import java.util.concurrent.ScheduledExecutorService; -import java.util.concurrent.TimeUnit; - import eu.siacs.conversations.Config; import eu.siacs.conversations.R; import eu.siacs.conversations.entities.Account; @@ -41,6 +34,12 @@ import eu.siacs.conversations.xml.Namespace; import eu.siacs.conversations.xmpp.Jid; import eu.siacs.conversations.xmpp.stanzas.IqPacket; import eu.siacs.conversations.xmpp.stanzas.PresencePacket; +import java.nio.charset.StandardCharsets; +import java.text.ParseException; +import java.util.List; +import java.util.concurrent.Executors; +import java.util.concurrent.ScheduledExecutorService; +import java.util.concurrent.TimeUnit; public class UnifiedPushBroker { diff --git a/src/main/java/eu/siacs/conversations/ui/AboutActivity.java b/src/main/java/eu/siacs/conversations/ui/AboutActivity.java index 6f2e0d80e..59a60f282 100644 --- a/src/main/java/eu/siacs/conversations/ui/AboutActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/AboutActivity.java @@ -1,7 +1,5 @@ package eu.siacs.conversations.ui; -import static eu.siacs.conversations.ui.XmppActivity.configureActionBar; - import android.os.Bundle; import androidx.appcompat.app.AppCompatActivity; @@ -10,6 +8,8 @@ import eu.siacs.conversations.R; import eu.siacs.conversations.ui.util.SettingsUtils; import eu.siacs.conversations.utils.ThemeHelper; +import static eu.siacs.conversations.ui.XmppActivity.configureActionBar; + public class AboutActivity extends AppCompatActivity { @Override diff --git a/src/main/java/eu/siacs/conversations/ui/AbstractSearchableListItemActivity.java b/src/main/java/eu/siacs/conversations/ui/AbstractSearchableListItemActivity.java index 3ca8dd114..0479598f8 100644 --- a/src/main/java/eu/siacs/conversations/ui/AbstractSearchableListItemActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/AbstractSearchableListItemActivity.java @@ -9,6 +9,7 @@ import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.inputmethod.InputMethodManager; +import android.widget.ArrayAdapter; import android.widget.EditText; import android.widget.ListView; import android.widget.TextView; diff --git a/src/main/java/eu/siacs/conversations/ui/Activities.java b/src/main/java/eu/siacs/conversations/ui/Activities.java index 894931008..d95d6b4ac 100644 --- a/src/main/java/eu/siacs/conversations/ui/Activities.java +++ b/src/main/java/eu/siacs/conversations/ui/Activities.java @@ -5,7 +5,6 @@ import android.content.Context; import android.content.res.Configuration; import android.os.Build; import android.view.View; - import com.google.android.material.elevation.SurfaceColors; public final class Activities { diff --git a/src/main/java/eu/siacs/conversations/ui/BlockContactDialog.java b/src/main/java/eu/siacs/conversations/ui/BlockContactDialog.java index 013f314b9..04678c3c7 100644 --- a/src/main/java/eu/siacs/conversations/ui/BlockContactDialog.java +++ b/src/main/java/eu/siacs/conversations/ui/BlockContactDialog.java @@ -4,6 +4,7 @@ import android.view.View; import android.widget.Toast; import androidx.annotation.StringRes; +import androidx.appcompat.app.AlertDialog; import androidx.databinding.DataBindingUtil; import com.google.android.material.dialog.MaterialAlertDialogBuilder; diff --git a/src/main/java/eu/siacs/conversations/ui/ChooseAccountForProfilePictureActivity.java b/src/main/java/eu/siacs/conversations/ui/ChooseAccountForProfilePictureActivity.java index 7eca2a85d..71662589c 100644 --- a/src/main/java/eu/siacs/conversations/ui/ChooseAccountForProfilePictureActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/ChooseAccountForProfilePictureActivity.java @@ -7,14 +7,14 @@ import android.widget.Toast; import androidx.databinding.DataBindingUtil; -import java.util.ArrayList; -import java.util.List; - import eu.siacs.conversations.R; import eu.siacs.conversations.databinding.ActivityManageAccountsBinding; import eu.siacs.conversations.entities.Account; import eu.siacs.conversations.ui.adapter.AccountAdapter; +import java.util.ArrayList; +import java.util.List; + public class ChooseAccountForProfilePictureActivity extends XmppActivity { protected final List accountList = new ArrayList<>(); diff --git a/src/main/java/eu/siacs/conversations/ui/ChooseContactActivity.java b/src/main/java/eu/siacs/conversations/ui/ChooseContactActivity.java index 867381d2b..41237f392 100644 --- a/src/main/java/eu/siacs/conversations/ui/ChooseContactActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/ChooseContactActivity.java @@ -32,6 +32,7 @@ import java.util.HashSet; import java.util.List; import java.util.Set; +import eu.siacs.conversations.Config; import eu.siacs.conversations.R; import eu.siacs.conversations.entities.Account; import eu.siacs.conversations.entities.Contact; diff --git a/src/main/java/eu/siacs/conversations/ui/ConferenceDetailsActivity.java b/src/main/java/eu/siacs/conversations/ui/ConferenceDetailsActivity.java index aa89614d7..dd80bf8bd 100644 --- a/src/main/java/eu/siacs/conversations/ui/ConferenceDetailsActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/ConferenceDetailsActivity.java @@ -1,8 +1,5 @@ package eu.siacs.conversations.ui; -import static eu.siacs.conversations.entities.Bookmark.printableValue; -import static eu.siacs.conversations.utils.StringUtils.changed; - import android.app.Activity; import android.app.PendingIntent; import android.content.Context; @@ -32,6 +29,7 @@ import java.util.Map; import java.util.concurrent.atomic.AtomicInteger; import java.util.stream.Collectors; +import eu.siacs.conversations.Config; import eu.siacs.conversations.R; import eu.siacs.conversations.databinding.ActivityMucDetailsBinding; import eu.siacs.conversations.entities.Account; @@ -64,6 +62,9 @@ import eu.siacs.conversations.utils.XmppUri; 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.utils.StringUtils.changed; + public class ConferenceDetailsActivity extends XmppActivity implements OnConversationUpdate, OnMucRosterUpdate, XmppConnectionService.OnAffiliationChanged, XmppConnectionService.OnConfigurationPushed, XmppConnectionService.OnRoomDestroy, TextWatcher, OnMediaLoaded { public static final String ACTION_VIEW_MUC = "view_muc"; diff --git a/src/main/java/eu/siacs/conversations/ui/ContactDetailsActivity.java b/src/main/java/eu/siacs/conversations/ui/ContactDetailsActivity.java index 4f934a8ef..a932a400b 100644 --- a/src/main/java/eu/siacs/conversations/ui/ContactDetailsActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/ContactDetailsActivity.java @@ -7,6 +7,7 @@ import android.content.DialogInterface; import android.content.Intent; import android.content.SharedPreferences; import android.content.pm.PackageManager; +import android.graphics.drawable.Drawable; import android.content.res.ColorStateList; import android.net.Uri; import android.os.Build; @@ -18,12 +19,14 @@ import android.provider.ContactsContract.Intents; import android.text.Spannable; import android.text.SpannableString; import android.text.style.RelativeSizeSpan; +import android.util.TypedValue; +import android.view.inputmethod.InputMethodManager; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.View.OnClickListener; -import android.view.inputmethod.InputMethodManager; +import android.view.ViewGroup; import android.widget.ArrayAdapter; import android.widget.CompoundButton; import android.widget.CompoundButton.OnCheckedChangeListener; @@ -38,6 +41,7 @@ import androidx.core.view.ViewCompat; import androidx.databinding.DataBindingUtil; import com.google.android.material.color.MaterialColors; +import com.google.android.material.dialog.MaterialAlertDialogBuilder; import com.google.common.collect.ImmutableList; import com.google.common.primitives.Ints; @@ -51,6 +55,7 @@ import java.util.List; import java.util.Map; import java.util.stream.Collectors; +import eu.siacs.conversations.AppSettings; import eu.siacs.conversations.Config; import eu.siacs.conversations.R; import eu.siacs.conversations.crypto.axolotl.AxolotlService; @@ -82,6 +87,7 @@ import eu.siacs.conversations.utils.PhoneNumberUtilWrapper; import eu.siacs.conversations.utils.UIHelper; import eu.siacs.conversations.utils.XEP0392Helper; import eu.siacs.conversations.utils.XmppUri; +import eu.siacs.conversations.xml.Element; import eu.siacs.conversations.xml.Namespace; import eu.siacs.conversations.xmpp.Jid; import eu.siacs.conversations.xmpp.OnKeyStatusUpdated; diff --git a/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java b/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java index 8e23da5bc..da5231357 100644 --- a/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java @@ -6,6 +6,8 @@ import android.os.Bundle; import androidx.annotation.Nullable; import androidx.appcompat.app.AppCompatActivity; +import eu.siacs.conversations.ui.util.SettingsUtils; + public class ConversationActivity extends AppCompatActivity { @Override diff --git a/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java b/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java index 1cde83fdd..12fcbfc52 100644 --- a/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java +++ b/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java @@ -18,6 +18,8 @@ import android.app.FragmentManager; import android.app.PendingIntent; import android.app.ProgressDialog; import android.content.ActivityNotFoundException; +import android.content.ContentResolver; +import android.content.ContentValues; import android.content.Context; import android.content.DialogInterface; import android.content.Intent; @@ -25,9 +27,11 @@ import android.content.IntentSender.SendIntentException; import android.content.SharedPreferences; import android.content.pm.PackageManager; import android.graphics.drawable.Drawable; +import android.content.res.ColorStateList; import android.net.Uri; import android.os.Build; import android.os.Bundle; +import android.os.Environment; import android.os.Handler; import android.os.SystemClock; import android.os.VibrationEffect; @@ -78,6 +82,9 @@ import androidx.viewpager.widget.PagerAdapter; import com.google.common.base.Optional; import com.google.common.collect.ImmutableList; +import org.jetbrains.annotations.NotNull; + +import java.net.URL; import java.util.AbstractMap; import java.util.ArrayList; import java.util.Arrays; @@ -86,6 +93,7 @@ import java.util.Collections; import java.util.Comparator; import java.util.HashSet; import java.util.Iterator; +import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.Set; @@ -161,6 +169,19 @@ import eu.siacs.conversations.xmpp.jingle.Media; import eu.siacs.conversations.xmpp.jingle.OngoingRtpSession; import eu.siacs.conversations.xmpp.jingle.RtpCapability; import eu.siacs.conversations.xmpp.stanzas.IqPacket; +import eu.siacs.conversations.xmpp.jingle.RtpEndUserState; + + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.Collections; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Set; +import java.util.UUID; +import java.util.concurrent.atomic.AtomicBoolean; public class ConversationFragment extends XmppFragment implements EditMessage.KeyboardListener, diff --git a/src/main/java/eu/siacs/conversations/ui/ConversationsActivity.java b/src/main/java/eu/siacs/conversations/ui/ConversationsActivity.java index b74456fa9..18d9313ca 100644 --- a/src/main/java/eu/siacs/conversations/ui/ConversationsActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/ConversationsActivity.java @@ -69,6 +69,7 @@ import java.util.Arrays; import java.util.HashSet; import java.util.List; import java.util.Set; +import java.util.Objects; import java.util.concurrent.atomic.AtomicBoolean; import eu.siacs.conversations.Config; diff --git a/src/main/java/eu/siacs/conversations/ui/ConversationsOverviewFragment.java b/src/main/java/eu/siacs/conversations/ui/ConversationsOverviewFragment.java index eb63a72a6..89f121de1 100644 --- a/src/main/java/eu/siacs/conversations/ui/ConversationsOverviewFragment.java +++ b/src/main/java/eu/siacs/conversations/ui/ConversationsOverviewFragment.java @@ -29,9 +29,6 @@ package eu.siacs.conversations.ui; -import static androidx.recyclerview.widget.ItemTouchHelper.LEFT; -import static androidx.recyclerview.widget.ItemTouchHelper.RIGHT; - import android.app.Activity; import android.app.AlertDialog; import android.app.Fragment; @@ -60,6 +57,7 @@ import com.google.common.base.Optional; import com.google.common.collect.Collections2; import java.util.ArrayList; +import java.util.Collections; import java.util.Comparator; import java.util.List; import java.util.Map; @@ -76,8 +74,9 @@ import eu.siacs.conversations.entities.Contact; import eu.siacs.conversations.entities.Conversation; import eu.siacs.conversations.entities.Conversational; import eu.siacs.conversations.entities.ListItem; -import eu.siacs.conversations.services.QuickConversationsService; +import eu.siacs.conversations.entities.Presence; import eu.siacs.conversations.services.XmppConnectionService; +import eu.siacs.conversations.services.QuickConversationsService; import eu.siacs.conversations.ui.adapter.ConversationAdapter; import eu.siacs.conversations.ui.interfaces.OnConversationArchived; import eu.siacs.conversations.ui.interfaces.OnConversationSelected; @@ -92,6 +91,9 @@ import eu.siacs.conversations.utils.EasyOnboardingInvite; import eu.siacs.conversations.utils.ThemeHelper; import eu.siacs.conversations.xmpp.jingle.OngoingRtpSession; +import static androidx.recyclerview.widget.ItemTouchHelper.LEFT; +import static androidx.recyclerview.widget.ItemTouchHelper.RIGHT; + public class ConversationsOverviewFragment extends XmppFragment { private static final String STATE_SCROLL_POSITION = ConversationsOverviewFragment.class.getName()+".scroll_state"; diff --git a/src/main/java/eu/siacs/conversations/ui/CreatePrivateGroupChatDialog.java b/src/main/java/eu/siacs/conversations/ui/CreatePrivateGroupChatDialog.java index a188d4e87..ae3406a2d 100644 --- a/src/main/java/eu/siacs/conversations/ui/CreatePrivateGroupChatDialog.java +++ b/src/main/java/eu/siacs/conversations/ui/CreatePrivateGroupChatDialog.java @@ -6,6 +6,7 @@ import android.os.Bundle; import android.widget.AutoCompleteTextView; import androidx.annotation.NonNull; +import androidx.appcompat.app.AlertDialog; import androidx.databinding.DataBindingUtil; import androidx.fragment.app.DialogFragment; diff --git a/src/main/java/eu/siacs/conversations/ui/EditAccountActivity.java b/src/main/java/eu/siacs/conversations/ui/EditAccountActivity.java index 62726128b..59b902d56 100644 --- a/src/main/java/eu/siacs/conversations/ui/EditAccountActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/EditAccountActivity.java @@ -41,13 +41,6 @@ import com.google.android.material.dialog.MaterialAlertDialogBuilder; import com.google.android.material.textfield.TextInputLayout; import com.google.common.base.CharMatcher; -import org.openintents.openpgp.util.OpenPgpUtils; - -import java.util.Arrays; -import java.util.List; -import java.util.Set; -import java.util.concurrent.atomic.AtomicInteger; - import eu.siacs.conversations.AppSettings; import eu.siacs.conversations.Config; import eu.siacs.conversations.R; @@ -85,8 +78,16 @@ import eu.siacs.conversations.xmpp.XmppConnection; import eu.siacs.conversations.xmpp.XmppConnection.Features; import eu.siacs.conversations.xmpp.forms.Data; import eu.siacs.conversations.xmpp.pep.Avatar; + import okhttp3.HttpUrl; +import org.openintents.openpgp.util.OpenPgpUtils; + +import java.util.Arrays; +import java.util.List; +import java.util.Set; +import java.util.concurrent.atomic.AtomicInteger; + public class EditAccountActivity extends OmemoActivity implements OnAccountUpdate, OnUpdateBlocklist, OnKeyStatusUpdated, OnCaptchaRequested, KeyChainAliasCallback, XmppConnectionService.OnShowErrorToast, XmppConnectionService.OnMamPreferencesFetched { diff --git a/src/main/java/eu/siacs/conversations/ui/EnterJidDialog.java b/src/main/java/eu/siacs/conversations/ui/EnterJidDialog.java index 20d76bb3a..f8ecfe9d6 100644 --- a/src/main/java/eu/siacs/conversations/ui/EnterJidDialog.java +++ b/src/main/java/eu/siacs/conversations/ui/EnterJidDialog.java @@ -2,6 +2,8 @@ package eu.siacs.conversations.ui; import android.app.Activity; import android.app.Dialog; +import android.content.DialogInterface.OnClickListener; +import android.content.DialogInterface; import android.os.Bundle; import android.text.Editable; import android.text.InputType; @@ -12,14 +14,15 @@ import android.view.View; import android.view.ViewGroup; import android.widget.AdapterView; import android.widget.ArrayAdapter; +import android.widget.TextView; import android.widget.ToggleButton; import androidx.annotation.NonNull; import androidx.appcompat.app.AlertDialog; import androidx.databinding.DataBindingUtil; import androidx.fragment.app.DialogFragment; -import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; +import androidx.recyclerview.widget.LinearLayoutManager; import java.util.ArrayList; import java.util.Arrays; @@ -28,20 +31,21 @@ import java.util.Collections; import java.util.List; import java.util.Map; +import io.michaelrocks.libphonenumber.android.NumberParseException; + import eu.siacs.conversations.R; import eu.siacs.conversations.databinding.DialogEnterJidBinding; +import eu.siacs.conversations.services.XmppConnectionService; import eu.siacs.conversations.entities.Account; import eu.siacs.conversations.entities.Contact; import eu.siacs.conversations.entities.Presence; import eu.siacs.conversations.entities.ServiceDiscoveryResult; -import eu.siacs.conversations.services.XmppConnectionService; import eu.siacs.conversations.ui.adapter.KnownHostsAdapter; import eu.siacs.conversations.ui.interfaces.OnBackendConnected; import eu.siacs.conversations.ui.util.DelayedHintHelper; import eu.siacs.conversations.utils.PhoneNumberUtilWrapper; import eu.siacs.conversations.xmpp.Jid; import eu.siacs.conversations.xmpp.OnGatewayResult; -import io.michaelrocks.libphonenumber.android.NumberParseException; public class EnterJidDialog extends DialogFragment implements OnBackendConnected, TextWatcher { diff --git a/src/main/java/eu/siacs/conversations/ui/ExtendedFabSizeChanger.java b/src/main/java/eu/siacs/conversations/ui/ExtendedFabSizeChanger.java index 3a6141f98..6c21f1a2d 100644 --- a/src/main/java/eu/siacs/conversations/ui/ExtendedFabSizeChanger.java +++ b/src/main/java/eu/siacs/conversations/ui/ExtendedFabSizeChanger.java @@ -2,7 +2,6 @@ package eu.siacs.conversations.ui; import androidx.annotation.NonNull; import androidx.recyclerview.widget.RecyclerView; - import com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton; public class ExtendedFabSizeChanger extends RecyclerView.OnScrollListener { diff --git a/src/main/java/eu/siacs/conversations/ui/JoinConferenceDialog.java b/src/main/java/eu/siacs/conversations/ui/JoinConferenceDialog.java index ad4cef1f6..7ed3fbd9d 100644 --- a/src/main/java/eu/siacs/conversations/ui/JoinConferenceDialog.java +++ b/src/main/java/eu/siacs/conversations/ui/JoinConferenceDialog.java @@ -6,6 +6,7 @@ import android.content.Context; import android.content.DialogInterface; import android.os.Bundle; import android.widget.AutoCompleteTextView; +import android.widget.Spinner; import androidx.annotation.NonNull; import androidx.appcompat.app.AlertDialog; diff --git a/src/main/java/eu/siacs/conversations/ui/LocationActivity.java b/src/main/java/eu/siacs/conversations/ui/LocationActivity.java index 359df08b1..141874b48 100644 --- a/src/main/java/eu/siacs/conversations/ui/LocationActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/LocationActivity.java @@ -1,6 +1,7 @@ package eu.siacs.conversations.ui; import android.Manifest; +import android.annotation.TargetApi; import android.content.Context; import android.content.SharedPreferences; import android.content.pm.PackageManager; @@ -9,6 +10,7 @@ import android.graphics.BitmapFactory; import android.location.Location; import android.location.LocationListener; import android.location.LocationManager; +import android.os.Build; import android.os.Bundle; import android.preference.PreferenceManager; import android.provider.Settings; @@ -37,6 +39,7 @@ import eu.siacs.conversations.services.QuickConversationsService; import eu.siacs.conversations.ui.util.LocationHelper; import eu.siacs.conversations.ui.widget.Marker; import eu.siacs.conversations.ui.widget.MyLocation; +import eu.siacs.conversations.ui.util.SettingsUtils; public abstract class LocationActivity extends ActionBarActivity implements LocationListener { protected LocationManager locationManager; diff --git a/src/main/java/eu/siacs/conversations/ui/MucUsersActivity.java b/src/main/java/eu/siacs/conversations/ui/MucUsersActivity.java index e3de9106c..72cad4cd0 100644 --- a/src/main/java/eu/siacs/conversations/ui/MucUsersActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/MucUsersActivity.java @@ -17,9 +17,11 @@ import androidx.annotation.NonNull; import androidx.databinding.DataBindingUtil; import com.google.common.collect.Collections2; +import com.google.common.collect.Lists; import com.google.common.collect.Ordering; import java.util.ArrayList; +import java.util.Collections; import java.util.Locale; import eu.siacs.conversations.R; diff --git a/src/main/java/eu/siacs/conversations/ui/OmemoActivity.java b/src/main/java/eu/siacs/conversations/ui/OmemoActivity.java index 027622b4c..ac7559769 100644 --- a/src/main/java/eu/siacs/conversations/ui/OmemoActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/OmemoActivity.java @@ -8,6 +8,7 @@ import android.widget.CompoundButton; import android.widget.LinearLayout; import android.widget.Toast; +import androidx.appcompat.app.AlertDialog; import androidx.databinding.DataBindingUtil; import com.google.android.material.color.MaterialColors; diff --git a/src/main/java/eu/siacs/conversations/ui/PublishGroupChatProfilePictureActivity.java b/src/main/java/eu/siacs/conversations/ui/PublishGroupChatProfilePictureActivity.java index fd5344ee2..8d686c36f 100644 --- a/src/main/java/eu/siacs/conversations/ui/PublishGroupChatProfilePictureActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/PublishGroupChatProfilePictureActivity.java @@ -29,8 +29,6 @@ package eu.siacs.conversations.ui; -import static eu.siacs.conversations.ui.PublishProfilePictureActivity.REQUEST_CHOOSE_PICTURE; - import android.content.Intent; import android.graphics.Bitmap; import android.net.Uri; @@ -42,8 +40,6 @@ import android.widget.Toast; import androidx.annotation.StringRes; import androidx.databinding.DataBindingUtil; -import com.canhub.cropper.CropImage; - import eu.siacs.conversations.Config; import eu.siacs.conversations.R; import eu.siacs.conversations.databinding.ActivityPublishProfilePictureBinding; @@ -51,6 +47,10 @@ import eu.siacs.conversations.entities.Conversation; import eu.siacs.conversations.ui.interfaces.OnAvatarPublication; import eu.siacs.conversations.ui.util.PendingItem; +import static eu.siacs.conversations.ui.PublishProfilePictureActivity.REQUEST_CHOOSE_PICTURE; + +import com.canhub.cropper.CropImage; + public class PublishGroupChatProfilePictureActivity extends XmppActivity implements OnAvatarPublication { private final PendingItem pendingConversationUuid = new PendingItem<>(); private ActivityPublishProfilePictureBinding binding; diff --git a/src/main/java/eu/siacs/conversations/ui/RecordingActivity.java b/src/main/java/eu/siacs/conversations/ui/RecordingActivity.java index 5f023b9c5..e4fdab63a 100644 --- a/src/main/java/eu/siacs/conversations/ui/RecordingActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/RecordingActivity.java @@ -23,13 +23,14 @@ import java.text.SimpleDateFormat; import java.util.Date; import java.util.Locale; import java.util.Objects; -import java.util.Set; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; +import java.util.Set; import eu.siacs.conversations.Config; import eu.siacs.conversations.R; import eu.siacs.conversations.databinding.ActivityRecordingBinding; +import eu.siacs.conversations.ui.util.SettingsUtils; import eu.siacs.conversations.utils.ThemeHelper; import eu.siacs.conversations.utils.TimeFrameUtils; diff --git a/src/main/java/eu/siacs/conversations/ui/RtpSessionActivity.java b/src/main/java/eu/siacs/conversations/ui/RtpSessionActivity.java index faec8af61..f83d8a0be 100644 --- a/src/main/java/eu/siacs/conversations/ui/RtpSessionActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/RtpSessionActivity.java @@ -1,8 +1,9 @@ package eu.siacs.conversations.ui; -import static java.util.Arrays.asList; import static eu.siacs.conversations.utils.PermissionUtils.getFirstDenied; +import static java.util.Arrays.asList; + import android.Manifest; import android.annotation.SuppressLint; import android.app.PictureInPictureParams; @@ -58,6 +59,7 @@ import eu.siacs.conversations.entities.Conversation; import eu.siacs.conversations.services.CallIntegration; import eu.siacs.conversations.services.CallIntegrationConnectionService; import eu.siacs.conversations.services.XmppConnectionService; +import eu.siacs.conversations.ui.widget.DialpadView; import eu.siacs.conversations.ui.util.AvatarWorkerTask; import eu.siacs.conversations.ui.util.MainThreadExecutor; import eu.siacs.conversations.ui.util.Rationals; @@ -73,6 +75,16 @@ import eu.siacs.conversations.xmpp.jingle.OngoingRtpSession; import eu.siacs.conversations.xmpp.jingle.RtpCapability; import eu.siacs.conversations.xmpp.jingle.RtpEndUserState; +import org.webrtc.RendererCommon; +import org.webrtc.SurfaceViewRenderer; +import org.webrtc.VideoTrack; + +import java.lang.ref.WeakReference; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import java.util.Set; + public class RtpSessionActivity extends XmppActivity implements XmppConnectionService.OnJingleRtpConnectionUpdate, eu.siacs.conversations.ui.widget.SurfaceViewRenderer.OnAspectRatioChanged { diff --git a/src/main/java/eu/siacs/conversations/ui/ScanActivity.java b/src/main/java/eu/siacs/conversations/ui/ScanActivity.java index 196dec28b..983f21dc8 100644 --- a/src/main/java/eu/siacs/conversations/ui/ScanActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/ScanActivity.java @@ -61,6 +61,7 @@ import java.util.Map; import eu.siacs.conversations.Config; import eu.siacs.conversations.R; import eu.siacs.conversations.ui.service.CameraManager; +import eu.siacs.conversations.ui.util.SettingsUtils; import eu.siacs.conversations.ui.widget.ScannerView; import eu.siacs.conversations.utils.ThemeHelper; diff --git a/src/main/java/eu/siacs/conversations/ui/SearchActivity.java b/src/main/java/eu/siacs/conversations/ui/SearchActivity.java index 2296fcf56..e78ff1534 100644 --- a/src/main/java/eu/siacs/conversations/ui/SearchActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/SearchActivity.java @@ -29,9 +29,6 @@ package eu.siacs.conversations.ui; -import static eu.siacs.conversations.ui.util.SoftKeyboardUtils.hideSoftKeyboard; -import static eu.siacs.conversations.ui.util.SoftKeyboardUtils.showKeyboard; - import android.app.PendingIntent; import android.content.Intent; import android.os.Bundle; @@ -47,6 +44,7 @@ import android.widget.AdapterView; import android.widget.EditText; import android.widget.Toast; +import androidx.core.content.ContextCompat; import androidx.databinding.DataBindingUtil; import com.google.android.material.color.MaterialColors; @@ -73,6 +71,10 @@ import eu.siacs.conversations.ui.util.PendingItem; import eu.siacs.conversations.ui.util.ShareUtil; import eu.siacs.conversations.utils.FtsUtils; import eu.siacs.conversations.utils.MessageUtils; +import eu.siacs.conversations.utils.UIHelper; + +import static eu.siacs.conversations.ui.util.SoftKeyboardUtils.hideSoftKeyboard; +import static eu.siacs.conversations.ui.util.SoftKeyboardUtils.showKeyboard; public class SearchActivity extends XmppActivity implements TextWatcher, OnSearchResultsAvailable, MessageAdapter.OnContactPictureClicked { diff --git a/src/main/java/eu/siacs/conversations/ui/SendLogActivity.java b/src/main/java/eu/siacs/conversations/ui/SendLogActivity.java index acb43795a..98cb6df5b 100644 --- a/src/main/java/eu/siacs/conversations/ui/SendLogActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/SendLogActivity.java @@ -63,6 +63,7 @@ import java.util.regex.Pattern; import eu.siacs.conversations.Config; import eu.siacs.conversations.R; +import eu.siacs.conversations.services.BarcodeProvider; public class SendLogActivity extends ActionBarActivity { public final static String TAG = "com.xtralogic.android.logcollector"; diff --git a/src/main/java/eu/siacs/conversations/ui/ShareLocationActivity.java b/src/main/java/eu/siacs/conversations/ui/ShareLocationActivity.java index 50ba4d8e0..c7ddcc01c 100644 --- a/src/main/java/eu/siacs/conversations/ui/ShareLocationActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/ShareLocationActivity.java @@ -14,11 +14,6 @@ import androidx.databinding.DataBindingUtil; import com.google.android.material.snackbar.Snackbar; import com.google.common.math.DoubleMath; -import org.osmdroid.api.IGeoPoint; -import org.osmdroid.util.GeoPoint; - -import java.math.RoundingMode; - import eu.siacs.conversations.Config; import eu.siacs.conversations.R; import eu.siacs.conversations.databinding.ActivityShareLocationBinding; @@ -27,6 +22,11 @@ import eu.siacs.conversations.ui.widget.Marker; import eu.siacs.conversations.ui.widget.MyLocation; import eu.siacs.conversations.utils.LocationProvider; +import org.osmdroid.api.IGeoPoint; +import org.osmdroid.util.GeoPoint; + +import java.math.RoundingMode; + public class ShareLocationActivity extends LocationActivity implements LocationListener { private Snackbar snackBar; diff --git a/src/main/java/eu/siacs/conversations/ui/ShareWithActivity.java b/src/main/java/eu/siacs/conversations/ui/ShareWithActivity.java index d0ac8c94a..fd7365669 100644 --- a/src/main/java/eu/siacs/conversations/ui/ShareWithActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/ShareWithActivity.java @@ -12,6 +12,7 @@ import android.widget.Toast; import androidx.annotation.NonNull; import androidx.databinding.DataBindingUtil; import androidx.recyclerview.widget.LinearLayoutManager; +import androidx.recyclerview.widget.RecyclerView; import java.util.ArrayList; import java.util.Comparator; @@ -31,6 +32,9 @@ import eu.siacs.conversations.services.XmppConnectionService; import eu.siacs.conversations.ui.adapter.ConversationAdapter; import eu.siacs.conversations.xmpp.Jid; +import java.util.ArrayList; +import java.util.List; + public class ShareWithActivity extends XmppActivity implements XmppConnectionService.OnConversationUpdate { diff --git a/src/main/java/eu/siacs/conversations/ui/ShowLocationActivity.java b/src/main/java/eu/siacs/conversations/ui/ShowLocationActivity.java index 0d8992eec..8ed7e1da6 100644 --- a/src/main/java/eu/siacs/conversations/ui/ShowLocationActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/ShowLocationActivity.java @@ -21,10 +21,6 @@ import androidx.databinding.DataBindingUtil; import com.google.common.base.Strings; import com.google.common.primitives.Doubles; -import org.osmdroid.util.GeoPoint; - -import java.util.Map; - import eu.siacs.conversations.Config; import eu.siacs.conversations.R; import eu.siacs.conversations.databinding.ActivityShowLocationBinding; @@ -35,6 +31,10 @@ import eu.siacs.conversations.ui.widget.MyLocation; import eu.siacs.conversations.utils.GeoHelper; import eu.siacs.conversations.utils.LocationProvider; +import org.osmdroid.util.GeoPoint; + +import java.util.Map; + public class ShowLocationActivity extends LocationActivity implements LocationListener { private GeoPoint loc = LocationProvider.FALLBACK; diff --git a/src/main/java/eu/siacs/conversations/ui/StartConversationActivity.java b/src/main/java/eu/siacs/conversations/ui/StartConversationActivity.java index 78bb65549..29d9b7a9e 100644 --- a/src/main/java/eu/siacs/conversations/ui/StartConversationActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/StartConversationActivity.java @@ -9,7 +9,11 @@ import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; import android.content.pm.PackageManager; +import android.content.res.Resources; import android.database.DataSetObserver; +import android.graphics.Color; +import android.graphics.drawable.ColorDrawable; +import android.graphics.drawable.Drawable; import android.net.Uri; import android.os.Build; import android.os.Bundle; @@ -21,6 +25,7 @@ import android.text.method.LinkMovementMethod; import android.util.AttributeSet; import android.util.Log; import android.util.Pair; +import android.util.TypedValue; import android.view.ContextMenu; import android.view.ContextMenu.ContextMenuInfo; import android.view.KeyEvent; @@ -29,6 +34,7 @@ import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; +import android.view.ViewParent; import android.view.inputmethod.InputMethodManager; import android.widget.AdapterView; import android.widget.AdapterView.AdapterContextMenuInfo; @@ -41,6 +47,8 @@ import android.widget.ExpandableListView; import android.widget.FrameLayout; import android.widget.ListAdapter; import android.widget.ListView; +import android.widget.Space; +import android.widget.Spinner; import android.widget.TextView; import android.widget.Toast; @@ -63,6 +71,7 @@ import androidx.viewpager.widget.PagerAdapter; import androidx.viewpager.widget.ViewPager; import com.google.android.material.textfield.TextInputLayout; +import com.google.common.collect.Iterables; import com.leinardi.android.speeddial.SpeedDialActionItem; import com.leinardi.android.speeddial.SpeedDialView; @@ -77,6 +86,7 @@ import java.util.Locale; import java.util.Map; import java.util.Set; import java.util.concurrent.atomic.AtomicBoolean; +import java.util.function.Function; import java.util.stream.Collectors; import eu.siacs.conversations.BuildConfig; @@ -102,6 +112,7 @@ import eu.siacs.conversations.ui.util.SoftKeyboardUtils; import eu.siacs.conversations.ui.util.StyledAttributes; import eu.siacs.conversations.ui.widget.SwipeRefreshListFragment; import eu.siacs.conversations.utils.AccountUtils; +import eu.siacs.conversations.utils.StringUtils; import eu.siacs.conversations.utils.UIHelper; import eu.siacs.conversations.utils.XmppUri; import eu.siacs.conversations.xmpp.Jid; diff --git a/src/main/java/eu/siacs/conversations/ui/TrustKeysActivity.java b/src/main/java/eu/siacs/conversations/ui/TrustKeysActivity.java index 7adcbe78a..ba069b9a5 100644 --- a/src/main/java/eu/siacs/conversations/ui/TrustKeysActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/TrustKeysActivity.java @@ -1,5 +1,6 @@ package eu.siacs.conversations.ui; +import android.app.AlertDialog; import android.content.Intent; import android.os.Bundle; import android.util.Log; @@ -15,15 +16,6 @@ import androidx.databinding.DataBindingUtil; import com.google.android.material.dialog.MaterialAlertDialogBuilder; -import org.whispersystems.libsignal.IdentityKey; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.concurrent.atomic.AtomicBoolean; - import eu.siacs.conversations.Config; import eu.siacs.conversations.R; import eu.siacs.conversations.crypto.OmemoSetting; @@ -41,6 +33,15 @@ import eu.siacs.conversations.utils.XmppUri; import eu.siacs.conversations.xmpp.Jid; import eu.siacs.conversations.xmpp.OnKeyStatusUpdated; +import org.whispersystems.libsignal.IdentityKey; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.concurrent.atomic.AtomicBoolean; + public class TrustKeysActivity extends OmemoActivity implements OnKeyStatusUpdated { private final Map ownKeysToTrust = new HashMap<>(); private final Map> foreignKeysToTrust = new HashMap<>(); diff --git a/src/main/java/eu/siacs/conversations/ui/UriHandlerActivity.java b/src/main/java/eu/siacs/conversations/ui/UriHandlerActivity.java index 30ae331fe..199847181 100644 --- a/src/main/java/eu/siacs/conversations/ui/UriHandlerActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/UriHandlerActivity.java @@ -18,11 +18,6 @@ import androidx.databinding.DataBindingUtil; import com.google.common.base.Strings; -import java.io.IOException; -import java.util.List; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - import eu.siacs.conversations.Config; import eu.siacs.conversations.R; import eu.siacs.conversations.databinding.ActivityUriHandlerBinding; @@ -34,12 +29,18 @@ import eu.siacs.conversations.utils.SignupUtils; import eu.siacs.conversations.utils.ThemeHelper; import eu.siacs.conversations.utils.XmppUri; import eu.siacs.conversations.xmpp.Jid; + import okhttp3.Call; import okhttp3.Callback; import okhttp3.HttpUrl; import okhttp3.Request; import okhttp3.Response; +import java.io.IOException; +import java.util.List; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + public class UriHandlerActivity extends BaseActivity { public static final String ACTION_SCAN_QR_CODE = "scan_qr_code"; diff --git a/src/main/java/eu/siacs/conversations/ui/XmppActivity.java b/src/main/java/eu/siacs/conversations/ui/XmppActivity.java index 8f6a4400d..82b2f4e08 100644 --- a/src/main/java/eu/siacs/conversations/ui/XmppActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/XmppActivity.java @@ -16,6 +16,7 @@ import android.content.ServiceConnection; import android.content.SharedPreferences; import android.content.pm.PackageManager; import android.content.pm.ResolveInfo; +import android.content.res.Configuration; import android.content.res.Resources; import android.graphics.Bitmap; import android.graphics.Point; @@ -83,12 +84,19 @@ import eu.siacs.conversations.ui.util.SettingsUtils; import eu.siacs.conversations.ui.util.SoftKeyboardUtils; import eu.siacs.conversations.utils.AccountUtils; import eu.siacs.conversations.utils.Compatibility; +import eu.siacs.conversations.utils.ExceptionHelper; import eu.siacs.conversations.utils.SignupUtils; import eu.siacs.conversations.utils.ThemeHelper; import eu.siacs.conversations.xmpp.Jid; import eu.siacs.conversations.xmpp.OnKeyStatusUpdated; import eu.siacs.conversations.xmpp.OnUpdateBlocklist; +import java.io.IOException; +import java.lang.ref.WeakReference; +import java.util.ArrayList; +import java.util.List; +import java.util.concurrent.RejectedExecutionException; + public abstract class XmppActivity extends ActionBarActivity { public static final String EXTRA_ACCOUNT = "account"; diff --git a/src/main/java/eu/siacs/conversations/ui/activity/SettingsActivity.java b/src/main/java/eu/siacs/conversations/ui/activity/SettingsActivity.java index ffc55d34d..7ac855534 100644 --- a/src/main/java/eu/siacs/conversations/ui/activity/SettingsActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/activity/SettingsActivity.java @@ -8,8 +8,6 @@ import androidx.preference.PreferenceFragmentCompat; import com.google.common.collect.ImmutableSet; -import java.util.Collections; - import eu.siacs.conversations.R; import eu.siacs.conversations.databinding.ActivitySettingsBinding; import eu.siacs.conversations.ui.Activities; @@ -18,6 +16,8 @@ import eu.siacs.conversations.ui.fragment.settings.MainSettingsFragment; import eu.siacs.conversations.ui.fragment.settings.NotificationsSettingsFragment; import eu.siacs.conversations.ui.fragment.settings.XmppPreferenceFragment; +import java.util.Collections; + public class SettingsActivity extends XmppActivity { @Override diff --git a/src/main/java/eu/siacs/conversations/ui/adapter/AccountAdapter.java b/src/main/java/eu/siacs/conversations/ui/adapter/AccountAdapter.java index 0e7c554e1..88475c580 100644 --- a/src/main/java/eu/siacs/conversations/ui/adapter/AccountAdapter.java +++ b/src/main/java/eu/siacs/conversations/ui/adapter/AccountAdapter.java @@ -10,14 +10,15 @@ import androidx.databinding.DataBindingUtil; import com.google.android.material.color.MaterialColors; -import java.util.List; - +import eu.siacs.conversations.Config; import eu.siacs.conversations.R; import eu.siacs.conversations.databinding.ItemAccountBinding; import eu.siacs.conversations.entities.Account; import eu.siacs.conversations.ui.XmppActivity; import eu.siacs.conversations.ui.util.AvatarWorkerTask; +import java.util.List; + public class AccountAdapter extends ArrayAdapter { private final XmppActivity activity; diff --git a/src/main/java/eu/siacs/conversations/ui/adapter/ChannelSearchResultAdapter.java b/src/main/java/eu/siacs/conversations/ui/adapter/ChannelSearchResultAdapter.java index c816c94fc..aa6fd1b78 100644 --- a/src/main/java/eu/siacs/conversations/ui/adapter/ChannelSearchResultAdapter.java +++ b/src/main/java/eu/siacs/conversations/ui/adapter/ChannelSearchResultAdapter.java @@ -13,8 +13,6 @@ import androidx.recyclerview.widget.DiffUtil; import androidx.recyclerview.widget.ListAdapter; import androidx.recyclerview.widget.RecyclerView; -import java.util.Locale; - import eu.siacs.conversations.R; import eu.siacs.conversations.databinding.ItemChannelDiscoveryBinding; import eu.siacs.conversations.entities.Room; @@ -22,6 +20,8 @@ import eu.siacs.conversations.ui.XmppActivity; import eu.siacs.conversations.ui.util.AvatarWorkerTask; import eu.siacs.conversations.xmpp.Jid; +import java.util.Locale; + public class ChannelSearchResultAdapter extends ListAdapter implements View.OnCreateContextMenuListener { private static final DiffUtil.ItemCallback DIFF = new DiffUtil.ItemCallback<>() { diff --git a/src/main/java/eu/siacs/conversations/ui/adapter/ConversationAdapter.java b/src/main/java/eu/siacs/conversations/ui/adapter/ConversationAdapter.java index 5083568c4..740db833e 100644 --- a/src/main/java/eu/siacs/conversations/ui/adapter/ConversationAdapter.java +++ b/src/main/java/eu/siacs/conversations/ui/adapter/ConversationAdapter.java @@ -2,6 +2,8 @@ package eu.siacs.conversations.ui.adapter; import android.content.Context; import android.content.SharedPreferences; +import android.content.res.TypedArray; +import android.database.DataSetObserver; import android.content.res.ColorStateList; import android.graphics.Typeface; import android.preference.PreferenceManager; @@ -19,6 +21,9 @@ import androidx.databinding.DataBindingUtil; import androidx.recyclerview.widget.RecyclerView; import com.google.common.base.Optional; +import com.google.common.base.Strings; + +import org.checkerframework.checker.units.qual.C; import java.util.ArrayList; import java.util.Collections; @@ -30,8 +35,9 @@ import java.util.Map; import java.util.Set; import eu.siacs.conversations.R; -import eu.siacs.conversations.databinding.ItemConversationBinding; +import eu.siacs.conversations.databinding.ConversationListRowBinding; import eu.siacs.conversations.entities.Account; +import eu.siacs.conversations.databinding.ItemConversationBinding; import eu.siacs.conversations.entities.Conversation; import eu.siacs.conversations.entities.Conversational; import eu.siacs.conversations.entities.ListItem; @@ -45,6 +51,8 @@ import eu.siacs.conversations.utils.UIHelper; import eu.siacs.conversations.xmpp.Jid; import eu.siacs.conversations.xmpp.jingle.OngoingRtpSession; +import java.util.List; + public class ConversationAdapter extends RecyclerView.Adapter { diff --git a/src/main/java/eu/siacs/conversations/ui/adapter/KnownHostsAdapter.java b/src/main/java/eu/siacs/conversations/ui/adapter/KnownHostsAdapter.java index 1e8df0740..b085cb964 100644 --- a/src/main/java/eu/siacs/conversations/ui/adapter/KnownHostsAdapter.java +++ b/src/main/java/eu/siacs/conversations/ui/adapter/KnownHostsAdapter.java @@ -9,14 +9,14 @@ import androidx.annotation.NonNull; import com.google.common.collect.ImmutableList; import com.google.common.collect.Ordering; +import eu.siacs.conversations.Config; + import java.util.ArrayList; import java.util.Collection; import java.util.List; import java.util.Locale; import java.util.regex.Pattern; -import eu.siacs.conversations.Config; - public class KnownHostsAdapter extends ArrayAdapter { private static final Pattern E164_PATTERN = Pattern.compile("^\\+[1-9]\\d{1,14}$"); diff --git a/src/main/java/eu/siacs/conversations/ui/adapter/ListItemAdapter.java b/src/main/java/eu/siacs/conversations/ui/adapter/ListItemAdapter.java index d9d9451af..4f9311392 100644 --- a/src/main/java/eu/siacs/conversations/ui/adapter/ListItemAdapter.java +++ b/src/main/java/eu/siacs/conversations/ui/adapter/ListItemAdapter.java @@ -22,8 +22,6 @@ import com.google.android.material.color.MaterialColors; import com.google.common.collect.ImmutableList; import com.google.common.primitives.Ints; -import java.util.List; - import eu.siacs.conversations.AppSettings; import eu.siacs.conversations.Config; import eu.siacs.conversations.R; @@ -38,6 +36,8 @@ import eu.siacs.conversations.utils.UIHelper; import eu.siacs.conversations.utils.XEP0392Helper; import eu.siacs.conversations.xmpp.Jid; +import java.util.List; + public class ListItemAdapter extends ArrayAdapter { protected XmppActivity activity; diff --git a/src/main/java/eu/siacs/conversations/ui/adapter/MediaAdapter.java b/src/main/java/eu/siacs/conversations/ui/adapter/MediaAdapter.java index 99378457a..7b3a35ab3 100644 --- a/src/main/java/eu/siacs/conversations/ui/adapter/MediaAdapter.java +++ b/src/main/java/eu/siacs/conversations/ui/adapter/MediaAdapter.java @@ -21,12 +21,6 @@ import androidx.recyclerview.widget.RecyclerView; import com.google.android.material.color.MaterialColors; import com.google.common.base.Strings; -import java.lang.ref.WeakReference; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.concurrent.RejectedExecutionException; - import eu.siacs.conversations.R; import eu.siacs.conversations.databinding.ItemMediaBinding; import eu.siacs.conversations.ui.XmppActivity; @@ -34,6 +28,12 @@ import eu.siacs.conversations.ui.util.Attachment; import eu.siacs.conversations.ui.util.ViewUtil; import eu.siacs.conversations.worker.ExportBackupWorker; +import java.lang.ref.WeakReference; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.concurrent.RejectedExecutionException; + public class MediaAdapter extends RecyclerView.Adapter { public static final List DOCUMENT_MIMES = diff --git a/src/main/java/eu/siacs/conversations/ui/adapter/MediaPreviewAdapter.java b/src/main/java/eu/siacs/conversations/ui/adapter/MediaPreviewAdapter.java index 6864a5f38..3aecd30fa 100644 --- a/src/main/java/eu/siacs/conversations/ui/adapter/MediaPreviewAdapter.java +++ b/src/main/java/eu/siacs/conversations/ui/adapter/MediaPreviewAdapter.java @@ -9,7 +9,9 @@ import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.Drawable; import android.net.Uri; import android.os.AsyncTask; +import android.util.Log; import android.view.LayoutInflater; +import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.Toast; @@ -20,11 +22,11 @@ import androidx.core.widget.ImageViewCompat; import androidx.databinding.DataBindingUtil; import androidx.recyclerview.widget.RecyclerView; +import eu.siacs.conversations.Config; import java.lang.ref.WeakReference; import java.util.ArrayList; import java.util.List; import java.util.concurrent.RejectedExecutionException; - import eu.siacs.conversations.R; import eu.siacs.conversations.databinding.ItemMediaPreviewBinding; import eu.siacs.conversations.persistance.FileBackend; @@ -33,6 +35,12 @@ import eu.siacs.conversations.ui.ShowLocationActivity; import eu.siacs.conversations.ui.XmppActivity; import eu.siacs.conversations.ui.util.Attachment; +import java.lang.ref.WeakReference; +import java.util.ArrayList; +import java.util.List; +import java.util.Locale; +import java.util.concurrent.RejectedExecutionException; + public class MediaPreviewAdapter extends RecyclerView.Adapter { diff --git a/src/main/java/eu/siacs/conversations/ui/fragment/settings/BackupSettingsFragment.java b/src/main/java/eu/siacs/conversations/ui/fragment/settings/BackupSettingsFragment.java index 69eeece69..f78577656 100644 --- a/src/main/java/eu/siacs/conversations/ui/fragment/settings/BackupSettingsFragment.java +++ b/src/main/java/eu/siacs/conversations/ui/fragment/settings/BackupSettingsFragment.java @@ -27,13 +27,13 @@ import com.google.android.material.dialog.MaterialAlertDialogBuilder; import com.google.common.base.Strings; import com.google.common.primitives.Longs; -import java.util.concurrent.TimeUnit; - import eu.siacs.conversations.Config; import eu.siacs.conversations.R; import eu.siacs.conversations.persistance.FileBackend; import eu.siacs.conversations.worker.ExportBackupWorker; +import java.util.concurrent.TimeUnit; + public class BackupSettingsFragment extends XmppPreferenceFragment { public static final String CREATE_ONE_OFF_BACKUP = "create_one_off_backup"; diff --git a/src/main/java/eu/siacs/conversations/ui/fragment/settings/SecuritySettingsFragment.java b/src/main/java/eu/siacs/conversations/ui/fragment/settings/SecuritySettingsFragment.java index 4252c7cfa..0ccf2679e 100644 --- a/src/main/java/eu/siacs/conversations/ui/fragment/settings/SecuritySettingsFragment.java +++ b/src/main/java/eu/siacs/conversations/ui/fragment/settings/SecuritySettingsFragment.java @@ -13,15 +13,15 @@ import androidx.preference.Preference; import com.google.android.material.dialog.MaterialAlertDialogBuilder; import com.google.common.base.Strings; -import java.security.KeyStoreException; -import java.util.ArrayList; -import java.util.Collections; - import eu.siacs.conversations.AppSettings; import eu.siacs.conversations.R; import eu.siacs.conversations.crypto.OmemoSetting; import eu.siacs.conversations.services.MemorizingTrustManager; +import java.security.KeyStoreException; +import java.util.ArrayList; +import java.util.Collections; + public class SecuritySettingsFragment extends XmppPreferenceFragment { private static final String REMOVE_TRUSTED_CERTIFICATES = "remove_trusted_certificates"; diff --git a/src/main/java/eu/siacs/conversations/ui/fragment/settings/UpSettingsFragment.java b/src/main/java/eu/siacs/conversations/ui/fragment/settings/UpSettingsFragment.java index cf9448f78..771acbbe1 100644 --- a/src/main/java/eu/siacs/conversations/ui/fragment/settings/UpSettingsFragment.java +++ b/src/main/java/eu/siacs/conversations/ui/fragment/settings/UpSettingsFragment.java @@ -12,15 +12,15 @@ import com.google.common.base.Strings; import com.google.common.collect.ImmutableList; import com.google.common.collect.Lists; +import eu.siacs.conversations.R; +import eu.siacs.conversations.receiver.UnifiedPushDistributor; +import eu.siacs.conversations.xmpp.Jid; + import java.net.URI; import java.net.URISyntaxException; import java.util.Arrays; import java.util.List; -import eu.siacs.conversations.R; -import eu.siacs.conversations.receiver.UnifiedPushDistributor; -import eu.siacs.conversations.xmpp.Jid; - public class UpSettingsFragment extends XmppPreferenceFragment { @Override diff --git a/src/main/java/eu/siacs/conversations/ui/service/AudioPlayer.java b/src/main/java/eu/siacs/conversations/ui/service/AudioPlayer.java index 27e979a4f..cb8b591d7 100644 --- a/src/main/java/eu/siacs/conversations/ui/service/AudioPlayer.java +++ b/src/main/java/eu/siacs/conversations/ui/service/AudioPlayer.java @@ -24,10 +24,6 @@ import androidx.core.content.ContextCompat; import com.google.common.primitives.Ints; -import java.lang.ref.WeakReference; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; - import eu.siacs.conversations.Config; import eu.siacs.conversations.R; import eu.siacs.conversations.entities.Message; @@ -38,6 +34,10 @@ import eu.siacs.conversations.ui.util.PendingItem; import eu.siacs.conversations.utils.TimeFrameUtils; import eu.siacs.conversations.utils.WeakReferenceSet; +import java.lang.ref.WeakReference; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; + public class AudioPlayer implements View.OnClickListener, MediaPlayer.OnCompletionListener, diff --git a/src/main/java/eu/siacs/conversations/ui/text/FixedURLSpan.java b/src/main/java/eu/siacs/conversations/ui/text/FixedURLSpan.java index bb4571997..fa7a4f898 100644 --- a/src/main/java/eu/siacs/conversations/ui/text/FixedURLSpan.java +++ b/src/main/java/eu/siacs/conversations/ui/text/FixedURLSpan.java @@ -34,6 +34,7 @@ import android.content.ActivityNotFoundException; import android.content.Context; import android.content.Intent; import android.net.Uri; +import android.os.Build; import android.text.Editable; import android.text.Spanned; import android.text.style.URLSpan; diff --git a/src/main/java/eu/siacs/conversations/ui/util/Attachment.java b/src/main/java/eu/siacs/conversations/ui/util/Attachment.java index 492ff7a5b..aee735d88 100644 --- a/src/main/java/eu/siacs/conversations/ui/util/Attachment.java +++ b/src/main/java/eu/siacs/conversations/ui/util/Attachment.java @@ -40,15 +40,15 @@ import androidx.annotation.NonNull; import com.google.common.base.MoreObjects; +import eu.siacs.conversations.entities.Message; +import eu.siacs.conversations.utils.MimeUtils; + import java.io.File; import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.UUID; -import eu.siacs.conversations.entities.Message; -import eu.siacs.conversations.utils.MimeUtils; - public class Attachment implements Parcelable { Attachment(Parcel in) { diff --git a/src/main/java/eu/siacs/conversations/ui/util/MucDetailsContextMenuHelper.java b/src/main/java/eu/siacs/conversations/ui/util/MucDetailsContextMenuHelper.java index 0420e5517..16977fbb9 100644 --- a/src/main/java/eu/siacs/conversations/ui/util/MucDetailsContextMenuHelper.java +++ b/src/main/java/eu/siacs/conversations/ui/util/MucDetailsContextMenuHelper.java @@ -10,6 +10,8 @@ import android.view.Menu; import android.view.MenuItem; import android.view.View; +import androidx.appcompat.app.AlertDialog; + import com.google.android.material.dialog.MaterialAlertDialogBuilder; import eu.siacs.conversations.Config; diff --git a/src/main/java/eu/siacs/conversations/ui/util/MyLinkify.java b/src/main/java/eu/siacs/conversations/ui/util/MyLinkify.java index dfff1c0de..d5d3a82da 100644 --- a/src/main/java/eu/siacs/conversations/ui/util/MyLinkify.java +++ b/src/main/java/eu/siacs/conversations/ui/util/MyLinkify.java @@ -42,6 +42,7 @@ import java.util.Arrays; import java.util.Collection; import java.util.List; import java.util.Locale; +import java.util.Objects; import eu.siacs.conversations.ui.text.FixedURLSpan; import eu.siacs.conversations.utils.GeoHelper; diff --git a/src/main/java/eu/siacs/conversations/ui/util/PresenceSelector.java b/src/main/java/eu/siacs/conversations/ui/util/PresenceSelector.java index 402d1077c..a26d02810 100644 --- a/src/main/java/eu/siacs/conversations/ui/util/PresenceSelector.java +++ b/src/main/java/eu/siacs/conversations/ui/util/PresenceSelector.java @@ -34,6 +34,8 @@ import android.content.Context; import android.util.Pair; import android.widget.Toast; +import androidx.appcompat.app.AlertDialog; + import com.google.android.material.dialog.MaterialAlertDialogBuilder; import java.util.Collections; diff --git a/src/main/java/eu/siacs/conversations/ui/util/ViewUtil.java b/src/main/java/eu/siacs/conversations/ui/util/ViewUtil.java index a027816d5..1cc630ad3 100644 --- a/src/main/java/eu/siacs/conversations/ui/util/ViewUtil.java +++ b/src/main/java/eu/siacs/conversations/ui/util/ViewUtil.java @@ -3,11 +3,14 @@ package eu.siacs.conversations.ui.util; import android.content.ActivityNotFoundException; import android.content.Context; import android.content.Intent; +import android.content.pm.PackageManager; +import android.content.pm.ResolveInfo; import android.net.Uri; import android.util.Log; import android.widget.Toast; import java.io.File; +import java.util.List; import eu.siacs.conversations.Config; import eu.siacs.conversations.R; diff --git a/src/main/java/eu/siacs/conversations/utils/AccountUtils.java b/src/main/java/eu/siacs/conversations/utils/AccountUtils.java index 5011c07f8..fe70241f9 100644 --- a/src/main/java/eu/siacs/conversations/utils/AccountUtils.java +++ b/src/main/java/eu/siacs/conversations/utils/AccountUtils.java @@ -14,6 +14,7 @@ import java.util.ArrayList; import java.util.List; import java.util.UUID; +import eu.siacs.conversations.Config; import eu.siacs.conversations.R; import eu.siacs.conversations.entities.Account; import eu.siacs.conversations.services.XmppConnectionService; diff --git a/src/main/java/eu/siacs/conversations/utils/ExceptionHelper.java b/src/main/java/eu/siacs/conversations/utils/ExceptionHelper.java index a4526057e..0b03dc640 100644 --- a/src/main/java/eu/siacs/conversations/utils/ExceptionHelper.java +++ b/src/main/java/eu/siacs/conversations/utils/ExceptionHelper.java @@ -8,15 +8,6 @@ import android.util.Log; import com.google.android.material.dialog.MaterialAlertDialogBuilder; -import java.io.BufferedReader; -import java.io.FileInputStream; -import java.io.IOException; -import java.io.InputStreamReader; -import java.io.OutputStream; -import java.text.SimpleDateFormat; -import java.util.Date; -import java.util.Locale; - import eu.siacs.conversations.AppSettings; import eu.siacs.conversations.Config; import eu.siacs.conversations.R; @@ -26,6 +17,15 @@ import eu.siacs.conversations.entities.Message; import eu.siacs.conversations.services.XmppConnectionService; import eu.siacs.conversations.ui.XmppActivity; +import java.io.BufferedReader; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStreamReader; +import java.io.OutputStream; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.Locale; + public class ExceptionHelper { private static final String FILENAME = "stacktrace.txt"; diff --git a/src/main/java/eu/siacs/conversations/utils/FileUtils.java b/src/main/java/eu/siacs/conversations/utils/FileUtils.java index d9553f04f..e439ab030 100644 --- a/src/main/java/eu/siacs/conversations/utils/FileUtils.java +++ b/src/main/java/eu/siacs/conversations/utils/FileUtils.java @@ -5,6 +5,7 @@ import android.content.ContentUris; import android.content.Context; import android.database.Cursor; import android.net.Uri; +import android.os.Build; import android.os.Environment; import android.provider.DocumentsContract; import android.provider.MediaStore; diff --git a/src/main/java/eu/siacs/conversations/utils/IrregularUnicodeDetector.java b/src/main/java/eu/siacs/conversations/utils/IrregularUnicodeDetector.java index 64eb5b630..5cc093249 100644 --- a/src/main/java/eu/siacs/conversations/utils/IrregularUnicodeDetector.java +++ b/src/main/java/eu/siacs/conversations/utils/IrregularUnicodeDetector.java @@ -54,6 +54,7 @@ import java.util.Set; import java.util.regex.Matcher; import java.util.regex.Pattern; +import eu.siacs.conversations.R; import eu.siacs.conversations.xmpp.Jid; public class IrregularUnicodeDetector { diff --git a/src/main/java/eu/siacs/conversations/utils/SSLSockets.java b/src/main/java/eu/siacs/conversations/utils/SSLSockets.java index 8733f6222..4a8680e20 100644 --- a/src/main/java/eu/siacs/conversations/utils/SSLSockets.java +++ b/src/main/java/eu/siacs/conversations/utils/SSLSockets.java @@ -7,6 +7,9 @@ import androidx.annotation.RequiresApi; import com.google.common.base.Strings; +import eu.siacs.conversations.Config; +import eu.siacs.conversations.entities.Account; + import org.conscrypt.Conscrypt; import java.lang.reflect.Method; @@ -24,9 +27,6 @@ import javax.net.ssl.SSLParameters; import javax.net.ssl.SSLSession; import javax.net.ssl.SSLSocket; -import eu.siacs.conversations.Config; -import eu.siacs.conversations.entities.Account; - public class SSLSockets { public static void setSecurity(final SSLSocket sslSocket) { diff --git a/src/main/java/eu/siacs/conversations/utils/StylingHelper.java b/src/main/java/eu/siacs/conversations/utils/StylingHelper.java index bdefff13e..fc669c87d 100644 --- a/src/main/java/eu/siacs/conversations/utils/StylingHelper.java +++ b/src/main/java/eu/siacs/conversations/utils/StylingHelper.java @@ -29,6 +29,7 @@ package eu.siacs.conversations.utils; +import android.content.Context; import android.graphics.Color; import android.graphics.Typeface; import android.text.Editable; @@ -46,6 +47,7 @@ import android.widget.EditText; import android.widget.TextView; import androidx.annotation.ColorInt; +import androidx.core.content.ContextCompat; import com.google.android.material.color.MaterialColors; @@ -53,6 +55,7 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import eu.siacs.conversations.R; import eu.siacs.conversations.entities.Message; import eu.siacs.conversations.ui.text.QuoteSpan; diff --git a/src/main/java/eu/siacs/conversations/utils/ThemeHelper.java b/src/main/java/eu/siacs/conversations/utils/ThemeHelper.java index 6747842e2..8a141a507 100644 --- a/src/main/java/eu/siacs/conversations/utils/ThemeHelper.java +++ b/src/main/java/eu/siacs/conversations/utils/ThemeHelper.java @@ -34,6 +34,7 @@ import android.content.SharedPreferences; import android.content.res.Configuration; import android.content.res.Resources; import android.content.res.TypedArray; +import android.graphics.Color; import android.os.Build; import android.preference.PreferenceManager; import android.util.TypedValue; diff --git a/src/main/java/eu/siacs/conversations/utils/XmlHelper.java b/src/main/java/eu/siacs/conversations/utils/XmlHelper.java index 0bdf13bf3..54880be8f 100644 --- a/src/main/java/eu/siacs/conversations/utils/XmlHelper.java +++ b/src/main/java/eu/siacs/conversations/utils/XmlHelper.java @@ -4,12 +4,12 @@ import com.google.common.base.Joiner; import com.google.common.collect.Iterables; import com.google.common.collect.Lists; +import eu.siacs.conversations.xml.Element; + import java.util.Collection; import java.util.Collections; import java.util.List; -import eu.siacs.conversations.xml.Element; - public class XmlHelper { public static String encodeEntities(String content) { content = content.replace("&", "&"); diff --git a/src/main/java/eu/siacs/conversations/worker/ExportBackupWorker.java b/src/main/java/eu/siacs/conversations/worker/ExportBackupWorker.java index ec512e590..75ef9036c 100644 --- a/src/main/java/eu/siacs/conversations/worker/ExportBackupWorker.java +++ b/src/main/java/eu/siacs/conversations/worker/ExportBackupWorker.java @@ -25,6 +25,18 @@ import com.google.common.base.Strings; import com.google.common.collect.ImmutableList; import com.google.gson.stream.JsonWriter; +import eu.siacs.conversations.Config; +import eu.siacs.conversations.R; +import eu.siacs.conversations.crypto.axolotl.SQLiteAxolotlStore; +import eu.siacs.conversations.entities.Account; +import eu.siacs.conversations.entities.Conversation; +import eu.siacs.conversations.entities.Message; +import eu.siacs.conversations.persistance.DatabaseBackend; +import eu.siacs.conversations.persistance.FileBackend; +import eu.siacs.conversations.receiver.WorkManagerEventReceiver; +import eu.siacs.conversations.utils.BackupFileHeader; +import eu.siacs.conversations.utils.Compatibility; + import java.io.DataOutputStream; import java.io.File; import java.io.FileOutputStream; @@ -53,18 +65,6 @@ import javax.crypto.spec.IvParameterSpec; import javax.crypto.spec.PBEKeySpec; import javax.crypto.spec.SecretKeySpec; -import eu.siacs.conversations.Config; -import eu.siacs.conversations.R; -import eu.siacs.conversations.crypto.axolotl.SQLiteAxolotlStore; -import eu.siacs.conversations.entities.Account; -import eu.siacs.conversations.entities.Conversation; -import eu.siacs.conversations.entities.Message; -import eu.siacs.conversations.persistance.DatabaseBackend; -import eu.siacs.conversations.persistance.FileBackend; -import eu.siacs.conversations.receiver.WorkManagerEventReceiver; -import eu.siacs.conversations.utils.BackupFileHeader; -import eu.siacs.conversations.utils.Compatibility; - public class ExportBackupWorker extends Worker { private static final SimpleDateFormat DATE_FORMAT = diff --git a/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java b/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java index b652adaa5..75bd661b3 100644 --- a/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java +++ b/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java @@ -114,8 +114,50 @@ import eu.siacs.conversations.xmpp.stanzas.streammgmt.AckPacket; import eu.siacs.conversations.xmpp.stanzas.streammgmt.EnablePacket; import eu.siacs.conversations.xmpp.stanzas.streammgmt.RequestPacket; import eu.siacs.conversations.xmpp.stanzas.streammgmt.ResumePacket; + import okhttp3.HttpUrl; +import org.xmlpull.v1.XmlPullParserException; + +import java.io.ByteArrayInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.net.ConnectException; +import java.net.IDN; +import java.net.InetAddress; +import java.net.InetSocketAddress; +import java.net.Socket; +import java.net.UnknownHostException; +import java.security.KeyManagementException; +import java.security.NoSuchAlgorithmException; +import java.security.Principal; +import java.security.PrivateKey; +import java.security.cert.X509Certificate; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Hashtable; +import java.util.Iterator; +import java.util.List; +import java.util.Map.Entry; +import java.util.Set; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicBoolean; +import java.util.concurrent.atomic.AtomicInteger; +import java.util.regex.Matcher; + +import javax.net.ssl.KeyManager; +import javax.net.ssl.SSLContext; +import javax.net.ssl.SSLPeerUnverifiedException; +import javax.net.ssl.SSLSocket; +import javax.net.ssl.SSLSocketFactory; +import javax.net.ssl.X509KeyManager; +import javax.net.ssl.X509TrustManager; + public class XmppConnection implements Runnable { private static final int PACKET_IQ = 0; diff --git a/src/main/java/eu/siacs/conversations/xmpp/jingle/AbstractContentMap.java b/src/main/java/eu/siacs/conversations/xmpp/jingle/AbstractContentMap.java index a0e15c6a6..847678a05 100644 --- a/src/main/java/eu/siacs/conversations/xmpp/jingle/AbstractContentMap.java +++ b/src/main/java/eu/siacs/conversations/xmpp/jingle/AbstractContentMap.java @@ -4,16 +4,16 @@ import com.google.common.collect.Collections2; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - import eu.siacs.conversations.xmpp.jingle.stanzas.Content; import eu.siacs.conversations.xmpp.jingle.stanzas.GenericDescription; import eu.siacs.conversations.xmpp.jingle.stanzas.GenericTransportInfo; import eu.siacs.conversations.xmpp.jingle.stanzas.Group; import eu.siacs.conversations.xmpp.jingle.stanzas.JinglePacket; +import java.util.List; +import java.util.Map; +import java.util.Set; + public abstract class AbstractContentMap< D extends GenericDescription, T extends GenericTransportInfo> { diff --git a/src/main/java/eu/siacs/conversations/xmpp/jingle/AbstractJingleConnection.java b/src/main/java/eu/siacs/conversations/xmpp/jingle/AbstractJingleConnection.java index 32574594e..6aeb348c1 100644 --- a/src/main/java/eu/siacs/conversations/xmpp/jingle/AbstractJingleConnection.java +++ b/src/main/java/eu/siacs/conversations/xmpp/jingle/AbstractJingleConnection.java @@ -11,12 +11,6 @@ import com.google.common.base.Strings; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; -import java.util.Arrays; -import java.util.Collection; -import java.util.List; -import java.util.Map; -import java.util.function.Consumer; - import eu.siacs.conversations.Config; import eu.siacs.conversations.entities.Account; import eu.siacs.conversations.entities.Contact; @@ -29,6 +23,12 @@ import eu.siacs.conversations.xmpp.jingle.stanzas.JinglePacket; import eu.siacs.conversations.xmpp.jingle.stanzas.Reason; import eu.siacs.conversations.xmpp.stanzas.IqPacket; +import java.util.Arrays; +import java.util.Collection; +import java.util.List; +import java.util.Map; +import java.util.function.Consumer; + public abstract class AbstractJingleConnection { public static final String JINGLE_MESSAGE_PROPOSE_ID_PREFIX = "jm-propose-"; diff --git a/src/main/java/eu/siacs/conversations/xmpp/jingle/DirectConnectionUtils.java b/src/main/java/eu/siacs/conversations/xmpp/jingle/DirectConnectionUtils.java index 53c79a9f0..a2a5c4032 100644 --- a/src/main/java/eu/siacs/conversations/xmpp/jingle/DirectConnectionUtils.java +++ b/src/main/java/eu/siacs/conversations/xmpp/jingle/DirectConnectionUtils.java @@ -7,8 +7,13 @@ import java.net.InetAddress; import java.net.NetworkInterface; import java.net.SocketException; import java.net.UnknownHostException; +import java.security.SecureRandom; +import java.util.ArrayList; import java.util.Enumeration; import java.util.List; +import java.util.UUID; + +import eu.siacs.conversations.xmpp.Jid; public class DirectConnectionUtils { diff --git a/src/main/java/eu/siacs/conversations/xmpp/jingle/FileTransferContentMap.java b/src/main/java/eu/siacs/conversations/xmpp/jingle/FileTransferContentMap.java index 3e73359ac..c678c91cb 100644 --- a/src/main/java/eu/siacs/conversations/xmpp/jingle/FileTransferContentMap.java +++ b/src/main/java/eu/siacs/conversations/xmpp/jingle/FileTransferContentMap.java @@ -4,11 +4,6 @@ import com.google.common.collect.ImmutableMap; import com.google.common.collect.Iterables; import com.google.common.collect.Maps; -import java.util.Arrays; -import java.util.Collections; -import java.util.List; -import java.util.Map; - import eu.siacs.conversations.xml.Element; import eu.siacs.conversations.xml.Namespace; import eu.siacs.conversations.xmpp.jingle.stanzas.Content; @@ -19,10 +14,16 @@ import eu.siacs.conversations.xmpp.jingle.stanzas.Group; import eu.siacs.conversations.xmpp.jingle.stanzas.IbbTransportInfo; import eu.siacs.conversations.xmpp.jingle.stanzas.IceUdpTransportInfo; import eu.siacs.conversations.xmpp.jingle.stanzas.JinglePacket; +import eu.siacs.conversations.xmpp.jingle.stanzas.RtpDescription; import eu.siacs.conversations.xmpp.jingle.stanzas.SocksByteStreamsTransportInfo; import eu.siacs.conversations.xmpp.jingle.stanzas.WebRTCDataChannelTransportInfo; import eu.siacs.conversations.xmpp.jingle.transports.Transport; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import java.util.Map; + public class FileTransferContentMap extends AbstractContentMap { diff --git a/src/main/java/eu/siacs/conversations/xmpp/jingle/IceServers.java b/src/main/java/eu/siacs/conversations/xmpp/jingle/IceServers.java index d2e192ddd..7b2f88457 100644 --- a/src/main/java/eu/siacs/conversations/xmpp/jingle/IceServers.java +++ b/src/main/java/eu/siacs/conversations/xmpp/jingle/IceServers.java @@ -6,18 +6,18 @@ import com.google.common.base.Strings; import com.google.common.collect.ImmutableList; import com.google.common.primitives.Ints; -import org.webrtc.PeerConnection; - -import java.util.Arrays; -import java.util.Collections; -import java.util.List; - import eu.siacs.conversations.Config; import eu.siacs.conversations.utils.IP; import eu.siacs.conversations.xml.Element; import eu.siacs.conversations.xml.Namespace; import eu.siacs.conversations.xmpp.stanzas.IqPacket; +import org.webrtc.PeerConnection; + +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + public final class IceServers { public static List parse(final IqPacket response) { diff --git a/src/main/java/eu/siacs/conversations/xmpp/jingle/JingleConnectionManager.java b/src/main/java/eu/siacs/conversations/xmpp/jingle/JingleConnectionManager.java index 20fb34b3c..6d0ec1e82 100644 --- a/src/main/java/eu/siacs/conversations/xmpp/jingle/JingleConnectionManager.java +++ b/src/main/java/eu/siacs/conversations/xmpp/jingle/JingleConnectionManager.java @@ -15,19 +15,6 @@ import com.google.common.collect.Collections2; import com.google.common.collect.ComparisonChain; import com.google.common.collect.ImmutableSet; -import java.lang.ref.WeakReference; -import java.security.SecureRandom; -import java.util.Collection; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.Executors; -import java.util.concurrent.ScheduledExecutorService; -import java.util.concurrent.ScheduledFuture; -import java.util.concurrent.TimeUnit; - import eu.siacs.conversations.Config; import eu.siacs.conversations.entities.Account; import eu.siacs.conversations.entities.Contact; @@ -55,6 +42,19 @@ import eu.siacs.conversations.xmpp.jingle.transports.Transport; import eu.siacs.conversations.xmpp.stanzas.IqPacket; import eu.siacs.conversations.xmpp.stanzas.MessagePacket; +import java.lang.ref.WeakReference; +import java.security.SecureRandom; +import java.util.Collection; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.Executors; +import java.util.concurrent.ScheduledExecutorService; +import java.util.concurrent.ScheduledFuture; +import java.util.concurrent.TimeUnit; + public class JingleConnectionManager extends AbstractConnectionManager { public static final ScheduledExecutorService SCHEDULED_EXECUTOR_SERVICE = Executors.newSingleThreadScheduledExecutor(); diff --git a/src/main/java/eu/siacs/conversations/xmpp/jingle/JingleFileTransferConnection.java b/src/main/java/eu/siacs/conversations/xmpp/jingle/JingleFileTransferConnection.java index 21ed3c064..60365e6ea 100644 --- a/src/main/java/eu/siacs/conversations/xmpp/jingle/JingleFileTransferConnection.java +++ b/src/main/java/eu/siacs/conversations/xmpp/jingle/JingleFileTransferConnection.java @@ -17,6 +17,30 @@ import com.google.common.util.concurrent.ListenableFuture; import com.google.common.util.concurrent.MoreExecutors; import com.google.common.util.concurrent.SettableFuture; +import eu.siacs.conversations.Config; +import eu.siacs.conversations.crypto.axolotl.XmppAxolotlMessage; +import eu.siacs.conversations.entities.Conversation; +import eu.siacs.conversations.entities.Message; +import eu.siacs.conversations.entities.Transferable; +import eu.siacs.conversations.entities.TransferablePlaceholder; +import eu.siacs.conversations.services.AbstractConnectionManager; +import eu.siacs.conversations.xml.Namespace; +import eu.siacs.conversations.xmpp.Jid; +import eu.siacs.conversations.xmpp.XmppConnection; +import eu.siacs.conversations.xmpp.jingle.stanzas.FileTransferDescription; +import eu.siacs.conversations.xmpp.jingle.stanzas.GenericTransportInfo; +import eu.siacs.conversations.xmpp.jingle.stanzas.IbbTransportInfo; +import eu.siacs.conversations.xmpp.jingle.stanzas.IceUdpTransportInfo; +import eu.siacs.conversations.xmpp.jingle.stanzas.JinglePacket; +import eu.siacs.conversations.xmpp.jingle.stanzas.Reason; +import eu.siacs.conversations.xmpp.jingle.stanzas.SocksByteStreamsTransportInfo; +import eu.siacs.conversations.xmpp.jingle.stanzas.WebRTCDataChannelTransportInfo; +import eu.siacs.conversations.xmpp.jingle.transports.InbandBytestreamsTransport; +import eu.siacs.conversations.xmpp.jingle.transports.SocksByteStreamsTransport; +import eu.siacs.conversations.xmpp.jingle.transports.Transport; +import eu.siacs.conversations.xmpp.jingle.transports.WebRTCDataChannelTransport; +import eu.siacs.conversations.xmpp.stanzas.IqPacket; + import org.bouncycastle.crypto.engines.AESEngine; import org.bouncycastle.crypto.io.CipherInputStream; import org.bouncycastle.crypto.io.CipherOutputStream; @@ -44,30 +68,6 @@ import java.util.Optional; import java.util.Queue; import java.util.concurrent.CountDownLatch; -import eu.siacs.conversations.Config; -import eu.siacs.conversations.crypto.axolotl.XmppAxolotlMessage; -import eu.siacs.conversations.entities.Conversation; -import eu.siacs.conversations.entities.Message; -import eu.siacs.conversations.entities.Transferable; -import eu.siacs.conversations.entities.TransferablePlaceholder; -import eu.siacs.conversations.services.AbstractConnectionManager; -import eu.siacs.conversations.xml.Namespace; -import eu.siacs.conversations.xmpp.Jid; -import eu.siacs.conversations.xmpp.XmppConnection; -import eu.siacs.conversations.xmpp.jingle.stanzas.FileTransferDescription; -import eu.siacs.conversations.xmpp.jingle.stanzas.GenericTransportInfo; -import eu.siacs.conversations.xmpp.jingle.stanzas.IbbTransportInfo; -import eu.siacs.conversations.xmpp.jingle.stanzas.IceUdpTransportInfo; -import eu.siacs.conversations.xmpp.jingle.stanzas.JinglePacket; -import eu.siacs.conversations.xmpp.jingle.stanzas.Reason; -import eu.siacs.conversations.xmpp.jingle.stanzas.SocksByteStreamsTransportInfo; -import eu.siacs.conversations.xmpp.jingle.stanzas.WebRTCDataChannelTransportInfo; -import eu.siacs.conversations.xmpp.jingle.transports.InbandBytestreamsTransport; -import eu.siacs.conversations.xmpp.jingle.transports.SocksByteStreamsTransport; -import eu.siacs.conversations.xmpp.jingle.transports.Transport; -import eu.siacs.conversations.xmpp.jingle.transports.WebRTCDataChannelTransport; -import eu.siacs.conversations.xmpp.stanzas.IqPacket; - public class JingleFileTransferConnection extends AbstractJingleConnection implements Transport.Callback, Transferable { diff --git a/src/main/java/eu/siacs/conversations/xmpp/jingle/JingleRtpConnection.java b/src/main/java/eu/siacs/conversations/xmpp/jingle/JingleRtpConnection.java index 9e46430f3..ba78ab909 100644 --- a/src/main/java/eu/siacs/conversations/xmpp/jingle/JingleRtpConnection.java +++ b/src/main/java/eu/siacs/conversations/xmpp/jingle/JingleRtpConnection.java @@ -25,23 +25,6 @@ import com.google.common.util.concurrent.Futures; import com.google.common.util.concurrent.ListenableFuture; import com.google.common.util.concurrent.MoreExecutors; -import org.webrtc.EglBase; -import org.webrtc.IceCandidate; -import org.webrtc.PeerConnection; -import org.webrtc.VideoTrack; - -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; -import java.util.Queue; -import java.util.Set; -import java.util.concurrent.ExecutionException; -import java.util.concurrent.ScheduledFuture; -import java.util.concurrent.TimeUnit; - import eu.siacs.conversations.BuildConfig; import eu.siacs.conversations.Config; import eu.siacs.conversations.crypto.axolotl.AxolotlService; @@ -68,6 +51,23 @@ import eu.siacs.conversations.xmpp.jingle.stanzas.RtpDescription; import eu.siacs.conversations.xmpp.stanzas.IqPacket; import eu.siacs.conversations.xmpp.stanzas.MessagePacket; +import org.webrtc.EglBase; +import org.webrtc.IceCandidate; +import org.webrtc.PeerConnection; +import org.webrtc.VideoTrack; + +import java.util.Arrays; +import java.util.Collection; +import java.util.Collections; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.Queue; +import java.util.Set; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.ScheduledFuture; +import java.util.concurrent.TimeUnit; + public class JingleRtpConnection extends AbstractJingleConnection implements WebRTCWrapper.EventCallback, CallIntegration.Callback, OngoingRtpSession { diff --git a/src/main/java/eu/siacs/conversations/xmpp/jingle/OngoingRtpSession.java b/src/main/java/eu/siacs/conversations/xmpp/jingle/OngoingRtpSession.java index 2957492a1..358411bcb 100644 --- a/src/main/java/eu/siacs/conversations/xmpp/jingle/OngoingRtpSession.java +++ b/src/main/java/eu/siacs/conversations/xmpp/jingle/OngoingRtpSession.java @@ -1,11 +1,11 @@ package eu.siacs.conversations.xmpp.jingle; -import java.util.Set; - import eu.siacs.conversations.entities.Account; import eu.siacs.conversations.services.CallIntegration; import eu.siacs.conversations.xmpp.Jid; +import java.util.Set; + public interface OngoingRtpSession { Account getAccount(); diff --git a/src/main/java/eu/siacs/conversations/xmpp/jingle/RtpCapability.java b/src/main/java/eu/siacs/conversations/xmpp/jingle/RtpCapability.java index 406d064df..b53f0b9e8 100644 --- a/src/main/java/eu/siacs/conversations/xmpp/jingle/RtpCapability.java +++ b/src/main/java/eu/siacs/conversations/xmpp/jingle/RtpCapability.java @@ -5,6 +5,7 @@ import com.google.common.collect.Collections2; import java.util.ArrayList; import java.util.Arrays; +import java.util.Collection; import java.util.Collections; import java.util.List; import java.util.Map; diff --git a/src/main/java/eu/siacs/conversations/xmpp/jingle/RtpContentMap.java b/src/main/java/eu/siacs/conversations/xmpp/jingle/RtpContentMap.java index b2d58ab3f..94f8ca300 100644 --- a/src/main/java/eu/siacs/conversations/xmpp/jingle/RtpContentMap.java +++ b/src/main/java/eu/siacs/conversations/xmpp/jingle/RtpContentMap.java @@ -13,14 +13,6 @@ import com.google.common.collect.Iterables; import com.google.common.collect.Maps; import com.google.common.collect.Sets; -import java.util.Collection; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import javax.annotation.Nonnull; - import eu.siacs.conversations.xmpp.jingle.stanzas.Content; import eu.siacs.conversations.xmpp.jingle.stanzas.GenericDescription; import eu.siacs.conversations.xmpp.jingle.stanzas.GenericTransportInfo; @@ -30,6 +22,14 @@ import eu.siacs.conversations.xmpp.jingle.stanzas.JinglePacket; import eu.siacs.conversations.xmpp.jingle.stanzas.OmemoVerifiedIceUdpTransportInfo; import eu.siacs.conversations.xmpp.jingle.stanzas.RtpDescription; +import java.util.Collection; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import javax.annotation.Nonnull; + public class RtpContentMap extends AbstractContentMap { public RtpContentMap( diff --git a/src/main/java/eu/siacs/conversations/xmpp/jingle/SessionDescription.java b/src/main/java/eu/siacs/conversations/xmpp/jingle/SessionDescription.java index aa82bcb95..025a7acc9 100644 --- a/src/main/java/eu/siacs/conversations/xmpp/jingle/SessionDescription.java +++ b/src/main/java/eu/siacs/conversations/xmpp/jingle/SessionDescription.java @@ -13,12 +13,6 @@ import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMultimap; import com.google.common.collect.Multimap; -import java.util.Collection; -import java.util.Collections; -import java.util.List; -import java.util.Locale; -import java.util.Map; - import eu.siacs.conversations.Config; import eu.siacs.conversations.xml.Namespace; import eu.siacs.conversations.xmpp.jingle.stanzas.FileTransferDescription; @@ -28,6 +22,12 @@ import eu.siacs.conversations.xmpp.jingle.stanzas.IceUdpTransportInfo; import eu.siacs.conversations.xmpp.jingle.stanzas.RtpDescription; import eu.siacs.conversations.xmpp.jingle.stanzas.WebRTCDataChannelTransportInfo; +import java.util.Collection; +import java.util.Collections; +import java.util.List; +import java.util.Locale; +import java.util.Map; + public class SessionDescription { public static final String LINE_DIVIDER = "\r\n"; diff --git a/src/main/java/eu/siacs/conversations/xmpp/jingle/ToneManager.java b/src/main/java/eu/siacs/conversations/xmpp/jingle/ToneManager.java index bb0ee5c68..4b4b23d82 100644 --- a/src/main/java/eu/siacs/conversations/xmpp/jingle/ToneManager.java +++ b/src/main/java/eu/siacs/conversations/xmpp/jingle/ToneManager.java @@ -1,15 +1,11 @@ package eu.siacs.conversations.xmpp.jingle; -import static java.util.Arrays.asList; - import android.content.Context; import android.media.AudioManager; import android.media.ToneGenerator; import android.os.Build; import android.util.Log; -import androidx.core.content.ContextCompat; - import java.util.Arrays; import java.util.Set; import java.util.concurrent.ScheduledFuture; @@ -17,6 +13,10 @@ import java.util.concurrent.TimeUnit; import eu.siacs.conversations.Config; +import static java.util.Arrays.asList; + +import androidx.core.content.ContextCompat; + class ToneManager { private ToneGenerator toneGenerator; diff --git a/src/main/java/eu/siacs/conversations/xmpp/jingle/TrackWrapper.java b/src/main/java/eu/siacs/conversations/xmpp/jingle/TrackWrapper.java index 173e46b89..16e89ca3b 100644 --- a/src/main/java/eu/siacs/conversations/xmpp/jingle/TrackWrapper.java +++ b/src/main/java/eu/siacs/conversations/xmpp/jingle/TrackWrapper.java @@ -6,6 +6,8 @@ import com.google.common.base.CaseFormat; import com.google.common.base.Optional; import com.google.common.base.Preconditions; +import eu.siacs.conversations.Config; + import org.webrtc.MediaStreamTrack; import org.webrtc.PeerConnection; import org.webrtc.RtpSender; @@ -16,8 +18,6 @@ import java.util.UUID; import javax.annotation.Nonnull; import javax.annotation.Nullable; -import eu.siacs.conversations.Config; - class TrackWrapper { public final T track; public final RtpSender rtpSender; diff --git a/src/main/java/eu/siacs/conversations/xmpp/jingle/WebRTCWrapper.java b/src/main/java/eu/siacs/conversations/xmpp/jingle/WebRTCWrapper.java index 0bb34b75f..bda9878aa 100644 --- a/src/main/java/eu/siacs/conversations/xmpp/jingle/WebRTCWrapper.java +++ b/src/main/java/eu/siacs/conversations/xmpp/jingle/WebRTCWrapper.java @@ -14,12 +14,16 @@ import com.google.common.util.concurrent.ListenableFuture; import com.google.common.util.concurrent.MoreExecutors; import com.google.common.util.concurrent.SettableFuture; +import eu.siacs.conversations.Config; +import eu.siacs.conversations.services.XmppConnectionService; + import org.webrtc.AudioSource; import org.webrtc.AudioTrack; import org.webrtc.CandidatePairChangeEvent; import org.webrtc.DataChannel; import org.webrtc.DefaultVideoDecoderFactory; import org.webrtc.DefaultVideoEncoderFactory; +import org.webrtc.DtmfSender; import org.webrtc.EglBase; import org.webrtc.IceCandidate; import org.webrtc.MediaConstraints; @@ -36,8 +40,8 @@ import org.webrtc.audio.JavaAudioDeviceModule; import java.util.LinkedList; import java.util.List; -import java.util.Map; import java.util.Queue; +import java.util.Map; import java.util.Set; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; @@ -48,9 +52,6 @@ import java.util.concurrent.atomic.AtomicBoolean; import javax.annotation.Nonnull; import javax.annotation.Nullable; -import eu.siacs.conversations.Config; -import eu.siacs.conversations.services.XmppConnectionService; - public class WebRTCWrapper { private static final String EXTENDED_LOGGING_TAG = WebRTCWrapper.class.getSimpleName(); diff --git a/src/main/java/eu/siacs/conversations/xmpp/jingle/stanzas/Content.java b/src/main/java/eu/siacs/conversations/xmpp/jingle/stanzas/Content.java index 26ab2feb2..a4cb13e07 100644 --- a/src/main/java/eu/siacs/conversations/xmpp/jingle/stanzas/Content.java +++ b/src/main/java/eu/siacs/conversations/xmpp/jingle/stanzas/Content.java @@ -8,9 +8,6 @@ import com.google.common.base.Preconditions; import com.google.common.base.Strings; import com.google.common.collect.ImmutableSet; -import java.util.Locale; -import java.util.Set; - import eu.siacs.conversations.Config; import eu.siacs.conversations.crypto.axolotl.AxolotlService; import eu.siacs.conversations.crypto.axolotl.XmppAxolotlMessage; @@ -19,6 +16,9 @@ import eu.siacs.conversations.xml.Namespace; import eu.siacs.conversations.xmpp.Jid; import eu.siacs.conversations.xmpp.jingle.SessionDescription; +import java.util.Locale; +import java.util.Set; + public class Content extends Element { public Content(final Creator creator, final Senders senders, final String name) { diff --git a/src/main/java/eu/siacs/conversations/xmpp/jingle/stanzas/FileTransferDescription.java b/src/main/java/eu/siacs/conversations/xmpp/jingle/stanzas/FileTransferDescription.java index 02a0c1cde..3878d98d9 100644 --- a/src/main/java/eu/siacs/conversations/xmpp/jingle/stanzas/FileTransferDescription.java +++ b/src/main/java/eu/siacs/conversations/xmpp/jingle/stanzas/FileTransferDescription.java @@ -12,12 +12,12 @@ import com.google.common.collect.ImmutableList; import com.google.common.io.BaseEncoding; import com.google.common.primitives.Longs; -import java.util.List; - import eu.siacs.conversations.Config; import eu.siacs.conversations.xml.Element; import eu.siacs.conversations.xml.Namespace; +import java.util.List; + public class FileTransferDescription extends GenericDescription { private FileTransferDescription() { diff --git a/src/main/java/eu/siacs/conversations/xmpp/jingle/stanzas/IceUdpTransportInfo.java b/src/main/java/eu/siacs/conversations/xmpp/jingle/stanzas/IceUdpTransportInfo.java index f3609ea98..8d90b1982 100644 --- a/src/main/java/eu/siacs/conversations/xmpp/jingle/stanzas/IceUdpTransportInfo.java +++ b/src/main/java/eu/siacs/conversations/xmpp/jingle/stanzas/IceUdpTransportInfo.java @@ -10,12 +10,19 @@ import com.google.common.base.Objects; import com.google.common.base.Preconditions; import com.google.common.base.Splitter; import com.google.common.base.Strings; +import com.google.common.collect.ArrayListMultimap; import com.google.common.collect.Collections2; import com.google.common.collect.ImmutableCollection; import com.google.common.collect.ImmutableList; import com.google.common.collect.Iterables; import com.google.common.collect.Multimap; +import eu.siacs.conversations.Config; +import eu.siacs.conversations.xml.Element; +import eu.siacs.conversations.xml.Namespace; +import eu.siacs.conversations.xmpp.jingle.SessionDescription; +import eu.siacs.conversations.xmpp.jingle.transports.Transport; + import java.util.Arrays; import java.util.Collection; import java.util.Collections; @@ -27,12 +34,6 @@ import java.util.Locale; import java.util.Map; import java.util.UUID; -import eu.siacs.conversations.Config; -import eu.siacs.conversations.xml.Element; -import eu.siacs.conversations.xml.Namespace; -import eu.siacs.conversations.xmpp.jingle.SessionDescription; -import eu.siacs.conversations.xmpp.jingle.transports.Transport; - public class IceUdpTransportInfo extends GenericTransportInfo { public static final IceUdpTransportInfo STUB = new IceUdpTransportInfo(); diff --git a/src/main/java/eu/siacs/conversations/xmpp/jingle/stanzas/JinglePacket.java b/src/main/java/eu/siacs/conversations/xmpp/jingle/stanzas/JinglePacket.java index 788dbb013..a24040d3d 100644 --- a/src/main/java/eu/siacs/conversations/xmpp/jingle/stanzas/JinglePacket.java +++ b/src/main/java/eu/siacs/conversations/xmpp/jingle/stanzas/JinglePacket.java @@ -7,13 +7,13 @@ import com.google.common.base.Preconditions; import com.google.common.base.Strings; import com.google.common.collect.ImmutableMap; -import java.util.Map; - import eu.siacs.conversations.xml.Element; import eu.siacs.conversations.xml.Namespace; import eu.siacs.conversations.xmpp.Jid; import eu.siacs.conversations.xmpp.stanzas.IqPacket; +import java.util.Map; + public class JinglePacket extends IqPacket { private JinglePacket() { diff --git a/src/main/java/eu/siacs/conversations/xmpp/jingle/stanzas/Reason.java b/src/main/java/eu/siacs/conversations/xmpp/jingle/stanzas/Reason.java index f734e0685..669a01c49 100644 --- a/src/main/java/eu/siacs/conversations/xmpp/jingle/stanzas/Reason.java +++ b/src/main/java/eu/siacs/conversations/xmpp/jingle/stanzas/Reason.java @@ -5,6 +5,7 @@ import androidx.annotation.NonNull; import com.google.common.base.CaseFormat; import com.google.common.base.Throwables; +import eu.siacs.conversations.crypto.axolotl.AxolotlService; import eu.siacs.conversations.crypto.axolotl.CryptoFailedException; import eu.siacs.conversations.xmpp.jingle.RtpContentMap; diff --git a/src/main/java/eu/siacs/conversations/xmpp/jingle/stanzas/SocksByteStreamsTransportInfo.java b/src/main/java/eu/siacs/conversations/xmpp/jingle/stanzas/SocksByteStreamsTransportInfo.java index 1386a9ff0..4b1d85847 100644 --- a/src/main/java/eu/siacs/conversations/xmpp/jingle/stanzas/SocksByteStreamsTransportInfo.java +++ b/src/main/java/eu/siacs/conversations/xmpp/jingle/stanzas/SocksByteStreamsTransportInfo.java @@ -6,14 +6,14 @@ import com.google.common.base.Preconditions; import com.google.common.base.Strings; import com.google.common.collect.ImmutableList; -import java.util.Collection; -import java.util.List; - import eu.siacs.conversations.Config; import eu.siacs.conversations.xml.Element; import eu.siacs.conversations.xml.Namespace; import eu.siacs.conversations.xmpp.jingle.transports.SocksByteStreamsTransport; +import java.util.Collection; +import java.util.List; + public class SocksByteStreamsTransportInfo extends GenericTransportInfo { private SocksByteStreamsTransportInfo() { diff --git a/src/main/java/eu/siacs/conversations/xmpp/jingle/transports/InbandBytestreamsTransport.java b/src/main/java/eu/siacs/conversations/xmpp/jingle/transports/InbandBytestreamsTransport.java index e868ea02f..ce2d4b31f 100644 --- a/src/main/java/eu/siacs/conversations/xmpp/jingle/transports/InbandBytestreamsTransport.java +++ b/src/main/java/eu/siacs/conversations/xmpp/jingle/transports/InbandBytestreamsTransport.java @@ -9,6 +9,15 @@ import com.google.common.primitives.Ints; import com.google.common.util.concurrent.Futures; import com.google.common.util.concurrent.ListenableFuture; +import eu.siacs.conversations.Config; +import eu.siacs.conversations.entities.Account; +import eu.siacs.conversations.xml.Element; +import eu.siacs.conversations.xml.Namespace; +import eu.siacs.conversations.xmpp.Jid; +import eu.siacs.conversations.xmpp.XmppConnection; +import eu.siacs.conversations.xmpp.jingle.stanzas.IbbTransportInfo; +import eu.siacs.conversations.xmpp.stanzas.IqPacket; + import java.io.Closeable; import java.io.IOException; import java.io.InputStream; @@ -22,15 +31,6 @@ import java.util.concurrent.Semaphore; import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicInteger; -import eu.siacs.conversations.Config; -import eu.siacs.conversations.entities.Account; -import eu.siacs.conversations.xml.Element; -import eu.siacs.conversations.xml.Namespace; -import eu.siacs.conversations.xmpp.Jid; -import eu.siacs.conversations.xmpp.XmppConnection; -import eu.siacs.conversations.xmpp.jingle.stanzas.IbbTransportInfo; -import eu.siacs.conversations.xmpp.stanzas.IqPacket; - public class InbandBytestreamsTransport implements Transport { private static final int DEFAULT_BLOCK_SIZE = 8192; diff --git a/src/main/java/eu/siacs/conversations/xmpp/jingle/transports/SocksByteStreamsTransport.java b/src/main/java/eu/siacs/conversations/xmpp/jingle/transports/SocksByteStreamsTransport.java index a5d0c9934..bbda1c622 100644 --- a/src/main/java/eu/siacs/conversations/xmpp/jingle/transports/SocksByteStreamsTransport.java +++ b/src/main/java/eu/siacs/conversations/xmpp/jingle/transports/SocksByteStreamsTransport.java @@ -23,6 +23,17 @@ import com.google.common.util.concurrent.ListenableFuture; import com.google.common.util.concurrent.MoreExecutors; import com.google.common.util.concurrent.SettableFuture; +import eu.siacs.conversations.Config; +import eu.siacs.conversations.utils.SocksSocketFactory; +import eu.siacs.conversations.xml.Element; +import eu.siacs.conversations.xml.Namespace; +import eu.siacs.conversations.xmpp.Jid; +import eu.siacs.conversations.xmpp.XmppConnection; +import eu.siacs.conversations.xmpp.jingle.AbstractJingleConnection; +import eu.siacs.conversations.xmpp.jingle.DirectConnectionUtils; +import eu.siacs.conversations.xmpp.jingle.stanzas.SocksByteStreamsTransportInfo; +import eu.siacs.conversations.xmpp.stanzas.IqPacket; + import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; @@ -49,17 +60,6 @@ import java.util.concurrent.Executors; import java.util.concurrent.TimeoutException; import java.util.concurrent.atomic.AtomicBoolean; -import eu.siacs.conversations.Config; -import eu.siacs.conversations.utils.SocksSocketFactory; -import eu.siacs.conversations.xml.Element; -import eu.siacs.conversations.xml.Namespace; -import eu.siacs.conversations.xmpp.Jid; -import eu.siacs.conversations.xmpp.XmppConnection; -import eu.siacs.conversations.xmpp.jingle.AbstractJingleConnection; -import eu.siacs.conversations.xmpp.jingle.DirectConnectionUtils; -import eu.siacs.conversations.xmpp.jingle.stanzas.SocksByteStreamsTransportInfo; -import eu.siacs.conversations.xmpp.stanzas.IqPacket; - public class SocksByteStreamsTransport implements Transport { private final XmppConnection xmppConnection; diff --git a/src/main/java/eu/siacs/conversations/xmpp/jingle/transports/Transport.java b/src/main/java/eu/siacs/conversations/xmpp/jingle/transports/Transport.java index d24ca9637..ce99ac8cc 100644 --- a/src/main/java/eu/siacs/conversations/xmpp/jingle/transports/Transport.java +++ b/src/main/java/eu/siacs/conversations/xmpp/jingle/transports/Transport.java @@ -2,14 +2,14 @@ package eu.siacs.conversations.xmpp.jingle.transports; import com.google.common.util.concurrent.ListenableFuture; +import eu.siacs.conversations.xmpp.jingle.stanzas.GenericTransportInfo; +import eu.siacs.conversations.xmpp.jingle.stanzas.Group; + import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.util.concurrent.CountDownLatch; -import eu.siacs.conversations.xmpp.jingle.stanzas.GenericTransportInfo; -import eu.siacs.conversations.xmpp.jingle.stanzas.Group; - public interface Transport { OutputStream getOutputStream() throws IOException; diff --git a/src/main/java/eu/siacs/conversations/xmpp/jingle/transports/WebRTCDataChannelTransport.java b/src/main/java/eu/siacs/conversations/xmpp/jingle/transports/WebRTCDataChannelTransport.java index 416a11111..e4dd730d5 100644 --- a/src/main/java/eu/siacs/conversations/xmpp/jingle/transports/WebRTCDataChannelTransport.java +++ b/src/main/java/eu/siacs/conversations/xmpp/jingle/transports/WebRTCDataChannelTransport.java @@ -14,6 +14,16 @@ import com.google.common.util.concurrent.ListenableFuture; import com.google.common.util.concurrent.MoreExecutors; import com.google.common.util.concurrent.SettableFuture; +import eu.siacs.conversations.Config; +import eu.siacs.conversations.entities.Account; +import eu.siacs.conversations.xml.Namespace; +import eu.siacs.conversations.xmpp.XmppConnection; +import eu.siacs.conversations.xmpp.jingle.IceServers; +import eu.siacs.conversations.xmpp.jingle.WebRTCWrapper; +import eu.siacs.conversations.xmpp.jingle.stanzas.IceUdpTransportInfo; +import eu.siacs.conversations.xmpp.jingle.stanzas.WebRTCDataChannelTransportInfo; +import eu.siacs.conversations.xmpp.stanzas.IqPacket; + import org.webrtc.CandidatePairChangeEvent; import org.webrtc.DataChannel; import org.webrtc.IceCandidate; @@ -43,16 +53,6 @@ import java.util.concurrent.atomic.AtomicBoolean; import javax.annotation.Nonnull; -import eu.siacs.conversations.Config; -import eu.siacs.conversations.entities.Account; -import eu.siacs.conversations.xml.Namespace; -import eu.siacs.conversations.xmpp.XmppConnection; -import eu.siacs.conversations.xmpp.jingle.IceServers; -import eu.siacs.conversations.xmpp.jingle.WebRTCWrapper; -import eu.siacs.conversations.xmpp.jingle.stanzas.IceUdpTransportInfo; -import eu.siacs.conversations.xmpp.jingle.stanzas.WebRTCDataChannelTransportInfo; -import eu.siacs.conversations.xmpp.stanzas.IqPacket; - public class WebRTCDataChannelTransport implements Transport { private static final int BUFFER_SIZE = 16_384;