diff options
22 files changed, 70 insertions, 72 deletions
diff --git a/src/main/java/de/pixart/messenger/ui/ChannelDiscoveryActivity.java b/src/main/java/de/pixart/messenger/ui/ChannelDiscoveryActivity.java index 23c8da480..6c2a5c562 100644 --- a/src/main/java/de/pixart/messenger/ui/ChannelDiscoveryActivity.java +++ b/src/main/java/de/pixart/messenger/ui/ChannelDiscoveryActivity.java @@ -1,6 +1,5 @@ package de.pixart.messenger.ui; -import android.app.AlertDialog; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; @@ -17,6 +16,7 @@ import android.view.inputmethod.InputMethodManager; import android.widget.EditText; import android.widget.TextView; +import androidx.appcompat.app.AlertDialog; import androidx.appcompat.widget.Toolbar; import androidx.databinding.DataBindingUtil; @@ -224,7 +224,7 @@ public class ChannelDiscoveryActivity extends XmppActivity implements MenuItem.O joinChannelSearchResult(accounts.get(0), result); } else if (accounts.size() > 0) { final AtomicReference<String> account = new AtomicReference<>(accounts.get(0)); - AlertDialog.Builder builder = new AlertDialog.Builder(this); + final AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle(R.string.choose_account); builder.setSingleChoiceItems(accounts.toArray(new CharSequence[0]), 0, (dialog, which) -> account.set(accounts.get(which))); builder.setPositiveButton(R.string.join, (dialog, which) -> joinChannelSearchResult(account.get(), result)); diff --git a/src/main/java/de/pixart/messenger/ui/ConferenceDetailsActivity.java b/src/main/java/de/pixart/messenger/ui/ConferenceDetailsActivity.java index d11b6ccdf..87207b0cd 100644 --- a/src/main/java/de/pixart/messenger/ui/ConferenceDetailsActivity.java +++ b/src/main/java/de/pixart/messenger/ui/ConferenceDetailsActivity.java @@ -115,7 +115,7 @@ public class ConferenceDetailsActivity extends XmppActivity implements OnConvers private OnClickListener mNotifyStatusClickListener = new OnClickListener() { @Override public void onClick(View v) { - AlertDialog.Builder builder = new AlertDialog.Builder(ConferenceDetailsActivity.this); + final AlertDialog.Builder builder = new AlertDialog.Builder(ConferenceDetailsActivity.this); builder.setTitle(R.string.pref_notification_settings); String[] choices = { getString(R.string.notify_on_all_messages), @@ -132,7 +132,7 @@ public class ConferenceDetailsActivity extends XmppActivity implements OnConvers builder.setNegativeButton(R.string.cancel, null); builder.setPositiveButton(R.string.ok, (dialog, which) -> { if (choice.get() == 2) { - AlertDialog.Builder builder1 = new AlertDialog.Builder(ConferenceDetailsActivity.this); + final AlertDialog.Builder builder1 = new AlertDialog.Builder(ConferenceDetailsActivity.this); builder1.setTitle(R.string.disable_notifications); final int[] durations = getResources().getIntArray(R.array.mute_options_durations); final CharSequence[] labels = new CharSequence[durations.length]; @@ -170,14 +170,14 @@ public class ConferenceDetailsActivity extends XmppActivity implements OnConvers @Override public void onClick(View v) { final MucOptions mucOptions = mConversation.getMucOptions(); - AlertDialog.Builder builder = new AlertDialog.Builder(ConferenceDetailsActivity.this); + final AlertDialog.Builder builder = new AlertDialog.Builder(ConferenceDetailsActivity.this); MucConfiguration configuration = MucConfiguration.get(ConferenceDetailsActivity.this, mAdvancedMode, mucOptions); builder.setTitle(configuration.title); final boolean[] values = configuration.values; builder.setMultiChoiceItems(configuration.names, values, (dialog, which, isChecked) -> values[which] = isChecked); builder.setNegativeButton(R.string.cancel, null); builder.setPositiveButton(R.string.confirm, (dialog, which) -> { - Bundle options = configuration.toBundle(values); + final Bundle options = configuration.toBundle(values); options.putString("muc#roomconfig_persistentroom", "1"); xmppConnectionService.pushConferenceConfiguration(mConversation, options, diff --git a/src/main/java/de/pixart/messenger/ui/ContactDetailsActivity.java b/src/main/java/de/pixart/messenger/ui/ContactDetailsActivity.java index 7c2ce1220..75d60baba 100644 --- a/src/main/java/de/pixart/messenger/ui/ContactDetailsActivity.java +++ b/src/main/java/de/pixart/messenger/ui/ContactDetailsActivity.java @@ -156,15 +156,14 @@ public class ContactDetailsActivity extends OmemoActivity implements OnAccountUp public void onClick(View v) { Uri systemAccount = contact.getSystemAccount(); if (systemAccount == null) { - AlertDialog.Builder builder = new AlertDialog.Builder( - ContactDetailsActivity.this); + final AlertDialog.Builder builder = new AlertDialog.Builder(ContactDetailsActivity.this); builder.setTitle(getString(R.string.action_add_phone_book)); builder.setMessage(getString(R.string.add_phone_book_text, contact.getJid().toString())); builder.setNegativeButton(getString(R.string.cancel), null); builder.setPositiveButton(getString(R.string.add), addToPhonebook); builder.create().show(); } else { - Intent intent = new Intent(Intent.ACTION_VIEW); + final Intent intent = new Intent(Intent.ACTION_VIEW); intent.setData(systemAccount); try { startActivity(intent); @@ -179,7 +178,7 @@ public class ContactDetailsActivity extends OmemoActivity implements OnAccountUp private OnClickListener mNotifyStatusClickListener = new OnClickListener() { @Override public void onClick(View v) { - AlertDialog.Builder builder = new AlertDialog.Builder(ContactDetailsActivity.this); + final AlertDialog.Builder builder = new AlertDialog.Builder(ContactDetailsActivity.this); builder.setTitle(R.string.pref_notification_settings); String[] choices = { getString(R.string.notify_on_all_messages), @@ -195,7 +194,7 @@ public class ContactDetailsActivity extends OmemoActivity implements OnAccountUp builder.setNegativeButton(R.string.cancel, null); builder.setPositiveButton(R.string.ok, (DialogInterface.OnClickListener) (dialog, which) -> { if (choice.get() == 1) { - AlertDialog.Builder builder1 = new AlertDialog.Builder(ContactDetailsActivity.this); + final AlertDialog.Builder builder1 = new AlertDialog.Builder(ContactDetailsActivity.this); builder1.setTitle(R.string.disable_notifications); final int[] durations = getResources().getIntArray(R.array.mute_options_durations); final CharSequence[] labels = new CharSequence[durations.length]; @@ -673,7 +672,7 @@ public class ContactDetailsActivity extends OmemoActivity implements OnAccountUp } protected void confirmToDeleteFingerprint(final String fingerprint) { - AlertDialog.Builder builder = new AlertDialog.Builder(this); + final AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle(R.string.delete_fingerprint); builder.setMessage(R.string.sure_delete_fingerprint); builder.setNegativeButton(R.string.cancel, null); diff --git a/src/main/java/de/pixart/messenger/ui/ConversationFragment.java b/src/main/java/de/pixart/messenger/ui/ConversationFragment.java index 16ab1f0a6..9ab0f50fc 100644 --- a/src/main/java/de/pixart/messenger/ui/ConversationFragment.java +++ b/src/main/java/de/pixart/messenger/ui/ConversationFragment.java @@ -1446,7 +1446,7 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke activity.xmppConnectionService.archiveConversation(conversation); } else { activity.runOnUiThread(() -> { - AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); + final AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); builder.setTitle(getString(R.string.action_end_conversation_muc)); builder.setMessage(getString(R.string.leave_conference_warning)); builder.setNegativeButton(getString(R.string.cancel), null); @@ -1719,7 +1719,7 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke @SuppressLint("InflateParams") protected void clearHistoryDialog(final Conversation conversation) { - AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); + final AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); builder.setTitle(getString(R.string.clear_conversation_history)); final View dialogView = getActivity().getLayoutInflater().inflate(R.layout.dialog_clear_history, null); final CheckBox endConversationCheckBox = dialogView.findViewById(R.id.end_conversation_checkbox); @@ -1878,7 +1878,7 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke } private void showErrorMessage(final Message message) { - AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); + final AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); builder.setTitle(R.string.error_message); final String errorMessage = message.getErrorMessage(); final String[] errorMessageParts = errorMessage == null ? new String[0] : errorMessage.split("\\u001f"); @@ -1905,7 +1905,7 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke while (relevantForCorrection.mergeable(relevantForCorrection.next())) { relevantForCorrection = relevantForCorrection.next(); } - AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); + final AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); builder.setNegativeButton(R.string.cancel, null); builder.setTitle(R.string.delete_message_dialog); builder.setMessage(R.string.delete_message_dialog_msg); @@ -1934,7 +1934,7 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke } private void deleteFile(final Message message) { - AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); + final AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); builder.setNegativeButton(R.string.cancel, null); builder.setTitle(R.string.delete_file_dialog); builder.setMessage(R.string.delete_file_dialog_msg); @@ -2286,7 +2286,7 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke private void hasWriteAccessInMUC() { if ((conversation.getMode() == Conversation.MODE_MULTI && !conversation.getMucOptions().participating()) && !activity.xmppConnectionService.hideYouAreNotParticipating()) { activity.runOnUiThread(() -> { - AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); + final AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); builder.setTitle(getString(R.string.you_are_not_participating)); builder.setMessage(getString(R.string.no_write_access_in_public_muc)); builder.setNegativeButton(getString(R.string.hide_warning), @@ -2548,7 +2548,7 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke @Override public void onClick(View v) { activity.runOnUiThread(() -> { - AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); + final AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); builder.setTitle(getString(R.string.message_encryption)); builder.setMessage(getString(R.string.enable_message_encryption)); builder.setNegativeButton(getString(R.string.cancel), null); @@ -2893,7 +2893,7 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke } public void showNoPGPKeyDialog(boolean plural, DialogInterface.OnClickListener listener) { - AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); + final AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); builder.setIconAttribute(android.R.attr.alertDialogIcon); if (plural) { builder.setTitle(getString(R.string.no_pgp_keys)); diff --git a/src/main/java/de/pixart/messenger/ui/ConversationsActivity.java b/src/main/java/de/pixart/messenger/ui/ConversationsActivity.java index 51023c348..fd2e0a1d6 100644 --- a/src/main/java/de/pixart/messenger/ui/ConversationsActivity.java +++ b/src/main/java/de/pixart/messenger/ui/ConversationsActivity.java @@ -31,7 +31,7 @@ package de.pixart.messenger.ui; import android.annotation.SuppressLint; import android.app.Activity; -import android.app.AlertDialog; +import androidx.appcompat.app.AlertDialog; import android.app.Fragment; import android.app.FragmentManager; import android.app.FragmentTransaction; @@ -282,12 +282,12 @@ public class ConversationsActivity extends XmppActivity implements OnConversatio && isOptimizingBattery() && android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.M && getPreferences().getBoolean(getBatteryOptimizationPreferenceKey(), true)) { - AlertDialog.Builder builder = new AlertDialog.Builder(this); + final AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle(R.string.battery_optimizations_enabled); builder.setMessage(R.string.battery_optimizations_enabled_dialog); builder.setPositiveButton(R.string.next, (dialog, which) -> { - Intent intent = new Intent(Settings.ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS); - Uri uri = Uri.parse("package:" + getPackageName()); + final Intent intent = new Intent(Settings.ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS); + final Uri uri = Uri.parse("package:" + getPackageName()); intent.setData(uri); try { startActivityForResult(intent, REQUEST_BATTERY_OP); diff --git a/src/main/java/de/pixart/messenger/ui/EditAccountActivity.java b/src/main/java/de/pixart/messenger/ui/EditAccountActivity.java index 152dd8fc1..3afcf83bb 100644 --- a/src/main/java/de/pixart/messenger/ui/EditAccountActivity.java +++ b/src/main/java/de/pixart/messenger/ui/EditAccountActivity.java @@ -962,7 +962,7 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat publishOpenPGPPublicKey(mAccount); return true; case R.id.mgmt_account_password_forgotten: - AlertDialog.Builder builder = new AlertDialog.Builder(this); + final AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle(R.string.password_forgotten_title); builder.setMessage(R.string.password_forgotten_text); builder.setNegativeButton(R.string.cancel, null); @@ -1032,7 +1032,7 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat private void changePresence() { SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this); boolean manualStatus = sharedPreferences.getBoolean(SettingsActivity.MANUALLY_CHANGE_PRESENCE, getResources().getBoolean(R.bool.manually_change_presence)); - AlertDialog.Builder builder = new AlertDialog.Builder(this); + final AlertDialog.Builder builder = new AlertDialog.Builder(this); final DialogPresenceBinding binding = DataBindingUtil.inflate(getLayoutInflater(), R.layout.dialog_presence, null, false); final String current = mAccount.getPresenceStatusMessage(); if (current != null && !current.trim().isEmpty()) { @@ -1416,7 +1416,7 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat } private void showDeletePgpDialog() { - AlertDialog.Builder builder = new AlertDialog.Builder(this); + final AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle(R.string.unpublish_pgp); builder.setMessage(R.string.unpublish_pgp_message); builder.setNegativeButton(R.string.cancel, null); @@ -1464,7 +1464,7 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat } public void showWipePepDialog() { - AlertDialog.Builder builder = new AlertDialog.Builder(this); + final AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle(getString(R.string.clear_other_devices)); builder.setIconAttribute(android.R.attr.alertDialogIcon); builder.setMessage(getString(R.string.clear_other_devices_desc)); @@ -1481,9 +1481,9 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat } private void showPassword() { - AlertDialog.Builder builder = new AlertDialog.Builder(this); - View view = getLayoutInflater().inflate(R.layout.dialog_show_password, null); - TextView password = view.findViewById(R.id.password); + final AlertDialog.Builder builder = new AlertDialog.Builder(this); + final View view = getLayoutInflater().inflate(R.layout.dialog_show_password, null); + final TextView password = view.findViewById(R.id.password); password.setText(mAccount.getPassword()); builder.setTitle(R.string.password); builder.setView(view); @@ -1556,9 +1556,9 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat if (mFetchingMamPrefsToast != null) { mFetchingMamPrefsToast.cancel(); } - AlertDialog.Builder builder = new AlertDialog.Builder(EditAccountActivity.this); + final AlertDialog.Builder builder = new AlertDialog.Builder(EditAccountActivity.this); builder.setTitle(R.string.server_side_mam_prefs); - String defaultAttr = prefs.getAttribute("default"); + final String defaultAttr = prefs.getAttribute("default"); final List<String> defaults = Arrays.asList("never", "roster", "always"); final AtomicInteger choice = new AtomicInteger(Math.max(0, defaults.indexOf(defaultAttr))); builder.setSingleChoiceItems(R.array.mam_prefs, choice.get(), (dialog, which) -> choice.set(which)); diff --git a/src/main/java/de/pixart/messenger/ui/ImportBackupActivity.java b/src/main/java/de/pixart/messenger/ui/ImportBackupActivity.java index d732d7f30..ef9b7eec1 100644 --- a/src/main/java/de/pixart/messenger/ui/ImportBackupActivity.java +++ b/src/main/java/de/pixart/messenger/ui/ImportBackupActivity.java @@ -150,7 +150,7 @@ public class ImportBackupActivity extends XmppActivity implements ServiceConnect final DialogEnterPasswordBinding enterPasswordBinding = DataBindingUtil.inflate(LayoutInflater.from(this), R.layout.dialog_enter_password, null, false); Log.d(Config.LOGTAG, "attempting to import " + backupFile.getUri()); enterPasswordBinding.explain.setText(getString(R.string.enter_password_to_restore, backupFile.getHeader().getJid().toString())); - AlertDialog.Builder builder = new AlertDialog.Builder(this); + final AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setView(enterPasswordBinding.getRoot()); builder.setTitle(R.string.enter_password); builder.setNegativeButton(R.string.cancel, (dialog, which) -> { diff --git a/src/main/java/de/pixart/messenger/ui/JoinConferenceDialog.java b/src/main/java/de/pixart/messenger/ui/JoinConferenceDialog.java index d65d8db74..a019832ad 100644 --- a/src/main/java/de/pixart/messenger/ui/JoinConferenceDialog.java +++ b/src/main/java/de/pixart/messenger/ui/JoinConferenceDialog.java @@ -75,7 +75,7 @@ public class JoinConferenceDialog extends DialogFragment implements OnBackendCon builder.setView(binding.getRoot()); builder.setPositiveButton(R.string.join, null); builder.setNegativeButton(R.string.cancel, null); - AlertDialog dialog = builder.create(); + final AlertDialog dialog = builder.create(); dialog.show(); dialog.getButton(DialogInterface.BUTTON_POSITIVE).setOnClickListener(view -> mListener.onJoinDialogPositiveClick(dialog, binding.account, binding.accountJidLayout, binding.jid, binding.bookmark.isChecked())); binding.jid.setOnEditorActionListener((v, actionId, event) -> { diff --git a/src/main/java/de/pixart/messenger/ui/MagicCreateActivity.java b/src/main/java/de/pixart/messenger/ui/MagicCreateActivity.java index 683db3929..78f7ec11e 100644 --- a/src/main/java/de/pixart/messenger/ui/MagicCreateActivity.java +++ b/src/main/java/de/pixart/messenger/ui/MagicCreateActivity.java @@ -134,7 +134,7 @@ public class MagicCreateActivity extends XmppActivity implements TextWatcher, Ad intent.putExtra("existing", false); intent.putExtra("useownprovider", useOwnProvider); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK); - AlertDialog.Builder builder = new AlertDialog.Builder(this); + final AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle(getString(R.string.create_account)); builder.setCancelable(false); StringBuilder messasge = new StringBuilder(); diff --git a/src/main/java/de/pixart/messenger/ui/ManageAccountActivity.java b/src/main/java/de/pixart/messenger/ui/ManageAccountActivity.java index 67201ba03..b06fec004 100644 --- a/src/main/java/de/pixart/messenger/ui/ManageAccountActivity.java +++ b/src/main/java/de/pixart/messenger/ui/ManageAccountActivity.java @@ -354,7 +354,7 @@ public class ManageAccountActivity extends XmppActivity implements OnAccountUpda } private void deleteAccount(final Account account) { - AlertDialog.Builder builder = new AlertDialog.Builder(this); + final AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle(getString(R.string.mgmt_account_are_you_sure)); builder.setIconAttribute(android.R.attr.alertDialogIcon); builder.setMessage(getString(R.string.mgmt_account_delete_confirm_message)); diff --git a/src/main/java/de/pixart/messenger/ui/OmemoActivity.java b/src/main/java/de/pixart/messenger/ui/OmemoActivity.java index 1c9977ea6..9f309ac5f 100644 --- a/src/main/java/de/pixart/messenger/ui/OmemoActivity.java +++ b/src/main/java/de/pixart/messenger/ui/OmemoActivity.java @@ -193,7 +193,7 @@ public abstract class OmemoActivity extends XmppActivity { } public void showPurgeKeyDialog(final Account account, final String fingerprint) { - AlertDialog.Builder builder = new AlertDialog.Builder(this); + final AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle(R.string.distrust_omemo_key); builder.setMessage(R.string.distrust_omemo_key_text); builder.setNegativeButton(getString(R.string.cancel), null); diff --git a/src/main/java/de/pixart/messenger/ui/SetSettingsActivity.java b/src/main/java/de/pixart/messenger/ui/SetSettingsActivity.java index 0eb6ceb89..5c4ce2622 100644 --- a/src/main/java/de/pixart/messenger/ui/SetSettingsActivity.java +++ b/src/main/java/de/pixart/messenger/ui/SetSettingsActivity.java @@ -131,7 +131,7 @@ public class SetSettingsActivity extends XmppActivity implements XmppConnectionS message = getString(R.string.error); } Log.d(Config.LOGTAG, "STRING value " + title); - AlertDialog.Builder builder = new AlertDialog.Builder(this); + final AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle(title); builder.setMessage(message); builder.setNeutralButton(getString(R.string.ok), null); diff --git a/src/main/java/de/pixart/messenger/ui/SettingsActivity.java b/src/main/java/de/pixart/messenger/ui/SettingsActivity.java index a85d4ddb2..b34161a0c 100644 --- a/src/main/java/de/pixart/messenger/ui/SettingsActivity.java +++ b/src/main/java/de/pixart/messenger/ui/SettingsActivity.java @@ -424,7 +424,7 @@ public class SettingsActivity extends XmppActivity implements } private boolean deleteOmemoIdentities() { - AlertDialog.Builder builder = new AlertDialog.Builder(this); + final AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle(R.string.pref_delete_omemo_identities); final List<CharSequence> accounts = new ArrayList<>(); for (Account account : xmppConnectionService.getAccounts()) { @@ -460,7 +460,7 @@ public class SettingsActivity extends XmppActivity implements } } }); - AlertDialog dialog = builder.create(); + final AlertDialog dialog = builder.create(); dialog.show(); dialog.getButton(AlertDialog.BUTTON_POSITIVE).setEnabled(false); return true; diff --git a/src/main/java/de/pixart/messenger/ui/StartConversationActivity.java b/src/main/java/de/pixart/messenger/ui/StartConversationActivity.java index fb25e3c71..8f4e468c7 100644 --- a/src/main/java/de/pixart/messenger/ui/StartConversationActivity.java +++ b/src/main/java/de/pixart/messenger/ui/StartConversationActivity.java @@ -463,8 +463,7 @@ public class StartConversationActivity extends XmppActivity implements XmppConne protected void deleteConference() { int position = conference_context_id; final Bookmark bookmark = (Bookmark) conferences.get(position); - - AlertDialog.Builder builder = new AlertDialog.Builder(this); + final AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setNegativeButton(R.string.cancel, null); builder.setTitle(R.string.delete_bookmark); builder.setMessage(JidDialog.style(this, R.string.remove_bookmark_text, bookmark.getJid().toEscapedString())); @@ -729,7 +728,7 @@ public class StartConversationActivity extends XmppActivity implements XmppConne if (checkSelfPermission(Manifest.permission.READ_CONTACTS) != PackageManager.PERMISSION_GRANTED) { if (mRequestedContactsPermission.compareAndSet(false, true)) { if (shouldShowRequestPermissionRationale(Manifest.permission.READ_CONTACTS)) { - AlertDialog.Builder builder = new AlertDialog.Builder(this); + final AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle(R.string.sync_with_contacts); builder.setMessage(R.string.sync_with_contacts_long); builder.setPositiveButton(R.string.next, (dialog, which) -> requestPermissions(new String[]{Manifest.permission.READ_CONTACTS}, REQUEST_SYNC_CONTACTS)); @@ -865,11 +864,11 @@ public class StartConversationActivity extends XmppActivity implements XmppConne } private void displayVerificationWarningDialog(final Contact contact, final Invite invite) { - AlertDialog.Builder builder = new AlertDialog.Builder(this); + final AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle(R.string.verify_omemo_keys); - View view = getLayoutInflater().inflate(R.layout.dialog_verify_fingerprints, null); + final View view = getLayoutInflater().inflate(R.layout.dialog_verify_fingerprints, null); final CheckBox isTrustedSource = view.findViewById(R.id.trusted_source); - TextView warning = view.findViewById(R.id.warning); + final TextView warning = view.findViewById(R.id.warning); warning.setText(JidDialog.style(this, R.string.verifying_omemo_keys_trusted_source, contact.getJid().asBareJid().toEscapedString(), contact.getDisplayName())); builder.setView(view); builder.setPositiveButton(R.string.confirm, (dialog, which) -> { @@ -879,7 +878,7 @@ public class StartConversationActivity extends XmppActivity implements XmppConne switchToConversationDoNotAppend(contact, invite.getBody()); }); builder.setNegativeButton(R.string.cancel, (dialog, which) -> StartConversationActivity.this.finish()); - AlertDialog dialog = builder.create(); + final AlertDialog dialog = builder.create(); dialog.setCanceledOnTouchOutside(false); dialog.setOnCancelListener(dialog1 -> StartConversationActivity.this.finish()); dialog.show(); diff --git a/src/main/java/de/pixart/messenger/ui/StartUI.java b/src/main/java/de/pixart/messenger/ui/StartUI.java index c3c2596d2..d1fe6d084 100644 --- a/src/main/java/de/pixart/messenger/ui/StartUI.java +++ b/src/main/java/de/pixart/messenger/ui/StartUI.java @@ -80,7 +80,7 @@ public class StartUI extends AppCompatActivity @Override public void onPermissionsDenied(int requestCode, List<String> list) { Log.d(Config.LOGTAG, "Permissions denied:" + requestCode); - AlertDialog dialog = new AlertDialog.Builder(this) + final AlertDialog dialog = new AlertDialog.Builder(this) .setMessage(getString(R.string.request_permissions_message_again)) .setPositiveButton(getString(R.string.yes), new DialogInterface.OnClickListener() { @Override diff --git a/src/main/java/de/pixart/messenger/ui/TrustKeysActivity.java b/src/main/java/de/pixart/messenger/ui/TrustKeysActivity.java index eacaf8a39..699b50abc 100644 --- a/src/main/java/de/pixart/messenger/ui/TrustKeysActivity.java +++ b/src/main/java/de/pixart/messenger/ui/TrustKeysActivity.java @@ -1,6 +1,6 @@ package de.pixart.messenger.ui; -import android.app.AlertDialog; +import androidx.appcompat.app.AlertDialog; import android.content.Intent; import android.os.Bundle; import android.util.Log; @@ -255,7 +255,7 @@ public class TrustKeysActivity extends OmemoActivity implements OnKeyStatusUpdat } private void disableEncryptionDialog(View view) { - AlertDialog.Builder builder = new AlertDialog.Builder(this); + final AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle(R.string.disable_encryption); builder.setMessage(R.string.disable_encryption_message); builder.setPositiveButton(R.string.disable_now, (dialog, which) -> { diff --git a/src/main/java/de/pixart/messenger/ui/UpdaterActivity.java b/src/main/java/de/pixart/messenger/ui/UpdaterActivity.java index fdd9b95d3..6cc3571b5 100644 --- a/src/main/java/de/pixart/messenger/ui/UpdaterActivity.java +++ b/src/main/java/de/pixart/messenger/ui/UpdaterActivity.java @@ -119,7 +119,7 @@ public class UpdaterActivity extends XmppActivity { } //oh yeah we do need an upgrade, let the user know send an alert message - AlertDialog.Builder builder = new AlertDialog.Builder(UpdaterActivity.this); + final AlertDialog.Builder builder = new AlertDialog.Builder(UpdaterActivity.this); builder.setCancelable(false); //open link to changelog //if the user agrees to upgrade @@ -248,7 +248,7 @@ public class UpdaterActivity extends XmppActivity { } private void showCancelDialog() { - AlertDialog.Builder builder = new AlertDialog.Builder(this); + final AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setMessage(R.string.cancel_update) .setCancelable(false) .setPositiveButton(R.string.yes, (dialog, id) -> { @@ -261,7 +261,7 @@ public class UpdaterActivity extends XmppActivity { UpdaterActivity.this.finish(); }) .setNegativeButton(R.string.no, (dialog, id) -> dialog.cancel()); - AlertDialog alert = builder.create(); + final AlertDialog alert = builder.create(); alert.show(); } diff --git a/src/main/java/de/pixart/messenger/ui/VerifyOTRActivity.java b/src/main/java/de/pixart/messenger/ui/VerifyOTRActivity.java index 8febb90b4..c7b7f4cad 100644 --- a/src/main/java/de/pixart/messenger/ui/VerifyOTRActivity.java +++ b/src/main/java/de/pixart/messenger/ui/VerifyOTRActivity.java @@ -422,7 +422,7 @@ public class VerifyOTRActivity extends XmppActivity implements XmppConnectionSer } private void showManuallyVerifyDialog() { - AlertDialog.Builder builder = new AlertDialog.Builder(this); + final AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle(R.string.manually_verify); builder.setMessage(R.string.are_you_sure_verify_fingerprint); builder.setNegativeButton(R.string.cancel, null); diff --git a/src/main/java/de/pixart/messenger/ui/XmppActivity.java b/src/main/java/de/pixart/messenger/ui/XmppActivity.java index f2a3f5c76..4f9cb587a 100644 --- a/src/main/java/de/pixart/messenger/ui/XmppActivity.java +++ b/src/main/java/de/pixart/messenger/ui/XmppActivity.java @@ -270,7 +270,7 @@ public abstract class XmppActivity extends ActionBarActivity { } public void showInstallPgpDialog() { - AlertDialog.Builder builder = new AlertDialog.Builder(this); + final AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle(getString(R.string.openkeychain_required)); builder.setIconAttribute(android.R.attr.alertDialogIcon); builder.setMessage(getText(R.string.openkeychain_required_long)); @@ -685,7 +685,7 @@ public abstract class XmppActivity extends ActionBarActivity { protected void displayErrorDialog(final int errorCode) { runOnUiThread(() -> { - AlertDialog.Builder builder = new AlertDialog.Builder(XmppActivity.this); + final AlertDialog.Builder builder = new AlertDialog.Builder(XmppActivity.this); builder.setIconAttribute(android.R.attr.alertDialogIcon); builder.setTitle(getString(R.string.error)); builder.setMessage(errorCode); @@ -703,7 +703,7 @@ public abstract class XmppActivity extends ActionBarActivity { if (contact == null) { return; } - AlertDialog.Builder builder = new AlertDialog.Builder(this); + final AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle(contact.getJid().toString()); builder.setMessage(getString(R.string.not_in_roster)); builder.setNegativeButton(getString(R.string.cancel), null); @@ -712,7 +712,7 @@ public abstract class XmppActivity extends ActionBarActivity { } private void showAskForPresenceDialog(final Contact contact) { - AlertDialog.Builder builder = new AlertDialog.Builder(this); + final AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle(contact.getJid().toString()); builder.setMessage(R.string.request_presence_updates); builder.setNegativeButton(R.string.cancel, null); @@ -730,7 +730,7 @@ public abstract class XmppActivity extends ActionBarActivity { private void warnMutalPresenceSubscription(final Conversation conversation, final OnPresenceSelected listener) { - AlertDialog.Builder builder = new AlertDialog.Builder(this); + final AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle(conversation.getContact().getJid().toString()); builder.setMessage(R.string.without_mutual_presence_updates); builder.setNegativeButton(R.string.cancel, null); @@ -761,7 +761,7 @@ public abstract class XmppActivity extends ActionBarActivity { final @StringRes int hint, boolean password, boolean permitEmpty) { - AlertDialog.Builder builder = new AlertDialog.Builder(this); + final AlertDialog.Builder builder = new AlertDialog.Builder(this); DialogQuickeditBinding binding = DataBindingUtil.inflate(getLayoutInflater(), R.layout.dialog_quickedit, null, false); if (password) { binding.inputEditText.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD); @@ -887,7 +887,7 @@ public abstract class XmppActivity extends ActionBarActivity { private void showPresenceSelectionDialog(Presences presences, final Conversation conversation, final OnPresenceSelected listener) { final Contact contact = conversation.getContact(); - AlertDialog.Builder builder = new AlertDialog.Builder(this); + final AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle(getString(R.string.choose_presence)); final String[] resourceArray = presences.toResourceArray(); Pair<Map<String, String>, Map<String, String>> typeAndName = presences.toTypeAndNameMap(); @@ -1190,7 +1190,7 @@ public abstract class XmppActivity extends ActionBarActivity { ImageView view = new ImageView(this); view.setBackgroundColor(Color.WHITE); view.setImageBitmap(bitmap); - AlertDialog.Builder builder = new AlertDialog.Builder(this); + final AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setView(view); builder.create().show(); } @@ -1396,7 +1396,7 @@ public abstract class XmppActivity extends ActionBarActivity { ShowToast = "false"; } if (!installFromUnknownSourceAllowed() && xmppConnectionService.installedFrom() == null) { - AlertDialog.Builder builder = new AlertDialog.Builder(this); + final AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle(R.string.install_from_unknown_sources_disabled); builder.setMessage(R.string.install_from_unknown_sources_disabled_dialog); builder.setPositiveButton(R.string.next, (dialog, which) -> { diff --git a/src/main/java/de/pixart/messenger/ui/util/MucDetailsContextMenuHelper.java b/src/main/java/de/pixart/messenger/ui/util/MucDetailsContextMenuHelper.java index 7a3411cfa..10f14bf4f 100644 --- a/src/main/java/de/pixart/messenger/ui/util/MucDetailsContextMenuHelper.java +++ b/src/main/java/de/pixart/messenger/ui/util/MucDetailsContextMenuHelper.java @@ -257,7 +257,7 @@ public final class MucDetailsContextMenuHelper { private static void kickFromRoom(final User user, XmppActivity activity, XmppConnectionService.OnAffiliationChanged onAffiliationChanged) { final Conversation conversation = user.getConversation(); - AlertDialog.Builder builder = new AlertDialog.Builder(activity); + final AlertDialog.Builder builder = new AlertDialog.Builder(activity); builder.setTitle(R.string.kick_from_conference); String jid = user.getRealJid().asBareJid().toString(); SpannableString message; @@ -284,7 +284,7 @@ public final class MucDetailsContextMenuHelper { private static void banFromRoom(final User user, XmppActivity activity, XmppConnectionService.OnAffiliationChanged onAffiliationChanged) { final Conversation conversation = user.getConversation(); - AlertDialog.Builder builder = new AlertDialog.Builder(activity); + final AlertDialog.Builder builder = new AlertDialog.Builder(activity); builder.setTitle(R.string.ban_from_conference); String jid = user.getRealJid().asBareJid().toString(); SpannableString message; diff --git a/src/main/java/de/pixart/messenger/ui/util/PresenceSelector.java b/src/main/java/de/pixart/messenger/ui/util/PresenceSelector.java index ce6ff84e7..a22ec1740 100644 --- a/src/main/java/de/pixart/messenger/ui/util/PresenceSelector.java +++ b/src/main/java/de/pixart/messenger/ui/util/PresenceSelector.java @@ -30,7 +30,7 @@ package de.pixart.messenger.ui.util; import android.app.Activity; -import android.app.AlertDialog; +import androidx.appcompat.app.AlertDialog; import android.content.Context; import android.util.Pair; @@ -50,7 +50,7 @@ public class PresenceSelector { public static void showPresenceSelectionDialog(Activity activity, final Conversation conversation, final OnPresenceSelected listener) { final Contact contact = conversation.getContact(); final Presences presences = contact.getPresences(); - AlertDialog.Builder builder = new AlertDialog.Builder(activity); + final AlertDialog.Builder builder = new AlertDialog.Builder(activity); builder.setTitle(activity.getString(R.string.choose_presence)); final String[] resourceArray = presences.toResourceArray(); Pair<Map<String, String>, Map<String, String>> typeAndName = presences.toTypeAndNameMap(); @@ -99,7 +99,7 @@ public class PresenceSelector { } public static void warnMutualPresenceSubscription(Activity activity, final Conversation conversation, final OnPresenceSelected listener) { - AlertDialog.Builder builder = new AlertDialog.Builder(activity); + final AlertDialog.Builder builder = new AlertDialog.Builder(activity); builder.setTitle(conversation.getContact().getJid().toString()); builder.setMessage(R.string.without_mutual_presence_updates); builder.setNegativeButton(R.string.cancel, null); diff --git a/src/main/java/de/pixart/messenger/utils/ExceptionHelper.java b/src/main/java/de/pixart/messenger/utils/ExceptionHelper.java index 834f83cea..2f7370ee1 100644 --- a/src/main/java/de/pixart/messenger/utils/ExceptionHelper.java +++ b/src/main/java/de/pixart/messenger/utils/ExceptionHelper.java @@ -85,13 +85,13 @@ public class ExceptionHelper { } file.close(); activity.deleteFile(FILENAME); - AlertDialog.Builder builder = new AlertDialog.Builder(activity); + final AlertDialog.Builder builder = new AlertDialog.Builder(activity); builder.setTitle(activity.getString(R.string.crash_report_title)); builder.setMessage(activity.getText(R.string.crash_report_message)); builder.setPositiveButton(activity.getText(R.string.send_now), (dialog, which) -> { Log.d(Config.LOGTAG, "using account=" + account.getJid().asBareJid() + " to send in stack trace"); - Conversation conversation = service.findOrCreateConversation(account, Config.BUG_REPORTS, false, true); - Message message = new Message(conversation, report.toString(), Message.ENCRYPTION_NONE); + final Conversation conversation = service.findOrCreateConversation(account, Config.BUG_REPORTS, false, true); + final Message message = new Message(conversation, report.toString(), Message.ENCRYPTION_NONE); service.sendMessage(message); }); builder.setNegativeButton(activity.getText(R.string.send_never), (dialog, which) -> preferences.edit().putBoolean("never_send", true).apply()); |