diff --git a/.gitignore b/.gitignore index 81a24e7f4..c689a5f59 100644 --- a/.gitignore +++ b/.gitignore @@ -9,7 +9,6 @@ src/quicksyPlaystore/res/values/push.xml # https://github.com/github/gitignore/blob/master/Gradle.gitignore .gradle/ build/ -gradle.properties captures/ signing.properties # Ignore Gradle GUI config diff --git a/.travis.yml b/.travis.yml index 48a836ed1..65506e26c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,8 +13,10 @@ before_script: - mkdir libs - wget -O libs/libwebrtc-m87.aar https://gultsch.de/files/libwebrtc-m87.aar script: - - ./gradlew assembleConversationsFreeSystemRelease - - ./gradlew assembleQuicksyFreeCompatRelease + - ./gradlew assembleQuicksyFreeCompatDebug + - ./gradlew assembleQuicksyFreeSystemDebug + - ./gradlew assembleConversationsFreeCompatDebug + - ./gradlew assembleConversationsFreeSystemDebug before_install: - yes | sdkmanager "platforms;android-28" diff --git a/CHANGELOG.md b/CHANGELOG.md index 9b597c4f6..d40c91daa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,15 @@ # Changelog +### Version 2.9.6 + +* Show call button for offline contacts if they previously announced support +* Back button no longer ends call when call is connected +* bug fixes + +### Version 2.9.5 + +* Quicksy: Automatically receive verification SMS + ### Version 2.9.4 * minor stability improvements for A/V calls diff --git a/build.gradle b/build.gradle index ff48deaaa..fefd66061 100644 --- a/build.gradle +++ b/build.gradle @@ -8,7 +8,7 @@ buildscript { jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:4.1.1' + classpath 'com.android.tools.build:gradle:4.1.2' } } @@ -26,37 +26,36 @@ configurations { conversationsFreeCompatImplementation conversationsPlaystoreCompatImplementation conversationsPlaystoreSystemImplementation + quicksyPlaystoreCompatImplementation + quicksyPlaystoreSystemImplementation quicksyFreeCompatImplementation quicksyImplementation } -ext { - supportLibVersion = '28.0.0' -} - dependencies { + implementation 'androidx.viewpager:viewpager:1.0.0' + //should remain that low because later versions introduce dependency to androidx (not sure exactly from what version) - playstoreImplementation('com.google.firebase:firebase-messaging:17.3.4') { + playstoreImplementation('com.google.firebase:firebase-messaging:21.0.1') { exclude group: 'com.google.firebase', module: 'firebase-core' exclude group: 'com.google.firebase', module: 'firebase-analytics' exclude group: 'com.google.firebase', module: 'firebase-measurement-connector' } - conversationsPlaystoreCompatImplementation("com.android.installreferrer:installreferrer:1.1.2") - conversationsPlaystoreSystemImplementation("com.android.installreferrer:installreferrer:1.1.2") + conversationsPlaystoreCompatImplementation("com.android.installreferrer:installreferrer:2.2") + conversationsPlaystoreSystemImplementation("com.android.installreferrer:installreferrer:2.2") + quicksyPlaystoreCompatImplementation 'com.google.android.gms:play-services-auth-api-phone:17.5.0' + quicksyPlaystoreSystemImplementation 'com.google.android.gms:play-services-auth-api-phone:17.5.0' implementation 'org.sufficientlysecure:openpgp-api:10.0' - implementation('com.theartofdev.edmodo:android-image-cropper:2.7.+') { - exclude group: 'com.android.support', module: 'appcompat-v7' - exclude group: 'com.android.support', module: 'exifinterface' - } - implementation "com.android.support:support-v13:$supportLibVersion" - implementation "com.android.support:appcompat-v7:$supportLibVersion" - implementation "com.android.support:exifinterface:$supportLibVersion" - implementation "com.android.support:cardview-v7:$supportLibVersion" - implementation "com.android.support:support-emoji:$supportLibVersion" - implementation "com.android.support:design:$supportLibVersion" - compatImplementation "com.android.support:support-emoji-appcompat:$supportLibVersion" - conversationsFreeCompatImplementation "com.android.support:support-emoji-bundled:$supportLibVersion" - quicksyFreeCompatImplementation "com.android.support:support-emoji-bundled:$supportLibVersion" + implementation 'com.theartofdev.edmodo:android-image-cropper:2.8.0' + implementation 'androidx.appcompat:appcompat:1.2.0' + implementation 'androidx.exifinterface:exifinterface:1.3.2' + implementation 'androidx.cardview:cardview:1.0.0' + implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0' + implementation 'androidx.emoji:emoji:1.1.0' + implementation 'com.google.android.material:material:1.2.1' + compatImplementation 'androidx.emoji:emoji-appcompat:1.1.0' + conversationsFreeCompatImplementation 'androidx.emoji:emoji-bundled:1.1.0' + quicksyFreeCompatImplementation 'androidx.emoji:emoji-bundled:1.1.0' implementation 'org.bouncycastle:bcmail-jdk15on:1.64' //zxing stopped supporting Java 7 so we have to stick with 3.3.3 //https://github.com/zxing/zxing/issues/1170 @@ -79,7 +78,7 @@ dependencies { //okhttp needs to stick with 3.12.x implementation 'com.squareup.okhttp3:okhttp:3.12.12' implementation 'com.google.guava:guava:27.1-android' - quicksyImplementation 'io.michaelrocks:libphonenumber-android:8.11.1' + quicksyImplementation 'io.michaelrocks:libphonenumber-android:8.12.16' //implementation fileTree(include: ['libwebrtc-m87.aar'], dir: 'libs') implementation 'org.webrtc:google-webrtc:1.0.32006' } @@ -96,8 +95,8 @@ android { defaultConfig { minSdkVersion 21 targetSdkVersion 29 - versionCode 404 - versionName "2.9.4" + versionCode 407 + versionName "2.9.6" archivesBaseName += "-$versionName" applicationId "eu.sum7.conversations" resValue "string", "applicationId", applicationId @@ -152,14 +151,21 @@ android { } sourceSets { + quicksyFreeSystem { + java { + srcDir 'src/quicksyFree/java' + } + } quicksyFreeCompat { java { srcDir 'src/freeCompat/java' + srcDir 'src/quicksyFree/java' } } quicksyPlaystoreCompat { java { srcDir 'src/playstoreCompat/java' + srcDir 'src/quicksyPlaystore/java' } res { srcDir 'src/playstoreCompat/res' @@ -167,6 +173,9 @@ android { } } quicksyPlaystoreSystem { + java { + srcDir 'src/quicksyPlaystore/java' + } res { srcDir 'src/quicksyPlaystore/res' } diff --git a/conversations.doap b/conversations.doap index 6dccb05f2..462d750da 100644 --- a/conversations.doap +++ b/conversations.doap @@ -26,6 +26,15 @@ en + + + + + + + + + Java @@ -82,6 +91,28 @@ 1.1 + + + + complete + 1.1 + + + + + + complete + 1.2 + + + + + + partial + 1.2 + Avatars only + + @@ -110,6 +141,14 @@ 1.5.1 + + + + partial + 1.1 + Read only. Publication via XEP-0398 + + @@ -123,7 +162,14 @@ complete 1.1.2 - File transfer only + File transfer + A/V calls + + + + + + complete + 1.2.1 @@ -134,6 +180,13 @@ read only + + + + complete + 1.1 + + @@ -162,6 +215,27 @@ 2.0.1 + + + + complete + 2.0.1 + + + + + + complete + 0.7 + + + + + + complete + 1.1 + + @@ -213,11 +287,25 @@ - + + complete + 1.0.1 + + + + + complete 1.0 + + + + complete + 1.2.0 + + @@ -233,6 +321,13 @@ opt-in + + + + complete + 1.0.0 + + @@ -240,6 +335,20 @@ 0.3 + + + + complete + 1.0.0 + + + + + + complete + 1.0.0 + + @@ -247,6 +356,13 @@ 0.3.0 + + + + complete + 0.3.0 + + @@ -255,6 +371,13 @@ Only available in the version distributed over Google Play + + + + complete + 1.0.0 + + diff --git a/gradle.properties b/gradle.properties new file mode 100644 index 000000000..431e485f2 --- /dev/null +++ b/gradle.properties @@ -0,0 +1,3 @@ +android.useAndroidX=true +android.enableJetifier=true +org.gradle.jvmargs=-Xmx4096m diff --git a/metadata/en-US/changelogs/407.txt b/metadata/en-US/changelogs/407.txt new file mode 100644 index 000000000..8af4fe67b --- /dev/null +++ b/metadata/en-US/changelogs/407.txt @@ -0,0 +1,3 @@ +• Show call button for offline contacts if they previously announced support +• Back button no longer ends call when call is connected +• bug fixes diff --git a/src/compat/java/eu/siacs/conversations/ui/widget/EmojiWrapperEditText.java b/src/compat/java/eu/siacs/conversations/ui/widget/EmojiWrapperEditText.java index af6587ef5..01905e376 100644 --- a/src/compat/java/eu/siacs/conversations/ui/widget/EmojiWrapperEditText.java +++ b/src/compat/java/eu/siacs/conversations/ui/widget/EmojiWrapperEditText.java @@ -1,9 +1,10 @@ package eu.siacs.conversations.ui.widget; import android.content.Context; -import android.support.text.emoji.widget.EmojiAppCompatEditText; import android.util.AttributeSet; +import androidx.emoji.widget.EmojiAppCompatEditText; + public class EmojiWrapperEditText extends EmojiAppCompatEditText { public EmojiWrapperEditText(Context context) { diff --git a/src/compat/java/eu/siacs/conversations/utils/EmojiWrapper.java b/src/compat/java/eu/siacs/conversations/utils/EmojiWrapper.java index 9466531a3..3b6cf71e1 100644 --- a/src/compat/java/eu/siacs/conversations/utils/EmojiWrapper.java +++ b/src/compat/java/eu/siacs/conversations/utils/EmojiWrapper.java @@ -29,7 +29,7 @@ package eu.siacs.conversations.utils; -import android.support.text.emoji.EmojiCompat; +import androidx.emoji.text.EmojiCompat; public class EmojiWrapper { diff --git a/src/conversations/java/eu/siacs/conversations/entities/AccountConfiguration.java b/src/conversations/java/eu/siacs/conversations/entities/AccountConfiguration.java index 702d45e23..65b6804f9 100644 --- a/src/conversations/java/eu/siacs/conversations/entities/AccountConfiguration.java +++ b/src/conversations/java/eu/siacs/conversations/entities/AccountConfiguration.java @@ -1,7 +1,6 @@ package eu.siacs.conversations.entities; import com.google.common.base.Preconditions; -import com.google.common.base.Strings; import com.google.gson.Gson; import com.google.gson.GsonBuilder; import com.google.gson.JsonSyntaxException; diff --git a/src/conversations/java/eu/siacs/conversations/services/ImportBackupService.java b/src/conversations/java/eu/siacs/conversations/services/ImportBackupService.java index 3fee92855..9c6ebaafd 100644 --- a/src/conversations/java/eu/siacs/conversations/services/ImportBackupService.java +++ b/src/conversations/java/eu/siacs/conversations/services/ImportBackupService.java @@ -12,10 +12,11 @@ import android.net.Uri; import android.os.Binder; import android.os.IBinder; import android.provider.OpenableColumns; -import android.support.v4.app.NotificationCompat; -import android.support.v4.app.NotificationManagerCompat; import android.util.Log; +import androidx.core.app.NotificationCompat; +import androidx.core.app.NotificationManagerCompat; + import com.google.common.base.Charsets; import com.google.common.base.Stopwatch; import com.google.common.io.CountingInputStream; @@ -60,7 +61,7 @@ import eu.siacs.conversations.xmpp.Jid; public class ImportBackupService extends Service { private static final int NOTIFICATION_ID = 21; - private static AtomicBoolean running = new AtomicBoolean(false); + private static final AtomicBoolean running = new AtomicBoolean(false); private final ImportBackupServiceBinder binder = new ImportBackupServiceBinder(); private final SerialSingleThreadExecutor executor = new SerialSingleThreadExecutor(getClass().getSimpleName()); private final Set mOnBackupProcessedListeners = Collections.newSetFromMap(new WeakHashMap<>()); diff --git a/src/conversations/java/eu/siacs/conversations/services/QuickConversationsService.java b/src/conversations/java/eu/siacs/conversations/services/QuickConversationsService.java index 1d83a5cb5..b2a0d17f4 100644 --- a/src/conversations/java/eu/siacs/conversations/services/QuickConversationsService.java +++ b/src/conversations/java/eu/siacs/conversations/services/QuickConversationsService.java @@ -1,5 +1,10 @@ package eu.siacs.conversations.services; +import android.content.Intent; +import android.util.Log; + +import eu.siacs.conversations.Config; + public class QuickConversationsService extends AbstractQuickConversationsService { QuickConversationsService(XmppConnectionService xmppConnectionService) { @@ -25,4 +30,9 @@ public class QuickConversationsService extends AbstractQuickConversationsService public void considerSyncBackground(boolean force) { } + + @Override + public void handleSmsReceived(Intent intent) { + Log.d(Config.LOGTAG,"ignoring received SMS"); + } } \ No newline at end of file diff --git a/src/conversations/java/eu/siacs/conversations/ui/EasyOnboardingInviteActivity.java b/src/conversations/java/eu/siacs/conversations/ui/EasyOnboardingInviteActivity.java index 4db0f5bfe..fea92401b 100644 --- a/src/conversations/java/eu/siacs/conversations/ui/EasyOnboardingInviteActivity.java +++ b/src/conversations/java/eu/siacs/conversations/ui/EasyOnboardingInviteActivity.java @@ -2,17 +2,17 @@ package eu.siacs.conversations.ui; import android.app.Activity; import android.content.Intent; -import android.databinding.DataBindingUtil; import android.graphics.Bitmap; import android.graphics.Point; import android.os.Bundle; -import android.support.v7.widget.Toolbar; import android.util.Log; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.Toast; +import androidx.databinding.DataBindingUtil; + import com.google.common.base.Strings; import eu.siacs.conversations.Config; @@ -34,7 +34,7 @@ public class EasyOnboardingInviteActivity extends XmppActivity implements EasyOn public void onCreate(final Bundle bundle) { super.onCreate(bundle); this.binding = DataBindingUtil.setContentView(this, R.layout.activity_easy_invite); - setSupportActionBar((Toolbar) binding.toolbar); + setSupportActionBar(binding.toolbar); configureActionBar(getSupportActionBar(), true); this.binding.shareButton.setOnClickListener(v -> share()); if (bundle != null && bundle.containsKey("invite")) { diff --git a/src/conversations/java/eu/siacs/conversations/ui/ImportBackupActivity.java b/src/conversations/java/eu/siacs/conversations/ui/ImportBackupActivity.java index da4512465..888c75129 100644 --- a/src/conversations/java/eu/siacs/conversations/ui/ImportBackupActivity.java +++ b/src/conversations/java/eu/siacs/conversations/ui/ImportBackupActivity.java @@ -5,21 +5,22 @@ import android.content.Context; import android.content.DialogInterface; import android.content.Intent; import android.content.ServiceConnection; -import android.databinding.DataBindingUtil; import android.net.Uri; import android.os.Build; import android.os.Bundle; import android.os.IBinder; -import android.support.design.widget.Snackbar; -import android.support.v4.content.ContextCompat; -import android.support.v7.app.AlertDialog; -import android.support.v7.widget.Toolbar; import android.util.Log; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuItem; import android.view.View; +import androidx.appcompat.app.AlertDialog; +import androidx.core.content.ContextCompat; +import androidx.databinding.DataBindingUtil; + +import com.google.android.material.snackbar.Snackbar; + import java.io.IOException; import java.util.List; @@ -48,7 +49,7 @@ public class ImportBackupActivity extends ActionBarActivity implements ServiceCo setTheme(this.mTheme); super.onCreate(savedInstanceState); binding = DataBindingUtil.setContentView(this, R.layout.activity_import_backup); - setSupportActionBar((Toolbar) binding.toolbar); + setSupportActionBar(binding.toolbar); setLoadingState(savedInstanceState != null && savedInstanceState.getBoolean("loading_state", false)); this.backupFileAdapter = new BackupFileAdapter(); this.binding.list.setAdapter(this.backupFileAdapter); diff --git a/src/conversations/java/eu/siacs/conversations/ui/MagicCreateActivity.java b/src/conversations/java/eu/siacs/conversations/ui/MagicCreateActivity.java index 6b772abf9..6f0386672 100644 --- a/src/conversations/java/eu/siacs/conversations/ui/MagicCreateActivity.java +++ b/src/conversations/java/eu/siacs/conversations/ui/MagicCreateActivity.java @@ -2,14 +2,14 @@ package eu.siacs.conversations.ui; import android.content.Intent; import android.content.pm.ActivityInfo; -import android.databinding.DataBindingUtil; import android.os.Bundle; -import android.support.v7.widget.Toolbar; import android.text.Editable; import android.text.TextWatcher; import android.view.View; import android.widget.Toast; +import androidx.databinding.DataBindingUtil; + import java.security.SecureRandom; import eu.siacs.conversations.Config; @@ -61,7 +61,7 @@ public class MagicCreateActivity extends XmppActivity implements TextWatcher { } super.onCreate(savedInstanceState); this.binding = DataBindingUtil.setContentView(this, R.layout.magic_create); - setSupportActionBar((Toolbar) this.binding.toolbar); + setSupportActionBar(this.binding.toolbar); configureActionBar(getSupportActionBar(), this.domain == null); if (username != null && domain != null) { binding.title.setText(R.string.your_server_invitation); diff --git a/src/conversations/java/eu/siacs/conversations/ui/ManageAccountActivity.java b/src/conversations/java/eu/siacs/conversations/ui/ManageAccountActivity.java index 1c127a877..c1ee451be 100644 --- a/src/conversations/java/eu/siacs/conversations/ui/ManageAccountActivity.java +++ b/src/conversations/java/eu/siacs/conversations/ui/ManageAccountActivity.java @@ -5,9 +5,6 @@ import android.content.Intent; import android.os.Bundle; import android.security.KeyChain; import android.security.KeyChainAliasCallback; -import android.support.annotation.NonNull; -import android.support.v7.app.ActionBar; -import android.support.v7.app.AlertDialog; import android.util.Pair; import android.view.ContextMenu; import android.view.ContextMenu.ContextMenuInfo; @@ -18,6 +15,10 @@ import android.widget.AdapterView.AdapterContextMenuInfo; import android.widget.ListView; import android.widget.Toast; +import androidx.annotation.NonNull; +import androidx.appcompat.app.ActionBar; +import androidx.appcompat.app.AlertDialog; + import org.openintents.openpgp.util.OpenPgpApi; import java.util.ArrayList; @@ -31,8 +32,8 @@ import eu.siacs.conversations.services.XmppConnectionService; import eu.siacs.conversations.services.XmppConnectionService.OnAccountUpdate; import eu.siacs.conversations.ui.adapter.AccountAdapter; import eu.siacs.conversations.ui.util.MenuDoubleTabUtil; -import eu.siacs.conversations.xmpp.XmppConnection; import eu.siacs.conversations.xmpp.Jid; +import eu.siacs.conversations.xmpp.XmppConnection; import static eu.siacs.conversations.utils.PermissionUtils.allGranted; import static eu.siacs.conversations.utils.PermissionUtils.writeGranted; @@ -226,7 +227,7 @@ public class ManageAccountActivity extends XmppActivity implements OnAccountUpda @Override - public void onRequestPermissionsResult(int requestCode, @NonNull String permissions[], @NonNull int[] grantResults) { + public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { if (grantResults.length > 0) { if (allGranted(grantResults)) { switch (requestCode) { diff --git a/src/conversations/java/eu/siacs/conversations/ui/PickServerActivity.java b/src/conversations/java/eu/siacs/conversations/ui/PickServerActivity.java index f84f47d69..06320d33d 100644 --- a/src/conversations/java/eu/siacs/conversations/ui/PickServerActivity.java +++ b/src/conversations/java/eu/siacs/conversations/ui/PickServerActivity.java @@ -2,12 +2,12 @@ package eu.siacs.conversations.ui; import android.content.Intent; import android.content.pm.ActivityInfo; -import android.databinding.DataBindingUtil; import android.os.Bundle; -import android.support.v7.app.AppCompatActivity; -import android.support.v7.widget.Toolbar; import android.view.MenuItem; +import androidx.appcompat.app.AppCompatActivity; +import androidx.databinding.DataBindingUtil; + import java.util.List; import eu.siacs.conversations.R; @@ -66,7 +66,7 @@ public class PickServerActivity extends XmppActivity { } super.onCreate(savedInstanceState); ActivityPickServerBinding binding = DataBindingUtil.setContentView(this, R.layout.activity_pick_server); - setSupportActionBar((Toolbar) binding.toolbar); + setSupportActionBar(binding.toolbar); configureActionBar(getSupportActionBar()); binding.useCim.setOnClickListener(v -> { final Intent intent = new Intent(this, MagicCreateActivity.class); diff --git a/src/conversations/java/eu/siacs/conversations/ui/WelcomeActivity.java b/src/conversations/java/eu/siacs/conversations/ui/WelcomeActivity.java index 03e41a1bf..8f652ce8e 100644 --- a/src/conversations/java/eu/siacs/conversations/ui/WelcomeActivity.java +++ b/src/conversations/java/eu/siacs/conversations/ui/WelcomeActivity.java @@ -4,20 +4,19 @@ import android.Manifest; import android.content.ActivityNotFoundException; import android.content.Intent; import android.content.pm.ActivityInfo; -import android.content.pm.PackageManager; -import android.databinding.DataBindingUtil; import android.net.Uri; import android.os.Bundle; import android.security.KeyChain; import android.security.KeyChainAliasCallback; -import android.support.annotation.NonNull; -import android.support.v7.app.AppCompatActivity; -import android.support.v7.widget.Toolbar; import android.util.Log; import android.view.Menu; import android.view.MenuItem; import android.widget.Toast; +import androidx.annotation.NonNull; +import androidx.appcompat.app.AppCompatActivity; +import androidx.databinding.DataBindingUtil; + import java.util.Arrays; import java.util.List; @@ -120,7 +119,7 @@ public class WelcomeActivity extends XmppActivity implements XmppConnectionServi } super.onCreate(savedInstanceState); ActivityWelcomeBinding binding = DataBindingUtil.setContentView(this, R.layout.activity_welcome); - setSupportActionBar((Toolbar) binding.toolbar); + setSupportActionBar(binding.toolbar); configureActionBar(getSupportActionBar(), false); binding.registerNewAccount.setOnClickListener(v -> { final Intent intent = new Intent(this, PickServerActivity.class); diff --git a/src/conversations/java/eu/siacs/conversations/ui/adapter/BackupFileAdapter.java b/src/conversations/java/eu/siacs/conversations/ui/adapter/BackupFileAdapter.java index e71505e96..9857dcd8a 100644 --- a/src/conversations/java/eu/siacs/conversations/ui/adapter/BackupFileAdapter.java +++ b/src/conversations/java/eu/siacs/conversations/ui/adapter/BackupFileAdapter.java @@ -1,13 +1,10 @@ package eu.siacs.conversations.ui.adapter; import android.content.res.Resources; -import android.databinding.DataBindingUtil; import android.graphics.Bitmap; import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.Drawable; import android.os.AsyncTask; -import android.support.annotation.NonNull; -import android.support.v7.widget.RecyclerView; import android.text.format.DateUtils; import android.util.DisplayMetrics; import android.view.LayoutInflater; @@ -15,6 +12,10 @@ import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; +import androidx.annotation.NonNull; +import androidx.databinding.DataBindingUtil; +import androidx.recyclerview.widget.RecyclerView; + import java.lang.ref.WeakReference; import java.util.ArrayList; import java.util.List; diff --git a/src/conversations/res/layout/activity_import_backup.xml b/src/conversations/res/layout/activity_import_backup.xml index b1d0bd9b0..5435c0f72 100644 --- a/src/conversations/res/layout/activity_import_backup.xml +++ b/src/conversations/res/layout/activity_import_backup.xml @@ -26,20 +26,20 @@ - - - + app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" /> + \ No newline at end of file diff --git a/src/conversations/res/layout/dialog_enter_password.xml b/src/conversations/res/layout/dialog_enter_password.xml index e2fc38ff4..40f3ba34d 100644 --- a/src/conversations/res/layout/dialog_enter_password.xml +++ b/src/conversations/res/layout/dialog_enter_password.xml @@ -22,7 +22,7 @@ android:text="@string/restore_warning" android:textAppearance="@style/TextAppearance.Conversations.Body1"/> - - + \ No newline at end of file diff --git a/src/conversations/res/values-bg/strings.xml b/src/conversations/res/values-bg/strings.xml index 8839fe441..0ac2e3710 100644 --- a/src/conversations/res/values-bg/strings.xml +++ b/src/conversations/res/values-bg/strings.xml @@ -5,4 +5,13 @@ Създаване не нов профил Имате ли вече XMPP профил? Това може да се случи, ако вече използвате друг клиент на XMPP или сте използвали преди това Conversations. Ако не, можете да създадете нов XMPP профил в момента.\nСъвет: Някои доставчици на имейл също предоставят XMPP профили.   - + XMPP е мрежа за общуване чрез мигновени съобщения, която не е обвързана с конкретен доставчик. Можете да използвате клиента с всеки сървър, който работи с XMPP.\nЗа Ваше удобство, ние предоставяме лесен начин да си създадете профил в conversations.im¹ — сървър, пригоден да работи добре с Conversations. + Бяхте поканен(а) в %1$s. Ще Ви преведем през процеса на създаване на акаунт.\nИзбирайки %1$s за доставчик, Вие ще можете да общувате и с потребители на други доставчици, като им предоставите своя пълен адрес за XMPP. + Бяхте поканен(а) в %1$s. Вече Ви избрахме потребителско име. Ще Ви преведем през процеса на създаване на акаунт.\nЩе можете да общувате и с потребители на други доставчици, като им предоставите своя пълен адрес за XMPP. + Вашата покана за сървъра + Неправилно форматиран код за достъп + Докоснете бутона за споделяне, за да изпратите на контакта си покана за %1$s. + Ако контактът Ви е наблизо, може да сканира кода по-долу, за да приеме поканата Ви. + Присъедини се в %1$s и си пиши с мен: %2$s + Споделяне на поканата чрез… + diff --git a/src/conversations/res/values-ca/strings.xml b/src/conversations/res/values-ca/strings.xml index 71a32bc6b..be3d17103 100644 --- a/src/conversations/res/values-ca/strings.xml +++ b/src/conversations/res/values-ca/strings.xml @@ -2,4 +2,16 @@ Triï el seu proveïdor de XMPP - \ No newline at end of file + Fer servir conversations.im + Crear un compte nou + Ja tens un compte XMPP? Aquest podria ser el cas si ja estàs usant un client XMPP diferent o has usat Converses abans. Si no, pots crear un nou compte XMPP ara mateix.\nPista: Alguns proveïdors de correu electrònic també proporcionen comptes XMPP. + XMPP és una xarxa de missatgeria instantània independent del proveïdor. Pots usar aquest client amb qualsevol servidor XMPP que triïs. No obstant això, per a la teva conveniència, hem fet fàcil la creació d\'un compte en Conversaciones.im¹; un proveïdor especialment adequat per a l\'ús amb Conversations. + Has estat convidat a %1$s. Et guiarem a través del procés de creació d\'un compte.\nEn triar%1$s com a proveïdor podràs comunicar-se amb els usuaris d\'altres proveïdors donant-los la seva adreça XMPP completa. + Has estat convidat a %1$s . Ja s\'ha triat un nom d\'usuari per a tu. Et guiarem en el procés de creació d\'un compte. Podràs comunicar-te amb usuaris d\'altres proveïdors donant-los la teva adreça XMPP completa. + La teva invitació al servidor + Codi d\'aprovisionament mal formatat + Toca el botó de compartir per a enviar al teu contacte una invitació a %1$s . + Si el teu contacte està a prop, també pot escanejar el codi de baix per a acceptar la teva invitació. + Uneix-te %1$s i xerra amb mi: %2$s + Comparteix la invitació amb... + \ No newline at end of file diff --git a/src/conversations/res/values-es/strings.xml b/src/conversations/res/values-es/strings.xml index 28a26cde4..bc7b23af9 100644 --- a/src/conversations/res/values-es/strings.xml +++ b/src/conversations/res/values-es/strings.xml @@ -9,4 +9,8 @@ Has sido invitado a %1$s. Un nombre de usuario ya ha sido escogido para ti. Te guiaremos durante el proceso de creación de la cuenta.\nPodrás comunicarte con otros usuarios de otros servidores proporcionándoles tu dirección XMPP completa. Tu invitación al servidor Código de abastecimiento formateado incorrectamente - + Pulsa el botón de compartir para enviar a tu contacto una invitación a %1$s. + Si tu contacto está cerca, también puede escanear el código mostrado debajo para aceptar tu invitación. + Únete a %1$s y chatea conmigo: %2$s + Compartir invitación con... + diff --git a/src/conversations/res/values-id/strings.xml b/src/conversations/res/values-id/strings.xml new file mode 100644 index 000000000..fb4121cc3 --- /dev/null +++ b/src/conversations/res/values-id/strings.xml @@ -0,0 +1,16 @@ + + + Pilih XMPP server anda + Gunakan conversations.im + Buat akun baru + Anda sudah memiliki akun XMPP? Ini mungkin terjadi jika Anda sudah menggunakan aplikasi XMPP yang berbeda atau pernah menggunakan Conversations sebelumnya. Jika tidak, Anda dapat membuat akun XMPP baru. \ NPetunjuk: Beberapa penyedia layanan email juga menyediakan akun XMPP. + XMPP adalah jaringan penyedia pesan instan independen. Anda dapat menggunakan aplikasi ini dengan server XMPP pilihan Anda. \ NNamun demi kenyamanan Anda, kami permudah untuk membuat akun di Conversations.im¹; provider yang sangat cocok digunakan dengan Conversations. + Anda telah diundang ke %1$s. Kami akan memandu Anda melalui proses pembuatan akun. \nSaat memilih %1$s sebagai penyedia, Anda akan dapat berkomunikasi dengan pengguna provider lain dengan memberikan alamat XMPP lengkap Anda kepada mereka. + Anda telah diundang ke%1$s. Username telah dipilihkan untuk Anda. Kami akan memandu Anda melalui proses pembuatan akun. \nAnda dapat berkomunikasi dengan pengguna provider lain dengan memberi mereka alamat XMPP lengkap Anda. + Undangan server Anda + Kode provisioning tidak diformat dengan benar + Klik tombol bagikan untuk mengirim undangan ke kontak Anda %1$s. + Jika kontak Anda di dekat Anda, mereka juga dapat memindai kode di bawah ini untuk menerima undangan Anda + Bergabung %1$s dan mengobrol dengan saya: %2$s + Bagikan undangan dengan... + \ No newline at end of file diff --git a/src/freeCompat/java/eu/siacs/conversations/ui/service/EmojiService.java b/src/freeCompat/java/eu/siacs/conversations/ui/service/EmojiService.java index 53cea0dfd..1f60368bb 100644 --- a/src/freeCompat/java/eu/siacs/conversations/ui/service/EmojiService.java +++ b/src/freeCompat/java/eu/siacs/conversations/ui/service/EmojiService.java @@ -2,14 +2,9 @@ package eu.siacs.conversations.ui.service; import android.content.Context; import android.os.Build; -import android.support.text.emoji.EmojiCompat; -import android.support.text.emoji.FontRequestEmojiCompatConfig; -import android.support.text.emoji.bundled.BundledEmojiCompatConfig; -import android.support.v4.provider.FontRequest; -import android.util.Log; - -import eu.siacs.conversations.Config; -import eu.siacs.conversations.R; +import androidx.emoji.text.EmojiCompat; +import androidx.emoji.text.FontRequestEmojiCompatConfig; +import androidx.emoji.bundled.BundledEmojiCompatConfig; public class EmojiService { diff --git a/src/main/AndroidManifest.xml b/src/main/AndroidManifest.xml index 16731574e..c98aae041 100644 --- a/src/main/AndroidManifest.xml +++ b/src/main/AndroidManifest.xml @@ -266,7 +266,7 @@ diff --git a/src/main/java/eu/siacs/conversations/Config.java b/src/main/java/eu/siacs/conversations/Config.java index d0fdc8e2a..bd70f2731 100644 --- a/src/main/java/eu/siacs/conversations/Config.java +++ b/src/main/java/eu/siacs/conversations/Config.java @@ -6,8 +6,8 @@ import android.net.Uri; import java.util.Collections; import java.util.List; -import eu.siacs.conversations.xmpp.chatstate.ChatState; import eu.siacs.conversations.xmpp.Jid; +import eu.siacs.conversations.xmpp.chatstate.ChatState; public final class Config { private static final int UNENCRYPTED = 1; diff --git a/src/main/java/eu/siacs/conversations/crypto/PgpEngine.java b/src/main/java/eu/siacs/conversations/crypto/PgpEngine.java index 69f78c913..c5ca3ad75 100644 --- a/src/main/java/eu/siacs/conversations/crypto/PgpEngine.java +++ b/src/main/java/eu/siacs/conversations/crypto/PgpEngine.java @@ -2,9 +2,10 @@ package eu.siacs.conversations.crypto; import android.app.PendingIntent; import android.content.Intent; -import android.support.annotation.StringRes; import android.util.Log; +import androidx.annotation.StringRes; + import org.openintents.openpgp.OpenPgpError; import org.openintents.openpgp.OpenPgpSignatureResult; import org.openintents.openpgp.util.OpenPgpApi; @@ -30,8 +31,8 @@ import eu.siacs.conversations.services.XmppConnectionService; import eu.siacs.conversations.ui.UiCallback; public class PgpEngine { - private OpenPgpApi api; - private XmppConnectionService mXmppConnectionService; + private final OpenPgpApi api; + private final XmppConnectionService mXmppConnectionService; public PgpEngine(OpenPgpApi api, XmppConnectionService service) { this.api = api; diff --git a/src/main/java/eu/siacs/conversations/crypto/axolotl/AxolotlService.java b/src/main/java/eu/siacs/conversations/crypto/axolotl/AxolotlService.java index cc22bc818..b43d331c8 100644 --- a/src/main/java/eu/siacs/conversations/crypto/axolotl/AxolotlService.java +++ b/src/main/java/eu/siacs/conversations/crypto/axolotl/AxolotlService.java @@ -2,18 +2,19 @@ package eu.siacs.conversations.crypto.axolotl; import android.os.Bundle; import android.security.KeyChain; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; import android.util.Log; import android.util.Pair; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; + import org.bouncycastle.jce.provider.BouncyCastleProvider; -import org.whispersystems.libsignal.SignalProtocolAddress; import org.whispersystems.libsignal.IdentityKey; import org.whispersystems.libsignal.IdentityKeyPair; import org.whispersystems.libsignal.InvalidKeyException; import org.whispersystems.libsignal.InvalidKeyIdException; import org.whispersystems.libsignal.SessionBuilder; +import org.whispersystems.libsignal.SignalProtocolAddress; import org.whispersystems.libsignal.UntrustedIdentityException; import org.whispersystems.libsignal.ecc.ECPublicKey; import org.whispersystems.libsignal.state.PreKeyBundle; @@ -48,12 +49,12 @@ import eu.siacs.conversations.services.XmppConnectionService; import eu.siacs.conversations.utils.CryptoHelper; import eu.siacs.conversations.utils.SerialSingleThreadExecutor; import eu.siacs.conversations.xml.Element; +import eu.siacs.conversations.xmpp.Jid; import eu.siacs.conversations.xmpp.OnAdvancedStreamFeaturesLoaded; import eu.siacs.conversations.xmpp.OnIqPacketReceived; import eu.siacs.conversations.xmpp.pep.PublishOptions; import eu.siacs.conversations.xmpp.stanzas.IqPacket; import eu.siacs.conversations.xmpp.stanzas.MessagePacket; -import eu.siacs.conversations.xmpp.Jid; public class AxolotlService implements OnAdvancedStreamFeaturesLoaded { @@ -85,9 +86,9 @@ public class AxolotlService implements OnAdvancedStreamFeaturesLoaded { private int numPublishTriesOnEmptyPep = 0; private boolean pepBroken = false; private int lastDeviceListNotificationHash = 0; - private Set postponedSessions = new HashSet<>(); //sessions stored here will receive after mam catchup treatment - private Set postponedHealing = new HashSet<>(); //addresses stored here will need a healing notification after mam catchup - private AtomicBoolean changeAccessMode = new AtomicBoolean(false); + private final Set postponedSessions = new HashSet<>(); //sessions stored here will receive after mam catchup treatment + private final Set postponedHealing = new HashSet<>(); //addresses stored here will need a healing notification after mam catchup + private final AtomicBoolean changeAccessMode = new AtomicBoolean(false); public AxolotlService(Account account, XmppConnectionService connectionService) { if (account == null || connectionService == null) { diff --git a/src/main/java/eu/siacs/conversations/crypto/axolotl/SQLiteAxolotlStore.java b/src/main/java/eu/siacs/conversations/crypto/axolotl/SQLiteAxolotlStore.java index d723bd262..866449c18 100644 --- a/src/main/java/eu/siacs/conversations/crypto/axolotl/SQLiteAxolotlStore.java +++ b/src/main/java/eu/siacs/conversations/crypto/axolotl/SQLiteAxolotlStore.java @@ -3,15 +3,15 @@ package eu.siacs.conversations.crypto.axolotl; import android.util.Log; import android.util.LruCache; -import org.whispersystems.libsignal.SignalProtocolAddress; import org.whispersystems.libsignal.IdentityKey; import org.whispersystems.libsignal.IdentityKeyPair; import org.whispersystems.libsignal.InvalidKeyIdException; +import org.whispersystems.libsignal.SignalProtocolAddress; import org.whispersystems.libsignal.ecc.Curve; import org.whispersystems.libsignal.ecc.ECKeyPair; -import org.whispersystems.libsignal.state.SignalProtocolStore; import org.whispersystems.libsignal.state.PreKeyRecord; import org.whispersystems.libsignal.state.SessionRecord; +import org.whispersystems.libsignal.state.SignalProtocolStore; import org.whispersystems.libsignal.state.SignedPreKeyRecord; import org.whispersystems.libsignal.util.KeyHelper; diff --git a/src/main/java/eu/siacs/conversations/crypto/axolotl/XmppAxolotlSession.java b/src/main/java/eu/siacs/conversations/crypto/axolotl/XmppAxolotlSession.java index c48459190..20af42fe4 100644 --- a/src/main/java/eu/siacs/conversations/crypto/axolotl/XmppAxolotlSession.java +++ b/src/main/java/eu/siacs/conversations/crypto/axolotl/XmppAxolotlSession.java @@ -1,10 +1,10 @@ package eu.siacs.conversations.crypto.axolotl; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; import android.util.Log; -import org.whispersystems.libsignal.SignalProtocolAddress; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; + import org.whispersystems.libsignal.DuplicateMessageException; import org.whispersystems.libsignal.IdentityKey; import org.whispersystems.libsignal.InvalidKeyException; @@ -14,6 +14,7 @@ import org.whispersystems.libsignal.InvalidVersionException; import org.whispersystems.libsignal.LegacyMessageException; import org.whispersystems.libsignal.NoSessionException; import org.whispersystems.libsignal.SessionCipher; +import org.whispersystems.libsignal.SignalProtocolAddress; import org.whispersystems.libsignal.UntrustedIdentityException; import org.whispersystems.libsignal.protocol.CiphertextMessage; import org.whispersystems.libsignal.protocol.PreKeySignalMessage; diff --git a/src/main/java/eu/siacs/conversations/entities/Account.java b/src/main/java/eu/siacs/conversations/entities/Account.java index bd6e4e54e..bd71dc9fa 100644 --- a/src/main/java/eu/siacs/conversations/entities/Account.java +++ b/src/main/java/eu/siacs/conversations/entities/Account.java @@ -27,9 +27,9 @@ import eu.siacs.conversations.services.AvatarService; import eu.siacs.conversations.services.XmppConnectionService; import eu.siacs.conversations.utils.UIHelper; import eu.siacs.conversations.utils.XmppUri; +import eu.siacs.conversations.xmpp.Jid; import eu.siacs.conversations.xmpp.XmppConnection; import eu.siacs.conversations.xmpp.jingle.RtpCapability; -import eu.siacs.conversations.xmpp.Jid; public class Account extends AbstractEntity implements AvatarService.Avatarable { diff --git a/src/main/java/eu/siacs/conversations/entities/Bookmark.java b/src/main/java/eu/siacs/conversations/entities/Bookmark.java index e04328b1a..7ded4f842 100644 --- a/src/main/java/eu/siacs/conversations/entities/Bookmark.java +++ b/src/main/java/eu/siacs/conversations/entities/Bookmark.java @@ -1,8 +1,9 @@ package eu.siacs.conversations.entities; import android.content.Context; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; import java.lang.ref.WeakReference; import java.util.ArrayList; @@ -21,7 +22,7 @@ import eu.siacs.conversations.xmpp.Jid; public class Bookmark extends Element implements ListItem { - private Account account; + private final Account account; private WeakReference conversation; private Jid jid; diff --git a/src/main/java/eu/siacs/conversations/entities/Contact.java b/src/main/java/eu/siacs/conversations/entities/Contact.java index a3cbfc896..5453f9c23 100644 --- a/src/main/java/eu/siacs/conversations/entities/Contact.java +++ b/src/main/java/eu/siacs/conversations/entities/Contact.java @@ -4,9 +4,12 @@ import android.content.ContentValues; import android.content.Context; import android.database.Cursor; import android.net.Uri; -import android.support.annotation.NonNull; import android.text.TextUtils; +import androidx.annotation.NonNull; + +import com.google.common.base.Strings; + import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; @@ -16,6 +19,7 @@ import java.util.Collection; import java.util.HashSet; import java.util.List; import java.util.Locale; +import java.util.Objects; import eu.siacs.conversations.Config; import eu.siacs.conversations.R; @@ -25,8 +29,9 @@ import eu.siacs.conversations.services.QuickConversationsService; import eu.siacs.conversations.utils.JidHelper; import eu.siacs.conversations.utils.UIHelper; import eu.siacs.conversations.xml.Element; -import eu.siacs.conversations.xmpp.pep.Avatar; import eu.siacs.conversations.xmpp.Jid; +import eu.siacs.conversations.xmpp.jingle.RtpCapability; +import eu.siacs.conversations.xmpp.pep.Avatar; public class Contact implements ListItem, Blockable { public static final String TABLENAME = "contacts"; @@ -44,6 +49,7 @@ public class Contact implements ListItem, Blockable { public static final String LAST_PRESENCE = "last_presence"; public static final String LAST_TIME = "last_time"; public static final String GROUPS = "groups"; + public static final String RTP_CAPABILITY = "rtpCapability"; private String accountUuid; private String systemName; private String serverName; @@ -62,11 +68,12 @@ public class Contact implements ListItem, Blockable { private boolean mActive = false; private long mLastseen = 0; private String mLastPresence = null; + private RtpCapability.Capability rtpCapability; public Contact(final String account, final String systemName, final String serverName, final String presenceName, final Jid jid, final int subscription, final String photoUri, final Uri systemAccount, final String keys, final String avatar, final long lastseen, - final String presence, final String groups) { + final String presence, final String groups, final RtpCapability.Capability rtpCapability) { this.accountUuid = account; this.systemName = systemName; this.serverName = serverName; @@ -94,6 +101,7 @@ public class Contact implements ListItem, Blockable { } this.mLastseen = lastseen; this.mLastPresence = presence; + this.rtpCapability = rtpCapability; } public Contact(final Jid jid) { @@ -127,10 +135,17 @@ public class Contact implements ListItem, Blockable { cursor.getString(cursor.getColumnIndex(AVATAR)), cursor.getLong(cursor.getColumnIndex(LAST_TIME)), cursor.getString(cursor.getColumnIndex(LAST_PRESENCE)), - cursor.getString(cursor.getColumnIndex(GROUPS))); + cursor.getString(cursor.getColumnIndex(GROUPS)), + RtpCapability.Capability.of(cursor.getString(cursor.getColumnIndex(RTP_CAPABILITY)))); } public String getDisplayName() { + if (isSelf()) { + final String displayName = account.getDisplayName(); + if (!Strings.isNullOrEmpty(displayName)) { + return displayName; + } + } if (Config.X509_VERIFICATION && !TextUtils.isEmpty(this.commonName)) { return this.commonName; } else if (!TextUtils.isEmpty(this.systemName)) { @@ -226,6 +241,7 @@ public class Contact implements ListItem, Blockable { values.put(LAST_PRESENCE, mLastPresence); values.put(LAST_TIME, mLastseen); values.put(GROUPS, groups.toString()); + values.put(RTP_CAPABILITY, rtpCapability == null ? null : rtpCapability.toString()); return values; } } @@ -565,7 +581,18 @@ public class Contact implements ListItem, Blockable { return (avatar != null && avatar.getFilename() != null) || presenceName != null; } - public final class Options { + public boolean refreshRtpCapability() { + final RtpCapability.Capability previous = this.rtpCapability; + this.rtpCapability = RtpCapability.check(this, false); + return !Objects.equals(previous, this.rtpCapability); + } + + public RtpCapability.Capability getRtpCapability() { + + return this.rtpCapability; + } + + public static final class Options { public static final int TO = 0; public static final int FROM = 1; public static final int ASKING = 2; diff --git a/src/main/java/eu/siacs/conversations/entities/Conversation.java b/src/main/java/eu/siacs/conversations/entities/Conversation.java index 702873fe2..a38dc5427 100644 --- a/src/main/java/eu/siacs/conversations/entities/Conversation.java +++ b/src/main/java/eu/siacs/conversations/entities/Conversation.java @@ -2,10 +2,11 @@ package eu.siacs.conversations.entities; import android.content.ContentValues; import android.database.Cursor; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; import android.text.TextUtils; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; + import com.google.common.collect.ComparisonChain; import com.google.common.collect.Lists; @@ -28,9 +29,9 @@ import eu.siacs.conversations.services.AvatarService; import eu.siacs.conversations.services.QuickConversationsService; import eu.siacs.conversations.utils.JidHelper; import eu.siacs.conversations.utils.UIHelper; +import eu.siacs.conversations.xmpp.Jid; import eu.siacs.conversations.xmpp.chatstate.ChatState; import eu.siacs.conversations.xmpp.mam.MamReference; -import eu.siacs.conversations.xmpp.Jid; import static eu.siacs.conversations.entities.Bookmark.printableValue; @@ -68,12 +69,12 @@ public class Conversation extends AbstractEntity implements Blockable, Comparabl public AtomicBoolean messagesLoaded = new AtomicBoolean(true); protected Account account = null; private String draftMessage; - private String name; - private String contactUuid; - private String accountUuid; + private final String name; + private final String contactUuid; + private final String accountUuid; private Jid contactJid; private int status; - private long created; + private final long created; private int mode; private JSONObject attributes; private Jid nextCounterpart; @@ -487,7 +488,7 @@ public class Conversation extends AbstractEntity implements Blockable, Comparabl public void setLastClearHistory(long time, String reference) { if (reference != null) { - setAttribute(ATTRIBUTE_LAST_CLEAR_HISTORY, String.valueOf(time) + ":" + reference); + setAttribute(ATTRIBUTE_LAST_CLEAR_HISTORY, time + ":" + reference); } else { setAttribute(ATTRIBUTE_LAST_CLEAR_HISTORY, time); } diff --git a/src/main/java/eu/siacs/conversations/entities/MucOptions.java b/src/main/java/eu/siacs/conversations/entities/MucOptions.java index 67657159a..d1f6525ce 100644 --- a/src/main/java/eu/siacs/conversations/entities/MucOptions.java +++ b/src/main/java/eu/siacs/conversations/entities/MucOptions.java @@ -1,9 +1,10 @@ package eu.siacs.conversations.entities; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; import android.text.TextUtils; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; + import java.util.ArrayList; import java.util.Collections; import java.util.HashSet; @@ -17,11 +18,11 @@ import eu.siacs.conversations.services.AvatarService; import eu.siacs.conversations.services.MessageArchiveService; import eu.siacs.conversations.utils.JidHelper; import eu.siacs.conversations.utils.UIHelper; +import eu.siacs.conversations.xmpp.Jid; import eu.siacs.conversations.xmpp.chatstate.ChatState; import eu.siacs.conversations.xmpp.forms.Data; import eu.siacs.conversations.xmpp.forms.Field; import eu.siacs.conversations.xmpp.pep.Avatar; -import eu.siacs.conversations.xmpp.Jid; public class MucOptions { @@ -37,7 +38,7 @@ public class MucOptions { private final Conversation conversation; public OnRenameListener onRenameListener = null; private boolean mAutoPushConfiguration = true; - private Account account; + private final Account account; private ServiceDiscoveryResult serviceDiscoveryResult; private boolean isOnline = false; private Error error = Error.NONE; @@ -158,11 +159,8 @@ public class MucOptions { } public boolean allowInvites() { - final Field allowInvitesField = getRoomInfoForm().getFieldByName("muc#roomconfig_allowinvites"); - final boolean allowInvites = allowInvitesField != null && "1".equals(allowInvitesField.getValue()); - final Field allowMemberInvitesField = getRoomInfoForm().getFieldByName("muc#roomconfig_allowmemberinvites"); - final boolean allowMemberInvites = allowMemberInvitesField != null && "1".equals(allowMemberInvitesField.getValue()); - return allowInvites || allowMemberInvites; + final Field field = getRoomInfoForm().getFieldByName("muc#roomconfig_allowinvites"); + return field != null && "1".equals(field.getValue()); } public boolean canChangeSubject() { @@ -636,8 +634,8 @@ public class MucOptions { OUTCAST(0, R.string.outcast), NONE(1, R.string.no_affiliation); - private int resId; - private int rank; + private final int resId; + private final int rank; Affiliation(int rank, int resId) { this.resId = resId; @@ -679,8 +677,8 @@ public class MucOptions { PARTICIPANT(R.string.participant, 2), NONE(R.string.no_role, 0); - private int resId; - private int rank; + private final int resId; + private final int rank; Role(int resId, int rank) { this.resId = resId; @@ -747,7 +745,7 @@ public class MucOptions { private Jid fullJid; private long pgpKeyId = 0; private Avatar avatar; - private MucOptions options; + private final MucOptions options; private ChatState chatState = Config.DEFAULT_CHAT_STATE; public User(MucOptions options, Jid fullJid) { @@ -858,7 +856,7 @@ public class MucOptions { @Override public String toString() { - return "[fulljid:" + String.valueOf(fullJid) + ",realjid:" + String.valueOf(realJid) + ",affiliation" + affiliation.toString() + "]"; + return "[fulljid:" + fullJid + ",realjid:" + realJid + ",affiliation" + affiliation.toString() + "]"; } public boolean realJidMatchesAccount() { diff --git a/src/main/java/eu/siacs/conversations/entities/Presence.java b/src/main/java/eu/siacs/conversations/entities/Presence.java index 5b89e5279..edafd95de 100644 --- a/src/main/java/eu/siacs/conversations/entities/Presence.java +++ b/src/main/java/eu/siacs/conversations/entities/Presence.java @@ -1,13 +1,12 @@ package eu.siacs.conversations.entities; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; -import java.lang.Comparable; import java.util.Locale; import eu.siacs.conversations.xml.Element; -public class Presence implements Comparable { +public class Presence implements Comparable { public enum Status { CHAT, ONLINE, AWAY, XA, DND, OFFLINE; @@ -64,8 +63,8 @@ public class Presence implements Comparable { return new Presence(Status.fromShowString(show), ver, hash, node, message); } - public int compareTo(@NonNull Object other) { - return this.status.compareTo(((Presence)other).status); + public int compareTo(@NonNull Presence other) { + return this.status.compareTo(other.status); } public Status getStatus() { diff --git a/src/main/java/eu/siacs/conversations/entities/Presences.java b/src/main/java/eu/siacs/conversations/entities/Presences.java index feca98839..04d378cc2 100644 --- a/src/main/java/eu/siacs/conversations/entities/Presences.java +++ b/src/main/java/eu/siacs/conversations/entities/Presences.java @@ -136,6 +136,9 @@ public class Presences { public boolean anySupport(final String namespace) { synchronized (this.presences) { + if (this.presences.size() == 0) { + return true; + } for (Presence presence : this.presences.values()) { ServiceDiscoveryResult disco = presence.getServiceDiscoveryResult(); if (disco != null && disco.getFeatures().contains(namespace)) { diff --git a/src/main/java/eu/siacs/conversations/entities/RtpSessionStatus.java b/src/main/java/eu/siacs/conversations/entities/RtpSessionStatus.java index 8e360cb27..87a2e0601 100644 --- a/src/main/java/eu/siacs/conversations/entities/RtpSessionStatus.java +++ b/src/main/java/eu/siacs/conversations/entities/RtpSessionStatus.java @@ -1,6 +1,6 @@ package eu.siacs.conversations.entities; -import android.support.annotation.DrawableRes; +import androidx.annotation.DrawableRes; import com.google.common.base.Strings; diff --git a/src/main/java/eu/siacs/conversations/entities/ServiceDiscoveryResult.java b/src/main/java/eu/siacs/conversations/entities/ServiceDiscoveryResult.java index d0bdb5632..8eccbe141 100644 --- a/src/main/java/eu/siacs/conversations/entities/ServiceDiscoveryResult.java +++ b/src/main/java/eu/siacs/conversations/entities/ServiceDiscoveryResult.java @@ -2,26 +2,23 @@ package eu.siacs.conversations.entities; import android.content.ContentValues; import android.database.Cursor; -import android.support.annotation.NonNull; import android.util.Base64; -import android.util.Log; + +import androidx.annotation.NonNull; import com.google.common.base.Strings; -import java.io.UnsupportedEncodingException; -import java.lang.Comparable; -import java.security.MessageDigest; -import java.security.NoSuchAlgorithmException; -import java.util.ArrayList; -import java.util.Collections; -import java.util.Comparator; -import java.util.List; - import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; -import eu.siacs.conversations.Config; +import java.nio.charset.StandardCharsets; +import java.security.MessageDigest; +import java.security.NoSuchAlgorithmException; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + import eu.siacs.conversations.xml.Element; import eu.siacs.conversations.xml.Namespace; import eu.siacs.conversations.xmpp.forms.Data; @@ -242,12 +239,8 @@ public class ServiceDiscoveryResult { return null; } - try { - return md.digest(s.toString().getBytes("UTF-8")); - } catch (UnsupportedEncodingException e) { - return null; - } - } + return md.digest(s.toString().getBytes(StandardCharsets.UTF_8)); + } private JSONObject toJSON() { try { diff --git a/src/main/java/eu/siacs/conversations/entities/TransferablePlaceholder.java b/src/main/java/eu/siacs/conversations/entities/TransferablePlaceholder.java index e065953ef..c8a60d7d9 100644 --- a/src/main/java/eu/siacs/conversations/entities/TransferablePlaceholder.java +++ b/src/main/java/eu/siacs/conversations/entities/TransferablePlaceholder.java @@ -2,7 +2,7 @@ package eu.siacs.conversations.entities; public class TransferablePlaceholder implements Transferable { - private int status; + private final int status; public TransferablePlaceholder(int status) { this.status = status; diff --git a/src/main/java/eu/siacs/conversations/generator/IqGenerator.java b/src/main/java/eu/siacs/conversations/generator/IqGenerator.java index 1e5a0ed14..ae9ce3bd5 100644 --- a/src/main/java/eu/siacs/conversations/generator/IqGenerator.java +++ b/src/main/java/eu/siacs/conversations/generator/IqGenerator.java @@ -29,12 +29,12 @@ import eu.siacs.conversations.entities.Conversation; import eu.siacs.conversations.entities.DownloadableFile; import eu.siacs.conversations.services.MessageArchiveService; import eu.siacs.conversations.services.XmppConnectionService; -import eu.siacs.conversations.xml.Namespace; import eu.siacs.conversations.xml.Element; +import eu.siacs.conversations.xml.Namespace; +import eu.siacs.conversations.xmpp.Jid; import eu.siacs.conversations.xmpp.forms.Data; import eu.siacs.conversations.xmpp.pep.Avatar; import eu.siacs.conversations.xmpp.stanzas.IqPacket; -import eu.siacs.conversations.xmpp.Jid; public class IqGenerator extends AbstractGenerator { @@ -430,7 +430,7 @@ public class IqGenerator extends AbstractGenerator { ByteBuffer bb = ByteBuffer.wrap(new byte[16]); bb.putLong(uuid.getMostSignificantBits()); bb.putLong(uuid.getLeastSignificantBits()); - return Base64.encodeToString(bb.array(), Base64.URL_SAFE | Base64.NO_PADDING | Base64.NO_WRAP) + name.substring(pos, name.length()); + return Base64.encodeToString(bb.array(), Base64.URL_SAFE | Base64.NO_PADDING | Base64.NO_WRAP) + name.substring(pos); } catch (Exception e) { return name; } diff --git a/src/main/java/eu/siacs/conversations/http/HttpDownloadConnection.java b/src/main/java/eu/siacs/conversations/http/HttpDownloadConnection.java index 476ea2d20..03ee51de0 100644 --- a/src/main/java/eu/siacs/conversations/http/HttpDownloadConnection.java +++ b/src/main/java/eu/siacs/conversations/http/HttpDownloadConnection.java @@ -1,9 +1,10 @@ package eu.siacs.conversations.http; import android.os.PowerManager; -import android.support.annotation.Nullable; import android.util.Log; +import androidx.annotation.Nullable; + import com.google.common.base.Strings; import com.google.common.io.ByteStreams; @@ -328,7 +329,7 @@ public class HttpDownloadConnection implements Transferable { private long retrieveFileSize() throws IOException { try { - Log.d(Config.LOGTAG, "retrieve file size. interactive:" + String.valueOf(interactive)); + Log.d(Config.LOGTAG, "retrieve file size. interactive:" + interactive); changeStatus(STATUS_CHECKING); HttpURLConnection connection; final String hostname = mUrl.getHost(); diff --git a/src/main/java/eu/siacs/conversations/http/SlotRequester.java b/src/main/java/eu/siacs/conversations/http/SlotRequester.java index d9f4cdc20..b52bab39a 100644 --- a/src/main/java/eu/siacs/conversations/http/SlotRequester.java +++ b/src/main/java/eu/siacs/conversations/http/SlotRequester.java @@ -42,12 +42,12 @@ import eu.siacs.conversations.parser.IqParser; import eu.siacs.conversations.services.XmppConnectionService; import eu.siacs.conversations.xml.Element; import eu.siacs.conversations.xml.Namespace; -import eu.siacs.conversations.xmpp.stanzas.IqPacket; import eu.siacs.conversations.xmpp.Jid; +import eu.siacs.conversations.xmpp.stanzas.IqPacket; public class SlotRequester { - private XmppConnectionService service; + private final XmppConnectionService service; public SlotRequester(XmppConnectionService service) { this.service = service; diff --git a/src/main/java/eu/siacs/conversations/parser/AbstractParser.java b/src/main/java/eu/siacs/conversations/parser/AbstractParser.java index 80390be43..000fa036d 100644 --- a/src/main/java/eu/siacs/conversations/parser/AbstractParser.java +++ b/src/main/java/eu/siacs/conversations/parser/AbstractParser.java @@ -3,7 +3,6 @@ package eu.siacs.conversations.parser; import java.text.ParseException; import java.text.SimpleDateFormat; - import java.util.ArrayList; import java.util.List; import java.util.Locale; @@ -15,8 +14,8 @@ import eu.siacs.conversations.entities.MucOptions; import eu.siacs.conversations.services.XmppConnectionService; import eu.siacs.conversations.xml.Element; import eu.siacs.conversations.xmpp.InvalidJid; -import eu.siacs.conversations.xmpp.stanzas.AbstractStanza; import eu.siacs.conversations.xmpp.Jid; +import eu.siacs.conversations.xmpp.stanzas.AbstractStanza; public abstract class AbstractParser { @@ -82,7 +81,7 @@ public abstract class AbstractParser { } else { ms = 0; } - timestamp = timestamp.substring(0,19)+timestamp.substring(timestamp.length() -5,timestamp.length()); + timestamp = timestamp.substring(0,19)+timestamp.substring(timestamp.length() -5); dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ",Locale.US); return Math.min(dateFormat.parse(timestamp).getTime()+ms, System.currentTimeMillis()); } diff --git a/src/main/java/eu/siacs/conversations/parser/IqParser.java b/src/main/java/eu/siacs/conversations/parser/IqParser.java index 537f36058..d02d69ddc 100644 --- a/src/main/java/eu/siacs/conversations/parser/IqParser.java +++ b/src/main/java/eu/siacs/conversations/parser/IqParser.java @@ -1,10 +1,11 @@ package eu.siacs.conversations.parser; -import android.support.annotation.NonNull; import android.text.TextUtils; import android.util.Log; import android.util.Pair; +import androidx.annotation.NonNull; + import com.google.common.base.CharMatcher; import com.google.common.io.BaseEncoding; @@ -35,11 +36,11 @@ import eu.siacs.conversations.services.XmppConnectionService; import eu.siacs.conversations.xml.Element; import eu.siacs.conversations.xml.Namespace; import eu.siacs.conversations.xmpp.InvalidJid; +import eu.siacs.conversations.xmpp.Jid; import eu.siacs.conversations.xmpp.OnIqPacketReceived; import eu.siacs.conversations.xmpp.OnUpdateBlocklist; import eu.siacs.conversations.xmpp.forms.Data; import eu.siacs.conversations.xmpp.stanzas.IqPacket; -import eu.siacs.conversations.xmpp.Jid; public class IqParser extends AbstractParser implements OnIqPacketReceived { diff --git a/src/main/java/eu/siacs/conversations/parser/MessageParser.java b/src/main/java/eu/siacs/conversations/parser/MessageParser.java index d2e35fc4f..17e00a975 100644 --- a/src/main/java/eu/siacs/conversations/parser/MessageParser.java +++ b/src/main/java/eu/siacs/conversations/parser/MessageParser.java @@ -38,17 +38,17 @@ import eu.siacs.conversations.services.MessageArchiveService; import eu.siacs.conversations.services.QuickConversationsService; import eu.siacs.conversations.services.XmppConnectionService; import eu.siacs.conversations.utils.CryptoHelper; +import eu.siacs.conversations.xml.Element; import eu.siacs.conversations.xml.LocalizedContent; import eu.siacs.conversations.xml.Namespace; -import eu.siacs.conversations.xml.Element; import eu.siacs.conversations.xmpp.InvalidJid; +import eu.siacs.conversations.xmpp.Jid; import eu.siacs.conversations.xmpp.OnMessagePacketReceived; import eu.siacs.conversations.xmpp.chatstate.ChatState; import eu.siacs.conversations.xmpp.jingle.JingleConnectionManager; import eu.siacs.conversations.xmpp.jingle.JingleRtpConnection; import eu.siacs.conversations.xmpp.pep.Avatar; import eu.siacs.conversations.xmpp.stanzas.MessagePacket; -import eu.siacs.conversations.xmpp.Jid; public class MessageParser extends AbstractParser implements OnMessagePacketReceived { diff --git a/src/main/java/eu/siacs/conversations/parser/PresenceParser.java b/src/main/java/eu/siacs/conversations/parser/PresenceParser.java index 6d9937766..d0ec7f6bc 100644 --- a/src/main/java/eu/siacs/conversations/parser/PresenceParser.java +++ b/src/main/java/eu/siacs/conversations/parser/PresenceParser.java @@ -5,7 +5,6 @@ import android.util.Log; 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; @@ -22,10 +21,10 @@ import eu.siacs.conversations.utils.XmppUri; import eu.siacs.conversations.xml.Element; import eu.siacs.conversations.xml.Namespace; import eu.siacs.conversations.xmpp.InvalidJid; +import eu.siacs.conversations.xmpp.Jid; import eu.siacs.conversations.xmpp.OnPresencePacketReceived; import eu.siacs.conversations.xmpp.pep.Avatar; import eu.siacs.conversations.xmpp.stanzas.PresencePacket; -import eu.siacs.conversations.xmpp.Jid; public class PresenceParser extends AbstractParser implements OnPresencePacketReceived { diff --git a/src/main/java/eu/siacs/conversations/persistance/DatabaseBackend.java b/src/main/java/eu/siacs/conversations/persistance/DatabaseBackend.java index dce2f8e20..f21efa6d5 100644 --- a/src/main/java/eu/siacs/conversations/persistance/DatabaseBackend.java +++ b/src/main/java/eu/siacs/conversations/persistance/DatabaseBackend.java @@ -11,11 +11,12 @@ import android.os.SystemClock; import android.util.Base64; import android.util.Log; +import org.json.JSONException; import org.json.JSONObject; -import org.whispersystems.libsignal.SignalProtocolAddress; import org.whispersystems.libsignal.IdentityKey; import org.whispersystems.libsignal.IdentityKeyPair; import org.whispersystems.libsignal.InvalidKeyException; +import org.whispersystems.libsignal.SignalProtocolAddress; import org.whispersystems.libsignal.state.PreKeyRecord; import org.whispersystems.libsignal.state.SessionRecord; import org.whispersystems.libsignal.state.SignedPreKeyRecord; @@ -36,8 +37,6 @@ import java.util.Set; import java.util.UUID; import java.util.concurrent.CopyOnWriteArrayList; -import org.json.JSONException; - import eu.siacs.conversations.Config; import eu.siacs.conversations.crypto.axolotl.AxolotlService; import eu.siacs.conversations.crypto.axolotl.FingerprintStatus; @@ -57,15 +56,15 @@ import eu.siacs.conversations.utils.FtsUtils; import eu.siacs.conversations.utils.MimeUtils; import eu.siacs.conversations.utils.Resolver; import eu.siacs.conversations.xmpp.InvalidJid; -import eu.siacs.conversations.xmpp.mam.MamReference; import eu.siacs.conversations.xmpp.Jid; +import eu.siacs.conversations.xmpp.mam.MamReference; public class DatabaseBackend extends SQLiteOpenHelper { private static final String DATABASE_NAME = "history"; private static final int DATABASE_VERSION = 48; private static DatabaseBackend instance = null; - private static String CREATE_CONTATCS_STATEMENT = "create table " + private static final String CREATE_CONTATCS_STATEMENT = "create table " + Contact.TABLENAME + "(" + Contact.ACCOUNT + " TEXT, " + Contact.SERVERNAME + " TEXT, " + Contact.SYSTEMNAME + " TEXT," + Contact.PRESENCE_NAME + " TEXT," @@ -73,12 +72,13 @@ public class DatabaseBackend extends SQLiteOpenHelper { + Contact.PHOTOURI + " TEXT," + Contact.OPTIONS + " NUMBER," + Contact.SYSTEMACCOUNT + " NUMBER, " + Contact.AVATAR + " TEXT, " + Contact.LAST_PRESENCE + " TEXT, " + Contact.LAST_TIME + " NUMBER, " + + Contact.RTP_CAPABILITY + " TEXT," + Contact.GROUPS + " TEXT, FOREIGN KEY(" + Contact.ACCOUNT + ") REFERENCES " + Account.TABLENAME + "(" + Account.UUID + ") ON DELETE CASCADE, UNIQUE(" + Contact.ACCOUNT + ", " + Contact.JID + ") ON CONFLICT REPLACE);"; - private static String CREATE_DISCOVERY_RESULTS_STATEMENT = "create table " + private static final String CREATE_DISCOVERY_RESULTS_STATEMENT = "create table " + ServiceDiscoveryResult.TABLENAME + "(" + ServiceDiscoveryResult.HASH + " TEXT, " + ServiceDiscoveryResult.VER + " TEXT, " @@ -86,7 +86,7 @@ public class DatabaseBackend extends SQLiteOpenHelper { + "UNIQUE(" + ServiceDiscoveryResult.HASH + ", " + ServiceDiscoveryResult.VER + ") ON CONFLICT REPLACE);"; - private static String CREATE_PRESENCE_TEMPLATES_STATEMENT = "CREATE TABLE " + private static final String CREATE_PRESENCE_TEMPLATES_STATEMENT = "CREATE TABLE " + PresenceTemplate.TABELNAME + "(" + PresenceTemplate.UUID + " TEXT, " + PresenceTemplate.LAST_USED + " NUMBER," @@ -94,7 +94,7 @@ public class DatabaseBackend extends SQLiteOpenHelper { + PresenceTemplate.STATUS + " TEXT," + "UNIQUE(" + PresenceTemplate.MESSAGE + "," + PresenceTemplate.STATUS + ") ON CONFLICT REPLACE);"; - private static String CREATE_PREKEYS_STATEMENT = "CREATE TABLE " + private static final String CREATE_PREKEYS_STATEMENT = "CREATE TABLE " + SQLiteAxolotlStore.PREKEY_TABLENAME + "(" + SQLiteAxolotlStore.ACCOUNT + " TEXT, " + SQLiteAxolotlStore.ID + " INTEGER, " @@ -106,7 +106,7 @@ public class DatabaseBackend extends SQLiteOpenHelper { + ") ON CONFLICT REPLACE" + ");"; - private static String CREATE_SIGNED_PREKEYS_STATEMENT = "CREATE TABLE " + private static final String CREATE_SIGNED_PREKEYS_STATEMENT = "CREATE TABLE " + SQLiteAxolotlStore.SIGNED_PREKEY_TABLENAME + "(" + SQLiteAxolotlStore.ACCOUNT + " TEXT, " + SQLiteAxolotlStore.ID + " INTEGER, " @@ -118,7 +118,7 @@ public class DatabaseBackend extends SQLiteOpenHelper { + ") ON CONFLICT REPLACE" + ");"; - private static String CREATE_SESSIONS_STATEMENT = "CREATE TABLE " + private static final String CREATE_SESSIONS_STATEMENT = "CREATE TABLE " + SQLiteAxolotlStore.SESSION_TABLENAME + "(" + SQLiteAxolotlStore.ACCOUNT + " TEXT, " + SQLiteAxolotlStore.NAME + " TEXT, " @@ -132,7 +132,7 @@ public class DatabaseBackend extends SQLiteOpenHelper { + ") ON CONFLICT REPLACE" + ");"; - private static String CREATE_IDENTITIES_STATEMENT = "CREATE TABLE " + private static final String CREATE_IDENTITIES_STATEMENT = "CREATE TABLE " + SQLiteAxolotlStore.IDENTITIES_TABLENAME + "(" + SQLiteAxolotlStore.ACCOUNT + " TEXT, " + SQLiteAxolotlStore.NAME + " TEXT, " @@ -151,9 +151,9 @@ public class DatabaseBackend extends SQLiteOpenHelper { + ") ON CONFLICT IGNORE" + ");"; - private static String RESOLVER_RESULTS_TABLENAME = "resolver_results"; + private static final String RESOLVER_RESULTS_TABLENAME = "resolver_results"; - private static String CREATE_RESOLVER_RESULTS_TABLE = "create table " + RESOLVER_RESULTS_TABLENAME + "(" + private static final String CREATE_RESOLVER_RESULTS_TABLE = "create table " + RESOLVER_RESULTS_TABLENAME + "(" + Resolver.Result.DOMAIN + " TEXT," + Resolver.Result.HOSTNAME + " TEXT," + Resolver.Result.IP + " BLOB," @@ -165,16 +165,16 @@ public class DatabaseBackend extends SQLiteOpenHelper { + "UNIQUE(" + Resolver.Result.DOMAIN + ") ON CONFLICT REPLACE" + ");"; - private static String CREATE_MESSAGE_TIME_INDEX = "create INDEX message_time_index ON " + Message.TABLENAME + "(" + Message.TIME_SENT + ")"; - private static String CREATE_MESSAGE_CONVERSATION_INDEX = "create INDEX message_conversation_index ON " + Message.TABLENAME + "(" + Message.CONVERSATION + ")"; - private static String CREATE_MESSAGE_DELETED_INDEX = "create index message_deleted_index ON " + Message.TABLENAME + "(" + Message.DELETED + ")"; - private static String CREATE_MESSAGE_RELATIVE_FILE_PATH_INDEX = "create INDEX message_file_path_index ON " + Message.TABLENAME + "(" + Message.RELATIVE_FILE_PATH + ")"; - private static String CREATE_MESSAGE_TYPE_INDEX = "create INDEX message_type_index ON " + Message.TABLENAME + "(" + Message.TYPE + ")"; + private static final String CREATE_MESSAGE_TIME_INDEX = "create INDEX message_time_index ON " + Message.TABLENAME + "(" + Message.TIME_SENT + ")"; + private static final String CREATE_MESSAGE_CONVERSATION_INDEX = "create INDEX message_conversation_index ON " + Message.TABLENAME + "(" + Message.CONVERSATION + ")"; + private static final String CREATE_MESSAGE_DELETED_INDEX = "create index message_deleted_index ON " + Message.TABLENAME + "(" + Message.DELETED + ")"; + private static final String CREATE_MESSAGE_RELATIVE_FILE_PATH_INDEX = "create INDEX message_file_path_index ON " + Message.TABLENAME + "(" + Message.RELATIVE_FILE_PATH + ")"; + private static final String CREATE_MESSAGE_TYPE_INDEX = "create INDEX message_type_index ON " + Message.TABLENAME + "(" + Message.TYPE + ")"; - private static String CREATE_MESSAGE_INDEX_TABLE = "CREATE VIRTUAL TABLE messages_index USING FTS4(uuid TEXT PRIMARY KEY, body TEXT)"; - private static String CREATE_MESSAGE_INSERT_TRIGGER = "CREATE TRIGGER after_message_insert AFTER INSERT ON " + Message.TABLENAME + " BEGIN INSERT INTO messages_index (uuid,body) VALUES (new.uuid,new.body); END;"; - private static String CREATE_MESSAGE_UPDATE_TRIGGER = "CREATE TRIGGER after_message_update UPDATE of uuid,body ON " + Message.TABLENAME + " BEGIN update messages_index set body=new.body,uuid=new.uuid WHERE uuid=old.uuid; END;"; - private static String COPY_PREEXISTING_ENTRIES = "INSERT into messages_index(uuid,body) select uuid,body FROM " + Message.TABLENAME + ";"; + private static final String CREATE_MESSAGE_INDEX_TABLE = "CREATE VIRTUAL TABLE messages_index USING FTS4(uuid TEXT PRIMARY KEY, body TEXT)"; + private static final String CREATE_MESSAGE_INSERT_TRIGGER = "CREATE TRIGGER after_message_insert AFTER INSERT ON " + Message.TABLENAME + " BEGIN INSERT INTO messages_index (uuid,body) VALUES (new.uuid,new.body); END;"; + private static final String CREATE_MESSAGE_UPDATE_TRIGGER = "CREATE TRIGGER after_message_update UPDATE of uuid,body ON " + Message.TABLENAME + " BEGIN update messages_index set body=new.body,uuid=new.uuid WHERE uuid=old.uuid; END;"; + private static final String COPY_PREEXISTING_ENTRIES = "INSERT into messages_index(uuid,body) select uuid,body FROM " + Message.TABLENAME + ";"; private DatabaseBackend(Context context) { super(context, DATABASE_NAME, null, DATABASE_VERSION); @@ -563,6 +563,9 @@ public class DatabaseBackend extends SQLiteOpenHelper { if (oldVersion < 48 && newVersion >= 48) { db.execSQL("ALTER TABLE " + Contact.TABLENAME + " ADD COLUMN " + Contact.PRESENCE_NAME + " TEXT"); } + if (oldVersion < 48 && newVersion >= 48) { + db.execSQL("ALTER TABLE " + Contact.TABLENAME + " ADD COLUMN " + Contact.RTP_CAPABILITY + " TEXT"); + } } private void canonicalizeJids(SQLiteDatabase db) { @@ -633,7 +636,7 @@ public class DatabaseBackend extends SQLiteOpenHelper { continue; } - String updateArgs[] = { + String[] updateArgs = { newServer, cursor.getString(cursor.getColumnIndex(Account.UUID)), }; @@ -872,7 +875,7 @@ public class DatabaseBackend extends SQLiteOpenHelper { SQLiteDatabase db = this.getReadableDatabase(); final String SQL = "select uuid,relativeFilePath from messages where type in (1,2,5) and deleted=0 and "+Message.RELATIVE_FILE_PATH+" is not null and conversationUuid=(select uuid from conversations where accountUuid=? and (contactJid=? or contactJid like ?)) order by timeSent desc"; final String[] args = {account, jid.toString(), jid.toString() + "/%"}; - Cursor cursor = db.rawQuery(SQL + (limit > 0 ? " limit " + String.valueOf(limit) : ""), args); + Cursor cursor = db.rawQuery(SQL + (limit > 0 ? " limit " + limit : ""), args); List filesPaths = new ArrayList<>(); while (cursor.moveToNext()) { filesPaths.add(new FilePath(cursor.getString(0), cursor.getString(1))); @@ -1005,7 +1008,7 @@ public class DatabaseBackend extends SQLiteOpenHelper { public void readRoster(Roster roster) { SQLiteDatabase db = this.getReadableDatabase(); Cursor cursor; - String args[] = {roster.getAccount().getUuid()}; + String[] args = {roster.getAccount().getUuid()}; cursor = db.query(Contact.TABLENAME, null, Contact.ACCOUNT + "=?", args, null, null, null); while (cursor.moveToNext()) { roster.initContact(Contact.fromCursor(cursor)); diff --git a/src/main/java/eu/siacs/conversations/persistance/FileBackend.java b/src/main/java/eu/siacs/conversations/persistance/FileBackend.java index a072e9d9a..ce81694e4 100644 --- a/src/main/java/eu/siacs/conversations/persistance/FileBackend.java +++ b/src/main/java/eu/siacs/conversations/persistance/FileBackend.java @@ -20,8 +20,6 @@ import android.os.Environment; import android.os.ParcelFileDescriptor; import android.provider.MediaStore; import android.provider.OpenableColumns; -import android.support.annotation.RequiresApi; -import android.support.v4.content.FileProvider; import android.system.Os; import android.system.StructStat; import android.util.Base64; @@ -30,6 +28,9 @@ import android.util.DisplayMetrics; import android.util.Log; import android.util.LruCache; +import androidx.annotation.RequiresApi; +import androidx.core.content.FileProvider; + import java.io.ByteArrayOutputStream; import java.io.Closeable; import java.io.File; @@ -277,7 +278,6 @@ public class FileBackend { } finally { if (bitmap != null) { bitmap.recycle(); - ; } } } @@ -982,9 +982,9 @@ public class FileBackend { public Uri getTakePhotoUri() { File file; if (Config.ONLY_INTERNAL_STORAGE) { - file = new File(mXmppConnectionService.getCacheDir().getAbsolutePath(), "Camera/IMG_" + this.IMAGE_DATE_FORMAT.format(new Date()) + ".jpg"); + file = new File(mXmppConnectionService.getCacheDir().getAbsolutePath(), "Camera/IMG_" + IMAGE_DATE_FORMAT.format(new Date()) + ".jpg"); } else { - file = new File(getTakePhotoPath() + "IMG_" + this.IMAGE_DATE_FORMAT.format(new Date()) + ".jpg"); + file = new File(getTakePhotoPath() + "IMG_" + IMAGE_DATE_FORMAT.format(new Date()) + ".jpg"); } file.getParentFile().mkdirs(); return getUriForFile(mXmppConnectionService, file); @@ -1408,9 +1408,6 @@ public class FileBackend { return null; } Bitmap bm = cropCenter(getAvatarUri(avatar), size, size); - if (bm == null) { - return null; - } return bm; } @@ -1447,7 +1444,7 @@ public class FileBackend { } public static class FileCopyException extends Exception { - private int resId; + private final int resId; private FileCopyException(int resId) { this.resId = resId; diff --git a/src/main/java/eu/siacs/conversations/persistance/OnPhoneContactsMerged.java b/src/main/java/eu/siacs/conversations/persistance/OnPhoneContactsMerged.java index 6a457b17f..46ad9fa7b 100644 --- a/src/main/java/eu/siacs/conversations/persistance/OnPhoneContactsMerged.java +++ b/src/main/java/eu/siacs/conversations/persistance/OnPhoneContactsMerged.java @@ -1,5 +1,5 @@ package eu.siacs.conversations.persistance; public interface OnPhoneContactsMerged { - public void phoneContactsMerged(); + void phoneContactsMerged(); } diff --git a/src/main/java/eu/siacs/conversations/services/AbstractQuickConversationsService.java b/src/main/java/eu/siacs/conversations/services/AbstractQuickConversationsService.java index dabd36290..d05e40ae8 100644 --- a/src/main/java/eu/siacs/conversations/services/AbstractQuickConversationsService.java +++ b/src/main/java/eu/siacs/conversations/services/AbstractQuickConversationsService.java @@ -1,9 +1,14 @@ package eu.siacs.conversations.services; +import android.content.Intent; + import eu.siacs.conversations.BuildConfig; public abstract class AbstractQuickConversationsService { + + public static final String SMS_RETRIEVED_ACTION = "com.google.android.gms.auth.api.phone.SMS_RETRIEVED"; + protected final XmppConnectionService service; public AbstractQuickConversationsService(XmppConnectionService service) { @@ -25,4 +30,6 @@ public abstract class AbstractQuickConversationsService { public abstract boolean isSynchronizing(); public abstract void considerSyncBackground(boolean force); + + public abstract void handleSmsReceived(Intent intent); } diff --git a/src/main/java/eu/siacs/conversations/services/AppRTCAudioManager.java b/src/main/java/eu/siacs/conversations/services/AppRTCAudioManager.java index 144341b8e..e1fe854ff 100644 --- a/src/main/java/eu/siacs/conversations/services/AppRTCAudioManager.java +++ b/src/main/java/eu/siacs/conversations/services/AppRTCAudioManager.java @@ -20,9 +20,10 @@ import android.media.AudioManager; import android.media.AudioRecord; import android.media.MediaRecorder; import android.os.Build; -import android.support.annotation.Nullable; import android.util.Log; +import androidx.annotation.Nullable; + import org.webrtc.ThreadUtils; import java.util.Collections; @@ -47,7 +48,7 @@ public class AppRTCAudioManager { // Handles all tasks related to Bluetooth headset devices. private final AppRTCBluetoothManager bluetoothManager; @Nullable - private AudioManager audioManager; + private final AudioManager audioManager; @Nullable private AudioManagerEvents audioManagerEvents; private AudioManagerState amState; @@ -78,7 +79,7 @@ public class AppRTCAudioManager { // avoid duplicate elements. private Set audioDevices = new HashSet<>(); // Broadcast receiver for wired headset intent broadcasts. - private BroadcastReceiver wiredHeadsetReceiver; + private final BroadcastReceiver wiredHeadsetReceiver; // Callback method for changes in audio focus. @Nullable private AudioManager.OnAudioFocusChangeListener audioFocusChangeListener; diff --git a/src/main/java/eu/siacs/conversations/services/AppRTCBluetoothManager.java b/src/main/java/eu/siacs/conversations/services/AppRTCBluetoothManager.java index e5ea9be02..862cdf0c7 100644 --- a/src/main/java/eu/siacs/conversations/services/AppRTCBluetoothManager.java +++ b/src/main/java/eu/siacs/conversations/services/AppRTCBluetoothManager.java @@ -23,14 +23,15 @@ import android.media.AudioManager; import android.os.Handler; import android.os.Looper; import android.os.Process; -import android.support.annotation.Nullable; import android.util.Log; +import androidx.annotation.Nullable; + +import org.webrtc.ThreadUtils; + import java.util.List; import java.util.Set; -import org.webrtc.ThreadUtils; - import eu.siacs.conversations.Config; import eu.siacs.conversations.utils.AppRTCUtils; diff --git a/src/main/java/eu/siacs/conversations/services/AppRTCProximitySensor.java b/src/main/java/eu/siacs/conversations/services/AppRTCProximitySensor.java index 8bdc65f2e..2f24787c0 100644 --- a/src/main/java/eu/siacs/conversations/services/AppRTCProximitySensor.java +++ b/src/main/java/eu/siacs/conversations/services/AppRTCProximitySensor.java @@ -15,9 +15,10 @@ import android.hardware.SensorEvent; import android.hardware.SensorEventListener; import android.hardware.SensorManager; import android.os.Build; -import android.support.annotation.Nullable; import android.util.Log; +import androidx.annotation.Nullable; + import org.webrtc.ThreadUtils; import eu.siacs.conversations.Config; diff --git a/src/main/java/eu/siacs/conversations/services/AttachFileToConversationRunnable.java b/src/main/java/eu/siacs/conversations/services/AttachFileToConversationRunnable.java index eb3380396..a24d9e1e4 100644 --- a/src/main/java/eu/siacs/conversations/services/AttachFileToConversationRunnable.java +++ b/src/main/java/eu/siacs/conversations/services/AttachFileToConversationRunnable.java @@ -6,19 +6,18 @@ import android.net.Uri; import android.os.Build; import android.os.ParcelFileDescriptor; import android.preference.PreferenceManager; -import android.support.annotation.RequiresApi; import android.util.Log; +import androidx.annotation.RequiresApi; + import net.ypresto.androidtranscoder.MediaTranscoder; import net.ypresto.androidtranscoder.format.MediaFormatStrategy; -import net.ypresto.androidtranscoder.format.MediaFormatStrategyPresets; import java.io.File; import java.io.FileDescriptor; import java.io.FileNotFoundException; import java.util.concurrent.ExecutionException; import java.util.concurrent.Future; -import java.util.concurrent.atomic.AtomicInteger; import eu.siacs.conversations.Config; import eu.siacs.conversations.R; diff --git a/src/main/java/eu/siacs/conversations/services/AvatarService.java b/src/main/java/eu/siacs/conversations/services/AvatarService.java index 6a00e7440..7baee23f9 100644 --- a/src/main/java/eu/siacs/conversations/services/AvatarService.java +++ b/src/main/java/eu/siacs/conversations/services/AvatarService.java @@ -12,15 +12,15 @@ import android.graphics.Typeface; import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.Drawable; import android.net.Uri; -import android.support.annotation.ColorInt; -import android.support.annotation.Nullable; -import android.support.v4.content.res.ResourcesCompat; import android.text.TextUtils; import android.util.DisplayMetrics; import android.util.Log; import android.util.LruCache; -import java.util.ArrayList; +import androidx.annotation.ColorInt; +import androidx.annotation.Nullable; +import androidx.core.content.res.ResourcesCompat; + import java.util.HashMap; import java.util.HashSet; import java.util.List; @@ -40,9 +40,9 @@ import eu.siacs.conversations.entities.MucOptions; import eu.siacs.conversations.entities.RawBlockable; import eu.siacs.conversations.entities.Room; import eu.siacs.conversations.utils.UIHelper; +import eu.siacs.conversations.xmpp.Jid; import eu.siacs.conversations.xmpp.OnAdvancedStreamFeaturesLoaded; import eu.siacs.conversations.xmpp.XmppConnection; -import eu.siacs.conversations.xmpp.Jid; public class AvatarService implements OnAdvancedStreamFeaturesLoaded { @@ -519,7 +519,7 @@ public class AvatarService implements OnAdvancedStreamFeaturesLoaded { this.sizes.add(size); } return PREFIX_ACCOUNT + "_" + account.getUuid() + "_" - + String.valueOf(size); + + size; } /*public Bitmap get(String name, int size) { diff --git a/src/main/java/eu/siacs/conversations/services/BarcodeProvider.java b/src/main/java/eu/siacs/conversations/services/BarcodeProvider.java index bc9608ea3..582998aa2 100644 --- a/src/main/java/eu/siacs/conversations/services/BarcodeProvider.java +++ b/src/main/java/eu/siacs/conversations/services/BarcodeProvider.java @@ -13,9 +13,10 @@ import android.net.Uri; import android.os.CancellationSignal; import android.os.IBinder; import android.os.ParcelFileDescriptor; -import android.support.annotation.Nullable; import android.util.Log; +import androidx.annotation.Nullable; + import com.google.zxing.BarcodeFormat; import com.google.zxing.EncodeHintType; import com.google.zxing.common.BitMatrix; diff --git a/src/main/java/eu/siacs/conversations/services/ChannelDiscoveryService.java b/src/main/java/eu/siacs/conversations/services/ChannelDiscoveryService.java index 19c0085a0..a706dfb30 100644 --- a/src/main/java/eu/siacs/conversations/services/ChannelDiscoveryService.java +++ b/src/main/java/eu/siacs/conversations/services/ChannelDiscoveryService.java @@ -1,8 +1,9 @@ package eu.siacs.conversations.services; -import android.support.annotation.NonNull; import android.util.Log; +import androidx.annotation.NonNull; + import com.google.common.cache.Cache; import com.google.common.cache.CacheBuilder; @@ -22,6 +23,7 @@ import eu.siacs.conversations.entities.Room; import eu.siacs.conversations.http.HttpConnectionManager; import eu.siacs.conversations.http.services.MuclumbusService; import eu.siacs.conversations.parser.IqParser; +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; @@ -32,7 +34,6 @@ import retrofit2.Callback; import retrofit2.Response; import retrofit2.Retrofit; import retrofit2.converter.gson.GsonConverterFactory; -import eu.siacs.conversations.xmpp.Jid; public class ChannelDiscoveryService { diff --git a/src/main/java/eu/siacs/conversations/services/EventReceiver.java b/src/main/java/eu/siacs/conversations/services/EventReceiver.java index 500eb25e5..b189e9a9e 100644 --- a/src/main/java/eu/siacs/conversations/services/EventReceiver.java +++ b/src/main/java/eu/siacs/conversations/services/EventReceiver.java @@ -5,7 +5,6 @@ import android.content.Context; import android.content.Intent; import android.os.Bundle; import android.preference.PreferenceManager; -import android.support.v4.content.ContextCompat; import android.util.Log; import com.google.common.base.Strings; diff --git a/src/main/java/eu/siacs/conversations/services/ExportBackupService.java b/src/main/java/eu/siacs/conversations/services/ExportBackupService.java index 1c6a53878..95584ae23 100644 --- a/src/main/java/eu/siacs/conversations/services/ExportBackupService.java +++ b/src/main/java/eu/siacs/conversations/services/ExportBackupService.java @@ -11,9 +11,10 @@ import android.database.DatabaseUtils; import android.database.sqlite.SQLiteDatabase; import android.net.Uri; import android.os.IBinder; -import android.support.v4.app.NotificationCompat; import android.util.Log; +import androidx.core.app.NotificationCompat; + import com.google.common.base.Strings; import java.io.DataOutputStream; diff --git a/src/main/java/eu/siacs/conversations/services/MemorizingTrustManager.java b/src/main/java/eu/siacs/conversations/services/MemorizingTrustManager.java index 7caf80da0..1aa82d8a3 100644 --- a/src/main/java/eu/siacs/conversations/services/MemorizingTrustManager.java +++ b/src/main/java/eu/siacs/conversations/services/MemorizingTrustManager.java @@ -34,11 +34,12 @@ import android.content.Intent; import android.net.Uri; import android.os.Handler; import android.preference.PreferenceManager; -import android.support.v7.app.AppCompatActivity; import android.util.Base64; import android.util.Log; import android.util.SparseArray; +import androidx.appcompat.app.AppCompatActivity; + import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; @@ -114,14 +115,14 @@ public class MemorizingTrustManager { static String KEYSTORE_DIR = "KeyStore"; static String KEYSTORE_FILE = "KeyStore.bks"; private static int decisionId = 0; - private static SparseArray openDecisions = new SparseArray(); + private static final SparseArray openDecisions = new SparseArray(); Context master; AppCompatActivity foregroundAct; NotificationManager notificationManager; Handler masterHandler; private File keyStoreFile; private KeyStore appKeyStore; - private X509TrustManager defaultTrustManager; + private final X509TrustManager defaultTrustManager; private X509TrustManager appTrustManager; private String poshCacheDir; @@ -699,7 +700,7 @@ public class MemorizingTrustManager { Object name = altName.get(1); if (name instanceof String) { si.append("["); - si.append((Integer) altName.get(0)); + si.append(altName.get(0)); si.append("] "); si.append(name); si.append("\n"); diff --git a/src/main/java/eu/siacs/conversations/services/MessageArchiveService.java b/src/main/java/eu/siacs/conversations/services/MessageArchiveService.java index 47d4a240b..592a36702 100644 --- a/src/main/java/eu/siacs/conversations/services/MessageArchiveService.java +++ b/src/main/java/eu/siacs/conversations/services/MessageArchiveService.java @@ -18,11 +18,11 @@ import eu.siacs.conversations.entities.Conversational; import eu.siacs.conversations.entities.ReceiptRequest; import eu.siacs.conversations.generator.AbstractGenerator; import eu.siacs.conversations.xml.Element; +import eu.siacs.conversations.xmpp.Jid; import eu.siacs.conversations.xmpp.OnAdvancedStreamFeaturesLoaded; import eu.siacs.conversations.xmpp.mam.MamReference; import eu.siacs.conversations.xmpp.stanzas.IqPacket; import eu.siacs.conversations.xmpp.stanzas.MessagePacket; -import eu.siacs.conversations.xmpp.Jid; public class MessageArchiveService implements OnAdvancedStreamFeaturesLoaded { @@ -89,9 +89,9 @@ public class MessageArchiveService implements OnAdvancedStreamFeaturesLoaded { return null; } - }; + } - MessageArchiveService(final XmppConnectionService service) { + MessageArchiveService(final XmppConnectionService service) { this.mXmppConnectionService = service; } @@ -370,7 +370,7 @@ public class MessageArchiveService implements OnAdvancedStreamFeaturesLoaded { done = done || (query.getActualMessageCount() == 0 && !query.isCatchup()); this.finalizeQuery(query, done); - Log.d(Config.LOGTAG, query.getAccount().getJid().asBareJid() + ": finished mam after " + query.getTotalCount() + "(" + query.getActualMessageCount() + ") messages. messages left=" + Boolean.toString(!done) + " count=" + count); + Log.d(Config.LOGTAG, query.getAccount().getJid().asBareJid() + ": finished mam after " + query.getTotalCount() + "(" + query.getActualMessageCount() + ") messages. messages left=" + !done + " count=" + count); if (query.isCatchup() && query.getActualMessageCount() > 0) { mXmppConnectionService.getNotificationService().finishBacklog(true, query.getAccount()); } @@ -459,10 +459,10 @@ public class MessageArchiveService implements OnAdvancedStreamFeaturesLoaded { private int actualCount = 0; private int actualInThisQuery = 0; private long start; - private long end; - private String queryId; + private final long end; + private final String queryId; private String reference = null; - private Account account; + private final Account account; private Conversation conversation; private PagingOrder pagingOrder = PagingOrder.NORMAL; private XmppConnectionService.OnMoreMessagesLoaded callback = null; @@ -649,7 +649,7 @@ public class MessageArchiveService implements OnAdvancedStreamFeaturesLoaded { } builder.append(this.reference); } - builder.append(", catchup=").append(Boolean.toString(catchup)); + builder.append(", catchup=").append(catchup); builder.append(", ns=").append(version.namespace); return builder.toString(); } diff --git a/src/main/java/eu/siacs/conversations/services/NotificationService.java b/src/main/java/eu/siacs/conversations/services/NotificationService.java index 3c2a093bc..789a60e38 100644 --- a/src/main/java/eu/siacs/conversations/services/NotificationService.java +++ b/src/main/java/eu/siacs/conversations/services/NotificationService.java @@ -17,20 +17,21 @@ import android.net.Uri; import android.os.Build; import android.os.SystemClock; import android.preference.PreferenceManager; -import android.support.annotation.RequiresApi; -import android.support.v4.app.NotificationCompat; -import android.support.v4.app.NotificationCompat.BigPictureStyle; -import android.support.v4.app.NotificationCompat.Builder; -import android.support.v4.app.NotificationManagerCompat; -import android.support.v4.app.Person; -import android.support.v4.app.RemoteInput; -import android.support.v4.content.ContextCompat; -import android.support.v4.graphics.drawable.IconCompat; import android.text.SpannableString; import android.text.style.StyleSpan; import android.util.DisplayMetrics; import android.util.Log; +import androidx.annotation.RequiresApi; +import androidx.core.app.NotificationCompat; +import androidx.core.app.NotificationCompat.BigPictureStyle; +import androidx.core.app.NotificationCompat.Builder; +import androidx.core.app.NotificationManagerCompat; +import androidx.core.app.Person; +import androidx.core.app.RemoteInput; +import androidx.core.content.ContextCompat; +import androidx.core.graphics.drawable.IconCompat; + import java.io.File; import java.io.IOException; import java.util.ArrayList; @@ -662,7 +663,7 @@ public class NotificationService { private Builder buildMultipleConversation(final boolean notify, final boolean quietHours) { final Builder mBuilder = new NotificationCompat.Builder(mXmppConnectionService, quietHours ? "quiet_hours" : (notify ? "messages" : "silent_messages")); final NotificationCompat.InboxStyle style = new NotificationCompat.InboxStyle(); - style.setBigContentTitle(mXmppConnectionService.getString(R.string.x_unread_conversations, notifications.size())); + style.setBigContentTitle(mXmppConnectionService.getResources().getQuantityString(R.plurals.x_unread_conversations, notifications.size(), notifications.size())); final StringBuilder names = new StringBuilder(); Conversation conversation = null; for (final ArrayList messages : notifications.values()) { @@ -687,8 +688,9 @@ public class NotificationService { if (names.length() >= 2) { names.delete(names.length() - 2, names.length()); } - mBuilder.setContentTitle(mXmppConnectionService.getString(R.string.x_unread_conversations, notifications.size())); - mBuilder.setTicker(mXmppConnectionService.getString(R.string.x_unread_conversations, notifications.size())); + final String contentTitle = mXmppConnectionService.getResources().getQuantityString(R.plurals.x_unread_conversations, notifications.size(), notifications.size()); + mBuilder.setContentTitle(contentTitle); + mBuilder.setTicker(contentTitle); mBuilder.setContentText(names.toString()); mBuilder.setStyle(style); if (conversation != null) { diff --git a/src/main/java/eu/siacs/conversations/services/ShortcutService.java b/src/main/java/eu/siacs/conversations/services/ShortcutService.java index 9908879e7..6b7106f74 100644 --- a/src/main/java/eu/siacs/conversations/services/ShortcutService.java +++ b/src/main/java/eu/siacs/conversations/services/ShortcutService.java @@ -8,9 +8,10 @@ import android.graphics.Bitmap; import android.graphics.drawable.Icon; import android.net.Uri; import android.os.Build; -import android.support.annotation.NonNull; import android.util.Log; +import androidx.annotation.NonNull; + import java.util.ArrayList; import java.util.HashMap; import java.util.List; diff --git a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java index 0f2423f63..de18882d7 100644 --- a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java +++ b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java @@ -32,10 +32,6 @@ import android.os.SystemClock; import android.preference.PreferenceManager; import android.provider.ContactsContract; import android.security.KeyChain; -import android.support.annotation.BoolRes; -import android.support.annotation.IntegerRes; -import android.support.v4.app.RemoteInput; -import android.support.v4.content.ContextCompat; import android.telephony.PhoneStateListener; import android.telephony.TelephonyManager; import android.text.TextUtils; @@ -44,6 +40,11 @@ import android.util.Log; import android.util.LruCache; import android.util.Pair; +import androidx.annotation.BoolRes; +import androidx.annotation.IntegerRes; +import androidx.core.app.RemoteInput; +import androidx.core.content.ContextCompat; + import com.google.common.base.Objects; import com.google.common.base.Strings; @@ -135,6 +136,7 @@ import eu.siacs.conversations.utils.WakeLockHelper; 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.OnBindListener; import eu.siacs.conversations.xmpp.OnContactStatusChanged; import eu.siacs.conversations.xmpp.OnIqPacketReceived; @@ -159,7 +161,6 @@ import eu.siacs.conversations.xmpp.stanzas.IqPacket; import eu.siacs.conversations.xmpp.stanzas.MessagePacket; import eu.siacs.conversations.xmpp.stanzas.PresencePacket; import me.leolin.shortcutbadger.ShortcutBadger; -import eu.siacs.conversations.xmpp.Jid; public class XmppConnectionService extends Service { @@ -206,21 +207,21 @@ public class XmppConnectionService extends Service { } }; public DatabaseBackend databaseBackend; - private ReplacingSerialSingleThreadExecutor mContactMergerExecutor = new ReplacingSerialSingleThreadExecutor("ContactMerger"); + private final ReplacingSerialSingleThreadExecutor mContactMergerExecutor = new ReplacingSerialSingleThreadExecutor("ContactMerger"); private long mLastActivity = 0; - private FileBackend fileBackend = new FileBackend(this); + private final FileBackend fileBackend = new FileBackend(this); private MemorizingTrustManager mMemorizingTrustManager; - private NotificationService mNotificationService = new NotificationService(this); - private ChannelDiscoveryService mChannelDiscoveryService = new ChannelDiscoveryService(this); - private ShortcutService mShortcutService = new ShortcutService(this); - private AtomicBoolean mInitialAddressbookSyncCompleted = new AtomicBoolean(false); - private AtomicBoolean mForceForegroundService = new AtomicBoolean(false); - private AtomicBoolean mForceDuringOnCreate = new AtomicBoolean(false); - private AtomicReference ongoingCall = new AtomicReference<>(); - private OnMessagePacketReceived mMessageParser = new MessageParser(this); - private OnPresencePacketReceived mPresenceParser = new PresenceParser(this); - private IqParser mIqParser = new IqParser(this); - private MessageGenerator mMessageGenerator = new MessageGenerator(this); + private final NotificationService mNotificationService = new NotificationService(this); + private final ChannelDiscoveryService mChannelDiscoveryService = new ChannelDiscoveryService(this); + private final ShortcutService mShortcutService = new ShortcutService(this); + private final AtomicBoolean mInitialAddressbookSyncCompleted = new AtomicBoolean(false); + private final AtomicBoolean mForceForegroundService = new AtomicBoolean(false); + private final AtomicBoolean mForceDuringOnCreate = new AtomicBoolean(false); + private final AtomicReference ongoingCall = new AtomicReference<>(); + private final OnMessagePacketReceived mMessageParser = new MessageParser(this); + private final OnPresencePacketReceived mPresenceParser = new PresenceParser(this); + private final IqParser mIqParser = new IqParser(this); + private final MessageGenerator mMessageGenerator = new MessageGenerator(this); public OnContactStatusChanged onContactStatusChanged = (contact, online) -> { Conversation conversation = find(getConversations(), contact); if (conversation != null) { @@ -231,14 +232,14 @@ public class XmppConnectionService extends Service { } } }; - private PresenceGenerator mPresenceGenerator = new PresenceGenerator(this); + private final PresenceGenerator mPresenceGenerator = new PresenceGenerator(this); private List accounts; - private JingleConnectionManager mJingleConnectionManager = new JingleConnectionManager(this); - private HttpConnectionManager mHttpConnectionManager = new HttpConnectionManager(this); - private AvatarService mAvatarService = new AvatarService(this); - private MessageArchiveService mMessageArchiveService = new MessageArchiveService(this); - private PushManagementService mPushManagementService = new PushManagementService(this); - private QuickConversationsService mQuickConversationsService = new QuickConversationsService(this); + private final JingleConnectionManager mJingleConnectionManager = new JingleConnectionManager(this); + private final HttpConnectionManager mHttpConnectionManager = new HttpConnectionManager(this); + private final AvatarService mAvatarService = new AvatarService(this); + private final MessageArchiveService mMessageArchiveService = new MessageArchiveService(this); + private final PushManagementService mPushManagementService = new PushManagementService(this); + private final QuickConversationsService mQuickConversationsService = new QuickConversationsService(this); private final ConversationsFileObserver fileObserver = new ConversationsFileObserver( Environment.getExternalStorageDirectory().getAbsolutePath() ) { @@ -357,10 +358,10 @@ public class XmppConnectionService extends Service { syncDirtyContacts(account); } }; - private AtomicLong mLastExpiryRun = new AtomicLong(0); + private final AtomicLong mLastExpiryRun = new AtomicLong(0); private SecureRandom mRandom; - private LruCache, ServiceDiscoveryResult> discoCache = new LruCache<>(20); - private OnStatusChanged statusListener = new OnStatusChanged() { + private final LruCache, ServiceDiscoveryResult> discoCache = new LruCache<>(20); + private final OnStatusChanged statusListener = new OnStatusChanged() { @Override public void onStatusChanged(final Account account) { @@ -459,8 +460,8 @@ public class XmppConnectionService extends Service { private WakeLock wakeLock; private PowerManager pm; private LruCache mBitmapCache; - private BroadcastReceiver mInternalEventReceiver = new InternalEventReceiver(); - private BroadcastReceiver mInternalScreenEventReceiver = new InternalEventReceiver(); + private final BroadcastReceiver mInternalEventReceiver = new InternalEventReceiver(); + private final BroadcastReceiver mInternalScreenEventReceiver = new InternalEventReceiver(); private static String generateFetchKey(Account account, final Avatar avatar) { return account.getJid().asBareJid() + "_" + avatar.owner + "_" + avatar.sha1sum; @@ -633,6 +634,9 @@ public class XmppConnectionService extends Service { if (action != null) { final String uuid = intent.getStringExtra("uuid"); switch (action) { + case QuickConversationsService.SMS_RETRIEVED_ACTION: + mQuickConversationsService.handleSmsReceived(intent); + break; case ConnectivityManager.CONNECTIVITY_ACTION: if (hasInternetConnection()) { if (Config.POST_CONNECTIVITY_CHANGE_PING_INTERVAL > 0) { @@ -796,7 +800,7 @@ public class XmppConnectionService extends Service { for (Account account : pingCandidates) { final boolean lowTimeout = isInLowPingTimeoutMode(account); account.getXmppConnection().sendPing(); - Log.d(Config.LOGTAG, account.getJid().asBareJid() + " send ping (action=" + action + ",lowTimeout=" + Boolean.toString(lowTimeout) + ")"); + Log.d(Config.LOGTAG, account.getJid().asBareJid() + " send ping (action=" + action + ",lowTimeout=" + lowTimeout + ")"); scheduleWakeUpCall(lowTimeout ? Config.LOW_PING_TIMEOUT : Config.PING_TIMEOUT, account.getUuid().hashCode()); } } @@ -1284,17 +1288,20 @@ public class XmppConnectionService extends Service { final OngoingCall ongoing = ongoingCall.get(); if (force || mForceDuringOnCreate.get() || mForceForegroundService.get() || ongoing != null || (Compatibility.keepForegroundService(this) && hasEnabledAccounts())) { final Notification notification; + final int id; if (ongoing != null) { notification = this.mNotificationService.getOngoingCallNotification(ongoing.id, ongoing.media); - startForeground(NotificationService.ONGOING_CALL_NOTIFICATION_ID, notification); + id = NotificationService.ONGOING_CALL_NOTIFICATION_ID; + startForeground(id, notification); mNotificationService.cancel(NotificationService.FOREGROUND_NOTIFICATION_ID); } else { notification = this.mNotificationService.createForegroundNotification(); - startForeground(NotificationService.FOREGROUND_NOTIFICATION_ID, notification); + id = NotificationService.FOREGROUND_NOTIFICATION_ID; + startForeground(id, notification); } if (!mForceForegroundService.get()) { - mNotificationService.notify(NotificationService.FOREGROUND_NOTIFICATION_ID, notification); + mNotificationService.notify(id, notification); } status = true; } else { @@ -1833,7 +1840,7 @@ public class XmppConnectionService extends Service { } }); } else { - Log.d(Config.LOGTAG, account.getJid().asBareJid() + ": error publishing bookmarks (retry=" + Boolean.toString(retry) + ") " + response); + Log.d(Config.LOGTAG, account.getJid().asBareJid() + ": error publishing bookmarks (retry=" + retry + ") " + response); } }); } @@ -4545,6 +4552,10 @@ public class XmppConnectionService extends Service { final ServiceDiscoveryResult disco = getCachedServiceDiscoveryResult(key); if (disco != null) { presence.setServiceDiscoveryResult(disco); + final Contact contact = account.getRoster().getContact(jid); + if (contact.refreshRtpCapability()) { + syncRoster(account); + } } else { if (account.inProgressDiscoFetches.contains(key)) { Log.d(Config.LOGTAG, account.getJid().asBareJid() + ": skipping duplicate disco request for " + key.second + " to " + jid); @@ -4578,12 +4589,21 @@ public class XmppConnectionService extends Service { } private void injectServiceDiscoveryResult(Roster roster, String hash, String ver, ServiceDiscoveryResult disco) { + boolean rosterNeedsSync = false; for (final Contact contact : roster.getContacts()) { + boolean serviceDiscoverySet = false; for (final Presence presence : contact.getPresences().getPresences()) { if (hash.equals(presence.getHash()) && ver.equals(presence.getVer())) { presence.setServiceDiscoveryResult(disco); + serviceDiscoverySet = true; } } + if (serviceDiscoverySet) { + rosterNeedsSync |= contact.refreshRtpCapability(); + } + } + if (rosterNeedsSync) { + syncRoster(roster.getAccount()); } } diff --git a/src/main/java/eu/siacs/conversations/ui/AboutActivity.java b/src/main/java/eu/siacs/conversations/ui/AboutActivity.java index 2d281a9e2..3c705e639 100644 --- a/src/main/java/eu/siacs/conversations/ui/AboutActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/AboutActivity.java @@ -1,8 +1,8 @@ package eu.siacs.conversations.ui; import android.os.Bundle; -import android.preference.PreferenceManager; -import android.support.v7.app.AppCompatActivity; + +import androidx.appcompat.app.AppCompatActivity; import eu.siacs.conversations.R; import eu.siacs.conversations.utils.ThemeHelper; diff --git a/src/main/java/eu/siacs/conversations/ui/AbstractSearchableListItemActivity.java b/src/main/java/eu/siacs/conversations/ui/AbstractSearchableListItemActivity.java index 78d1fb694..3db6aa5a1 100644 --- a/src/main/java/eu/siacs/conversations/ui/AbstractSearchableListItemActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/AbstractSearchableListItemActivity.java @@ -1,9 +1,7 @@ package eu.siacs.conversations.ui; import android.content.Context; -import android.databinding.DataBindingUtil; import android.os.Bundle; -import android.support.v7.widget.Toolbar; import android.text.Editable; import android.text.TextWatcher; import android.view.KeyEvent; @@ -16,6 +14,8 @@ import android.widget.EditText; import android.widget.ListView; import android.widget.TextView; +import androidx.databinding.DataBindingUtil; + import java.util.ArrayList; import java.util.List; @@ -92,7 +92,7 @@ public abstract class AbstractSearchableListItemActivity extends XmppActivity im public void onCreate(final Bundle savedInstanceState) { super.onCreate(savedInstanceState); this.binding = DataBindingUtil.setContentView(this,R.layout.activity_choose_contact); - setSupportActionBar((Toolbar) binding.toolbar); + setSupportActionBar(binding.toolbar); configureActionBar(getSupportActionBar()); this.binding.chooseContactList.setFastScrollEnabled(true); mListItemsAdapter = new ListItemAdapter(this, listItems); diff --git a/src/main/java/eu/siacs/conversations/ui/ActionBarActivity.java b/src/main/java/eu/siacs/conversations/ui/ActionBarActivity.java index 198599fd1..8564bcfcb 100644 --- a/src/main/java/eu/siacs/conversations/ui/ActionBarActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/ActionBarActivity.java @@ -1,8 +1,11 @@ package eu.siacs.conversations.ui; -import android.support.v7.app.ActionBar; -import android.support.v7.app.AppCompatActivity; import android.view.MenuItem; +import android.view.View; + +import androidx.appcompat.app.ActionBar; +import androidx.appcompat.app.AppCompatActivity; +import androidx.appcompat.widget.Toolbar; public abstract class ActionBarActivity extends AppCompatActivity { @@ -17,6 +20,10 @@ public abstract class ActionBarActivity extends AppCompatActivity { } } + public void setSupportActionBar(View toolbar) { + super.setSupportActionBar((Toolbar) toolbar); + } + @Override public boolean onOptionsItemSelected(final MenuItem item) { switch (item.getItemId()) { diff --git a/src/main/java/eu/siacs/conversations/ui/BlockContactDialog.java b/src/main/java/eu/siacs/conversations/ui/BlockContactDialog.java index 2e3db1730..6f4d77c51 100644 --- a/src/main/java/eu/siacs/conversations/ui/BlockContactDialog.java +++ b/src/main/java/eu/siacs/conversations/ui/BlockContactDialog.java @@ -1,17 +1,17 @@ package eu.siacs.conversations.ui; -import android.databinding.DataBindingUtil; -import android.support.annotation.StringRes; -import android.support.v7.app.AlertDialog; import android.view.View; import android.widget.Toast; +import androidx.annotation.StringRes; +import androidx.appcompat.app.AlertDialog; +import androidx.databinding.DataBindingUtil; + import eu.siacs.conversations.R; import eu.siacs.conversations.databinding.DialogBlockContactBinding; import eu.siacs.conversations.entities.Blockable; import eu.siacs.conversations.entities.Conversation; import eu.siacs.conversations.ui.util.JidDialog; -import eu.siacs.conversations.xmpp.Jid; public final class BlockContactDialog { public static void show(final XmppActivity xmppActivity, final Blockable blockable) { diff --git a/src/main/java/eu/siacs/conversations/ui/BlocklistActivity.java b/src/main/java/eu/siacs/conversations/ui/BlocklistActivity.java index 201c5e7b7..55cf9ba03 100644 --- a/src/main/java/eu/siacs/conversations/ui/BlocklistActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/BlocklistActivity.java @@ -1,11 +1,12 @@ package eu.siacs.conversations.ui; import android.os.Bundle; -import android.support.v4.app.Fragment; -import android.support.v4.app.FragmentTransaction; import android.text.Editable; import android.widget.Toast; +import androidx.fragment.app.Fragment; +import androidx.fragment.app.FragmentTransaction; + import java.util.Collections; import eu.siacs.conversations.R; @@ -14,8 +15,8 @@ import eu.siacs.conversations.entities.Blockable; import eu.siacs.conversations.entities.ListItem; import eu.siacs.conversations.entities.RawBlockable; import eu.siacs.conversations.ui.interfaces.OnBackendConnected; -import eu.siacs.conversations.xmpp.OnUpdateBlocklist; import eu.siacs.conversations.xmpp.Jid; +import eu.siacs.conversations.xmpp.OnUpdateBlocklist; public class BlocklistActivity extends AbstractSearchableListItemActivity implements OnUpdateBlocklist { diff --git a/src/main/java/eu/siacs/conversations/ui/ChangePasswordActivity.java b/src/main/java/eu/siacs/conversations/ui/ChangePasswordActivity.java index 4f6245c12..c2a334821 100644 --- a/src/main/java/eu/siacs/conversations/ui/ChangePasswordActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/ChangePasswordActivity.java @@ -2,12 +2,13 @@ package eu.siacs.conversations.ui; import android.content.Intent; import android.os.Bundle; -import android.support.design.widget.TextInputLayout; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.Toast; +import com.google.android.material.textfield.TextInputLayout; + import eu.siacs.conversations.R; import eu.siacs.conversations.entities.Account; import eu.siacs.conversations.services.XmppConnectionService; @@ -16,7 +17,7 @@ import eu.siacs.conversations.ui.widget.DisabledActionModeCallback; public class ChangePasswordActivity extends XmppActivity implements XmppConnectionService.OnAccountPasswordChanged { private Button mChangePasswordButton; - private View.OnClickListener mOnChangePasswordButtonClicked = new View.OnClickListener() { + private final View.OnClickListener mOnChangePasswordButtonClicked = new View.OnClickListener() { @Override public void onClick(View view) { if (mAccount != null) { diff --git a/src/main/java/eu/siacs/conversations/ui/ChannelDiscoveryActivity.java b/src/main/java/eu/siacs/conversations/ui/ChannelDiscoveryActivity.java index 398be7f68..4687e5f63 100644 --- a/src/main/java/eu/siacs/conversations/ui/ChannelDiscoveryActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/ChannelDiscoveryActivity.java @@ -4,11 +4,9 @@ import android.app.AlertDialog; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; -import android.databinding.DataBindingUtil; import android.net.Uri; import android.os.Bundle; import android.preference.PreferenceManager; -import android.support.v7.widget.Toolbar; import android.text.Html; import android.text.method.LinkMovementMethod; import android.view.KeyEvent; @@ -20,6 +18,8 @@ import android.widget.EditText; import android.widget.TextView; import android.widget.Toast; +import androidx.databinding.DataBindingUtil; + import java.util.Collections; import java.util.List; import java.util.concurrent.atomic.AtomicReference; @@ -77,7 +77,7 @@ public class ChannelDiscoveryActivity extends XmppActivity implements MenuItem.O protected void onCreate(final Bundle savedInstanceState) { super.onCreate(savedInstanceState); binding = DataBindingUtil.setContentView(this, R.layout.activity_channel_discovery); - setSupportActionBar((Toolbar) binding.toolbar); + setSupportActionBar(binding.toolbar); configureActionBar(getSupportActionBar(), true); binding.list.setAdapter(this.adapter); this.adapter.setOnChannelSearchResultSelectedListener(this); diff --git a/src/main/java/eu/siacs/conversations/ui/ChooseContactActivity.java b/src/main/java/eu/siacs/conversations/ui/ChooseContactActivity.java index 3a507c519..9da5c7546 100644 --- a/src/main/java/eu/siacs/conversations/ui/ChooseContactActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/ChooseContactActivity.java @@ -5,11 +5,6 @@ import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; import android.os.Bundle; -import android.support.annotation.NonNull; -import android.support.annotation.StringRes; -import android.support.v4.app.Fragment; -import android.support.v4.app.FragmentTransaction; -import android.support.v7.app.ActionBar; import android.view.ActionMode; import android.view.KeyEvent; import android.view.Menu; @@ -21,6 +16,12 @@ import android.widget.AdapterView; import android.widget.ListView; import android.widget.TextView; +import androidx.annotation.NonNull; +import androidx.annotation.StringRes; +import androidx.appcompat.app.ActionBar; +import androidx.fragment.app.Fragment; +import androidx.fragment.app.FragmentTransaction; + import com.google.common.base.Strings; import java.util.ArrayList; @@ -50,15 +51,15 @@ public class ChooseContactActivity extends AbstractSearchableListItemActivity im public static final String EXTRA_SHOW_ENTER_JID = "extra_show_enter_jid"; public static final String EXTRA_CONVERSATION = "extra_conversation"; private static final String EXTRA_FILTERED_CONTACTS = "extra_filtered_contacts"; - private List mActivatedAccounts = new ArrayList<>(); - private Set selected = new HashSet<>(); + private final List mActivatedAccounts = new ArrayList<>(); + private final Set selected = new HashSet<>(); private Set filterContacts; private boolean showEnterJid = false; private boolean startSearching = false; private boolean multiple = false; - private PendingItem postponedActivityResult = new PendingItem<>(); + private final PendingItem postponedActivityResult = new PendingItem<>(); public static Intent create(Activity activity, Conversation conversation) { final Intent intent = new Intent(activity, ChooseContactActivity.class); @@ -380,7 +381,7 @@ public class ChooseContactActivity extends AbstractSearchableListItemActivity im } @Override - public void onRequestPermissionsResult(int requestCode, @NonNull String permissions[], @NonNull int[] grantResults) { + public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { ScanActivity.onRequestPermissionResult(this, requestCode, grantResults); } diff --git a/src/main/java/eu/siacs/conversations/ui/ConferenceDetailsActivity.java b/src/main/java/eu/siacs/conversations/ui/ConferenceDetailsActivity.java index 946a066fb..3d29bb89a 100644 --- a/src/main/java/eu/siacs/conversations/ui/ConferenceDetailsActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/ConferenceDetailsActivity.java @@ -3,10 +3,7 @@ package eu.siacs.conversations.ui; import android.app.PendingIntent; import android.content.Context; import android.content.Intent; -import android.databinding.DataBindingUtil; import android.os.Bundle; -import android.support.v7.app.AlertDialog; -import android.support.v7.widget.Toolbar; import android.text.Editable; import android.text.SpannableStringBuilder; import android.text.TextWatcher; @@ -16,6 +13,9 @@ import android.view.View; import android.view.View.OnClickListener; import android.widget.Toast; +import androidx.appcompat.app.AlertDialog; +import androidx.databinding.DataBindingUtil; + import java.util.Collections; import java.util.List; import java.util.concurrent.atomic.AtomicInteger; @@ -48,8 +48,8 @@ import eu.siacs.conversations.utils.EmojiWrapper; import eu.siacs.conversations.utils.StringUtils; import eu.siacs.conversations.utils.StylingHelper; import eu.siacs.conversations.utils.XmppUri; -import me.drakeet.support.toast.ToastCompat; 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; @@ -65,7 +65,7 @@ public class ConferenceDetailsActivity extends XmppActivity implements OnConvers private boolean mAdvancedMode = false; - private UiCallback renameCallback = new UiCallback() { + private final UiCallback renameCallback = new UiCallback() { @Override public void success(Conversation object) { displayToast(getString(R.string.your_nick_has_been_changed)); @@ -86,7 +86,7 @@ public class ConferenceDetailsActivity extends XmppActivity implements OnConvers } }; - private OnClickListener mNotifyStatusClickListener = new OnClickListener() { + private final OnClickListener mNotifyStatusClickListener = new OnClickListener() { @Override public void onClick(View v) { AlertDialog.Builder builder = new AlertDialog.Builder(ConferenceDetailsActivity.this); @@ -118,7 +118,7 @@ public class ConferenceDetailsActivity extends XmppActivity implements OnConvers } }; - private OnClickListener mChangeConferenceSettings = new OnClickListener() { + private final OnClickListener mChangeConferenceSettings = new OnClickListener() { @Override public void onClick(View v) { final MucOptions mucOptions = mConversation.getMucOptions(); @@ -160,7 +160,7 @@ public class ConferenceDetailsActivity extends XmppActivity implements OnConvers super.onCreate(savedInstanceState); this.binding = DataBindingUtil.setContentView(this, R.layout.activity_muc_details); this.binding.changeConferenceButton.setOnClickListener(this.mChangeConferenceSettings); - setSupportActionBar((Toolbar) binding.toolbar); + setSupportActionBar(binding.toolbar); configureActionBar(getSupportActionBar()); this.binding.editNickButton.setOnClickListener(v -> quickEdit(mConversation.getMucOptions().getActualNick(), R.string.nickname, diff --git a/src/main/java/eu/siacs/conversations/ui/ContactDetailsActivity.java b/src/main/java/eu/siacs/conversations/ui/ContactDetailsActivity.java index 6c5496650..74f9e7068 100644 --- a/src/main/java/eu/siacs/conversations/ui/ContactDetailsActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/ContactDetailsActivity.java @@ -6,7 +6,6 @@ import android.content.DialogInterface; import android.content.Intent; import android.content.SharedPreferences; import android.content.pm.PackageManager; -import android.databinding.DataBindingUtil; import android.net.Uri; import android.os.Build; import android.os.Bundle; @@ -14,9 +13,6 @@ import android.preference.PreferenceManager; import android.provider.ContactsContract.CommonDataKinds; import android.provider.ContactsContract.Contacts; import android.provider.ContactsContract.Intents; -import android.support.annotation.NonNull; -import android.support.v7.app.AlertDialog; -import android.support.v7.widget.Toolbar; import android.text.Spannable; import android.text.SpannableString; import android.text.style.RelativeSizeSpan; @@ -30,6 +26,10 @@ import android.widget.CompoundButton.OnCheckedChangeListener; import android.widget.TextView; import android.widget.Toast; +import androidx.annotation.NonNull; +import androidx.appcompat.app.AlertDialog; +import androidx.databinding.DataBindingUtil; + import org.openintents.openpgp.util.OpenPgpUtils; import java.util.Collection; @@ -73,14 +73,14 @@ public class ContactDetailsActivity extends OmemoActivity implements OnAccountUp private MediaAdapter mMediaAdapter; private Contact contact; - private DialogInterface.OnClickListener removeFromRoster = new DialogInterface.OnClickListener() { + private final DialogInterface.OnClickListener removeFromRoster = new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { xmppConnectionService.deleteContactOnServer(contact); } }; - private OnCheckedChangeListener mOnSendCheckedChange = new OnCheckedChangeListener() { + private final OnCheckedChangeListener mOnSendCheckedChange = new OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { @@ -96,7 +96,7 @@ public class ContactDetailsActivity extends OmemoActivity implements OnAccountUp } } }; - private OnCheckedChangeListener mOnReceiveCheckedChange = new OnCheckedChangeListener() { + private final OnCheckedChangeListener mOnReceiveCheckedChange = new OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { @@ -197,7 +197,7 @@ public class ContactDetailsActivity extends OmemoActivity implements OnAccountUp this.messageFingerprint = getIntent().getStringExtra("fingerprint"); this.binding = DataBindingUtil.setContentView(this, R.layout.activity_contact_details); - setSupportActionBar((Toolbar) binding.toolbar); + setSupportActionBar(binding.toolbar); configureActionBar(getSupportActionBar()); binding.showInactiveDevices.setOnClickListener(v -> { showInactiveOmemo = !showInactiveOmemo; @@ -232,7 +232,7 @@ public class ContactDetailsActivity extends OmemoActivity implements OnAccountUp } @Override - public void onRequestPermissionsResult(int requestCode, @NonNull String permissions[], @NonNull int[] grantResults) { + public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { if (grantResults.length > 0) if (grantResults[0] == PackageManager.PERMISSION_GRANTED) { if (requestCode == REQUEST_SYNC_CONTACTS && xmppConnectionServiceBound) { @@ -371,22 +371,14 @@ public class ContactDetailsActivity extends OmemoActivity implements OnAccountUp binding.detailsSendPresence.setText(R.string.send_presence_updates); } else { binding.detailsSendPresence.setText(R.string.preemptively_grant); - if (contact.getOption(Contact.Options.PREEMPTIVE_GRANT)) { - binding.detailsSendPresence.setChecked(true); - } else { - binding.detailsSendPresence.setChecked(false); - } + binding.detailsSendPresence.setChecked(contact.getOption(Contact.Options.PREEMPTIVE_GRANT)); } if (contact.getOption(Contact.Options.TO)) { binding.detailsReceivePresence.setText(R.string.receive_presence_updates); binding.detailsReceivePresence.setChecked(true); } else { binding.detailsReceivePresence.setText(R.string.ask_for_presence_updates); - if (contact.getOption(Contact.Options.ASKING)) { - binding.detailsReceivePresence.setChecked(true); - } else { - binding.detailsReceivePresence.setChecked(false); - } + binding.detailsReceivePresence.setChecked(contact.getOption(Contact.Options.ASKING)); } if (contact.getAccount().isOnlineAndConnected()) { binding.detailsReceivePresence.setEnabled(true); @@ -476,8 +468,8 @@ public class ContactDetailsActivity extends OmemoActivity implements OnAccountUp if (Config.supportOpenPgp() && contact.getPgpKeyId() != 0) { hasKeys = true; View view = inflater.inflate(R.layout.contact_key, binding.detailsContactKeys, false); - TextView key = (TextView) view.findViewById(R.id.key); - TextView keyType = (TextView) view.findViewById(R.id.key_type); + TextView key = view.findViewById(R.id.key); + TextView keyType = view.findViewById(R.id.key_type); keyType.setText(R.string.openpgp_key_id); if ("pgp".equals(messageFingerprint)) { keyType.setTextAppearance(this, R.style.TextAppearance_Conversations_Caption_Highlight); diff --git a/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java b/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java index 0f8b47939..8e23da5bc 100644 --- a/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java @@ -2,8 +2,9 @@ package eu.siacs.conversations.ui; import android.content.Intent; import android.os.Bundle; -import android.support.annotation.Nullable; -import android.support.v7.app.AppCompatActivity; + +import androidx.annotation.Nullable; +import androidx.appcompat.app.AppCompatActivity; public class ConversationActivity extends AppCompatActivity { diff --git a/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java b/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java index df558d60e..f2700408b 100644 --- a/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java +++ b/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java @@ -3,36 +3,28 @@ package eu.siacs.conversations.ui; import android.Manifest; import android.annotation.SuppressLint; import android.app.Activity; -import android.app.FragmentManager; -import android.content.SharedPreferences; -import android.content.pm.PackageManager; -import android.databinding.DataBindingUtil; -import android.net.Uri; -import android.os.Build; -import android.preference.PreferenceManager; -import android.provider.MediaStore; -import android.support.annotation.IdRes; -import android.support.annotation.NonNull; -import android.support.annotation.StringRes; -import android.support.v7.app.AlertDialog; import android.app.Fragment; +import android.app.FragmentManager; import android.app.PendingIntent; import android.content.Context; import android.content.DialogInterface; import android.content.Intent; import android.content.IntentSender.SendIntentException; +import android.content.SharedPreferences; +import android.content.pm.PackageManager; +import android.net.Uri; +import android.os.Build; import android.os.Bundle; import android.os.Handler; import android.os.SystemClock; -import android.support.v13.view.inputmethod.InputConnectionCompat; -import android.support.v13.view.inputmethod.InputContentInfoCompat; +import android.preference.PreferenceManager; +import android.provider.MediaStore; import android.text.Editable; import android.text.TextUtils; import android.util.Log; import android.view.ContextMenu; import android.view.ContextMenu.ContextMenuInfo; import android.view.Gravity; -import android.view.KeyEvent; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuInflater; @@ -53,6 +45,14 @@ import android.widget.PopupMenu; import android.widget.TextView.OnEditorActionListener; import android.widget.Toast; +import androidx.annotation.IdRes; +import androidx.annotation.NonNull; +import androidx.annotation.StringRes; +import androidx.appcompat.app.AlertDialog; +import androidx.core.view.inputmethod.InputConnectionCompat; +import androidx.core.view.inputmethod.InputContentInfoCompat; +import androidx.databinding.DataBindingUtil; + import com.google.common.base.Optional; import java.util.ArrayList; @@ -118,6 +118,7 @@ import eu.siacs.conversations.utils.StylingHelper; import eu.siacs.conversations.utils.TimeFrameUtils; import eu.siacs.conversations.utils.UIHelper; import eu.siacs.conversations.xml.Namespace; +import eu.siacs.conversations.xmpp.Jid; import eu.siacs.conversations.xmpp.XmppConnection; import eu.siacs.conversations.xmpp.chatstate.ChatState; import eu.siacs.conversations.xmpp.jingle.AbstractJingleConnection; @@ -126,7 +127,6 @@ import eu.siacs.conversations.xmpp.jingle.JingleFileTransferConnection; import eu.siacs.conversations.xmpp.jingle.Media; import eu.siacs.conversations.xmpp.jingle.OngoingRtpSession; import eu.siacs.conversations.xmpp.jingle.RtpCapability; -import eu.siacs.conversations.xmpp.Jid; import static eu.siacs.conversations.ui.XmppActivity.EXTRA_ACCOUNT; import static eu.siacs.conversations.ui.XmppActivity.REQUEST_INVITE_TO_CONVERSATION; @@ -849,7 +849,7 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke case ATTACHMENT_CHOICE_LOCATION: double latitude = data.getDoubleExtra("latitude", 0); double longitude = data.getDoubleExtra("longitude", 0); - Uri geo = Uri.parse("geo:" + String.valueOf(latitude) + "," + String.valueOf(longitude)); + Uri geo = Uri.parse("geo:" + latitude + "," + longitude); mediaPreviewAdapter.addMediaPreviews(Attachment.of(getActivity(), geo, Attachment.Type.LOCATION)); toggleInputMethod(); break; @@ -1121,8 +1121,9 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke MenuItem cancelTransmission = menu.findItem(R.id.cancel_transmission); MenuItem deleteFile = menu.findItem(R.id.delete_file); MenuItem showErrorMessage = menu.findItem(R.id.show_error_message); + final boolean unInitiatedButKnownSize = MessageUtils.unInitiatedButKnownSize(m); final boolean showError = m.getStatus() == Message.STATUS_SEND_FAILED && m.getErrorMessage() != null && !Message.ERROR_MESSAGE_CANCELLED.equals(m.getErrorMessage()); - if (!m.isFileOrImage() && !encrypted && !m.isGeoUri() && !m.treatAsDownloadable()) { + if (!m.isFileOrImage() && !encrypted && !m.isGeoUri() && !m.treatAsDownloadable() && !unInitiatedButKnownSize && t == null) { copyMessage.setVisible(true); quoteMessage.setVisible(!showError && MessageUtils.prepareQuote(m).length() > 0); String body = m.getMergedBody().toString(); @@ -1143,7 +1144,7 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke && m.getConversation() instanceof Conversation) { correctMessage.setVisible(true); } - if ((m.isFileOrImage() && !deleted && !receiving) || (m.getType() == Message.TYPE_TEXT && !m.treatAsDownloadable())) { + if ((m.isFileOrImage() && !deleted && !receiving) || (m.getType() == Message.TYPE_TEXT && !m.treatAsDownloadable()) && !unInitiatedButKnownSize && t == null) { shareWith.setVisible(true); } if (m.getStatus() == Message.STATUS_SEND_FAILED) { @@ -1152,6 +1153,7 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke if (m.hasFileOnRemoteHost() || m.isGeoUri() || m.treatAsDownloadable() + || unInitiatedButKnownSize || t instanceof HttpDownloadConnection) { copyUrl.setVisible(true); } @@ -2098,7 +2100,7 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke } stopScrolling(); - Log.d(Config.LOGTAG, "reInit(hasExtras=" + Boolean.toString(hasExtras) + ")"); + Log.d(Config.LOGTAG, "reInit(hasExtras=" + hasExtras + ")"); if (this.conversation.isRead() && hasExtras) { Log.d(Config.LOGTAG, "trimming conversation"); @@ -2120,7 +2122,7 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke refresh(false); activity.invalidateOptionsMenu(); this.conversation.messagesLoaded.set(true); - Log.d(Config.LOGTAG, "scrolledToBottomAndNoPending=" + Boolean.toString(scrolledToBottomAndNoPending)); + Log.d(Config.LOGTAG, "scrolledToBottomAndNoPending=" + scrolledToBottomAndNoPending); if (hasExtras || scrolledToBottomAndNoPending) { resetUnreadMessagesCount(); diff --git a/src/main/java/eu/siacs/conversations/ui/ConversationsActivity.java b/src/main/java/eu/siacs/conversations/ui/ConversationsActivity.java index 026a0cafa..61a8a586e 100644 --- a/src/main/java/eu/siacs/conversations/ui/ConversationsActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/ConversationsActivity.java @@ -39,21 +39,21 @@ import android.content.ActivityNotFoundException; import android.content.Context; import android.content.Intent; import android.content.pm.PackageManager; -import android.databinding.DataBindingUtil; import android.net.Uri; import android.os.Bundle; import android.provider.Settings; -import android.support.annotation.IdRes; -import android.support.annotation.NonNull; -import android.support.v7.app.ActionBar; -import android.support.v7.app.AlertDialog; -import android.support.v7.widget.Toolbar; import android.util.Log; import android.view.KeyEvent; import android.view.Menu; import android.view.MenuItem; import android.widget.Toast; +import androidx.annotation.IdRes; +import androidx.annotation.NonNull; +import androidx.appcompat.app.ActionBar; +import androidx.appcompat.app.AlertDialog; +import androidx.databinding.DataBindingUtil; + import org.openintents.openpgp.util.OpenPgpApi; import java.util.Arrays; @@ -76,13 +76,12 @@ import eu.siacs.conversations.ui.util.ActivityResult; import eu.siacs.conversations.ui.util.ConversationMenuConfigurator; import eu.siacs.conversations.ui.util.MenuDoubleTabUtil; import eu.siacs.conversations.ui.util.PendingItem; -import eu.siacs.conversations.utils.AccountUtils; import eu.siacs.conversations.utils.EmojiWrapper; import eu.siacs.conversations.utils.ExceptionHelper; import eu.siacs.conversations.utils.SignupUtils; import eu.siacs.conversations.utils.XmppUri; -import eu.siacs.conversations.xmpp.OnUpdateBlocklist; import eu.siacs.conversations.xmpp.Jid; +import eu.siacs.conversations.xmpp.OnUpdateBlocklist; import static eu.siacs.conversations.ui.ConversationFragment.REQUEST_DECRYPT_PGP; @@ -98,7 +97,7 @@ public class ConversationsActivity extends XmppActivity implements OnConversatio public static final String EXTRA_POST_INIT_ACTION = "post_init_action"; public static final String POST_ACTION_RECORD_VOICE = "record_voice"; - private static List VIEW_AND_SHARE_ACTIONS = Arrays.asList( + private static final List VIEW_AND_SHARE_ACTIONS = Arrays.asList( ACTION_VIEW_CONVERSATION, Intent.ACTION_SEND, Intent.ACTION_SEND_MULTIPLE @@ -115,7 +114,7 @@ public class ConversationsActivity extends XmppActivity implements OnConversatio private final PendingItem postponedActivityResult = new PendingItem<>(); private ActivityConversationsBinding binding; private boolean mActivityPaused = true; - private AtomicBoolean mRedirectInProcess = new AtomicBoolean(false); + private final AtomicBoolean mRedirectInProcess = new AtomicBoolean(false); private static boolean isViewOrShareIntent(Intent i) { Log.d(Config.LOGTAG, "action: " + (i == null ? null : i.getAction())); @@ -360,7 +359,7 @@ public class ConversationsActivity extends XmppActivity implements OnConversatio ConversationMenuConfigurator.reloadFeatures(this); OmemoSetting.load(this); this.binding = DataBindingUtil.setContentView(this, R.layout.activity_conversations); - setSupportActionBar((Toolbar) binding.toolbar); + setSupportActionBar(binding.toolbar); configureActionBar(getSupportActionBar()); this.getFragmentManager().addOnBackStackChangedListener(this::invalidateActionBarTitle); this.getFragmentManager().addOnBackStackChangedListener(this::showDialogsIfMainIsOverview); @@ -538,6 +537,7 @@ public class ConversationsActivity extends XmppActivity implements OnConversatio @Override protected void onNewIntent(final Intent intent) { + super.onNewIntent(intent); if (isViewOrShareIntent(intent)) { if (xmppConnectionService != null) { clearPendingViewIntent(); @@ -661,7 +661,7 @@ public class ConversationsActivity extends XmppActivity implements OnConversatio if (!mActivityPaused && pendingViewIntent.peek() == null) { xmppConnectionService.sendReadMarker(conversation, upToUuid); } else { - Log.d(Config.LOGTAG, "ignoring read callback. mActivityPaused=" + Boolean.toString(mActivityPaused)); + Log.d(Config.LOGTAG, "ignoring read callback. mActivityPaused=" + mActivityPaused); } } diff --git a/src/main/java/eu/siacs/conversations/ui/ConversationsOverviewFragment.java b/src/main/java/eu/siacs/conversations/ui/ConversationsOverviewFragment.java index 3c3c53f63..eebd94df5 100644 --- a/src/main/java/eu/siacs/conversations/ui/ConversationsOverviewFragment.java +++ b/src/main/java/eu/siacs/conversations/ui/ConversationsOverviewFragment.java @@ -33,14 +33,9 @@ import android.app.Activity; import android.app.AlertDialog; import android.app.Fragment; import android.content.Intent; -import android.databinding.DataBindingUtil; import android.graphics.Canvas; import android.graphics.Paint; import android.os.Bundle; -import android.support.design.widget.Snackbar; -import android.support.v7.widget.LinearLayoutManager; -import android.support.v7.widget.RecyclerView; -import android.support.v7.widget.helper.ItemTouchHelper; import android.util.Log; import android.view.LayoutInflater; import android.view.Menu; @@ -50,6 +45,12 @@ import android.view.View; import android.view.ViewGroup; import android.widget.Toast; +import androidx.databinding.DataBindingUtil; +import androidx.recyclerview.widget.ItemTouchHelper; +import androidx.recyclerview.widget.LinearLayoutManager; +import androidx.recyclerview.widget.RecyclerView; + +import com.google.android.material.snackbar.Snackbar; import com.google.common.collect.Collections2; import java.util.ArrayList; @@ -74,8 +75,8 @@ import eu.siacs.conversations.utils.AccountUtils; import eu.siacs.conversations.utils.EasyOnboardingInvite; import eu.siacs.conversations.utils.ThemeHelper; -import static android.support.v7.widget.helper.ItemTouchHelper.LEFT; -import static android.support.v7.widget.helper.ItemTouchHelper.RIGHT; +import static androidx.recyclerview.widget.ItemTouchHelper.LEFT; +import static androidx.recyclerview.widget.ItemTouchHelper.RIGHT; public class ConversationsOverviewFragment extends XmppFragment { @@ -88,9 +89,9 @@ public class ConversationsOverviewFragment extends XmppFragment { private ConversationAdapter conversationsAdapter; private XmppActivity activity; private float mSwipeEscapeVelocity = 0f; - private PendingActionHelper pendingActionHelper = new PendingActionHelper(); + private final PendingActionHelper pendingActionHelper = new PendingActionHelper(); - private ItemTouchHelper.SimpleCallback callback = new ItemTouchHelper.SimpleCallback(0,LEFT|RIGHT) { + private final ItemTouchHelper.SimpleCallback callback = new ItemTouchHelper.SimpleCallback(0,LEFT|RIGHT) { @Override public boolean onMove(RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder, RecyclerView.ViewHolder target) { //todo maybe we can manually changing the position of the conversation diff --git a/src/main/java/eu/siacs/conversations/ui/CreatePrivateGroupChatDialog.java b/src/main/java/eu/siacs/conversations/ui/CreatePrivateGroupChatDialog.java index ef2984a23..6e4098264 100644 --- a/src/main/java/eu/siacs/conversations/ui/CreatePrivateGroupChatDialog.java +++ b/src/main/java/eu/siacs/conversations/ui/CreatePrivateGroupChatDialog.java @@ -2,13 +2,14 @@ package eu.siacs.conversations.ui; import android.app.Dialog; import android.content.Context; -import android.databinding.DataBindingUtil; import android.os.Bundle; -import android.support.annotation.NonNull; -import android.support.v4.app.DialogFragment; -import android.support.v7.app.AlertDialog; import android.widget.Spinner; +import androidx.annotation.NonNull; +import androidx.appcompat.app.AlertDialog; +import androidx.databinding.DataBindingUtil; +import androidx.fragment.app.DialogFragment; + import java.util.ArrayList; import java.util.List; diff --git a/src/main/java/eu/siacs/conversations/ui/CreatePublicChannelDialog.java b/src/main/java/eu/siacs/conversations/ui/CreatePublicChannelDialog.java index 90ecb6df0..3c23b06eb 100644 --- a/src/main/java/eu/siacs/conversations/ui/CreatePublicChannelDialog.java +++ b/src/main/java/eu/siacs/conversations/ui/CreatePublicChannelDialog.java @@ -4,11 +4,7 @@ import android.app.Activity; import android.app.Dialog; import android.content.Context; import android.content.DialogInterface; -import android.databinding.DataBindingUtil; import android.os.Bundle; -import android.support.annotation.NonNull; -import android.support.v4.app.DialogFragment; -import android.support.v7.app.AlertDialog; import android.text.Editable; import android.text.TextUtils; import android.text.TextWatcher; @@ -16,6 +12,11 @@ import android.view.View; import android.widget.AdapterView; import android.widget.Button; +import androidx.annotation.NonNull; +import androidx.appcompat.app.AlertDialog; +import androidx.databinding.DataBindingUtil; +import androidx.fragment.app.DialogFragment; + import java.security.SecureRandom; import java.util.ArrayList; import java.util.Collection; @@ -29,8 +30,8 @@ import eu.siacs.conversations.ui.adapter.KnownHostsAdapter; import eu.siacs.conversations.ui.interfaces.OnBackendConnected; import eu.siacs.conversations.ui.util.DelayedHintHelper; import eu.siacs.conversations.utils.CryptoHelper; -import eu.siacs.conversations.xmpp.XmppConnection; import eu.siacs.conversations.xmpp.Jid; +import eu.siacs.conversations.xmpp.XmppConnection; public class CreatePublicChannelDialog extends DialogFragment implements OnBackendConnected { diff --git a/src/main/java/eu/siacs/conversations/ui/EditAccountActivity.java b/src/main/java/eu/siacs/conversations/ui/EditAccountActivity.java index d7eff28ec..a8f8f3cd2 100644 --- a/src/main/java/eu/siacs/conversations/ui/EditAccountActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/EditAccountActivity.java @@ -6,7 +6,6 @@ import android.content.ActivityNotFoundException; import android.content.Intent; import android.content.IntentSender; import android.content.SharedPreferences; -import android.databinding.DataBindingUtil; import android.graphics.Bitmap; import android.net.Uri; import android.os.Build; @@ -16,11 +15,6 @@ import android.preference.PreferenceManager; import android.provider.Settings; import android.security.KeyChain; import android.security.KeyChainAliasCallback; -import android.support.design.widget.TextInputLayout; -import android.support.v7.app.ActionBar; -import android.support.v7.app.AlertDialog; -import android.support.v7.app.AlertDialog.Builder; -import android.support.v7.widget.Toolbar; import android.text.Editable; import android.text.TextUtils; import android.text.TextWatcher; @@ -34,6 +28,12 @@ import android.widget.EditText; import android.widget.ImageView; import android.widget.Toast; +import androidx.appcompat.app.ActionBar; +import androidx.appcompat.app.AlertDialog; +import androidx.appcompat.app.AlertDialog.Builder; +import androidx.databinding.DataBindingUtil; + +import com.google.android.material.textfield.TextInputLayout; import com.google.common.base.CharMatcher; import org.openintents.openpgp.util.OpenPgpUtils; @@ -42,7 +42,6 @@ import java.net.URL; import java.util.Arrays; import java.util.List; import java.util.Set; -import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicInteger; import eu.siacs.conversations.Config; @@ -65,7 +64,6 @@ import eu.siacs.conversations.ui.util.AvatarWorkerTask; import eu.siacs.conversations.ui.util.MenuDoubleTabUtil; import eu.siacs.conversations.ui.util.PendingItem; import eu.siacs.conversations.ui.util.SoftKeyboardUtils; -import eu.siacs.conversations.utils.CharSequenceUtils; import eu.siacs.conversations.utils.CryptoHelper; import eu.siacs.conversations.utils.Resolver; import eu.siacs.conversations.utils.SignupUtils; @@ -319,7 +317,7 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat } }; - private View.OnFocusChangeListener mEditTextFocusListener = new View.OnFocusChangeListener() { + private final View.OnFocusChangeListener mEditTextFocusListener = new View.OnFocusChangeListener() { @Override public void onFocusChange(View view, boolean b) { EditText et = (EditText) view; @@ -599,7 +597,7 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat this.mSavedInstanceInit = savedInstanceState.getBoolean("initMode", false); } this.binding = DataBindingUtil.setContentView(this, R.layout.activity_edit_account); - setSupportActionBar((Toolbar) binding.toolbar); + setSupportActionBar(binding.toolbar); binding.accountJid.addTextChangedListener(this.mTextWatcher); binding.accountJid.setOnFocusChangeListener(this.mEditTextFocusListener); this.binding.accountPassword.addTextChangedListener(this.mTextWatcher); diff --git a/src/main/java/eu/siacs/conversations/ui/EnterJidDialog.java b/src/main/java/eu/siacs/conversations/ui/EnterJidDialog.java index 83d6d4a0c..2f8c98d76 100644 --- a/src/main/java/eu/siacs/conversations/ui/EnterJidDialog.java +++ b/src/main/java/eu/siacs/conversations/ui/EnterJidDialog.java @@ -2,16 +2,17 @@ package eu.siacs.conversations.ui; import android.app.Activity; import android.app.Dialog; -import android.databinding.DataBindingUtil; import android.os.Bundle; -import android.support.annotation.NonNull; -import android.support.v4.app.DialogFragment; -import android.support.v7.app.AlertDialog; import android.text.Editable; import android.text.TextWatcher; import android.view.View; import android.widget.ArrayAdapter; +import androidx.annotation.NonNull; +import androidx.appcompat.app.AlertDialog; +import androidx.databinding.DataBindingUtil; +import androidx.fragment.app.DialogFragment; + import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; diff --git a/src/main/java/eu/siacs/conversations/ui/JoinConferenceDialog.java b/src/main/java/eu/siacs/conversations/ui/JoinConferenceDialog.java index 05dca588d..e17aab3a4 100644 --- a/src/main/java/eu/siacs/conversations/ui/JoinConferenceDialog.java +++ b/src/main/java/eu/siacs/conversations/ui/JoinConferenceDialog.java @@ -2,18 +2,18 @@ package eu.siacs.conversations.ui; import android.app.Activity; import android.app.Dialog; -import android.databinding.DataBindingUtil; -import android.support.annotation.NonNull; -import android.support.design.widget.TextInputLayout; -import android.support.v4.app.DialogFragment; import android.content.Context; import android.content.DialogInterface; import android.os.Bundle; -import android.support.v7.app.AlertDialog; -import android.view.KeyEvent; import android.widget.AutoCompleteTextView; import android.widget.Spinner; -import android.widget.TextView; + +import androidx.annotation.NonNull; +import androidx.appcompat.app.AlertDialog; +import androidx.databinding.DataBindingUtil; +import androidx.fragment.app.DialogFragment; + +import com.google.android.material.textfield.TextInputLayout; import java.util.ArrayList; import java.util.Collection; diff --git a/src/main/java/eu/siacs/conversations/ui/LocationActivity.java b/src/main/java/eu/siacs/conversations/ui/LocationActivity.java index eb11e5a74..3e830c7c0 100644 --- a/src/main/java/eu/siacs/conversations/ui/LocationActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/LocationActivity.java @@ -14,11 +14,12 @@ import android.os.Build; import android.os.Bundle; import android.preference.PreferenceManager; import android.provider.Settings; -import android.support.annotation.BoolRes; -import android.support.annotation.NonNull; import android.util.Log; import android.view.MenuItem; +import androidx.annotation.BoolRes; +import androidx.annotation.NonNull; + import org.osmdroid.api.IGeoPoint; import org.osmdroid.api.IMapController; import org.osmdroid.config.Configuration; diff --git a/src/main/java/eu/siacs/conversations/ui/MediaBrowserActivity.java b/src/main/java/eu/siacs/conversations/ui/MediaBrowserActivity.java index ba5102886..3793203dd 100644 --- a/src/main/java/eu/siacs/conversations/ui/MediaBrowserActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/MediaBrowserActivity.java @@ -2,18 +2,17 @@ package eu.siacs.conversations.ui; import android.content.Context; import android.content.Intent; -import android.databinding.DataBindingUtil; import android.os.Bundle; -import android.support.v7.widget.Toolbar; + +import androidx.databinding.DataBindingUtil; import java.util.List; import eu.siacs.conversations.R; +import eu.siacs.conversations.databinding.ActivityMediaBrowserBinding; import eu.siacs.conversations.entities.Account; import eu.siacs.conversations.entities.Contact; import eu.siacs.conversations.entities.Conversation; - -import eu.siacs.conversations.databinding.ActivityMediaBrowserBinding; import eu.siacs.conversations.ui.adapter.MediaAdapter; import eu.siacs.conversations.ui.interfaces.OnMediaLoaded; import eu.siacs.conversations.ui.util.Attachment; @@ -30,7 +29,7 @@ public class MediaBrowserActivity extends XmppActivity implements OnMediaLoaded protected void onCreate(final Bundle savedInstanceState) { super.onCreate(savedInstanceState); this.binding = DataBindingUtil.setContentView(this,R.layout.activity_media_browser); - setSupportActionBar((Toolbar) binding.toolbar); + setSupportActionBar(binding.toolbar); configureActionBar(getSupportActionBar()); mMediaAdapter = new MediaAdapter(this, R.dimen.media_size); this.binding.media.setAdapter(mMediaAdapter); diff --git a/src/main/java/eu/siacs/conversations/ui/MemorizingActivity.java b/src/main/java/eu/siacs/conversations/ui/MemorizingActivity.java index 556ed760c..7f8a55a72 100644 --- a/src/main/java/eu/siacs/conversations/ui/MemorizingActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/MemorizingActivity.java @@ -28,11 +28,10 @@ import android.content.DialogInterface; import android.content.DialogInterface.OnCancelListener; import android.content.DialogInterface.OnClickListener; import android.content.Intent; -import android.content.SharedPreferences; import android.os.Bundle; -import android.preference.PreferenceManager; -import android.support.v7.app.AlertDialog; -import android.support.v7.app.AppCompatActivity; + +import androidx.appcompat.app.AlertDialog; +import androidx.appcompat.app.AppCompatActivity; import java.util.logging.Level; import java.util.logging.Logger; diff --git a/src/main/java/eu/siacs/conversations/ui/MucUsersActivity.java b/src/main/java/eu/siacs/conversations/ui/MucUsersActivity.java index 298741651..2f05be90f 100644 --- a/src/main/java/eu/siacs/conversations/ui/MucUsersActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/MucUsersActivity.java @@ -2,9 +2,7 @@ package eu.siacs.conversations.ui; import android.content.Context; import android.content.Intent; -import android.databinding.DataBindingUtil; import android.os.Bundle; -import android.support.v7.widget.Toolbar; import android.text.Editable; import android.text.TextUtils; import android.text.TextWatcher; @@ -15,6 +13,8 @@ import android.view.inputmethod.InputMethodManager; import android.widget.EditText; import android.widget.Toast; +import androidx.databinding.DataBindingUtil; + import java.util.ArrayList; import java.util.Collections; import java.util.Locale; @@ -90,7 +90,7 @@ public class MucUsersActivity extends XmppActivity implements XmppConnectionServ protected void onCreate(final Bundle savedInstanceState) { super.onCreate(savedInstanceState); ActivityMucUsersBinding binding = DataBindingUtil.setContentView(this, R.layout.activity_muc_users); - setSupportActionBar((Toolbar) binding.toolbar); + setSupportActionBar(binding.toolbar); configureActionBar(getSupportActionBar(), true); this.userAdapter = new UserAdapter(getPreferences().getBoolean("advanced_muc_mode", false)); binding.list.setAdapter(this.userAdapter); diff --git a/src/main/java/eu/siacs/conversations/ui/OmemoActivity.java b/src/main/java/eu/siacs/conversations/ui/OmemoActivity.java index 9d41be658..89fdae333 100644 --- a/src/main/java/eu/siacs/conversations/ui/OmemoActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/OmemoActivity.java @@ -1,22 +1,15 @@ package eu.siacs.conversations.ui; -import android.databinding.DataBindingUtil; -import android.net.Uri; -import android.support.v7.app.AlertDialog; import android.content.Intent; -import android.os.Bundle; -import android.support.v4.content.ContextCompat; import android.view.ContextMenu; import android.view.MenuItem; import android.view.View; import android.widget.CompoundButton; - import android.widget.LinearLayout; -import android.widget.TextView; import android.widget.Toast; -import java.security.cert.X509Certificate; -import java.util.Arrays; +import androidx.appcompat.app.AlertDialog; +import androidx.databinding.DataBindingUtil; import eu.siacs.conversations.Config; import eu.siacs.conversations.R; @@ -211,7 +204,7 @@ public abstract class OmemoActivity extends XmppActivity { } @Override - public void onRequestPermissionsResult(int requestCode, String permissions[], int[] grantResults) { + public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) { ScanActivity.onRequestPermissionResult(this, requestCode, grantResults); } } diff --git a/src/main/java/eu/siacs/conversations/ui/PublishGroupChatProfilePictureActivity.java b/src/main/java/eu/siacs/conversations/ui/PublishGroupChatProfilePictureActivity.java index 898f607c4..81b0ae15c 100644 --- a/src/main/java/eu/siacs/conversations/ui/PublishGroupChatProfilePictureActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/PublishGroupChatProfilePictureActivity.java @@ -30,16 +30,16 @@ package eu.siacs.conversations.ui; import android.content.Intent; -import android.databinding.DataBindingUtil; import android.graphics.Bitmap; import android.net.Uri; import android.os.Bundle; -import android.support.annotation.StringRes; -import android.support.v7.widget.Toolbar; import android.util.Log; import android.view.View; import android.widget.Toast; +import androidx.annotation.StringRes; +import androidx.databinding.DataBindingUtil; + import com.theartofdev.edmodo.cropper.CropImage; import eu.siacs.conversations.Config; @@ -91,7 +91,7 @@ public class PublishGroupChatProfilePictureActivity extends XmppActivity impleme public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); this.binding = DataBindingUtil.setContentView(this, R.layout.activity_publish_profile_picture); - setSupportActionBar((Toolbar) this.binding.toolbar); + setSupportActionBar(this.binding.toolbar); configureActionBar(getSupportActionBar()); this.binding.cancelButton.setOnClickListener((v) -> this.finish()); this.binding.secondaryHint.setVisibility(View.GONE); diff --git a/src/main/java/eu/siacs/conversations/ui/PublishProfilePictureActivity.java b/src/main/java/eu/siacs/conversations/ui/PublishProfilePictureActivity.java index db05cc8bf..f0e715218 100644 --- a/src/main/java/eu/siacs/conversations/ui/PublishProfilePictureActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/PublishProfilePictureActivity.java @@ -6,7 +6,6 @@ import android.graphics.Bitmap; import android.net.Uri; import android.os.Build; import android.os.Bundle; -import android.support.annotation.StringRes; import android.util.Log; import android.view.View; import android.view.View.OnLongClickListener; @@ -15,6 +14,8 @@ import android.widget.ImageView; import android.widget.TextView; import android.widget.Toast; +import androidx.annotation.StringRes; + import com.theartofdev.edmodo.cropper.CropImage; import java.util.concurrent.atomic.AtomicBoolean; @@ -40,8 +41,8 @@ public class PublishProfilePictureActivity extends XmppActivity implements XmppC private Account account; private boolean support = false; private boolean publishing = false; - private AtomicBoolean handledExternalUri = new AtomicBoolean(false); - private OnLongClickListener backToDefaultListener = new OnLongClickListener() { + private final AtomicBoolean handledExternalUri = new AtomicBoolean(false); + private final OnLongClickListener backToDefaultListener = new OnLongClickListener() { @Override public boolean onLongClick(View v) { diff --git a/src/main/java/eu/siacs/conversations/ui/RecordingActivity.java b/src/main/java/eu/siacs/conversations/ui/RecordingActivity.java index bcd564788..5e4c90048 100644 --- a/src/main/java/eu/siacs/conversations/ui/RecordingActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/RecordingActivity.java @@ -1,10 +1,8 @@ package eu.siacs.conversations.ui; -import android.annotation.SuppressLint; import android.app.Activity; import android.content.Context; import android.content.Intent; -import android.databinding.DataBindingUtil; import android.media.MediaRecorder; import android.net.Uri; import android.os.Bundle; @@ -16,6 +14,8 @@ import android.view.View; import android.view.WindowManager; import android.widget.Toast; +import androidx.databinding.DataBindingUtil; + import java.io.File; import java.io.IOException; import java.text.SimpleDateFormat; @@ -40,10 +40,10 @@ public class RecordingActivity extends Activity implements View.OnClickListener private MediaRecorder mRecorder; private long mStartTime = 0; - private CountDownLatch outputFileWrittenLatch = new CountDownLatch(1); + private final CountDownLatch outputFileWrittenLatch = new CountDownLatch(1); - private Handler mHandler = new Handler(); - private Runnable mTickExecutor = new Runnable() { + private final Handler mHandler = new Handler(); + private final Runnable mTickExecutor = new Runnable() { @Override public void run() { tick(); diff --git a/src/main/java/eu/siacs/conversations/ui/RtpSessionActivity.java b/src/main/java/eu/siacs/conversations/ui/RtpSessionActivity.java index 0cf2d6f33..dbb8763fb 100644 --- a/src/main/java/eu/siacs/conversations/ui/RtpSessionActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/RtpSessionActivity.java @@ -7,15 +7,11 @@ import android.content.ActivityNotFoundException; import android.content.Context; import android.content.Intent; import android.content.pm.PackageManager; -import android.databinding.DataBindingUtil; import android.os.Build; import android.os.Bundle; import android.os.Handler; import android.os.PowerManager; import android.os.SystemClock; -import android.support.annotation.NonNull; -import android.support.annotation.RequiresApi; -import android.support.annotation.StringRes; import android.util.Log; import android.util.Rational; import android.view.Menu; @@ -24,6 +20,11 @@ import android.view.View; import android.view.WindowManager; import android.widget.Toast; +import androidx.annotation.NonNull; +import androidx.annotation.RequiresApi; +import androidx.annotation.StringRes; +import androidx.databinding.DataBindingUtil; + import com.google.common.base.Optional; import com.google.common.base.Preconditions; import com.google.common.base.Throwables; @@ -55,12 +56,12 @@ import eu.siacs.conversations.ui.util.MainThreadExecutor; import eu.siacs.conversations.utils.PermissionUtils; import eu.siacs.conversations.utils.TimeFrameUtils; import eu.siacs.conversations.xml.Namespace; +import eu.siacs.conversations.xmpp.Jid; import eu.siacs.conversations.xmpp.jingle.AbstractJingleConnection; import eu.siacs.conversations.xmpp.jingle.JingleConnectionManager; import eu.siacs.conversations.xmpp.jingle.JingleRtpConnection; import eu.siacs.conversations.xmpp.jingle.Media; import eu.siacs.conversations.xmpp.jingle.RtpEndUserState; -import eu.siacs.conversations.xmpp.Jid; import static eu.siacs.conversations.utils.PermissionUtils.getFirstDenied; import static java.util.Arrays.asList; @@ -99,8 +100,8 @@ public class RtpSessionActivity extends XmppActivity implements XmppConnectionSe private ActivityRtpSessionBinding binding; private PowerManager.WakeLock mProximityWakeLock; - private Handler mHandler = new Handler(); - private Runnable mTickExecutor = new Runnable() { + private final Handler mHandler = new Handler(); + private final Runnable mTickExecutor = new Runnable() { @Override public void run() { updateCallDuration(); @@ -457,18 +458,21 @@ public class RtpSessionActivity extends XmppActivity implements XmppConnectionSe @Override public void onBackPressed() { + if (isConnected()) { + if (switchToPictureInPicture()) { + return; + } + } else { + endCall(); + } super.onBackPressed(); - endCall(); } @Override public void onUserLeaveHint() { super.onUserLeaveHint(); - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O && deviceSupportsPictureInPicture()) { - if (shouldBePictureInPicture()) { - startPictureInPicture(); - return; - } + if (switchToPictureInPicture()) { + return; } //TODO apparently this method is not getting called on Android 10 when using the task switcher final boolean emptyReference = rtpConnectionReference == null || rtpConnectionReference.get() == null; @@ -477,6 +481,21 @@ public class RtpSessionActivity extends XmppActivity implements XmppConnectionSe } } + private boolean isConnected() { + final JingleRtpConnection connection = this.rtpConnectionReference != null ? this.rtpConnectionReference.get() : null; + return connection != null && connection.getEndUserState() == RtpEndUserState.CONNECTED; + } + + private boolean switchToPictureInPicture() { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O && deviceSupportsPictureInPicture()) { + if (shouldBePictureInPicture()) { + startPictureInPicture(); + return true; + } + } + return false; + } + @RequiresApi(api = Build.VERSION_CODES.O) private void startPictureInPicture() { try { diff --git a/src/main/java/eu/siacs/conversations/ui/ScanActivity.java b/src/main/java/eu/siacs/conversations/ui/ScanActivity.java index 24f3e82af..cebd19bc3 100644 --- a/src/main/java/eu/siacs/conversations/ui/ScanActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/ScanActivity.java @@ -17,18 +17,6 @@ package eu.siacs.conversations.ui; -import java.util.EnumMap; -import java.util.Map; - -import com.google.zxing.BinaryBitmap; -import com.google.zxing.DecodeHintType; -import com.google.zxing.PlanarYUVLuminanceSource; -import com.google.zxing.ReaderException; -import com.google.zxing.Result; -import com.google.zxing.ResultPointCallback; -import com.google.zxing.common.HybridBinarizer; -import com.google.zxing.qrcode.QRCodeReader; - import android.Manifest; import android.app.Activity; import android.content.Context; @@ -45,8 +33,6 @@ import android.os.Handler; import android.os.HandlerThread; import android.os.Process; import android.os.Vibrator; -import android.support.v4.app.ActivityCompat; -import android.support.v4.content.ContextCompat; import android.util.Log; import android.view.KeyEvent; import android.view.Surface; @@ -56,6 +42,21 @@ import android.view.View; import android.view.WindowManager; import android.widget.Toast; +import androidx.core.app.ActivityCompat; +import androidx.core.content.ContextCompat; + +import com.google.zxing.BinaryBitmap; +import com.google.zxing.DecodeHintType; +import com.google.zxing.PlanarYUVLuminanceSource; +import com.google.zxing.ReaderException; +import com.google.zxing.Result; +import com.google.zxing.ResultPointCallback; +import com.google.zxing.common.HybridBinarizer; +import com.google.zxing.qrcode.QRCodeReader; + +import java.util.EnumMap; +import java.util.Map; + import eu.siacs.conversations.Config; import eu.siacs.conversations.R; import eu.siacs.conversations.ui.service.CameraManager; @@ -73,7 +74,7 @@ public final class ScanActivity extends Activity implements SurfaceTextureListen private static final long VIBRATE_DURATION = 50L; private static final long AUTO_FOCUS_INTERVAL_MS = 2500L; - private static boolean DISABLE_CONTINUOUS_AUTOFOCUS = Build.MODEL.equals("GT-I9100") // Galaxy S2 + private static final boolean DISABLE_CONTINUOUS_AUTOFOCUS = Build.MODEL.equals("GT-I9100") // Galaxy S2 || Build.MODEL.equals("SGH-T989") // Galaxy S2 || Build.MODEL.equals("SGH-T989D") // Galaxy S2 X || Build.MODEL.equals("SAMSUNG-SGH-I727") // Galaxy S2 Skyrocket diff --git a/src/main/java/eu/siacs/conversations/ui/SearchActivity.java b/src/main/java/eu/siacs/conversations/ui/SearchActivity.java index 1b2430f6d..f5f4eb175 100644 --- a/src/main/java/eu/siacs/conversations/ui/SearchActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/SearchActivity.java @@ -30,9 +30,7 @@ package eu.siacs.conversations.ui; import android.content.Intent; -import android.databinding.DataBindingUtil; import android.os.Bundle; -import android.support.v7.widget.Toolbar; import android.text.Editable; import android.text.InputType; import android.text.TextWatcher; @@ -44,6 +42,8 @@ import android.view.View; import android.widget.AdapterView; import android.widget.EditText; +import androidx.databinding.DataBindingUtil; + import com.google.common.base.Strings; import java.lang.ref.WeakReference; @@ -61,10 +61,10 @@ import eu.siacs.conversations.ui.adapter.MessageAdapter; import eu.siacs.conversations.ui.interfaces.OnSearchResultsAvailable; import eu.siacs.conversations.ui.util.ChangeWatcher; import eu.siacs.conversations.ui.util.DateSeparator; -import eu.siacs.conversations.ui.util.StyledAttributes; import eu.siacs.conversations.ui.util.ListViewUtils; import eu.siacs.conversations.ui.util.PendingItem; import eu.siacs.conversations.ui.util.ShareUtil; +import eu.siacs.conversations.ui.util.StyledAttributes; import eu.siacs.conversations.utils.FtsUtils; import eu.siacs.conversations.utils.MessageUtils; @@ -95,7 +95,7 @@ public class SearchActivity extends XmppActivity implements TextWatcher, OnSearc } super.onCreate(bundle); this.binding = DataBindingUtil.setContentView(this, R.layout.activity_search); - setSupportActionBar((Toolbar) this.binding.toolbar); + setSupportActionBar(this.binding.toolbar); configureActionBar(getSupportActionBar()); this.messageListAdapter = new MessageAdapter(this, this.messages); this.messageListAdapter.setOnContactPictureClicked(this); diff --git a/src/main/java/eu/siacs/conversations/ui/SettingsActivity.java b/src/main/java/eu/siacs/conversations/ui/SettingsActivity.java index 1a84dcb72..3632c9cd8 100644 --- a/src/main/java/eu/siacs/conversations/ui/SettingsActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/SettingsActivity.java @@ -1,19 +1,15 @@ package eu.siacs.conversations.ui; -import android.preference.CheckBoxPreference; -import android.support.annotation.NonNull; -import android.support.v4.content.ContextCompat; -import android.support.v7.app.AlertDialog; import android.app.FragmentManager; import android.content.DialogInterface; import android.content.Intent; import android.content.SharedPreferences; import android.content.SharedPreferences.OnSharedPreferenceChangeListener; import android.content.pm.PackageManager; - import android.net.Uri; import android.os.Build; import android.os.Bundle; +import android.preference.CheckBoxPreference; import android.preference.ListPreference; import android.preference.Preference; import android.preference.PreferenceCategory; @@ -23,6 +19,10 @@ import android.provider.MediaStore; import android.util.Log; import android.widget.Toast; +import androidx.annotation.NonNull; +import androidx.appcompat.app.AlertDialog; +import androidx.core.content.ContextCompat; + import java.io.File; import java.security.KeyStoreException; import java.util.ArrayList; @@ -188,11 +188,7 @@ public class SettingsActivity extends XmppActivity implements } else if (selectedItems.contains(indexSelected)) { selectedItems.remove(Integer.valueOf(indexSelected)); } - if (selectedItems.size() > 0) - ((AlertDialog) dialog).getButton(DialogInterface.BUTTON_POSITIVE).setEnabled(true); - else { - ((AlertDialog) dialog).getButton(DialogInterface.BUTTON_POSITIVE).setEnabled(false); - } + ((AlertDialog) dialog).getButton(DialogInterface.BUTTON_POSITIVE).setEnabled(selectedItems.size() > 0); }); dialogBuilder.setPositiveButton( diff --git a/src/main/java/eu/siacs/conversations/ui/ShareLocationActivity.java b/src/main/java/eu/siacs/conversations/ui/ShareLocationActivity.java index 136e9d2b2..641a01e5c 100644 --- a/src/main/java/eu/siacs/conversations/ui/ShareLocationActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/ShareLocationActivity.java @@ -3,16 +3,17 @@ package eu.siacs.conversations.ui; import android.Manifest; import android.content.Intent; import android.content.pm.PackageManager; -import android.databinding.DataBindingUtil; import android.location.Location; import android.location.LocationListener; import android.os.Build; import android.os.Bundle; -import android.support.annotation.NonNull; -import android.support.design.widget.Snackbar; -import android.support.v7.widget.Toolbar; import android.view.View; +import androidx.annotation.NonNull; +import androidx.databinding.DataBindingUtil; + +import com.google.android.material.snackbar.Snackbar; + import org.osmdroid.api.IGeoPoint; import org.osmdroid.util.GeoPoint; @@ -54,7 +55,7 @@ public class ShareLocationActivity extends LocationActivity implements LocationL super.onCreate(savedInstanceState); this.binding = DataBindingUtil.setContentView(this,R.layout.activity_share_location); - setSupportActionBar((Toolbar) binding.toolbar); + setSupportActionBar(binding.toolbar); configureActionBar(getSupportActionBar()); setupMapView(binding.map, LocationProvider.getGeoPoint(this)); diff --git a/src/main/java/eu/siacs/conversations/ui/ShareWithActivity.java b/src/main/java/eu/siacs/conversations/ui/ShareWithActivity.java index 3589bb41e..a55df7105 100644 --- a/src/main/java/eu/siacs/conversations/ui/ShareWithActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/ShareWithActivity.java @@ -4,13 +4,14 @@ import android.content.Intent; import android.content.pm.PackageManager; import android.net.Uri; import android.os.Bundle; -import android.support.v7.widget.LinearLayoutManager; -import android.support.v7.widget.RecyclerView; import android.util.Log; import android.view.Menu; import android.view.MenuItem; import android.widget.Toast; +import androidx.recyclerview.widget.LinearLayoutManager; +import androidx.recyclerview.widget.RecyclerView; + import java.util.ArrayList; import java.util.List; @@ -44,7 +45,7 @@ public class ShareWithActivity extends XmppActivity implements XmppConnectionSer private static final int REQUEST_START_NEW_CONVERSATION = 0x0501; private ConversationAdapter mAdapter; - private List mConversations = new ArrayList<>(); + private final List mConversations = new ArrayList<>(); protected void onActivityResult(int requestCode, int resultCode, final Intent data) { @@ -63,7 +64,7 @@ public class ShareWithActivity extends XmppActivity implements XmppConnectionSer } @Override - public void onRequestPermissionsResult(int requestCode, String permissions[], int[] grantResults) { + public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) { if (grantResults.length > 0) if (grantResults[0] == PackageManager.PERMISSION_GRANTED) { if (requestCode == REQUEST_STORAGE_PERMISSION) { diff --git a/src/main/java/eu/siacs/conversations/ui/ShortcutActivity.java b/src/main/java/eu/siacs/conversations/ui/ShortcutActivity.java index db25ee3e8..33164c95c 100644 --- a/src/main/java/eu/siacs/conversations/ui/ShortcutActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/ShortcutActivity.java @@ -4,16 +4,14 @@ import android.content.ComponentName; import android.content.Context; import android.content.Intent; import android.os.Bundle; -import android.support.v7.app.ActionBar; -import android.util.Log; -import android.view.View; import android.view.inputmethod.InputMethodManager; +import androidx.appcompat.app.ActionBar; + import java.util.Arrays; import java.util.Collections; import java.util.List; -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/ShowLocationActivity.java b/src/main/java/eu/siacs/conversations/ui/ShowLocationActivity.java index b591659c6..43c55de49 100644 --- a/src/main/java/eu/siacs/conversations/ui/ShowLocationActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/ShowLocationActivity.java @@ -5,18 +5,18 @@ import android.content.ClipData; import android.content.ClipboardManager; import android.content.ComponentName; import android.content.Intent; -import android.databinding.DataBindingUtil; import android.location.Location; import android.location.LocationListener; import android.net.Uri; import android.os.Bundle; -import android.support.annotation.NonNull; -import android.support.v7.widget.Toolbar; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.Toast; +import androidx.annotation.NonNull; +import androidx.databinding.DataBindingUtil; + import org.osmdroid.util.GeoPoint; import java.util.HashMap; @@ -48,7 +48,7 @@ public class ShowLocationActivity extends LocationActivity implements LocationLi super.onCreate(savedInstanceState); this.binding = DataBindingUtil.setContentView(this,R.layout.activity_show_location); - setSupportActionBar((Toolbar) binding.toolbar); + setSupportActionBar(binding.toolbar); configureActionBar(getSupportActionBar()); setupMapView(this.binding.map, this.loc); @@ -193,7 +193,7 @@ public class ShowLocationActivity extends LocationActivity implements LocationLi private void startNavigation() { startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse( "google.navigation:q=" + - String.valueOf(this.loc.getLatitude()) + "," + String.valueOf(this.loc.getLongitude()) + this.loc.getLatitude() + "," + this.loc.getLongitude() ))); } diff --git a/src/main/java/eu/siacs/conversations/ui/StartConversationActivity.java b/src/main/java/eu/siacs/conversations/ui/StartConversationActivity.java index fa0d5ada9..bfb922fa1 100644 --- a/src/main/java/eu/siacs/conversations/ui/StartConversationActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/StartConversationActivity.java @@ -9,22 +9,9 @@ import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; import android.content.pm.PackageManager; -import android.databinding.DataBindingUtil; import android.net.Uri; import android.os.Build; import android.os.Bundle; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; -import android.support.design.widget.TextInputLayout; -import android.support.v4.app.Fragment; -import android.support.v4.app.FragmentManager; -import android.support.v4.app.FragmentTransaction; -import android.support.v4.view.PagerAdapter; -import android.support.v4.view.ViewPager; -import android.support.v4.widget.SwipeRefreshLayout; -import android.support.v7.app.ActionBar; -import android.support.v7.app.AlertDialog; -import android.support.v7.widget.Toolbar; import android.text.Editable; import android.text.Html; import android.text.TextWatcher; @@ -50,6 +37,20 @@ import android.widget.Spinner; import android.widget.TextView; import android.widget.Toast; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.appcompat.app.ActionBar; +import androidx.appcompat.app.AlertDialog; +import androidx.databinding.DataBindingUtil; +import androidx.fragment.app.Fragment; +import androidx.fragment.app.FragmentManager; +import androidx.fragment.app.FragmentTransaction; +import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; +import androidx.viewpager.widget.PagerAdapter; +import androidx.viewpager.widget.ViewPager; + +import com.google.android.material.textfield.TextInputLayout; + import java.util.ArrayList; import java.util.Collections; import java.util.List; @@ -77,9 +78,9 @@ import eu.siacs.conversations.ui.util.SoftKeyboardUtils; import eu.siacs.conversations.ui.widget.SwipeRefreshListFragment; import eu.siacs.conversations.utils.AccountUtils; import eu.siacs.conversations.utils.XmppUri; +import eu.siacs.conversations.xmpp.Jid; import eu.siacs.conversations.xmpp.OnUpdateBlocklist; import eu.siacs.conversations.xmpp.XmppConnection; -import eu.siacs.conversations.xmpp.Jid; public class StartConversationActivity extends XmppActivity implements XmppConnectionService.OnConversationUpdate, OnRosterUpdate, OnUpdateBlocklist, CreatePrivateGroupChatDialog.CreateConferenceDialogListener, JoinConferenceDialog.JoinConferenceDialogListener, SwipeRefreshLayout.OnRefreshListener, CreatePublicChannelDialog.CreatePublicChannelDialogListener { @@ -93,17 +94,17 @@ public class StartConversationActivity extends XmppActivity implements XmppConne public int conference_context_id; public int contact_context_id; private ListPagerAdapter mListPagerAdapter; - private List contacts = new ArrayList<>(); + private final List contacts = new ArrayList<>(); private ListItemAdapter mContactsAdapter; - private List conferences = new ArrayList<>(); + private final List conferences = new ArrayList<>(); private ListItemAdapter mConferenceAdapter; - private List mActivatedAccounts = new ArrayList<>(); + private final List mActivatedAccounts = new ArrayList<>(); private EditText mSearchEditText; - private AtomicBoolean mRequestedContactsPermission = new AtomicBoolean(false); - private AtomicBoolean mOpenedFab = new AtomicBoolean(false); + private final AtomicBoolean mRequestedContactsPermission = new AtomicBoolean(false); + private final AtomicBoolean mOpenedFab = new AtomicBoolean(false); private boolean mHideOfflineContacts = false; private boolean createdByViewIntent = false; - private MenuItem.OnActionExpandListener mOnActionExpandListener = new MenuItem.OnActionExpandListener() { + private final MenuItem.OnActionExpandListener mOnActionExpandListener = new MenuItem.OnActionExpandListener() { @Override public boolean onMenuItemActionExpand(MenuItem item) { @@ -132,7 +133,7 @@ public class StartConversationActivity extends XmppActivity implements XmppConne return true; } }; - private TextWatcher mSearchTextWatcher = new TextWatcher() { + private final TextWatcher mSearchTextWatcher = new TextWatcher() { @Override public void afterTextChanged(Editable editable) { @@ -148,7 +149,7 @@ public class StartConversationActivity extends XmppActivity implements XmppConne } }; private MenuItem mMenuSearchView; - private ListItemAdapter.OnTagClickedListener mOnTagClickedListener = new ListItemAdapter.OnTagClickedListener() { + private final ListItemAdapter.OnTagClickedListener mOnTagClickedListener = new ListItemAdapter.OnTagClickedListener() { @Override public void onTagClicked(String tag) { if (mMenuSearchView != null) { @@ -161,7 +162,7 @@ public class StartConversationActivity extends XmppActivity implements XmppConne }; private Pair mPostponedActivityResult; private Toast mToast; - private UiCallback mAdhocConferenceCallback = new UiCallback() { + private final UiCallback mAdhocConferenceCallback = new UiCallback() { @Override public void success(final Conversation conversation) { runOnUiThread(() -> { @@ -181,7 +182,7 @@ public class StartConversationActivity extends XmppActivity implements XmppConne } }; private ActivityStartConversationBinding binding; - private TextView.OnEditorActionListener mSearchDone = new TextView.OnEditorActionListener() { + private final TextView.OnEditorActionListener mSearchDone = new TextView.OnEditorActionListener() { @Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { int pos = binding.startConversationViewPager.getCurrentItem(); @@ -261,8 +262,7 @@ public class StartConversationActivity extends XmppActivity implements XmppConne public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); this.binding = DataBindingUtil.setContentView(this, R.layout.activity_start_conversation); - Toolbar toolbar = (Toolbar) binding.toolbar; - setSupportActionBar(toolbar); + setSupportActionBar(binding.toolbar); configureActionBar(getSupportActionBar()); binding.speedDial.inflate(R.menu.start_conversation_fab_submenu); @@ -376,6 +376,7 @@ public class StartConversationActivity extends XmppActivity implements XmppConne @Override public void onNewIntent(final Intent intent) { + super.onNewIntent(intent); if (xmppConnectionServiceBound) { processViewIntent(intent); } else { @@ -759,7 +760,7 @@ public class StartConversationActivity extends XmppActivity implements XmppConne } @Override - public void onRequestPermissionsResult(int requestCode, @NonNull String permissions[], @NonNull int[] grantResults) { + public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { if (grantResults.length > 0) if (grantResults[0] == PackageManager.PERMISSION_GRANTED) { ScanActivity.onRequestPermissionResult(this, requestCode, grantResults); diff --git a/src/main/java/eu/siacs/conversations/ui/TrustKeysActivity.java b/src/main/java/eu/siacs/conversations/ui/TrustKeysActivity.java index 0ac96fea4..ece042ffd 100644 --- a/src/main/java/eu/siacs/conversations/ui/TrustKeysActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/TrustKeysActivity.java @@ -2,10 +2,7 @@ package eu.siacs.conversations.ui; import android.app.AlertDialog; import android.content.Intent; -import android.databinding.DataBindingUtil; import android.os.Bundle; -import android.support.v7.app.ActionBar; -import android.support.v7.widget.Toolbar; import android.util.Log; import android.view.Gravity; import android.view.Menu; @@ -14,6 +11,9 @@ import android.view.View; import android.view.View.OnClickListener; import android.widget.Toast; +import androidx.appcompat.app.ActionBar; +import androidx.databinding.DataBindingUtil; + import org.whispersystems.libsignal.IdentityKey; import java.util.ArrayList; @@ -37,8 +37,8 @@ import eu.siacs.conversations.entities.Message; import eu.siacs.conversations.utils.CryptoHelper; import eu.siacs.conversations.utils.IrregularUnicodeDetector; import eu.siacs.conversations.utils.XmppUri; -import eu.siacs.conversations.xmpp.OnKeyStatusUpdated; import eu.siacs.conversations.xmpp.Jid; +import eu.siacs.conversations.xmpp.OnKeyStatusUpdated; public class TrustKeysActivity extends OmemoActivity implements OnKeyStatusUpdated { @@ -55,7 +55,7 @@ public class TrustKeysActivity extends OmemoActivity implements OnKeyStatusUpdat commitTrusts(); finishOk(false); }; - private AtomicBoolean mUseCameraHintShown = new AtomicBoolean(false); + private final AtomicBoolean mUseCameraHintShown = new AtomicBoolean(false); private AxolotlService.FetchStatus lastFetchReport = AxolotlService.FetchStatus.SUCCESS; private Toast mUseCameraHintToast = null; private ActivityTrustKeysBinding binding; @@ -82,7 +82,7 @@ public class TrustKeysActivity extends OmemoActivity implements OnKeyStatusUpdat binding.cancelButton.setOnClickListener(mCancelButtonListener); binding.saveButton.setOnClickListener(mSaveButtonListener); - setSupportActionBar((Toolbar) binding.toolbar); + setSupportActionBar(binding.toolbar); configureActionBar(getSupportActionBar()); if (savedInstanceState != null) { @@ -151,7 +151,7 @@ public class TrustKeysActivity extends OmemoActivity implements OnKeyStatusUpdat } } else { reloadFingerprints(); - Log.d(Config.LOGTAG, "xmpp uri was: " + uri.getJid() + " has Fingerprints: " + Boolean.toString(uri.hasFingerprints())); + Log.d(Config.LOGTAG, "xmpp uri was: " + uri.getJid() + " has Fingerprints: " + uri.hasFingerprints()); Toast.makeText(this, R.string.barcode_does_not_contain_fingerprints_for_this_conversation, Toast.LENGTH_SHORT).show(); } populateView(); @@ -437,7 +437,7 @@ public class TrustKeysActivity extends OmemoActivity implements OnKeyStatusUpdat synchronized (this.foreignKeysToTrust) { for (Jid jid : contactJids) { Map fingerprints = foreignKeysToTrust.get(jid); - if (hasNoOtherTrustedKeys(jid) && (fingerprints == null || !fingerprints.values().contains(true))) { + if (hasNoOtherTrustedKeys(jid) && (fingerprints == null || !fingerprints.containsValue(true))) { lock(); return; } diff --git a/src/main/java/eu/siacs/conversations/ui/UriHandlerActivity.java b/src/main/java/eu/siacs/conversations/ui/UriHandlerActivity.java index 30c330c4d..f868e3337 100644 --- a/src/main/java/eu/siacs/conversations/ui/UriHandlerActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/UriHandlerActivity.java @@ -7,10 +7,11 @@ import android.content.pm.PackageManager; import android.net.Uri; import android.os.Build; import android.os.Bundle; -import android.support.v4.content.ContextCompat; -import android.support.v7.app.AppCompatActivity; import android.widget.Toast; +import androidx.appcompat.app.AppCompatActivity; +import androidx.core.content.ContextCompat; + import com.google.common.base.Strings; import java.util.List; diff --git a/src/main/java/eu/siacs/conversations/ui/XmppActivity.java b/src/main/java/eu/siacs/conversations/ui/XmppActivity.java index e143cee3d..b3591551b 100644 --- a/src/main/java/eu/siacs/conversations/ui/XmppActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/XmppActivity.java @@ -19,7 +19,6 @@ import android.content.pm.PackageManager; import android.content.pm.ResolveInfo; import android.content.res.Resources; import android.content.res.TypedArray; -import android.databinding.DataBindingUtil; import android.graphics.Bitmap; import android.graphics.Color; import android.graphics.Point; @@ -35,12 +34,6 @@ import android.os.IBinder; import android.os.PowerManager; import android.os.SystemClock; import android.preference.PreferenceManager; -import android.support.annotation.BoolRes; -import android.support.annotation.NonNull; -import android.support.annotation.StringRes; -import android.support.v7.app.AlertDialog; -import android.support.v7.app.AlertDialog.Builder; -import android.support.v7.app.AppCompatDelegate; import android.text.InputType; import android.util.DisplayMetrics; import android.util.Log; @@ -50,6 +43,14 @@ import android.view.View; import android.widget.ImageView; import android.widget.Toast; +import androidx.annotation.BoolRes; +import androidx.annotation.NonNull; +import androidx.annotation.StringRes; +import androidx.appcompat.app.AlertDialog; +import androidx.appcompat.app.AlertDialog.Builder; +import androidx.appcompat.app.AppCompatDelegate; +import androidx.databinding.DataBindingUtil; + import java.io.IOException; import java.lang.ref.WeakReference; import java.util.ArrayList; @@ -77,9 +78,9 @@ import eu.siacs.conversations.ui.util.SoftKeyboardUtils; import eu.siacs.conversations.utils.AccountUtils; import eu.siacs.conversations.utils.ExceptionHelper; 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 eu.siacs.conversations.xmpp.Jid; public abstract class XmppActivity extends ActionBarActivity { @@ -119,12 +120,12 @@ public abstract class XmppActivity extends ActionBarActivity { }; private DisplayMetrics metrics; private long mLastUiRefresh = 0; - private Handler mRefreshUiHandler = new Handler(); - private Runnable mRefreshUiRunnable = () -> { + private final Handler mRefreshUiHandler = new Handler(); + private final Runnable mRefreshUiRunnable = () -> { mLastUiRefresh = SystemClock.elapsedRealtime(); refreshUiReal(); }; - private UiCallback adhocCallback = new UiCallback() { + private final UiCallback adhocCallback = new UiCallback() { @Override public void success(final Conversation conversation) { runOnUiThread(() -> { @@ -913,7 +914,7 @@ public abstract class XmppActivity extends ActionBarActivity { public static class ConferenceInvite { private String uuid; - private List jids = new ArrayList<>(); + private final List jids = new ArrayList<>(); public static ConferenceInvite parse(Intent data) { ConferenceInvite invite = new ConferenceInvite(); 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 73e3b4194..b070a63bb 100644 --- a/src/main/java/eu/siacs/conversations/ui/adapter/AccountAdapter.java +++ b/src/main/java/eu/siacs/conversations/ui/adapter/AccountAdapter.java @@ -1,21 +1,14 @@ package eu.siacs.conversations.ui.adapter; -import android.content.res.Resources; -import android.databinding.DataBindingUtil; -import android.graphics.Bitmap; -import android.graphics.drawable.BitmapDrawable; -import android.graphics.drawable.Drawable; -import android.os.AsyncTask; -import android.support.annotation.NonNull; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ArrayAdapter; -import android.widget.ImageView; -import java.lang.ref.WeakReference; +import androidx.annotation.NonNull; +import androidx.databinding.DataBindingUtil; + import java.util.List; -import java.util.concurrent.RejectedExecutionException; import eu.siacs.conversations.Config; import eu.siacs.conversations.R; @@ -24,12 +17,11 @@ import eu.siacs.conversations.entities.Account; import eu.siacs.conversations.ui.XmppActivity; import eu.siacs.conversations.ui.util.AvatarWorkerTask; import eu.siacs.conversations.ui.util.StyledAttributes; -import eu.siacs.conversations.utils.UIHelper; public class AccountAdapter extends ArrayAdapter { - private XmppActivity activity; - private boolean showStateButton; + private final XmppActivity activity; + private final boolean showStateButton; public AccountAdapter(XmppActivity activity, List objects, boolean showStateButton) { super(activity, 0, objects); 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 3c533a7a2..ae9a67f6b 100644 --- a/src/main/java/eu/siacs/conversations/ui/adapter/ChannelSearchResultAdapter.java +++ b/src/main/java/eu/siacs/conversations/ui/adapter/ChannelSearchResultAdapter.java @@ -1,17 +1,18 @@ package eu.siacs.conversations.ui.adapter; import android.app.Activity; -import android.databinding.DataBindingUtil; -import android.support.annotation.NonNull; -import android.support.v7.recyclerview.extensions.ListAdapter; -import android.support.v7.util.DiffUtil; -import android.support.v7.widget.RecyclerView; import android.text.TextUtils; import android.view.ContextMenu; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; +import androidx.annotation.NonNull; +import androidx.databinding.DataBindingUtil; +import androidx.recyclerview.widget.DiffUtil; +import androidx.recyclerview.widget.ListAdapter; +import androidx.recyclerview.widget.RecyclerView; + import java.util.Locale; import eu.siacs.conversations.R; 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 8aaeceafd..049703597 100644 --- a/src/main/java/eu/siacs/conversations/ui/adapter/ConversationAdapter.java +++ b/src/main/java/eu/siacs/conversations/ui/adapter/ConversationAdapter.java @@ -1,14 +1,15 @@ package eu.siacs.conversations.ui.adapter; -import android.databinding.DataBindingUtil; import android.graphics.Typeface; -import android.support.annotation.NonNull; -import android.support.v7.widget.RecyclerView; import android.util.Pair; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; +import androidx.annotation.NonNull; +import androidx.databinding.DataBindingUtil; +import androidx.recyclerview.widget.RecyclerView; + import com.google.common.base.Optional; import java.util.List; @@ -25,13 +26,13 @@ import eu.siacs.conversations.ui.util.StyledAttributes; import eu.siacs.conversations.utils.EmojiWrapper; import eu.siacs.conversations.utils.IrregularUnicodeDetector; import eu.siacs.conversations.utils.UIHelper; -import eu.siacs.conversations.xmpp.jingle.OngoingRtpSession; import eu.siacs.conversations.xmpp.Jid; +import eu.siacs.conversations.xmpp.jingle.OngoingRtpSession; public class ConversationAdapter extends RecyclerView.Adapter { - private XmppActivity activity; - private List conversations; + private final XmppActivity activity; + private final List conversations; private OnConversationClickListener listener; public ConversationAdapter(XmppActivity activity, List conversations) { 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 f6017cf4d..08f8fcd32 100644 --- a/src/main/java/eu/siacs/conversations/ui/adapter/KnownHostsAdapter.java +++ b/src/main/java/eu/siacs/conversations/ui/adapter/KnownHostsAdapter.java @@ -1,10 +1,11 @@ package eu.siacs.conversations.ui.adapter; import android.content.Context; -import android.support.annotation.NonNull; import android.widget.ArrayAdapter; import android.widget.Filter; +import androidx.annotation.NonNull; + import java.util.ArrayList; import java.util.Collection; import java.util.Collections; @@ -15,10 +16,10 @@ import eu.siacs.conversations.Config; public class KnownHostsAdapter extends ArrayAdapter { - private static Pattern E164_PATTERN = Pattern.compile("^\\+[1-9]\\d{1,14}$"); + private static final Pattern E164_PATTERN = Pattern.compile("^\\+[1-9]\\d{1,14}$"); private ArrayList domains; - private Filter domainFilter = new Filter() { + private final Filter domainFilter = new Filter() { @Override protected FilterResults performFiltering(CharSequence constraint) { 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 a0e6ded14..4e7213380 100644 --- a/src/main/java/eu/siacs/conversations/ui/adapter/ListItemAdapter.java +++ b/src/main/java/eu/siacs/conversations/ui/adapter/ListItemAdapter.java @@ -1,7 +1,6 @@ package eu.siacs.conversations.ui.adapter; import android.content.SharedPreferences; -import android.databinding.DataBindingUtil; import android.preference.PreferenceManager; import android.view.LayoutInflater; import android.view.View; @@ -10,6 +9,8 @@ import android.widget.ArrayAdapter; import android.widget.ImageView; import android.widget.TextView; +import androidx.databinding.DataBindingUtil; + import com.wefika.flowlayout.FlowLayout; import java.util.List; @@ -30,7 +31,7 @@ public class ListItemAdapter extends ArrayAdapter { protected XmppActivity activity; private boolean showDynamicTags = false; private OnTagClickedListener mOnTagClickedListener = null; - private View.OnClickListener onTagTvClick = view -> { + private final View.OnClickListener onTagTvClick = view -> { if (view instanceof TextView && mOnTagClickedListener != null) { TextView tv = (TextView) view; final String tag = tv.getText().toString(); 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 03920f2dc..75ab964f4 100644 --- a/src/main/java/eu/siacs/conversations/ui/adapter/MediaAdapter.java +++ b/src/main/java/eu/siacs/conversations/ui/adapter/MediaAdapter.java @@ -2,20 +2,21 @@ package eu.siacs.conversations.ui.adapter; import android.content.Context; import android.content.res.Resources; -import android.databinding.DataBindingUtil; import android.graphics.Bitmap; import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.Drawable; import android.os.AsyncTask; -import android.support.annotation.AttrRes; -import android.support.annotation.DimenRes; -import android.support.annotation.NonNull; -import android.support.v7.widget.RecyclerView; import android.util.Log; import android.view.LayoutInflater; import android.view.ViewGroup; import android.widget.ImageView; +import androidx.annotation.AttrRes; +import androidx.annotation.DimenRes; +import androidx.annotation.NonNull; +import androidx.databinding.DataBindingUtil; +import androidx.recyclerview.widget.RecyclerView; + import java.lang.ref.WeakReference; import java.util.ArrayList; import java.util.Arrays; 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 a2f423a04..73f24fe15 100644 --- a/src/main/java/eu/siacs/conversations/ui/adapter/MediaPreviewAdapter.java +++ b/src/main/java/eu/siacs/conversations/ui/adapter/MediaPreviewAdapter.java @@ -4,19 +4,20 @@ import android.content.ActivityNotFoundException; import android.content.Context; import android.content.Intent; import android.content.res.Resources; -import android.databinding.DataBindingUtil; import android.graphics.Bitmap; import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.Drawable; import android.net.Uri; import android.os.AsyncTask; -import android.support.annotation.NonNull; -import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.Toast; +import androidx.annotation.NonNull; +import androidx.databinding.DataBindingUtil; +import androidx.recyclerview.widget.RecyclerView; + import java.lang.ref.WeakReference; import java.util.ArrayList; import java.util.List; diff --git a/src/main/java/eu/siacs/conversations/ui/adapter/MessageAdapter.java b/src/main/java/eu/siacs/conversations/ui/adapter/MessageAdapter.java index d5e3b9de4..70ebcb8db 100644 --- a/src/main/java/eu/siacs/conversations/ui/adapter/MessageAdapter.java +++ b/src/main/java/eu/siacs/conversations/ui/adapter/MessageAdapter.java @@ -7,20 +7,14 @@ import android.content.SharedPreferences; import android.content.pm.PackageManager; import android.graphics.Typeface; import android.preference.PreferenceManager; -import android.support.v4.app.ActivityCompat; -import android.support.v4.content.ContextCompat; import android.text.Spannable; import android.text.SpannableString; import android.text.SpannableStringBuilder; -import android.text.Spanned; import android.text.format.DateUtils; import android.text.style.ForegroundColorSpan; import android.text.style.RelativeSizeSpan; import android.text.style.StyleSpan; import android.util.DisplayMetrics; -import android.view.ActionMode; -import android.view.Menu; -import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import android.view.WindowManager; @@ -32,6 +26,9 @@ import android.widget.RelativeLayout; import android.widget.TextView; import android.widget.Toast; +import androidx.core.app.ActivityCompat; +import androidx.core.content.ContextCompat; + import com.google.common.base.Strings; import java.net.URL; @@ -87,7 +84,7 @@ public class MessageAdapter extends ArrayAdapter { private final XmppActivity activity; private final AudioPlayer audioPlayer; private List highlightedTerm = null; - private DisplayMetrics metrics; + private final DisplayMetrics metrics; private OnContactPictureClicked mOnContactPictureClickedListener; private OnContactPictureLongClicked mOnContactPictureLongClickedListener; private OnQuoteListener onQuoteListener; diff --git a/src/main/java/eu/siacs/conversations/ui/adapter/PresenceTemplateAdapter.java b/src/main/java/eu/siacs/conversations/ui/adapter/PresenceTemplateAdapter.java index c77784c6e..62526da62 100644 --- a/src/main/java/eu/siacs/conversations/ui/adapter/PresenceTemplateAdapter.java +++ b/src/main/java/eu/siacs/conversations/ui/adapter/PresenceTemplateAdapter.java @@ -30,10 +30,11 @@ package eu.siacs.conversations.ui.adapter; import android.content.Context; -import android.support.annotation.NonNull; import android.widget.ArrayAdapter; import android.widget.Filter; +import androidx.annotation.NonNull; + import java.util.ArrayList; import java.util.List; import java.util.Locale; diff --git a/src/main/java/eu/siacs/conversations/ui/adapter/UserAdapter.java b/src/main/java/eu/siacs/conversations/ui/adapter/UserAdapter.java index 7b61ec822..41bfb24a1 100644 --- a/src/main/java/eu/siacs/conversations/ui/adapter/UserAdapter.java +++ b/src/main/java/eu/siacs/conversations/ui/adapter/UserAdapter.java @@ -2,16 +2,17 @@ package eu.siacs.conversations.ui.adapter; import android.app.PendingIntent; import android.content.IntentSender; -import android.databinding.DataBindingUtil; -import android.support.annotation.NonNull; -import android.support.v7.recyclerview.extensions.ListAdapter; -import android.support.v7.util.DiffUtil; -import android.support.v7.widget.RecyclerView; import android.view.ContextMenu; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; +import androidx.annotation.NonNull; +import androidx.databinding.DataBindingUtil; +import androidx.recyclerview.widget.DiffUtil; +import androidx.recyclerview.widget.ListAdapter; +import androidx.recyclerview.widget.RecyclerView; + import org.openintents.openpgp.util.OpenPgpUtils; import eu.siacs.conversations.R; diff --git a/src/main/java/eu/siacs/conversations/ui/adapter/UserPreviewAdapter.java b/src/main/java/eu/siacs/conversations/ui/adapter/UserPreviewAdapter.java index 12cfd35f1..14920c9c6 100644 --- a/src/main/java/eu/siacs/conversations/ui/adapter/UserPreviewAdapter.java +++ b/src/main/java/eu/siacs/conversations/ui/adapter/UserPreviewAdapter.java @@ -1,14 +1,15 @@ package eu.siacs.conversations.ui.adapter; -import android.databinding.DataBindingUtil; -import android.support.annotation.NonNull; -import android.support.v7.recyclerview.extensions.ListAdapter; -import android.support.v7.widget.RecyclerView; import android.view.ContextMenu; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; +import androidx.annotation.NonNull; +import androidx.databinding.DataBindingUtil; +import androidx.recyclerview.widget.ListAdapter; +import androidx.recyclerview.widget.RecyclerView; + import eu.siacs.conversations.R; import eu.siacs.conversations.databinding.UserPreviewBinding; import eu.siacs.conversations.entities.MucOptions; diff --git a/src/main/java/eu/siacs/conversations/ui/forms/FormBooleanFieldWrapper.java b/src/main/java/eu/siacs/conversations/ui/forms/FormBooleanFieldWrapper.java index 6cb357a90..0c85d88ba 100644 --- a/src/main/java/eu/siacs/conversations/ui/forms/FormBooleanFieldWrapper.java +++ b/src/main/java/eu/siacs/conversations/ui/forms/FormBooleanFieldWrapper.java @@ -16,7 +16,7 @@ public class FormBooleanFieldWrapper extends FormFieldWrapper { protected FormBooleanFieldWrapper(Context context, Field field) { super(context, field); - checkBox = (CheckBox) view.findViewById(R.id.field); + checkBox = view.findViewById(R.id.field); checkBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { @@ -28,7 +28,7 @@ public class FormBooleanFieldWrapper extends FormFieldWrapper { @Override protected void setLabel(String label, boolean required) { - CheckBox checkBox = (CheckBox) view.findViewById(R.id.field); + CheckBox checkBox = view.findViewById(R.id.field); checkBox.setText(createSpannableLabelString(label, required)); } diff --git a/src/main/java/eu/siacs/conversations/ui/forms/FormJidSingleFieldWrapper.java b/src/main/java/eu/siacs/conversations/ui/forms/FormJidSingleFieldWrapper.java index 0cb21ed93..00f0899c1 100644 --- a/src/main/java/eu/siacs/conversations/ui/forms/FormJidSingleFieldWrapper.java +++ b/src/main/java/eu/siacs/conversations/ui/forms/FormJidSingleFieldWrapper.java @@ -6,8 +6,8 @@ import android.text.InputType; import java.util.List; import eu.siacs.conversations.R; -import eu.siacs.conversations.xmpp.forms.Field; import eu.siacs.conversations.xmpp.Jid; +import eu.siacs.conversations.xmpp.forms.Field; public class FormJidSingleFieldWrapper extends FormTextFieldWrapper { @@ -34,7 +34,7 @@ public class FormJidSingleFieldWrapper extends FormTextFieldWrapper { @Override protected void setValues(List values) { - StringBuilder builder = new StringBuilder(""); + StringBuilder builder = new StringBuilder(); for(String value : values) { builder.append(value); } diff --git a/src/main/java/eu/siacs/conversations/ui/forms/FormTextFieldWrapper.java b/src/main/java/eu/siacs/conversations/ui/forms/FormTextFieldWrapper.java index b7dac9510..81fbb2e2e 100644 --- a/src/main/java/eu/siacs/conversations/ui/forms/FormTextFieldWrapper.java +++ b/src/main/java/eu/siacs/conversations/ui/forms/FormTextFieldWrapper.java @@ -19,7 +19,7 @@ public class FormTextFieldWrapper extends FormFieldWrapper { protected FormTextFieldWrapper(Context context, Field field) { super(context, field); - editText = (EditText) view.findViewById(R.id.field); + editText = view.findViewById(R.id.field); editText.setSingleLine(!"text-multi".equals(field.getType())); if ("text-private".equals(field.getType())) { editText.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD); @@ -43,7 +43,7 @@ public class FormTextFieldWrapper extends FormFieldWrapper { @Override protected void setLabel(String label, boolean required) { - TextView textView = (TextView) view.findViewById(R.id.label); + TextView textView = view.findViewById(R.id.label); textView.setText(createSpannableLabelString(label, required)); } @@ -64,7 +64,7 @@ public class FormTextFieldWrapper extends FormFieldWrapper { @Override protected void setValues(List values) { - StringBuilder builder = new StringBuilder(""); + StringBuilder builder = new StringBuilder(); for(int i = 0; i < values.size(); ++i) { builder.append(values.get(i)); if (i < values.size() - 1 && "text-multi".equals(field.getType())) { diff --git a/src/main/java/eu/siacs/conversations/ui/interfaces/OnAvatarPublication.java b/src/main/java/eu/siacs/conversations/ui/interfaces/OnAvatarPublication.java index 5d84c5853..4d120ebaf 100644 --- a/src/main/java/eu/siacs/conversations/ui/interfaces/OnAvatarPublication.java +++ b/src/main/java/eu/siacs/conversations/ui/interfaces/OnAvatarPublication.java @@ -29,7 +29,7 @@ package eu.siacs.conversations.ui.interfaces; -import android.support.annotation.StringRes; +import androidx.annotation.StringRes; public interface OnAvatarPublication { 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 5d3766452..7e073670c 100644 --- a/src/main/java/eu/siacs/conversations/ui/service/AudioPlayer.java +++ b/src/main/java/eu/siacs/conversations/ui/service/AudioPlayer.java @@ -12,8 +12,6 @@ import android.media.AudioManager; import android.os.Build; import android.os.Handler; import android.os.PowerManager; -import android.support.v4.app.ActivityCompat; -import android.support.v4.content.ContextCompat; import android.util.Log; import android.view.View; import android.widget.ImageButton; @@ -21,6 +19,9 @@ import android.widget.RelativeLayout; import android.widget.SeekBar; import android.widget.TextView; +import androidx.core.app.ActivityCompat; +import androidx.core.content.ContextCompat; + import java.lang.ref.WeakReference; import java.util.Locale; import java.util.concurrent.ExecutorService; diff --git a/src/main/java/eu/siacs/conversations/ui/service/CameraManager.java b/src/main/java/eu/siacs/conversations/ui/service/CameraManager.java index 9f1fc99a7..f3af5d3ed 100644 --- a/src/main/java/eu/siacs/conversations/ui/service/CameraManager.java +++ b/src/main/java/eu/siacs/conversations/ui/service/CameraManager.java @@ -17,15 +17,6 @@ package eu.siacs.conversations.ui.service; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.Comparator; -import java.util.List; - -import com.google.zxing.PlanarYUVLuminanceSource; - import android.annotation.SuppressLint; import android.graphics.Rect; import android.graphics.RectF; @@ -35,6 +26,15 @@ import android.hardware.Camera.PreviewCallback; import android.util.Log; import android.view.TextureView; +import com.google.zxing.PlanarYUVLuminanceSource; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.Comparator; +import java.util.List; + import eu.siacs.conversations.Config; /** @@ -48,7 +48,7 @@ public final class CameraManager { private static final int MAX_PREVIEW_PIXELS = 1280 * 720; private Camera camera; - private CameraInfo cameraInfo = new CameraInfo(); + private final CameraInfo cameraInfo = new CameraInfo(); private Camera.Size cameraResolution; private Rect frame; private RectF framePreview; 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 eb45feebe..684fd8094 100644 --- a/src/main/java/eu/siacs/conversations/ui/text/FixedURLSpan.java +++ b/src/main/java/eu/siacs/conversations/ui/text/FixedURLSpan.java @@ -38,16 +38,13 @@ import android.os.Build; import android.text.Editable; import android.text.Spanned; import android.text.style.URLSpan; -import android.util.Log; import android.view.View; import android.widget.Toast; import java.util.Arrays; -import eu.siacs.conversations.Config; import eu.siacs.conversations.R; import eu.siacs.conversations.ui.ConversationsActivity; -import eu.siacs.conversations.utils.XmppUri; @SuppressLint("ParcelCreator") diff --git a/src/main/java/eu/siacs/conversations/ui/text/QuoteSpan.java b/src/main/java/eu/siacs/conversations/ui/text/QuoteSpan.java index 0757ad5de..98360e9b8 100644 --- a/src/main/java/eu/siacs/conversations/ui/text/QuoteSpan.java +++ b/src/main/java/eu/siacs/conversations/ui/text/QuoteSpan.java @@ -2,7 +2,6 @@ package eu.siacs.conversations.ui.text; import android.graphics.Canvas; import android.graphics.Paint; -import android.support.annotation.ColorInt; import android.text.Layout; import android.text.TextPaint; import android.text.style.CharacterStyle; @@ -10,6 +9,8 @@ import android.text.style.LeadingMarginSpan; import android.util.DisplayMetrics; import android.util.TypedValue; +import androidx.annotation.ColorInt; + public class QuoteSpan extends CharacterStyle implements LeadingMarginSpan { private final int color; diff --git a/src/main/java/eu/siacs/conversations/ui/util/AvatarWorkerTask.java b/src/main/java/eu/siacs/conversations/ui/util/AvatarWorkerTask.java index ad7da7189..f5331c7a6 100644 --- a/src/main/java/eu/siacs/conversations/ui/util/AvatarWorkerTask.java +++ b/src/main/java/eu/siacs/conversations/ui/util/AvatarWorkerTask.java @@ -6,9 +6,10 @@ import android.graphics.Bitmap; import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.Drawable; import android.os.AsyncTask; -import android.support.annotation.DimenRes; import android.widget.ImageView; +import androidx.annotation.DimenRes; + import java.lang.ref.WeakReference; import java.util.concurrent.RejectedExecutionException; @@ -20,7 +21,8 @@ import eu.siacs.conversations.ui.XmppActivity; public class AvatarWorkerTask extends AsyncTask { private final WeakReference imageViewReference; private AvatarService.Avatarable avatarable = null; - private @DimenRes int size; + private @DimenRes + final int size; public AvatarWorkerTask(ImageView imageView, @DimenRes int size) { imageViewReference = new WeakReference<>(imageView); diff --git a/src/main/java/eu/siacs/conversations/ui/util/ConversationMenuConfigurator.java b/src/main/java/eu/siacs/conversations/ui/util/ConversationMenuConfigurator.java index 24bbdd7c7..900246591 100644 --- a/src/main/java/eu/siacs/conversations/ui/util/ConversationMenuConfigurator.java +++ b/src/main/java/eu/siacs/conversations/ui/util/ConversationMenuConfigurator.java @@ -30,17 +30,15 @@ package eu.siacs.conversations.ui.util; import android.content.Context; -import android.content.Intent; import android.content.pm.PackageManager; -import android.provider.MediaStore; -import android.support.annotation.NonNull; import android.view.Menu; import android.view.MenuItem; +import androidx.annotation.NonNull; + import eu.siacs.conversations.Config; import eu.siacs.conversations.R; import eu.siacs.conversations.crypto.OmemoSetting; -import eu.siacs.conversations.crypto.axolotl.AxolotlService; import eu.siacs.conversations.entities.Conversation; import eu.siacs.conversations.entities.Conversational; import eu.siacs.conversations.entities.Message; diff --git a/src/main/java/eu/siacs/conversations/ui/util/DelayedHintHelper.java b/src/main/java/eu/siacs/conversations/ui/util/DelayedHintHelper.java index 805b8f217..2df162099 100644 --- a/src/main/java/eu/siacs/conversations/ui/util/DelayedHintHelper.java +++ b/src/main/java/eu/siacs/conversations/ui/util/DelayedHintHelper.java @@ -30,9 +30,10 @@ package eu.siacs.conversations.ui.util; import android.os.Handler; -import android.support.annotation.StringRes; import android.widget.EditText; +import androidx.annotation.StringRes; + public class DelayedHintHelper { public static void setHint(@StringRes final int res, EditText editText) { diff --git a/src/main/java/eu/siacs/conversations/ui/util/GridManager.java b/src/main/java/eu/siacs/conversations/ui/util/GridManager.java index c84dbd63b..c11e423c5 100644 --- a/src/main/java/eu/siacs/conversations/ui/util/GridManager.java +++ b/src/main/java/eu/siacs/conversations/ui/util/GridManager.java @@ -1,12 +1,13 @@ package eu.siacs.conversations.ui.util; import android.content.Context; -import android.support.annotation.DimenRes; -import android.support.v7.widget.GridLayoutManager; -import android.support.v7.widget.RecyclerView; import android.util.Log; import android.view.ViewTreeObserver; +import androidx.annotation.DimenRes; +import androidx.recyclerview.widget.GridLayoutManager; +import androidx.recyclerview.widget.RecyclerView; + import eu.siacs.conversations.Config; import eu.siacs.conversations.ui.adapter.MediaAdapter; diff --git a/src/main/java/eu/siacs/conversations/ui/util/JidDialog.java b/src/main/java/eu/siacs/conversations/ui/util/JidDialog.java index ae5401717..7ac8a6f9c 100644 --- a/src/main/java/eu/siacs/conversations/ui/util/JidDialog.java +++ b/src/main/java/eu/siacs/conversations/ui/util/JidDialog.java @@ -1,16 +1,17 @@ package eu.siacs.conversations.ui.util; import android.content.Context; -import android.support.annotation.StringRes; import android.text.SpannableString; import android.text.Spanned; import android.text.style.TypefaceSpan; +import androidx.annotation.StringRes; + public class JidDialog { public static SpannableString style(Context context, @StringRes int res, String... args) { - SpannableString spannable = new SpannableString(context.getString(res, (Object[]) args)); + final SpannableString spannable = new SpannableString(context.getString(res, (Object[]) args)); if (args.length >= 1) { final String value = args[0]; int start = spannable.toString().indexOf(value); diff --git a/src/main/java/eu/siacs/conversations/ui/util/LocationHelper.java b/src/main/java/eu/siacs/conversations/ui/util/LocationHelper.java index 27a6c0837..7922ac369 100644 --- a/src/main/java/eu/siacs/conversations/ui/util/LocationHelper.java +++ b/src/main/java/eu/siacs/conversations/ui/util/LocationHelper.java @@ -64,9 +64,6 @@ public final class LocationHelper { return true; } else if (isNewer && !isLessAccurate) { return true; - } else if (isNewer && !isSignificantlyLessAccurate && isFromSameProvider) { - return true; - } - return false; - } + } else return isNewer && !isSignificantlyLessAccurate && isFromSameProvider; + } } \ No newline at end of file diff --git a/src/main/java/eu/siacs/conversations/ui/util/MucConfiguration.java b/src/main/java/eu/siacs/conversations/ui/util/MucConfiguration.java index 3f40f714f..3772a851e 100644 --- a/src/main/java/eu/siacs/conversations/ui/util/MucConfiguration.java +++ b/src/main/java/eu/siacs/conversations/ui/util/MucConfiguration.java @@ -2,7 +2,8 @@ package eu.siacs.conversations.ui.util; import android.content.Context; import android.os.Bundle; -import android.support.annotation.StringRes; + +import androidx.annotation.StringRes; import eu.siacs.conversations.R; import eu.siacs.conversations.entities.MucOptions; 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 0e848e392..da1ac7a44 100644 --- a/src/main/java/eu/siacs/conversations/ui/util/MucDetailsContextMenuHelper.java +++ b/src/main/java/eu/siacs/conversations/ui/util/MucDetailsContextMenuHelper.java @@ -2,7 +2,6 @@ package eu.siacs.conversations.ui.util; import android.app.Activity; import android.preference.PreferenceManager; -import android.support.v7.app.AlertDialog; import android.text.SpannableString; import android.text.Spanned; import android.text.style.TypefaceSpan; @@ -11,6 +10,8 @@ import android.view.Menu; import android.view.MenuItem; import android.view.View; +import androidx.appcompat.app.AlertDialog; + import eu.siacs.conversations.Config; import eu.siacs.conversations.R; import eu.siacs.conversations.entities.Account; diff --git a/src/main/java/eu/siacs/conversations/ui/util/MyLinkify.java b/src/main/java/eu/siacs/conversations/ui/util/MyLinkify.java index aa2aeb704..b72c5aa86 100644 --- a/src/main/java/eu/siacs/conversations/ui/util/MyLinkify.java +++ b/src/main/java/eu/siacs/conversations/ui/util/MyLinkify.java @@ -81,9 +81,7 @@ public class MyLinkify { if (end < cs.length()) { // Reject strings that were probably matched only because they contain a dot followed by // by some known TLD (see also comment for WORD_BOUNDARY in Patterns.java) - if (isAlphabetic(cs.charAt(end-1)) && isAlphabetic(cs.charAt(end))) { - return false; - } + return !isAlphabetic(cs.charAt(end - 1)) || !isAlphabetic(cs.charAt(end)); } return true; 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 2f29e5b76..6edcf3349 100644 --- a/src/main/java/eu/siacs/conversations/ui/util/PresenceSelector.java +++ b/src/main/java/eu/siacs/conversations/ui/util/PresenceSelector.java @@ -31,9 +31,10 @@ package eu.siacs.conversations.ui.util; import android.app.Activity; import android.content.Context; -import android.support.v7.app.AlertDialog; import android.util.Pair; +import androidx.appcompat.app.AlertDialog; + import java.util.Collections; import java.util.Map; import java.util.concurrent.atomic.AtomicInteger; diff --git a/src/main/java/eu/siacs/conversations/ui/util/SoftKeyboardUtils.java b/src/main/java/eu/siacs/conversations/ui/util/SoftKeyboardUtils.java index bcc25b01e..0b2eaf801 100644 --- a/src/main/java/eu/siacs/conversations/ui/util/SoftKeyboardUtils.java +++ b/src/main/java/eu/siacs/conversations/ui/util/SoftKeyboardUtils.java @@ -31,11 +31,12 @@ package eu.siacs.conversations.ui.util; import android.app.Activity; import android.content.Context; -import android.support.annotation.NonNull; import android.view.View; import android.view.inputmethod.InputMethodManager; import android.widget.EditText; +import androidx.annotation.NonNull; + public class SoftKeyboardUtils { diff --git a/src/main/java/eu/siacs/conversations/ui/util/StyledAttributes.java b/src/main/java/eu/siacs/conversations/ui/util/StyledAttributes.java index 2b0b3f6e3..709aa0386 100644 --- a/src/main/java/eu/siacs/conversations/ui/util/StyledAttributes.java +++ b/src/main/java/eu/siacs/conversations/ui/util/StyledAttributes.java @@ -31,8 +31,9 @@ package eu.siacs.conversations.ui.util; import android.content.Context; import android.content.res.TypedArray; -import android.support.annotation.AttrRes; -import android.support.annotation.ColorInt; + +import androidx.annotation.AttrRes; +import androidx.annotation.ColorInt; public class StyledAttributes { public static android.graphics.drawable.Drawable getDrawable(Context context, @AttrRes int id) { diff --git a/src/main/java/eu/siacs/conversations/ui/widget/EditMessage.java b/src/main/java/eu/siacs/conversations/ui/widget/EditMessage.java index 1a1327ec4..eadd562a7 100644 --- a/src/main/java/eu/siacs/conversations/ui/widget/EditMessage.java +++ b/src/main/java/eu/siacs/conversations/ui/widget/EditMessage.java @@ -1,15 +1,11 @@ package eu.siacs.conversations.ui.widget; -import android.content.SharedPreferences; -import android.preference.PreferenceManager; -import android.support.v13.view.inputmethod.EditorInfoCompat; -import android.support.v13.view.inputmethod.InputConnectionCompat; -import android.support.v13.view.inputmethod.InputContentInfoCompat; - import android.content.Context; +import android.content.SharedPreferences; import android.os.Build; import android.os.Bundle; import android.os.Handler; +import android.preference.PreferenceManager; import android.text.Editable; import android.text.InputFilter; import android.text.InputType; @@ -19,6 +15,10 @@ import android.view.KeyEvent; import android.view.inputmethod.EditorInfo; import android.view.inputmethod.InputConnection; +import androidx.core.view.inputmethod.EditorInfoCompat; +import androidx.core.view.inputmethod.InputConnectionCompat; +import androidx.core.view.inputmethod.InputContentInfoCompat; + import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; diff --git a/src/main/java/eu/siacs/conversations/ui/widget/ImmediateAutoCompleteTextView.java b/src/main/java/eu/siacs/conversations/ui/widget/ImmediateAutoCompleteTextView.java index 4e40ff404..71e56d7fa 100644 --- a/src/main/java/eu/siacs/conversations/ui/widget/ImmediateAutoCompleteTextView.java +++ b/src/main/java/eu/siacs/conversations/ui/widget/ImmediateAutoCompleteTextView.java @@ -32,7 +32,7 @@ package eu.siacs.conversations.ui.widget; import android.content.Context; import android.util.AttributeSet; -public class ImmediateAutoCompleteTextView extends android.support.v7.widget.AppCompatAutoCompleteTextView { +public class ImmediateAutoCompleteTextView extends androidx.appcompat.widget.AppCompatAutoCompleteTextView { public ImmediateAutoCompleteTextView(Context context, AttributeSet attrs) { super(context, attrs); diff --git a/src/main/java/eu/siacs/conversations/ui/widget/MyLocation.java b/src/main/java/eu/siacs/conversations/ui/widget/MyLocation.java index a48e78f92..f49f3dd79 100644 --- a/src/main/java/eu/siacs/conversations/ui/widget/MyLocation.java +++ b/src/main/java/eu/siacs/conversations/ui/widget/MyLocation.java @@ -1,14 +1,13 @@ package eu.siacs.conversations.ui.widget; -import android.annotation.TargetApi; import android.content.Context; import android.graphics.Bitmap; import android.graphics.Canvas; import android.graphics.Paint; import android.graphics.Point; import android.location.Location; -import android.os.Build; -import android.support.v4.content.ContextCompat; + +import androidx.core.content.ContextCompat; import org.osmdroid.util.GeoPoint; import org.osmdroid.util.TileSystem; diff --git a/src/main/java/eu/siacs/conversations/ui/widget/ScannerView.java b/src/main/java/eu/siacs/conversations/ui/widget/ScannerView.java index 4eb25418d..3d7d37170 100644 --- a/src/main/java/eu/siacs/conversations/ui/widget/ScannerView.java +++ b/src/main/java/eu/siacs/conversations/ui/widget/ScannerView.java @@ -17,12 +17,6 @@ package eu.siacs.conversations.ui.widget; -import java.util.HashMap; -import java.util.Iterator; -import java.util.Map; - -import com.google.zxing.ResultPoint; - import android.content.Context; import android.content.res.Resources; import android.graphics.Canvas; @@ -35,6 +29,12 @@ import android.graphics.RectF; import android.util.AttributeSet; import android.view.View; +import com.google.zxing.ResultPoint; + +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; + import eu.siacs.conversations.R; /** diff --git a/src/main/java/eu/siacs/conversations/ui/widget/SwipeRefreshListFragment.java b/src/main/java/eu/siacs/conversations/ui/widget/SwipeRefreshListFragment.java index 5f04647c9..b1ef6165a 100644 --- a/src/main/java/eu/siacs/conversations/ui/widget/SwipeRefreshListFragment.java +++ b/src/main/java/eu/siacs/conversations/ui/widget/SwipeRefreshListFragment.java @@ -18,21 +18,21 @@ package eu.siacs.conversations.ui.widget; import android.content.Context; import android.os.Bundle; -import android.support.v4.app.ListFragment; -import android.support.v4.view.ViewCompat; -import android.support.v4.widget.SwipeRefreshLayout; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ListView; +import androidx.fragment.app.ListFragment; +import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; + import eu.siacs.conversations.R; import eu.siacs.conversations.ui.util.StyledAttributes; /** - * Subclass of {@link android.support.v4.app.ListFragment} which provides automatic support for + * Subclass of {@link androidx.fragment.app.ListFragment} which provides automatic support for * providing the 'swipe-to-refresh' UX gesture by wrapping the the content view in a - * {@link android.support.v4.widget.SwipeRefreshLayout}. + * {@link androidx.swiperefreshlayout.widget.SwipeRefreshLayout}. */ public class SwipeRefreshListFragment extends ListFragment { @@ -80,10 +80,10 @@ public class SwipeRefreshListFragment extends ListFragment { } /** - * Set the {@link android.support.v4.widget.SwipeRefreshLayout.OnRefreshListener} to listen for + * Set the {@link androidx.core.widget.SwipeRefreshLayout.OnRefreshListener} to listen for * initiated refreshes. * - * @see android.support.v4.widget.SwipeRefreshLayout#setOnRefreshListener(android.support.v4.widget.SwipeRefreshLayout.OnRefreshListener) + * @see androidx.core.widget.SwipeRefreshLayout#setOnRefreshListener(androidx.core.widget.SwipeRefreshLayout.OnRefreshListener) */ public void setOnRefreshListener(SwipeRefreshLayout.OnRefreshListener listener) { onRefreshListener = listener; @@ -95,10 +95,10 @@ public class SwipeRefreshListFragment extends ListFragment { } /** - * Set whether the {@link android.support.v4.widget.SwipeRefreshLayout} should be displaying + * Set whether the {@link androidx.core.widget.SwipeRefreshLayout} should be displaying * that it is refreshing or not. * - * @see android.support.v4.widget.SwipeRefreshLayout#setRefreshing(boolean) + * @see androidx.core.widget.SwipeRefreshLayout#setRefreshing(boolean) */ public void setRefreshing(boolean refreshing) { this.refreshing = refreshing; @@ -109,12 +109,12 @@ public class SwipeRefreshListFragment extends ListFragment { /** - * Sub-class of {@link android.support.v4.widget.SwipeRefreshLayout} for use in this - * {@link android.support.v4.app.ListFragment}. The reason that this is needed is because - * {@link android.support.v4.widget.SwipeRefreshLayout} only supports a single child, which it + * Sub-class of {@link androidx.core.widget.SwipeRefreshLayout} for use in this + * {@link androidx.core.app.ListFragment}. The reason that this is needed is because + * {@link androidx.core.widget.SwipeRefreshLayout} only supports a single child, which it * expects to be the one which triggers refreshes. In our case the layout's child is the content * view returned from - * {@link android.support.v4.app.ListFragment#onCreateView(android.view.LayoutInflater, android.view.ViewGroup, android.os.Bundle)} + * {@link androidx.core.app.ListFragment#onCreateView(android.view.LayoutInflater, android.view.ViewGroup, android.os.Bundle)} * which is a {@link android.view.ViewGroup}. * *

To enable 'swipe-to-refresh' support via the {@link android.widget.ListView} we need to diff --git a/src/main/java/eu/siacs/conversations/ui/widget/TextInputEditText.java b/src/main/java/eu/siacs/conversations/ui/widget/TextInputEditText.java index 747e59916..c6b9968b3 100644 --- a/src/main/java/eu/siacs/conversations/ui/widget/TextInputEditText.java +++ b/src/main/java/eu/siacs/conversations/ui/widget/TextInputEditText.java @@ -12,7 +12,7 @@ import java.lang.reflect.Field; * A wrapper class to fix some weird fuck ups on Meizu devices * credit goes to the people in this thread https://github.com/android-in-china/Compatibility/issues/11 */ -public class TextInputEditText extends android.support.design.widget.TextInputEditText { +public class TextInputEditText extends com.google.android.material.textfield.TextInputEditText { public TextInputEditText(Context context) { super(context); diff --git a/src/main/java/eu/siacs/conversations/ui/widget/UnreadCountCustomView.java b/src/main/java/eu/siacs/conversations/ui/widget/UnreadCountCustomView.java index b61fee1e2..1f622a253 100644 --- a/src/main/java/eu/siacs/conversations/ui/widget/UnreadCountCustomView.java +++ b/src/main/java/eu/siacs/conversations/ui/widget/UnreadCountCustomView.java @@ -6,10 +6,11 @@ import android.graphics.Canvas; import android.graphics.Color; import android.graphics.Paint; import android.graphics.Typeface; -import android.support.v4.content.ContextCompat; import android.util.AttributeSet; import android.view.View; +import androidx.core.content.ContextCompat; + import eu.siacs.conversations.R; public class UnreadCountCustomView extends View { diff --git a/src/main/java/eu/siacs/conversations/utils/Android360pFormatStrategy.java b/src/main/java/eu/siacs/conversations/utils/Android360pFormatStrategy.java index 761eff2a3..a692cc6dc 100644 --- a/src/main/java/eu/siacs/conversations/utils/Android360pFormatStrategy.java +++ b/src/main/java/eu/siacs/conversations/utils/Android360pFormatStrategy.java @@ -3,9 +3,10 @@ package eu.siacs.conversations.utils; import android.media.MediaCodecInfo; import android.media.MediaFormat; import android.os.Build; -import android.support.annotation.RequiresApi; import android.util.Log; +import androidx.annotation.RequiresApi; + import net.ypresto.androidtranscoder.format.MediaFormatExtraConstants; import net.ypresto.androidtranscoder.format.MediaFormatStrategy; import net.ypresto.androidtranscoder.format.OutputFormatUnavailableException; diff --git a/src/main/java/eu/siacs/conversations/utils/Android720pFormatStrategy.java b/src/main/java/eu/siacs/conversations/utils/Android720pFormatStrategy.java index 981866951..274ebb76f 100644 --- a/src/main/java/eu/siacs/conversations/utils/Android720pFormatStrategy.java +++ b/src/main/java/eu/siacs/conversations/utils/Android720pFormatStrategy.java @@ -3,9 +3,10 @@ package eu.siacs.conversations.utils; import android.media.MediaCodecInfo; import android.media.MediaFormat; import android.os.Build; -import android.support.annotation.RequiresApi; import android.util.Log; +import androidx.annotation.RequiresApi; + import net.ypresto.androidtranscoder.format.MediaFormatExtraConstants; import net.ypresto.androidtranscoder.format.MediaFormatStrategy; import net.ypresto.androidtranscoder.format.OutputFormatUnavailableException; diff --git a/src/main/java/eu/siacs/conversations/utils/AndroidUsingExecLowPriority.java b/src/main/java/eu/siacs/conversations/utils/AndroidUsingExecLowPriority.java index d06c3afeb..d8c46b08f 100644 --- a/src/main/java/eu/siacs/conversations/utils/AndroidUsingExecLowPriority.java +++ b/src/main/java/eu/siacs/conversations/utils/AndroidUsingExecLowPriority.java @@ -11,11 +11,6 @@ package eu.siacs.conversations.utils; -import de.measite.minidns.dnsserverlookup.AbstractDNSServerLookupMechanism; -import de.measite.minidns.dnsserverlookup.AndroidUsingReflection; -import de.measite.minidns.dnsserverlookup.DNSServerLookupMechanism; -import de.measite.minidns.util.PlatformDetection; - import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; @@ -24,6 +19,11 @@ import java.net.InetAddress; import java.util.HashSet; import java.util.logging.Level; +import de.measite.minidns.dnsserverlookup.AbstractDNSServerLookupMechanism; +import de.measite.minidns.dnsserverlookup.AndroidUsingReflection; +import de.measite.minidns.dnsserverlookup.DNSServerLookupMechanism; +import de.measite.minidns.util.PlatformDetection; + /** * Try to retrieve the list of DNS server by executing getprop. */ diff --git a/src/main/java/eu/siacs/conversations/utils/BackupFileHeader.java b/src/main/java/eu/siacs/conversations/utils/BackupFileHeader.java index 212473ea4..54387a8ee 100644 --- a/src/main/java/eu/siacs/conversations/utils/BackupFileHeader.java +++ b/src/main/java/eu/siacs/conversations/utils/BackupFileHeader.java @@ -10,11 +10,11 @@ public class BackupFileHeader { private static final int VERSION = 1; - private String app; - private Jid jid; - private long timestamp; - private byte[] iv; - private byte[] salt; + private final String app; + private final Jid jid; + private final long timestamp; + private final byte[] iv; + private final byte[] salt; @Override diff --git a/src/main/java/eu/siacs/conversations/utils/Compatibility.java b/src/main/java/eu/siacs/conversations/utils/Compatibility.java index b03ad5454..1ea0d70ea 100644 --- a/src/main/java/eu/siacs/conversations/utils/Compatibility.java +++ b/src/main/java/eu/siacs/conversations/utils/Compatibility.java @@ -10,12 +10,12 @@ import android.os.Build; import android.preference.Preference; import android.preference.PreferenceCategory; import android.preference.PreferenceManager; -import android.support.annotation.BoolRes; -import android.support.v4.content.ContextCompat; import android.util.Log; +import androidx.annotation.BoolRes; +import androidx.core.content.ContextCompat; + import java.util.Arrays; -import java.util.Collections; import java.util.List; import eu.siacs.conversations.Config; diff --git a/src/main/java/eu/siacs/conversations/utils/ConversationsFileObserver.java b/src/main/java/eu/siacs/conversations/utils/ConversationsFileObserver.java index 8bf36ea1f..4ee842223 100644 --- a/src/main/java/eu/siacs/conversations/utils/ConversationsFileObserver.java +++ b/src/main/java/eu/siacs/conversations/utils/ConversationsFileObserver.java @@ -6,7 +6,6 @@ import android.util.Log; import java.io.File; import java.util.ArrayList; -import java.util.Collections; import java.util.List; import java.util.Stack; import java.util.concurrent.Executor; diff --git a/src/main/java/eu/siacs/conversations/utils/CryptoHelper.java b/src/main/java/eu/siacs/conversations/utils/CryptoHelper.java index 0a2231389..3174c4198 100644 --- a/src/main/java/eu/siacs/conversations/utils/CryptoHelper.java +++ b/src/main/java/eu/siacs/conversations/utils/CryptoHelper.java @@ -11,6 +11,7 @@ import org.bouncycastle.cert.jcajce.JcaX509CertificateHolder; import java.net.MalformedURLException; import java.net.URL; +import java.nio.charset.StandardCharsets; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import java.security.SecureRandom; @@ -256,7 +257,7 @@ public final class CryptoHelper { public static String getFingerprint(String value) { try { MessageDigest md = MessageDigest.getInstance("SHA-1"); - return bytesToHex(md.digest(value.getBytes("UTF-8"))); + return bytesToHex(md.digest(value.getBytes(StandardCharsets.UTF_8))); } catch (Exception e) { return ""; } diff --git a/src/main/java/eu/siacs/conversations/utils/EasyOnboardingInvite.java b/src/main/java/eu/siacs/conversations/utils/EasyOnboardingInvite.java index e4ed8e1b5..37bce5e22 100644 --- a/src/main/java/eu/siacs/conversations/utils/EasyOnboardingInvite.java +++ b/src/main/java/eu/siacs/conversations/utils/EasyOnboardingInvite.java @@ -16,9 +16,9 @@ import eu.siacs.conversations.xmpp.XmppConnection; public class EasyOnboardingInvite implements Parcelable { - private String domain; - private String uri; - private String landingUrl; + private final String domain; + private final String uri; + private final String landingUrl; protected EasyOnboardingInvite(Parcel in) { domain = in.readString(); diff --git a/src/main/java/eu/siacs/conversations/utils/Emoticons.java b/src/main/java/eu/siacs/conversations/utils/Emoticons.java index 26dc205b4..266d9d081 100644 --- a/src/main/java/eu/siacs/conversations/utils/Emoticons.java +++ b/src/main/java/eu/siacs/conversations/utils/Emoticons.java @@ -29,9 +29,10 @@ package eu.siacs.conversations.utils; -import android.support.annotation.NonNull; import android.util.LruCache; +import androidx.annotation.NonNull; + import java.util.ArrayList; import java.util.Arrays; import java.util.HashSet; diff --git a/src/main/java/eu/siacs/conversations/utils/ExceptionHandler.java b/src/main/java/eu/siacs/conversations/utils/ExceptionHandler.java index 68672156b..8a77e04bb 100644 --- a/src/main/java/eu/siacs/conversations/utils/ExceptionHandler.java +++ b/src/main/java/eu/siacs/conversations/utils/ExceptionHandler.java @@ -1,7 +1,8 @@ package eu.siacs.conversations.utils; import android.content.Context; -import android.support.annotation.NonNull; + +import androidx.annotation.NonNull; import java.io.PrintWriter; import java.io.StringWriter; diff --git a/src/main/java/eu/siacs/conversations/utils/ExceptionHelper.java b/src/main/java/eu/siacs/conversations/utils/ExceptionHelper.java index ca515e8fa..ea272302b 100644 --- a/src/main/java/eu/siacs/conversations/utils/ExceptionHelper.java +++ b/src/main/java/eu/siacs/conversations/utils/ExceptionHelper.java @@ -6,9 +6,10 @@ import android.content.pm.PackageInfo; import android.content.pm.PackageManager; import android.content.pm.Signature; import android.preference.PreferenceManager; -import android.support.v7.app.AlertDialog; import android.util.Log; +import androidx.appcompat.app.AlertDialog; + import java.io.BufferedReader; import java.io.FileInputStream; import java.io.IOException; diff --git a/src/main/java/eu/siacs/conversations/utils/FtsUtils.java b/src/main/java/eu/siacs/conversations/utils/FtsUtils.java index 88959c6b2..6984d20ec 100644 --- a/src/main/java/eu/siacs/conversations/utils/FtsUtils.java +++ b/src/main/java/eu/siacs/conversations/utils/FtsUtils.java @@ -37,7 +37,7 @@ import java.util.Locale; public class FtsUtils { - private static List KEYWORDS = Arrays.asList("OR", "AND"); + private static final List KEYWORDS = Arrays.asList("OR", "AND"); public static List parse(String input) { List term = new ArrayList<>(); diff --git a/src/main/java/eu/siacs/conversations/utils/GeoHelper.java b/src/main/java/eu/siacs/conversations/utils/GeoHelper.java index 9847236ef..459968f37 100644 --- a/src/main/java/eu/siacs/conversations/utils/GeoHelper.java +++ b/src/main/java/eu/siacs/conversations/utils/GeoHelper.java @@ -107,7 +107,7 @@ public class GeoHelper { intents.add(geoIntent(geoPoint, label)); Intent httpIntent = new Intent(Intent.ACTION_VIEW); - httpIntent.setData(Uri.parse("https://maps.google.com/maps?q=loc:"+String.valueOf(geoPoint.getLatitude()) + "," + String.valueOf(geoPoint.getLongitude()) +label)); + httpIntent.setData(Uri.parse("https://maps.google.com/maps?q=loc:"+ geoPoint.getLatitude() + "," + geoPoint.getLongitude() +label)); intents.add(httpIntent); return intents; } @@ -120,7 +120,7 @@ public class GeoHelper { private static Intent geoIntent(GeoPoint geoPoint, String label) { Intent geoIntent = new Intent(Intent.ACTION_VIEW); - geoIntent.setData(Uri.parse("geo:" + String.valueOf(geoPoint.getLatitude()) + "," + String.valueOf(geoPoint.getLongitude()) + "?q=" + String.valueOf(geoPoint.getLatitude()) + "," + String.valueOf(geoPoint.getLongitude()) + "("+ label+")")); + geoIntent.setData(Uri.parse("geo:" + geoPoint.getLatitude() + "," + geoPoint.getLongitude() + "?q=" + geoPoint.getLatitude() + "," + geoPoint.getLongitude() + "("+ label+")")); return geoIntent; } diff --git a/src/main/java/eu/siacs/conversations/utils/ImStyleParser.java b/src/main/java/eu/siacs/conversations/utils/ImStyleParser.java index 873ab9f43..d21bfadf1 100644 --- a/src/main/java/eu/siacs/conversations/utils/ImStyleParser.java +++ b/src/main/java/eu/siacs/conversations/utils/ImStyleParser.java @@ -53,7 +53,7 @@ public class ImStyleParser { if (BLOCK_KEYWORDS.contains(c) && isCharRepeatedTwoTimes(text, c, i + 1, end)) { int to = seekEndBlock(text, c, i + 3, end); if (to != -1 && (to != i + 5 || ALLOW_EMPTY)) { - String keyword = String.valueOf(c) + String.valueOf(c) + String.valueOf(c); + String keyword = String.valueOf(c) + c + c; styles.add(new Style(keyword, i, to)); i = to; continue; diff --git a/src/main/java/eu/siacs/conversations/utils/IrregularUnicodeDetector.java b/src/main/java/eu/siacs/conversations/utils/IrregularUnicodeDetector.java index 832e0dc56..d3aade355 100644 --- a/src/main/java/eu/siacs/conversations/utils/IrregularUnicodeDetector.java +++ b/src/main/java/eu/siacs/conversations/utils/IrregularUnicodeDetector.java @@ -32,13 +32,14 @@ package eu.siacs.conversations.utils; import android.annotation.TargetApi; import android.content.Context; import android.os.Build; -import android.support.annotation.ColorInt; import android.text.Spannable; import android.text.SpannableString; import android.text.SpannableStringBuilder; import android.text.style.ForegroundColorSpan; import android.util.LruCache; +import androidx.annotation.ColorInt; + import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; @@ -229,8 +230,7 @@ public class IrregularUnicodeDetector { if (pattern != null) { return pattern; } - ; - pattern = PatternTuple.of(jid); + pattern = PatternTuple.of(jid); CACHE.put(jid, pattern); return pattern; } diff --git a/src/main/java/eu/siacs/conversations/utils/JidHelper.java b/src/main/java/eu/siacs/conversations/utils/JidHelper.java index c53af65ed..e7443c8bb 100644 --- a/src/main/java/eu/siacs/conversations/utils/JidHelper.java +++ b/src/main/java/eu/siacs/conversations/utils/JidHelper.java @@ -40,7 +40,7 @@ import eu.siacs.conversations.xmpp.Jid; public class JidHelper { - private static List LOCAL_PART_BLACKLIST = Arrays.asList("xmpp", "jabber", "me"); + private static final List LOCAL_PART_BLACKLIST = Arrays.asList("xmpp", "jabber", "me"); public static String localPartOrFallback(Jid jid) { if (LOCAL_PART_BLACKLIST.contains(jid.getLocal().toLowerCase(Locale.ENGLISH))) { diff --git a/src/main/java/eu/siacs/conversations/utils/MessageUtils.java b/src/main/java/eu/siacs/conversations/utils/MessageUtils.java index e8ae07e68..d8b991894 100644 --- a/src/main/java/eu/siacs/conversations/utils/MessageUtils.java +++ b/src/main/java/eu/siacs/conversations/utils/MessageUtils.java @@ -62,8 +62,8 @@ public class MessageUtils { } body = nick + " " + message.getBody().substring(Message.ME_COMMAND.length()); } else { - body = message.getMergedBody().toString();; - } + body = message.getMergedBody().toString(); + } for (String line : body.split("\n")) { if (line.length() <= 0) { continue; diff --git a/src/main/java/eu/siacs/conversations/utils/OnPhoneContactsLoadedListener.java b/src/main/java/eu/siacs/conversations/utils/OnPhoneContactsLoadedListener.java index f18a4ed8e..9ae928812 100644 --- a/src/main/java/eu/siacs/conversations/utils/OnPhoneContactsLoadedListener.java +++ b/src/main/java/eu/siacs/conversations/utils/OnPhoneContactsLoadedListener.java @@ -5,5 +5,5 @@ import android.os.Bundle; import java.util.List; public interface OnPhoneContactsLoadedListener { - public void onPhoneContactsLoaded(List phoneContacts); + void onPhoneContactsLoaded(List phoneContacts); } diff --git a/src/main/java/eu/siacs/conversations/utils/PermissionUtils.java b/src/main/java/eu/siacs/conversations/utils/PermissionUtils.java index 852dedc00..80b58d8cb 100644 --- a/src/main/java/eu/siacs/conversations/utils/PermissionUtils.java +++ b/src/main/java/eu/siacs/conversations/utils/PermissionUtils.java @@ -4,7 +4,8 @@ import android.Manifest; import android.app.Activity; import android.content.pm.PackageManager; import android.os.Build; -import android.support.v4.app.ActivityCompat; + +import androidx.core.app.ActivityCompat; import com.google.common.collect.ImmutableList; diff --git a/src/main/java/eu/siacs/conversations/utils/PhoneHelper.java b/src/main/java/eu/siacs/conversations/utils/PhoneHelper.java index e849730b7..0238dc975 100644 --- a/src/main/java/eu/siacs/conversations/utils/PhoneHelper.java +++ b/src/main/java/eu/siacs/conversations/utils/PhoneHelper.java @@ -3,20 +3,13 @@ package eu.siacs.conversations.utils; import android.Manifest; import android.annotation.SuppressLint; import android.content.Context; -import android.content.CursorLoader; import android.content.pm.PackageManager; import android.database.Cursor; import android.net.Uri; import android.os.Build; -import android.os.Bundle; -import android.provider.ContactsContract; import android.provider.ContactsContract.Profile; import android.provider.Settings; -import java.util.ArrayList; -import java.util.List; -import java.util.concurrent.RejectedExecutionException; - public class PhoneHelper { @SuppressLint("HardwareIds") diff --git a/src/main/java/eu/siacs/conversations/utils/QuickLoader.java b/src/main/java/eu/siacs/conversations/utils/QuickLoader.java index 34e9e0e97..07d46281d 100644 --- a/src/main/java/eu/siacs/conversations/utils/QuickLoader.java +++ b/src/main/java/eu/siacs/conversations/utils/QuickLoader.java @@ -37,7 +37,7 @@ import eu.siacs.conversations.entities.Conversation; public class QuickLoader { private static String CONVERSATION_UUID = null; - private static Object LOCK = new Object(); + private static final Object LOCK = new Object(); public static void set(final String uuid) { synchronized (LOCK) { diff --git a/src/main/java/eu/siacs/conversations/utils/Resolver.java b/src/main/java/eu/siacs/conversations/utils/Resolver.java index 258fbdac9..22c898f15 100644 --- a/src/main/java/eu/siacs/conversations/utils/Resolver.java +++ b/src/main/java/eu/siacs/conversations/utils/Resolver.java @@ -2,9 +2,10 @@ package eu.siacs.conversations.utils; import android.content.ContentValues; import android.database.Cursor; -import android.support.annotation.NonNull; import android.util.Log; +import androidx.annotation.NonNull; + import java.io.IOException; import java.lang.reflect.Field; import java.net.InetAddress; diff --git a/src/main/java/eu/siacs/conversations/utils/SSLSocketHelper.java b/src/main/java/eu/siacs/conversations/utils/SSLSocketHelper.java index 13b33570b..53d4f4169 100644 --- a/src/main/java/eu/siacs/conversations/utils/SSLSocketHelper.java +++ b/src/main/java/eu/siacs/conversations/utils/SSLSocketHelper.java @@ -1,12 +1,14 @@ package eu.siacs.conversations.utils; import android.os.Build; -import android.support.annotation.RequiresApi; import android.util.Log; +import androidx.annotation.RequiresApi; + import org.conscrypt.Conscrypt; import java.lang.reflect.Method; +import java.nio.charset.StandardCharsets; import java.security.NoSuchAlgorithmException; import java.util.Arrays; import java.util.Collection; @@ -70,7 +72,7 @@ public class SSLSocketHelper { final Method method = socket.getClass().getMethod("setAlpnProtocols", byte[].class); // the concatenation of 8-bit, length prefixed protocol names, just one in our case... // http://tools.ietf.org/html/draft-agl-tls-nextprotoneg-04#page-4 - final byte[] protocolUTF8Bytes = protocol.getBytes("UTF-8"); + final byte[] protocolUTF8Bytes = protocol.getBytes(StandardCharsets.UTF_8); final byte[] lengthPrefixedProtocols = new byte[protocolUTF8Bytes.length + 1]; lengthPrefixedProtocols[0] = (byte) protocol.length(); // cannot be over 255 anyhow System.arraycopy(protocolUTF8Bytes, 0, lengthPrefixedProtocols, 1, protocolUTF8Bytes.length); diff --git a/src/main/java/eu/siacs/conversations/utils/StylingHelper.java b/src/main/java/eu/siacs/conversations/utils/StylingHelper.java index 4d4339a42..7a18dffbb 100644 --- a/src/main/java/eu/siacs/conversations/utils/StylingHelper.java +++ b/src/main/java/eu/siacs/conversations/utils/StylingHelper.java @@ -32,8 +32,6 @@ package eu.siacs.conversations.utils; import android.content.Context; import android.graphics.Color; import android.graphics.Typeface; -import android.support.annotation.ColorInt; -import android.support.v4.content.ContextCompat; import android.text.Editable; import android.text.ParcelableSpan; import android.text.Spannable; @@ -48,6 +46,9 @@ import android.text.style.TypefaceSpan; import android.widget.EditText; import android.widget.TextView; +import androidx.annotation.ColorInt; +import androidx.core.content.ContextCompat; + import java.util.ArrayList; import java.util.Arrays; import java.util.List; @@ -58,7 +59,7 @@ import eu.siacs.conversations.ui.text.QuoteSpan; public class StylingHelper { - private static List> SPAN_CLASSES = Arrays.asList( + private static final List> SPAN_CLASSES = Arrays.asList( StyleSpan.class, StrikethroughSpan.class, TypefaceSpan.class, diff --git a/src/main/java/eu/siacs/conversations/utils/TLSSocketFactory.java b/src/main/java/eu/siacs/conversations/utils/TLSSocketFactory.java index 00bae7b75..8bd737c7e 100644 --- a/src/main/java/eu/siacs/conversations/utils/TLSSocketFactory.java +++ b/src/main/java/eu/siacs/conversations/utils/TLSSocketFactory.java @@ -6,6 +6,7 @@ import java.net.Socket; import java.security.KeyManagementException; import java.security.NoSuchAlgorithmException; import java.security.SecureRandom; + import javax.net.ssl.SSLContext; import javax.net.ssl.SSLSocket; import javax.net.ssl.SSLSocketFactory; diff --git a/src/main/java/eu/siacs/conversations/utils/ThemeHelper.java b/src/main/java/eu/siacs/conversations/utils/ThemeHelper.java index bd50ab0ae..17311cb0c 100644 --- a/src/main/java/eu/siacs/conversations/utils/ThemeHelper.java +++ b/src/main/java/eu/siacs/conversations/utils/ThemeHelper.java @@ -36,12 +36,14 @@ import android.content.res.Resources; import android.content.res.TypedArray; import android.os.Build; import android.preference.PreferenceManager; -import android.support.annotation.StyleRes; -import android.support.design.widget.Snackbar; -import android.support.v4.content.ContextCompat; import android.util.TypedValue; import android.widget.TextView; +import androidx.annotation.StyleRes; +import androidx.core.content.ContextCompat; + +import com.google.android.material.snackbar.Snackbar; + import eu.siacs.conversations.R; import eu.siacs.conversations.ui.SettingsActivity; @@ -103,8 +105,8 @@ public class ThemeHelper { final float size = typedArray.getDimension(0,0f); typedArray.recycle(); if (size != 0f) { - final TextView text = snackbar.getView().findViewById(android.support.design.R.id.snackbar_text); - final TextView action = snackbar.getView().findViewById(android.support.design.R.id.snackbar_action); + final TextView text = snackbar.getView().findViewById(com.google.android.material.R.id.snackbar_text); + final TextView action = snackbar.getView().findViewById(com.google.android.material.R.id.snackbar_action); if (text != null && action != null) { text.setTextSize(TypedValue.COMPLEX_UNIT_PX, size); action.setTextSize(TypedValue.COMPLEX_UNIT_PX, size); diff --git a/src/main/java/eu/siacs/conversations/utils/TimeFrameUtils.java b/src/main/java/eu/siacs/conversations/utils/TimeFrameUtils.java index 6ad1325be..1cb78db0c 100644 --- a/src/main/java/eu/siacs/conversations/utils/TimeFrameUtils.java +++ b/src/main/java/eu/siacs/conversations/utils/TimeFrameUtils.java @@ -31,7 +31,8 @@ package eu.siacs.conversations.utils; import android.content.Context; import android.os.SystemClock; -import android.support.annotation.PluralsRes; + +import androidx.annotation.PluralsRes; import java.util.Locale; diff --git a/src/main/java/eu/siacs/conversations/utils/UIHelper.java b/src/main/java/eu/siacs/conversations/utils/UIHelper.java index bf87dd0bd..a686f8697 100644 --- a/src/main/java/eu/siacs/conversations/utils/UIHelper.java +++ b/src/main/java/eu/siacs/conversations/utils/UIHelper.java @@ -1,12 +1,15 @@ package eu.siacs.conversations.utils; import android.content.Context; -import android.support.annotation.ColorInt; import android.text.SpannableStringBuilder; import android.text.format.DateFormat; import android.text.format.DateUtils; import android.util.Pair; +import androidx.annotation.ColorInt; + +import com.google.common.base.Strings; + import java.math.BigInteger; import java.security.MessageDigest; import java.util.Arrays; @@ -18,6 +21,7 @@ import java.util.Locale; 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.entities.Contact; import eu.siacs.conversations.entities.Conversation; import eu.siacs.conversations.entities.Conversational; @@ -32,7 +36,7 @@ import eu.siacs.conversations.xmpp.Jid; public class UIHelper { - private static int[] UNSAFE_COLORS = { + private static final int[] UNSAFE_COLORS = { 0xFFF44336, //red 500 0xFFE53935, //red 600 0xFFD32F2F, //red 700 @@ -45,7 +49,7 @@ public class UIHelper { 0xFFD84315, //deep orange 800, }; - private static int[] SAFE_COLORS = { + private static final int[] SAFE_COLORS = { 0xFFE91E63, //pink 500 0xFFD81B60, //pink 600 0xFFC2185B, //pink 700 @@ -521,8 +525,15 @@ public class UIHelper { if (conversation instanceof Conversation && conversation.getMode() == Conversation.MODE_MULTI) { return ((Conversation) conversation).getMucOptions().getSelf().getName(); } else { - final Jid jid = conversation.getAccount().getJid(); - return jid.getLocal() != null ? jid.getLocal() : jid.getDomain().toString(); + final Account account = conversation.getAccount(); + final Jid jid = account.getJid(); + final String displayName = account.getDisplayName(); + if (Strings.isNullOrEmpty(displayName)) { + return jid.getLocal() != null ? jid.getLocal() : jid.getDomain().toString(); + } else { + return displayName; + } + } } } @@ -559,14 +570,16 @@ public class UIHelper { } } - public static boolean receivedLocationQuestion(Message message) { + public static boolean receivedLocationQuestion(final Message message) { if (message == null || message.getStatus() != Message.STATUS_RECEIVED || message.getType() != Message.TYPE_TEXT) { return false; } - String body = message.getBody() == null ? null : message.getBody().trim().toLowerCase(Locale.getDefault()); - body = body.replace("?", "").replace("¿", ""); + final String body = Strings.nullToEmpty(message.getBody()) + .trim() + .toLowerCase(Locale.getDefault()) + .replace("?", "").replace("¿", ""); return LOCATION_QUESTIONS.contains(body); } diff --git a/src/main/java/eu/siacs/conversations/utils/XEP0392Helper.java b/src/main/java/eu/siacs/conversations/utils/XEP0392Helper.java index ee6a90e1e..69c00365e 100644 --- a/src/main/java/eu/siacs/conversations/utils/XEP0392Helper.java +++ b/src/main/java/eu/siacs/conversations/utils/XEP0392Helper.java @@ -1,10 +1,10 @@ package eu.siacs.conversations.utils; import android.graphics.Color; -import android.util.Log; import org.hsluv.HUSLColorConverter; +import java.nio.charset.StandardCharsets; import java.security.MessageDigest; class XEP0392Helper { @@ -12,7 +12,7 @@ class XEP0392Helper { private static double angle(String nickname) { try { MessageDigest sha1 = MessageDigest.getInstance("SHA-1"); - byte[] digest = sha1.digest(nickname.getBytes("UTF-8")); + byte[] digest = sha1.digest(nickname.getBytes(StandardCharsets.UTF_8)); int angle = ((int) (digest[0]) & 0xff) + ((int) (digest[1]) & 0xff) * 256; return angle / 65536.; } catch (Exception e) { diff --git a/src/main/java/eu/siacs/conversations/utils/XmppUri.java b/src/main/java/eu/siacs/conversations/utils/XmppUri.java index 52f84f24b..f3aa65155 100644 --- a/src/main/java/eu/siacs/conversations/utils/XmppUri.java +++ b/src/main/java/eu/siacs/conversations/utils/XmppUri.java @@ -1,7 +1,8 @@ package eu.siacs.conversations.utils; import android.net.Uri; -import android.support.annotation.NonNull; + +import androidx.annotation.NonNull; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; diff --git a/src/main/java/eu/siacs/conversations/xml/Element.java b/src/main/java/eu/siacs/conversations/xml/Element.java index 1bd11f604..c0ece7f4c 100644 --- a/src/main/java/eu/siacs/conversations/xml/Element.java +++ b/src/main/java/eu/siacs/conversations/xml/Element.java @@ -6,8 +6,8 @@ import java.util.List; import eu.siacs.conversations.utils.XmlHelper; import eu.siacs.conversations.xmpp.InvalidJid; -import eu.siacs.conversations.xmpp.stanzas.MessagePacket; import eu.siacs.conversations.xmpp.Jid; +import eu.siacs.conversations.xmpp.stanzas.MessagePacket; public class Element { private final String name; diff --git a/src/main/java/eu/siacs/conversations/xml/TagWriter.java b/src/main/java/eu/siacs/conversations/xml/TagWriter.java index df062b8cf..0e03fc1e8 100644 --- a/src/main/java/eu/siacs/conversations/xml/TagWriter.java +++ b/src/main/java/eu/siacs/conversations/xml/TagWriter.java @@ -16,10 +16,10 @@ public class TagWriter { private OutputStreamWriter outputStream; private boolean finished = false; - private LinkedBlockingQueue writeQueue = new LinkedBlockingQueue(); + private final LinkedBlockingQueue writeQueue = new LinkedBlockingQueue(); private CountDownLatch stanzaWriterCountDownLatch = null; - private Thread asyncStanzaWriter = new Thread() { + private final Thread asyncStanzaWriter = new Thread() { @Override public void run() { diff --git a/src/main/java/eu/siacs/conversations/xmpp/InvalidJid.java b/src/main/java/eu/siacs/conversations/xmpp/InvalidJid.java index a990dc5c1..f3a21c36f 100644 --- a/src/main/java/eu/siacs/conversations/xmpp/InvalidJid.java +++ b/src/main/java/eu/siacs/conversations/xmpp/InvalidJid.java @@ -29,7 +29,7 @@ package eu.siacs.conversations.xmpp; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import eu.siacs.conversations.xmpp.stanzas.AbstractStanza; diff --git a/src/main/java/eu/siacs/conversations/xmpp/OnAdvancedStreamFeaturesLoaded.java b/src/main/java/eu/siacs/conversations/xmpp/OnAdvancedStreamFeaturesLoaded.java index e45eba73e..9093076f7 100644 --- a/src/main/java/eu/siacs/conversations/xmpp/OnAdvancedStreamFeaturesLoaded.java +++ b/src/main/java/eu/siacs/conversations/xmpp/OnAdvancedStreamFeaturesLoaded.java @@ -3,5 +3,5 @@ package eu.siacs.conversations.xmpp; import eu.siacs.conversations.entities.Account; public interface OnAdvancedStreamFeaturesLoaded { - public void onAdvancedStreamFeaturesAvailable(final Account account); + void onAdvancedStreamFeaturesAvailable(final Account account); } diff --git a/src/main/java/eu/siacs/conversations/xmpp/OnBindListener.java b/src/main/java/eu/siacs/conversations/xmpp/OnBindListener.java index f09cf33dd..2406d8d7f 100644 --- a/src/main/java/eu/siacs/conversations/xmpp/OnBindListener.java +++ b/src/main/java/eu/siacs/conversations/xmpp/OnBindListener.java @@ -3,5 +3,5 @@ package eu.siacs.conversations.xmpp; import eu.siacs.conversations.entities.Account; public interface OnBindListener { - public void onBind(Account account); + void onBind(Account account); } diff --git a/src/main/java/eu/siacs/conversations/xmpp/OnContactStatusChanged.java b/src/main/java/eu/siacs/conversations/xmpp/OnContactStatusChanged.java index 20b17f021..afbe21c32 100644 --- a/src/main/java/eu/siacs/conversations/xmpp/OnContactStatusChanged.java +++ b/src/main/java/eu/siacs/conversations/xmpp/OnContactStatusChanged.java @@ -3,5 +3,5 @@ package eu.siacs.conversations.xmpp; import eu.siacs.conversations.entities.Contact; public interface OnContactStatusChanged { - public void onContactStatusChanged(final Contact contact, final boolean online); + void onContactStatusChanged(final Contact contact, final boolean online); } diff --git a/src/main/java/eu/siacs/conversations/xmpp/OnKeyStatusUpdated.java b/src/main/java/eu/siacs/conversations/xmpp/OnKeyStatusUpdated.java index e7fc582e4..705782455 100644 --- a/src/main/java/eu/siacs/conversations/xmpp/OnKeyStatusUpdated.java +++ b/src/main/java/eu/siacs/conversations/xmpp/OnKeyStatusUpdated.java @@ -3,5 +3,5 @@ package eu.siacs.conversations.xmpp; import eu.siacs.conversations.crypto.axolotl.AxolotlService; public interface OnKeyStatusUpdated { - public void onKeyStatusUpdated(AxolotlService.FetchStatus report); + void onKeyStatusUpdated(AxolotlService.FetchStatus report); } diff --git a/src/main/java/eu/siacs/conversations/xmpp/OnMessagePacketReceived.java b/src/main/java/eu/siacs/conversations/xmpp/OnMessagePacketReceived.java index 325e945f0..24acf16e2 100644 --- a/src/main/java/eu/siacs/conversations/xmpp/OnMessagePacketReceived.java +++ b/src/main/java/eu/siacs/conversations/xmpp/OnMessagePacketReceived.java @@ -4,5 +4,5 @@ import eu.siacs.conversations.entities.Account; import eu.siacs.conversations.xmpp.stanzas.MessagePacket; public interface OnMessagePacketReceived extends PacketReceived { - public void onMessagePacketReceived(Account account, MessagePacket packet); + void onMessagePacketReceived(Account account, MessagePacket packet); } diff --git a/src/main/java/eu/siacs/conversations/xmpp/OnPresencePacketReceived.java b/src/main/java/eu/siacs/conversations/xmpp/OnPresencePacketReceived.java index 95c1acfcc..e1bf839f4 100644 --- a/src/main/java/eu/siacs/conversations/xmpp/OnPresencePacketReceived.java +++ b/src/main/java/eu/siacs/conversations/xmpp/OnPresencePacketReceived.java @@ -4,5 +4,5 @@ import eu.siacs.conversations.entities.Account; import eu.siacs.conversations.xmpp.stanzas.PresencePacket; public interface OnPresencePacketReceived extends PacketReceived { - public void onPresencePacketReceived(Account account, PresencePacket packet); + void onPresencePacketReceived(Account account, PresencePacket packet); } diff --git a/src/main/java/eu/siacs/conversations/xmpp/OnStatusChanged.java b/src/main/java/eu/siacs/conversations/xmpp/OnStatusChanged.java index ad1d98cb9..262838b51 100644 --- a/src/main/java/eu/siacs/conversations/xmpp/OnStatusChanged.java +++ b/src/main/java/eu/siacs/conversations/xmpp/OnStatusChanged.java @@ -3,5 +3,5 @@ package eu.siacs.conversations.xmpp; import eu.siacs.conversations.entities.Account; public interface OnStatusChanged { - public void onStatusChanged(Account account); + void onStatusChanged(Account account); } diff --git a/src/main/java/eu/siacs/conversations/xmpp/OnUpdateBlocklist.java b/src/main/java/eu/siacs/conversations/xmpp/OnUpdateBlocklist.java index 92e72cfa8..e4f1a7cbe 100644 --- a/src/main/java/eu/siacs/conversations/xmpp/OnUpdateBlocklist.java +++ b/src/main/java/eu/siacs/conversations/xmpp/OnUpdateBlocklist.java @@ -3,11 +3,11 @@ package eu.siacs.conversations.xmpp; public interface OnUpdateBlocklist { // Use an enum instead of a boolean to make sure we don't run into the boolean trap // (`onUpdateBlocklist(true)' doesn't read well, and could be confusing). - public static enum Status { + enum Status { BLOCKED, UNBLOCKED } @SuppressWarnings("MethodNameSameAsClassName") - public void OnUpdateBlocklist(final Status status); + void OnUpdateBlocklist(final Status status); } diff --git a/src/main/java/eu/siacs/conversations/xmpp/PacketReceived.java b/src/main/java/eu/siacs/conversations/xmpp/PacketReceived.java index d4502d734..05ddc392f 100644 --- a/src/main/java/eu/siacs/conversations/xmpp/PacketReceived.java +++ b/src/main/java/eu/siacs/conversations/xmpp/PacketReceived.java @@ -1,5 +1,5 @@ package eu.siacs.conversations.xmpp; -public abstract interface PacketReceived { +public interface PacketReceived { } diff --git a/src/main/java/eu/siacs/conversations/xmpp/WrappedJid.java b/src/main/java/eu/siacs/conversations/xmpp/WrappedJid.java index aeee5c6e4..08fb6e6dc 100644 --- a/src/main/java/eu/siacs/conversations/xmpp/WrappedJid.java +++ b/src/main/java/eu/siacs/conversations/xmpp/WrappedJid.java @@ -1,11 +1,10 @@ package eu.siacs.conversations.xmpp; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import org.jxmpp.jid.Jid; import org.jxmpp.jid.impl.JidCreate; -import org.jxmpp.jid.parts.Domainpart; import org.jxmpp.jid.parts.Localpart; import org.jxmpp.jid.parts.Resourcepart; import org.jxmpp.stringprep.XmppStringprepException; diff --git a/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java b/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java index 70374522a..e58b11b35 100644 --- a/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java +++ b/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java @@ -5,12 +5,13 @@ import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.os.SystemClock; import android.security.KeyChain; -import android.support.annotation.NonNull; import android.util.Base64; import android.util.Log; import android.util.Pair; import android.util.SparseArray; +import androidx.annotation.NonNull; + import org.xmlpull.v1.XmlPullParserException; import java.io.ByteArrayInputStream; 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 bd50a22a2..0b1ff4495 100644 --- a/src/main/java/eu/siacs/conversations/xmpp/jingle/AbstractJingleConnection.java +++ b/src/main/java/eu/siacs/conversations/xmpp/jingle/AbstractJingleConnection.java @@ -8,8 +8,8 @@ import eu.siacs.conversations.entities.Account; import eu.siacs.conversations.entities.Contact; import eu.siacs.conversations.entities.Message; import eu.siacs.conversations.services.XmppConnectionService; -import eu.siacs.conversations.xmpp.jingle.stanzas.JinglePacket; import eu.siacs.conversations.xmpp.Jid; +import eu.siacs.conversations.xmpp.jingle.stanzas.JinglePacket; public abstract class AbstractJingleConnection { diff --git a/src/main/java/eu/siacs/conversations/xmpp/jingle/JingleCandidate.java b/src/main/java/eu/siacs/conversations/xmpp/jingle/JingleCandidate.java index 0fd0eabaf..78ffb28be 100644 --- a/src/main/java/eu/siacs/conversations/xmpp/jingle/JingleCandidate.java +++ b/src/main/java/eu/siacs/conversations/xmpp/jingle/JingleCandidate.java @@ -13,9 +13,9 @@ public class JingleCandidate { public static int TYPE_DIRECT = 0; public static int TYPE_PROXY = 1; - private boolean ours; + private final boolean ours; private boolean usedByCounterpart = false; - private String cid; + private final String cid; private String host; private int port; private int type; 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 178ac659c..27111af35 100644 --- a/src/main/java/eu/siacs/conversations/xmpp/jingle/JingleConnectionManager.java +++ b/src/main/java/eu/siacs/conversations/xmpp/jingle/JingleConnectionManager.java @@ -14,7 +14,6 @@ import com.google.common.collect.ImmutableSet; import java.lang.ref.WeakReference; import java.security.SecureRandom; -import java.util.Arrays; import java.util.Collection; import java.util.Collections; import java.util.HashMap; @@ -61,7 +60,7 @@ public class JingleConnectionManager extends AbstractConnectionManager { .expireAfterWrite(24, TimeUnit.HOURS) .build(); - private HashMap primaryCandidates = new HashMap<>(); + private final HashMap primaryCandidates = new HashMap<>(); public JingleConnectionManager(XmppConnectionService service) { super(service); 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 408635f93..8997a5043 100644 --- a/src/main/java/eu/siacs/conversations/xmpp/jingle/JingleFileTransferConnection.java +++ b/src/main/java/eu/siacs/conversations/xmpp/jingle/JingleFileTransferConnection.java @@ -41,6 +41,7 @@ import eu.siacs.conversations.services.AbstractConnectionManager; import eu.siacs.conversations.utils.CryptoHelper; import eu.siacs.conversations.xml.Element; import eu.siacs.conversations.xml.Namespace; +import eu.siacs.conversations.xmpp.Jid; import eu.siacs.conversations.xmpp.OnIqPacketReceived; import eu.siacs.conversations.xmpp.jingle.stanzas.Content; import eu.siacs.conversations.xmpp.jingle.stanzas.FileTransferDescription; @@ -50,7 +51,6 @@ import eu.siacs.conversations.xmpp.jingle.stanzas.JinglePacket; import eu.siacs.conversations.xmpp.jingle.stanzas.Reason; import eu.siacs.conversations.xmpp.jingle.stanzas.S5BTransportInfo; import eu.siacs.conversations.xmpp.stanzas.IqPacket; -import eu.siacs.conversations.xmpp.Jid; public class JingleFileTransferConnection extends AbstractJingleConnection implements Transferable { @@ -70,8 +70,8 @@ public class JingleFileTransferConnection extends AbstractJingleConnection imple private int mStatus = Transferable.STATUS_UNKNOWN; private Message message; private Jid responder; - private List candidates = new ArrayList<>(); - private ConcurrentHashMap connections = new ConcurrentHashMap<>(); + private final List candidates = new ArrayList<>(); + private final ConcurrentHashMap connections = new ConcurrentHashMap<>(); private String transportId; private FileTransferDescription description; @@ -100,7 +100,7 @@ public class JingleFileTransferConnection extends AbstractJingleConnection imple private OutputStream mFileOutputStream; private InputStream mFileInputStream; - private OnIqPacketReceived responseListener = (account, packet) -> { + private final OnIqPacketReceived responseListener = (account, packet) -> { if (packet.getType() != IqPacket.TYPE.RESULT) { if (mJingleStatus != JINGLE_STATUS_FAILED && mJingleStatus != JINGLE_STATUS_FINISHED) { fail(IqParser.extractErrorMessage(packet)); @@ -164,7 +164,7 @@ public class JingleFileTransferConnection extends AbstractJingleConnection imple JingleFileTransferConnection.this.fail(); } }; - private OnTransportConnected onIbbTransportConnected = new OnTransportConnected() { + private final OnTransportConnected onIbbTransportConnected = new OnTransportConnected() { @Override public void failed() { Log.d(Config.LOGTAG, "ibb open failed"); @@ -177,7 +177,7 @@ public class JingleFileTransferConnection extends AbstractJingleConnection imple JingleFileTransferConnection.this.transport.send(file, onFileTransmissionStatusChanged); } }; - private OnProxyActivated onProxyActivated = new OnProxyActivated() { + private final OnProxyActivated onProxyActivated = new OnProxyActivated() { @Override public void success() { diff --git a/src/main/java/eu/siacs/conversations/xmpp/jingle/JingleInBandTransport.java b/src/main/java/eu/siacs/conversations/xmpp/jingle/JingleInBandTransport.java index 7be13bedb..c68941928 100644 --- a/src/main/java/eu/siacs/conversations/xmpp/jingle/JingleInBandTransport.java +++ b/src/main/java/eu/siacs/conversations/xmpp/jingle/JingleInBandTransport.java @@ -18,9 +18,9 @@ import eu.siacs.conversations.entities.DownloadableFile; import eu.siacs.conversations.persistance.FileBackend; import eu.siacs.conversations.services.AbstractConnectionManager; import eu.siacs.conversations.xml.Element; +import eu.siacs.conversations.xmpp.Jid; import eu.siacs.conversations.xmpp.OnIqPacketReceived; import eu.siacs.conversations.xmpp.stanzas.IqPacket; -import eu.siacs.conversations.xmpp.Jid; public class JingleInBandTransport extends JingleTransport { @@ -46,7 +46,7 @@ public class JingleInBandTransport extends JingleTransport { private OnFileTransmissionStatusChanged onFileTransmissionStatusChanged; - private OnIqPacketReceived onAckReceived = new OnIqPacketReceived() { + private final OnIqPacketReceived onAckReceived = new OnIqPacketReceived() { @Override public void onIqPacketReceived(Account account, IqPacket packet) { if (!connected) { diff --git a/src/main/java/eu/siacs/conversations/xmpp/jingle/OnTransportConnected.java b/src/main/java/eu/siacs/conversations/xmpp/jingle/OnTransportConnected.java index 38f03c5d0..3e397823d 100644 --- a/src/main/java/eu/siacs/conversations/xmpp/jingle/OnTransportConnected.java +++ b/src/main/java/eu/siacs/conversations/xmpp/jingle/OnTransportConnected.java @@ -1,7 +1,7 @@ package eu.siacs.conversations.xmpp.jingle; public interface OnTransportConnected { - public void failed(); + void failed(); - public void established(); + void established(); } 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 7fad0459a..8a7581f04 100644 --- a/src/main/java/eu/siacs/conversations/xmpp/jingle/RtpCapability.java +++ b/src/main/java/eu/siacs/conversations/xmpp/jingle/RtpCapability.java @@ -1,5 +1,7 @@ package eu.siacs.conversations.xmpp.jingle; +import com.google.common.base.Strings; + import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; @@ -14,13 +16,13 @@ import eu.siacs.conversations.xml.Namespace; public class RtpCapability { - private static List BASIC_RTP_REQUIREMENTS = Arrays.asList( + private static final List BASIC_RTP_REQUIREMENTS = Arrays.asList( Namespace.JINGLE, Namespace.JINGLE_TRANSPORT_ICE_UDP, Namespace.JINGLE_APPS_RTP, Namespace.JINGLE_APPS_DTLS ); - private static List VIDEO_REQUIREMENTS = Arrays.asList( + private static final List VIDEO_REQUIREMENTS = Arrays.asList( Namespace.JINGLE_FEATURE_AUDIO, Namespace.JINGLE_FEATURE_VIDEO ); @@ -42,7 +44,7 @@ public class RtpCapability { public static String[] filterPresences(final Contact contact, Capability required) { final Presences presences = contact.getPresences(); final ArrayList resources = new ArrayList<>(); - for(final Map.Entry presence : presences.getPresencesMap().entrySet()) { + for (final Map.Entry presence : presences.getPresencesMap().entrySet()) { final Capability capability = check(presence.getValue()); if (capability == Capability.NONE) { continue; @@ -55,9 +57,16 @@ public class RtpCapability { } public static Capability check(final Contact contact) { + return check(contact, true); + } + + public static Capability check(final Contact contact, final boolean allowFallback) { final Presences presences = contact.getPresences(); + if (presences.size() == 0 && allowFallback && contact.getAccount().isEnabled()) { + return contact.getRtpCapability(); + } Capability result = Capability.NONE; - for(Presence presence : presences.getPresences()) { + for (final Presence presence : presences.getPresences()) { Capability capability = check(presence); if (capability == Capability.VIDEO) { result = capability; @@ -69,7 +78,18 @@ public class RtpCapability { } public enum Capability { - NONE, AUDIO, VIDEO + NONE, AUDIO, VIDEO; + + public static Capability of(String value) { + if (Strings.isNullOrEmpty(value)) { + return NONE; + } + try { + return valueOf(value); + } catch (IllegalArgumentException e) { + return NONE; + } + } } } 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 52762407f..7c329089a 100644 --- a/src/main/java/eu/siacs/conversations/xmpp/jingle/SessionDescription.java +++ b/src/main/java/eu/siacs/conversations/xmpp/jingle/SessionDescription.java @@ -88,7 +88,6 @@ public class SessionDescription { case 'm': if (currentMediaBuilder == null) { sessionDescriptionBuilder.setAttributes(attributeMap); - ; } else { currentMediaBuilder.setAttributes(attributeMap); mediaBuilder.add(currentMediaBuilder.createMedia()); 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 f27efb1e2..e21c38968 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 @@ -1,12 +1,11 @@ package eu.siacs.conversations.xmpp.jingle.stanzas; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import com.google.common.base.Preconditions; import java.util.Locale; -import eu.siacs.conversations.entities.DownloadableFile; import eu.siacs.conversations.xml.Element; import eu.siacs.conversations.xml.Namespace; 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 21b1d5089..0863b29df 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 @@ -1,6 +1,6 @@ package eu.siacs.conversations.xmpp.jingle.stanzas; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import com.google.common.base.CaseFormat; import com.google.common.base.Preconditions; @@ -11,8 +11,8 @@ import java.util.Map; import eu.siacs.conversations.xml.Element; import eu.siacs.conversations.xml.Namespace; -import eu.siacs.conversations.xmpp.stanzas.IqPacket; import eu.siacs.conversations.xmpp.Jid; +import eu.siacs.conversations.xmpp.stanzas.IqPacket; public class JinglePacket extends IqPacket { 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 9e4c8d95d..c419045b0 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 @@ -1,6 +1,6 @@ package eu.siacs.conversations.xmpp.jingle.stanzas; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import com.google.common.base.CaseFormat; diff --git a/src/main/java/eu/siacs/conversations/xmpp/pep/Avatar.java b/src/main/java/eu/siacs/conversations/xmpp/pep/Avatar.java index 1e4c1f629..a4397e466 100644 --- a/src/main/java/eu/siacs/conversations/xmpp/pep/Avatar.java +++ b/src/main/java/eu/siacs/conversations/xmpp/pep/Avatar.java @@ -7,9 +7,9 @@ import eu.siacs.conversations.xmpp.Jid; public class Avatar { - public enum Origin { PEP, VCARD }; + public enum Origin { PEP, VCARD } - public String type; + public String type; public String sha1sum; public String image; public int height; diff --git a/src/main/res/drawable/background.xml b/src/main/res/drawable/background.xml index f9c1fa73a..215c0eae4 100644 --- a/src/main/res/drawable/background.xml +++ b/src/main/res/drawable/background.xml @@ -1,11 +1,11 @@ - + + android:src="@drawable/splash_logo" /> diff --git a/src/main/res/layout/account_row.xml b/src/main/res/layout/account_row.xml index 75e3c2e54..914ee1950 100644 --- a/src/main/res/layout/account_row.xml +++ b/src/main/res/layout/account_row.xml @@ -44,7 +44,7 @@ android:textAppearance="@style/TextAppearance.Conversations.Body2" /> - - - + \ No newline at end of file diff --git a/src/main/res/layout/activity_change_password.xml b/src/main/res/layout/activity_change_password.xml index 03d575f98..51f26920a 100644 --- a/src/main/res/layout/activity_change_password.xml +++ b/src/main/res/layout/activity_change_password.xml @@ -13,7 +13,7 @@ android:layout_above="@+id/button_bar" android:layout_below="@id/toolbar"> - - - + - - + - + - - - + app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" /> + \ No newline at end of file diff --git a/src/main/res/layout/activity_choose_contact.xml b/src/main/res/layout/activity_choose_contact.xml index f44ef3509..b937f6d19 100644 --- a/src/main/res/layout/activity_choose_contact.xml +++ b/src/main/res/layout/activity_choose_contact.xml @@ -22,7 +22,7 @@ android:divider="@android:color/transparent" android:dividerHeight="0dp"/> - - - + - - - + - - + diff --git a/src/main/res/layout/activity_edit_account.xml b/src/main/res/layout/activity_edit_account.xml index 8741740ad..4fd8dc3c3 100644 --- a/src/main/res/layout/activity_edit_account.xml +++ b/src/main/res/layout/activity_edit_account.xml @@ -24,7 +24,7 @@ android:orientation="vertical"> - - - + - - + - - + - - + @@ -158,9 +158,9 @@ android:text="@string/register_account"/> - + - - + - - + - - + diff --git a/src/main/res/layout/activity_media_browser.xml b/src/main/res/layout/activity_media_browser.xml index 4a54e5fd4..57e12be9b 100644 --- a/src/main/res/layout/activity_media_browser.xml +++ b/src/main/res/layout/activity_media_browser.xml @@ -11,7 +11,7 @@ android:id="@+id/toolbar" layout="@layout/toolbar"/> - - - - + - - + @@ -216,9 +216,9 @@ android:layout_marginTop="32dp" android:textAppearance="@style/TextAppearance.Conversations.Caption"/> - + - - - + - - - + - - + diff --git a/src/main/res/layout/activity_muc_users.xml b/src/main/res/layout/activity_muc_users.xml index c195a0a1a..3fc73d02c 100644 --- a/src/main/res/layout/activity_muc_users.xml +++ b/src/main/res/layout/activity_muc_users.xml @@ -14,21 +14,21 @@ layout="@layout/toolbar" /> - - - + app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" /> + \ No newline at end of file diff --git a/src/main/res/layout/activity_publish_profile_picture.xml b/src/main/res/layout/activity_publish_profile_picture.xml index 635f49b45..aa9e9dc8f 100644 --- a/src/main/res/layout/activity_publish_profile_picture.xml +++ b/src/main/res/layout/activity_publish_profile_picture.xml @@ -8,7 +8,7 @@ - - + - - - + - - - - - - - - - + - - + - - - + + - + + android:background="?color_background_overlay" /> + app:backgroundTint="?colorPrimary" + app:sdMainFabClosedBackgroundColor="?colorPrimary" + app:sdMainFabClosedSrc="@drawable/ic_add_white_24dp" + app:sdMainFabOpenedBackgroundColor="?colorPrimaryDark" + app:sdOverlayLayout="@id/overlay" + app:sdUseReverseAnimationOnClose="true" /> diff --git a/src/main/res/layout/activity_trust_keys.xml b/src/main/res/layout/activity_trust_keys.xml index 96617702e..03f002149 100644 --- a/src/main/res/layout/activity_trust_keys.xml +++ b/src/main/res/layout/activity_trust_keys.xml @@ -21,7 +21,7 @@ android:layout_height="wrap_content" android:orientation="vertical"> - - + - - + - - - + diff --git a/src/main/res/layout/create_public_channel_dialog.xml b/src/main/res/layout/create_public_channel_dialog.xml index 4e458fc3c..048244d0c 100644 --- a/src/main/res/layout/create_public_channel_dialog.xml +++ b/src/main/res/layout/create_public_channel_dialog.xml @@ -19,7 +19,7 @@ android:layout_width="fill_parent" android:layout_height="wrap_content"/> - - - + - + diff --git a/src/main/res/layout/dialog_join_conference.xml b/src/main/res/layout/dialog_join_conference.xml index cb8fd313d..e4d4b8000 100644 --- a/src/main/res/layout/dialog_join_conference.xml +++ b/src/main/res/layout/dialog_join_conference.xml @@ -22,7 +22,7 @@ android:layout_width="fill_parent" android:layout_height="wrap_content"/> - - + - - + \ No newline at end of file diff --git a/src/main/res/layout/dialog_quickedit.xml b/src/main/res/layout/dialog_quickedit.xml index f0b71fc1b..0b3219fec 100644 --- a/src/main/res/layout/dialog_quickedit.xml +++ b/src/main/res/layout/dialog_quickedit.xml @@ -8,7 +8,7 @@ android:orientation="vertical" android:padding="?dialogPreferredPadding"> - - + \ No newline at end of file diff --git a/src/main/res/layout/enter_jid_dialog.xml b/src/main/res/layout/enter_jid_dialog.xml index b7b7a310f..cacb98a6f 100644 --- a/src/main/res/layout/enter_jid_dialog.xml +++ b/src/main/res/layout/enter_jid_dialog.xml @@ -22,7 +22,7 @@ android:layout_width="fill_parent" android:layout_height="wrap_content"/> - - + diff --git a/src/main/res/layout/fragment_conversation.xml b/src/main/res/layout/fragment_conversation.xml index d83dbe0b9..1ffbef68f 100644 --- a/src/main/res/layout/fragment_conversation.xml +++ b/src/main/res/layout/fragment_conversation.xml @@ -23,7 +23,7 @@ android:transcriptMode="normal" tools:listitem="@layout/message_sent"> - - - + - - - - + \ No newline at end of file diff --git a/src/main/res/layout/keys_card.xml b/src/main/res/layout/keys_card.xml index e0c385ad5..54eaaabc0 100644 --- a/src/main/res/layout/keys_card.xml +++ b/src/main/res/layout/keys_card.xml @@ -1,7 +1,7 @@ - - + \ No newline at end of file diff --git a/src/main/res/layout/toolbar.xml b/src/main/res/layout/toolbar.xml index 89b029df5..ebee72b0a 100644 --- a/src/main/res/layout/toolbar.xml +++ b/src/main/res/layout/toolbar.xml @@ -1,5 +1,5 @@ -Нов разговор Управление на профилите Управление на профила + Затваряне на разговора Подробности за контакта Подробности за груповия разговор Подробности за канала @@ -15,6 +16,8 @@ Деблокиране на контакта Блокиране на домейна Деблокиране на домейна + Блокиране на участника + Деблокиране на участника Управление на профилите Настройки Споделяне в разговора @@ -36,12 +39,14 @@ Модератор Участник Посетител + Искате ли да премахнете %s от списъка си с контакти? Разговорите с него няма да бъдат премахнати. Искате ли да блокирате %s, така че да не може да Ви праща съобщения? Искате ли да деблокирате %s, така че отново да може да Ви праща съобщения? Блокиране на всички контакти от %s? Деблокиране на всички контакти от %s? Контактът е блокиран Блокиран + Искате ли да премахнете отметката за %s? Разговорите, свързани с тази отметка, няма да бъдат премахнати. Регистриране на нов профил на сървъра Промяна на паролата в сървъра Споделяне с… diff --git a/src/main/res/values-ca/strings.xml b/src/main/res/values-ca/strings.xml index 2749e83d9..9093a6f2f 100644 --- a/src/main/res/values-ca/strings.xml +++ b/src/main/res/values-ca/strings.xml @@ -4,8 +4,10 @@ Nova conversa Gestiona els comptes Administrar compte + Conversa pròxima Detalls del contacte Detalls del xat de grup + Detalls del canal Afegeix un compte Edita el nom Afegeix a la llibreta d\'adreces @@ -14,6 +16,8 @@ Desbloqueja el contacte Bloqueja el domini Desbloqueja el domini + Bloquejar participant + Desbloquejar participant Gestiona els comptes Configuració Compartir amb Conversations @@ -25,6 +29,10 @@ Ara fa 1 min fa %d mins + + %dconverses no llegides + %d converses no llegides + enviant… Desxifrant el missatge. Espereu… Missatge xifrat amb OpenPGP @@ -35,12 +43,14 @@ Moderador Participant Visitant + Vols eliminar a %s de la teva llista de contactes? Les converses amb aquest contacte no seran eliminades. Voleu impedir que %s us pugui enviar missatges? Us agradaria desbloquejar %s i permetre que us enviï missatges? Voleu bloquejar tots els contactes de %s? Voleu desbloquejar tots el contactes de %s? Contacte bloquejat Bloquejats + Vols esborrar %s com a marcador? Les converses amb aquest marcador no seran eliminades. Registra un compte nou al servidor Canvia la contrasenya al servidor Comparteix amb… @@ -59,14 +69,22 @@ Desa D\'acord El Conversations s\'ha aturat + Usar el teu compte XMPP per a enviar seguiments de pila ajuda al desenvolupament continu de Conversations. Envia ara No preguntis de nou + No es va poder connectar al compte + No es va poder connectar-se a múltiples comptes + Prem per a administrar els teus comptes Envia un fitxer + Afegir aquest contacte perdut a la teva llista de contactes? Afegeix un contacte L\'enviament ha fallat + Preparant-se per a enviar la imatge + Preparant-se per a enviar la imatge S\'estan compartint els fitxers. Espereu… Neteja l\'historial Neteja l\'historial de la conversa + Vols esborrar tots els missatges d\'aquesta conversa?\n\n Advertiment: Això no influirà en els missatges emmagatzemats en altres dispositius o servidors. Eliminar fitxer Estàs segur que vols esborrar aquest fitxer?\n\n Advertiment: Això no eliminarà les còpies d\'aquest fitxer que estiguin emmagatzemades en altres dispositius o servidors. Tanca aquesta conversa després @@ -77,16 +95,20 @@ Envia un missatge xifrat amb OMEMO Envia un missatge xifrat amb v\\OMEMO Envia un missatge xifrat amb OpenPGP + Nou sobrenom en ús Envia sense xifrar El desxiframent ha fallat. Potser no teniu la clau privada apropiada. OpenKeychain + Conversations usa OpenKeychain per a xifrar i desxifrar missatges i gestionar les seves claus públiques.\n\n Està llicenciat baix GPLv3+ i disponible en F-Droid i Google Play.\n\n (Si us plau, reiniciï Conversations després.) Reinicia Instal·la Instal·leu l\'OpenKeychain s\'està oferint… s\'està esperant… No s\'ha trobat cap clau OpenPGP + No es va poder xifrar el teu missatge perquè el teu contacte no està anunciant la seva clau pública.\n\n Si us plau, demana-li al seu contacte que configuri OpenPGP. No s\'ha trobat cap clau OpenPGP + No es pot encriptar el teu missatge perquè els teus contactes no anuncien les seves claus públiques. Si us plau, demana\'ls que configurin OpenPGP. General Accepta els fitxers Accepta fitxers automàticament amb una mida menor a… @@ -96,12 +118,19 @@ Vibra quan arribi un missatge nou Notificació LED Fes que la notificació lumínica parpellegi quan arribi un missatge nou + To de trucada + So de notificació + So de notificació per als nous missatges + To de trucada entrant Període de gràcia + La durada de les notificacions se silencia després de detectar activitat en un dels seus altres dispositius. Avançat Mai enviïs informes d\'errors + En enviar els rastres de la pila estàs ajudant al desenvolupament Confirma els missatges Feu saber als vostres contactes quan heu rebut i llegit els seus missatges UI + OpenKeychain va produir un error. Clau dolenta per encriptar. Accepta S\'ha produït un error @@ -114,8 +143,10 @@ Fes una fotografia Accepta les peticions de subscripció preventivament El fitxer triat no és una imatge + No es va poder convertir l\'arxiu d\'imatge No s\'ha trobat el fitxer Error d\'E/S general. Pot ser que us hagueu quedat sense espai d\'emmagatzematge. + L\'aplicació que vas usar per a seleccionar aquesta imatge no va proporcionar suficients permisos per a llegir l\'arxiu.\n\nUtilitza un gestor d\'arxius diferent per a triar una imatge. Desconegut Inhabilitat temporalment En línia @@ -127,6 +158,8 @@ El registre ha fallat El nom d\'usuari ja està en ús S\'ha completat el registre + El registre no està suportat pel servidor + Token de registre invàlid S\'ha produït un error en la negociació de TLS Violació de la política Servidor incompatible @@ -142,12 +175,17 @@ Publica la clau pública d\'OpenPGP Elimina la clau pública d\'OpenPGP Esteu segur que voleu eliminar la vostra clau pública d\'OpenPGP de l\'anunci de la vostra presència?\nEls vostres contactes ja no podran enviar missatges xifrats amb OpenPGP. + S\'ha publicat la clau pública de OpenPGP. Habilita el compte N\'esteu segur? + En esborrar el teu compte s\'esborra tot l\'historial de converses Enregistra veu Adreça XMPP + Bloquejar la direcció XMPP username@example.com Contrasenya + Aquesta no és una direcció XMPP vàlida + Fora de la memòria. Imatge massa gran Voleu afegir a %s a la vostra llibreta d\'adreces? Informació del servidor XEP-0313: Gestió d\'arxivat de missatges @@ -156,6 +194,7 @@ XEP-0191: Ordre de bloqueig XEP-0237: Versionat de la llista de contactes XEP-0198: Gestió del flux de dades + XEP-0215: Descobriment de servei extern XEP-0163: Protocol d\'esdeveniments personals (Avatars / OMEMO) XEP-0363: Pujada de fitxers per HTTP XEP-0357: Notificacions de tramesa automàtica @@ -163,9 +202,14 @@ No disponible No es troben anuncis de clau pública darrera connexió: ara mateix + vist per última vegada fa un minut darrera connexió: fa %d minuts + vist per última vegada fa una hora darrera connexió: fa %d hores + vist per última vegada fa un dia darrera connexió: fa %d dies + Missatge encriptat. Si us plau, instal·la OpenKeychain per a desencriptar-ho. + S\'han trobat nous missatges xifrats OpenPGP Identificador de la clau d\'OpenPGP Empremta digital OMEMO Empremta digital v\\OMEMO @@ -176,6 +220,7 @@ S\'estan obtenint les claus… Fet Desxifra + Marcadors Cerca Introduïu un contacte Suprimeix el contacte @@ -186,10 +231,16 @@ Seleccioneu El contacte ja existeix Entra + channel@conference.example.com/nick + channel@conference.example.com Desa com a marcador Elimina dels marcadors Destrueix el xat en grup Destrueix el canal + Estàs segur que vols destruir aquest xat en grup?\n\nAdvertiment: El xat de grup serà eliminat per complet en el servidor. + Estàs segur que vols destruir aquest canal públic?\n\nAdvertiment: El canal serà completament eliminat en el servidor. + No es va poder destruir el xat del grup + No es va poder destruir el canal Edita el tema del xat de grup Assumpte S\'està unint al xat de grup… @@ -198,25 +249,32 @@ Afegeix de nou %s ha llegit fins aquí %s han llegit fins aquí + %1$s +%2$d uns altres han llegit fins a aquest punt Tothom ha llegit fins a aquí Publica + Premi l\'avatar per a seleccionar una imatge de la galeria S\'està publicant… El servidor ha rebutjat la vostra publicació + No s\'ha pogut convertir la imatge No s\'ha pogut desar l\'avatar al disc (O feu un toc llarg per restablir al valor predeterminat) + El seu servidor no suporta la publicació d\'avatars xiuxiuejat a %s Envia un missatge privat a %s Connecta Aquest compte ja existeix Següent + Sessió establerta Salta Inhabilita les notificacions Habilita El xat de grup requereix contrasenya Introduïu la contrasenya + Si us plau, sol·liciti primer les actualitzacions de presència al seu contacte.\n\nAixò s\'usarà per a determinar quina aplicació de xat està usant el teu contacte. Sol·licita ara Ignora + Advertiment:: Enviar això sense actualitzacions de presència mútua podria causar problemes inesperats.\n\n Vagi a \"Dades de contacte\" per a verificar les seves subscripcions de presència. Seguretat Permet la correcció de missatges Permet que els contactes editin de manera retroactiva els missatges @@ -229,6 +287,9 @@ Habilitar hores de silenci Les notificacions seràn silenciades a les hores de silenci Altres + Sincronitzar als marcadors + Unir-se als xats de grup automàticament si el marcador l\'indica + Empremta digital de OMEMO copiada en el portapapers Estàs prohibit en aquest xat de grup Aquest xat en grup només és de membres Limitació de recursos @@ -236,6 +297,7 @@ S\'ha tancat el xat de grup Ja no ets en aquest xat de grup Utlitzant el compte %s + allotjat en %s S\'està verificant %s al host HTTP No estàs connectat. Intenta-ho més tard Verificació de la mida de %s @@ -247,6 +309,7 @@ Envia una altra vegada URL del fitxer URL copiada al portapapers + Adreça XMPP copiada en el porta-retalls Missatge d\'error copiat al portapapers Adreça Web Escaneja el codi de barres 2D @@ -255,11 +318,16 @@ Detalls del compte Confirmar Intenta una altra vegada + Servei de primer pla Evitar que el sistema operatiu desconnecti la connexió Crea una còpia de seguretat + Els arxius de suport s\'emmagatzemaran en %s + Creant arxius de còpia de seguretat La còpia de seguretat s\'ha creat + Els arxius de suport han estat emmagatzemats en %s Restaurant la còpia de seguretat La còpia de seguretat s\'ha restaurat + No oblidis habilitar el compte. Tria un fitxer Rebent %1$s (%2$d%% completat) Descargat %s @@ -267,16 +335,27 @@ Fitxer Obert %s Enviant (%1$d%% completat) + Preparant-se per a compartir l\'arxiu %s ofert per descarregar Transmissió cancelada + no es va poder compartir l\'arxiu + transmissió d\'arxius cancel·lada + Arxius eliminats + No s\'ha trobat cap aplicació per a obrir l\'arxiu + No s\'ha trobat cap aplicació per a obrir l\'enllaç + No s\'ha trobat cap aplicació per a veure el contacte Etiquetes dinàmiques Mostra etiquetes de nomès lectura per sota dels noms dels contactes Habilitar notificació No s\'ha trobat cap servidor de xat de grup + No s\'ha pogut crear un xat de grup Avatar del compte Copieu l\'empremta digital OMEMO al porta-retalls Regenerar la clau OMEMO Esborra els dispositius + Estàs segur que vols esborrar tots els altres dispositius de l\'anunci de OMEMO? La pròxima vegada que els teus dispositius es connectin, tornaran a anunciar-se, però pot ser que no rebin els missatges enviats mentrestant. + No hi ha claus disponibles per a aquest contacte.\nNo s\'han pogut obtenir noves claus del servidor. Potser hi ha algun problema amb el servidor del teu contacte? + No hi ha claus utilitzables per a aquest contacte.\NAsseguri\'s que tots dos tenen subscripció de presència. Alguna cosa ha anat malament Anar a cercar la història als servidors No hi ha més histories al servidor @@ -286,6 +365,7 @@ Cambiar contrasenya Contrasenya actual Nova contrasenya + La contrasenya no pot estar buida Habilitar tots els comptes Deshabilitar tots els comptes Realitzar l\'acció amb… @@ -294,14 +374,25 @@ Outcast Membre Mode avançat + Concedir privilegis als membres + Revocar els privilegis dels membres Admetre privilegis d\'administrador Rebocar privilegis d\'administrador + Concedir privilegis al propietari + Revocar els privilegis del propietari Suprimeix del xat de grup + Eliminar del canal No s\'ha pogut canviar l\'afiliació del %s Prohibició del xat en grup + Prohibició del canal + Estàs intentant eliminar a %s d\'un canal públic. L\'única manera de fer-ho és prohibir a aquest usuari per sempre. Banejat ara No s\'ha pogut canviar les regles de %s + Configuració del xat de grup privat + Configuració del canal públic Privat, només membres + Fer que les direccions XMPP siguin visibles per a qualsevol + Fer que el canal sigui moderat No esteu participant S\'han modificat les opcions de xat en grup. No s\'han pogut modificar les opcions de xat de grup @@ -312,6 +403,7 @@ Marcar com llegit Entrada Entra per enviar + Utilitzi la tecla Intro per a enviar el missatge. Sempre pots usar Ctrl+Intro per a enviar un missatge, fins i tot si aquesta opció està desactivada. Mostra el botó enter Canviar la clau dels emoticones per un botó d\'entrada audio @@ -332,8 +424,11 @@ Feu saber als vostres contactes quan els escriviu missatges Enviar localització Mostrar localització + No s\'ha trobat cap aplicació per a mostrar la ubicació Localització Conversa tancada + Deixar el xat de grup privat + Canal públic de l\'esquerra No confiar en les CAs del sistema Tots els certificats han de ser aprovats manualment Eliminar certificats @@ -346,12 +441,15 @@ %d certificat esborrat %d certificats esborrats + Substituir el botó \"Enviar\" per una acció ràpida Acció ràpida Cap Ús més recent Trieu una acció ràpida Buscar contactes + Buscar favorits Envia un missatge privat + %1$s ha abandonat el xat de grup Nom d\'usuari Nom d\'usuari Aquest no és un nom d\'usuari vàlid @@ -361,17 +459,28 @@ S\'ha produït un error en la baixada: no s\'ha pogut escriure el fitxer La xarxa Tor no està disponible Vincular el error + El servidor no és responsable d\'aquest domini Trencat Disponibilitat Fora quan la pantalla està apagada + Mostrar com a Absent quan la pantalla està apagada + Ocupat en manera silenciosa + Mostrar com ocupat quan el dispositiu està en manera silenciosa Tracteu de vibrar al modo silenciós + Mostrar com ocupat quan el dispositiu està en vibració Configuració de connexió estesa Mostra el nom de la màquina i la configuració del port quan configureu un compte xmpp.example.com + Inici de sessió amb certificat + No s\'ha pogut analitzar el certificat Arxivant preferències Preferències d\'arxivat al servidor S\'estan obtenint les preferències d\'arxivat. Espereu… + No s\'han pogut recuperar les preferències d\'arxiu + Es requereix CAPTCHA Introduïu el text de la imatge de dalt + Cadena de certificats no fiable + La direcció XMPP no coincideix amb el certificat Renova el certificat S\'ha produït un error en obtenir la clau OMEMO!. Clau OMEMO verificada amb certificat! @@ -381,6 +490,7 @@ Tunelar totes les connexions a través de la xarxa Tor. Requereix Orbot Nom del \"Host\" Port + Servidor- or .onion-address Aquest no és un número de port vàlid Aquest no és un nom de host vàlid %1$d of %2$d comptes connectats @@ -389,28 +499,41 @@ %d messages Carregueu més missatges + Arxiu compartit amb %s + Imatge compartida amb %s + Imatges compartides amb %s + Text compartit amb %s + Concedir a Conversations accés a l\'emmagatzematge extern + Concedir accés a la càmera a Conversations Sincronitza amb contactes + Converses vol permís per a accedir als teus contactes per a aparellar la teva llista de contactes XMPP amb els teus contactes per a mostrar els seus noms complets i avatars.\nNomés llegirà els teus contactes i els aparellarà localment sense pujar-los al teu servidor.
No guardarem una còpia d\'aquests números de telèfon.\n\nPer a més informació llegeixi la nostra política de privadesa

Ara se us demanarà que concediu permís per accedir als vostres contactes.]]>
Notifica a tots els missatges Notifica només quan s\'esmenta S\'han desactivat les notificacions S\'han pausat les notificacions Compressió d\'imatge + Suggeriment: Utilitzi \"Triar arxiu\" en lloc de \"Triar imatge\" per a enviar imatges individuals sense comprimir, independentment d\'aquesta configuració. Sempre + Només imatges grans Optimitzacions de la bateria habilitades + El seu dispositiu està emprant fortes optimitzacions de la bateria per a les Converses, la qual cosa pot provocar retards en les notificacions o fins i tot la pèrdua de missatges.\nEs recomana desactivar-les. + El seu dispositiu està emprant fortes optimitzacions de la bateria per a les Converses, la qual cosa pot provocar retards en les notificacions o fins i tot la pèrdua de missatges.\nEs recomana desactivar-les. Desactivar L\'àrea seleccionada és massa gran (Sense comptes activats) Aquest camp és obligatori Corregeix el missatge Envia el missatge corregit + Ja has validat l\'empremta digital d\'aquesta persona de manera segura per a confirmar la seva confiança. En seleccionar \"Fet\" només estàs confirmant que %s forma part d\'aquest xat de grup. Heu desactivat aquest compte + Error de seguretat: Accés invàlid a un arxiu! + No s\'ha trobat cap aplicació per a compartir URI Comparteix l\'URI amb… -
Vostè es registra amb el seu número de telèfon i Quicksy es basarà automàticament en els números de telèfon de la seva llibreta d\'adreces per suggerir-li possibles contactes.

En registrar-se vostè accepta la nostra política de privadesa . ]]>
- Us guiarem pel procés de creació d\'un compte a chat.sum7.eu.\nQuan -trieu chat.sum7.eu com a proveïdor, podreu comunicar-vos amb els usuaris -d\'altres proveïdors donant-los la vostra ID Jabber completa. - La vostra Jabber ID completa serà: %s +
Si es registra amb el seu número de telèfon i Quicksy,--basant-se en els números de telèfon de la seva agenda--li suggereix automàticament possibles contactes.

En inscriure\'s, accepta nostra política de privacitat.]]>
+ Acceptar i continuar + S\'ha establert una guia per a la creació de comptes en chat.sum7.eu.\nEn triar chat.sum7.eu com a proveïdor podràs comunicar-te amb usuaris d\'altres proveïdors donant-los la teva adreça XMPP completa. + La seva adreça XMPP completa serà: %s Crear compte Utilitza el meu propi proveïdor Tria el teu nom d\'usuari @@ -433,9 +556,17 @@ d\'altres proveïdors donant-los la vostra ID Jabber completa.
Curt Mitjà Llarg + Ús de la radiodifusió + Permetre que els seus contactes sàpiguen quan usa Conversations Privadesa Tema Seleccioneu la paleta de colors + Automàtic + Clar + Fosc + Fons verd + Utilitzeu fons verd per als missatges rebuts + No s\'ha pogut connectar amb OpenKeychain Aquest dispositiu ja no està en ús Ordinador Telèfon mòbil @@ -443,20 +574,29 @@ d\'altres proveïdors donant-los la vostra ID Jabber completa.
Navegador web Consola Cal fer pagament + Concedir el permís d\'ús d\'Internet Jo El contacte demana la subscripció a la presència Permetre No hi ha permís per accedir %s El servidor remot no s\'ha trobat + Temps d\'espera del servidor remot + No s\'ha pogut actualitzar el compte + Denunciar aquesta adreça XMPP per spam. Elimineu les identitats OMEMO + Regenera les teves claus OMEMO. Tots els teus contactes hauran de verificar-te de nou. Utilitza això només com a últim recurs. Elimineu les tecles seleccionades Cal que us connecteu per publicar el vostre avatar. Mostra el missatge d\'error Missatge d\'error S\'ha activat el protector de dades + El seu sistema operatiu està restringint l\'accés de Converses a Internet quan està en segon pla. Per a rebre notificacions de nous missatges ha de permetre l\'accés sense restriccions de Converses quan l\'\"Estalvi de dades\" està activat.\nConversations continuarà fent un esforç per estalviar dades quan sigui possible. El vostre dispositiu no suporta desactivar el protector de dades de Conversations + No s\'ha pogut crear l\'arxiu temporal S\'ha verificat aquest dispositiu Copieu l\'empremta digital + S\'han verificat totes les claus OMEMO que tens en el teu poder + El codi de barres no conté empremtes dactilars per a aquesta conversa. Empremtes digitals verificades Utilitzeu la càmera per escanejar el codi de barres d\'un contacte Espereu que es puguin obtenir les claus @@ -464,8 +604,11 @@ d\'altres proveïdors donant-los la vostra ID Jabber completa.
Comparteix com a XMPP URI Comparteix com a enllaç HTTP Confiança cega abans de la verificació + Confiar en els nous dispositius dels contactes no verificats, però sol·licitar la confirmació manual dels nous dispositius per als contactes verificats. + Confiar cegament en les claus de OMEMO, la qual cosa significa que podria ser una altra persona o que algú podria haver intervingut. No confiable Codi de barres 2D no vàlid + Netejar la carpeta de caixet (utilitzada per l\'aplicació de la cambra) Netejar la memòria cache Netejar l\'emmagatzematge privat Netejar emmagatzematge privat on es mantenen els fitxers (es poden tornar a descarregar del servidor) @@ -475,6 +618,7 @@ d\'altres proveïdors donant-los la vostra ID Jabber completa.
Mostra inactiu Amaga inactiu Dispositiu no confiable + Està segur que vol eliminar la verificació d\'aquest dispositiu?\nAquest dispositiu i els missatges que provinguin d\'ell es marcaran com \"No fiable\". 1%d segons %d segons @@ -507,6 +651,7 @@ d\'altres proveïdors donant-los la vostra ID Jabber completa.
S\'han tancat les converses corresponents. Contacte bloquejat. Notificacions d\'estranys + Notificar per a missatges i trucades rebudes d\'estranys. S\'ha rebut un missatge de un desconegut Bloqueja al desconegut Bloqueja tot el domini @@ -516,11 +661,14 @@ d\'altres proveïdors donant-los la vostra ID Jabber completa.
Mecanisme SASL degradat El servidor requereix el registre al lloc web Obre la pàgina web + No s\'ha trobat cap aplicació per a obrir el lloc web Notificacions \"cap amunt\" + Mostrar les notificacions dels caps de fila Avui Ahir Valideu el nom del servidor amb DNSSEC Els certificats de servidor que contenen el nom de host validat es consideren verificats + El certificat no conté una direcció XMPP parcial Grava vídeo Copiar al portapapers @@ -544,6 +692,8 @@ d\'afegir Converses a la llista d\'aplicacions protegides.
Edita el missatge d\'estat Desactiva el xifratge Les converses no poden enviar missatges xifrats a 1%1$s . Això pot ser degut al vostre contacte mitjançant un servidor o client obsolet que no pot gestionar OMEMO. + No s\'ha pogut obtenir la llista de dispositius + No s\'han pogut obtenir les claus d\'encriptació Suggeriment: en alguns casos això es pot resoldre afegint les vostres llistes de contactes. Estàs segur que vols desactivar el xifratge OMEMO per a aquesta conversa?\nAixò permetrà que l\'administrador del servidor llegeixi els missatges, però pot ser l\'única forma de comunicar-se amb persones que utilitzin clients obsolets. @@ -562,6 +712,7 @@ que l\'administrador del servidor llegeixi els missatges, però pot ser l\'únic Mitjana Gran El missatge no està xifrat per a aquest dispositiu. + No s\'ha pogut desxifrar el missatge OMEMO. desfer L\'ús compartit d\'ubicacions està desactivat Posició fixa @@ -572,12 +723,16 @@ que l\'administrador del servidor llegeixi els missatges, però pot ser l\'únic Compartir ubicació Mostrar ubicació Compartir + No s\'ha pogut iniciar l\'enregistrament Si us plau, esperi… + Concedir accés al micròfon a Conversations Buscar missatges GIF Veure conversa Plugin per Compartir Ubicació + Utilitzar el plugin de compartir ubicació en lloc del mapa incorporat Copiar adreça web + Copiar la adeça XMPP Ús compartit de fitxers HTTP per a S3 Recerca directa En la pantalla \'Iniciar conversa\' obri el teclat i col·loqui el cursor en el camp de recerca @@ -590,4 +745,216 @@ que l\'administrador del servidor llegeixi els missatges, però pot ser l\'únic Proporcionar un nom és opcional Nom del xat en grup Aquest xat en grup ha estat destruït + No s\'ha pogut guardar l\'enregistrament + Servei de primer pla + Aquesta categoria de notificació s\'utilitza per a mostrar una notificació permanent que indica que les Converses s\'estan executant. + Informació d\'estat + Problemes de connectivitat + Aquesta categoria de notificació s\'utilitza per a mostrar una notificació en cas que hi hagi un problema de connexió a un compte. + Missatges + Tracades + Missatges + Trucades entrants + Trucades en curs + Missatges silenciosos + Aquest grup de notificacions s\'utilitza per a mostrar notificacions que no han d\'activar cap so. Per exemple, quan estan actives en un altre dispositiu (període de gràcia). + Lliuraments fallits + Configuració de la notificació de missatges + Configuració de la notificació de trucades entrants + Importància, So, Vibració + Compressió de vídeo + Veure mitjans + Participants + Navegador de mitjans + Arxiu omès per violació de seguretat. + Qualitat del vídeo + Una menor qualitat significa arxius més petits + Mitjà (360p) + Alt (720p) + cancel·lat + Ja està redactant un missatge. + Funció no implementada + Codi de país invàlid + Triï un país + número de telèfon + Verifiqui el seu número de telèfon + Quicksy enviarà un missatge SMS (poden aplicar-se càrrecs de l\'operador) per a verificar el teu número de telèfon. Introdueix el codi del teu país i el número de telèfon: +
%s

Està bé, o vol editar el número?]]>
+ %s no és un número de telèfon vàlid. + Si us plau, introdueixi el seu número de telèfon. + Buscar països + Verificar %s + %s.]]> + Li hem enviat un altre SMS amb un codi de 6 dígits. + Si us plau, introdueixi el pin de 6 dígits a continuació. + Reexpedir SMS + Reexpedir SMS (%s) + Si us plau, esperi (%s) + tornar + Pegar automàticament un possible pin des del portapapers. + Si us plau, introdueixi el seu pin de 6 dígits. + Està segur que vol avortar el procediment de registre? + Si + No + Verificant... + Sol·licitud de SMS... + El pin que has introduït és incorrecte. + El pin que li hem enviat ha caducat. + Error de xarxa desconegut. + Resposta desconeguda del servidor. + No s\'ha pogut connectar amb el servidor. + No s\'ha pogut establir una connexió segura. + No s\'ha pogut trobar el servidor. + Alguna cosa va sortir malament en processar la seva sol·licitud. + Entrada d\'usuari no vàlida + No està disponible temporalment. Torna a intentar-ho més tard. + No hi ha connexió a la xarxa. + Si us plau, intenti-ho de nou en %s + La seva velocitat està limitada + Massa intents + Estàs utilitzant una versió desactualizada d\'aquesta aplicació. + Actualitzar + Aquest número de telèfon està actualment connectat amb un altre dispositiu. + Si us plau, introdueixi el seu nom perquè la gent, que no li té en la seva llibreta d\'adreces, sàpiga qui és vostè. + El seu nom + Introdueixi el seu nom + Utilitzi el botó d\'edició per a establir el seu nom. + Rebutjar la sol·licitud + Instal·lar Orbot + Iniciar Orbot + No hi ha cap aplicació de venda instal·lada. + Aquest canal farà pública la seva adreça XMPP + Llibre electrònic + Original (sense comprimir) + Obrir amb... + Foto de perfil de Conversations + Triï el compte + Restaurar còpia de seguretat + Restaurar + Introdueixi la contrasenya del compte %s per a restaurar la còpia de seguretat. + No utilitzi la funció de restauració de la còpia de seguretat per a intentar clonar (executar simultàniament) una instal·lació. La restauració d\'una còpia de seguretat només està pensada per a migracions o en cas que hagis perdut el dispositiu original. + No s\'ha pogut restaurar la còpia de seguretat. + No s\'ha pogut desxifrar la còpia de seguretat. La contrasenya és correcta? + Còpia de seguretat i restauració + Introdueixi la direcció XMPP + Crear un xat de grup + Unir-se a un canal públic + Crear un xat de grup privat + Crear un canal públic + Nom del canal + Adreça XMPP + Indiqui un nom per al canal + Indiqui una direcció XMPP + Aquesta és una direcció XMPP. Si us plau, proporcioni un nom. + Creant un canal públic... + Aquest canal ja existeix + T\'has unit a un canal existent + No s\'ha pogut guardar la configuració del canal + Permetre que qualsevol pugui editar el tema + Permetre que qualsevol convidi a uns altres + Qualsevol pot editar el tema. + Els propietaris poden editar el tema. + Els administradors poden editar el tema. + Els propietaris poden convidar a uns altres. + Qualsevol pot convidar a uns altres. + Les adreces XMPP són visibles per als administradors. + Les adreces XMPP són visibles per a qualsevol. + Aquest canal públic no té participants. Convida als teus contactes o utilitza el botó de compartir per a distribuir la seva adreça XMPP. + Aquest xat de grup privat no té participants. + Gestionar els privilegis + Buscar participants + Arxiu massa gran + Adjuntar + Descobreix canals + Buscar canals + Possible violació de la privacitat. + search.jabber.network.

L\'ús d\'aquesta funció transmetrà la seva adreça IP i els termes de cerca a aquest servei. Consulti la seva Política de Privacitat per a obtenir més informació.]]>
+ Ja tinc un compte + Afegir compte existent + Registrar un nou compte + Això sembla una direcció de domini + Afegir de totes maneres + Això sembla una direcció de canal + Compartir arxius de còpia de seguretat + Còpia de seguretat de Conversations + Esdeveniment + Obrir la còpia de seguretat + L\'arxiu seleccionat no és un arxiu de còpia de seguretat de Conversations + Aquest compte ja està configurada + Si us plau, introdueixi la contrasenya d\'aquest compte + No s\'ha pogut realitzar aquesta acció + Unir-se al canal públic... + L\'aplicació per a compartir no va donar permís per a accedir a aquest arxiu. + + jabber.network + Servidor local + La majoria dels usuaris haurien de triar \'jabber.network\' per a obtenir millors suggeriments de tot l\'ecosistema públic de XMPP. + Mètode de descobriment de canals + Còpia de seguretat + Sobre + Si us plau, habiliti un compte + Fer una trucada + Trucada entrant + Trucada de vídeo entrant + Connectant + Connectat + Acceptant la trucada + Finalitzant la trucada + Resposta + Descartar + Descobrir dispositius + Sonant + Ocupat + No es va poder establir la trucada + Connexió perduda + Trucada rebutjada + Fallada de l\'aplicació + Penjar + Trucada en curs + Trucada de vídeo en curs + Desactivar Tor per a fer trucades + Trucada entrant + Trucada entrant · %s + Trucada sortint + Trucada sortint · %s + Trucada perduda + Trucada de veu + Trucada de vídeo + Ajuda + Passar a la conversa + El seu micròfon no està disponible + Només pots tenir una trucada alhora. + Tornar a la trucada en curs + No es pot canviar de càmera + Enclavar en la part superior + Desenclavar de dalt + Ruta GPX + No s\'ha pogut corregir el missatge + Totes les converses + Aquesta conversa + El seu avatar + Avatar per a %s + Encriptat amb OMEMO + Encriptat amb OpenPGP + No encriptat + Sortir + Gravar la bústia de veu + Reproduir àudio + Pausar l\'àudio + Afegir contacte, crear o unir-se a un xat de grup, o descobrir canals + + View %1$d Participant + Veure %1$d Participants + + + Alguns missatges no han pogut ser lliurats + Alguns missatges no han pogut ser lliurats + + Lliuraments fallits + Més opcions + No s\'ha trobat cap aplicació + Convidar a Conversations + No es pot processar la invitació + El servidor no admet la generació d\'invitacions + Cap compte actiu admet aquesta funció diff --git a/src/main/res/values-cs/strings.xml b/src/main/res/values-cs/strings.xml index dd2a09c53..f446dc120 100644 --- a/src/main/res/values-cs/strings.xml +++ b/src/main/res/values-cs/strings.xml @@ -7,6 +7,7 @@ Zavřít konverzaci Detaily kontaktu Detaily skupinového chatu + Detaily kanálu Přidat účet Upravit jméno Přidat do adresáře @@ -20,6 +21,8 @@ Sdílet s konverzací Začít konverzaci Vybrat kontakt + Vybrat kontakty + Sdílet pomocí účtu Seznam blokovaných právě teď před minutou @@ -39,13 +42,16 @@ Zablokovat všechny kontakty z %s? Odblokovat všechny kontakty z %s? Kontakty zablokovány + Zablokovaný Přejete si odstranit %s ze záložek? Předešlé rozhovory pod záložkou nebudou odstraněny. Registrovat nový účet na serveru Změnit heslo na serveru Sdílet s... Začít konverzaci Pozvat kontakt + Pozvat Kontakty + Kontakt Zrušit Nastavit Přidat @@ -58,14 +64,22 @@ Aplikace Konverzace přestala reagovat Odeslat teď Již se neptat + Nelze se připojit k účtu Přiložit soubor + Přidat chybějící kontakt do seznamu kontaktů? Přidat kontakt doručení selhalo + Připravuji odeslání obrázku + Připravuji odeslání obrázků Sdílení souborů. Chvíli strpení... Smazat historii Smaže historii konverzací + Opravdu chcete smazat všechny zprávy v této konverzace?\n\nVarováníToto neovlivní zprávy uložené na jiných zařízeních či serverech. + Smazat soubor + Opravdu chcete smazat tento soubor?\n\nVarováníToto neovlivní kopie uložené na jiných zařízeních či serverech. Vybrat přístroj Odeslat nešifrovanou zprávu + Odeslat zprávu Odeslat zprávu pro %s Poslat OMEMO šifrovanou zprávu Odeslat v\\OMEMO šifrovanou zprávu @@ -89,7 +103,10 @@ Vibrovat při přijetí nové zprávy LED upozornění Blikat při přijetí nové zprávy + Vyzváněcí tón + Vyzváněcí tón pro příchozí hovor Časová lhůta + Časová lhůta po kterou bude Conversations v tichém režimu při zaznamenání aktivity na jiném přístroji Rozšířené Neodesílat detaily o pádu aplikace Potvrzovat zprávy @@ -97,6 +114,7 @@ UI Přijmout Došlo k chybě + Chyba Váš účet Zasílat změny stavu Přijímat změny stavu @@ -129,6 +147,7 @@ Dočasně vypnout Zveřejnit avatar Zveřejnit OpenPGP klíč + OpenPGP veřejný klíč zveřejněn. Povolit účet Jste si jisti? Nahrát hlas @@ -183,6 +202,7 @@ kanál@konference.server.cz Uložit jako záložku Smazat záložku + Zrušit kanál Odejít Kontakt přidán do seznamu Opět přidat @@ -353,6 +373,7 @@ %d zpráv Načíst více zpráv + Povolit Conversations přístup ke kameře Synchronizovat s kontakty Upozorňovat na všechny zprávy Upozornění vypnuta diff --git a/src/main/res/values-de/strings.xml b/src/main/res/values-de/strings.xml index ba44d4438..60f6187d3 100644 --- a/src/main/res/values-de/strings.xml +++ b/src/main/res/values-de/strings.xml @@ -29,7 +29,10 @@ gerade vor einer Minute vor %d Minuten - %d ungelesene Unterhaltungen + + %d ungelesene Unterhaltung + %d ungelesene Unterhaltungen + senden… Nachricht wird entschlüsselt. Bitte warten… OpenPGP-verschlüsselte Nachricht diff --git a/src/main/res/values-el/strings.xml b/src/main/res/values-el/strings.xml index 2f9c58e51..03ba2915f 100644 --- a/src/main/res/values-el/strings.xml +++ b/src/main/res/values-el/strings.xml @@ -29,7 +29,6 @@ μόλις τώρα πριν από 1 λεπτό πριν από %d λεπτά - %d αδιάβαστες συζητήσεις αποστολή... Αποκρυπτογράφηση μηνύματος. Παρακαλώ περιμένετε... Κρυπτογραφημένο μήνυμα OpenPGP diff --git a/src/main/res/values-es/strings.xml b/src/main/res/values-es/strings.xml index 2a70dccea..eee2de1c5 100644 --- a/src/main/res/values-es/strings.xml +++ b/src/main/res/values-es/strings.xml @@ -29,7 +29,10 @@ ahora hace 1 min hace %d min - %dconversaciones sin leer + + %d conversación sin leer + %dconversaciones sin leer + enviando… Descifrando mensaje. Por favor, espera... Mensaje cifrado con OpenPGP @@ -948,4 +951,8 @@ Envíos fallidos Más opciones No se ha encontrado aplicación + Invitar a Conversations + No se ha podido leer la invitación + El servidor no soporta la creación de invitaciones + Ninguna cuenta activa soporta esta característica diff --git a/src/main/res/values-eu/strings.xml b/src/main/res/values-eu/strings.xml index e3dc29fb4..2ca7339fd 100644 --- a/src/main/res/values-eu/strings.xml +++ b/src/main/res/values-eu/strings.xml @@ -28,7 +28,6 @@ orain min 1 lehenago %d min lehenago - Irakurrik gabeko %d elkarrizketa bidaltzen… Mezua desenkriptatzen. Mesedez itxaron… OpenPGPz enkriptatutako mezua diff --git a/src/main/res/values-fr/strings.xml b/src/main/res/values-fr/strings.xml index e8918029b..8e12440eb 100644 --- a/src/main/res/values-fr/strings.xml +++ b/src/main/res/values-fr/strings.xml @@ -29,7 +29,6 @@ À l\'instant Il y a 1 minute Il y a %d minutes - %d conversations non lues Envoi… Déchiffrement du message. Veuillez patienter… Message chiffré avec OpenPGP diff --git a/src/main/res/values-gl/strings.xml b/src/main/res/values-gl/strings.xml index dc20afeb2..b8d38cade 100644 --- a/src/main/res/values-gl/strings.xml +++ b/src/main/res/values-gl/strings.xml @@ -29,7 +29,10 @@ agora Hai 1 min hai %d minutos - %d conversas non lidas + + %d conversa sen ler + %d conversas sen ler + enviando… Descifrando a mensaxe. Por favor agarde... Mensaxe cifrado con OpenPGP @@ -254,7 +257,7 @@ O servidor rexeitou a túa publicación Non se puido converter a imaxe Non se puido salvar o avatar no disco - (ou pulsación longa para voltar ao valor por omisión) + (ou pulsación longa para volver ao valor por defecto) O servidor non soporta a publicación de avatares murmurado a %s diff --git a/src/main/res/values-hu/strings.xml b/src/main/res/values-hu/strings.xml index d1c193856..6f50fc62a 100644 --- a/src/main/res/values-hu/strings.xml +++ b/src/main/res/values-hu/strings.xml @@ -29,7 +29,6 @@ éppen most 1 perce %d perce - %d olvasatlan beszélgetés küldés… Üzenet visszafejtése. Kérem várjon… OpenPGP-vel titkosított üzenet diff --git a/src/main/res/values-id/strings.xml b/src/main/res/values-id/strings.xml index 08fb2bc34..282b0e455 100644 --- a/src/main/res/values-id/strings.xml +++ b/src/main/res/values-id/strings.xml @@ -3,7 +3,11 @@ Pengaturan Percakapan Baru Pengaturan Akun + Pengaturan akun + Tutup percakapan Detil Kontak + Detil grup chat + Detil channel Tambah Akun Ubah Nama Tambahkan ke daftar kontak @@ -12,10 +16,15 @@ Batal blokir kontak Blokir domain Batal blokir domain + Blok partisipan + Buka blok partisipan Pengaturan Akun Pengaturan Bagikan dengan Conversation Mulai Percakapan + Pilih kontak + Pilih beberapa kontak + Bagikan melalui akun Daftar blokir sekarang 1 min lalu @@ -24,6 +33,7 @@ Mendekripsi pesan. Mohon tunggu… Pesan terenkripsi OpenPGP Nickname ini sudah digunakan + Alias tidak valid Administrator Pemilik Moderator @@ -34,10 +44,15 @@ Blokir semua kontak dari %s? Batalkan blokir semua kontak dari %s? Kontak terblokir + Diblok Daftarkan akun baru di server Ganti password di server Bagikan dengan... + Mulai percakapan + Undang kontak + Undang Kontak + Kontak Batal Atur Tambah @@ -50,13 +65,25 @@ Percakapan terhenti Kirim sekarang Jangan tanya lagi + Tidak dapat terhubung ke akun + Tidak dapat terhubung ke multi akun + Klik untuk mengatur akun anda Sisipkan berkas + Tambah kontak ini ke daftar kontak anda? Tambah kontak pengiriman gagal + Mempersiapkan pengiriman gambar + Mempersiapkan pengiriman beberapa gambar Membagikan berkas. Mohon tunggu… Bersihkan riwayat Hapus Riwayat Percakapan + Hapus file + Lanjutkan dengan menutup percakapan + Pilih perangkat Kirim pesan tak-terenkripsi + Kirim pesan + Kirimkan pesan ke %s + Kirim pesan terenkripsi OMEMO Kirim pesan terenskripsi OpenPGP Kirim tidak terenkripsi Dekripsi gagal. Mungkin Anda tidak memiliki kunci pribadi yang tepat. @@ -76,12 +103,19 @@ Getar Aktifkan getar ketika pesan masuk Notifikasi LED + Nada dering + Notifikasi suara + Notifikasi suara untuk pesan baru + Nada dering untuk panggilan masuk Lanjutan Jangan kirim laporan kerusakan Konfirmasi Pesan UI + OpenKeychain menghasilkan kesalahan. + Kunci untuk enkripsi cacat Terima Sebuah kesalahan terjadi + Kesalahan Akun anda Kirim pembaruan kehadiran Terima pembaruan kehadiran @@ -90,6 +124,7 @@ Ambil gambar Ijinkan permintaan berlangganan Berkas yang anda pilih bukan gambar + Tidak bisa mengkonversi file gambar Berkas tidak ditemukan Kesalahan Umum I/O. Mungkin Anda kehabisan ruang penyimpanan? Tidak diketahui @@ -103,7 +138,12 @@ Registrasi gagal Username telah digunakan Registrasi berhasil + Server tidak mendukung registrasi + Token registrasi salah + Kegagalan negosiasi TLS + Pelanggaran kebijakan Server tidak cocok + Tidak terenkripsi OTR OpenPGP OMEMO @@ -111,11 +151,19 @@ Sementara dimatikan Publikasikan avatar Publikasikan kunci OpenPGP + Hapus kunci publik OpenPGP + Kunci publik OpenPGP diumumkan Aktifkan Akun Apakah Anda yakin.? + Menghapus akun akan menghilangkan semua riwayat percakapan Rekam suara + alamat XMPP + Blok alamat XMPP username@example.com Password + Alamat XMPP salah + Memori habis. Gambar terlalu besar + Anda ingin menambahkan %s ke daftar kontak? Info Server XEP-0313: MAM XEP-0280: Message Carbons @@ -130,13 +178,18 @@ tidak tersedia Pemberitahuan kunci publik tidak ditemukan terakhir terlihat sekarang + Muncul satu menit yang lalu terlihat %d menit lalu + Muncul satu jam yang lalu terlihat %d jam lalu + Muncul satu hari yang lalu terlihat %d hari lalu Perangkat lainnya Selesai Deskripsi Cari + Masukkan kontak + Hapus kontak Lihat detil kontak Blokir kontak Lepas blokir kontak @@ -146,11 +199,18 @@ Gabung Simpan sebagai bookmark Hapus bookmark + Hapus grup chat + Hapus channel + Tidak dapat menghapus grup chat + Tidak dapat menghapus channel + Edit subyek grup chat + Topik Tinggalkan Kontak ditambahkan ke daftar anda Tambah kembali %s telah membaca hingga disini Publikasi + Klik avatar untuk memilih gambar dari galeri Mempublikasi... Server tidak mengijinkan publikasi Anda Tidak dapat menyimpan Avatar ke memori @@ -164,9 +224,12 @@ Lewati Nonaktifkan notifikasi Aktifkan + Grup chat memerlukan kata kunci Masukan password Request sekarang Abaikan + Keamanan + Ijinkan mengedit pesan Harap berhati-hati dengan ini Waktu sunyi Waktu mulai @@ -174,10 +237,13 @@ Aktifkan waktu sunyi Pemberitahuan akan disunyukan ketika jam sunyi. Lainnya + Anda terlarang dari grup chat ini menggunakan akun %s Anda tidak terhubung. Coba lagi nanti Cek %s ukuran Opsi pesan + Kutipan + Tempel sebagai kutipan Salin URL asli Kirim lagi URL Berkas @@ -305,4 +371,22 @@ Tema Latar Hijau Gunakan latar hijau untuk pesan masuk + Kecil + Sedang + Besar + Bagikan + Silahkan menunggu… + Ijinkan Conversations mengakses mikrofon + Cari pesan + Kopi alamat website + Kopi alamat XMPP + Pencarian langsung + Nama kontak + Panggilan + Nama + Pesan + Telepon + Pesan + Telepon masuk + Telepon keluar diff --git a/src/main/res/values-it/strings.xml b/src/main/res/values-it/strings.xml index 00aa0dccb..e89be2864 100644 --- a/src/main/res/values-it/strings.xml +++ b/src/main/res/values-it/strings.xml @@ -29,7 +29,6 @@ adesso 1 min fa %d min fa - %d conversazioni non lette invio… Decifrazione messaggio. Attendere prego... Messaggio cifrato con OpenPGP @@ -951,4 +950,5 @@ Invita su Conversations Impossibile analizzare l\'invito Il server non supporta la generazione di inviti + Nessun account attivo supporta questa funzione diff --git a/src/main/res/values-ja/strings.xml b/src/main/res/values-ja/strings.xml index f4a6a59dd..2cd4cada3 100644 --- a/src/main/res/values-ja/strings.xml +++ b/src/main/res/values-ja/strings.xml @@ -29,7 +29,6 @@ ちょうど今 1 分前 %d 分前 - 未読%d件 送信中… メッセージを復号化しています。しばらくお待ちください… OpenPGP 暗号化メッセージ diff --git a/src/main/res/values-night/colors.xml b/src/main/res/values-night/colors.xml new file mode 100644 index 000000000..7275c9cbe --- /dev/null +++ b/src/main/res/values-night/colors.xml @@ -0,0 +1,5 @@ + + + #ff424242 + #ff282828 + diff --git a/src/main/res/values-nl/strings.xml b/src/main/res/values-nl/strings.xml index 2f2b64cab..45c7f5ea1 100644 --- a/src/main/res/values-nl/strings.xml +++ b/src/main/res/values-nl/strings.xml @@ -28,7 +28,6 @@ zojuist 1 min. geleden %d min. geleden - %d ongelezen gesprekken versturen… Bericht aan het ontsleutelen. Even geduld… OpenPGP-versleuteld bericht diff --git a/src/main/res/values-pl/strings.xml b/src/main/res/values-pl/strings.xml index 9275587aa..951ffd5ff 100644 --- a/src/main/res/values-pl/strings.xml +++ b/src/main/res/values-pl/strings.xml @@ -29,7 +29,12 @@ przed chwilą minutę temu %d minut temu - %d nieprzeczytanych konwersacji + + %d nieprzeczytana konwersacja + %d nieprzeczytane konwersacje + %d nieprzeczytanych konwersacji + %d nieprzeczytanych konwersacji + wysyłanie... Odszyfrowywanie wiadomości. To zajmie tylko chwilę... Wiadomość zaszyfrowana OpenPGP diff --git a/src/main/res/values-pt-rBR/strings.xml b/src/main/res/values-pt-rBR/strings.xml index 9c2e272ea..01cdeb64b 100644 --- a/src/main/res/values-pt-rBR/strings.xml +++ b/src/main/res/values-pt-rBR/strings.xml @@ -29,7 +29,10 @@ agora 1 minuto atrás %d minutos atrás - %d conversas não lidas + + %d conversa não lida + %d conversas não lidas + enviando... Descriptografando a mensagem. Por favor, aguarde... Mensagem criptografada via OpenPGP diff --git a/src/main/res/values-ro-rRO/strings.xml b/src/main/res/values-ro-rRO/strings.xml index 322e9ecd6..21880baf3 100644 --- a/src/main/res/values-ro-rRO/strings.xml +++ b/src/main/res/values-ro-rRO/strings.xml @@ -29,7 +29,11 @@ acum acum un minut acum %d minute - %d conversații necitite + + %d conversație necitită + %d conversații necitite + %d de conversații necitite + trimitere... Decriptez mesaj. Te rog așteaptă... Mesaj criptat cu OpenPGP diff --git a/src/main/res/values-ru/strings.xml b/src/main/res/values-ru/strings.xml index 19f9eb716..1ac1ebe8f 100644 --- a/src/main/res/values-ru/strings.xml +++ b/src/main/res/values-ru/strings.xml @@ -29,7 +29,6 @@ только что 1 минуту назад %d мин. назад - %d непрочитанных бесед отправка… Расшифровка сообщения. Подождите… OpenPGP зашифр. сообщение diff --git a/src/main/res/values-sr/strings.xml b/src/main/res/values-sr/strings.xml index 0c5ef2675..74948c5af 100644 --- a/src/main/res/values-sr/strings.xml +++ b/src/main/res/values-sr/strings.xml @@ -3,8 +3,11 @@ Поставке Нова преписка Управљај налозима + Управљај налогом + Затвори преписку Детаљи контакта Детаљи групног ћаскања + Детаљи канала Додај налог Уреди име Додај у именик @@ -13,6 +16,8 @@ Одблокирај контакт Блокирај домен Одблокирај домен + Блокирај учесника + Одблокирај учесника Управљање налозима Поставке Подели у преписци @@ -24,6 +29,11 @@ управо сад пре минут пре %d минута + + %d непрочитана порука + %d непрочитане поруке + %d непрочитаних порука + шаљем… Дешифрујем поруку, сачекајте… ОпенПГП шифрована порука @@ -34,17 +44,20 @@ Модератор Учесник Посетилац + Да ли желите да уклоните %s са вашег списка контаката? Преписке са овим контактом неће бити уклоњене. Желите ли да блокирате поруке од %s? Желите ли да одблокирате %s и допустите им да вам шаљу поруке? Блокирати све контакте од %s? Одблокирати све контакте од %s? Контакт блокиран Блокиран + Да ли желите да уклоните %s са обележивача? Преписке са овим контактом неће бити уклоњене. Региструј нови налог на серверу Промени лозинку на серверу Подели помоћу… Почни преписку Позови контакт + Позови Контакти Контакт Одустани @@ -57,14 +70,25 @@ Сачувај У реду Конверзација се срушила + Слањем контратрага путем свог ИксМПП налога помажете развоју Конверзација. Пошаљи одмах Не питај више + Не могу да се повежем са налогом + Не могу да се повежем са више налога + Тапните овде да бисте управљали вашим налозима Приложи фајл + Контакт није на вашем списку контаката. Желите ли да га додате? Додај контакт испорука није успела + Припремам слику за пренос + Припремам слике за пренос Делим фајлове, сачекајте… Очисти историјат Брисање историјата преписки + Желите ли да обришете све поруке из ове преписке?\n\nУпозорење: Ово неће утицати на поруке складиштене на осталим уређајима или серверима. + Обриши датотеку + Желите ли да обришете ову датотеку?\n\nУпозорење: Ово неће утицати на копије ове датотеке складиштене на осталим уређајима или серверима. + Затвори ову преписку након тога Изаберите уређај Пошаљи нешифровану поруку Пошаљи поруку diff --git a/src/main/res/values-sv/strings.xml b/src/main/res/values-sv/strings.xml index 0f371f3ef..c2947af07 100644 --- a/src/main/res/values-sv/strings.xml +++ b/src/main/res/values-sv/strings.xml @@ -28,7 +28,6 @@ just nu 1 min sedan %d min sedan - %d olästa konversationer skickar… Avkrypterar meddelande. Vänta… OpenPGP-krypterat meddelande diff --git a/src/main/res/values-tr-rTR/strings.xml b/src/main/res/values-tr-rTR/strings.xml index 1868d2dc5..9bf017f74 100644 --- a/src/main/res/values-tr-rTR/strings.xml +++ b/src/main/res/values-tr-rTR/strings.xml @@ -29,7 +29,6 @@ şimdi 1 dakika önce %d dakika önc - %d okunmamış konuşma gönderiyor… İleti deşifre ediliyor. Lütfen bekleyin… OpenPGP şifreli ileti diff --git a/src/main/res/values-uk/strings.xml b/src/main/res/values-uk/strings.xml index 34361619d..1b613aac8 100644 --- a/src/main/res/values-uk/strings.xml +++ b/src/main/res/values-uk/strings.xml @@ -28,7 +28,6 @@ щойно 1 хвилину тому %d хвилин тому - %d непрочитаних розмов відправляю… Розшифровую повідомлення. Зачекайте, будь ласка… Повідомлення зашифроване OpenPGP diff --git a/src/main/res/values-zh-rCN/strings.xml b/src/main/res/values-zh-rCN/strings.xml index 8b9b114aa..eec076f2c 100644 --- a/src/main/res/values-zh-rCN/strings.xml +++ b/src/main/res/values-zh-rCN/strings.xml @@ -29,7 +29,9 @@ 刚刚 1分钟前 %d分钟前 - %d条未读消息 + + %d 未读会话 + 发送中… 正在解密信息。请稍候…… OpenPGP加密的信息 @@ -941,4 +943,5 @@ 邀请到 Conversations 无法解析邀请 服务器不支持生成邀请 + 没有活跃帐户支持此功能 diff --git a/src/main/res/values/about.xml b/src/main/res/values/about.xml index bf3c227b9..5953d543d 100644 --- a/src/main/res/values/about.xml +++ b/src/main/res/values/about.xml @@ -31,7 +31,7 @@ Conversations • the very last word in instant messaging. - \n\nCopyright © 2014-2020 Daniel Gultsch + \n\nCopyright © 2014-2021 Daniel Gultsch \n\nThis program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or @@ -44,6 +44,7 @@ along with this program. If not, see https://www.gnu.org/licenses \n\nDownload the full source code at https://github.com/iNPUTmice/Conversations \n\n\nLibraries + \n\nhttps://webrtc.org\nCopyright (c) 2011, The WebRTC project authors. All rights reserved. (https://webrtc.org/support/license) \n\nhttps://github.com/ypresto/android-transcoder\n(Apache License, Version 2.0) \n\nhttps://www.bouncycastle.org\n(The MIT License (MIT)) \n\nhttps://www.gnu.org/software/libidn\n(Apache License, Version 2.0) diff --git a/src/main/res/values/colors.xml b/src/main/res/values/colors.xml index 37a8fe124..21fb04feb 100644 --- a/src/main/res/values/colors.xml +++ b/src/main/res/values/colors.xml @@ -40,5 +40,8 @@ #c04CAF50 + #fffafafa + #ffe0e0e0 + #ff2196f3 diff --git a/src/main/res/values/strings.xml b/src/main/res/values/strings.xml index 226d4dcc4..78c130ac4 100644 --- a/src/main/res/values/strings.xml +++ b/src/main/res/values/strings.xml @@ -29,7 +29,11 @@ just now 1 min ago %d mins ago - %d unread conversations + + %d unread conversation + %d unread conversations + + sending… Decrypting message. Please wait… OpenPGP encrypted message diff --git a/src/main/res/values/themes.xml b/src/main/res/values/themes.xml index 881a21037..50cda5b34 100644 --- a/src/main/res/values/themes.xml +++ b/src/main/res/values/themes.xml @@ -363,8 +363,8 @@ @color/black - diff --git a/src/playstore/java/eu/siacs/conversations/services/MaintenanceReceiver.java b/src/playstore/java/eu/siacs/conversations/services/MaintenanceReceiver.java index 6eb5172c2..24212cf34 100644 --- a/src/playstore/java/eu/siacs/conversations/services/MaintenanceReceiver.java +++ b/src/playstore/java/eu/siacs/conversations/services/MaintenanceReceiver.java @@ -3,7 +3,6 @@ package eu.siacs.conversations.services; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; -import android.support.v4.content.ContextCompat; import android.util.Log; import com.google.firebase.iid.FirebaseInstanceId; diff --git a/src/playstore/java/eu/siacs/conversations/services/PushManagementService.java b/src/playstore/java/eu/siacs/conversations/services/PushManagementService.java index ae883f524..db1ad6586 100644 --- a/src/playstore/java/eu/siacs/conversations/services/PushManagementService.java +++ b/src/playstore/java/eu/siacs/conversations/services/PushManagementService.java @@ -4,8 +4,7 @@ import android.util.Log; import com.google.android.gms.common.ConnectionResult; import com.google.android.gms.common.GoogleApiAvailability; -import com.google.firebase.iid.FirebaseInstanceId; -import com.google.firebase.iid.InstanceIdResult; +import com.google.firebase.messaging.FirebaseMessaging; import eu.siacs.conversations.Config; import eu.siacs.conversations.R; @@ -55,7 +54,7 @@ public class PushManagementService { e.printStackTrace(); } } else { - Log.d(Config.LOGTAG, a.getJid().asBareJid() + ": failed to enable push. invalid response from app server "+response); + Log.d(Config.LOGTAG, a.getJid().asBareJid() + ": failed to enable push. invalid response from app server " + response); } }); }); @@ -73,18 +72,18 @@ public class PushManagementService { } private void retrieveFcmInstanceToken(final OnGcmInstanceTokenRetrieved instanceTokenRetrieved) { - final FirebaseInstanceId firebaseInstanceId; + final FirebaseMessaging firebaseMessaging; try { - firebaseInstanceId = FirebaseInstanceId.getInstance(); + firebaseMessaging = FirebaseMessaging.getInstance(); } catch (IllegalStateException e) { - Log.d(Config.LOGTAG, "unable to get firebase instance token ",e); + Log.d(Config.LOGTAG, "unable to get firebase instance token ", e); return; } - firebaseInstanceId.getInstanceId().addOnCompleteListener(task -> { + firebaseMessaging.getToken().addOnCompleteListener(task -> { if (!task.isSuccessful()) { Log.d(Config.LOGTAG, "unable to get Firebase instance token", task.getException()); } - final InstanceIdResult result; + final String result; try { result = task.getResult(); } catch (Exception e) { @@ -92,7 +91,7 @@ public class PushManagementService { return; } if (result != null) { - instanceTokenRetrieved.onGcmInstanceTokenRetrieved(result.getToken()); + instanceTokenRetrieved.onGcmInstanceTokenRetrieved(result); } }); diff --git a/src/playstore/java/eu/siacs/conversations/services/PushMessageReceiver.java b/src/playstore/java/eu/siacs/conversations/services/PushMessageReceiver.java index eb6bdf905..f060747a5 100644 --- a/src/playstore/java/eu/siacs/conversations/services/PushMessageReceiver.java +++ b/src/playstore/java/eu/siacs/conversations/services/PushMessageReceiver.java @@ -1,7 +1,6 @@ package eu.siacs.conversations.services; import android.content.Intent; -import android.support.v4.content.ContextCompat; import android.util.Log; import com.google.firebase.messaging.FirebaseMessagingService; diff --git a/src/playstoreCompat/java/eu/siacs/conversations/ui/service/EmojiService.java b/src/playstoreCompat/java/eu/siacs/conversations/ui/service/EmojiService.java index 106d08204..5ed8c100a 100644 --- a/src/playstoreCompat/java/eu/siacs/conversations/ui/service/EmojiService.java +++ b/src/playstoreCompat/java/eu/siacs/conversations/ui/service/EmojiService.java @@ -2,11 +2,12 @@ package eu.siacs.conversations.ui.service; import android.content.Context; import android.os.Build; -import android.support.text.emoji.EmojiCompat; -import android.support.text.emoji.FontRequestEmojiCompatConfig; -import android.support.v4.provider.FontRequest; import android.util.Log; +import androidx.core.provider.FontRequest; +import androidx.emoji.text.EmojiCompat; +import androidx.emoji.text.FontRequestEmojiCompatConfig; + import eu.siacs.conversations.Config; import eu.siacs.conversations.R; diff --git a/src/quicksy/AndroidManifest.xml b/src/quicksy/AndroidManifest.xml index ed68582b3..1c30d2f28 100644 --- a/src/quicksy/AndroidManifest.xml +++ b/src/quicksy/AndroidManifest.xml @@ -32,5 +32,14 @@ android:label="@string/enter_your_name" android:launchMode="singleTask" /> + + + + + + diff --git a/src/quicksy/java/eu/siacs/conversations/android/PhoneNumberContact.java b/src/quicksy/java/eu/siacs/conversations/android/PhoneNumberContact.java index 4515ec299..6afb5a0d7 100644 --- a/src/quicksy/java/eu/siacs/conversations/android/PhoneNumberContact.java +++ b/src/quicksy/java/eu/siacs/conversations/android/PhoneNumberContact.java @@ -9,6 +9,8 @@ import android.os.Build; import android.provider.ContactsContract; import android.util.Log; +import com.google.common.collect.ImmutableMap; + import java.util.Collection; import java.util.Collections; import java.util.HashMap; @@ -20,7 +22,7 @@ import io.michaelrocks.libphonenumber.android.NumberParseException; public class PhoneNumberContact extends AbstractPhoneContact { - private String phoneNumber; + private final String phoneNumber; public String getPhoneNumber() { return phoneNumber; @@ -29,15 +31,15 @@ public class PhoneNumberContact extends AbstractPhoneContact { private PhoneNumberContact(Context context, Cursor cursor) throws IllegalArgumentException { super(cursor); try { - this.phoneNumber = PhoneNumberUtilWrapper.normalize(context,cursor.getString(cursor.getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER))); + this.phoneNumber = PhoneNumberUtilWrapper.normalize(context, cursor.getString(cursor.getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER))); } catch (NumberParseException | NullPointerException e) { throw new IllegalArgumentException(e); } } - public static Map load(Context context) { + public static ImmutableMap load(Context context) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && context.checkSelfPermission(Manifest.permission.READ_CONTACTS) != PackageManager.PERMISSION_GRANTED) { - return Collections.emptyMap(); + return ImmutableMap.of(); } final String[] PROJECTION = new String[]{ContactsContract.Data._ID, ContactsContract.Data.DISPLAY_NAME, @@ -47,8 +49,8 @@ public class PhoneNumberContact extends AbstractPhoneContact { final Cursor cursor; try { cursor = context.getContentResolver().query(ContactsContract.CommonDataKinds.Phone.CONTENT_URI, PROJECTION, null, null, null); - } catch (Exception e) { - return Collections.emptyMap(); + } catch (final Exception e) { + return ImmutableMap.of(); } final HashMap contacts = new HashMap<>(); while (cursor != null && cursor.moveToNext()) { @@ -58,18 +60,18 @@ public class PhoneNumberContact extends AbstractPhoneContact { if (preexisting == null || preexisting.rating() < contact.rating()) { contacts.put(contact.getPhoneNumber(), contact); } - } catch (IllegalArgumentException e) { - Log.d(Config.LOGTAG, "unable to create phone contact"); + } catch (final IllegalArgumentException e) { + Log.d(Config.LOGTAG, e.getMessage()); } } if (cursor != null) { cursor.close(); } - return contacts; + return ImmutableMap.copyOf(contacts); } public static PhoneNumberContact findByUri(Collection haystack, Uri needle) { - for(PhoneNumberContact contact : haystack) { + for (PhoneNumberContact contact : haystack) { if (needle.equals(contact.getLookupUri())) { return contact; } diff --git a/src/quicksy/java/eu/siacs/conversations/services/QuickConversationsService.java b/src/quicksy/java/eu/siacs/conversations/services/QuickConversationsService.java index f8e73b447..05b076424 100644 --- a/src/quicksy/java/eu/siacs/conversations/services/QuickConversationsService.java +++ b/src/quicksy/java/eu/siacs/conversations/services/QuickConversationsService.java @@ -1,12 +1,16 @@ package eu.siacs.conversations.services; +import android.content.Intent; import android.content.SharedPreferences; import android.net.Uri; +import android.os.Bundle; import android.os.SystemClock; import android.preference.PreferenceManager; import android.util.Log; +import com.google.common.collect.ImmutableMap; + import java.io.BufferedWriter; import java.io.IOException; import java.io.OutputStream; @@ -22,6 +26,7 @@ import java.security.cert.CertificateException; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; +import java.util.HashMap; import java.util.List; import java.util.Locale; import java.util.Map; @@ -47,6 +52,7 @@ import eu.siacs.conversations.utils.AccountUtils; import eu.siacs.conversations.utils.CryptoHelper; import eu.siacs.conversations.utils.PhoneNumberUtilWrapper; import eu.siacs.conversations.utils.SerialSingleThreadExecutor; +import eu.siacs.conversations.utils.SmsRetrieverWrapper; import eu.siacs.conversations.xml.Element; import eu.siacs.conversations.xml.Namespace; import eu.siacs.conversations.xmpp.Jid; @@ -122,6 +128,7 @@ public class QuickConversationsService extends AbstractQuickConversationsService public void requestVerification(Phonenumber.PhoneNumber phoneNumber) { final String e164 = PhoneNumberUtilWrapper.normalize(service, phoneNumber); if (mVerificationRequestInProgress.compareAndSet(false, true)) { + SmsRetrieverWrapper.start(service); new Thread(() -> { try { final URL url = new URL(BASE_URL + "/authentication/" + e164); @@ -322,10 +329,36 @@ public class QuickConversationsService extends AbstractQuickConversationsService }); } + @Override + public void handleSmsReceived(final Intent intent) { + final Bundle extras = intent.getExtras(); + final String pin = SmsRetrieverWrapper.extractPin(extras); + if (pin == null) { + Log.d(Config.LOGTAG, "unable to extract Pin from received SMS"); + return; + } + final Account account = AccountUtils.getFirst(service); + if (account == null) { + Log.d(Config.LOGTAG, "no account configured to process PIN received by SMS"); + return; + } + verify(account, pin); + synchronized (mOnVerification) { + for (OnVerification onVerification : mOnVerification) { + onVerification.startBackgroundVerification(pin); + } + } + + } + private void considerSync(boolean forced) { - Map contacts = PhoneNumberContact.load(service); - for (Account account : service.getAccounts()) { + final ImmutableMap allContacts = PhoneNumberContact.load(service); + for (final Account account : service.getAccounts()) { + final Map contacts = filtered(allContacts, account.getJid().getLocal()); + if (contacts.size() < allContacts.size()) { + Log.d(Config.LOGTAG, account.getJid().asBareJid() + ": found own phone number in address book. ignoring..."); + } refresh(account, contacts.values()); if (!considerSync(account, contacts, forced)) { service.syncRoster(account); @@ -333,6 +366,15 @@ public class QuickConversationsService extends AbstractQuickConversationsService } } + @SafeVarargs + private static Map filtered(final Map input, final A... filters) { + final HashMap result = new HashMap<>(input); + for (final A filtered : filters) { + result.remove(filtered); + } + return result; + } + private void refresh(Account account, Collection contacts) { for (Contact contact : account.getRoster().getWithSystemAccounts(PhoneNumberContact.class)) { final Uri uri = contact.getSystemAccount(); @@ -353,7 +395,7 @@ public class QuickConversationsService extends AbstractQuickConversationsService } } - private boolean considerSync(Account account, final Map contacts, final boolean forced) { + private boolean considerSync(final Account account, final Map contacts, final boolean forced) { final int hash = contacts.keySet().hashCode(); Log.d(Config.LOGTAG, account.getJid().asBareJid() + ": consider sync of " + hash); if (!mLastSyncAttempt.retry(hash) && !forced) { @@ -363,14 +405,14 @@ public class QuickConversationsService extends AbstractQuickConversationsService mRunningSyncJobs.incrementAndGet(); final Jid syncServer = Jid.of(API_DOMAIN); Log.d(Config.LOGTAG, account.getJid().asBareJid() + ": sending phone list to " + syncServer); - List entries = new ArrayList<>(); - for (PhoneNumberContact c : contacts.values()) { + final List entries = new ArrayList<>(); + for (final PhoneNumberContact c : contacts.values()) { entries.add(new Element("entry").setAttribute("number", c.getPhoneNumber())); } - IqPacket query = new IqPacket(IqPacket.TYPE.GET); + final IqPacket query = new IqPacket(IqPacket.TYPE.GET); query.setTo(syncServer); - Element book = new Element("phone-book", Namespace.SYNCHRONIZATION).setChildren(entries); - String statusQuo = Entry.statusQuo(contacts.values(), account.getRoster().getWithSystemAccounts(PhoneNumberContact.class)); + final Element book = new Element("phone-book", Namespace.SYNCHRONIZATION).setChildren(entries); + final String statusQuo = Entry.statusQuo(contacts.values(), account.getRoster().getWithSystemAccounts(PhoneNumberContact.class)); book.setAttribute("ver", statusQuo); query.addChild(book); mLastSyncAttempt = Attempt.create(hash); @@ -378,14 +420,14 @@ public class QuickConversationsService extends AbstractQuickConversationsService if (response.getType() == IqPacket.TYPE.RESULT) { final Element phoneBook = response.findChild("phone-book", Namespace.SYNCHRONIZATION); if (phoneBook != null) { - List withSystemAccounts = account.getRoster().getWithSystemAccounts(PhoneNumberContact.class); + final List withSystemAccounts = account.getRoster().getWithSystemAccounts(PhoneNumberContact.class); for (Entry entry : Entry.ofPhoneBook(phoneBook)) { - PhoneNumberContact phoneContact = contacts.get(entry.getNumber()); + final PhoneNumberContact phoneContact = contacts.get(entry.getNumber()); if (phoneContact == null) { continue; } - for (Jid jid : entry.getJids()) { - Contact contact = account.getRoster().getContact(jid); + for (final Jid jid : entry.getJids()) { + final Contact contact = account.getRoster().getContact(jid); final boolean needsCacheClean = contact.setPhoneContact(phoneContact); if (needsCacheClean) { service.getAvatarService().clear(contact); @@ -393,7 +435,7 @@ public class QuickConversationsService extends AbstractQuickConversationsService withSystemAccounts.remove(contact); } } - for (Contact contact : withSystemAccounts) { + for (final Contact contact : withSystemAccounts) { final boolean needsCacheClean = contact.unsetPhoneContact(PhoneNumberContact.class); if (needsCacheClean) { service.getAvatarService().clear(contact); @@ -429,11 +471,13 @@ public class QuickConversationsService extends AbstractQuickConversationsService void onVerificationSucceeded(); void onVerificationRetryAt(long timestamp); + + void startBackgroundVerification(String pin); } private static class Attempt { private final long timestamp; - private int hash; + private final int hash; private static final Attempt NULL = new Attempt(0, 0); diff --git a/src/quicksy/java/eu/siacs/conversations/services/SMSReceiver.java b/src/quicksy/java/eu/siacs/conversations/services/SMSReceiver.java new file mode 100644 index 000000000..f68d51e8c --- /dev/null +++ b/src/quicksy/java/eu/siacs/conversations/services/SMSReceiver.java @@ -0,0 +1,22 @@ +package eu.siacs.conversations.services; + +import android.content.BroadcastReceiver; +import android.content.Context; +import android.content.Intent; +import android.os.Bundle; +import android.preference.PreferenceManager; +import android.util.Log; + +import com.google.common.base.Strings; + +import eu.siacs.conversations.Config; +import eu.siacs.conversations.utils.Compatibility; + +public class SMSReceiver extends BroadcastReceiver { + + @Override + public void onReceive(final Context context, final Intent intent) { + intent.setClass(context, XmppConnectionService.class); + Compatibility.startService(context, intent); + } +} diff --git a/src/quicksy/java/eu/siacs/conversations/ui/ChooseCountryActivity.java b/src/quicksy/java/eu/siacs/conversations/ui/ChooseCountryActivity.java index c17776554..3e1d39db0 100644 --- a/src/quicksy/java/eu/siacs/conversations/ui/ChooseCountryActivity.java +++ b/src/quicksy/java/eu/siacs/conversations/ui/ChooseCountryActivity.java @@ -2,10 +2,10 @@ package eu.siacs.conversations.ui; import android.content.Context; import android.content.Intent; -import android.databinding.DataBindingUtil; +import androidx.databinding.DataBindingUtil; import android.os.Bundle; -import android.support.v7.widget.LinearLayoutManager; -import android.support.v7.widget.Toolbar; +import androidx.recyclerview.widget.LinearLayoutManager; +import androidx.appcompat.widget.Toolbar; import android.text.Editable; import android.text.TextWatcher; import android.view.Menu; diff --git a/src/quicksy/java/eu/siacs/conversations/ui/EnterNameActivity.java b/src/quicksy/java/eu/siacs/conversations/ui/EnterNameActivity.java index 136cb8e31..a15419eba 100644 --- a/src/quicksy/java/eu/siacs/conversations/ui/EnterNameActivity.java +++ b/src/quicksy/java/eu/siacs/conversations/ui/EnterNameActivity.java @@ -1,9 +1,9 @@ package eu.siacs.conversations.ui; import android.content.Intent; -import android.databinding.DataBindingUtil; +import androidx.databinding.DataBindingUtil; import android.os.Bundle; -import android.support.v7.widget.Toolbar; +import androidx.appcompat.widget.Toolbar; import android.view.View; import java.util.concurrent.atomic.AtomicBoolean; diff --git a/src/quicksy/java/eu/siacs/conversations/ui/EnterPhoneNumberActivity.java b/src/quicksy/java/eu/siacs/conversations/ui/EnterPhoneNumberActivity.java index 270be018c..e146ab3be 100644 --- a/src/quicksy/java/eu/siacs/conversations/ui/EnterPhoneNumberActivity.java +++ b/src/quicksy/java/eu/siacs/conversations/ui/EnterPhoneNumberActivity.java @@ -2,9 +2,9 @@ package eu.siacs.conversations.ui; import android.app.AlertDialog; import android.content.Intent; -import android.databinding.DataBindingUtil; +import androidx.databinding.DataBindingUtil; import android.os.Bundle; -import android.support.v7.widget.Toolbar; +import androidx.appcompat.widget.Toolbar; import android.text.Editable; import android.text.Html; import android.text.TextUtils; diff --git a/src/quicksy/java/eu/siacs/conversations/ui/TosActivity.java b/src/quicksy/java/eu/siacs/conversations/ui/TosActivity.java index d38bab7ce..eb2b77d9c 100644 --- a/src/quicksy/java/eu/siacs/conversations/ui/TosActivity.java +++ b/src/quicksy/java/eu/siacs/conversations/ui/TosActivity.java @@ -5,18 +5,14 @@ import android.content.SharedPreferences; import android.content.pm.ActivityInfo; import android.os.Bundle; import android.preference.PreferenceManager; -import android.support.v7.app.ActionBar; -import android.support.v7.app.AppCompatActivity; import android.text.Html; import android.text.method.LinkMovementMethod; import android.widget.Button; import android.widget.TextView; -import java.util.List; +import androidx.appcompat.app.ActionBar; import eu.siacs.conversations.R; -import eu.siacs.conversations.entities.Account; -import eu.siacs.conversations.utils.XmppUri; public class TosActivity extends XmppActivity { @@ -41,6 +37,7 @@ public class TosActivity extends XmppActivity { @Override public void onNewIntent(Intent intent) { + super.onNewIntent(intent); if (intent != null) { setIntent(intent); } diff --git a/src/quicksy/java/eu/siacs/conversations/ui/VerifyActivity.java b/src/quicksy/java/eu/siacs/conversations/ui/VerifyActivity.java index 7dc59845e..1e388ce8f 100644 --- a/src/quicksy/java/eu/siacs/conversations/ui/VerifyActivity.java +++ b/src/quicksy/java/eu/siacs/conversations/ui/VerifyActivity.java @@ -6,12 +6,12 @@ import android.content.ClipDescription; import android.content.ClipboardManager; import android.content.Context; import android.content.Intent; -import android.databinding.DataBindingUtil; +import androidx.databinding.DataBindingUtil; import android.os.Bundle; import android.os.Handler; import android.os.SystemClock; -import android.support.design.widget.Snackbar; -import android.support.v7.widget.Toolbar; +import com.google.android.material.snackbar.Snackbar; +import androidx.appcompat.widget.Toolbar; import android.text.Html; import android.view.View; @@ -246,6 +246,8 @@ public class VerifyActivity extends XmppActivity implements ClipboardManager.OnP public void onResume() { super.onResume(); if (pinEntryWrapper.isEmpty()) { + //starting with Android P we need input focus + pinEntryWrapper.requestFocus(); pastePinFromClipboard(); } } @@ -314,6 +316,12 @@ public class VerifyActivity extends XmppActivity implements ClipboardManager.OnP runOnUiThread(VERIFICATION_TIMEOUT_UPDATER); } + @Override + public void startBackgroundVerification(String pin) { + pinEntryWrapper.setPin(pin); + setVerifyingState(true); + } + //send sms again button callback @Override public void onVerificationRequestFailed(int code) { @@ -327,6 +335,7 @@ public class VerifyActivity extends XmppActivity implements ClipboardManager.OnP @Override public void onVerificationRequested() { runOnUiThread(() -> { + pinEntryWrapper.clear(); setRequestingVerificationState(false); AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setMessage(R.string.we_have_sent_you_another_sms); diff --git a/src/quicksy/java/eu/siacs/conversations/ui/adapter/CountryAdapter.java b/src/quicksy/java/eu/siacs/conversations/ui/adapter/CountryAdapter.java index 266f9e631..adbd07f82 100644 --- a/src/quicksy/java/eu/siacs/conversations/ui/adapter/CountryAdapter.java +++ b/src/quicksy/java/eu/siacs/conversations/ui/adapter/CountryAdapter.java @@ -1,8 +1,8 @@ package eu.siacs.conversations.ui.adapter; -import android.databinding.DataBindingUtil; -import android.support.annotation.NonNull; -import android.support.v7.widget.RecyclerView; +import androidx.databinding.DataBindingUtil; +import androidx.annotation.NonNull; +import androidx.recyclerview.widget.RecyclerView; import android.view.LayoutInflater; import android.view.ViewGroup; diff --git a/src/quicksy/java/eu/siacs/conversations/ui/util/ApiDialogHelper.java b/src/quicksy/java/eu/siacs/conversations/ui/util/ApiDialogHelper.java index 9bd7b2514..6deca9c5b 100644 --- a/src/quicksy/java/eu/siacs/conversations/ui/util/ApiDialogHelper.java +++ b/src/quicksy/java/eu/siacs/conversations/ui/util/ApiDialogHelper.java @@ -7,7 +7,7 @@ import android.content.DialogInterface; import android.content.Intent; import android.net.Uri; import android.os.SystemClock; -import android.support.annotation.StringRes; +import androidx.annotation.StringRes; import eu.siacs.conversations.R; import eu.siacs.conversations.services.QuickConversationsService; diff --git a/src/quicksy/java/eu/siacs/conversations/ui/util/PinEntryWrapper.java b/src/quicksy/java/eu/siacs/conversations/ui/util/PinEntryWrapper.java index 8e91f659d..b0eef9af6 100644 --- a/src/quicksy/java/eu/siacs/conversations/ui/util/PinEntryWrapper.java +++ b/src/quicksy/java/eu/siacs/conversations/ui/util/PinEntryWrapper.java @@ -14,7 +14,7 @@ import java.util.regex.Pattern; public class PinEntryWrapper { - private static Pattern PIN_STRING_PATTERN = Pattern.compile("^[0-9]{6}$"); + private static final Pattern PIN_STRING_PATTERN = Pattern.compile("^[0-9]{6}$"); private final List digits = new ArrayList<>(); @@ -152,4 +152,8 @@ public class PinEntryWrapper { digits.get(i).getText().clear(); } } + + public void requestFocus() { + digits.get(0).requestFocus(); + } } \ No newline at end of file diff --git a/src/quicksy/java/eu/siacs/conversations/utils/PhoneNumberUtilWrapper.java b/src/quicksy/java/eu/siacs/conversations/utils/PhoneNumberUtilWrapper.java index 5f68c2a06..4bc18b886 100644 --- a/src/quicksy/java/eu/siacs/conversations/utils/PhoneNumberUtilWrapper.java +++ b/src/quicksy/java/eu/siacs/conversations/utils/PhoneNumberUtilWrapper.java @@ -37,7 +37,7 @@ public class PhoneNumberUtilWrapper { public static String normalize(Context context, String input) throws IllegalArgumentException, NumberParseException { final Phonenumber.PhoneNumber number = getInstance(context).parse(input, LocationProvider.getUserCountry(context)); if (!getInstance(context).isValidNumber(number)) { - throw new IllegalArgumentException("Not a valid phone number"); + throw new IllegalArgumentException(String.format("%s is not a valid phone number", input)); } return normalize(context, number); } diff --git a/src/quicksy/res/layout/activity_choose_country.xml b/src/quicksy/res/layout/activity_choose_country.xml index 640923c4f..47ba167b1 100644 --- a/src/quicksy/res/layout/activity_choose_country.xml +++ b/src/quicksy/res/layout/activity_choose_country.xml @@ -11,7 +11,7 @@ android:id="@+id/toolbar" layout="@layout/toolbar"/> - - \ No newline at end of file + diff --git a/src/quicksy/res/layout/activity_enter_number.xml b/src/quicksy/res/layout/activity_enter_number.xml index b76faba19..d54ead3bf 100644 --- a/src/quicksy/res/layout/activity_enter_number.xml +++ b/src/quicksy/res/layout/activity_enter_number.xml @@ -10,7 +10,7 @@ android:id="@+id/toolbar" layout="@layout/toolbar" /> - @@ -108,6 +108,6 @@ android:textColor="?colorAccent" /> - + diff --git a/src/quicksy/res/layout/activity_verify.xml b/src/quicksy/res/layout/activity_verify.xml index b46aa0910..4ecc349c1 100644 --- a/src/quicksy/res/layout/activity_verify.xml +++ b/src/quicksy/res/layout/activity_verify.xml @@ -11,7 +11,7 @@ android:id="@+id/toolbar" layout="@layout/toolbar" /> - @@ -188,6 +188,6 @@ android:layout_centerHorizontal="true" /> - + - \ No newline at end of file + diff --git a/src/quicksy/res/values-bg/strings.xml b/src/quicksy/res/values-bg/strings.xml index 6e03fbf87..a923200e4 100644 --- a/src/quicksy/res/values-bg/strings.xml +++ b/src/quicksy/res/values-bg/strings.xml @@ -9,6 +9,8 @@ Изпращайки проследявания на стека, Вие помагате за непрекъснатото развитие на Quicksy Quicksy се нуждае от достъп до външно място за съхранение Quicksy се нуждае от достъп до камерата + Устройството Ви прилага сериозни оптимизации за използването на батерията върху Quicksy, които може да доведат до забавени известия и дори пропуснати съобщения.\nПрепоръчително е да ги изключите. + Устройството Ви прилага сериозни оптимизации за използването на батерията върху Quicksy, които може да доведат до забавени известия и дори пропуснати съобщения.\nСега ще бъдете помолен(а) да ги изключите. Така всичките Ви контакти ще знаят кога използвате Quicksy Операционната Ви система не позволява на Quicksy да се свързва с Интернет когато работи на заден фон. За да получавате известия за новите съобщения, трябва да дадете на Quicksy неограничен достъп когато съхранението на данни е включено.\nQuicksy ще продължи да се опитва да записва данните когато е възможно. Устройството Ви не поддържа изключването на съхранението на данни за Quicksy. @@ -18,4 +20,7 @@ Тази категория известия се използва за показване на постоянно известие, което показва, че Quicksy работи. Профилна снимка за Quicksy Quicksy не може да се използва във Вашата страна. - + Идентичността на сървъра не може да бъде потвърдена. + Неизвестна грешка в сигурността. + Времето за изчакване на сървъра изтече. + diff --git a/src/quicksy/res/values-ca/strings.xml b/src/quicksy/res/values-ca/strings.xml index 28975a804..ec2414dbf 100644 --- a/src/quicksy/res/values-ca/strings.xml +++ b/src/quicksy/res/values-ca/strings.xml @@ -9,6 +9,8 @@ En enviar les traces de les piles, vostè està ajudant al desenvolupament continu de Quicksy Quicksy necessita accés a emmagatzematge extern Quicksy necessita accés a la càmera + El teu dispositiu està emprant optimitzacions de bateria pesada per a Quicksy que poden portar a notificacions retardades o fins i tot a la pèrdua de missatges\nEs recomana desactivar-los. + El teu dispositiu està emprant optimitzacions de bateria pesada per a Quicksy, la qual cosa pot portar a notificacions retardades o fins i tot a la pèrdua de missatges.\n\nAra se\'t demanarà que els desactivis. Avisi a tots els seus contactes quan utilitzi Quicksy El seu sistema operatiu està restringint l\'accés a Internet a Quicksy quan està en segon pla. Per rebre notificacions de nous missatges, ha de permetre l\'accés sense restriccions de Quicksy quan el protector de dades està activat.\nQuicksy farà un esforç per guardar les dades quan sigui possible. El seu dispositiu no és compatible amb la desactivació del protector de dades per Quicksy. @@ -17,4 +19,8 @@ Quicksy necessita accés al micròfon Aquest tipus de notificació s\'utilitza per mostrar una notificació permanent que indica que Quicksy s\'està executant. Imatge de perfil en Quicksy - + Quicksy no està disponible al teu país. + No es pot verificar la identitat del servidor. + Error de seguretat desconegut. + Temps d\'espera mentre es connecta al servidor. + diff --git a/src/quicksy/res/values-id/strings.xml b/src/quicksy/res/values-id/strings.xml new file mode 100644 index 000000000..5d336777b --- /dev/null +++ b/src/quicksy/res/values-id/strings.xml @@ -0,0 +1,26 @@ + + + Quicksy mengalami kegagalan sistem + Dengan mengirimkan data log, Anda membantu pengembangan Quicksy \nPeringatan: Ini akan menggunakan akun XMPP Anda untuk mengirim data log ke pengembang. + Quicksy menggunakan aplikasi pihak ketiga bernama OpenKeychain untuk mengenkripsi dan mendekripsi pesan dan untuk mengelola kunci publik Anda.\n\nOpenKeychain dilisensikan di bawah GPLv3 dan tersedia di F-Droid dan Google Play.\n\n (Harap restart Quicksy instalasi.) + Quicksy tidak dapat mengenkripsi pesan Anda karena kontak Anda tidak mengumumkan kunci publiknya.\n\nMinta kontak Anda untuk setting OpenPGP. + Quicksy tidak dapat mengenkripsi pesan Anda karena kontak-kontak Anda tidak mengumumkan kunci publiknya.\n\nMinta mereka untuk setting OpenPGP. + Durasi Quicksy tetap diam setelah melihat aktivitas di perangkat lain + Dengan mengirimkan data log, Anda sedang membantu pengembangan Quicksy + Quicksy memerlukan akses ke penyimpanan data + Quicksy memerlukan akses ke kamera + Perangkat Anda mengaktifkan fitur pengoptimalan baterai maksimal untuk Quicksy yang dapat menyebabkan notifikasi tertunda atau bahkan kehilangan pesan. \nDisarankan untuk menonaktifkan fiturnya. + Perangkat Anda menggunakan pengoptimalan baterai maksimal untuk Quicksy yang dapat menyebabkan notifikasi tertunda atau bahkan kehilangan pesan. \n\nAnda akan diminta untuk menonaktifkannya. + Ijinkan kontak anda mengetahui kapan anda menggunakan Quicksy + OS Anda membatasi Quicksy untuk mengakses Internet saat berada di latar belakang. Untuk menerima pemberitahuan pesan baru, Anda harus mengizinkan akses tak terbatas Quicksy saat Penghemat data aktif.\nQuicksy berusaha untuk menghemat data jika memungkinkan. + Perangkat Anda tidak mendukung penonaktifan Penghemat data untuk Quicksy. + Untuk tetap menerima notifikasi, bahkan saat layar mati, Anda perlu menambahkan Quicksy ke daftar aplikasi yang dilindungi. + Quicksy tidak dapat mengirim pesan terenkripsi ke %1$s. Ini mungkin karena kontak Anda menggunakan server atau aplikasi usang yang tidak dapat menggunakan OMEMO. + Quicksy memerlukan akses ke mikrofon + Kategori notifikasi ini digunakan untuk menampilkan notifikasi permanen yang menunjukkan bahwa Quicksy sedang berjalan. + Gambar profil Quicksy + Quicksy tidak tersedia di negara anda. + Gagal memverifikasi identitas server + Error keamanan tidak dikenal. + Waktu habis saat menghubungi server. + diff --git a/src/quicksyFree/java/eu/siacs/conversations/utils/SmsRetrieverWrapper.java b/src/quicksyFree/java/eu/siacs/conversations/utils/SmsRetrieverWrapper.java new file mode 100644 index 000000000..e3e6f5a43 --- /dev/null +++ b/src/quicksyFree/java/eu/siacs/conversations/utils/SmsRetrieverWrapper.java @@ -0,0 +1,16 @@ +package eu.siacs.conversations.utils; + +import android.os.Bundle; + +import eu.siacs.conversations.services.XmppConnectionService; + +public class SmsRetrieverWrapper { + + public static void start(XmppConnectionService service) { + //nop + } + + public static String extractPin(Bundle extras) { + return null; + } +} \ No newline at end of file diff --git a/src/quicksyPlaystore/java/eu/siacs/conversations/utils/SmsRetrieverWrapper.java b/src/quicksyPlaystore/java/eu/siacs/conversations/utils/SmsRetrieverWrapper.java new file mode 100644 index 000000000..3aa38ab5f --- /dev/null +++ b/src/quicksyPlaystore/java/eu/siacs/conversations/utils/SmsRetrieverWrapper.java @@ -0,0 +1,40 @@ +package eu.siacs.conversations.utils; + +import android.content.Context; +import android.os.Bundle; +import android.util.Log; + +import com.google.android.gms.auth.api.phone.SmsRetriever; +import com.google.android.gms.auth.api.phone.SmsRetrieverClient; +import com.google.android.gms.common.api.CommonStatusCodes; +import com.google.android.gms.common.api.Status; +import com.google.android.gms.tasks.Task; +import com.google.common.base.Strings; + +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import eu.siacs.conversations.Config; + +public class SmsRetrieverWrapper { + + public static void start(final Context context) { + final SmsRetrieverClient client = SmsRetriever.getClient(context); + final Task task = client.startSmsRetriever(); + task.addOnSuccessListener(aVoid -> Log.d(Config.LOGTAG, "successfully started SMS retriever")); + task.addOnFailureListener(e -> Log.d(Config.LOGTAG, "unable to start SMS retriever", e)); + } + + public static String extractPin(Bundle extras) { + final Status status = extras == null ? null : (Status) extras.get(SmsRetriever.EXTRA_STATUS); + if (status != null && status.getStatusCode() == CommonStatusCodes.SUCCESS) { + Log.d(Config.LOGTAG, "Verification SMS received with status success"); + final String message = extras.getString(SmsRetriever.EXTRA_SMS_MESSAGE); + final Matcher m = Pattern.compile("(?