diff --git a/src/conversations/java/eu/siacs/conversations/utils/ProvisioningUtils.java b/src/conversations/java/eu/siacs/conversations/utils/ProvisioningUtils.java index 593291d95..424c8ad53 100644 --- a/src/conversations/java/eu/siacs/conversations/utils/ProvisioningUtils.java +++ b/src/conversations/java/eu/siacs/conversations/utils/ProvisioningUtils.java @@ -20,13 +20,13 @@ public class ProvisioningUtils { try { accountConfiguration = AccountConfiguration.parse(json); } catch (final IllegalArgumentException e) { - Toast.makeText(activity, R.string.improperly_formatted_provisioning, Toast.LENGTH_LONG).show(); + ToastCompat.makeText(activity, R.string.improperly_formatted_provisioning, ToastCompat.LENGTH_LONG).show(); return; } final Jid jid = accountConfiguration.getJid(); final List accounts = DatabaseBackend.getInstance(activity).getAccountJids(true); if (accounts.contains(jid)) { - Toast.makeText(activity, R.string.account_already_exists, Toast.LENGTH_LONG).show(); + ToastCompat.makeText(activity, R.string.account_already_exists, ToastCompat.LENGTH_LONG).show(); return; } final Intent serviceIntent = new Intent(activity, XmppConnectionService.class); diff --git a/src/main/java/eu/siacs/conversations/persistance/FileBackend.java b/src/main/java/eu/siacs/conversations/persistance/FileBackend.java index 15a776a4a..ea384c2c2 100644 --- a/src/main/java/eu/siacs/conversations/persistance/FileBackend.java +++ b/src/main/java/eu/siacs/conversations/persistance/FileBackend.java @@ -34,7 +34,6 @@ import android.util.Base64OutputStream; import android.util.DisplayMetrics; import android.util.Log; import android.util.LruCache; -import android.widget.Toast; import androidx.annotation.Nullable; import androidx.annotation.RequiresApi; @@ -1930,7 +1929,7 @@ public class FileBackend { final File destination = new File(getDestinationToSaveFile(message)); try { copyFile(source, destination); - ToastCompat.makeText(activity, activity.getString(R.string.file_copied_to, destination), Toast.LENGTH_SHORT).show(); + ToastCompat.makeText(activity, activity.getString(R.string.file_copied_to, destination), ToastCompat.LENGTH_SHORT).show(); } catch (IOException e) { e.printStackTrace(); } diff --git a/src/main/java/eu/siacs/conversations/services/UpdateService.java b/src/main/java/eu/siacs/conversations/services/UpdateService.java index 4bf42c54d..cac3b3a03 100644 --- a/src/main/java/eu/siacs/conversations/services/UpdateService.java +++ b/src/main/java/eu/siacs/conversations/services/UpdateService.java @@ -7,7 +7,6 @@ import android.os.AsyncTask; import android.os.Handler; import android.os.Looper; import android.util.Log; -import android.widget.Toast; import org.json.JSONException; import org.json.JSONObject; @@ -148,7 +147,7 @@ public class UpdateService extends AsyncTask { Blockable blockable = new RawBlockable(account, contactJid); if (xmppConnectionService.sendBlockRequest(blockable, false)) { - ToastCompat.makeText(BlocklistActivity.this, R.string.corresponding_conversations_closed, Toast.LENGTH_SHORT).show(); + ToastCompat.makeText(BlocklistActivity.this, R.string.corresponding_conversations_closed, ToastCompat.LENGTH_SHORT).show(); } return true; }); diff --git a/src/main/java/eu/siacs/conversations/ui/ChangePasswordActivity.java b/src/main/java/eu/siacs/conversations/ui/ChangePasswordActivity.java index b2c0b9b02..0b493f2c9 100644 --- a/src/main/java/eu/siacs/conversations/ui/ChangePasswordActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/ChangePasswordActivity.java @@ -4,7 +4,6 @@ import android.content.Intent; import android.os.Bundle; import android.view.View; import android.widget.Button; -import android.widget.Toast; import com.google.android.material.textfield.TextInputLayout; @@ -92,7 +91,7 @@ public class ChangePasswordActivity extends XmppActivity implements XmppConnecti runOnUiThread(new Runnable() { @Override public void run() { - ToastCompat.makeText(ChangePasswordActivity.this, R.string.password_changed, Toast.LENGTH_LONG).show(); + ToastCompat.makeText(ChangePasswordActivity.this, R.string.password_changed, ToastCompat.LENGTH_LONG).show(); finish(); } }); diff --git a/src/main/java/eu/siacs/conversations/ui/ChooseAccountForProfilePictureActivity.java b/src/main/java/eu/siacs/conversations/ui/ChooseAccountForProfilePictureActivity.java index d42fe4b7a..fffe31dc3 100644 --- a/src/main/java/eu/siacs/conversations/ui/ChooseAccountForProfilePictureActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/ChooseAccountForProfilePictureActivity.java @@ -4,7 +4,6 @@ import android.content.Intent; import android.net.Uri; import android.os.Bundle; import android.widget.ListView; -import android.widget.Toast; import java.util.ArrayList; import java.util.List; @@ -80,7 +79,7 @@ public class ChooseAccountForProfilePictureActivity extends XmppActivity { try { startActivity(intent); } catch (SecurityException e) { - ToastCompat.makeText(this, R.string.sharing_application_not_grant_permission, Toast.LENGTH_SHORT).show(); + ToastCompat.makeText(this, R.string.sharing_application_not_grant_permission, ToastCompat.LENGTH_SHORT).show(); return; } } diff --git a/src/main/java/eu/siacs/conversations/ui/ConferenceDetailsActivity.java b/src/main/java/eu/siacs/conversations/ui/ConferenceDetailsActivity.java index b790c54ad..43a1ee425 100644 --- a/src/main/java/eu/siacs/conversations/ui/ConferenceDetailsActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/ConferenceDetailsActivity.java @@ -14,7 +14,6 @@ import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.View.OnClickListener; -import android.widget.Toast; import androidx.appcompat.app.AlertDialog; import androidx.appcompat.widget.Toolbar; @@ -230,7 +229,7 @@ public class ConferenceDetailsActivity extends XmppActivity implements OnConvers } }); } catch (Exception e) { - ToastCompat.makeText(this, R.string.unable_to_perform_this_action, Toast.LENGTH_SHORT).show(); + ToastCompat.makeText(this, R.string.unable_to_perform_this_action, ToastCompat.LENGTH_SHORT).show(); e.printStackTrace(); } }); @@ -238,18 +237,18 @@ public class ConferenceDetailsActivity extends XmppActivity implements OnConvers try { final MucOptions mucOptions = mConversation.getMucOptions(); if (!mucOptions.hasVCards()) { - ToastCompat.makeText(this, R.string.host_does_not_support_group_chat_avatars, Toast.LENGTH_SHORT).show(); + ToastCompat.makeText(this, R.string.host_does_not_support_group_chat_avatars, ToastCompat.LENGTH_SHORT).show(); return; } if (!mucOptions.getSelf().getAffiliation().ranks(MucOptions.Affiliation.OWNER)) { - ToastCompat.makeText(this, R.string.only_the_owner_can_change_group_chat_avatar, Toast.LENGTH_SHORT).show(); + ToastCompat.makeText(this, R.string.only_the_owner_can_change_group_chat_avatar, ToastCompat.LENGTH_SHORT).show(); return; } final Intent intent = new Intent(this, PublishGroupChatProfilePictureActivity.class); intent.putExtra("uuid", mConversation.getUuid()); startActivity(intent); } catch (Exception e) { - ToastCompat.makeText(this, R.string.unable_to_perform_this_action, Toast.LENGTH_SHORT).show(); + ToastCompat.makeText(this, R.string.unable_to_perform_this_action, ToastCompat.LENGTH_SHORT).show(); e.printStackTrace(); } }); @@ -386,7 +385,7 @@ public class ConferenceDetailsActivity extends XmppActivity implements OnConvers public boolean onContextItemSelected(MenuItem item) { final User user = mUserPreviewAdapter.getSelectedUser(); if (user == null) { - ToastCompat.makeText(this, R.string.unable_to_perform_this_action, Toast.LENGTH_SHORT).show(); + ToastCompat.makeText(this, R.string.unable_to_perform_this_action, ToastCompat.LENGTH_SHORT).show(); return true; } if (!MucDetailsContextMenuHelper.onContextItemSelected(item, mUserPreviewAdapter.getSelectedUser(), this)) { @@ -783,7 +782,7 @@ public class ConferenceDetailsActivity extends XmppActivity implements OnConvers if (isFinishing()) { return; } - ToastCompat.makeText(this, msg, Toast.LENGTH_SHORT).show(); + ToastCompat.makeText(this, msg, ToastCompat.LENGTH_SHORT).show(); }); } diff --git a/src/main/java/eu/siacs/conversations/ui/ContactDetailsActivity.java b/src/main/java/eu/siacs/conversations/ui/ContactDetailsActivity.java index 7a18e8619..239e21b89 100644 --- a/src/main/java/eu/siacs/conversations/ui/ContactDetailsActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/ContactDetailsActivity.java @@ -28,7 +28,6 @@ import android.widget.CompoundButton; import android.widget.CompoundButton.OnCheckedChangeListener; import android.widget.ImageButton; import android.widget.TextView; -import android.widget.Toast; import androidx.annotation.NonNull; import androidx.appcompat.app.ActionBar; @@ -173,7 +172,7 @@ public class ContactDetailsActivity extends OmemoActivity implements OnAccountUp try { startActivityForResult(intent, 0); } catch (ActivityNotFoundException e) { - ToastCompat.makeText(ContactDetailsActivity.this, R.string.no_application_found_to_view_contact, Toast.LENGTH_SHORT).show(); + ToastCompat.makeText(ContactDetailsActivity.this, R.string.no_application_found_to_view_contact, ToastCompat.LENGTH_SHORT).show(); } }); builder.create().show(); @@ -441,7 +440,7 @@ public class ContactDetailsActivity extends OmemoActivity implements OnAccountUp startActivity(intent); overridePendingTransition(R.animator.fade_in, R.animator.fade_out); } catch (ActivityNotFoundException e) { - ToastCompat.makeText(ContactDetailsActivity.this, R.string.no_application_found_to_view_contact, Toast.LENGTH_SHORT).show(); + ToastCompat.makeText(ContactDetailsActivity.this, R.string.no_application_found_to_view_contact, ToastCompat.LENGTH_SHORT).show(); } } } @@ -760,7 +759,7 @@ public class ContactDetailsActivity extends OmemoActivity implements OnAccountUp try { startActivity(intent); } catch (final ActivityNotFoundException e) { - Toast.makeText(this, R.string.no_application_found_to_view_contact, Toast.LENGTH_SHORT).show(); + ToastCompat.makeText(this, R.string.no_application_found_to_view_contact, ToastCompat.LENGTH_SHORT).show(); } } } @@ -796,10 +795,10 @@ public class ContactDetailsActivity extends OmemoActivity implements OnAccountUp protected void processFingerprintVerification(XmppUri uri) { if (contact != null && contact.getJid().asBareJid().equals(uri.getJid()) && uri.hasFingerprints()) { if (xmppConnectionService.verifyFingerprints(contact, uri.getFingerprints())) { - ToastCompat.makeText(this, R.string.verified_fingerprints, Toast.LENGTH_SHORT).show(); + ToastCompat.makeText(this, R.string.verified_fingerprints, ToastCompat.LENGTH_SHORT).show(); } } else { - ToastCompat.makeText(this, R.string.invalid_barcode, Toast.LENGTH_SHORT).show(); + ToastCompat.makeText(this, R.string.invalid_barcode, ToastCompat.LENGTH_SHORT).show(); } } diff --git a/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java b/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java index e8e54b9b0..0aa483932 100644 --- a/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java +++ b/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java @@ -316,7 +316,7 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke if (ConversationFragment.this.conversation != conversation) { return; } - messageLoaderToast = ToastCompat.makeText(view.getContext(), resId, Toast.LENGTH_LONG); + messageLoaderToast = ToastCompat.makeText(view.getContext(), resId, ToastCompat.LENGTH_LONG); messageLoaderToast.show(); }); } @@ -334,7 +334,7 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke inputContentInfo.requestPermission(); } catch (Exception e) { Log.e(Config.LOGTAG, "InputContentInfoCompat#requestPermission() failed.", e); - ToastCompat.makeText(getActivity(), activity.getString(R.string.no_permission_to_access_x, inputContentInfo.getDescription()), Toast.LENGTH_LONG + ToastCompat.makeText(getActivity(), activity.getString(R.string.no_permission_to_access_x, inputContentInfo.getDescription()), ToastCompat.LENGTH_LONG ).show(); return false; } @@ -423,7 +423,7 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke 0, 0); } catch (SendIntentException e) { - ToastCompat.makeText(getActivity(), R.string.unable_to_connect_to_keychain, Toast.LENGTH_SHORT).show(); + ToastCompat.makeText(getActivity(), R.string.unable_to_connect_to_keychain, ToastCompat.LENGTH_SHORT).show(); conversation.getAccount().getPgpDecryptionService().continueDecryption(true); } } @@ -727,7 +727,7 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke if (conversation == null) { return; } - final Toast prepareFileToast = ToastCompat.makeText(getActivity(), getText(R.string.preparing_file), Toast.LENGTH_SHORT); + final Toast prepareFileToast = ToastCompat.makeText(getActivity(), getText(R.string.preparing_file), ToastCompat.LENGTH_SHORT); prepareFileToast.show(); activity.delegateUriPermissionsToService(uri); activity.xmppConnectionService.attachFileToConversation(conversation, uri, type, new UiInformableCallback() { @@ -761,7 +761,7 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke if (conversation == null) { return; } - final Toast prepareFileToast = ToastCompat.makeText(getActivity(), getText(R.string.preparing_image), Toast.LENGTH_LONG); + final Toast prepareFileToast = ToastCompat.makeText(getActivity(), getText(R.string.preparing_image), ToastCompat.LENGTH_LONG); prepareFileToast.show(); activity.delegateUriPermissionsToService(uri); activity.xmppConnectionService.attachImageToConversation(conversation, uri, @@ -789,7 +789,7 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke if (conversation == null) { return; } - final Toast prepareFileToast = ToastCompat.makeText(getActivity(), getText(R.string.preparing_image), Toast.LENGTH_LONG); + final Toast prepareFileToast = ToastCompat.makeText(getActivity(), getText(R.string.preparing_image), ToastCompat.LENGTH_LONG); prepareFileToast.show(); activity.delegateUriPermissionsToService(uri); activity.xmppConnectionService.attachImageToConversation(conversation, uri, @@ -822,7 +822,7 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke if (conversation == null) { return; } - final Toast prepareFileToast = ToastCompat.makeText(getActivity(), getText(R.string.preparing_image), Toast.LENGTH_LONG); + final Toast prepareFileToast = ToastCompat.makeText(getActivity(), getText(R.string.preparing_image), ToastCompat.LENGTH_LONG); prepareFileToast.show(); activity.delegateUriPermissionsToService(uri); activity.xmppConnectionService.attachImageToConversation(conversation, uri, @@ -993,7 +993,7 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke XmppActivity.ConferenceInvite invite = XmppActivity.ConferenceInvite.parse(data); if (invite != null) { if (invite.execute(activity)) { - activity.mToast = ToastCompat.makeText(activity, R.string.creating_conference, Toast.LENGTH_LONG); + activity.mToast = ToastCompat.makeText(activity, R.string.creating_conference, ToastCompat.LENGTH_LONG); activity.mToast.show(); } } @@ -1685,7 +1685,7 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke } else if (mode == Conversation.MODE_MULTI && conversation.getMucOptions().pgpKeysInUse()) { if (!conversation.getMucOptions().everybodyHasKeys()) { getActivity().runOnUiThread(() -> { - Toast warning = ToastCompat.makeText(activity, R.string.missing_public_keys, Toast.LENGTH_LONG); + Toast warning = ToastCompat.makeText(activity, R.string.missing_public_keys, ToastCompat.LENGTH_LONG); warning.setGravity(Gravity.CENTER_VERTICAL, 0, 0); warning.show(); }); @@ -1762,7 +1762,7 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke } else { res = R.string.no_storage_permission; } - ToastCompat.makeText(getActivity(), res, Toast.LENGTH_SHORT).show(); + ToastCompat.makeText(getActivity(), res, ToastCompat.LENGTH_SHORT).show(); } } if (readGranted(grantResults, permissions)) { @@ -1797,7 +1797,7 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke } if (!transferable.start()) { Log.d(Config.LOGTAG, "type: " + transferable.getClass().getName()); - ToastCompat.makeText(getActivity(), R.string.not_connected_try_again, Toast.LENGTH_SHORT).show(); + ToastCompat.makeText(getActivity(), R.string.not_connected_try_again, ToastCompat.LENGTH_SHORT).show(); } } else if (message.treatAsDownloadable() || message.hasFileOnRemoteHost() || MessageUtils.unInitiatedButKnownSize(message)) { createNewConnection(message); @@ -1808,7 +1808,7 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke private void createNewConnection(final Message message) { if (!activity.xmppConnectionService.hasInternetConnection()) { - ToastCompat.makeText(getActivity(), R.string.not_connected_try_again, Toast.LENGTH_SHORT).show(); + ToastCompat.makeText(getActivity(), R.string.not_connected_try_again, ToastCompat.LENGTH_SHORT).show(); return; } activity.xmppConnectionService.getHttpConnectionManager().createNewDownloadConnection(message, true); @@ -1905,7 +1905,7 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke if (activity.xmppConnectionService.webViewAvailable()) { intent = new Intent(getActivity(), ShareLocationActivity.class); } else { - ToastCompat.makeText(activity, R.string.webview_not_available, Toast.LENGTH_LONG).show(); + ToastCompat.makeText(activity, R.string.webview_not_available, ToastCompat.LENGTH_LONG).show(); } break; } @@ -1925,7 +1925,7 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke activity.overridePendingTransition(R.animator.fade_in, R.animator.fade_out); } } else { - //ignore Toast.makeText(context, R.string.no_application_found, Toast.LENGTH_LONG).show(); + //ignore ToastCompat.makeText(context, R.string.no_application_found, ToastCompat.LENGTH_LONG).show(); } } @@ -1998,7 +1998,7 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke builder.setMessage(displayError); builder.setNegativeButton(R.string.copy_to_clipboard, (dialog, which) -> { activity.copyTextToClipboard(displayError, R.string.error_message); - ToastCompat.makeText(activity, R.string.error_message_copied_to_clipboard, Toast.LENGTH_SHORT).show(); + ToastCompat.makeText(activity, R.string.error_message_copied_to_clipboard, ToastCompat.LENGTH_SHORT).show(); }); builder.setPositiveButton(R.string.ok, null); builder.create().show(); @@ -2081,10 +2081,10 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke return; } } else if (!Compatibility.hasStoragePermission(getActivity())) { - ToastCompat.makeText(activity, R.string.no_storage_permission, Toast.LENGTH_SHORT).show(); + ToastCompat.makeText(activity, R.string.no_storage_permission, ToastCompat.LENGTH_SHORT).show(); return; } else { - ToastCompat.makeText(activity, R.string.file_deleted, Toast.LENGTH_SHORT).show(); + ToastCompat.makeText(activity, R.string.file_deleted, ToastCompat.LENGTH_SHORT).show(); message.setFileDeleted(true); activity.xmppConnectionService.updateMessage(message, false); activity.onConversationsListItemUpdated(); @@ -2117,7 +2117,7 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke } if (activity.copyTextToClipboard(url, resId)) { ToastCompat.makeText(getActivity(), R.string.url_copied_to_clipboard, - Toast.LENGTH_SHORT).show(); + ToastCompat.LENGTH_SHORT).show(); } } @@ -2140,7 +2140,7 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke public void privateMessageWith(final Jid counterpart) { final Jid tcp = conversation.getMucOptions().getTrueCounterpart(counterpart); if (!getConversation().getMucOptions().isUserInRoom(counterpart) && getConversation().getMucOptions().findUserByRealJid(tcp == null ? null : tcp.asBareJid()) == null) { - ToastCompat.makeText(getActivity(), activity.getString(R.string.user_has_left_conference, counterpart.getResource()), Toast.LENGTH_SHORT).show(); + ToastCompat.makeText(getActivity(), activity.getString(R.string.user_has_left_conference, counterpart.getResource()), ToastCompat.LENGTH_SHORT).show(); return; } if (conversation.setOutgoingChatState(Config.DEFAULT_CHAT_STATE)) { @@ -2522,7 +2522,7 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke final Uri uri = iterator.next(); if (FileBackend.weOwnFile(getActivity(), uri)) { iterator.remove(); - ToastCompat.makeText(getActivity(), R.string.security_violation_not_attaching_file, Toast.LENGTH_SHORT).show(); + ToastCompat.makeText(getActivity(), R.string.security_violation_not_attaching_file, ToastCompat.LENGTH_SHORT).show(); } } return uris; @@ -2927,7 +2927,7 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke public void error(int error, Contact contact) { activity.runOnUiThread(() -> ToastCompat.makeText(activity, R.string.unable_to_connect_to_keychain, - Toast.LENGTH_SHORT + ToastCompat.LENGTH_SHORT ).show()); mSendingPgpMessage.set(false); } @@ -2949,7 +2949,7 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke Toast warning = ToastCompat .makeText(getActivity(), R.string.missing_public_keys, - Toast.LENGTH_LONG); + ToastCompat.LENGTH_LONG); warning.setGravity(Gravity.CENTER_VERTICAL, 0, 0); warning.show(); } @@ -2986,7 +2986,7 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke public void error(final int error, Message message) { getActivity().runOnUiThread(() -> { doneSendingPgpMessage(); - ToastCompat.makeText(getActivity(), error == 0 ? R.string.unable_to_connect_to_keychain : error, Toast.LENGTH_SHORT).show(); + ToastCompat.makeText(getActivity(), error == 0 ? R.string.unable_to_connect_to_keychain : error, ToastCompat.LENGTH_SHORT).show(); }); } @@ -3015,7 +3015,7 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke final Editable editable = this.binding.textinput.getText(); String previous = editable == null ? "" : editable.toString(); if (doNotAppend && !TextUtils.isEmpty(previous)) { - ToastCompat.makeText(getActivity(), R.string.already_drafting_message, Toast.LENGTH_LONG).show(); + ToastCompat.makeText(getActivity(), R.string.already_drafting_message, ToastCompat.LENGTH_LONG).show(); return; } if (UIHelper.isLastLineQuote(previous)) { @@ -3046,7 +3046,7 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke correctMessage(lastEditableMessage); return true; } else { - ToastCompat.makeText(getActivity(), R.string.could_not_correct_message, Toast.LENGTH_LONG).show(); + ToastCompat.makeText(getActivity(), R.string.could_not_correct_message, ToastCompat.LENGTH_LONG).show(); return false; } } @@ -3327,11 +3327,11 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke final MucOptions mucOptions = ((Conversation) message.getConversation()).getMucOptions(); if (mucOptions.participating() || ((Conversation) message.getConversation()).getNextCounterpart() != null) { if (!mucOptions.isUserInRoom(user) && mucOptions.findUserByRealJid(tcp == null ? null : tcp.asBareJid()) == null) { - ToastCompat.makeText(getActivity(), activity.getString(R.string.user_has_left_conference, user.getResource()), Toast.LENGTH_SHORT).show(); + ToastCompat.makeText(getActivity(), activity.getString(R.string.user_has_left_conference, user.getResource()), ToastCompat.LENGTH_SHORT).show(); } highlightInConference(user.getResource()); } else { - ToastCompat.makeText(getActivity(), R.string.you_are_not_participating, Toast.LENGTH_SHORT).show(); + ToastCompat.makeText(getActivity(), R.string.you_are_not_participating, ToastCompat.LENGTH_SHORT).show(); } } return; diff --git a/src/main/java/eu/siacs/conversations/ui/ConversationsActivity.java b/src/main/java/eu/siacs/conversations/ui/ConversationsActivity.java index 4681f34d1..81e3befbd 100644 --- a/src/main/java/eu/siacs/conversations/ui/ConversationsActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/ConversationsActivity.java @@ -53,7 +53,6 @@ import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.TextView; -import android.widget.Toast; import androidx.annotation.IdRes; import androidx.annotation.NonNull; @@ -325,7 +324,7 @@ public class ConversationsActivity extends XmppActivity implements OnConversatio try { startActivityForResult(intent, REQUEST_BATTERY_OP); } catch (ActivityNotFoundException e) { - ToastCompat.makeText(this, R.string.device_does_not_support_battery_op, Toast.LENGTH_SHORT).show(); + ToastCompat.makeText(this, R.string.device_does_not_support_battery_op, ToastCompat.LENGTH_SHORT).show(); } }); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) { @@ -605,7 +604,7 @@ public class ConversationsActivity extends XmppActivity implements OnConversatio } private void displayToast(final String msg) { - runOnUiThread(() -> ToastCompat.makeText(ConversationsActivity.this, msg, Toast.LENGTH_SHORT).show()); + runOnUiThread(() -> ToastCompat.makeText(ConversationsActivity.this, msg, ToastCompat.LENGTH_SHORT).show()); } @Override @@ -703,7 +702,7 @@ public class ConversationsActivity extends XmppActivity implements OnConversatio if (xmppConnectionService.hasInternetConnection()) { openInstallFromUnknownSourcesDialogIfNeeded(true); } else { - ToastCompat.makeText(this, R.string.account_status_no_internet, Toast.LENGTH_LONG).show(); + ToastCompat.makeText(this, R.string.account_status_no_internet, ToastCompat.LENGTH_LONG).show(); } break; case R.id.action_invite_user: @@ -1044,7 +1043,7 @@ public class ConversationsActivity extends XmppActivity implements OnConversatio @Override public void onShowErrorToast(int resId) { - runOnUiThread(() -> ToastCompat.makeText(this, resId, Toast.LENGTH_SHORT).show()); + runOnUiThread(() -> ToastCompat.makeText(this, resId, ToastCompat.LENGTH_SHORT).show()); } protected void AppUpdate(String Store) { diff --git a/src/main/java/eu/siacs/conversations/ui/EasyOnboardingInviteActivity.java b/src/main/java/eu/siacs/conversations/ui/EasyOnboardingInviteActivity.java index 278dcd61e..2cf8e049f 100644 --- a/src/main/java/eu/siacs/conversations/ui/EasyOnboardingInviteActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/EasyOnboardingInviteActivity.java @@ -2,9 +2,6 @@ package eu.siacs.conversations.ui; import android.app.Activity; import android.content.Intent; - -import androidx.appcompat.widget.Toolbar; -import androidx.databinding.DataBindingUtil; import android.graphics.Bitmap; import android.graphics.Point; import android.os.Bundle; @@ -12,7 +9,9 @@ import android.util.Log; import android.view.Menu; import android.view.MenuItem; import android.view.View; -import android.widget.Toast; + +import androidx.appcompat.widget.Toolbar; +import androidx.databinding.DataBindingUtil; import com.google.common.base.Strings; @@ -23,6 +22,7 @@ import eu.siacs.conversations.entities.Account; import eu.siacs.conversations.services.BarcodeProvider; import eu.siacs.conversations.utils.EasyOnboardingInvite; import eu.siacs.conversations.xmpp.Jid; +import me.drakeet.support.toast.ToastCompat; public class EasyOnboardingInviteActivity extends XmppActivity implements EasyOnboardingInvite.OnInviteRequested { @@ -144,7 +144,7 @@ public class EasyOnboardingInviteActivity extends XmppActivity implements EasyOn public void inviteRequestFailed(final String message) { runOnUiThread(() -> { if (!Strings.isNullOrEmpty(message)) { - Toast.makeText(this, message, Toast.LENGTH_LONG).show(); + ToastCompat.makeText(this, message, ToastCompat.LENGTH_LONG).show(); } finish(); }); diff --git a/src/main/java/eu/siacs/conversations/ui/EditAccountActivity.java b/src/main/java/eu/siacs/conversations/ui/EditAccountActivity.java index 808e1fe9f..6bd8c20af 100644 --- a/src/main/java/eu/siacs/conversations/ui/EditAccountActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/EditAccountActivity.java @@ -129,7 +129,7 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat if (mAccount != null && mAccount.getStatus() == Account.State.DISABLED && !accountInfoEdited) { mAccount.setOption(Account.OPTION_DISABLED, false); if (!xmppConnectionService.updateAccount(mAccount)) { - ToastCompat.makeText(EditAccountActivity.this, R.string.unable_to_update_account, Toast.LENGTH_SHORT).show(); + ToastCompat.makeText(EditAccountActivity.this, R.string.unable_to_update_account, ToastCompat.LENGTH_SHORT).show(); } return; } @@ -159,7 +159,7 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat if (inNeedOfSaslAccept()) { mAccount.setKey(Account.PINNED_MECHANISM_KEY, String.valueOf(-1)); if (!xmppConnectionService.updateAccount(mAccount)) { - ToastCompat.makeText(EditAccountActivity.this, R.string.unable_to_update_account, Toast.LENGTH_SHORT).show(); + ToastCompat.makeText(EditAccountActivity.this, R.string.unable_to_update_account, ToastCompat.LENGTH_SHORT).show(); } return; } @@ -172,7 +172,7 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat CustomTab.openTab(EditAccountActivity.this, Uri.parse(url.toString()), isDarkTheme()); return; } catch (ActivityNotFoundException e) { - ToastCompat.makeText(EditAccountActivity.this, R.string.application_found_to_open_website, Toast.LENGTH_SHORT).show(); + ToastCompat.makeText(EditAccountActivity.this, R.string.application_found_to_open_website, ToastCompat.LENGTH_SHORT).show(); return; } } @@ -246,7 +246,7 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat } if (registerNewAccount) { if (XmppConnection.errorMessage != null) { - ToastCompat.makeText(EditAccountActivity.this, XmppConnection.errorMessage, Toast.LENGTH_LONG).show(); + ToastCompat.makeText(EditAccountActivity.this, XmppConnection.errorMessage, ToastCompat.LENGTH_LONG).show(); } } if (mAccount != null) { @@ -264,7 +264,7 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat mAccount.setPassword(password); mAccount.setOption(Account.OPTION_REGISTER, registerNewAccount); if (!xmppConnectionService.updateAccount(mAccount)) { - ToastCompat.makeText(EditAccountActivity.this, R.string.unable_to_update_account, Toast.LENGTH_SHORT).show(); + ToastCompat.makeText(EditAccountActivity.this, R.string.unable_to_update_account, ToastCompat.LENGTH_SHORT).show(); return; } } else { @@ -500,11 +500,11 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat protected void processFingerprintVerification(XmppUri uri, boolean showWarningToast) { if (mAccount != null && mAccount.getJid().asBareJid().equals(uri.getJid()) && uri.hasFingerprints()) { if (xmppConnectionService.verifyFingerprints(mAccount, uri.getFingerprints())) { - ToastCompat.makeText(this, R.string.verified_fingerprints, Toast.LENGTH_SHORT).show(); + ToastCompat.makeText(this, R.string.verified_fingerprints, ToastCompat.LENGTH_SHORT).show(); updateAccountInformation(false); } } else if (showWarningToast) { - ToastCompat.makeText(this, R.string.invalid_barcode, Toast.LENGTH_SHORT).show(); + ToastCompat.makeText(this, R.string.invalid_barcode, ToastCompat.LENGTH_SHORT).show(); } } @@ -1424,7 +1424,7 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat try { startActivityForResult(intent, REQUEST_DATA_SAVER); } catch (ActivityNotFoundException e) { - ToastCompat.makeText(EditAccountActivity.this, R.string.device_does_not_support_data_saver, Toast.LENGTH_SHORT).show(); + ToastCompat.makeText(EditAccountActivity.this, R.string.device_does_not_support_data_saver, ToastCompat.LENGTH_SHORT).show(); } }); } else if (showBatteryWarning && android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.M) { @@ -1438,7 +1438,7 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat try { startActivityForResult(intent, REQUEST_BATTERY_OP); } catch (ActivityNotFoundException e) { - ToastCompat.makeText(EditAccountActivity.this, R.string.device_does_not_support_battery_op, Toast.LENGTH_SHORT).show(); + ToastCompat.makeText(EditAccountActivity.this, R.string.device_does_not_support_battery_op, ToastCompat.LENGTH_SHORT).show(); } }); } @@ -1456,7 +1456,7 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat } private void editMamPrefs() { - this.mFetchingMamPrefsToast = ToastCompat.makeText(this, R.string.fetching_mam_prefs, Toast.LENGTH_LONG); + this.mFetchingMamPrefsToast = ToastCompat.makeText(this, R.string.fetching_mam_prefs, ToastCompat.LENGTH_LONG); this.mFetchingMamPrefsToast.show(); xmppConnectionService.fetchMamPreferences(mAccount, this); } @@ -1526,7 +1526,7 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat runOnUiThread(new Runnable() { @Override public void run() { - ToastCompat.makeText(EditAccountActivity.this, resId, Toast.LENGTH_SHORT).show(); + ToastCompat.makeText(EditAccountActivity.this, resId, ToastCompat.LENGTH_SHORT).show(); } }); } @@ -1558,7 +1558,7 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat if (mFetchingMamPrefsToast != null) { mFetchingMamPrefsToast.cancel(); } - ToastCompat.makeText(EditAccountActivity.this, R.string.unable_to_fetch_mam_prefs, Toast.LENGTH_LONG).show(); + ToastCompat.makeText(EditAccountActivity.this, R.string.unable_to_fetch_mam_prefs, ToastCompat.LENGTH_LONG).show(); }); } @@ -1572,7 +1572,7 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat break; } } else { - ToastCompat.makeText(this, R.string.no_storage_permission, Toast.LENGTH_SHORT).show(); + ToastCompat.makeText(this, R.string.no_storage_permission, ToastCompat.LENGTH_SHORT).show(); } } if (readGranted(grantResults, permissions)) { diff --git a/src/main/java/eu/siacs/conversations/ui/ManageAccountActivity.java b/src/main/java/eu/siacs/conversations/ui/ManageAccountActivity.java index e37557e4b..cdb28954b 100644 --- a/src/main/java/eu/siacs/conversations/ui/ManageAccountActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/ManageAccountActivity.java @@ -13,7 +13,6 @@ import android.view.MenuItem; import android.view.View; import android.widget.AdapterView.AdapterContextMenuInfo; import android.widget.ListView; -import android.widget.Toast; import androidx.annotation.NonNull; import androidx.appcompat.app.ActionBar; @@ -32,8 +31,8 @@ import eu.siacs.conversations.services.XmppConnectionService; import eu.siacs.conversations.services.XmppConnectionService.OnAccountUpdate; import eu.siacs.conversations.ui.adapter.AccountAdapter; import eu.siacs.conversations.utils.MenuDoubleTabUtil; -import eu.siacs.conversations.xmpp.XmppConnection; import eu.siacs.conversations.xmpp.Jid; +import eu.siacs.conversations.xmpp.XmppConnection; import me.drakeet.support.toast.ToastCompat; import static eu.siacs.conversations.utils.PermissionUtils.allGranted; @@ -221,7 +220,7 @@ public class ManageAccountActivity extends XmppActivity implements OnAccountUpda break; } } else { - ToastCompat.makeText(this, R.string.no_storage_permission, Toast.LENGTH_SHORT).show(); + ToastCompat.makeText(this, R.string.no_storage_permission, ToastCompat.LENGTH_SHORT).show(); } } if (readGranted(grantResults, permissions)) { @@ -265,7 +264,7 @@ public class ManageAccountActivity extends XmppActivity implements OnAccountUpda try { KeyChain.choosePrivateKeyAlias(this, this, null, null, null, -1, null); } catch (ActivityNotFoundException e) { - ToastCompat.makeText(this, R.string.device_does_not_support_certificates, Toast.LENGTH_LONG).show(); + ToastCompat.makeText(this, R.string.device_does_not_support_certificates, ToastCompat.LENGTH_LONG).show(); } } @@ -330,7 +329,7 @@ public class ManageAccountActivity extends XmppActivity implements OnAccountUpda private void disableAccount(Account account) { account.setOption(Account.OPTION_DISABLED, true); if (!xmppConnectionService.updateAccount(account)) { - ToastCompat.makeText(this, R.string.unable_to_update_account, Toast.LENGTH_SHORT).show(); + ToastCompat.makeText(this, R.string.unable_to_update_account, ToastCompat.LENGTH_SHORT).show(); } } @@ -341,7 +340,7 @@ public class ManageAccountActivity extends XmppActivity implements OnAccountUpda connection.resetEverything(); } if (!xmppConnectionService.updateAccount(account)) { - ToastCompat.makeText(this, R.string.unable_to_update_account, Toast.LENGTH_SHORT).show(); + ToastCompat.makeText(this, R.string.unable_to_update_account, ToastCompat.LENGTH_SHORT).show(); } } @@ -424,6 +423,6 @@ public class ManageAccountActivity extends XmppActivity implements OnAccountUpda @Override public void informUser(final int r) { - runOnUiThread(() -> ToastCompat.makeText(ManageAccountActivity.this, r, Toast.LENGTH_LONG).show()); + runOnUiThread(() -> ToastCompat.makeText(ManageAccountActivity.this, r, ToastCompat.LENGTH_LONG).show()); } } diff --git a/src/main/java/eu/siacs/conversations/ui/MediaViewerActivity.java b/src/main/java/eu/siacs/conversations/ui/MediaViewerActivity.java index a720a8c32..6e225bcd1 100644 --- a/src/main/java/eu/siacs/conversations/ui/MediaViewerActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/MediaViewerActivity.java @@ -21,7 +21,6 @@ import android.view.MotionEvent; import android.view.View; import android.view.WindowManager; import android.webkit.MimeTypeMap; -import android.widget.Toast; import androidx.appcompat.app.ActionBar; import androidx.appcompat.app.AlertDialog; @@ -122,7 +121,7 @@ public class MediaViewerActivity extends XmppActivity implements AudioManager.On startActivity(Intent.createChooser(share, getText(R.string.share_with))); } catch (ActivityNotFoundException e) { //This should happen only on faulty androids because normally chooser is always available - ToastCompat.makeText(this, R.string.no_application_found_to_open_file, Toast.LENGTH_SHORT).show(); + ToastCompat.makeText(this, R.string.no_application_found_to_open_file, ToastCompat.LENGTH_SHORT).show(); } } @@ -145,7 +144,7 @@ public class MediaViewerActivity extends XmppActivity implements AudioManager.On uri = FileBackend.getUriForFile(this, mFile); } catch (SecurityException e) { Log.d(Config.LOGTAG, "No permission to access " + mFile.getAbsolutePath(), e); - ToastCompat.makeText(this, this.getString(R.string.no_permission_to_access_x, mFile.getAbsolutePath()), Toast.LENGTH_SHORT).show(); + ToastCompat.makeText(this, this.getString(R.string.no_permission_to_access_x, mFile.getAbsolutePath()), ToastCompat.LENGTH_SHORT).show(); return; } String mime = MimeUtils.guessMimeTypeFromUri(this, uri); @@ -161,7 +160,7 @@ public class MediaViewerActivity extends XmppActivity implements AudioManager.On this.startActivity(openIntent); finish(); } catch (ActivityNotFoundException e) { - ToastCompat.makeText(this, R.string.no_application_found_to_open_file, Toast.LENGTH_SHORT).show(); + ToastCompat.makeText(this, R.string.no_application_found_to_open_file, ToastCompat.LENGTH_SHORT).show(); } } @@ -185,11 +184,11 @@ public class MediaViewerActivity extends XmppActivity implements AudioManager.On } catch (Exception e) { isImage = false; Log.d(Config.LOGTAG, "Illegal exeption :" + e); - ToastCompat.makeText(MediaViewerActivity.this, getString(R.string.error_file_corrupt), Toast.LENGTH_SHORT).show(); + ToastCompat.makeText(MediaViewerActivity.this, getString(R.string.error_file_corrupt), ToastCompat.LENGTH_SHORT).show(); finish(); } } else { - ToastCompat.makeText(MediaViewerActivity.this, getString(R.string.file_deleted), Toast.LENGTH_SHORT).show(); + ToastCompat.makeText(MediaViewerActivity.this, getString(R.string.file_deleted), ToastCompat.LENGTH_SHORT).show(); } } else if (intent.hasExtra("video")) { mFileUri = intent.getParcelableExtra("video"); @@ -201,11 +200,11 @@ public class MediaViewerActivity extends XmppActivity implements AudioManager.On } catch (Exception e) { isVideo = false; Log.d(Config.LOGTAG, "Illegal exeption :" + e); - ToastCompat.makeText(MediaViewerActivity.this, getString(R.string.error_file_corrupt), Toast.LENGTH_SHORT).show(); + ToastCompat.makeText(MediaViewerActivity.this, getString(R.string.error_file_corrupt), ToastCompat.LENGTH_SHORT).show(); finish(); } } else { - ToastCompat.makeText(MediaViewerActivity.this, getString(R.string.file_deleted), Toast.LENGTH_SHORT).show(); + ToastCompat.makeText(MediaViewerActivity.this, getString(R.string.file_deleted), ToastCompat.LENGTH_SHORT).show(); } } } @@ -284,7 +283,7 @@ public class MediaViewerActivity extends XmppActivity implements AudioManager.On binding.messageImageView.setOnTouchListener((view, motionEvent) -> gestureDetector.onTouchEvent(motionEvent)); } } catch (Exception e) { - ToastCompat.makeText(this, getString(R.string.error_file_corrupt), Toast.LENGTH_LONG).show(); + ToastCompat.makeText(this, getString(R.string.error_file_corrupt), ToastCompat.LENGTH_LONG).show(); e.printStackTrace(); } } diff --git a/src/main/java/eu/siacs/conversations/ui/MucUsersActivity.java b/src/main/java/eu/siacs/conversations/ui/MucUsersActivity.java index 1c55aa227..8c32ba4d9 100644 --- a/src/main/java/eu/siacs/conversations/ui/MucUsersActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/MucUsersActivity.java @@ -11,7 +11,6 @@ import android.view.MenuItem; import android.view.View; import android.view.inputmethod.InputMethodManager; import android.widget.EditText; -import android.widget.Toast; import androidx.appcompat.widget.Toolbar; import androidx.databinding.DataBindingUtil; @@ -105,7 +104,7 @@ public class MucUsersActivity extends XmppActivity implements XmppConnectionServ } private void displayToast(final String msg) { - runOnUiThread(() -> ToastCompat.makeText(this, msg, Toast.LENGTH_SHORT).show()); + runOnUiThread(() -> ToastCompat.makeText(this, msg, ToastCompat.LENGTH_SHORT).show()); } @Override diff --git a/src/main/java/eu/siacs/conversations/ui/OmemoActivity.java b/src/main/java/eu/siacs/conversations/ui/OmemoActivity.java index 30ff475cb..c5e8173f5 100644 --- a/src/main/java/eu/siacs/conversations/ui/OmemoActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/OmemoActivity.java @@ -7,7 +7,6 @@ import android.view.MenuItem; import android.view.View; import android.widget.CompoundButton; import android.widget.LinearLayout; -import android.widget.Toast; import androidx.appcompat.app.AlertDialog; import androidx.databinding.DataBindingUtil; @@ -96,7 +95,7 @@ public abstract class OmemoActivity extends XmppActivity { ToastCompat.makeText( this, R.string.toast_message_omemo_fingerprint, - Toast.LENGTH_SHORT).show(); + ToastCompat.LENGTH_SHORT).show(); } } diff --git a/src/main/java/eu/siacs/conversations/ui/PublishGroupChatProfilePictureActivity.java b/src/main/java/eu/siacs/conversations/ui/PublishGroupChatProfilePictureActivity.java index 08687d5d0..40e9877c9 100644 --- a/src/main/java/eu/siacs/conversations/ui/PublishGroupChatProfilePictureActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/PublishGroupChatProfilePictureActivity.java @@ -35,7 +35,6 @@ import android.net.Uri; import android.os.Bundle; import android.util.Log; import android.view.View; -import android.widget.Toast; import androidx.annotation.StringRes; import androidx.appcompat.widget.Toolbar; @@ -127,7 +126,7 @@ public class PublishGroupChatProfilePictureActivity extends XmppActivity impleme } else if (resultCode == CropImage.CROP_IMAGE_ACTIVITY_RESULT_ERROR_CODE) { Exception error = result.getError(); if (error != null) { - ToastCompat.makeText(this, error.getMessage(), Toast.LENGTH_SHORT).show(); + ToastCompat.makeText(this, error.getMessage(), ToastCompat.LENGTH_SHORT).show(); } } } else if (requestCode == REQUEST_CHOOSE_PICTURE) { @@ -140,7 +139,7 @@ public class PublishGroupChatProfilePictureActivity extends XmppActivity impleme @Override public void onAvatarPublicationSucceeded() { runOnUiThread(() -> { - ToastCompat.makeText(this, R.string.avatar_has_been_published, Toast.LENGTH_SHORT).show(); + ToastCompat.makeText(this, R.string.avatar_has_been_published, ToastCompat.LENGTH_SHORT).show(); finish(); }); } @@ -148,7 +147,7 @@ public class PublishGroupChatProfilePictureActivity extends XmppActivity impleme @Override public void onAvatarPublicationFailed(@StringRes int res) { runOnUiThread(() -> { - ToastCompat.makeText(this, res, Toast.LENGTH_SHORT).show(); + ToastCompat.makeText(this, res, ToastCompat.LENGTH_SHORT).show(); this.binding.publishButton.setText(R.string.publish); this.binding.publishButton.setEnabled(true); }); diff --git a/src/main/java/eu/siacs/conversations/ui/PublishProfilePictureActivity.java b/src/main/java/eu/siacs/conversations/ui/PublishProfilePictureActivity.java index 66aa4314a..a2bff7ddd 100644 --- a/src/main/java/eu/siacs/conversations/ui/PublishProfilePictureActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/PublishProfilePictureActivity.java @@ -12,7 +12,6 @@ import android.view.View.OnLongClickListener; import android.widget.Button; import android.widget.ImageView; import android.widget.TextView; -import android.widget.Toast; import androidx.annotation.StringRes; @@ -66,7 +65,7 @@ public class PublishProfilePictureActivity extends XmppActivity implements XmppC } ToastCompat.makeText(PublishProfilePictureActivity.this, R.string.avatar_has_been_published, - Toast.LENGTH_SHORT).show(); + ToastCompat.LENGTH_SHORT).show(); finish(); }); } @@ -143,7 +142,7 @@ public class PublishProfilePictureActivity extends XmppActivity implements XmppC } else if (resultCode == CropImage.CROP_IMAGE_ACTIVITY_RESULT_ERROR_CODE) { Exception error = result.getError(); if (error != null) { - ToastCompat.makeText(this, error.getMessage(), Toast.LENGTH_SHORT).show(); + ToastCompat.makeText(this, error.getMessage(), ToastCompat.LENGTH_SHORT).show(); } } } else if (requestCode == REQUEST_CHOOSE_PICTURE) { diff --git a/src/main/java/eu/siacs/conversations/ui/RecordingActivity.java b/src/main/java/eu/siacs/conversations/ui/RecordingActivity.java index f3a2f52d1..421262537 100644 --- a/src/main/java/eu/siacs/conversations/ui/RecordingActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/RecordingActivity.java @@ -13,7 +13,6 @@ import android.util.Log; import android.view.View; import android.view.Window; import android.view.WindowManager; -import android.widget.Toast; import androidx.appcompat.app.AppCompatActivity; import androidx.databinding.DataBindingUtil; @@ -128,7 +127,7 @@ public class RecordingActivity extends AppCompatActivity implements View.OnClick mRecorder.release(); } catch (Exception e) { if (saveFile) { - ToastCompat.makeText(this, R.string.unable_to_save_recording, Toast.LENGTH_SHORT).show(); + ToastCompat.makeText(this, R.string.unable_to_save_recording, ToastCompat.LENGTH_SHORT).show(); return; } } finally { diff --git a/src/main/java/eu/siacs/conversations/ui/RtpSessionActivity.java b/src/main/java/eu/siacs/conversations/ui/RtpSessionActivity.java index 8d589be00..8fc8fa20e 100644 --- a/src/main/java/eu/siacs/conversations/ui/RtpSessionActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/RtpSessionActivity.java @@ -18,7 +18,6 @@ import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.WindowManager; -import android.widget.Toast; import androidx.annotation.NonNull; import androidx.annotation.RequiresApi; @@ -62,6 +61,7 @@ import eu.siacs.conversations.xmpp.jingle.JingleConnectionManager; import eu.siacs.conversations.xmpp.jingle.JingleRtpConnection; import eu.siacs.conversations.xmpp.jingle.Media; import eu.siacs.conversations.xmpp.jingle.RtpEndUserState; +import me.drakeet.support.toast.ToastCompat; import static eu.siacs.conversations.utils.PermissionUtils.getFirstDenied; import static java.util.Arrays.asList; @@ -190,7 +190,7 @@ public class RtpSessionActivity extends XmppActivity implements XmppConnectionSe try { startActivity(intent); } catch (final ActivityNotFoundException e) { - Toast.makeText(this, R.string.no_application_found_to_open_link, Toast.LENGTH_LONG).show(); + ToastCompat.makeText(this, R.string.no_application_found_to_open_link, ToastCompat.LENGTH_LONG).show(); } } @@ -246,7 +246,7 @@ public class RtpSessionActivity extends XmppActivity implements XmppConnectionSe try { requireRtpConnection().acceptCall(); } catch (final IllegalStateException e) { - Toast.makeText(this, e.getMessage(), Toast.LENGTH_SHORT).show(); + ToastCompat.makeText(this, e.getMessage(), ToastCompat.LENGTH_SHORT).show(); } } @@ -259,7 +259,7 @@ public class RtpSessionActivity extends XmppActivity implements XmppConnectionSe if (isMicrophoneAvailable) { return; } - runOnUiThread(() -> Toast.makeText(this, R.string.microphone_unavailable, Toast.LENGTH_LONG).show()); + runOnUiThread(() -> ToastCompat.makeText(this, R.string.microphone_unavailable, ToastCompat.LENGTH_LONG).show()); } ).start(); } @@ -436,7 +436,7 @@ public class RtpSessionActivity extends XmppActivity implements XmppConnectionSe } else { throw new IllegalStateException("Invalid permission result request"); } - Toast.makeText(this, getString(res, getString(R.string.app_name)), Toast.LENGTH_SHORT).show(); + ToastCompat.makeText(this, getString(res, getString(R.string.app_name)), ToastCompat.LENGTH_SHORT).show(); } } @@ -882,7 +882,7 @@ public class RtpSessionActivity extends XmppActivity implements XmppConnectionSe @Override public void onFailure(@NonNull final Throwable throwable) { Log.d(Config.LOGTAG, "could not switch camera", Throwables.getRootCause(throwable)); - Toast.makeText(RtpSessionActivity.this, R.string.could_not_switch_camera, Toast.LENGTH_LONG).show(); + ToastCompat.makeText(RtpSessionActivity.this, R.string.could_not_switch_camera, ToastCompat.LENGTH_LONG).show(); } }, MainThreadExecutor.getInstance()); } @@ -891,7 +891,7 @@ public class RtpSessionActivity extends XmppActivity implements XmppConnectionSe try { requireRtpConnection().setVideoEnabled(true); } catch (final IllegalStateException e) { - Toast.makeText(this, R.string.unable_to_enable_video, Toast.LENGTH_SHORT).show(); + ToastCompat.makeText(this, R.string.unable_to_enable_video, ToastCompat.LENGTH_SHORT).show(); return; } updateInCallButtonConfigurationVideo(true, requireRtpConnection().isCameraSwitchable()); diff --git a/src/main/java/eu/siacs/conversations/ui/ScanActivity.java b/src/main/java/eu/siacs/conversations/ui/ScanActivity.java index 3c1dd8fda..85f1fabbe 100644 --- a/src/main/java/eu/siacs/conversations/ui/ScanActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/ScanActivity.java @@ -40,7 +40,6 @@ import android.view.TextureView; import android.view.TextureView.SurfaceTextureListener; import android.view.View; import android.view.WindowManager; -import android.widget.Toast; import androidx.core.app.ActivityCompat; import androidx.core.content.ContextCompat; @@ -292,7 +291,7 @@ public final class ScanActivity extends Activity implements SurfaceTextureListen if (grantResults[0] == PackageManager.PERMISSION_GRANTED) { scan(activity); } else { - ToastCompat.makeText(activity, R.string.qr_code_scanner_needs_access_to_camera, Toast.LENGTH_SHORT).show(); + ToastCompat.makeText(activity, R.string.qr_code_scanner_needs_access_to_camera, ToastCompat.LENGTH_SHORT).show(); } } } diff --git a/src/main/java/eu/siacs/conversations/ui/SettingsActivity.java b/src/main/java/eu/siacs/conversations/ui/SettingsActivity.java index 96e738cc0..8da706d50 100644 --- a/src/main/java/eu/siacs/conversations/ui/SettingsActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/SettingsActivity.java @@ -16,7 +16,6 @@ import android.preference.PreferenceCategory; import android.preference.PreferenceManager; import android.preference.PreferenceScreen; import android.util.Log; -import android.widget.Toast; import androidx.annotation.NonNull; import androidx.appcompat.app.AlertDialog; @@ -577,7 +576,7 @@ public class SettingsActivity extends XmppActivity implements createBackup(true); } } else { - ToastCompat.makeText(this, R.string.no_storage_permission, Toast.LENGTH_SHORT).show(); + ToastCompat.makeText(this, R.string.no_storage_permission, ToastCompat.LENGTH_SHORT).show(); } } } @@ -593,7 +592,7 @@ public class SettingsActivity extends XmppActivity implements } private void displayToast(final String msg) { - runOnUiThread(() -> ToastCompat.makeText(SettingsActivity.this, msg, Toast.LENGTH_LONG).show()); + runOnUiThread(() -> ToastCompat.makeText(SettingsActivity.this, msg, ToastCompat.LENGTH_LONG).show()); } private void reconnectAccounts() { diff --git a/src/main/java/eu/siacs/conversations/ui/ShareWithActivity.java b/src/main/java/eu/siacs/conversations/ui/ShareWithActivity.java index fd6066329..015712073 100644 --- a/src/main/java/eu/siacs/conversations/ui/ShareWithActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/ShareWithActivity.java @@ -7,7 +7,6 @@ import android.os.Bundle; import android.util.Log; import android.view.Menu; import android.view.MenuItem; -import android.widget.Toast; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; @@ -76,7 +75,7 @@ public class ShareWithActivity extends XmppActivity implements XmppConnectionSer } } } else { - ToastCompat.makeText(this, R.string.no_storage_permission, Toast.LENGTH_SHORT).show(); + ToastCompat.makeText(this, R.string.no_storage_permission, ToastCompat.LENGTH_SHORT).show(); } } @@ -196,7 +195,7 @@ public class ShareWithActivity extends XmppActivity implements XmppConnectionSer try { startActivity(intent); } catch (SecurityException e) { - ToastCompat.makeText(this, R.string.sharing_application_not_grant_permission, Toast.LENGTH_SHORT).show(); + ToastCompat.makeText(this, R.string.sharing_application_not_grant_permission, ToastCompat.LENGTH_SHORT).show(); return; } finish(); diff --git a/src/main/java/eu/siacs/conversations/ui/StartConversationActivity.java b/src/main/java/eu/siacs/conversations/ui/StartConversationActivity.java index 80e6de67b..1e1faf6f9 100644 --- a/src/main/java/eu/siacs/conversations/ui/StartConversationActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/StartConversationActivity.java @@ -247,7 +247,7 @@ public class StartConversationActivity extends XmppActivity implements XmppConne protected void replaceToast(String msg) { hideToast(); - mToast = ToastCompat.makeText(this, msg, Toast.LENGTH_LONG); + mToast = ToastCompat.makeText(this, msg, ToastCompat.LENGTH_LONG); mToast.show(); } @@ -410,14 +410,14 @@ public class StartConversationActivity extends XmppActivity implements XmppConne try { context.startActivity(Intent.createChooser(shareIntent, context.getText(R.string.share_uri_with))); } catch (ActivityNotFoundException e) { - ToastCompat.makeText(context, R.string.no_application_to_share_uri, Toast.LENGTH_SHORT).show(); + ToastCompat.makeText(context, R.string.no_application_to_share_uri, ToastCompat.LENGTH_SHORT).show(); } } protected void openConversationsForBookmark(Bookmark bookmark) { final Jid jid = bookmark.getFullJid(); if (jid == null) { - ToastCompat.makeText(this, R.string.invalid_jid, Toast.LENGTH_SHORT).show(); + ToastCompat.makeText(this, R.string.invalid_jid, ToastCompat.LENGTH_SHORT).show(); return; } Conversation conversation = xmppConnectionService.findOrCreateConversation(bookmark.getAccount(), jid, true, true, true); @@ -714,7 +714,7 @@ public class StartConversationActivity extends XmppActivity implements XmppConne final List jids = ChooseContactActivity.extractJabberIds(intent); if (account != null && jids.size() > 0) { if (xmppConnectionService.createAdhocConference(account, name, jids, mAdhocConferenceCallback)) { - mToast = ToastCompat.makeText(this, R.string.creating_conference, Toast.LENGTH_LONG); + mToast = ToastCompat.makeText(this, R.string.creating_conference, ToastCompat.LENGTH_LONG); mToast.show(); } } @@ -844,7 +844,7 @@ public class StartConversationActivity extends XmppActivity implements XmppConne } else { if (invite.hasFingerprints()) { if (xmppConnectionService.verifyFingerprints(contact, invite.getFingerprints())) { - ToastCompat.makeText(this, R.string.verified_fingerprints, Toast.LENGTH_SHORT).show(); + ToastCompat.makeText(this, R.string.verified_fingerprints, ToastCompat.LENGTH_SHORT).show(); } } if (invite.account != null) { @@ -1039,7 +1039,7 @@ public class StartConversationActivity extends XmppActivity implements XmppConne @Override public void onCreatePublicChannel(Account account, String name, Jid address) { - mToast = ToastCompat.makeText(this, R.string.creating_channel, Toast.LENGTH_LONG); + mToast = ToastCompat.makeText(this, R.string.creating_channel, ToastCompat.LENGTH_LONG); mToast.show(); xmppConnectionService.createPublicChannel(account, name, address, new UiCallback() { @Override @@ -1263,7 +1263,7 @@ public class StartConversationActivity extends XmppActivity implements XmppConne boolean invite() { if (!isValidJid()) { - ToastCompat.makeText(StartConversationActivity.this, R.string.invalid_jid, Toast.LENGTH_SHORT).show(); + ToastCompat.makeText(StartConversationActivity.this, R.string.invalid_jid, ToastCompat.LENGTH_SHORT).show(); return false; } if (getJid() != null) { diff --git a/src/main/java/eu/siacs/conversations/ui/TrustKeysActivity.java b/src/main/java/eu/siacs/conversations/ui/TrustKeysActivity.java index 1eb368f9f..0dbd18bba 100644 --- a/src/main/java/eu/siacs/conversations/ui/TrustKeysActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/TrustKeysActivity.java @@ -1,6 +1,5 @@ package eu.siacs.conversations.ui; -import androidx.appcompat.app.AlertDialog; import android.content.Intent; import android.os.Bundle; import android.util.Log; @@ -12,6 +11,7 @@ import android.view.View.OnClickListener; import android.widget.Toast; import androidx.appcompat.app.ActionBar; +import androidx.appcompat.app.AlertDialog; import androidx.appcompat.widget.Toolbar; import androidx.databinding.DataBindingUtil; @@ -38,8 +38,8 @@ import eu.siacs.conversations.entities.Message; import eu.siacs.conversations.utils.CryptoHelper; import eu.siacs.conversations.utils.IrregularUnicodeDetector; import eu.siacs.conversations.utils.XmppUri; -import eu.siacs.conversations.xmpp.OnKeyStatusUpdated; import eu.siacs.conversations.xmpp.Jid; +import eu.siacs.conversations.xmpp.OnKeyStatusUpdated; import me.drakeet.support.toast.ToastCompat; public class TrustKeysActivity extends OmemoActivity implements OnKeyStatusUpdated { @@ -106,7 +106,7 @@ public class TrustKeysActivity extends OmemoActivity implements OnKeyStatusUpdat } private void showCameraToast() { - mUseCameraHintToast = ToastCompat.makeText(this, R.string.use_camera_icon_to_scan_barcode, Toast.LENGTH_LONG); + mUseCameraHintToast = ToastCompat.makeText(this, R.string.use_camera_icon_to_scan_barcode, ToastCompat.LENGTH_LONG); ActionBar actionBar = getSupportActionBar(); mUseCameraHintToast.setGravity(Gravity.TOP | Gravity.END, 0, actionBar == null ? 0 : actionBar.getHeight()); mUseCameraHintToast.show(); @@ -117,7 +117,7 @@ public class TrustKeysActivity extends OmemoActivity implements OnKeyStatusUpdat switch (item.getItemId()) { case R.id.action_scan_qr_code: if (hasPendingKeyFetches()) { - ToastCompat.makeText(this, R.string.please_wait_for_keys_to_be_fetched, Toast.LENGTH_SHORT).show(); + ToastCompat.makeText(this, R.string.please_wait_for_keys_to_be_fetched, ToastCompat.LENGTH_SHORT).show(); } else { ScanActivity.scan(this); return true; @@ -143,16 +143,16 @@ public class TrustKeysActivity extends OmemoActivity implements OnKeyStatusUpdat boolean performedVerification = xmppConnectionService.verifyFingerprints(mAccount.getRoster().getContact(uri.getJid()), uri.getFingerprints()); boolean keys = reloadFingerprints(); if (performedVerification && !keys && !hasNoOtherTrustedKeys() && !hasPendingKeyFetches()) { - ToastCompat.makeText(this, R.string.all_omemo_keys_have_been_verified, Toast.LENGTH_SHORT).show(); + ToastCompat.makeText(this, R.string.all_omemo_keys_have_been_verified, ToastCompat.LENGTH_SHORT).show(); finishOk(false); return; } else if (performedVerification) { - ToastCompat.makeText(this, R.string.verified_fingerprints, Toast.LENGTH_SHORT).show(); + ToastCompat.makeText(this, R.string.verified_fingerprints, ToastCompat.LENGTH_SHORT).show(); } } else { reloadFingerprints(); Log.d(Config.LOGTAG, "xmpp uri was: " + uri.getJid() + " has Fingerprints: " + Boolean.toString(uri.hasFingerprints())); - ToastCompat.makeText(this, R.string.barcode_does_not_contain_fingerprints_for_this_conversation, Toast.LENGTH_SHORT).show(); + ToastCompat.makeText(this, R.string.barcode_does_not_contain_fingerprints_for_this_conversation, ToastCompat.LENGTH_SHORT).show(); } populateView(); } @@ -368,15 +368,15 @@ public class TrustKeysActivity extends OmemoActivity implements OnKeyStatusUpdat } switch (report) { case ERROR: - ToastCompat.makeText(TrustKeysActivity.this, R.string.error_fetching_omemo_key, Toast.LENGTH_SHORT).show(); + ToastCompat.makeText(TrustKeysActivity.this, R.string.error_fetching_omemo_key, ToastCompat.LENGTH_SHORT).show(); break; case SUCCESS_TRUSTED: - ToastCompat.makeText(TrustKeysActivity.this, R.string.blindly_trusted_omemo_keys, Toast.LENGTH_LONG).show(); + ToastCompat.makeText(TrustKeysActivity.this, R.string.blindly_trusted_omemo_keys, ToastCompat.LENGTH_LONG).show(); break; case SUCCESS_VERIFIED: ToastCompat.makeText(TrustKeysActivity.this, Config.X509_VERIFICATION ? R.string.verified_omemo_key_with_certificate : R.string.all_omemo_keys_have_been_verified, - Toast.LENGTH_LONG).show(); + ToastCompat.LENGTH_LONG).show(); break; } }); diff --git a/src/main/java/eu/siacs/conversations/ui/UpdaterActivity.java b/src/main/java/eu/siacs/conversations/ui/UpdaterActivity.java index c32eb3d8f..3111f4b23 100644 --- a/src/main/java/eu/siacs/conversations/ui/UpdaterActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/UpdaterActivity.java @@ -15,7 +15,6 @@ import android.os.Bundle; import android.os.PowerManager; import android.util.Log; import android.widget.TextView; -import android.widget.Toast; import androidx.appcompat.app.AlertDialog; import androidx.core.app.ActivityCompat; @@ -102,13 +101,13 @@ public class UpdaterActivity extends XmppActivity { try { appURI = getIntent().getStringExtra("url"); } catch (Exception e) { - ToastCompat.makeText(getApplicationContext(), getText(R.string.failed), Toast.LENGTH_LONG).show(); + ToastCompat.makeText(getApplicationContext(), getText(R.string.failed), ToastCompat.LENGTH_LONG).show(); UpdaterActivity.this.finish(); } try { changelog = getIntent().getStringExtra("changelog"); } catch (Exception e) { - ToastCompat.makeText(getApplicationContext(), getText(R.string.failed), Toast.LENGTH_LONG).show(); + ToastCompat.makeText(getApplicationContext(), getText(R.string.failed), ToastCompat.LENGTH_LONG).show(); UpdaterActivity.this.finish(); } try { @@ -150,7 +149,7 @@ public class UpdaterActivity extends XmppActivity { uri = Uri.parse("https://" + blabber()); CustomTab.openTab(this, uri, isDarkTheme()); } catch (Exception e) { - ToastCompat.makeText(this, R.string.no_application_found_to_open_link, Toast.LENGTH_SHORT).show(); + ToastCompat.makeText(this, R.string.no_application_found_to_open_link, ToastCompat.LENGTH_SHORT).show(); } } } else if (store != null && store.equalsIgnoreCase(FDroid)) { @@ -166,11 +165,11 @@ public class UpdaterActivity extends XmppActivity { try { CustomTab.openTab(this, uri, isDarkTheme()); } catch (Exception e) { - ToastCompat.makeText(this, R.string.no_application_found_to_open_link, Toast.LENGTH_SHORT).show(); + ToastCompat.makeText(this, R.string.no_application_found_to_open_link, ToastCompat.LENGTH_SHORT).show(); } } } else { - ToastCompat.makeText(getApplicationContext(), getText(R.string.download_started), Toast.LENGTH_LONG).show(); + ToastCompat.makeText(getApplicationContext(), getText(R.string.download_started), ToastCompat.LENGTH_LONG).show(); downloadTask = new DownloadTask(UpdaterActivity.this); downloadTask.execute(appURI); } @@ -183,7 +182,7 @@ public class UpdaterActivity extends XmppActivity { try { CustomTab.openTab(this, uri, isDarkTheme()); } catch (Exception e) { - ToastCompat.makeText(this, R.string.no_application_found_to_open_link, Toast.LENGTH_SHORT).show(); + ToastCompat.makeText(this, R.string.no_application_found_to_open_link, ToastCompat.LENGTH_SHORT).show(); } finally { //restart updater to show dialog again after coming back after opening changelog recreate(); @@ -196,7 +195,7 @@ public class UpdaterActivity extends XmppActivity { //show the alert message builder.create().show(); } else { - ToastCompat.makeText(getApplicationContext(), getText(R.string.failed), Toast.LENGTH_LONG).show(); + ToastCompat.makeText(getApplicationContext(), getText(R.string.failed), ToastCompat.LENGTH_LONG).show(); UpdaterActivity.this.finish(); } } @@ -366,7 +365,7 @@ public class UpdaterActivity extends XmppActivity { // expect HTTP 200 OK, so we don't mistakenly save error report // instead of the file if (connection.getResponseCode() != HttpsURLConnection.HTTP_OK) { - ToastCompat.makeText(getApplicationContext(), getText(R.string.failed), Toast.LENGTH_LONG).show(); + ToastCompat.makeText(getApplicationContext(), getText(R.string.failed), ToastCompat.LENGTH_LONG).show(); return connection.getResponseCode() + ": " + connection.getResponseMessage(); } @@ -422,7 +421,7 @@ public class UpdaterActivity extends XmppActivity { WakeLockHelper.release(mWakeLock); mProgressDialog.dismiss(); if (result != null) { - ToastCompat.makeText(getApplicationContext(), getString(R.string.failed), Toast.LENGTH_LONG).show(); + ToastCompat.makeText(getApplicationContext(), getString(R.string.failed), ToastCompat.LENGTH_LONG).show(); Log.d(Config.LOGTAG, "AppUpdater: failed with " + result); UpdaterActivity.this.finish(); } else { diff --git a/src/main/java/eu/siacs/conversations/ui/UriHandlerActivity.java b/src/main/java/eu/siacs/conversations/ui/UriHandlerActivity.java index 13821a045..d938c35c8 100644 --- a/src/main/java/eu/siacs/conversations/ui/UriHandlerActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/UriHandlerActivity.java @@ -7,7 +7,6 @@ import android.content.pm.PackageManager; import android.net.Uri; import android.os.Build; import android.os.Bundle; -import android.widget.Toast; import androidx.appcompat.app.AppCompatActivity; import androidx.core.content.ContextCompat; @@ -70,7 +69,7 @@ public class UriHandlerActivity extends AppCompatActivity { scan(activity); } } else { - ToastCompat.makeText(activity, R.string.qr_code_scanner_needs_access_to_camera, Toast.LENGTH_SHORT).show(); + ToastCompat.makeText(activity, R.string.qr_code_scanner_needs_access_to_camera, ToastCompat.LENGTH_SHORT).show(); } } } @@ -113,7 +112,7 @@ public class UriHandlerActivity extends AppCompatActivity { final Jid jid = xmppUri.getJid(); if (xmppUri.isAction(XmppUri.ACTION_REGISTER)) { if (jid.getEscapedLocal() != null && accounts.contains(jid.asBareJid())) { - ToastCompat.makeText(this, R.string.account_already_exists, Toast.LENGTH_LONG).show(); + ToastCompat.makeText(this, R.string.account_already_exists, ToastCompat.LENGTH_LONG).show(); return; } intent = SignupUtils.getTokenRegistrationIntent(this, jid, preAuth, true); @@ -133,7 +132,7 @@ public class UriHandlerActivity extends AppCompatActivity { intent.putExtra(StartConversationActivity.EXTRA_INVITE_URI, xmppUri.toString()); startActivity(intent); } else { - ToastCompat.makeText(this, R.string.invalid_jid, Toast.LENGTH_SHORT).show(); + ToastCompat.makeText(this, R.string.invalid_jid, ToastCompat.LENGTH_SHORT).show(); } return; } @@ -176,7 +175,7 @@ public class UriHandlerActivity extends AppCompatActivity { intent.putExtra("scanned", scanned); intent.setData(uri); } else { - ToastCompat.makeText(this, R.string.invalid_jid, Toast.LENGTH_SHORT).show(); + ToastCompat.makeText(this, R.string.invalid_jid, ToastCompat.LENGTH_SHORT).show(); return; } startActivity(intent); diff --git a/src/main/java/eu/siacs/conversations/ui/WelcomeActivity.java b/src/main/java/eu/siacs/conversations/ui/WelcomeActivity.java index bae56aa2e..804b1c521 100644 --- a/src/main/java/eu/siacs/conversations/ui/WelcomeActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/WelcomeActivity.java @@ -1,11 +1,9 @@ package eu.siacs.conversations.ui; import android.Manifest; -import android.app.Activity; import android.content.ActivityNotFoundException; import android.content.Intent; import android.content.pm.ActivityInfo; -import android.content.pm.PackageManager; import android.net.Uri; import android.os.Bundle; import android.security.KeyChain; @@ -14,7 +12,6 @@ import android.util.Log; import android.view.Menu; import android.view.MenuItem; import android.view.View; -import android.widget.Toast; import androidx.annotation.NonNull; import androidx.appcompat.app.ActionBar; @@ -28,8 +25,8 @@ import eu.siacs.conversations.Config; import eu.siacs.conversations.R; import eu.siacs.conversations.databinding.WelcomeBinding; import eu.siacs.conversations.entities.Account; -import eu.siacs.conversations.ui.util.IntroHelper; import eu.siacs.conversations.services.XmppConnectionService; +import eu.siacs.conversations.ui.util.IntroHelper; import eu.siacs.conversations.ui.util.UpdateHelper; import eu.siacs.conversations.utils.Compatibility; import eu.siacs.conversations.utils.InstallReferrerUtils; @@ -204,7 +201,7 @@ public class WelcomeActivity extends XmppActivity implements XmppConnectionServi try { KeyChain.choosePrivateKeyAlias(this, this, null, null, null, -1, null); } catch (ActivityNotFoundException e) { - Toast.makeText(this, R.string.device_does_not_support_certificates, Toast.LENGTH_LONG).show(); + ToastCompat.makeText(this, R.string.device_does_not_support_certificates, ToastCompat.LENGTH_LONG).show(); } } @@ -226,7 +223,7 @@ public class WelcomeActivity extends XmppActivity implements XmppConnectionServi @Override public void informUser(final int r) { - runOnUiThread(() -> Toast.makeText(this, r, Toast.LENGTH_LONG).show()); + runOnUiThread(() -> ToastCompat.makeText(this, r, ToastCompat.LENGTH_LONG).show()); } @Override @@ -240,7 +237,7 @@ public class WelcomeActivity extends XmppActivity implements XmppConnectionServi break; } } else if (Arrays.asList(permissions).contains(Manifest.permission.WRITE_EXTERNAL_STORAGE)) { - ToastCompat.makeText(this, R.string.no_storage_permission, Toast.LENGTH_SHORT).show(); + ToastCompat.makeText(this, R.string.no_storage_permission, ToastCompat.LENGTH_SHORT).show(); } } if (readGranted(grantResults, permissions)) { diff --git a/src/main/java/eu/siacs/conversations/ui/XmppActivity.java b/src/main/java/eu/siacs/conversations/ui/XmppActivity.java index afd3301aa..9e3074a8c 100644 --- a/src/main/java/eu/siacs/conversations/ui/XmppActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/XmppActivity.java @@ -136,7 +136,7 @@ public abstract class XmppActivity extends ActionBarActivity { public boolean mUseTor = false; protected Toast mToast; - protected Runnable onOpenPGPKeyPublished = () -> ToastCompat.makeText(XmppActivity.this, R.string.openpgp_has_been_published, Toast.LENGTH_SHORT).show(); + protected Runnable onOpenPGPKeyPublished = () -> ToastCompat.makeText(XmppActivity.this, R.string.openpgp_has_been_published, ToastCompat.LENGTH_SHORT).show(); protected ConferenceInvite mPendingConferenceInvite = null; protected ServiceConnection mConnection = new ServiceConnection() { @@ -221,7 +221,7 @@ public abstract class XmppActivity extends ActionBarActivity { protected void replaceToast(String msg, boolean showlong) { hideToast(); - mToast = ToastCompat.makeText(this, msg, showlong ? Toast.LENGTH_LONG : Toast.LENGTH_SHORT); + mToast = ToastCompat.makeText(this, msg, showlong ? ToastCompat.LENGTH_LONG : ToastCompat.LENGTH_SHORT); mToast.show(); } @@ -314,7 +314,7 @@ public abstract class XmppActivity extends ActionBarActivity { try { CustomTab.openTab(this, uri, isDarkTheme()); } catch (Exception e) { - ToastCompat.makeText(this, R.string.no_application_found_to_open_link, Toast.LENGTH_SHORT).show(); + ToastCompat.makeText(this, R.string.no_application_found_to_open_link, ToastCompat.LENGTH_SHORT).show(); } } finish(); @@ -908,7 +908,7 @@ public abstract class XmppActivity extends ActionBarActivity { mPendingConferenceInvite = ConferenceInvite.parse(data); if (xmppConnectionServiceBound && mPendingConferenceInvite != null) { if (mPendingConferenceInvite.execute(this)) { - mToast = ToastCompat.makeText(this, R.string.creating_conference, Toast.LENGTH_LONG); + mToast = ToastCompat.makeText(this, R.string.creating_conference, ToastCompat.LENGTH_LONG); mToast.show(); } mPendingConferenceInvite = null; @@ -958,11 +958,11 @@ public abstract class XmppActivity extends ActionBarActivity { public void inviteUser() { if (!xmppConnectionServiceBound) { - ToastCompat.makeText(this, R.string.not_connected_try_again, Toast.LENGTH_SHORT).show(); + ToastCompat.makeText(this, R.string.not_connected_try_again, ToastCompat.LENGTH_SHORT).show(); return; } if (xmppConnectionService.getAccounts() == null) { - ToastCompat.makeText(this, R.string.no_accounts, Toast.LENGTH_SHORT).show(); + ToastCompat.makeText(this, R.string.no_accounts, ToastCompat.LENGTH_SHORT).show(); return; } @@ -1053,7 +1053,7 @@ public abstract class XmppActivity extends ActionBarActivity { final List accounts = EasyOnboardingInvite.getSupportingAccounts(this.xmppConnectionService); if (accounts.size() == 0) { //This can technically happen if opening the menu item races with accounts reconnecting or something - Toast.makeText(this, R.string.no_active_accounts_support_this, Toast.LENGTH_LONG).show(); + ToastCompat.makeText(this, R.string.no_active_accounts_support_this, ToastCompat.LENGTH_LONG).show(); } else if (accounts.size() == 1) { openEasyInviteScreen(accounts.get(0)); } else { @@ -1136,7 +1136,7 @@ public abstract class XmppActivity extends ActionBarActivity { startActivity(Intent.createChooser(intent, getText(R.string.share_uri_with))); overridePendingTransition(R.animator.fade_in, R.animator.fade_out); } catch (ActivityNotFoundException e) { - ToastCompat.makeText(this, R.string.no_application_to_share_uri, Toast.LENGTH_SHORT).show(); + ToastCompat.makeText(this, R.string.no_application_to_share_uri, ToastCompat.LENGTH_SHORT).show(); } } @@ -1147,7 +1147,7 @@ public abstract class XmppActivity extends ActionBarActivity { pgp.getIntentForKey(keyId).getIntentSender(), 0, null, 0, 0, 0); } catch (Throwable e) { - ToastCompat.makeText(XmppActivity.this, R.string.openpgp_error, Toast.LENGTH_SHORT).show(); + ToastCompat.makeText(XmppActivity.this, R.string.openpgp_error, ToastCompat.LENGTH_SHORT).show(); } } @@ -1410,7 +1410,7 @@ public abstract class XmppActivity extends ActionBarActivity { try { startActivityForResult(intent, REQUEST_UNKNOWN_SOURCE_OP); } catch (ActivityNotFoundException e) { - ToastCompat.makeText(XmppActivity.this, R.string.device_does_not_support_unknown_source_op, Toast.LENGTH_SHORT).show(); + ToastCompat.makeText(XmppActivity.this, R.string.device_does_not_support_unknown_source_op, ToastCompat.LENGTH_SHORT).show(); } finally { UpdateService task = new UpdateService(this, xmppConnectionService.installedFrom(), xmppConnectionService); task.executeOnExecutor(UpdateService.THREAD_POOL_EXECUTOR, ShowToast); diff --git a/src/main/java/eu/siacs/conversations/ui/adapter/MediaAdapter.java b/src/main/java/eu/siacs/conversations/ui/adapter/MediaAdapter.java index 92ffb4eb8..381de091a 100644 --- a/src/main/java/eu/siacs/conversations/ui/adapter/MediaAdapter.java +++ b/src/main/java/eu/siacs/conversations/ui/adapter/MediaAdapter.java @@ -12,12 +12,10 @@ import android.graphics.drawable.Drawable; import android.net.Uri; import android.os.AsyncTask; import android.util.Log; -import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; -import android.widget.Toast; import androidx.annotation.AttrRes; import androidx.annotation.DimenRes; @@ -205,7 +203,7 @@ public class MediaAdapter extends RecyclerView.Adapter { activity.startActivity(intent); activity.overridePendingTransition(R.animator.fade_in, R.animator.fade_out); } catch (Exception e) { - ToastCompat.makeText(activity, R.string.no_application_found_to_view_contact, Toast.LENGTH_LONG).show(); + ToastCompat.makeText(activity, R.string.no_application_found_to_view_contact, ToastCompat.LENGTH_LONG).show(); } }); @@ -898,7 +897,7 @@ public class MessageAdapter extends ArrayAdapter { viewHolder.progressBar.setVisibility(View.GONE); final DownloadableFile file = activity.xmppConnectionService.getFileBackend().getFile(message); if (!file.exists()) { - ToastCompat.makeText(activity, R.string.file_deleted, Toast.LENGTH_SHORT).show(); + ToastCompat.makeText(activity, R.string.file_deleted, ToastCompat.LENGTH_SHORT).show(); return; } final String mime = file.getMimeType(); @@ -1048,9 +1047,9 @@ public class MessageAdapter extends ArrayAdapter { conversation.messagesLoaded.set(true); MessageArchiveService.Query query = activity.xmppConnectionService.getMessageArchiveService().query(conversation, new MamReference(0), timestamp, false); if (query != null) { - ToastCompat.makeText(activity, R.string.fetching_history_from_server, Toast.LENGTH_LONG).show(); + ToastCompat.makeText(activity, R.string.fetching_history_from_server, ToastCompat.LENGTH_LONG).show(); } else { - ToastCompat.makeText(activity, R.string.not_fetching_history_retention_period, Toast.LENGTH_SHORT).show(); + ToastCompat.makeText(activity, R.string.not_fetching_history_retention_period, ToastCompat.LENGTH_SHORT).show(); } } @@ -1394,7 +1393,7 @@ public class MessageAdapter extends ArrayAdapter { } } } else { - ToastCompat.makeText(activity, R.string.webview_not_available, Toast.LENGTH_LONG).show(); + ToastCompat.makeText(activity, R.string.webview_not_available, ToastCompat.LENGTH_LONG).show(); } } diff --git a/src/main/java/eu/siacs/conversations/ui/text/FixedURLSpan.java b/src/main/java/eu/siacs/conversations/ui/text/FixedURLSpan.java index 75080bb9e..60888c26b 100644 --- a/src/main/java/eu/siacs/conversations/ui/text/FixedURLSpan.java +++ b/src/main/java/eu/siacs/conversations/ui/text/FixedURLSpan.java @@ -37,7 +37,6 @@ import android.text.Editable; import android.text.Spanned; import android.text.style.URLSpan; import android.view.View; -import android.widget.Toast; import java.util.Arrays; @@ -79,7 +78,7 @@ public class FixedURLSpan extends URLSpan { CustomTab.openTab(context, uri, ThemeHelper.isDark(ThemeHelper.find(context))); widget.playSoundEffect(0); } catch (ActivityNotFoundException e) { - ToastCompat.makeText(context, R.string.no_application_found_to_open_link, Toast.LENGTH_SHORT).show(); + ToastCompat.makeText(context, R.string.no_application_found_to_open_link, ToastCompat.LENGTH_SHORT).show(); } } } \ No newline at end of file diff --git a/src/main/java/eu/siacs/conversations/ui/util/CallManager.java b/src/main/java/eu/siacs/conversations/ui/util/CallManager.java index 483b83ba6..f04991aed 100644 --- a/src/main/java/eu/siacs/conversations/ui/util/CallManager.java +++ b/src/main/java/eu/siacs/conversations/ui/util/CallManager.java @@ -4,7 +4,6 @@ import android.Manifest; import android.content.Intent; import android.content.pm.PackageManager; import android.os.Build; -import android.widget.Toast; import com.google.common.base.Optional; @@ -25,6 +24,7 @@ import eu.siacs.conversations.xmpp.jingle.JingleConnectionManager; import eu.siacs.conversations.xmpp.jingle.Media; import eu.siacs.conversations.xmpp.jingle.OngoingRtpSession; import eu.siacs.conversations.xmpp.jingle.RtpCapability; +import me.drakeet.support.toast.ToastCompat; import static eu.siacs.conversations.ui.ConversationFragment.REQUEST_START_AUDIO_CALL; import static eu.siacs.conversations.ui.ConversationFragment.REQUEST_START_VIDEO_CALL; @@ -33,7 +33,7 @@ public class CallManager { public static void checkPermissionAndTriggerAudioCall(XmppActivity activity, Conversation conversation) { if (activity.mUseTor || conversation.getAccount().isOnion()) { - Toast.makeText(activity, R.string.disable_tor_to_make_call, Toast.LENGTH_SHORT).show(); + ToastCompat.makeText(activity, R.string.disable_tor_to_make_call, ToastCompat.LENGTH_SHORT).show(); return; } if (hasPermissions(REQUEST_START_AUDIO_CALL, activity, Manifest.permission.RECORD_AUDIO)) { @@ -43,7 +43,7 @@ public class CallManager { public static void checkPermissionAndTriggerVideoCall(XmppActivity activity, Conversation conversation) { if (activity.mUseTor || conversation.getAccount().isOnion()) { - Toast.makeText(activity, R.string.disable_tor_to_make_call, Toast.LENGTH_SHORT).show(); + ToastCompat.makeText(activity, R.string.disable_tor_to_make_call, ToastCompat.LENGTH_SHORT).show(); return; } if (hasPermissions(REQUEST_START_VIDEO_CALL, activity, Manifest.permission.CAMERA)) { @@ -53,7 +53,7 @@ public class CallManager { public static void triggerRtpSession(final String action, XmppActivity activity, Conversation conversation) { if (activity.xmppConnectionService.getJingleConnectionManager().isBusy()) { - Toast.makeText(activity, R.string.only_one_call_at_a_time, Toast.LENGTH_LONG).show(); + ToastCompat.makeText(activity, R.string.only_one_call_at_a_time, ToastCompat.LENGTH_LONG).show(); return; } diff --git a/src/main/java/eu/siacs/conversations/ui/util/ShareUtil.java b/src/main/java/eu/siacs/conversations/ui/util/ShareUtil.java index 934dad389..a7fcb0351 100644 --- a/src/main/java/eu/siacs/conversations/ui/util/ShareUtil.java +++ b/src/main/java/eu/siacs/conversations/ui/util/ShareUtil.java @@ -31,7 +31,6 @@ package eu.siacs.conversations.ui.util; import android.content.ActivityNotFoundException; import android.content.Intent; -import android.widget.Toast; import java.util.regex.Matcher; @@ -65,7 +64,7 @@ public class ShareUtil { try { shareIntent.putExtra(Intent.EXTRA_STREAM, FileBackend.getUriForFile(activity, file)); } catch (SecurityException e) { - ToastCompat.makeText(activity, activity.getString(R.string.no_permission_to_access_x, file.getAbsolutePath()), Toast.LENGTH_SHORT).show(); + ToastCompat.makeText(activity, activity.getString(R.string.no_permission_to_access_x, file.getAbsolutePath()), ToastCompat.LENGTH_SHORT).show(); return; } shareIntent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); @@ -80,13 +79,13 @@ public class ShareUtil { activity.overridePendingTransition(R.animator.fade_in, R.animator.fade_out); } catch (ActivityNotFoundException e) { //This should happen only on faulty androids because normally chooser is always available - ToastCompat.makeText(activity, R.string.no_application_found_to_open_file, Toast.LENGTH_SHORT).show(); + ToastCompat.makeText(activity, R.string.no_application_found_to_open_file, ToastCompat.LENGTH_SHORT).show(); } } public static void copyToClipboard(XmppActivity activity, Message message) { if (activity.copyTextToClipboard(message.getMergedBody().toString(), R.string.message)) { - ToastCompat.makeText(activity, R.string.message_copied_to_clipboard, Toast.LENGTH_SHORT).show(); + ToastCompat.makeText(activity, R.string.message_copied_to_clipboard, ToastCompat.LENGTH_SHORT).show(); } } @@ -105,7 +104,7 @@ public class ShareUtil { resId = R.string.file_url; } if (activity.copyTextToClipboard(url, resId)) { - ToastCompat.makeText(activity, R.string.url_copied_to_clipboard, Toast.LENGTH_SHORT).show(); + ToastCompat.makeText(activity, R.string.url_copied_to_clipboard, ToastCompat.LENGTH_SHORT).show(); } } @@ -116,7 +115,7 @@ public class ShareUtil { try { Jid jid = new XmppUri(body.substring(xmppPatternMatcher.start(), xmppPatternMatcher.end())).getJid(); if (activity.copyTextToClipboard(jid.asBareJid().toString(), R.string.account_settings_jabber_id)) { - ToastCompat.makeText(activity, R.string.jabber_id_copied_to_clipboard, Toast.LENGTH_SHORT).show(); + ToastCompat.makeText(activity, R.string.jabber_id_copied_to_clipboard, ToastCompat.LENGTH_SHORT).show(); } return; } catch (Exception e) { @@ -128,7 +127,7 @@ public class ShareUtil { if (webUrlPatternMatcher.find()) { String url = body.substring(webUrlPatternMatcher.start(), webUrlPatternMatcher.end()); if (activity.copyTextToClipboard(url, R.string.web_address)) { - ToastCompat.makeText(activity, R.string.url_copied_to_clipboard, Toast.LENGTH_SHORT).show(); + ToastCompat.makeText(activity, R.string.url_copied_to_clipboard, ToastCompat.LENGTH_SHORT).show(); } } } diff --git a/src/main/java/eu/siacs/conversations/ui/util/UpdateHelper.java b/src/main/java/eu/siacs/conversations/ui/util/UpdateHelper.java index b50d4076d..a48800b66 100644 --- a/src/main/java/eu/siacs/conversations/ui/util/UpdateHelper.java +++ b/src/main/java/eu/siacs/conversations/ui/util/UpdateHelper.java @@ -9,7 +9,6 @@ import android.net.Uri; import android.os.Environment; import android.preference.PreferenceManager; import android.util.Log; -import android.widget.Toast; import androidx.appcompat.app.AlertDialog; @@ -69,7 +68,7 @@ public class UpdateHelper { checkOldData(); activity.runOnUiThread(() -> { if (dataMoved) { - ToastCompat.makeText(activity, R.string.data_successfully_moved, Toast.LENGTH_LONG).show(); + ToastCompat.makeText(activity, R.string.data_successfully_moved, ToastCompat.LENGTH_LONG).show(); } final AlertDialog.Builder builder = new AlertDialog.Builder(activity); builder.setTitle(activity.getString(R.string.title_activity_updater)); @@ -82,11 +81,11 @@ public class UpdateHelper { try { CustomTab.openTab(activity, uri, ThemeHelper.isDark(ThemeHelper.find(activity))); } catch (Exception e) { - ToastCompat.makeText(activity, R.string.no_application_found_to_open_link, Toast.LENGTH_SHORT).show(); + ToastCompat.makeText(activity, R.string.no_application_found_to_open_link, ToastCompat.LENGTH_SHORT).show(); } showNewInstalledDialog(activity); } catch (Exception e) { - ToastCompat.makeText(activity, R.string.no_application_found_to_open_link, Toast.LENGTH_LONG).show(); + ToastCompat.makeText(activity, R.string.no_application_found_to_open_link, ToastCompat.LENGTH_LONG).show(); showNewInstalledDialog(activity); } } @@ -95,13 +94,13 @@ public class UpdateHelper { SaveMessageShown(activity, blabber_message); try { if (!moveData) { - ToastCompat.makeText(activity, R.string.error_moving_data, Toast.LENGTH_LONG).show(); + ToastCompat.makeText(activity, R.string.error_moving_data, ToastCompat.LENGTH_LONG).show(); } else { moveData_PAM_blabber(); } showNewInstalledDialog(activity); } catch (Exception e) { - ToastCompat.makeText(activity, R.string.error_moving_data, Toast.LENGTH_LONG).show(); + ToastCompat.makeText(activity, R.string.error_moving_data, ToastCompat.LENGTH_LONG).show(); showNewInstalledDialog(activity); } } diff --git a/src/main/java/eu/siacs/conversations/ui/util/ViewUtil.java b/src/main/java/eu/siacs/conversations/ui/util/ViewUtil.java index 8df503696..502e1c981 100644 --- a/src/main/java/eu/siacs/conversations/ui/util/ViewUtil.java +++ b/src/main/java/eu/siacs/conversations/ui/util/ViewUtil.java @@ -7,7 +7,6 @@ import android.content.pm.PackageManager; import android.content.pm.ResolveInfo; import android.net.Uri; import android.util.Log; -import android.widget.Toast; import java.io.File; import java.util.List; @@ -29,7 +28,7 @@ public class ViewUtil { public static void view(Context context, DownloadableFile file) { if (!file.exists()) { - ToastCompat.makeText(context, R.string.file_deleted, Toast.LENGTH_SHORT).show(); + ToastCompat.makeText(context, R.string.file_deleted, ToastCompat.LENGTH_SHORT).show(); return; } String mime = file.getMimeType(); @@ -45,7 +44,7 @@ public class ViewUtil { uri = FileBackend.getUriForFile(context, file); } catch (SecurityException e) { Log.d(Config.LOGTAG, "No permission to access " + file.getAbsolutePath(), e); - ToastCompat.makeText(context, context.getString(R.string.no_permission_to_access_x, file.getAbsolutePath()), Toast.LENGTH_SHORT).show(); + ToastCompat.makeText(context, context.getString(R.string.no_permission_to_access_x, file.getAbsolutePath()), ToastCompat.LENGTH_SHORT).show(); return; } // use internal viewer for images and videos @@ -79,7 +78,7 @@ public class ViewUtil { try { context.startActivity(openIntent); } catch (ActivityNotFoundException e) { - ToastCompat.makeText(context, R.string.no_application_found_to_open_file, Toast.LENGTH_SHORT).show(); + ToastCompat.makeText(context, R.string.no_application_found_to_open_file, ToastCompat.LENGTH_SHORT).show(); } } } diff --git a/src/main/java/eu/siacs/conversations/ui/widget/RichLinkView.java b/src/main/java/eu/siacs/conversations/ui/widget/RichLinkView.java index e8bac4b6c..ff16b37ce 100644 --- a/src/main/java/eu/siacs/conversations/ui/widget/RichLinkView.java +++ b/src/main/java/eu/siacs/conversations/ui/widget/RichLinkView.java @@ -9,7 +9,6 @@ import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.RelativeLayout; import android.widget.TextView; -import android.widget.Toast; import androidx.annotation.RequiresApi; @@ -141,7 +140,7 @@ public class RichLinkView extends RelativeLayout { try { CustomTab.openTab(this.context, Uri.parse(main_url), ThemeHelper.isDark(ThemeHelper.find(this.context))); } catch (Exception e) { - ToastCompat.makeText(this.context, R.string.no_application_found_to_open_link, Toast.LENGTH_SHORT).show(); + ToastCompat.makeText(this.context, R.string.no_application_found_to_open_link, ToastCompat.LENGTH_SHORT).show(); } } diff --git a/src/main/java/eu/siacs/conversations/utils/AccountUtils.java b/src/main/java/eu/siacs/conversations/utils/AccountUtils.java index c548f3aef..358a52b25 100644 --- a/src/main/java/eu/siacs/conversations/utils/AccountUtils.java +++ b/src/main/java/eu/siacs/conversations/utils/AccountUtils.java @@ -2,7 +2,6 @@ package eu.siacs.conversations.utils; import android.app.Activity; import android.content.Intent; -import android.widget.Toast; import java.util.ArrayList; import java.util.List; @@ -70,7 +69,7 @@ public class AccountUtils { if (MANAGE_ACCOUNT_ACTIVITY != null) { activity.startActivity(new Intent(activity, MANAGE_ACCOUNT_ACTIVITY)); } else { - ToastCompat.makeText(activity, R.string.feature_not_implemented, Toast.LENGTH_SHORT).show(); + ToastCompat.makeText(activity, R.string.feature_not_implemented, ToastCompat.LENGTH_SHORT).show(); } } diff --git a/src/main/java/eu/siacs/conversations/utils/ProvisioningUtils.java b/src/main/java/eu/siacs/conversations/utils/ProvisioningUtils.java index db05a4fc0..15e3e78ba 100644 --- a/src/main/java/eu/siacs/conversations/utils/ProvisioningUtils.java +++ b/src/main/java/eu/siacs/conversations/utils/ProvisioningUtils.java @@ -2,7 +2,6 @@ package eu.siacs.conversations.utils; import android.app.Activity; import android.content.Intent; -import android.widget.Toast; import java.util.List; @@ -12,6 +11,7 @@ import eu.siacs.conversations.persistance.DatabaseBackend; import eu.siacs.conversations.services.XmppConnectionService; import eu.siacs.conversations.ui.EditAccountActivity; import eu.siacs.conversations.xmpp.Jid; +import me.drakeet.support.toast.ToastCompat; public class ProvisioningUtils { @@ -20,13 +20,13 @@ public class ProvisioningUtils { try { accountConfiguration = AccountConfiguration.parse(json); } catch (final IllegalArgumentException e) { - Toast.makeText(activity, R.string.improperly_formatted_provisioning, Toast.LENGTH_LONG).show(); + ToastCompat.makeText(activity, R.string.improperly_formatted_provisioning, ToastCompat.LENGTH_LONG).show(); return; } final Jid jid = accountConfiguration.getJid(); final List accounts = DatabaseBackend.getInstance(activity).getAccountJids(true); if (accounts.contains(jid)) { - Toast.makeText(activity, R.string.account_already_exists, Toast.LENGTH_LONG).show(); + ToastCompat.makeText(activity, R.string.account_already_exists, ToastCompat.LENGTH_LONG).show(); return; } final Intent serviceIntent = new Intent(activity, XmppConnectionService.class);