From 5b48b4027e5e0769af6fd346247844904e3bb806 Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Fri, 15 Jan 2021 10:45:03 +0100 Subject: [PATCH] code clean up --- .../conversations/entities/MucOptions.java | 2 +- .../services/XmppConnectionService.java | 40 +++++++++---------- .../ui/adapter/MessageAdapter.java | 2 +- 3 files changed, 22 insertions(+), 22 deletions(-) diff --git a/src/main/java/eu/siacs/conversations/entities/MucOptions.java b/src/main/java/eu/siacs/conversations/entities/MucOptions.java index 67657159a..83b0c76fb 100644 --- a/src/main/java/eu/siacs/conversations/entities/MucOptions.java +++ b/src/main/java/eu/siacs/conversations/entities/MucOptions.java @@ -37,7 +37,7 @@ public class MucOptions { private final Conversation conversation; public OnRenameListener onRenameListener = null; private boolean mAutoPushConfiguration = true; - private Account account; + private final Account account; private ServiceDiscoveryResult serviceDiscoveryResult; private boolean isOnline = false; private Error error = Error.NONE; diff --git a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java index 0f2423f63..361c1a904 100644 --- a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java +++ b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java @@ -206,21 +206,21 @@ public class XmppConnectionService extends Service { } }; public DatabaseBackend databaseBackend; - private ReplacingSerialSingleThreadExecutor mContactMergerExecutor = new ReplacingSerialSingleThreadExecutor("ContactMerger"); + private final ReplacingSerialSingleThreadExecutor mContactMergerExecutor = new ReplacingSerialSingleThreadExecutor("ContactMerger"); private long mLastActivity = 0; - private FileBackend fileBackend = new FileBackend(this); + private final FileBackend fileBackend = new FileBackend(this); private MemorizingTrustManager mMemorizingTrustManager; - private NotificationService mNotificationService = new NotificationService(this); - private ChannelDiscoveryService mChannelDiscoveryService = new ChannelDiscoveryService(this); - private ShortcutService mShortcutService = new ShortcutService(this); - private AtomicBoolean mInitialAddressbookSyncCompleted = new AtomicBoolean(false); - private AtomicBoolean mForceForegroundService = new AtomicBoolean(false); - private AtomicBoolean mForceDuringOnCreate = new AtomicBoolean(false); - private AtomicReference ongoingCall = new AtomicReference<>(); - private OnMessagePacketReceived mMessageParser = new MessageParser(this); - private OnPresencePacketReceived mPresenceParser = new PresenceParser(this); - private IqParser mIqParser = new IqParser(this); - private MessageGenerator mMessageGenerator = new MessageGenerator(this); + private final NotificationService mNotificationService = new NotificationService(this); + private final ChannelDiscoveryService mChannelDiscoveryService = new ChannelDiscoveryService(this); + private final ShortcutService mShortcutService = new ShortcutService(this); + private final AtomicBoolean mInitialAddressbookSyncCompleted = new AtomicBoolean(false); + private final AtomicBoolean mForceForegroundService = new AtomicBoolean(false); + private final AtomicBoolean mForceDuringOnCreate = new AtomicBoolean(false); + private final AtomicReference ongoingCall = new AtomicReference<>(); + private final OnMessagePacketReceived mMessageParser = new MessageParser(this); + private final OnPresencePacketReceived mPresenceParser = new PresenceParser(this); + private final IqParser mIqParser = new IqParser(this); + private final MessageGenerator mMessageGenerator = new MessageGenerator(this); public OnContactStatusChanged onContactStatusChanged = (contact, online) -> { Conversation conversation = find(getConversations(), contact); if (conversation != null) { @@ -231,14 +231,14 @@ public class XmppConnectionService extends Service { } } }; - private PresenceGenerator mPresenceGenerator = new PresenceGenerator(this); + private final PresenceGenerator mPresenceGenerator = new PresenceGenerator(this); private List accounts; - private JingleConnectionManager mJingleConnectionManager = new JingleConnectionManager(this); - private HttpConnectionManager mHttpConnectionManager = new HttpConnectionManager(this); - private AvatarService mAvatarService = new AvatarService(this); - private MessageArchiveService mMessageArchiveService = new MessageArchiveService(this); - private PushManagementService mPushManagementService = new PushManagementService(this); - private QuickConversationsService mQuickConversationsService = new QuickConversationsService(this); + private final JingleConnectionManager mJingleConnectionManager = new JingleConnectionManager(this); + private final HttpConnectionManager mHttpConnectionManager = new HttpConnectionManager(this); + private final AvatarService mAvatarService = new AvatarService(this); + private final MessageArchiveService mMessageArchiveService = new MessageArchiveService(this); + private final PushManagementService mPushManagementService = new PushManagementService(this); + private final QuickConversationsService mQuickConversationsService = new QuickConversationsService(this); private final ConversationsFileObserver fileObserver = new ConversationsFileObserver( Environment.getExternalStorageDirectory().getAbsolutePath() ) { diff --git a/src/main/java/eu/siacs/conversations/ui/adapter/MessageAdapter.java b/src/main/java/eu/siacs/conversations/ui/adapter/MessageAdapter.java index 2924a07eb..25f0dfe1e 100644 --- a/src/main/java/eu/siacs/conversations/ui/adapter/MessageAdapter.java +++ b/src/main/java/eu/siacs/conversations/ui/adapter/MessageAdapter.java @@ -87,7 +87,7 @@ public class MessageAdapter extends ArrayAdapter { private final XmppActivity activity; private final AudioPlayer audioPlayer; private List highlightedTerm = null; - private DisplayMetrics metrics; + private final DisplayMetrics metrics; private OnContactPictureClicked mOnContactPictureClickedListener; private OnContactPictureLongClicked mOnContactPictureLongClickedListener; private boolean mUseGreenBackground = false;