automated code clean up

This commit is contained in:
Daniel Gultsch 2021-01-23 09:25:34 +01:00
parent 582aee4718
commit 8ce7bfb95e
177 changed files with 641 additions and 611 deletions

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -4,9 +4,10 @@ import android.content.ContentValues;
import android.content.Context; import android.content.Context;
import android.database.Cursor; import android.database.Cursor;
import android.net.Uri; import android.net.Uri;
import androidx.annotation.NonNull;
import android.text.TextUtils; import android.text.TextUtils;
import androidx.annotation.NonNull;
import com.google.common.base.Strings; import com.google.common.base.Strings;
import org.json.JSONArray; import org.json.JSONArray;
@ -28,9 +29,9 @@ import eu.siacs.conversations.services.QuickConversationsService;
import eu.siacs.conversations.utils.JidHelper; import eu.siacs.conversations.utils.JidHelper;
import eu.siacs.conversations.utils.UIHelper; import eu.siacs.conversations.utils.UIHelper;
import eu.siacs.conversations.xml.Element; import eu.siacs.conversations.xml.Element;
import eu.siacs.conversations.xmpp.Jid;
import eu.siacs.conversations.xmpp.jingle.RtpCapability; import eu.siacs.conversations.xmpp.jingle.RtpCapability;
import eu.siacs.conversations.xmpp.pep.Avatar; import eu.siacs.conversations.xmpp.pep.Avatar;
import eu.siacs.conversations.xmpp.Jid;
public class Contact implements ListItem, Blockable { public class Contact implements ListItem, Blockable {
public static final String TABLENAME = "contacts"; public static final String TABLENAME = "contacts";

View file

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

View file

@ -1,8 +1,9 @@
package eu.siacs.conversations.entities; package eu.siacs.conversations.entities;
import android.text.TextUtils;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import android.text.TextUtils;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
@ -17,11 +18,11 @@ import eu.siacs.conversations.services.AvatarService;
import eu.siacs.conversations.services.MessageArchiveService; import eu.siacs.conversations.services.MessageArchiveService;
import eu.siacs.conversations.utils.JidHelper; import eu.siacs.conversations.utils.JidHelper;
import eu.siacs.conversations.utils.UIHelper; import eu.siacs.conversations.utils.UIHelper;
import eu.siacs.conversations.xmpp.Jid;
import eu.siacs.conversations.xmpp.chatstate.ChatState; import eu.siacs.conversations.xmpp.chatstate.ChatState;
import eu.siacs.conversations.xmpp.forms.Data; import eu.siacs.conversations.xmpp.forms.Data;
import eu.siacs.conversations.xmpp.forms.Field; import eu.siacs.conversations.xmpp.forms.Field;
import eu.siacs.conversations.xmpp.pep.Avatar; import eu.siacs.conversations.xmpp.pep.Avatar;
import eu.siacs.conversations.xmpp.Jid;
public class MucOptions { public class MucOptions {
@ -633,8 +634,8 @@ public class MucOptions {
OUTCAST(0, R.string.outcast), OUTCAST(0, R.string.outcast),
NONE(1, R.string.no_affiliation); NONE(1, R.string.no_affiliation);
private int resId; private final int resId;
private int rank; private final int rank;
Affiliation(int rank, int resId) { Affiliation(int rank, int resId) {
this.resId = resId; this.resId = resId;
@ -676,8 +677,8 @@ public class MucOptions {
PARTICIPANT(R.string.participant, 2), PARTICIPANT(R.string.participant, 2),
NONE(R.string.no_role, 0); NONE(R.string.no_role, 0);
private int resId; private final int resId;
private int rank; private final int rank;
Role(int resId, int rank) { Role(int resId, int rank) {
this.resId = resId; this.resId = resId;
@ -744,7 +745,7 @@ public class MucOptions {
private Jid fullJid; private Jid fullJid;
private long pgpKeyId = 0; private long pgpKeyId = 0;
private Avatar avatar; private Avatar avatar;
private MucOptions options; private final MucOptions options;
private ChatState chatState = Config.DEFAULT_CHAT_STATE; private ChatState chatState = Config.DEFAULT_CHAT_STATE;
public User(MucOptions options, Jid fullJid) { public User(MucOptions options, Jid fullJid) {
@ -855,7 +856,7 @@ public class MucOptions {
@Override @Override
public String toString() { public String toString() {
return "[fulljid:" + String.valueOf(fullJid) + ",realjid:" + String.valueOf(realJid) + ",affiliation" + affiliation.toString() + "]"; return "[fulljid:" + fullJid + ",realjid:" + realJid + ",affiliation" + affiliation.toString() + "]";
} }
public boolean realJidMatchesAccount() { public boolean realJidMatchesAccount() {

View file

@ -2,7 +2,6 @@ package eu.siacs.conversations.entities;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import java.lang.Comparable;
import java.util.Locale; import java.util.Locale;
import eu.siacs.conversations.xml.Element; import eu.siacs.conversations.xml.Element;
@ -65,7 +64,7 @@ public class Presence implements Comparable<Presence> {
} }
public int compareTo(@NonNull Presence other) { public int compareTo(@NonNull Presence other) {
return this.status.compareTo(((Presence)other).status); return this.status.compareTo(other.status);
} }
public Status getStatus() { public Status getStatus() {

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -11,11 +11,12 @@ import android.os.SystemClock;
import android.util.Base64; import android.util.Base64;
import android.util.Log; import android.util.Log;
import org.json.JSONException;
import org.json.JSONObject; import org.json.JSONObject;
import org.whispersystems.libsignal.SignalProtocolAddress;
import org.whispersystems.libsignal.IdentityKey; import org.whispersystems.libsignal.IdentityKey;
import org.whispersystems.libsignal.IdentityKeyPair; import org.whispersystems.libsignal.IdentityKeyPair;
import org.whispersystems.libsignal.InvalidKeyException; import org.whispersystems.libsignal.InvalidKeyException;
import org.whispersystems.libsignal.SignalProtocolAddress;
import org.whispersystems.libsignal.state.PreKeyRecord; import org.whispersystems.libsignal.state.PreKeyRecord;
import org.whispersystems.libsignal.state.SessionRecord; import org.whispersystems.libsignal.state.SessionRecord;
import org.whispersystems.libsignal.state.SignedPreKeyRecord; import org.whispersystems.libsignal.state.SignedPreKeyRecord;
@ -36,8 +37,6 @@ import java.util.Set;
import java.util.UUID; import java.util.UUID;
import java.util.concurrent.CopyOnWriteArrayList; import java.util.concurrent.CopyOnWriteArrayList;
import org.json.JSONException;
import eu.siacs.conversations.Config; import eu.siacs.conversations.Config;
import eu.siacs.conversations.crypto.axolotl.AxolotlService; import eu.siacs.conversations.crypto.axolotl.AxolotlService;
import eu.siacs.conversations.crypto.axolotl.FingerprintStatus; import eu.siacs.conversations.crypto.axolotl.FingerprintStatus;
@ -57,8 +56,8 @@ import eu.siacs.conversations.utils.FtsUtils;
import eu.siacs.conversations.utils.MimeUtils; import eu.siacs.conversations.utils.MimeUtils;
import eu.siacs.conversations.utils.Resolver; import eu.siacs.conversations.utils.Resolver;
import eu.siacs.conversations.xmpp.InvalidJid; import eu.siacs.conversations.xmpp.InvalidJid;
import eu.siacs.conversations.xmpp.mam.MamReference;
import eu.siacs.conversations.xmpp.Jid; import eu.siacs.conversations.xmpp.Jid;
import eu.siacs.conversations.xmpp.mam.MamReference;
public class DatabaseBackend extends SQLiteOpenHelper { public class DatabaseBackend extends SQLiteOpenHelper {
@ -107,7 +106,7 @@ public class DatabaseBackend extends SQLiteOpenHelper {
+ ") ON CONFLICT REPLACE" + ") ON CONFLICT REPLACE"
+ ");"; + ");";
private static String CREATE_SIGNED_PREKEYS_STATEMENT = "CREATE TABLE " private static final String CREATE_SIGNED_PREKEYS_STATEMENT = "CREATE TABLE "
+ SQLiteAxolotlStore.SIGNED_PREKEY_TABLENAME + "(" + SQLiteAxolotlStore.SIGNED_PREKEY_TABLENAME + "("
+ SQLiteAxolotlStore.ACCOUNT + " TEXT, " + SQLiteAxolotlStore.ACCOUNT + " TEXT, "
+ SQLiteAxolotlStore.ID + " INTEGER, " + SQLiteAxolotlStore.ID + " INTEGER, "
@ -119,7 +118,7 @@ public class DatabaseBackend extends SQLiteOpenHelper {
+ ") ON CONFLICT REPLACE" + + ") ON CONFLICT REPLACE" +
");"; ");";
private static String CREATE_SESSIONS_STATEMENT = "CREATE TABLE " private static final String CREATE_SESSIONS_STATEMENT = "CREATE TABLE "
+ SQLiteAxolotlStore.SESSION_TABLENAME + "(" + SQLiteAxolotlStore.SESSION_TABLENAME + "("
+ SQLiteAxolotlStore.ACCOUNT + " TEXT, " + SQLiteAxolotlStore.ACCOUNT + " TEXT, "
+ SQLiteAxolotlStore.NAME + " TEXT, " + SQLiteAxolotlStore.NAME + " TEXT, "
@ -133,7 +132,7 @@ public class DatabaseBackend extends SQLiteOpenHelper {
+ ") ON CONFLICT REPLACE" + ") ON CONFLICT REPLACE"
+ ");"; + ");";
private static String CREATE_IDENTITIES_STATEMENT = "CREATE TABLE " private static final String CREATE_IDENTITIES_STATEMENT = "CREATE TABLE "
+ SQLiteAxolotlStore.IDENTITIES_TABLENAME + "(" + SQLiteAxolotlStore.IDENTITIES_TABLENAME + "("
+ SQLiteAxolotlStore.ACCOUNT + " TEXT, " + SQLiteAxolotlStore.ACCOUNT + " TEXT, "
+ SQLiteAxolotlStore.NAME + " TEXT, " + SQLiteAxolotlStore.NAME + " TEXT, "
@ -152,9 +151,9 @@ public class DatabaseBackend extends SQLiteOpenHelper {
+ ") ON CONFLICT IGNORE" + ") ON CONFLICT IGNORE"
+ ");"; + ");";
private static String RESOLVER_RESULTS_TABLENAME = "resolver_results"; private static final String RESOLVER_RESULTS_TABLENAME = "resolver_results";
private static String CREATE_RESOLVER_RESULTS_TABLE = "create table " + RESOLVER_RESULTS_TABLENAME + "(" private static final String CREATE_RESOLVER_RESULTS_TABLE = "create table " + RESOLVER_RESULTS_TABLENAME + "("
+ Resolver.Result.DOMAIN + " TEXT," + Resolver.Result.DOMAIN + " TEXT,"
+ Resolver.Result.HOSTNAME + " TEXT," + Resolver.Result.HOSTNAME + " TEXT,"
+ Resolver.Result.IP + " BLOB," + Resolver.Result.IP + " BLOB,"
@ -165,16 +164,16 @@ public class DatabaseBackend extends SQLiteOpenHelper {
+ "UNIQUE(" + Resolver.Result.DOMAIN + ") ON CONFLICT REPLACE" + "UNIQUE(" + Resolver.Result.DOMAIN + ") ON CONFLICT REPLACE"
+ ");"; + ");";
private static String CREATE_MESSAGE_TIME_INDEX = "create INDEX message_time_index ON " + Message.TABLENAME + "(" + Message.TIME_SENT + ")"; private static final String CREATE_MESSAGE_TIME_INDEX = "create INDEX message_time_index ON " + Message.TABLENAME + "(" + Message.TIME_SENT + ")";
private static String CREATE_MESSAGE_CONVERSATION_INDEX = "create INDEX message_conversation_index ON " + Message.TABLENAME + "(" + Message.CONVERSATION + ")"; private static final String CREATE_MESSAGE_CONVERSATION_INDEX = "create INDEX message_conversation_index ON " + Message.TABLENAME + "(" + Message.CONVERSATION + ")";
private static String CREATE_MESSAGE_DELETED_INDEX = "create index message_deleted_index ON " + Message.TABLENAME + "(" + Message.DELETED + ")"; private static final String CREATE_MESSAGE_DELETED_INDEX = "create index message_deleted_index ON " + Message.TABLENAME + "(" + Message.DELETED + ")";
private static String CREATE_MESSAGE_RELATIVE_FILE_PATH_INDEX = "create INDEX message_file_path_index ON " + Message.TABLENAME + "(" + Message.RELATIVE_FILE_PATH + ")"; private static final String CREATE_MESSAGE_RELATIVE_FILE_PATH_INDEX = "create INDEX message_file_path_index ON " + Message.TABLENAME + "(" + Message.RELATIVE_FILE_PATH + ")";
private static String CREATE_MESSAGE_TYPE_INDEX = "create INDEX message_type_index ON " + Message.TABLENAME + "(" + Message.TYPE + ")"; private static final String CREATE_MESSAGE_TYPE_INDEX = "create INDEX message_type_index ON " + Message.TABLENAME + "(" + Message.TYPE + ")";
private static String CREATE_MESSAGE_INDEX_TABLE = "CREATE VIRTUAL TABLE messages_index USING FTS4(uuid TEXT PRIMARY KEY, body TEXT)"; private static final String CREATE_MESSAGE_INDEX_TABLE = "CREATE VIRTUAL TABLE messages_index USING FTS4(uuid TEXT PRIMARY KEY, body TEXT)";
private static String CREATE_MESSAGE_INSERT_TRIGGER = "CREATE TRIGGER after_message_insert AFTER INSERT ON " + Message.TABLENAME + " BEGIN INSERT INTO messages_index (uuid,body) VALUES (new.uuid,new.body); END;"; private static final String CREATE_MESSAGE_INSERT_TRIGGER = "CREATE TRIGGER after_message_insert AFTER INSERT ON " + Message.TABLENAME + " BEGIN INSERT INTO messages_index (uuid,body) VALUES (new.uuid,new.body); END;";
private static String CREATE_MESSAGE_UPDATE_TRIGGER = "CREATE TRIGGER after_message_update UPDATE of uuid,body ON " + Message.TABLENAME + " BEGIN update messages_index set body=new.body,uuid=new.uuid WHERE uuid=old.uuid; END;"; private static final String CREATE_MESSAGE_UPDATE_TRIGGER = "CREATE TRIGGER after_message_update UPDATE of uuid,body ON " + Message.TABLENAME + " BEGIN update messages_index set body=new.body,uuid=new.uuid WHERE uuid=old.uuid; END;";
private static String COPY_PREEXISTING_ENTRIES = "INSERT into messages_index(uuid,body) select uuid,body FROM " + Message.TABLENAME + ";"; private static final String COPY_PREEXISTING_ENTRIES = "INSERT into messages_index(uuid,body) select uuid,body FROM " + Message.TABLENAME + ";";
private DatabaseBackend(Context context) { private DatabaseBackend(Context context) {
super(context, DATABASE_NAME, null, DATABASE_VERSION); super(context, DATABASE_NAME, null, DATABASE_VERSION);
@ -633,7 +632,7 @@ public class DatabaseBackend extends SQLiteOpenHelper {
continue; continue;
} }
String updateArgs[] = { String[] updateArgs = {
newServer, newServer,
cursor.getString(cursor.getColumnIndex(Account.UUID)), cursor.getString(cursor.getColumnIndex(Account.UUID)),
}; };
@ -872,7 +871,7 @@ public class DatabaseBackend extends SQLiteOpenHelper {
SQLiteDatabase db = this.getReadableDatabase(); SQLiteDatabase db = this.getReadableDatabase();
final String SQL = "select uuid,relativeFilePath from messages where type in (1,2,5) and deleted=0 and "+Message.RELATIVE_FILE_PATH+" is not null and conversationUuid=(select uuid from conversations where accountUuid=? and (contactJid=? or contactJid like ?)) order by timeSent desc"; final String SQL = "select uuid,relativeFilePath from messages where type in (1,2,5) and deleted=0 and "+Message.RELATIVE_FILE_PATH+" is not null and conversationUuid=(select uuid from conversations where accountUuid=? and (contactJid=? or contactJid like ?)) order by timeSent desc";
final String[] args = {account, jid.toString(), jid.toString() + "/%"}; final String[] args = {account, jid.toString(), jid.toString() + "/%"};
Cursor cursor = db.rawQuery(SQL + (limit > 0 ? " limit " + String.valueOf(limit) : ""), args); Cursor cursor = db.rawQuery(SQL + (limit > 0 ? " limit " + limit : ""), args);
List<FilePath> filesPaths = new ArrayList<>(); List<FilePath> filesPaths = new ArrayList<>();
while (cursor.moveToNext()) { while (cursor.moveToNext()) {
filesPaths.add(new FilePath(cursor.getString(0), cursor.getString(1))); filesPaths.add(new FilePath(cursor.getString(0), cursor.getString(1)));
@ -1005,7 +1004,7 @@ public class DatabaseBackend extends SQLiteOpenHelper {
public void readRoster(Roster roster) { public void readRoster(Roster roster) {
SQLiteDatabase db = this.getReadableDatabase(); SQLiteDatabase db = this.getReadableDatabase();
Cursor cursor; Cursor cursor;
String args[] = {roster.getAccount().getUuid()}; String[] args = {roster.getAccount().getUuid()};
cursor = db.query(Contact.TABLENAME, null, Contact.ACCOUNT + "=?", args, null, null, null); cursor = db.query(Contact.TABLENAME, null, Contact.ACCOUNT + "=?", args, null, null, null);
while (cursor.moveToNext()) { while (cursor.moveToNext()) {
roster.initContact(Contact.fromCursor(cursor)); roster.initContact(Contact.fromCursor(cursor));

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -17,6 +17,11 @@ import android.net.Uri;
import android.os.Build; import android.os.Build;
import android.os.SystemClock; import android.os.SystemClock;
import android.preference.PreferenceManager; import android.preference.PreferenceManager;
import android.text.SpannableString;
import android.text.style.StyleSpan;
import android.util.DisplayMetrics;
import android.util.Log;
import androidx.annotation.RequiresApi; import androidx.annotation.RequiresApi;
import androidx.core.app.NotificationCompat; import androidx.core.app.NotificationCompat;
import androidx.core.app.NotificationCompat.BigPictureStyle; import androidx.core.app.NotificationCompat.BigPictureStyle;
@ -26,10 +31,6 @@ import androidx.core.app.Person;
import androidx.core.app.RemoteInput; import androidx.core.app.RemoteInput;
import androidx.core.content.ContextCompat; import androidx.core.content.ContextCompat;
import androidx.core.graphics.drawable.IconCompat; import androidx.core.graphics.drawable.IconCompat;
import android.text.SpannableString;
import android.text.style.StyleSpan;
import android.util.DisplayMetrics;
import android.util.Log;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;

View file

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

View file

@ -460,8 +460,8 @@ public class XmppConnectionService extends Service {
private WakeLock wakeLock; private WakeLock wakeLock;
private PowerManager pm; private PowerManager pm;
private LruCache<String, Bitmap> mBitmapCache; private LruCache<String, Bitmap> mBitmapCache;
private BroadcastReceiver mInternalEventReceiver = new InternalEventReceiver(); private final BroadcastReceiver mInternalEventReceiver = new InternalEventReceiver();
private BroadcastReceiver mInternalScreenEventReceiver = new InternalEventReceiver(); private final BroadcastReceiver mInternalScreenEventReceiver = new InternalEventReceiver();
private static String generateFetchKey(Account account, final Avatar avatar) { private static String generateFetchKey(Account account, final Avatar avatar) {
return account.getJid().asBareJid() + "_" + avatar.owner + "_" + avatar.sha1sum; return account.getJid().asBareJid() + "_" + avatar.owner + "_" + avatar.sha1sum;
@ -800,7 +800,7 @@ public class XmppConnectionService extends Service {
for (Account account : pingCandidates) { for (Account account : pingCandidates) {
final boolean lowTimeout = isInLowPingTimeoutMode(account); final boolean lowTimeout = isInLowPingTimeoutMode(account);
account.getXmppConnection().sendPing(); account.getXmppConnection().sendPing();
Log.d(Config.LOGTAG, account.getJid().asBareJid() + " send ping (action=" + action + ",lowTimeout=" + Boolean.toString(lowTimeout) + ")"); Log.d(Config.LOGTAG, account.getJid().asBareJid() + " send ping (action=" + action + ",lowTimeout=" + lowTimeout + ")");
scheduleWakeUpCall(lowTimeout ? Config.LOW_PING_TIMEOUT : Config.PING_TIMEOUT, account.getUuid().hashCode()); scheduleWakeUpCall(lowTimeout ? Config.LOW_PING_TIMEOUT : Config.PING_TIMEOUT, account.getUuid().hashCode());
} }
} }
@ -1840,7 +1840,7 @@ public class XmppConnectionService extends Service {
} }
}); });
} else { } else {
Log.d(Config.LOGTAG, account.getJid().asBareJid() + ": error publishing bookmarks (retry=" + Boolean.toString(retry) + ") " + response); Log.d(Config.LOGTAG, account.getJid().asBareJid() + ": error publishing bookmarks (retry=" + retry + ") " + response);
} }
}); });
} }

View file

@ -1,7 +1,7 @@
package eu.siacs.conversations.ui; package eu.siacs.conversations.ui;
import android.os.Bundle; import android.os.Bundle;
import android.preference.PreferenceManager;
import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.app.AppCompatActivity;
import eu.siacs.conversations.R; import eu.siacs.conversations.R;

View file

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

View file

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

View file

@ -1,11 +1,12 @@
package eu.siacs.conversations.ui; package eu.siacs.conversations.ui;
import androidx.databinding.DataBindingUtil;
import androidx.annotation.StringRes;
import androidx.appcompat.app.AlertDialog;
import android.view.View; import android.view.View;
import android.widget.Toast; import android.widget.Toast;
import androidx.annotation.StringRes;
import androidx.appcompat.app.AlertDialog;
import androidx.databinding.DataBindingUtil;
import eu.siacs.conversations.R; import eu.siacs.conversations.R;
import eu.siacs.conversations.databinding.DialogBlockContactBinding; import eu.siacs.conversations.databinding.DialogBlockContactBinding;
import eu.siacs.conversations.entities.Blockable; import eu.siacs.conversations.entities.Blockable;

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -2,6 +2,7 @@ package eu.siacs.conversations.ui;
import android.content.Intent; import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.app.AppCompatActivity;

View file

@ -3,29 +3,22 @@ package eu.siacs.conversations.ui;
import android.Manifest; import android.Manifest;
import android.annotation.SuppressLint; import android.annotation.SuppressLint;
import android.app.Activity; import android.app.Activity;
import android.app.FragmentManager;
import android.content.SharedPreferences;
import android.content.pm.PackageManager;
import androidx.databinding.DataBindingUtil;
import android.net.Uri;
import android.os.Build;
import android.preference.PreferenceManager;
import android.provider.MediaStore;
import androidx.annotation.IdRes;
import androidx.annotation.NonNull;
import androidx.annotation.StringRes;
import androidx.appcompat.app.AlertDialog;
import android.app.Fragment; import android.app.Fragment;
import android.app.FragmentManager;
import android.app.PendingIntent; import android.app.PendingIntent;
import android.content.Context; import android.content.Context;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.content.Intent; import android.content.Intent;
import android.content.IntentSender.SendIntentException; import android.content.IntentSender.SendIntentException;
import android.content.SharedPreferences;
import android.content.pm.PackageManager;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler; import android.os.Handler;
import android.os.SystemClock; import android.os.SystemClock;
import androidx.core.view.inputmethod.InputConnectionCompat; import android.preference.PreferenceManager;
import androidx.core.view.inputmethod.InputContentInfoCompat; import android.provider.MediaStore;
import android.text.Editable; import android.text.Editable;
import android.text.TextUtils; import android.text.TextUtils;
import android.util.Log; import android.util.Log;
@ -52,6 +45,14 @@ import android.widget.PopupMenu;
import android.widget.TextView.OnEditorActionListener; import android.widget.TextView.OnEditorActionListener;
import android.widget.Toast; import android.widget.Toast;
import androidx.annotation.IdRes;
import androidx.annotation.NonNull;
import androidx.annotation.StringRes;
import androidx.appcompat.app.AlertDialog;
import androidx.core.view.inputmethod.InputConnectionCompat;
import androidx.core.view.inputmethod.InputContentInfoCompat;
import androidx.databinding.DataBindingUtil;
import com.google.common.base.Optional; import com.google.common.base.Optional;
import java.util.ArrayList; import java.util.ArrayList;
@ -117,6 +118,7 @@ import eu.siacs.conversations.utils.StylingHelper;
import eu.siacs.conversations.utils.TimeFrameUtils; import eu.siacs.conversations.utils.TimeFrameUtils;
import eu.siacs.conversations.utils.UIHelper; import eu.siacs.conversations.utils.UIHelper;
import eu.siacs.conversations.xml.Namespace; import eu.siacs.conversations.xml.Namespace;
import eu.siacs.conversations.xmpp.Jid;
import eu.siacs.conversations.xmpp.XmppConnection; import eu.siacs.conversations.xmpp.XmppConnection;
import eu.siacs.conversations.xmpp.chatstate.ChatState; import eu.siacs.conversations.xmpp.chatstate.ChatState;
import eu.siacs.conversations.xmpp.jingle.AbstractJingleConnection; import eu.siacs.conversations.xmpp.jingle.AbstractJingleConnection;
@ -125,7 +127,6 @@ import eu.siacs.conversations.xmpp.jingle.JingleFileTransferConnection;
import eu.siacs.conversations.xmpp.jingle.Media; import eu.siacs.conversations.xmpp.jingle.Media;
import eu.siacs.conversations.xmpp.jingle.OngoingRtpSession; import eu.siacs.conversations.xmpp.jingle.OngoingRtpSession;
import eu.siacs.conversations.xmpp.jingle.RtpCapability; import eu.siacs.conversations.xmpp.jingle.RtpCapability;
import eu.siacs.conversations.xmpp.Jid;
import static eu.siacs.conversations.ui.XmppActivity.EXTRA_ACCOUNT; import static eu.siacs.conversations.ui.XmppActivity.EXTRA_ACCOUNT;
import static eu.siacs.conversations.ui.XmppActivity.REQUEST_INVITE_TO_CONVERSATION; import static eu.siacs.conversations.ui.XmppActivity.REQUEST_INVITE_TO_CONVERSATION;
@ -848,7 +849,7 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke
case ATTACHMENT_CHOICE_LOCATION: case ATTACHMENT_CHOICE_LOCATION:
double latitude = data.getDoubleExtra("latitude", 0); double latitude = data.getDoubleExtra("latitude", 0);
double longitude = data.getDoubleExtra("longitude", 0); double longitude = data.getDoubleExtra("longitude", 0);
Uri geo = Uri.parse("geo:" + String.valueOf(latitude) + "," + String.valueOf(longitude)); Uri geo = Uri.parse("geo:" + latitude + "," + longitude);
mediaPreviewAdapter.addMediaPreviews(Attachment.of(getActivity(), geo, Attachment.Type.LOCATION)); mediaPreviewAdapter.addMediaPreviews(Attachment.of(getActivity(), geo, Attachment.Type.LOCATION));
toggleInputMethod(); toggleInputMethod();
break; break;
@ -2099,7 +2100,7 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke
} }
stopScrolling(); stopScrolling();
Log.d(Config.LOGTAG, "reInit(hasExtras=" + Boolean.toString(hasExtras) + ")"); Log.d(Config.LOGTAG, "reInit(hasExtras=" + hasExtras + ")");
if (this.conversation.isRead() && hasExtras) { if (this.conversation.isRead() && hasExtras) {
Log.d(Config.LOGTAG, "trimming conversation"); Log.d(Config.LOGTAG, "trimming conversation");
@ -2122,7 +2123,7 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke
refresh(false); refresh(false);
activity.invalidateOptionsMenu(); activity.invalidateOptionsMenu();
this.conversation.messagesLoaded.set(true); this.conversation.messagesLoaded.set(true);
Log.d(Config.LOGTAG, "scrolledToBottomAndNoPending=" + Boolean.toString(scrolledToBottomAndNoPending)); Log.d(Config.LOGTAG, "scrolledToBottomAndNoPending=" + scrolledToBottomAndNoPending);
if (hasExtras || scrolledToBottomAndNoPending) { if (hasExtras || scrolledToBottomAndNoPending) {
resetUnreadMessagesCount(); resetUnreadMessagesCount();

View file

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

View file

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

View file

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

View file

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

View file

@ -6,7 +6,6 @@ import android.content.ActivityNotFoundException;
import android.content.Intent; import android.content.Intent;
import android.content.IntentSender; import android.content.IntentSender;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import androidx.databinding.DataBindingUtil;
import android.graphics.Bitmap; import android.graphics.Bitmap;
import android.net.Uri; import android.net.Uri;
import android.os.Build; import android.os.Build;
@ -16,11 +15,6 @@ import android.preference.PreferenceManager;
import android.provider.Settings; import android.provider.Settings;
import android.security.KeyChain; import android.security.KeyChain;
import android.security.KeyChainAliasCallback; import android.security.KeyChainAliasCallback;
import com.google.android.material.textfield.TextInputLayout;
import androidx.appcompat.app.ActionBar;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AlertDialog.Builder;
import androidx.appcompat.widget.Toolbar;
import android.text.Editable; import android.text.Editable;
import android.text.TextUtils; import android.text.TextUtils;
import android.text.TextWatcher; import android.text.TextWatcher;
@ -34,6 +28,12 @@ import android.widget.EditText;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.Toast; import android.widget.Toast;
import androidx.appcompat.app.ActionBar;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AlertDialog.Builder;
import androidx.databinding.DataBindingUtil;
import com.google.android.material.textfield.TextInputLayout;
import com.google.common.base.CharMatcher; import com.google.common.base.CharMatcher;
import org.openintents.openpgp.util.OpenPgpUtils; import org.openintents.openpgp.util.OpenPgpUtils;
@ -317,7 +317,7 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
} }
}; };
private View.OnFocusChangeListener mEditTextFocusListener = new View.OnFocusChangeListener() { private final View.OnFocusChangeListener mEditTextFocusListener = new View.OnFocusChangeListener() {
@Override @Override
public void onFocusChange(View view, boolean b) { public void onFocusChange(View view, boolean b) {
EditText et = (EditText) view; EditText et = (EditText) view;
@ -597,7 +597,7 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
this.mSavedInstanceInit = savedInstanceState.getBoolean("initMode", false); this.mSavedInstanceInit = savedInstanceState.getBoolean("initMode", false);
} }
this.binding = DataBindingUtil.setContentView(this, R.layout.activity_edit_account); this.binding = DataBindingUtil.setContentView(this, R.layout.activity_edit_account);
setSupportActionBar((Toolbar) binding.toolbar); setSupportActionBar(binding.toolbar);
binding.accountJid.addTextChangedListener(this.mTextWatcher); binding.accountJid.addTextChangedListener(this.mTextWatcher);
binding.accountJid.setOnFocusChangeListener(this.mEditTextFocusListener); binding.accountJid.setOnFocusChangeListener(this.mEditTextFocusListener);
this.binding.accountPassword.addTextChangedListener(this.mTextWatcher); this.binding.accountPassword.addTextChangedListener(this.mTextWatcher);

View file

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

View file

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

View file

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

View file

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

View file

@ -28,9 +28,8 @@ import android.content.DialogInterface;
import android.content.DialogInterface.OnCancelListener; import android.content.DialogInterface.OnCancelListener;
import android.content.DialogInterface.OnClickListener; import android.content.DialogInterface.OnClickListener;
import android.content.Intent; import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle; import android.os.Bundle;
import android.preference.PreferenceManager;
import androidx.appcompat.app.AlertDialog; import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.app.AppCompatActivity;

View file

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

View file

@ -1,17 +1,16 @@
package eu.siacs.conversations.ui; package eu.siacs.conversations.ui;
import androidx.databinding.DataBindingUtil;
import androidx.appcompat.app.AlertDialog;
import android.content.Intent; import android.content.Intent;
import android.view.ContextMenu; import android.view.ContextMenu;
import android.view.MenuItem; import android.view.MenuItem;
import android.view.View; import android.view.View;
import android.widget.CompoundButton; import android.widget.CompoundButton;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import android.widget.Toast; import android.widget.Toast;
import androidx.appcompat.app.AlertDialog;
import androidx.databinding.DataBindingUtil;
import eu.siacs.conversations.Config; import eu.siacs.conversations.Config;
import eu.siacs.conversations.R; import eu.siacs.conversations.R;
import eu.siacs.conversations.crypto.axolotl.FingerprintStatus; import eu.siacs.conversations.crypto.axolotl.FingerprintStatus;
@ -205,7 +204,7 @@ public abstract class OmemoActivity extends XmppActivity {
} }
@Override @Override
public void onRequestPermissionsResult(int requestCode, String permissions[], int[] grantResults) { public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
ScanActivity.onRequestPermissionResult(this, requestCode, grantResults); ScanActivity.onRequestPermissionResult(this, requestCode, grantResults);
} }
} }

View file

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

View file

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

View file

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

View file

@ -7,15 +7,11 @@ import android.content.ActivityNotFoundException;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.pm.PackageManager; import android.content.pm.PackageManager;
import androidx.databinding.DataBindingUtil;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler; import android.os.Handler;
import android.os.PowerManager; import android.os.PowerManager;
import android.os.SystemClock; import android.os.SystemClock;
import androidx.annotation.NonNull;
import androidx.annotation.RequiresApi;
import androidx.annotation.StringRes;
import android.util.Log; import android.util.Log;
import android.util.Rational; import android.util.Rational;
import android.view.Menu; import android.view.Menu;
@ -24,6 +20,11 @@ import android.view.View;
import android.view.WindowManager; import android.view.WindowManager;
import android.widget.Toast; import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.annotation.RequiresApi;
import androidx.annotation.StringRes;
import androidx.databinding.DataBindingUtil;
import com.google.common.base.Optional; import com.google.common.base.Optional;
import com.google.common.base.Preconditions; import com.google.common.base.Preconditions;
import com.google.common.base.Throwables; import com.google.common.base.Throwables;
@ -55,12 +56,12 @@ import eu.siacs.conversations.ui.util.MainThreadExecutor;
import eu.siacs.conversations.utils.PermissionUtils; import eu.siacs.conversations.utils.PermissionUtils;
import eu.siacs.conversations.utils.TimeFrameUtils; import eu.siacs.conversations.utils.TimeFrameUtils;
import eu.siacs.conversations.xml.Namespace; import eu.siacs.conversations.xml.Namespace;
import eu.siacs.conversations.xmpp.Jid;
import eu.siacs.conversations.xmpp.jingle.AbstractJingleConnection; import eu.siacs.conversations.xmpp.jingle.AbstractJingleConnection;
import eu.siacs.conversations.xmpp.jingle.JingleConnectionManager; import eu.siacs.conversations.xmpp.jingle.JingleConnectionManager;
import eu.siacs.conversations.xmpp.jingle.JingleRtpConnection; import eu.siacs.conversations.xmpp.jingle.JingleRtpConnection;
import eu.siacs.conversations.xmpp.jingle.Media; import eu.siacs.conversations.xmpp.jingle.Media;
import eu.siacs.conversations.xmpp.jingle.RtpEndUserState; import eu.siacs.conversations.xmpp.jingle.RtpEndUserState;
import eu.siacs.conversations.xmpp.Jid;
import static eu.siacs.conversations.utils.PermissionUtils.getFirstDenied; import static eu.siacs.conversations.utils.PermissionUtils.getFirstDenied;
import static java.util.Arrays.asList; import static java.util.Arrays.asList;
@ -99,8 +100,8 @@ public class RtpSessionActivity extends XmppActivity implements XmppConnectionSe
private ActivityRtpSessionBinding binding; private ActivityRtpSessionBinding binding;
private PowerManager.WakeLock mProximityWakeLock; private PowerManager.WakeLock mProximityWakeLock;
private Handler mHandler = new Handler(); private final Handler mHandler = new Handler();
private Runnable mTickExecutor = new Runnable() { private final Runnable mTickExecutor = new Runnable() {
@Override @Override
public void run() { public void run() {
updateCallDuration(); updateCallDuration();

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -4,16 +4,14 @@ import android.content.ComponentName;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
import androidx.appcompat.app.ActionBar;
import android.util.Log;
import android.view.View;
import android.view.inputmethod.InputMethodManager; import android.view.inputmethod.InputMethodManager;
import androidx.appcompat.app.ActionBar;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import eu.siacs.conversations.Config;
import eu.siacs.conversations.R; import eu.siacs.conversations.R;
import eu.siacs.conversations.entities.Account; import eu.siacs.conversations.entities.Account;
import eu.siacs.conversations.entities.Contact; import eu.siacs.conversations.entities.Contact;

View file

@ -5,18 +5,18 @@ import android.content.ClipData;
import android.content.ClipboardManager; import android.content.ClipboardManager;
import android.content.ComponentName; import android.content.ComponentName;
import android.content.Intent; import android.content.Intent;
import androidx.databinding.DataBindingUtil;
import android.location.Location; import android.location.Location;
import android.location.LocationListener; import android.location.LocationListener;
import android.net.Uri; import android.net.Uri;
import android.os.Bundle; import android.os.Bundle;
import androidx.annotation.NonNull;
import androidx.appcompat.widget.Toolbar;
import android.view.Menu; import android.view.Menu;
import android.view.MenuItem; import android.view.MenuItem;
import android.view.View; import android.view.View;
import android.widget.Toast; import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.databinding.DataBindingUtil;
import org.osmdroid.util.GeoPoint; import org.osmdroid.util.GeoPoint;
import java.util.HashMap; import java.util.HashMap;
@ -48,7 +48,7 @@ public class ShowLocationActivity extends LocationActivity implements LocationLi
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
this.binding = DataBindingUtil.setContentView(this,R.layout.activity_show_location); this.binding = DataBindingUtil.setContentView(this,R.layout.activity_show_location);
setSupportActionBar((Toolbar) binding.toolbar); setSupportActionBar(binding.toolbar);
configureActionBar(getSupportActionBar()); configureActionBar(getSupportActionBar());
setupMapView(this.binding.map, this.loc); setupMapView(this.binding.map, this.loc);
@ -193,7 +193,7 @@ public class ShowLocationActivity extends LocationActivity implements LocationLi
private void startNavigation() { private void startNavigation() {
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse( startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(
"google.navigation:q=" + "google.navigation:q=" +
String.valueOf(this.loc.getLatitude()) + "," + String.valueOf(this.loc.getLongitude()) this.loc.getLatitude() + "," + this.loc.getLongitude()
))); )));
} }

View file

@ -9,22 +9,9 @@ import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.content.pm.PackageManager; import android.content.pm.PackageManager;
import androidx.databinding.DataBindingUtil;
import android.net.Uri; import android.net.Uri;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.google.android.material.textfield.TextInputLayout;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentTransaction;
import androidx.viewpager.widget.PagerAdapter;
import androidx.viewpager.widget.ViewPager;
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
import androidx.appcompat.app.ActionBar;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.widget.Toolbar;
import android.text.Editable; import android.text.Editable;
import android.text.Html; import android.text.Html;
import android.text.TextWatcher; import android.text.TextWatcher;
@ -50,6 +37,20 @@ import android.widget.Spinner;
import android.widget.TextView; import android.widget.TextView;
import android.widget.Toast; 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.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.List; 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.ui.widget.SwipeRefreshListFragment;
import eu.siacs.conversations.utils.AccountUtils; import eu.siacs.conversations.utils.AccountUtils;
import eu.siacs.conversations.utils.XmppUri; import eu.siacs.conversations.utils.XmppUri;
import eu.siacs.conversations.xmpp.Jid;
import eu.siacs.conversations.xmpp.OnUpdateBlocklist; import eu.siacs.conversations.xmpp.OnUpdateBlocklist;
import eu.siacs.conversations.xmpp.XmppConnection; 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 { public class StartConversationActivity extends XmppActivity implements XmppConnectionService.OnConversationUpdate, OnRosterUpdate, OnUpdateBlocklist, CreatePrivateGroupChatDialog.CreateConferenceDialogListener, JoinConferenceDialog.JoinConferenceDialogListener, SwipeRefreshLayout.OnRefreshListener, CreatePublicChannelDialog.CreatePublicChannelDialogListener {
@ -261,8 +262,7 @@ public class StartConversationActivity extends XmppActivity implements XmppConne
public void onCreate(Bundle savedInstanceState) { public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
this.binding = DataBindingUtil.setContentView(this, R.layout.activity_start_conversation); this.binding = DataBindingUtil.setContentView(this, R.layout.activity_start_conversation);
Toolbar toolbar = (Toolbar) binding.toolbar; setSupportActionBar(binding.toolbar);
setSupportActionBar(toolbar);
configureActionBar(getSupportActionBar()); configureActionBar(getSupportActionBar());
binding.speedDial.inflate(R.menu.start_conversation_fab_submenu); binding.speedDial.inflate(R.menu.start_conversation_fab_submenu);
@ -760,7 +760,7 @@ public class StartConversationActivity extends XmppActivity implements XmppConne
} }
@Override @Override
public void onRequestPermissionsResult(int requestCode, @NonNull String permissions[], @NonNull int[] grantResults) { public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
if (grantResults.length > 0) if (grantResults.length > 0)
if (grantResults[0] == PackageManager.PERMISSION_GRANTED) { if (grantResults[0] == PackageManager.PERMISSION_GRANTED) {
ScanActivity.onRequestPermissionResult(this, requestCode, grantResults); ScanActivity.onRequestPermissionResult(this, requestCode, grantResults);

View file

@ -2,10 +2,7 @@ package eu.siacs.conversations.ui;
import android.app.AlertDialog; import android.app.AlertDialog;
import android.content.Intent; import android.content.Intent;
import androidx.databinding.DataBindingUtil;
import android.os.Bundle; import android.os.Bundle;
import androidx.appcompat.app.ActionBar;
import androidx.appcompat.widget.Toolbar;
import android.util.Log; import android.util.Log;
import android.view.Gravity; import android.view.Gravity;
import android.view.Menu; import android.view.Menu;
@ -14,6 +11,9 @@ import android.view.View;
import android.view.View.OnClickListener; import android.view.View.OnClickListener;
import android.widget.Toast; import android.widget.Toast;
import androidx.appcompat.app.ActionBar;
import androidx.databinding.DataBindingUtil;
import org.whispersystems.libsignal.IdentityKey; import org.whispersystems.libsignal.IdentityKey;
import java.util.ArrayList; 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.CryptoHelper;
import eu.siacs.conversations.utils.IrregularUnicodeDetector; import eu.siacs.conversations.utils.IrregularUnicodeDetector;
import eu.siacs.conversations.utils.XmppUri; import eu.siacs.conversations.utils.XmppUri;
import eu.siacs.conversations.xmpp.OnKeyStatusUpdated;
import eu.siacs.conversations.xmpp.Jid; import eu.siacs.conversations.xmpp.Jid;
import eu.siacs.conversations.xmpp.OnKeyStatusUpdated;
public class TrustKeysActivity extends OmemoActivity implements OnKeyStatusUpdated { public class TrustKeysActivity extends OmemoActivity implements OnKeyStatusUpdated {
@ -55,7 +55,7 @@ public class TrustKeysActivity extends OmemoActivity implements OnKeyStatusUpdat
commitTrusts(); commitTrusts();
finishOk(false); finishOk(false);
}; };
private AtomicBoolean mUseCameraHintShown = new AtomicBoolean(false); private final AtomicBoolean mUseCameraHintShown = new AtomicBoolean(false);
private AxolotlService.FetchStatus lastFetchReport = AxolotlService.FetchStatus.SUCCESS; private AxolotlService.FetchStatus lastFetchReport = AxolotlService.FetchStatus.SUCCESS;
private Toast mUseCameraHintToast = null; private Toast mUseCameraHintToast = null;
private ActivityTrustKeysBinding binding; private ActivityTrustKeysBinding binding;
@ -82,7 +82,7 @@ public class TrustKeysActivity extends OmemoActivity implements OnKeyStatusUpdat
binding.cancelButton.setOnClickListener(mCancelButtonListener); binding.cancelButton.setOnClickListener(mCancelButtonListener);
binding.saveButton.setOnClickListener(mSaveButtonListener); binding.saveButton.setOnClickListener(mSaveButtonListener);
setSupportActionBar((Toolbar) binding.toolbar); setSupportActionBar(binding.toolbar);
configureActionBar(getSupportActionBar()); configureActionBar(getSupportActionBar());
if (savedInstanceState != null) { if (savedInstanceState != null) {
@ -151,7 +151,7 @@ public class TrustKeysActivity extends OmemoActivity implements OnKeyStatusUpdat
} }
} else { } else {
reloadFingerprints(); 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(); Toast.makeText(this, R.string.barcode_does_not_contain_fingerprints_for_this_conversation, Toast.LENGTH_SHORT).show();
} }
populateView(); populateView();
@ -437,7 +437,7 @@ public class TrustKeysActivity extends OmemoActivity implements OnKeyStatusUpdat
synchronized (this.foreignKeysToTrust) { synchronized (this.foreignKeysToTrust) {
for (Jid jid : contactJids) { for (Jid jid : contactJids) {
Map<String, Boolean> fingerprints = foreignKeysToTrust.get(jid); Map<String, Boolean> fingerprints = foreignKeysToTrust.get(jid);
if (hasNoOtherTrustedKeys(jid) && (fingerprints == null || !fingerprints.values().contains(true))) { if (hasNoOtherTrustedKeys(jid) && (fingerprints == null || !fingerprints.containsValue(true))) {
lock(); lock();
return; return;
} }

View file

@ -7,10 +7,11 @@ import android.content.pm.PackageManager;
import android.net.Uri; import android.net.Uri;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import androidx.core.content.ContextCompat;
import androidx.appcompat.app.AppCompatActivity;
import android.widget.Toast; import android.widget.Toast;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.content.ContextCompat;
import com.google.common.base.Strings; import com.google.common.base.Strings;
import java.util.List; import java.util.List;

View file

@ -19,7 +19,6 @@ import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo; import android.content.pm.ResolveInfo;
import android.content.res.Resources; import android.content.res.Resources;
import android.content.res.TypedArray; import android.content.res.TypedArray;
import androidx.databinding.DataBindingUtil;
import android.graphics.Bitmap; import android.graphics.Bitmap;
import android.graphics.Color; import android.graphics.Color;
import android.graphics.Point; import android.graphics.Point;
@ -35,12 +34,6 @@ import android.os.IBinder;
import android.os.PowerManager; import android.os.PowerManager;
import android.os.SystemClock; import android.os.SystemClock;
import android.preference.PreferenceManager; import android.preference.PreferenceManager;
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 android.text.InputType; import android.text.InputType;
import android.util.DisplayMetrics; import android.util.DisplayMetrics;
import android.util.Log; import android.util.Log;
@ -50,6 +43,14 @@ import android.view.View;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.Toast; 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.io.IOException;
import java.lang.ref.WeakReference; import java.lang.ref.WeakReference;
import java.util.ArrayList; 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.AccountUtils;
import eu.siacs.conversations.utils.ExceptionHelper; import eu.siacs.conversations.utils.ExceptionHelper;
import eu.siacs.conversations.utils.ThemeHelper; import eu.siacs.conversations.utils.ThemeHelper;
import eu.siacs.conversations.xmpp.Jid;
import eu.siacs.conversations.xmpp.OnKeyStatusUpdated; import eu.siacs.conversations.xmpp.OnKeyStatusUpdated;
import eu.siacs.conversations.xmpp.OnUpdateBlocklist; import eu.siacs.conversations.xmpp.OnUpdateBlocklist;
import eu.siacs.conversations.xmpp.Jid;
public abstract class XmppActivity extends ActionBarActivity { public abstract class XmppActivity extends ActionBarActivity {
@ -119,12 +120,12 @@ public abstract class XmppActivity extends ActionBarActivity {
}; };
private DisplayMetrics metrics; private DisplayMetrics metrics;
private long mLastUiRefresh = 0; private long mLastUiRefresh = 0;
private Handler mRefreshUiHandler = new Handler(); private final Handler mRefreshUiHandler = new Handler();
private Runnable mRefreshUiRunnable = () -> { private final Runnable mRefreshUiRunnable = () -> {
mLastUiRefresh = SystemClock.elapsedRealtime(); mLastUiRefresh = SystemClock.elapsedRealtime();
refreshUiReal(); refreshUiReal();
}; };
private UiCallback<Conversation> adhocCallback = new UiCallback<Conversation>() { private final UiCallback<Conversation> adhocCallback = new UiCallback<Conversation>() {
@Override @Override
public void success(final Conversation conversation) { public void success(final Conversation conversation) {
runOnUiThread(() -> { runOnUiThread(() -> {
@ -913,7 +914,7 @@ public abstract class XmppActivity extends ActionBarActivity {
public static class ConferenceInvite { public static class ConferenceInvite {
private String uuid; private String uuid;
private List<Jid> jids = new ArrayList<>(); private final List<Jid> jids = new ArrayList<>();
public static ConferenceInvite parse(Intent data) { public static ConferenceInvite parse(Intent data) {
ConferenceInvite invite = new ConferenceInvite(); ConferenceInvite invite = new ConferenceInvite();

View file

@ -1,13 +1,13 @@
package eu.siacs.conversations.ui.adapter; package eu.siacs.conversations.ui.adapter;
import androidx.databinding.DataBindingUtil;
import androidx.annotation.NonNull;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.ArrayAdapter; import android.widget.ArrayAdapter;
import androidx.annotation.NonNull;
import androidx.databinding.DataBindingUtil;
import java.util.List; import java.util.List;
import eu.siacs.conversations.Config; import eu.siacs.conversations.Config;
@ -20,8 +20,8 @@ import eu.siacs.conversations.ui.util.StyledAttributes;
public class AccountAdapter extends ArrayAdapter<Account> { public class AccountAdapter extends ArrayAdapter<Account> {
private XmppActivity activity; private final XmppActivity activity;
private boolean showStateButton; private final boolean showStateButton;
public AccountAdapter(XmppActivity activity, List<Account> objects, boolean showStateButton) { public AccountAdapter(XmppActivity activity, List<Account> objects, boolean showStateButton) {
super(activity, 0, objects); super(activity, 0, objects);

View file

@ -1,17 +1,18 @@
package eu.siacs.conversations.ui.adapter; package eu.siacs.conversations.ui.adapter;
import android.app.Activity; import android.app.Activity;
import androidx.databinding.DataBindingUtil;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.ListAdapter;
import androidx.recyclerview.widget.DiffUtil;
import androidx.recyclerview.widget.RecyclerView;
import android.text.TextUtils; import android.text.TextUtils;
import android.view.ContextMenu; import android.view.ContextMenu;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; 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 java.util.Locale;
import eu.siacs.conversations.R; import eu.siacs.conversations.R;

View file

@ -1,14 +1,15 @@
package eu.siacs.conversations.ui.adapter; package eu.siacs.conversations.ui.adapter;
import androidx.databinding.DataBindingUtil;
import android.graphics.Typeface; import android.graphics.Typeface;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import android.util.Pair; import android.util.Pair;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import androidx.annotation.NonNull;
import androidx.databinding.DataBindingUtil;
import androidx.recyclerview.widget.RecyclerView;
import com.google.common.base.Optional; import com.google.common.base.Optional;
import java.util.List; 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.EmojiWrapper;
import eu.siacs.conversations.utils.IrregularUnicodeDetector; import eu.siacs.conversations.utils.IrregularUnicodeDetector;
import eu.siacs.conversations.utils.UIHelper; import eu.siacs.conversations.utils.UIHelper;
import eu.siacs.conversations.xmpp.jingle.OngoingRtpSession;
import eu.siacs.conversations.xmpp.Jid; import eu.siacs.conversations.xmpp.Jid;
import eu.siacs.conversations.xmpp.jingle.OngoingRtpSession;
public class ConversationAdapter extends RecyclerView.Adapter<ConversationAdapter.ConversationViewHolder> { public class ConversationAdapter extends RecyclerView.Adapter<ConversationAdapter.ConversationViewHolder> {
private XmppActivity activity; private final XmppActivity activity;
private List<Conversation> conversations; private final List<Conversation> conversations;
private OnConversationClickListener listener; private OnConversationClickListener listener;
public ConversationAdapter(XmppActivity activity, List<Conversation> conversations) { public ConversationAdapter(XmppActivity activity, List<Conversation> conversations) {

View file

@ -1,10 +1,11 @@
package eu.siacs.conversations.ui.adapter; package eu.siacs.conversations.ui.adapter;
import android.content.Context; import android.content.Context;
import androidx.annotation.NonNull;
import android.widget.ArrayAdapter; import android.widget.ArrayAdapter;
import android.widget.Filter; import android.widget.Filter;
import androidx.annotation.NonNull;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.Collections; import java.util.Collections;
@ -15,10 +16,10 @@ import eu.siacs.conversations.Config;
public class KnownHostsAdapter extends ArrayAdapter<String> { public class KnownHostsAdapter extends ArrayAdapter<String> {
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<String> domains; private ArrayList<String> domains;
private Filter domainFilter = new Filter() { private final Filter domainFilter = new Filter() {
@Override @Override
protected FilterResults performFiltering(CharSequence constraint) { protected FilterResults performFiltering(CharSequence constraint) {

View file

@ -1,7 +1,6 @@
package eu.siacs.conversations.ui.adapter; package eu.siacs.conversations.ui.adapter;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import androidx.databinding.DataBindingUtil;
import android.preference.PreferenceManager; import android.preference.PreferenceManager;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
@ -10,6 +9,8 @@ import android.widget.ArrayAdapter;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.TextView; import android.widget.TextView;
import androidx.databinding.DataBindingUtil;
import com.wefika.flowlayout.FlowLayout; import com.wefika.flowlayout.FlowLayout;
import java.util.List; import java.util.List;
@ -30,7 +31,7 @@ public class ListItemAdapter extends ArrayAdapter<ListItem> {
protected XmppActivity activity; protected XmppActivity activity;
private boolean showDynamicTags = false; private boolean showDynamicTags = false;
private OnTagClickedListener mOnTagClickedListener = null; private OnTagClickedListener mOnTagClickedListener = null;
private View.OnClickListener onTagTvClick = view -> { private final View.OnClickListener onTagTvClick = view -> {
if (view instanceof TextView && mOnTagClickedListener != null) { if (view instanceof TextView && mOnTagClickedListener != null) {
TextView tv = (TextView) view; TextView tv = (TextView) view;
final String tag = tv.getText().toString(); final String tag = tv.getText().toString();

View file

@ -2,20 +2,21 @@ package eu.siacs.conversations.ui.adapter;
import android.content.Context; import android.content.Context;
import android.content.res.Resources; import android.content.res.Resources;
import androidx.databinding.DataBindingUtil;
import android.graphics.Bitmap; import android.graphics.Bitmap;
import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.os.AsyncTask; import android.os.AsyncTask;
import androidx.annotation.AttrRes;
import androidx.annotation.DimenRes;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import android.util.Log; import android.util.Log;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.ImageView; 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.lang.ref.WeakReference;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;

View file

@ -4,19 +4,20 @@ import android.content.ActivityNotFoundException;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.res.Resources; import android.content.res.Resources;
import androidx.databinding.DataBindingUtil;
import android.graphics.Bitmap; import android.graphics.Bitmap;
import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.net.Uri; import android.net.Uri;
import android.os.AsyncTask; import android.os.AsyncTask;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.Toast; import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.databinding.DataBindingUtil;
import androidx.recyclerview.widget.RecyclerView;
import java.lang.ref.WeakReference; import java.lang.ref.WeakReference;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;

View file

@ -7,8 +7,6 @@ import android.content.SharedPreferences;
import android.content.pm.PackageManager; import android.content.pm.PackageManager;
import android.graphics.Typeface; import android.graphics.Typeface;
import android.preference.PreferenceManager; import android.preference.PreferenceManager;
import androidx.core.app.ActivityCompat;
import androidx.core.content.ContextCompat;
import android.text.Spannable; import android.text.Spannable;
import android.text.SpannableString; import android.text.SpannableString;
import android.text.SpannableStringBuilder; import android.text.SpannableStringBuilder;
@ -28,6 +26,9 @@ import android.widget.RelativeLayout;
import android.widget.TextView; import android.widget.TextView;
import android.widget.Toast; import android.widget.Toast;
import androidx.core.app.ActivityCompat;
import androidx.core.content.ContextCompat;
import com.google.common.base.Strings; import com.google.common.base.Strings;
import java.net.URL; import java.net.URL;

View file

@ -30,10 +30,11 @@
package eu.siacs.conversations.ui.adapter; package eu.siacs.conversations.ui.adapter;
import android.content.Context; import android.content.Context;
import androidx.annotation.NonNull;
import android.widget.ArrayAdapter; import android.widget.ArrayAdapter;
import android.widget.Filter; import android.widget.Filter;
import androidx.annotation.NonNull;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Locale; import java.util.Locale;

View file

@ -2,16 +2,17 @@ package eu.siacs.conversations.ui.adapter;
import android.app.PendingIntent; import android.app.PendingIntent;
import android.content.IntentSender; import android.content.IntentSender;
import androidx.databinding.DataBindingUtil;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.ListAdapter;
import androidx.recyclerview.widget.DiffUtil;
import androidx.recyclerview.widget.RecyclerView;
import android.view.ContextMenu; import android.view.ContextMenu;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; 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 org.openintents.openpgp.util.OpenPgpUtils;
import eu.siacs.conversations.R; import eu.siacs.conversations.R;

View file

@ -1,14 +1,15 @@
package eu.siacs.conversations.ui.adapter; package eu.siacs.conversations.ui.adapter;
import androidx.databinding.DataBindingUtil;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.ListAdapter;
import androidx.recyclerview.widget.RecyclerView;
import android.view.ContextMenu; import android.view.ContextMenu;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; 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.R;
import eu.siacs.conversations.databinding.UserPreviewBinding; import eu.siacs.conversations.databinding.UserPreviewBinding;
import eu.siacs.conversations.entities.MucOptions; import eu.siacs.conversations.entities.MucOptions;

View file

@ -16,7 +16,7 @@ public class FormBooleanFieldWrapper extends FormFieldWrapper {
protected FormBooleanFieldWrapper(Context context, Field field) { protected FormBooleanFieldWrapper(Context context, Field field) {
super(context, field); super(context, field);
checkBox = (CheckBox) view.findViewById(R.id.field); checkBox = view.findViewById(R.id.field);
checkBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { checkBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override @Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
@ -28,7 +28,7 @@ public class FormBooleanFieldWrapper extends FormFieldWrapper {
@Override @Override
protected void setLabel(String label, boolean required) { 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)); checkBox.setText(createSpannableLabelString(label, required));
} }

View file

@ -6,8 +6,8 @@ import android.text.InputType;
import java.util.List; import java.util.List;
import eu.siacs.conversations.R; import eu.siacs.conversations.R;
import eu.siacs.conversations.xmpp.forms.Field;
import eu.siacs.conversations.xmpp.Jid; import eu.siacs.conversations.xmpp.Jid;
import eu.siacs.conversations.xmpp.forms.Field;
public class FormJidSingleFieldWrapper extends FormTextFieldWrapper { public class FormJidSingleFieldWrapper extends FormTextFieldWrapper {
@ -34,7 +34,7 @@ public class FormJidSingleFieldWrapper extends FormTextFieldWrapper {
@Override @Override
protected void setValues(List<String> values) { protected void setValues(List<String> values) {
StringBuilder builder = new StringBuilder(""); StringBuilder builder = new StringBuilder();
for(String value : values) { for(String value : values) {
builder.append(value); builder.append(value);
} }

View file

@ -19,7 +19,7 @@ public class FormTextFieldWrapper extends FormFieldWrapper {
protected FormTextFieldWrapper(Context context, Field field) { protected FormTextFieldWrapper(Context context, Field field) {
super(context, field); super(context, field);
editText = (EditText) view.findViewById(R.id.field); editText = view.findViewById(R.id.field);
editText.setSingleLine(!"text-multi".equals(field.getType())); editText.setSingleLine(!"text-multi".equals(field.getType()));
if ("text-private".equals(field.getType())) { if ("text-private".equals(field.getType())) {
editText.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD); editText.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD);
@ -43,7 +43,7 @@ public class FormTextFieldWrapper extends FormFieldWrapper {
@Override @Override
protected void setLabel(String label, boolean required) { 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)); textView.setText(createSpannableLabelString(label, required));
} }
@ -64,7 +64,7 @@ public class FormTextFieldWrapper extends FormFieldWrapper {
@Override @Override
protected void setValues(List<String> values) { protected void setValues(List<String> values) {
StringBuilder builder = new StringBuilder(""); StringBuilder builder = new StringBuilder();
for(int i = 0; i < values.size(); ++i) { for(int i = 0; i < values.size(); ++i) {
builder.append(values.get(i)); builder.append(values.get(i));
if (i < values.size() - 1 && "text-multi".equals(field.getType())) { if (i < values.size() - 1 && "text-multi".equals(field.getType())) {

View file

@ -12,8 +12,6 @@ import android.media.AudioManager;
import android.os.Build; import android.os.Build;
import android.os.Handler; import android.os.Handler;
import android.os.PowerManager; import android.os.PowerManager;
import androidx.core.app.ActivityCompat;
import androidx.core.content.ContextCompat;
import android.util.Log; import android.util.Log;
import android.view.View; import android.view.View;
import android.widget.ImageButton; import android.widget.ImageButton;
@ -21,6 +19,9 @@ import android.widget.RelativeLayout;
import android.widget.SeekBar; import android.widget.SeekBar;
import android.widget.TextView; import android.widget.TextView;
import androidx.core.app.ActivityCompat;
import androidx.core.content.ContextCompat;
import java.lang.ref.WeakReference; import java.lang.ref.WeakReference;
import java.util.Locale; import java.util.Locale;
import java.util.concurrent.ExecutorService; import java.util.concurrent.ExecutorService;

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