aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/de
diff options
context:
space:
mode:
authorChristian Schneppe <christian.schneppe@pix-art.de>2020-01-31 15:02:33 +0100
committerChristian Schneppe <christian.schneppe@pix-art.de>2020-01-31 15:02:33 +0100
commit851f7b073db781281a85fd369ea92ff0bc31ce7e (patch)
treeaddd2abe9cdee8eaa72c26ce9df487f6ac529fe0 /src/main/java/de
parentb0d89ba6adced09cb7a6839024c1590fc68217c5 (diff)
use ToastCompat instead of Toast
Diffstat (limited to 'src/main/java/de')
-rw-r--r--src/main/java/de/pixart/messenger/services/UpdateService.java3
-rw-r--r--src/main/java/de/pixart/messenger/ui/BlockContactDialog.java5
-rw-r--r--src/main/java/de/pixart/messenger/ui/BlocklistActivity.java3
-rw-r--r--src/main/java/de/pixart/messenger/ui/ChangePasswordActivity.java3
-rw-r--r--src/main/java/de/pixart/messenger/ui/ChooseAccountForProfilePictureActivity.java3
-rw-r--r--src/main/java/de/pixart/messenger/ui/ConferenceDetailsActivity.java6
-rw-r--r--src/main/java/de/pixart/messenger/ui/ContactDetailsActivity.java11
-rw-r--r--src/main/java/de/pixart/messenger/ui/ConversationFragment.java47
-rw-r--r--src/main/java/de/pixart/messenger/ui/ConversationsActivity.java11
-rw-r--r--src/main/java/de/pixart/messenger/ui/EditAccountActivity.java29
-rw-r--r--src/main/java/de/pixart/messenger/ui/ManageAccountActivity.java11
-rw-r--r--src/main/java/de/pixart/messenger/ui/MediaViewerActivity.java17
-rw-r--r--src/main/java/de/pixart/messenger/ui/MucUsersActivity.java3
-rw-r--r--src/main/java/de/pixart/messenger/ui/OmemoActivity.java3
-rw-r--r--src/main/java/de/pixart/messenger/ui/PublishGroupChatProfilePictureActivity.java7
-rw-r--r--src/main/java/de/pixart/messenger/ui/PublishProfilePictureActivity.java5
-rw-r--r--src/main/java/de/pixart/messenger/ui/RecordingActivity.java3
-rw-r--r--src/main/java/de/pixart/messenger/ui/ScanActivity.java3
-rw-r--r--src/main/java/de/pixart/messenger/ui/SettingsActivity.java4
-rw-r--r--src/main/java/de/pixart/messenger/ui/ShareWithActivity.java5
-rw-r--r--src/main/java/de/pixart/messenger/ui/ShowLocationActivity.java3
-rw-r--r--src/main/java/de/pixart/messenger/ui/StartConversationActivity.java15
-rw-r--r--src/main/java/de/pixart/messenger/ui/TrustKeysActivity.java17
-rw-r--r--src/main/java/de/pixart/messenger/ui/UpdaterActivity.java13
-rw-r--r--src/main/java/de/pixart/messenger/ui/UriHandlerActivity.java9
-rw-r--r--src/main/java/de/pixart/messenger/ui/VerifyOTRActivity.java9
-rw-r--r--src/main/java/de/pixart/messenger/ui/WelcomeActivity.java3
-rw-r--r--src/main/java/de/pixart/messenger/ui/XmppActivity.java17
-rw-r--r--src/main/java/de/pixart/messenger/ui/adapter/MessageAdapter.java11
-rw-r--r--src/main/java/de/pixart/messenger/ui/text/FixedURLSpan.java3
-rw-r--r--src/main/java/de/pixart/messenger/ui/util/ShareUtil.java13
-rw-r--r--src/main/java/de/pixart/messenger/ui/util/ViewUtil.java7
-rw-r--r--src/main/java/de/pixart/messenger/ui/widget/RichLinkView.java3
-rw-r--r--src/main/java/de/pixart/messenger/utils/AccountUtils.java3
34 files changed, 170 insertions, 138 deletions
diff --git a/src/main/java/de/pixart/messenger/services/UpdateService.java b/src/main/java/de/pixart/messenger/services/UpdateService.java
index e9671c814..5c0313320 100644
--- a/src/main/java/de/pixart/messenger/services/UpdateService.java
+++ b/src/main/java/de/pixart/messenger/services/UpdateService.java
@@ -22,6 +22,7 @@ import de.pixart.messenger.BuildConfig;
import de.pixart.messenger.Config;
import de.pixart.messenger.R;
import de.pixart.messenger.ui.UpdaterActivity;
+import me.drakeet.support.toast.ToastCompat;
import static de.pixart.messenger.http.HttpConnectionManager.getProxy;
@@ -131,7 +132,7 @@ public class UpdateService extends AsyncTask<String, Object, UpdateService.Wrapp
} else {
ToastMessage = context.getString(R.string.no_update_available);
}
- Toast.makeText(context, ToastMessage, Toast.LENGTH_LONG).show();
+ ToastCompat.makeText(context, ToastMessage, Toast.LENGTH_LONG).show();
});
}
diff --git a/src/main/java/de/pixart/messenger/ui/BlockContactDialog.java b/src/main/java/de/pixart/messenger/ui/BlockContactDialog.java
index 011480992..7e3018253 100644
--- a/src/main/java/de/pixart/messenger/ui/BlockContactDialog.java
+++ b/src/main/java/de/pixart/messenger/ui/BlockContactDialog.java
@@ -12,6 +12,7 @@ import de.pixart.messenger.databinding.DialogBlockContactBinding;
import de.pixart.messenger.entities.Blockable;
import de.pixart.messenger.entities.Conversation;
import de.pixart.messenger.ui.util.JidDialog;
+import me.drakeet.support.toast.ToastCompat;
import rocks.xmpp.addr.Jid;
public final class BlockContactDialog {
@@ -47,12 +48,12 @@ public final class BlockContactDialog {
} else {
boolean toastShown = false;
if (xmppActivity.xmppConnectionService.sendBlockRequest(blockable, binding.reportSpam.isChecked())) {
- Toast.makeText(xmppActivity, R.string.corresponding_conversations_closed, Toast.LENGTH_SHORT).show();
+ ToastCompat.makeText(xmppActivity, R.string.corresponding_conversations_closed, Toast.LENGTH_SHORT).show();
toastShown = true;
}
if (xmppActivity instanceof ContactDetailsActivity) {
if (!toastShown) {
- Toast.makeText(xmppActivity, R.string.contact_blocked_past_tense, Toast.LENGTH_SHORT).show();
+ ToastCompat.makeText(xmppActivity, R.string.contact_blocked_past_tense, Toast.LENGTH_SHORT).show();
}
xmppActivity.finish();
}
diff --git a/src/main/java/de/pixart/messenger/ui/BlocklistActivity.java b/src/main/java/de/pixart/messenger/ui/BlocklistActivity.java
index 9b27f4c33..b261c1292 100644
--- a/src/main/java/de/pixart/messenger/ui/BlocklistActivity.java
+++ b/src/main/java/de/pixart/messenger/ui/BlocklistActivity.java
@@ -16,6 +16,7 @@ import de.pixart.messenger.entities.ListItem;
import de.pixart.messenger.entities.RawBlockable;
import de.pixart.messenger.ui.interfaces.OnBackendConnected;
import de.pixart.messenger.xmpp.OnUpdateBlocklist;
+import me.drakeet.support.toast.ToastCompat;
import rocks.xmpp.addr.Jid;
public class BlocklistActivity extends AbstractSearchableListItemActivity implements OnUpdateBlocklist {
@@ -88,7 +89,7 @@ public class BlocklistActivity extends AbstractSearchableListItemActivity implem
dialog.setOnEnterJidDialogPositiveListener((accountJid, contactJid) -> {
Blockable blockable = new RawBlockable(account, contactJid);
if (xmppConnectionService.sendBlockRequest(blockable, false)) {
- Toast.makeText(BlocklistActivity.this, R.string.corresponding_conversations_closed, Toast.LENGTH_SHORT).show();
+ ToastCompat.makeText(BlocklistActivity.this, R.string.corresponding_conversations_closed, Toast.LENGTH_SHORT).show();
}
return true;
});
diff --git a/src/main/java/de/pixart/messenger/ui/ChangePasswordActivity.java b/src/main/java/de/pixart/messenger/ui/ChangePasswordActivity.java
index 866384616..fca9f6eb3 100644
--- a/src/main/java/de/pixart/messenger/ui/ChangePasswordActivity.java
+++ b/src/main/java/de/pixart/messenger/ui/ChangePasswordActivity.java
@@ -13,6 +13,7 @@ import de.pixart.messenger.entities.Account;
import de.pixart.messenger.services.XmppConnectionService;
import de.pixart.messenger.ui.widget.DisabledActionModeCallback;
import de.pixart.messenger.ui.widget.TextInputEditText;
+import me.drakeet.support.toast.ToastCompat;
public class ChangePasswordActivity extends XmppActivity implements XmppConnectionService.OnAccountPasswordChanged {
@@ -91,7 +92,7 @@ public class ChangePasswordActivity extends XmppActivity implements XmppConnecti
runOnUiThread(new Runnable() {
@Override
public void run() {
- Toast.makeText(ChangePasswordActivity.this, R.string.password_changed, Toast.LENGTH_LONG).show();
+ ToastCompat.makeText(ChangePasswordActivity.this, R.string.password_changed, Toast.LENGTH_LONG).show();
finish();
}
});
diff --git a/src/main/java/de/pixart/messenger/ui/ChooseAccountForProfilePictureActivity.java b/src/main/java/de/pixart/messenger/ui/ChooseAccountForProfilePictureActivity.java
index 0c008532c..9f4796a83 100644
--- a/src/main/java/de/pixart/messenger/ui/ChooseAccountForProfilePictureActivity.java
+++ b/src/main/java/de/pixart/messenger/ui/ChooseAccountForProfilePictureActivity.java
@@ -12,6 +12,7 @@ import java.util.List;
import de.pixart.messenger.R;
import de.pixart.messenger.entities.Account;
import de.pixart.messenger.ui.adapter.AccountAdapter;
+import me.drakeet.support.toast.ToastCompat;
public class ChooseAccountForProfilePictureActivity extends XmppActivity {
@@ -79,7 +80,7 @@ public class ChooseAccountForProfilePictureActivity extends XmppActivity {
try {
startActivity(intent);
} catch (SecurityException e) {
- Toast.makeText(this, R.string.sharing_application_not_grant_permission, Toast.LENGTH_SHORT).show();
+ ToastCompat.makeText(this, R.string.sharing_application_not_grant_permission, Toast.LENGTH_SHORT).show();
return;
}
}
diff --git a/src/main/java/de/pixart/messenger/ui/ConferenceDetailsActivity.java b/src/main/java/de/pixart/messenger/ui/ConferenceDetailsActivity.java
index b4da0055e..4dcf0ba1d 100644
--- a/src/main/java/de/pixart/messenger/ui/ConferenceDetailsActivity.java
+++ b/src/main/java/de/pixart/messenger/ui/ConferenceDetailsActivity.java
@@ -225,11 +225,11 @@ public class ConferenceDetailsActivity extends XmppActivity implements OnConvers
this.binding.detailsMucAvatar.setOnClickListener(v -> {
final MucOptions mucOptions = mConversation.getMucOptions();
if (!mucOptions.hasVCards()) {
- Toast.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, Toast.LENGTH_SHORT).show();
return;
}
if (!mucOptions.getSelf().getAffiliation().ranks(MucOptions.Affiliation.OWNER)) {
- Toast.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, Toast.LENGTH_SHORT).show();
return;
}
final Intent intent = new Intent(this, PublishGroupChatProfilePictureActivity.class);
@@ -335,7 +335,7 @@ public class ConferenceDetailsActivity extends XmppActivity implements OnConvers
public boolean onContextItemSelected(MenuItem item) {
final User user = mUserPreviewAdapter.getSelectedUser();
if (user == null) {
- Toast.makeText(this, R.string.unable_to_perform_this_action, Toast.LENGTH_SHORT).show();
+ ToastCompat.makeText(this, R.string.unable_to_perform_this_action, Toast.LENGTH_SHORT).show();
return true;
}
if (!MucDetailsContextMenuHelper.onContextItemSelected(item, mUserPreviewAdapter.getSelectedUser(), this)) {
diff --git a/src/main/java/de/pixart/messenger/ui/ContactDetailsActivity.java b/src/main/java/de/pixart/messenger/ui/ContactDetailsActivity.java
index c18c8cf4c..d66e7b4dd 100644
--- a/src/main/java/de/pixart/messenger/ui/ContactDetailsActivity.java
+++ b/src/main/java/de/pixart/messenger/ui/ContactDetailsActivity.java
@@ -72,6 +72,7 @@ import de.pixart.messenger.utils.XmppUri;
import de.pixart.messenger.xmpp.OnKeyStatusUpdated;
import de.pixart.messenger.xmpp.OnUpdateBlocklist;
import de.pixart.messenger.xmpp.XmppConnection;
+import me.drakeet.support.toast.ToastCompat;
import rocks.xmpp.addr.Jid;
import static de.pixart.messenger.ui.util.IntroHelper.showIntro;
@@ -144,7 +145,7 @@ public class ContactDetailsActivity extends OmemoActivity implements OnAccountUp
try {
ContactDetailsActivity.this.startActivityForResult(intent, 0);
} catch (ActivityNotFoundException e) {
- Toast.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, Toast.LENGTH_SHORT).show();
}
}
};
@@ -169,7 +170,7 @@ public class ContactDetailsActivity extends OmemoActivity implements OnAccountUp
startActivity(intent);
overridePendingTransition(R.animator.fade_in, R.animator.fade_out);
} catch (ActivityNotFoundException e) {
- Toast.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, Toast.LENGTH_SHORT).show();
}
}
}
@@ -363,7 +364,7 @@ public class ContactDetailsActivity extends OmemoActivity implements OnAccountUp
startActivity(intent);
overridePendingTransition(R.animator.fade_in, R.animator.fade_out);
} catch (ActivityNotFoundException e) {
- Toast.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, Toast.LENGTH_SHORT).show();
}
}
}
@@ -716,10 +717,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())) {
- Toast.makeText(this, R.string.verified_fingerprints, Toast.LENGTH_SHORT).show();
+ ToastCompat.makeText(this, R.string.verified_fingerprints, Toast.LENGTH_SHORT).show();
}
} else {
- Toast.makeText(this, R.string.invalid_barcode, Toast.LENGTH_SHORT).show();
+ ToastCompat.makeText(this, R.string.invalid_barcode, Toast.LENGTH_SHORT).show();
}
}
diff --git a/src/main/java/de/pixart/messenger/ui/ConversationFragment.java b/src/main/java/de/pixart/messenger/ui/ConversationFragment.java
index a3edfb9fe..6dbf00840 100644
--- a/src/main/java/de/pixart/messenger/ui/ConversationFragment.java
+++ b/src/main/java/de/pixart/messenger/ui/ConversationFragment.java
@@ -125,6 +125,7 @@ import de.pixart.messenger.utils.UIHelper;
import de.pixart.messenger.xmpp.XmppConnection;
import de.pixart.messenger.xmpp.chatstate.ChatState;
import de.pixart.messenger.xmpp.jingle.JingleConnection;
+import me.drakeet.support.toast.ToastCompat;
import rocks.xmpp.addr.Jid;
import static de.pixart.messenger.entities.Message.DELETED_MESSAGE_BODY;
@@ -314,7 +315,7 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke
if (ConversationFragment.this.conversation != conversation) {
return;
}
- messageLoaderToast = Toast.makeText(view.getContext(), resId, Toast.LENGTH_LONG);
+ messageLoaderToast = ToastCompat.makeText(view.getContext(), resId, Toast.LENGTH_LONG);
messageLoaderToast.show();
});
}
@@ -333,7 +334,7 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke
inputContentInfo.requestPermission();
} catch (Exception e) {
Log.e(Config.LOGTAG, "InputContentInfoCompat#requestPermission() failed.", e);
- Toast.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()), Toast.LENGTH_LONG
).show();
return false;
}
@@ -435,7 +436,7 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke
0,
0);
} catch (SendIntentException e) {
- Toast.makeText(getActivity(), R.string.unable_to_connect_to_keychain, Toast.LENGTH_SHORT).show();
+ ToastCompat.makeText(getActivity(), R.string.unable_to_connect_to_keychain, Toast.LENGTH_SHORT).show();
conversation.getAccount().getPgpDecryptionService().continueDecryption(true);
}
}
@@ -739,7 +740,7 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke
if (conversation == null) {
return;
}
- final Toast prepareFileToast = Toast.makeText(getActivity(), getText(R.string.preparing_file), Toast.LENGTH_LONG);
+ final Toast prepareFileToast = ToastCompat.makeText(getActivity(), getText(R.string.preparing_file), Toast.LENGTH_LONG);
prepareFileToast.show();
activity.delegateUriPermissionsToService(uri);
activity.xmppConnectionService.attachFileToConversation(conversation, uri, type, new UiInformableCallback<Message>() {
@@ -773,7 +774,7 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke
if (conversation == null) {
return;
}
- final Toast prepareFileToast = Toast.makeText(getActivity(), getText(R.string.preparing_image), Toast.LENGTH_LONG);
+ final Toast prepareFileToast = ToastCompat.makeText(getActivity(), getText(R.string.preparing_image), Toast.LENGTH_LONG);
prepareFileToast.show();
activity.delegateUriPermissionsToService(uri);
activity.xmppConnectionService.attachImageToConversation(conversation, uri,
@@ -801,7 +802,7 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke
if (conversation == null) {
return;
}
- final Toast prepareFileToast = Toast.makeText(getActivity(), getText(R.string.preparing_image), Toast.LENGTH_LONG);
+ final Toast prepareFileToast = ToastCompat.makeText(getActivity(), getText(R.string.preparing_image), Toast.LENGTH_LONG);
prepareFileToast.show();
activity.delegateUriPermissionsToService(uri);
activity.xmppConnectionService.attachImageToConversation(conversation, uri,
@@ -834,7 +835,7 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke
if (conversation == null) {
return;
}
- final Toast prepareFileToast = Toast.makeText(getActivity(), getText(R.string.preparing_image), Toast.LENGTH_LONG);
+ final Toast prepareFileToast = ToastCompat.makeText(getActivity(), getText(R.string.preparing_image), Toast.LENGTH_LONG);
prepareFileToast.show();
activity.delegateUriPermissionsToService(uri);
activity.xmppConnectionService.attachImageToConversation(conversation, uri,
@@ -1006,7 +1007,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 = Toast.makeText(activity, R.string.creating_conference, Toast.LENGTH_LONG);
+ activity.mToast = ToastCompat.makeText(activity, R.string.creating_conference, Toast.LENGTH_LONG);
activity.mToast.show();
}
}
@@ -1606,7 +1607,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 = Toast.makeText(activity, R.string.missing_public_keys, Toast.LENGTH_LONG);
+ Toast warning = ToastCompat.makeText(activity, R.string.missing_public_keys, Toast.LENGTH_LONG);
warning.setGravity(Gravity.CENTER_VERTICAL, 0, 0);
warning.show();
});
@@ -1662,7 +1663,7 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke
} else {
res = R.string.no_storage_permission;
}
- Toast.makeText(getActivity(), res, Toast.LENGTH_SHORT).show();
+ ToastCompat.makeText(getActivity(), res, Toast.LENGTH_SHORT).show();
}
}
if (readGranted(grantResults, permissions)) {
@@ -1686,7 +1687,7 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke
}
if (!transferable.start()) {
Log.d(Config.LOGTAG, "type: " + transferable.getClass().getName());
- Toast.makeText(getActivity(), R.string.not_connected_try_again, Toast.LENGTH_SHORT).show();
+ ToastCompat.makeText(getActivity(), R.string.not_connected_try_again, Toast.LENGTH_SHORT).show();
}
} else if (message.treatAsDownloadable() || message.hasFileOnRemoteHost() || MessageUtils.unInitiatedButKnownSize(message)) {
createNewConnection(message);
@@ -1697,7 +1698,7 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke
private void createNewConnection(final Message message) {
if (!activity.xmppConnectionService.getHttpConnectionManager().checkConnection(message)) {
- Toast.makeText(getActivity(), R.string.not_connected_try_again, Toast.LENGTH_SHORT).show();
+ ToastCompat.makeText(getActivity(), R.string.not_connected_try_again, Toast.LENGTH_SHORT).show();
return;
}
activity.xmppConnectionService.getHttpConnectionManager().createNewDownloadConnection(message, true);
@@ -1876,7 +1877,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);
- Toast.makeText(activity, R.string.error_message_copied_to_clipboard, Toast.LENGTH_SHORT).show();
+ ToastCompat.makeText(activity, R.string.error_message_copied_to_clipboard, Toast.LENGTH_SHORT).show();
});
builder.setPositiveButton(R.string.ok, null);
builder.create().show();
@@ -1959,10 +1960,10 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke
return;
}
} else if (!Compatibility.hasStoragePermission(getActivity())) {
- Toast.makeText(activity, R.string.no_storage_permission, Toast.LENGTH_SHORT).show();
+ ToastCompat.makeText(activity, R.string.no_storage_permission, Toast.LENGTH_SHORT).show();
return;
} else {
- Toast.makeText(activity, R.string.file_deleted, Toast.LENGTH_SHORT).show();
+ ToastCompat.makeText(activity, R.string.file_deleted, Toast.LENGTH_SHORT).show();
message.setFileDeleted(true);
activity.xmppConnectionService.updateMessage(message, false);
activity.onConversationsListItemUpdated();
@@ -1994,7 +1995,7 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke
resId = R.string.file_url;
}
if (activity.copyTextToClipboard(url, resId)) {
- Toast.makeText(getActivity(), R.string.url_copied_to_clipboard,
+ ToastCompat.makeText(getActivity(), R.string.url_copied_to_clipboard,
Toast.LENGTH_SHORT).show();
}
}
@@ -2018,7 +2019,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) {
- Toast.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()), Toast.LENGTH_SHORT).show();
return;
}
if (conversation.setOutgoingChatState(Config.DEFAULT_CHAT_STATE)) {
@@ -2390,7 +2391,7 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke
final Uri uri = iterator.next();
if (FileBackend.weOwnFile(getActivity(), uri)) {
iterator.remove();
- Toast.makeText(getActivity(), R.string.security_violation_not_attaching_file, Toast.LENGTH_SHORT).show();
+ ToastCompat.makeText(getActivity(), R.string.security_violation_not_attaching_file, Toast.LENGTH_SHORT).show();
}
}
return uris;
@@ -2808,7 +2809,7 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke
@Override
public void error(int error, Contact contact) {
- activity.runOnUiThread(() -> Toast.makeText(activity,
+ activity.runOnUiThread(() -> ToastCompat.makeText(activity,
R.string.unable_to_connect_to_keychain,
Toast.LENGTH_SHORT
).show());
@@ -2869,7 +2870,7 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke
public void error(final int error, Message message) {
getActivity().runOnUiThread(() -> {
doneSendingPgpMessage();
- Toast.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, Toast.LENGTH_SHORT).show();
});
}
@@ -2909,7 +2910,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)) {
- Toast.makeText(getActivity(), R.string.already_drafting_message, Toast.LENGTH_LONG).show();
+ ToastCompat.makeText(getActivity(), R.string.already_drafting_message, Toast.LENGTH_LONG).show();
return;
}
if (UIHelper.isLastLineQuote(previous)) {
@@ -3202,11 +3203,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) {
- Toast.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()), Toast.LENGTH_SHORT).show();
}
highlightInConference(user.getResource());
} else {
- Toast.makeText(getActivity(), R.string.you_are_not_participating, Toast.LENGTH_SHORT).show();
+ ToastCompat.makeText(getActivity(), R.string.you_are_not_participating, Toast.LENGTH_SHORT).show();
}
}
return;
diff --git a/src/main/java/de/pixart/messenger/ui/ConversationsActivity.java b/src/main/java/de/pixart/messenger/ui/ConversationsActivity.java
index 81b3b7e99..51023c348 100644
--- a/src/main/java/de/pixart/messenger/ui/ConversationsActivity.java
+++ b/src/main/java/de/pixart/messenger/ui/ConversationsActivity.java
@@ -95,6 +95,7 @@ import de.pixart.messenger.utils.UIHelper;
import de.pixart.messenger.utils.XmppUri;
import de.pixart.messenger.xmpp.OnUpdateBlocklist;
import de.pixart.messenger.xmpp.chatstate.ChatState;
+import me.drakeet.support.toast.ToastCompat;
import rocks.xmpp.addr.Jid;
import static de.pixart.messenger.ui.ConversationFragment.REQUEST_DECRYPT_PGP;
@@ -291,7 +292,7 @@ public class ConversationsActivity extends XmppActivity implements OnConversatio
try {
startActivityForResult(intent, REQUEST_BATTERY_OP);
} catch (ActivityNotFoundException e) {
- Toast.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, Toast.LENGTH_SHORT).show();
}
});
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
@@ -488,7 +489,7 @@ public class ConversationsActivity extends XmppActivity implements OnConversatio
}
private void displayToast(final String msg) {
- runOnUiThread(() -> Toast.makeText(ConversationsActivity.this, msg, Toast.LENGTH_SHORT).show());
+ runOnUiThread(() -> ToastCompat.makeText(ConversationsActivity.this, msg, Toast.LENGTH_SHORT).show());
}
@Override
@@ -573,7 +574,7 @@ public class ConversationsActivity extends XmppActivity implements OnConversatio
if (xmppConnectionService.hasInternetConnection()) {
openInstallFromUnknownSourcesDialogIfNeeded(true);
} else {
- Toast.makeText(this, R.string.account_status_no_internet, Toast.LENGTH_LONG).show();
+ ToastCompat.makeText(this, R.string.account_status_no_internet, Toast.LENGTH_LONG).show();
}
break;
case R.id.action_invite_user:
@@ -808,7 +809,7 @@ public class ConversationsActivity extends XmppActivity implements OnConversatio
public void verifyOtrSessionDialog(final Conversation conversation, View view) {
if (!conversation.hasValidOtrSession() || conversation.getOtrSession().getSessionStatus() != SessionStatus.ENCRYPTED) {
- Toast.makeText(this, R.string.otr_session_not_started, Toast.LENGTH_LONG).show();
+ ToastCompat.makeText(this, R.string.otr_session_not_started, Toast.LENGTH_LONG).show();
return;
}
if (view == null) {
@@ -907,7 +908,7 @@ public class ConversationsActivity extends XmppActivity implements OnConversatio
@Override
public void onShowErrorToast(int resId) {
- runOnUiThread(() -> Toast.makeText(this, resId, Toast.LENGTH_SHORT).show());
+ runOnUiThread(() -> ToastCompat.makeText(this, resId, Toast.LENGTH_SHORT).show());
}
protected void AppUpdate(String Store) {
diff --git a/src/main/java/de/pixart/messenger/ui/EditAccountActivity.java b/src/main/java/de/pixart/messenger/ui/EditAccountActivity.java
index 26ebf5d4b..530180fae 100644
--- a/src/main/java/de/pixart/messenger/ui/EditAccountActivity.java
+++ b/src/main/java/de/pixart/messenger/ui/EditAccountActivity.java
@@ -79,6 +79,7 @@ import de.pixart.messenger.xmpp.XmppConnection;
import de.pixart.messenger.xmpp.XmppConnection.Features;
import de.pixart.messenger.xmpp.forms.Data;
import de.pixart.messenger.xmpp.pep.Avatar;
+import me.drakeet.support.toast.ToastCompat;
import rocks.xmpp.addr.Jid;
import static de.pixart.messenger.utils.PermissionUtils.allGranted;
@@ -125,7 +126,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)) {
- Toast.makeText(EditAccountActivity.this, R.string.unable_to_update_account, Toast.LENGTH_SHORT).show();
+ ToastCompat.makeText(EditAccountActivity.this, R.string.unable_to_update_account, Toast.LENGTH_SHORT).show();
}
return;
}
@@ -155,7 +156,7 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
if (inNeedOfSaslAccept()) {
mAccount.setKey(Account.PINNED_MECHANISM_KEY, String.valueOf(-1));
if (!xmppConnectionService.updateAccount(mAccount)) {
- Toast.makeText(EditAccountActivity.this, R.string.unable_to_update_account, Toast.LENGTH_SHORT).show();
+ ToastCompat.makeText(EditAccountActivity.this, R.string.unable_to_update_account, Toast.LENGTH_SHORT).show();
}
return;
}
@@ -169,7 +170,7 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
overridePendingTransition(R.animator.fade_in, R.animator.fade_out);
return;
} catch (ActivityNotFoundException e) {
- Toast.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, Toast.LENGTH_SHORT).show();
return;
}
}
@@ -241,7 +242,7 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
}
if (registerNewAccount) {
if (XmppConnection.errorMessage != null) {
- Toast.makeText(EditAccountActivity.this, XmppConnection.errorMessage, Toast.LENGTH_LONG).show();
+ ToastCompat.makeText(EditAccountActivity.this, XmppConnection.errorMessage, Toast.LENGTH_LONG).show();
}
}
if (mAccount != null) {
@@ -259,7 +260,7 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
mAccount.setPassword(password);
mAccount.setOption(Account.OPTION_REGISTER, registerNewAccount);
if (!xmppConnectionService.updateAccount(mAccount)) {
- Toast.makeText(EditAccountActivity.this, R.string.unable_to_update_account, Toast.LENGTH_SHORT).show();
+ ToastCompat.makeText(EditAccountActivity.this, R.string.unable_to_update_account, Toast.LENGTH_SHORT).show();
return;
}
} else {
@@ -505,11 +506,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())) {
- Toast.makeText(this, R.string.verified_fingerprints, Toast.LENGTH_SHORT).show();
+ ToastCompat.makeText(this, R.string.verified_fingerprints, Toast.LENGTH_SHORT).show();
updateAccountInformation(false);
}
} else if (showWarningToast) {
- Toast.makeText(this, R.string.invalid_barcode, Toast.LENGTH_SHORT).show();
+ ToastCompat.makeText(this, R.string.invalid_barcode, Toast.LENGTH_SHORT).show();
}
}
@@ -1310,7 +1311,7 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
this.binding.actionCopyToClipboard.setVisibility(View.VISIBLE);
this.binding.actionCopyToClipboard.setOnClickListener(v -> {
if (copyTextToClipboard(CryptoHelper.prettifyFingerprint(otrFingerprint), R.string.otr_fingerprint)) {
- Toast.makeText(
+ ToastCompat.makeText(
EditAccountActivity.this,
R.string.toast_message_otr_fingerprint,
Toast.LENGTH_SHORT).show();
@@ -1446,7 +1447,7 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
try {
startActivityForResult(intent, REQUEST_DATA_SAVER);
} catch (ActivityNotFoundException e) {
- Toast.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, Toast.LENGTH_SHORT).show();
}
});
} else if (showBatteryWarning && android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.M) {
@@ -1460,7 +1461,7 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
try {
startActivityForResult(intent, REQUEST_BATTERY_OP);
} catch (ActivityNotFoundException e) {
- Toast.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, Toast.LENGTH_SHORT).show();
}
});
}
@@ -1478,7 +1479,7 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
}
private void editMamPrefs() {
- this.mFetchingMamPrefsToast = Toast.makeText(this, R.string.fetching_mam_prefs, Toast.LENGTH_LONG);
+ this.mFetchingMamPrefsToast = ToastCompat.makeText(this, R.string.fetching_mam_prefs, Toast.LENGTH_LONG);
this.mFetchingMamPrefsToast.show();
xmppConnectionService.fetchMamPreferences(mAccount, this);
}
@@ -1548,7 +1549,7 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
runOnUiThread(new Runnable() {
@Override
public void run() {
- Toast.makeText(EditAccountActivity.this, resId, Toast.LENGTH_SHORT).show();
+ ToastCompat.makeText(EditAccountActivity.this, resId, Toast.LENGTH_SHORT).show();
}
});
}
@@ -1580,7 +1581,7 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
if (mFetchingMamPrefsToast != null) {
mFetchingMamPrefsToast.cancel();
}
- Toast.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, Toast.LENGTH_LONG).show();
});
}
@@ -1594,7 +1595,7 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
break;
}
} else {
- Toast.makeText(this, R.string.no_storage_permission, Toast.LENGTH_SHORT).show();
+ ToastCompat.makeText(this, R.string.no_storage_permission, Toast.LENGTH_SHORT).show();
}
}
if (readGranted(grantResults, permissions)) {
diff --git a/src/main/java/de/pixart/messenger/ui/ManageAccountActivity.java b/src/main/java/de/pixart/messenger/ui/ManageAccountActivity.java
index f464cc6ae..67201ba03 100644
--- a/src/main/java/de/pixart/messenger/ui/ManageAccountActivity.java
+++ b/src/main/java/de/pixart/messenger/ui/ManageAccountActivity.java
@@ -33,6 +33,7 @@ import de.pixart.messenger.services.XmppConnectionService.OnAccountUpdate;
import de.pixart.messenger.ui.adapter.AccountAdapter;
import de.pixart.messenger.utils.MenuDoubleTabUtil;
import de.pixart.messenger.xmpp.XmppConnection;
+import me.drakeet.support.toast.ToastCompat;
import rocks.xmpp.addr.Jid;
import static de.pixart.messenger.utils.PermissionUtils.allGranted;
@@ -220,7 +221,7 @@ public class ManageAccountActivity extends XmppActivity implements OnAccountUpda
break;
}
} else {
- Toast.makeText(this, R.string.no_storage_permission, Toast.LENGTH_SHORT).show();
+ ToastCompat.makeText(this, R.string.no_storage_permission, Toast.LENGTH_SHORT).show();
}
}
if (readGranted(grantResults, permissions)) {
@@ -264,7 +265,7 @@ public class ManageAccountActivity extends XmppActivity implements OnAccountUpda
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, Toast.LENGTH_LONG).show();
}
}
@@ -329,7 +330,7 @@ public class ManageAccountActivity extends XmppActivity implements OnAccountUpda
private void disableAccount(Account account) {
account.setOption(Account.OPTION_DISABLED, true);
if (!xmppConnectionService.updateAccount(account)) {
- Toast.makeText(this, R.string.unable_to_update_account, Toast.LENGTH_SHORT).show();
+ ToastCompat.makeText(this, R.string.unable_to_update_account, Toast.LENGTH_SHORT).show();
}
}
@@ -340,7 +341,7 @@ public class ManageAccountActivity extends XmppActivity implements OnAccountUpda
connection.resetEverything();
}
if (!xmppConnectionService.updateAccount(account)) {
- Toast.makeText(this, R.string.unable_to_update_account, Toast.LENGTH_SHORT).show();
+ ToastCompat.makeText(this, R.string.unable_to_update_account, Toast.LENGTH_SHORT).show();
}
}
@@ -423,6 +424,6 @@ public class ManageAccountActivity extends XmppActivity implements OnAccountUpda
@Override
public void informUser(final int r) {
- runOnUiThread(() -> Toast.makeText(ManageAccountActivity.this, r, Toast.LENGTH_LONG).show());
+ runOnUiThread(() -> ToastCompat.makeText(ManageAccountActivity.this, r, Toast.LENGTH_LONG).show());
}
}
diff --git a/src/main/java/de/pixart/messenger/ui/MediaViewerActivity.java b/src/main/java/de/pixart/messenger/ui/MediaViewerActivity.java
index b9dff18c7..5431d5316 100644
--- a/src/main/java/de/pixart/messenger/ui/MediaViewerActivity.java
+++ b/src/main/java/de/pixart/messenger/ui/MediaViewerActivity.java
@@ -49,6 +49,7 @@ import de.pixart.messenger.databinding.ActivityMediaViewerBinding;
import de.pixart.messenger.persistance.FileBackend;
import de.pixart.messenger.utils.ExifHelper;
import de.pixart.messenger.utils.MimeUtils;
+import me.drakeet.support.toast.ToastCompat;
import static de.pixart.messenger.persistance.FileBackend.close;
@@ -140,7 +141,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
- Toast.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, Toast.LENGTH_SHORT).show();
}
}
@@ -163,7 +164,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);
- Toast.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()), Toast.LENGTH_SHORT).show();
return;
}
String mime = MimeUtils.guessMimeTypeFromUri(this, uri);
@@ -179,7 +180,7 @@ public class MediaViewerActivity extends XmppActivity implements AudioManager.On
this.startActivity(openIntent);
finish();
} catch (ActivityNotFoundException e) {
- Toast.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, Toast.LENGTH_SHORT).show();
}
}
@@ -203,11 +204,11 @@ public class MediaViewerActivity extends XmppActivity implements AudioManager.On
} catch (Exception e) {
isImage = false;
Log.d(Config.LOGTAG, "Illegal exeption :" + e);
- Toast.makeText(MediaViewerActivity.this, getString(R.string.error_file_corrupt), Toast.LENGTH_SHORT).show();
+ ToastCompat.makeText(MediaViewerActivity.this, getString(R.string.error_file_corrupt), Toast.LENGTH_SHORT).show();
finish();
}
} else {
- Toast.makeText(MediaViewerActivity.this, getString(R.string.file_deleted), Toast.LENGTH_SHORT).show();
+ ToastCompat.makeText(MediaViewerActivity.this, getString(R.string.file_deleted), Toast.LENGTH_SHORT).show();
}
} else if (intent.hasExtra("video")) {
mFileUri = intent.getParcelableExtra("video");
@@ -219,11 +220,11 @@ public class MediaViewerActivity extends XmppActivity implements AudioManager.On
} catch (Exception e) {
isVideo = false;
Log.d(Config.LOGTAG, "Illegal exeption :" + e);
- Toast.makeText(MediaViewerActivity.this, getString(R.string.error_file_corrupt), Toast.LENGTH_SHORT).show();
+ ToastCompat.makeText(MediaViewerActivity.this, getString(R.string.error_file_corrupt), Toast.LENGTH_SHORT).show();
finish();
}
} else {
- Toast.makeText(MediaViewerActivity.this, getString(R.string.file_deleted), Toast.LENGTH_SHORT).show();
+ ToastCompat.makeText(MediaViewerActivity.this, getString(R.string.file_deleted), Toast.LENGTH_SHORT).show();
}
}
}
@@ -252,7 +253,7 @@ public class MediaViewerActivity extends XmppActivity implements AudioManager.On
binding.messageImageView.setOnTouchListener((view, motionEvent) -> gestureDetector.onTouchEvent(motionEvent));
}
} catch (Exception e) {
- Toast.makeText(this, getString(R.string.error_file_corrupt), Toast.LENGTH_LONG).show();
+ ToastCompat.makeText(this, getString(R.string.error_file_corrupt), Toast.LENGTH_LONG).show();
e.printStackTrace();
}
}
diff --git a/src/main/java/de/pixart/messenger/ui/MucUsersActivity.java b/src/main/java/de/pixart/messenger/ui/MucUsersActivity.java
index 78fe80aaa..806e32743 100644
--- a/src/main/java/de/pixart/messenger/ui/MucUsersActivity.java
+++ b/src/main/java/de/pixart/messenger/ui/MucUsersActivity.java
@@ -28,6 +28,7 @@ import de.pixart.messenger.entities.MucOptions;
import de.pixart.messenger.services.XmppConnectionService;
import de.pixart.messenger.ui.adapter.UserAdapter;
import de.pixart.messenger.ui.util.MucDetailsContextMenuHelper;
+import me.drakeet.support.toast.ToastCompat;
import rocks.xmpp.addr.Jid;
public class MucUsersActivity extends XmppActivity implements XmppConnectionService.OnMucRosterUpdate, XmppConnectionService.OnAffiliationChanged, MenuItem.OnActionExpandListener, TextWatcher {
@@ -104,7 +105,7 @@ public class MucUsersActivity extends XmppActivity implements XmppConnectionServ
}
private void displayToast(final String msg) {
- runOnUiThread(() -> Toast.makeText(this, msg, Toast.LENGTH_SHORT).show());
+ runOnUiThread(() -> ToastCompat.makeText(this, msg, Toast.LENGTH_SHORT).show());
}
@Override
diff --git a/src/main/java/de/pixart/messenger/ui/OmemoActivity.java b/src/main/java/de/pixart/messenger/ui/OmemoActivity.java
index 2ae91ac0a..1c9977ea6 100644
--- a/src/main/java/de/pixart/messenger/ui/OmemoActivity.java
+++ b/src/main/java/de/pixart/messenger/ui/OmemoActivity.java
@@ -20,6 +20,7 @@ import de.pixart.messenger.databinding.ContactKeyBinding;
import de.pixart.messenger.entities.Account;
import de.pixart.messenger.utils.CryptoHelper;
import de.pixart.messenger.utils.XmppUri;
+import me.drakeet.support.toast.ToastCompat;
public abstract class OmemoActivity extends XmppActivity {
@@ -92,7 +93,7 @@ public abstract class OmemoActivity extends XmppActivity {
protected void copyOmemoFingerprint(String fingerprint) {
if (copyTextToClipboard(CryptoHelper.prettifyFingerprint(fingerprint.substring(2)), R.string.omemo_fingerprint)) {
- Toast.makeText(
+ ToastCompat.makeText(
this,
R.string.toast_message_omemo_fingerprint,
Toast.LENGTH_SHORT).show();
diff --git a/src/main/java/de/pixart/messenger/ui/PublishGroupChatProfilePictureActivity.java b/src/main/java/de/pixart/messenger/ui/PublishGroupChatProfilePictureActivity.java
index ac7f42e47..9c70640c3 100644
--- a/src/main/java/de/pixart/messenger/ui/PublishGroupChatProfilePictureActivity.java
+++ b/src/main/java/de/pixart/messenger/ui/PublishGroupChatProfilePictureActivity.java
@@ -49,6 +49,7 @@ import de.pixart.messenger.databinding.ActivityPublishProfilePictureBinding;
import de.pixart.messenger.entities.Conversation;
import de.pixart.messenger.ui.interfaces.OnAvatarPublication;
import de.pixart.messenger.ui.util.PendingItem;
+import me.drakeet.support.toast.ToastCompat;
public class PublishGroupChatProfilePictureActivity extends XmppActivity implements OnAvatarPublication {
@@ -124,7 +125,7 @@ public class PublishGroupChatProfilePictureActivity extends XmppActivity impleme
} else if (resultCode == CropImage.CROP_IMAGE_ACTIVITY_RESULT_ERROR_CODE) {
Exception error = result.getError();
if (error != null) {
- Toast.makeText(this, error.getMessage(), Toast.LENGTH_SHORT).show();
+ ToastCompat.makeText(this, error.getMessage(), Toast.LENGTH_SHORT).show();
}
}
}
@@ -141,7 +142,7 @@ public class PublishGroupChatProfilePictureActivity extends XmppActivity impleme
@Override
public void onAvatarPublicationSucceeded() {
runOnUiThread(() -> {
- Toast.makeText(this, R.string.avatar_has_been_published, Toast.LENGTH_SHORT).show();
+ ToastCompat.makeText(this, R.string.avatar_has_been_published, Toast.LENGTH_SHORT).show();
finish();
});
}
@@ -149,7 +150,7 @@ public class PublishGroupChatProfilePictureActivity extends XmppActivity impleme
@Override
public void onAvatarPublicationFailed(@StringRes int res) {
runOnUiThread(() -> {
- Toast.makeText(this, res, Toast.LENGTH_SHORT).show();
+ ToastCompat.makeText(this, res, Toast.LENGTH_SHORT).show();
this.binding.publishButton.setText(R.string.publish);
this.binding.publishButton.setEnabled(true);
});
diff --git a/src/main/java/de/pixart/messenger/ui/PublishProfilePictureActivity.java b/src/main/java/de/pixart/messenger/ui/PublishProfilePictureActivity.java
index 27f20d712..f505bd3a3 100644
--- a/src/main/java/de/pixart/messenger/ui/PublishProfilePictureActivity.java
+++ b/src/main/java/de/pixart/messenger/ui/PublishProfilePictureActivity.java
@@ -24,6 +24,7 @@ import de.pixart.messenger.entities.Account;
import de.pixart.messenger.services.XmppConnectionService;
import de.pixart.messenger.ui.interfaces.OnAvatarPublication;
import de.pixart.messenger.utils.PhoneHelper;
+import me.drakeet.support.toast.ToastCompat;
public class PublishProfilePictureActivity extends XmppActivity implements XmppConnectionService.OnAccountUpdate, OnAvatarPublication {
@@ -59,7 +60,7 @@ public class PublishProfilePictureActivity extends XmppActivity implements XmppC
intent.putExtra("init", true);
startActivity(intent);
}
- Toast.makeText(PublishProfilePictureActivity.this,
+ ToastCompat.makeText(PublishProfilePictureActivity.this,
R.string.avatar_has_been_published,
Toast.LENGTH_SHORT).show();
finish();
@@ -137,7 +138,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) {
- Toast.makeText(this, error.getMessage(), Toast.LENGTH_SHORT).show();
+ ToastCompat.makeText(this, error.getMessage(), Toast.LENGTH_SHORT).show();
}
}
}
diff --git a/src/main/java/de/pixart/messenger/ui/RecordingActivity.java b/src/main/java/de/pixart/messenger/ui/RecordingActivity.java
index 586278284..b56756ed4 100644
--- a/src/main/java/de/pixart/messenger/ui/RecordingActivity.java
+++ b/src/main/java/de/pixart/messenger/ui/RecordingActivity.java
@@ -30,6 +30,7 @@ import de.pixart.messenger.R;
import de.pixart.messenger.databinding.ActivityRecordingBinding;
import de.pixart.messenger.persistance.FileBackend;
import de.pixart.messenger.utils.ThemeHelper;
+import me.drakeet.support.toast.ToastCompat;
public class RecordingActivity extends Activity implements View.OnClickListener {
@@ -115,7 +116,7 @@ public class RecordingActivity extends Activity implements View.OnClickListener
mRecorder.release();
} catch (Exception e) {
if (saveFile) {
- Toast.makeText(this, R.string.unable_to_save_recording, Toast.LENGTH_SHORT).show();
+ ToastCompat.makeText(this, R.string.unable_to_save_recording, Toast.LENGTH_SHORT).show();
return;
}
} finally {
diff --git a/src/main/java/de/pixart/messenger/ui/ScanActivity.java b/src/main/java/de/pixart/messenger/ui/ScanActivity.java
index 77913920b..821fda700 100644
--- a/src/main/java/de/pixart/messenger/ui/ScanActivity.java
+++ b/src/main/java/de/pixart/messenger/ui/ScanActivity.java
@@ -61,6 +61,7 @@ import de.pixart.messenger.Config;
import de.pixart.messenger.R;
import de.pixart.messenger.ui.service.CameraManager;
import de.pixart.messenger.ui.widget.ScannerView;
+import me.drakeet.support.toast.ToastCompat;
/**
* @author Andreas Schildbach
@@ -290,7 +291,7 @@ public final class ScanActivity extends Activity implements SurfaceTextureListen
if (grantResults[0] == PackageManager.PERMISSION_GRANTED) {
scan(activity);
} else {
- Toast.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, Toast.LENGTH_SHORT).show();
}
}
}
diff --git a/src/main/java/de/pixart/messenger/ui/SettingsActivity.java b/src/main/java/de/pixart/messenger/ui/SettingsActivity.java
index ae13072c7..b51ad333c 100644
--- a/src/main/java/de/pixart/messenger/ui/SettingsActivity.java
+++ b/src/main/java/de/pixart/messenger/ui/SettingsActivity.java
@@ -522,7 +522,7 @@ public class SettingsActivity extends XmppActivity implements
createBackup(true);
}
} else {
- Toast.makeText(this, R.string.no_storage_permission, Toast.LENGTH_SHORT).show();
+ ToastCompat.makeText(this, R.string.no_storage_permission, Toast.LENGTH_SHORT).show();
}
}
}
@@ -534,7 +534,7 @@ public class SettingsActivity extends XmppActivity implements
}
private void displayToast(final String msg) {
- runOnUiThread(() -> Toast.makeText(SettingsActivity.this, msg, Toast.LENGTH_LONG).show());
+ runOnUiThread(() -> ToastCompat.makeText(SettingsActivity.this, msg, Toast.LENGTH_LONG).show());
}
private void reconnectAccounts() {
diff --git a/src/main/java/de/pixart/messenger/ui/ShareWithActivity.java b/src/main/java/de/pixart/messenger/ui/ShareWithActivity.java
index 7ae001a6f..5d44a2687 100644
--- a/src/main/java/de/pixart/messenger/ui/ShareWithActivity.java
+++ b/src/main/java/de/pixart/messenger/ui/ShareWithActivity.java
@@ -21,6 +21,7 @@ import de.pixart.messenger.entities.Account;
import de.pixart.messenger.entities.Conversation;
import de.pixart.messenger.services.XmppConnectionService;
import de.pixart.messenger.ui.adapter.ConversationAdapter;
+import me.drakeet.support.toast.ToastCompat;
import rocks.xmpp.addr.Jid;
public class ShareWithActivity extends XmppActivity implements XmppConnectionService.OnConversationUpdate {
@@ -75,7 +76,7 @@ public class ShareWithActivity extends XmppActivity implements XmppConnectionSer
}
}
} else {
- Toast.makeText(this, R.string.no_storage_permission, Toast.LENGTH_SHORT).show();
+ ToastCompat.makeText(this, R.string.no_storage_permission, Toast.LENGTH_SHORT).show();
}
}
@@ -195,7 +196,7 @@ public class ShareWithActivity extends XmppActivity implements XmppConnectionSer
try {
startActivity(intent);
} catch (SecurityException e) {
- Toast.makeText(this, R.string.sharing_application_not_grant_permission, Toast.LENGTH_SHORT).show();
+ ToastCompat.makeText(this, R.string.sharing_application_not_grant_permission, Toast.LENGTH_SHORT).show();
return;
}
finish();
diff --git a/src/main/java/de/pixart/messenger/ui/ShowLocationActivity.java b/src/main/java/de/pixart/messenger/ui/ShowLocationActivity.java
index ede5ec2f5..3b4305f47 100644
--- a/src/main/java/de/pixart/messenger/ui/ShowLocationActivity.java
+++ b/src/main/java/de/pixart/messenger/ui/ShowLocationActivity.java
@@ -28,6 +28,7 @@ import java.util.Locale;
import de.pixart.messenger.Config;
import de.pixart.messenger.R;
import de.pixart.messenger.utils.MenuDoubleTabUtil;
+import me.drakeet.support.toast.ToastCompat;
public class ShowLocationActivity extends XmppActivity {
FloatingActionButton fab;
@@ -161,7 +162,7 @@ public class ShowLocationActivity extends XmppActivity {
startActivity(intent);
overridePendingTransition(R.animator.fade_in, R.animator.fade_out);
} catch (ActivityNotFoundException e) {
- Toast.makeText(this, R.string.no_application_found_to_display_location, Toast.LENGTH_SHORT).show();
+ ToastCompat.makeText(this, R.string.no_application_found_to_display_location, Toast.LENGTH_SHORT).show();
}
}
diff --git a/src/main/java/de/pixart/messenger/ui/StartConversationActivity.java b/src/main/java/de/pixart/messenger/ui/StartConversationActivity.java
index c85a7e8bb..fb25e3c71 100644
--- a/src/main/java/de/pixart/messenger/ui/StartConversationActivity.java
+++ b/src/main/java/de/pixart/messenger/ui/StartConversationActivity.java
@@ -79,6 +79,7 @@ import de.pixart.messenger.utils.MenuDoubleTabUtil;
import de.pixart.messenger.utils.XmppUri;
import de.pixart.messenger.xmpp.OnUpdateBlocklist;
import de.pixart.messenger.xmpp.XmppConnection;
+import me.drakeet.support.toast.ToastCompat;
import rocks.xmpp.addr.Jid;
public class StartConversationActivity extends XmppActivity implements XmppConnectionService.OnConversationUpdate, OnRosterUpdate, OnUpdateBlocklist, CreatePrivateGroupChatDialog.CreateConferenceDialogListener, JoinConferenceDialog.JoinConferenceDialogListener, CreatePublicChannelDialog.CreatePublicChannelDialogListener {
@@ -245,7 +246,7 @@ public class StartConversationActivity extends XmppActivity implements XmppConne
protected void replaceToast(String msg) {
hideToast();
- mToast = Toast.makeText(this, msg, Toast.LENGTH_LONG);
+ mToast = ToastCompat.makeText(this, msg, Toast.LENGTH_LONG);
mToast.show();
}
@@ -408,14 +409,14 @@ public class StartConversationActivity extends XmppActivity implements XmppConne
try {
context.startActivity(Intent.createChooser(shareIntent, context.getText(R.string.share_uri_with)));
} catch (ActivityNotFoundException e) {
- Toast.makeText(context, R.string.no_application_to_share_uri, Toast.LENGTH_SHORT).show();
+ ToastCompat.makeText(context, R.string.no_application_to_share_uri, Toast.LENGTH_SHORT).show();
}
}
protected void openConversationsForBookmark(Bookmark bookmark) {
final Jid jid = bookmark.getFullJid();
if (jid == null) {
- Toast.makeText(this, R.string.invalid_jid, Toast.LENGTH_SHORT).show();
+ ToastCompat.makeText(this, R.string.invalid_jid, Toast.LENGTH_SHORT).show();
return;
}
Conversation conversation = xmppConnectionService.findOrCreateConversation(bookmark.getAccount(), jid, true, true, true);
@@ -711,7 +712,7 @@ public class StartConversationActivity extends XmppActivity implements XmppConne
final List<Jid> jids = ChooseContactActivity.extractJabberIds(intent);
if (account != null && jids.size() > 0) {
if (xmppConnectionService.createAdhocConference(account, name, jids, mAdhocConferenceCallback)) {
- mToast = Toast.makeText(this, R.string.creating_conference, Toast.LENGTH_LONG);
+ mToast = ToastCompat.makeText(this, R.string.creating_conference, Toast.LENGTH_LONG);
mToast.show();
}
}
@@ -841,7 +842,7 @@ public class StartConversationActivity extends XmppActivity implements XmppConne
} else {
if (invite.hasFingerprints()) {
if (xmppConnectionService.verifyFingerprints(contact, invite.getFingerprints())) {
- Toast.makeText(this, R.string.verified_fingerprints, Toast.LENGTH_SHORT).show();
+ ToastCompat.makeText(this, R.string.verified_fingerprints, Toast.LENGTH_SHORT).show();
}
}
if (invite.account != null) {
@@ -1034,7 +1035,7 @@ public class StartConversationActivity extends XmppActivity implements XmppConne
@Override
public void onCreatePublicChannel(Account account, String name, Jid address) {
- mToast = Toast.makeText(this, R.string.creating_channel, Toast.LENGTH_LONG);
+ mToast = ToastCompat.makeText(this, R.string.creating_channel, Toast.LENGTH_LONG);
mToast.show();
xmppConnectionService.createPublicChannel(account, name, address, new UiCallback<Conversation>() {
@Override
@@ -1254,7 +1255,7 @@ public class StartConversationActivity extends XmppActivity implements XmppConne
boolean invite() {
if (!isValidJid()) {
- Toast.makeText(StartConversationActivity.this, R.string.invalid_jid, Toast.LENGTH_SHORT).show();
+ ToastCompat.makeText(StartConversationActivity.this, R.string.invalid_jid, Toast.LENGTH_SHORT).show();
return false;
}
if (getJid() != null) {
diff --git a/src/main/java/de/pixart/messenger/ui/TrustKeysActivity.java b/src/main/java/de/pixart/messenger/ui/TrustKeysActivity.java
index 31ed6ab6f..eacaf8a39 100644
--- a/src/main/java/de/pixart/messenger/ui/TrustKeysActivity.java
+++ b/src/main/java/de/pixart/messenger/ui/TrustKeysActivity.java
@@ -39,6 +39,7 @@ import de.pixart.messenger.utils.CryptoHelper;
import de.pixart.messenger.utils.IrregularUnicodeDetector;
import de.pixart.messenger.utils.XmppUri;
import de.pixart.messenger.xmpp.OnKeyStatusUpdated;
+import me.drakeet.support.toast.ToastCompat;
import rocks.xmpp.addr.Jid;
public class TrustKeysActivity extends OmemoActivity implements OnKeyStatusUpdated {
@@ -105,7 +106,7 @@ public class TrustKeysActivity extends OmemoActivity implements OnKeyStatusUpdat
}
private void showCameraToast() {
- mUseCameraHintToast = Toast.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, Toast.LENGTH_LONG);
ActionBar actionBar = getSupportActionBar();
mUseCameraHintToast.setGravity(Gravity.TOP | Gravity.END, 0, actionBar == null ? 0 : actionBar.getHeight());
mUseCameraHintToast.show();
@@ -116,7 +117,7 @@ public class TrustKeysActivity extends OmemoActivity implements OnKeyStatusUpdat
switch (item.getItemId()) {
case R.id.action_scan_qr_code:
if (hasPendingKeyFetches()) {
- Toast.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, Toast.LENGTH_SHORT).show();
} else {
ScanActivity.scan(this);
return true;
@@ -142,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()) {
- Toast.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, Toast.LENGTH_SHORT).show();
finishOk(false);
return;
} else if (performedVerification) {
- Toast.makeText(this, R.string.verified_fingerprints, Toast.LENGTH_SHORT).show();
+ ToastCompat.makeText(this, R.string.verified_fingerprints, Toast.LENGTH_SHORT).show();
}
} else {
reloadFingerprints();
Log.d(Config.LOGTAG, "xmpp uri was: " + uri.getJid() + " has Fingerprints: " + Boolean.toString(uri.hasFingerprints()));
- Toast.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, Toast.LENGTH_SHORT).show();
}
populateView();
}
@@ -367,13 +368,13 @@ public class TrustKeysActivity extends OmemoActivity implements OnKeyStatusUpdat
}
switch (report) {
case ERROR:
- Toast.makeText(TrustKeysActivity.this, R.string.error_fetching_omemo_key, Toast.LENGTH_SHORT).show();
+ ToastCompat.makeText(TrustKeysActivity.this, R.string.error_fetching_omemo_key, Toast.LENGTH_SHORT).show();
break;
case SUCCESS_TRUSTED:
- Toast.makeText(TrustKeysActivity.this, R.string.blindly_trusted_omemo_keys, Toast.LENGTH_LONG).show();
+ ToastCompat.makeText(TrustKeysActivity.this, R.string.blindly_trusted_omemo_keys, Toast.LENGTH_LONG).show();
break;
case SUCCESS_VERIFIED:
- Toast.makeText(TrustKeysActivity.this,
+ 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();
break;
diff --git a/src/main/java/de/pixart/messenger/ui/UpdaterActivity.java b/src/main/java/de/pixart/messenger/ui/UpdaterActivity.java
index 6b5054968..fdd9b95d3 100644
--- a/src/main/java/de/pixart/messenger/ui/UpdaterActivity.java
+++ b/src/main/java/de/pixart/messenger/ui/UpdaterActivity.java
@@ -34,6 +34,7 @@ import de.pixart.messenger.R;
import de.pixart.messenger.persistance.FileBackend;
import de.pixart.messenger.services.XmppConnectionService;
import de.pixart.messenger.utils.WakeLockHelper;
+import me.drakeet.support.toast.ToastCompat;
import static de.pixart.messenger.http.HttpConnectionManager.getProxy;
import static de.pixart.messenger.services.XmppConnectionService.FDroid;
@@ -93,13 +94,13 @@ public class UpdaterActivity extends XmppActivity {
try {
appURI = getIntent().getStringExtra("url");
} catch (Exception e) {
- Toast.makeText(getApplicationContext(), getText(R.string.failed), Toast.LENGTH_LONG).show();
+ ToastCompat.makeText(getApplicationContext(), getText(R.string.failed), Toast.LENGTH_LONG).show();
UpdaterActivity.this.finish();
}
try {
changelog = getIntent().getStringExtra("changelog");
} catch (Exception e) {
- Toast.makeText(getApplicationContext(), getText(R.string.failed), Toast.LENGTH_LONG).show();
+ ToastCompat.makeText(getApplicationContext(), getText(R.string.failed), Toast.LENGTH_LONG).show();
UpdaterActivity.this.finish();
}
try {
@@ -157,7 +158,7 @@ public class UpdaterActivity extends XmppActivity {
overridePendingTransition(R.animator.fade_in, R.animator.fade_out);
}
} else {
- Toast.makeText(getApplicationContext(), getText(R.string.download_started), Toast.LENGTH_LONG).show();
+ ToastCompat.makeText(getApplicationContext(), getText(R.string.download_started), Toast.LENGTH_LONG).show();
downloadTask = new DownloadTask(UpdaterActivity.this);
downloadTask.execute(appURI);
}
@@ -186,7 +187,7 @@ public class UpdaterActivity extends XmppActivity {
//show the alert message
builder.create().show();
} else {
- Toast.makeText(getApplicationContext(), getText(R.string.failed), Toast.LENGTH_LONG).show();
+ ToastCompat.makeText(getApplicationContext(), getText(R.string.failed), Toast.LENGTH_LONG).show();
UpdaterActivity.this.finish();
}
}
@@ -341,7 +342,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() != HttpURLConnection.HTTP_OK) {
- Toast.makeText(getApplicationContext(), getText(R.string.failed), Toast.LENGTH_LONG).show();
+ ToastCompat.makeText(getApplicationContext(), getText(R.string.failed), Toast.LENGTH_LONG).show();
return connection.getResponseCode() + ": " + connection.getResponseMessage();
}
@@ -397,7 +398,7 @@ public class UpdaterActivity extends XmppActivity {
WakeLockHelper.release(mWakeLock);
mProgressDialog.dismiss();
if (result != null) {
- Toast.makeText(getApplicationContext(), getString(R.string.failed), Toast.LENGTH_LONG).show();
+ ToastCompat.makeText(getApplicationContext(), getString(R.string.failed), Toast.LENGTH_LONG).show();
Log.d(Config.LOGTAG, "AppUpdater: failed with " + result);
UpdaterActivity.this.finish();
} else {
diff --git a/src/main/java/de/pixart/messenger/ui/UriHandlerActivity.java b/src/main/java/de/pixart/messenger/ui/UriHandlerActivity.java
index 9c5d54774..f0331b882 100644
--- a/src/main/java/de/pixart/messenger/ui/UriHandlerActivity.java
+++ b/src/main/java/de/pixart/messenger/ui/UriHandlerActivity.java
@@ -20,6 +20,7 @@ import de.pixart.messenger.R;
import de.pixart.messenger.persistance.DatabaseBackend;
import de.pixart.messenger.utils.SignupUtils;
import de.pixart.messenger.utils.XmppUri;
+import me.drakeet.support.toast.ToastCompat;
import rocks.xmpp.addr.Jid;
public class UriHandlerActivity extends AppCompatActivity {
@@ -49,7 +50,7 @@ public class UriHandlerActivity extends AppCompatActivity {
if (grantResults[0] == PackageManager.PERMISSION_GRANTED) {
scan(activity);
} else {
- Toast.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, Toast.LENGTH_SHORT).show();
}
}
}
@@ -92,7 +93,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())) {
- Toast.makeText(this, R.string.account_already_exists, Toast.LENGTH_LONG).show();
+ ToastCompat.makeText(this, R.string.account_already_exists, Toast.LENGTH_LONG).show();
return;
}
intent = SignupUtils.getTokenRegistrationIntent(this, jid, preauth);
@@ -112,7 +113,7 @@ public class UriHandlerActivity extends AppCompatActivity {
intent.putExtra(StartConversationActivity.EXTRA_INVITE_URI, xmppUri.toString());
startActivity(intent);
} else {
- Toast.makeText(this, R.string.invalid_jid, Toast.LENGTH_SHORT).show();
+ ToastCompat.makeText(this, R.string.invalid_jid, Toast.LENGTH_SHORT).show();
}
return;
}
@@ -155,7 +156,7 @@ public class UriHandlerActivity extends AppCompatActivity {
intent.putExtra("scanned", scanned);
intent.setData(uri);
} else {
- Toast.makeText(this, R.string.invalid_jid, Toast.LENGTH_SHORT).show();
+ ToastCompat.makeText(this, R.string.invalid_jid, Toast.LENGTH_SHORT).show();
return;
}
startActivity(intent);
diff --git a/src/main/java/de/pixart/messenger/ui/VerifyOTRActivity.java b/src/main/java/de/pixart/messenger/ui/VerifyOTRActivity.java
index 0e7a2ce57..8febb90b4 100644
--- a/src/main/java/de/pixart/messenger/ui/VerifyOTRActivity.java
+++ b/src/main/java/de/pixart/messenger/ui/VerifyOTRActivity.java
@@ -26,6 +26,7 @@ import de.pixart.messenger.entities.Conversation;
import de.pixart.messenger.services.XmppConnectionService;
import de.pixart.messenger.utils.CryptoHelper;
import de.pixart.messenger.utils.XmppUri;
+import me.drakeet.support.toast.ToastCompat;
import rocks.xmpp.addr.Jid;
public class VerifyOTRActivity extends XmppActivity implements XmppConnectionService.OnConversationUpdate {
@@ -58,7 +59,7 @@ public class VerifyOTRActivity extends XmppActivity implements XmppConnectionSer
public void onClick(DialogInterface dialogInterface, int click) {
mConversation.verifyOtrFingerprint();
xmppConnectionService.syncRosterToDisk(mConversation.getAccount());
- Toast.makeText(VerifyOTRActivity.this, R.string.verified, Toast.LENGTH_SHORT).show();
+ ToastCompat.makeText(VerifyOTRActivity.this, R.string.verified, Toast.LENGTH_SHORT).show();
finish();
}
};
@@ -174,18 +175,18 @@ public class VerifyOTRActivity extends XmppActivity implements XmppConnectionSer
Contact contact = mConversation.getContact();
if (this.mConversation.getContact().getJid().equals(uri.getJid()) && uri.hasFingerprints()) {
xmppConnectionService.verifyFingerprints(contact, uri.getFingerprints());
- Toast.makeText(this, R.string.verified, Toast.LENGTH_SHORT).show();
+ ToastCompat.makeText(this, R.string.verified, Toast.LENGTH_SHORT).show();
updateView();
return true;
} else {
- Toast.makeText(this, R.string.could_not_verify_fingerprint, Toast.LENGTH_SHORT).show();
+ ToastCompat.makeText(this, R.string.could_not_verify_fingerprint, Toast.LENGTH_SHORT).show();
return false;
}
}
protected boolean isAccountOnline() {
if (this.mAccount.getStatus() != Account.State.ONLINE) {
- Toast.makeText(this, R.string.not_connected_try_again, Toast.LENGTH_SHORT).show();
+ ToastCompat.makeText(this, R.string.not_connected_try_again, Toast.LENGTH_SHORT).show();
return false;
} else {
return true;
diff --git a/src/main/java/de/pixart/messenger/ui/WelcomeActivity.java b/src/main/java/de/pixart/messenger/ui/WelcomeActivity.java
index fa7581a7a..92321c32a 100644
--- a/src/main/java/de/pixart/messenger/ui/WelcomeActivity.java
+++ b/src/main/java/de/pixart/messenger/ui/WelcomeActivity.java
@@ -27,6 +27,7 @@ import de.pixart.messenger.ui.util.IntroHelper;
import de.pixart.messenger.utils.InstallReferrerUtils;
import de.pixart.messenger.utils.SignupUtils;
import de.pixart.messenger.utils.XmppUri;
+import me.drakeet.support.toast.ToastCompat;
import rocks.xmpp.addr.Jid;
import static de.pixart.messenger.Config.DISALLOW_REGISTRATION_IN_UI;
@@ -194,7 +195,7 @@ public class WelcomeActivity extends XmppActivity {
break;
}
} else if (Arrays.asList(permissions).contains(Manifest.permission.WRITE_EXTERNAL_STORAGE)) {
- Toast.makeText(this, R.string.no_storage_permission, Toast.LENGTH_SHORT).show();
+ ToastCompat.makeText(this, R.string.no_storage_permission, Toast.LENGTH_SHORT).show();
}
}
if (readGranted(grantResults, permissions)) {
diff --git a/src/main/java/de/pixart/messenger/ui/XmppActivity.java b/src/main/java/de/pixart/messenger/ui/XmppActivity.java
index 807a70111..9d6fd1bf6 100644
--- a/src/main/java/de/pixart/messenger/ui/XmppActivity.java
+++ b/src/main/java/de/pixart/messenger/ui/XmppActivity.java
@@ -93,6 +93,7 @@ import de.pixart.messenger.utils.ThemeHelper;
import de.pixart.messenger.xmpp.OnKeyStatusUpdated;
import de.pixart.messenger.xmpp.OnUpdateBlocklist;
import de.pixart.messenger.xmpp.XmppConnection;
+import me.drakeet.support.toast.ToastCompat;
import pl.droidsonroids.gif.GifDrawable;
import rocks.xmpp.addr.Jid;
@@ -125,7 +126,7 @@ public abstract class XmppActivity extends ActionBarActivity {
protected boolean mUsingEnterKey = false;
protected Toast mToast;
- protected Runnable onOpenPGPKeyPublished = () -> Toast.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, Toast.LENGTH_SHORT).show();
protected ConferenceInvite mPendingConferenceInvite = null;
protected ServiceConnection mConnection = new ServiceConnection() {
@@ -210,7 +211,7 @@ public abstract class XmppActivity extends ActionBarActivity {
protected void replaceToast(String msg, boolean showlong) {
hideToast();
- mToast = Toast.makeText(this, msg, showlong ? Toast.LENGTH_LONG : Toast.LENGTH_SHORT);
+ mToast = ToastCompat.makeText(this, msg, showlong ? Toast.LENGTH_LONG : Toast.LENGTH_SHORT);
mToast.show();
}
@@ -936,7 +937,7 @@ public abstract class XmppActivity extends ActionBarActivity {
mPendingConferenceInvite = ConferenceInvite.parse(data);
if (xmppConnectionServiceBound && mPendingConferenceInvite != null) {
if (mPendingConferenceInvite.execute(this)) {
- mToast = Toast.makeText(this, R.string.creating_conference, Toast.LENGTH_LONG);
+ mToast = ToastCompat.makeText(this, R.string.creating_conference, Toast.LENGTH_LONG);
mToast.show();
}
mPendingConferenceInvite = null;
@@ -986,11 +987,11 @@ public abstract class XmppActivity extends ActionBarActivity {
public void inviteUser() {
if (!xmppConnectionServiceBound) {
- Toast.makeText(this, R.string.not_connected_try_again, Toast.LENGTH_SHORT).show();
+ ToastCompat.makeText(this, R.string.not_connected_try_again, Toast.LENGTH_SHORT).show();
return;
}
if (xmppConnectionService.getAccounts() == null) {
- Toast.makeText(this, R.string.no_accounts, Toast.LENGTH_SHORT).show();
+ ToastCompat.makeText(this, R.string.no_accounts, Toast.LENGTH_SHORT).show();
return;
}
if (!xmppConnectionService.multipleAccounts()) {
@@ -1132,7 +1133,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) {
- Toast.makeText(this, R.string.no_application_to_share_uri, Toast.LENGTH_SHORT).show();
+ ToastCompat.makeText(this, R.string.no_application_to_share_uri, Toast.LENGTH_SHORT).show();
}
}
@@ -1143,7 +1144,7 @@ public abstract class XmppActivity extends ActionBarActivity {
pgp.getIntentForKey(keyId).getIntentSender(), 0, null, 0,
0, 0);
} catch (Throwable e) {
- Toast.makeText(XmppActivity.this, R.string.openpgp_error, Toast.LENGTH_SHORT).show();
+ ToastCompat.makeText(XmppActivity.this, R.string.openpgp_error, Toast.LENGTH_SHORT).show();
}
}
@@ -1407,7 +1408,7 @@ public abstract class XmppActivity extends ActionBarActivity {
try {
startActivityForResult(intent, REQUEST_UNKNOWN_SOURCE_OP);
} catch (ActivityNotFoundException e) {
- Toast.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, Toast.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/de/pixart/messenger/ui/adapter/MessageAdapter.java b/src/main/java/de/pixart/messenger/ui/adapter/MessageAdapter.java
index 778caf1b2..dee202a5f 100644
--- a/src/main/java/de/pixart/messenger/ui/adapter/MessageAdapter.java
+++ b/src/main/java/de/pixart/messenger/ui/adapter/MessageAdapter.java
@@ -88,6 +88,7 @@ import de.pixart.messenger.utils.RichPreview;
import de.pixart.messenger.utils.StylingHelper;
import de.pixart.messenger.utils.UIHelper;
import de.pixart.messenger.xmpp.mam.MamReference;
+import me.drakeet.support.toast.ToastCompat;
import pl.droidsonroids.gif.GifImageView;
import rocks.xmpp.addr.Jid;
@@ -460,7 +461,7 @@ public class MessageAdapter extends ArrayAdapter<Message> implements CopyTextVie
activity.startActivity(intent);
activity.overridePendingTransition(R.animator.fade_in, R.animator.fade_out);
} catch (Exception e) {
- Toast.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, Toast.LENGTH_LONG).show();
}
});
@@ -860,7 +861,7 @@ public class MessageAdapter extends ArrayAdapter<Message> implements CopyTextVie
viewHolder.richlinkview.setVisibility(View.GONE);
DownloadableFile file = activity.xmppConnectionService.getFileBackend().getFile(message);
if (!file.exists()) {
- Toast.makeText(activity, R.string.file_deleted, Toast.LENGTH_SHORT).show();
+ ToastCompat.makeText(activity, R.string.file_deleted, Toast.LENGTH_SHORT).show();
return;
}
String mime = file.getMimeType();
@@ -976,9 +977,9 @@ public class MessageAdapter extends ArrayAdapter<Message> implements CopyTextVie
conversation.messagesLoaded.set(true);
MessageArchiveService.Query query = activity.xmppConnectionService.getMessageArchiveService().query(conversation, new MamReference(0), timestamp, false);
if (query != null) {
- Toast.makeText(activity, R.string.fetching_history_from_server, Toast.LENGTH_LONG).show();
+ ToastCompat.makeText(activity, R.string.fetching_history_from_server, Toast.LENGTH_LONG).show();
} else {
- Toast.makeText(activity, R.string.not_fetching_history_retention_period, Toast.LENGTH_SHORT).show();
+ ToastCompat.makeText(activity, R.string.not_fetching_history_retention_period, Toast.LENGTH_SHORT).show();
}
}
@@ -1332,7 +1333,7 @@ public class MessageAdapter extends ArrayAdapter<Message> implements CopyTextVie
return;
}
}
- Toast.makeText(activity, R.string.no_application_found_to_display_location, Toast.LENGTH_SHORT).show();
+ ToastCompat.makeText(activity, R.string.no_application_found_to_display_location, Toast.LENGTH_SHORT).show();
}
public void updatePreferences() {
diff --git a/src/main/java/de/pixart/messenger/ui/text/FixedURLSpan.java b/src/main/java/de/pixart/messenger/ui/text/FixedURLSpan.java
index c22dcc4cf..0472cbc15 100644
--- a/src/main/java/de/pixart/messenger/ui/text/FixedURLSpan.java
+++ b/src/main/java/de/pixart/messenger/ui/text/FixedURLSpan.java
@@ -46,6 +46,7 @@ import java.util.Arrays;
import de.pixart.messenger.Config;
import de.pixart.messenger.R;
import de.pixart.messenger.ui.ConversationsActivity;
+import me.drakeet.support.toast.ToastCompat;
@SuppressLint("ParcelCreator")
public class FixedURLSpan extends URLSpan {
@@ -83,7 +84,7 @@ public class FixedURLSpan extends URLSpan {
context.startActivity(intent);
widget.playSoundEffect(0);
} catch (ActivityNotFoundException e) {
- Toast.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, Toast.LENGTH_SHORT).show();
}
}
} \ No newline at end of file
diff --git a/src/main/java/de/pixart/messenger/ui/util/ShareUtil.java b/src/main/java/de/pixart/messenger/ui/util/ShareUtil.java
index ffa352ede..e73109b02 100644
--- a/src/main/java/de/pixart/messenger/ui/util/ShareUtil.java
+++ b/src/main/java/de/pixart/messenger/ui/util/ShareUtil.java
@@ -43,6 +43,7 @@ import de.pixart.messenger.ui.ConversationsActivity;
import de.pixart.messenger.ui.XmppActivity;
import de.pixart.messenger.utils.Patterns;
import de.pixart.messenger.utils.XmppUri;
+import me.drakeet.support.toast.ToastCompat;
import rocks.xmpp.addr.Jid;
public class ShareUtil {
@@ -64,7 +65,7 @@ public class ShareUtil {
try {
shareIntent.putExtra(Intent.EXTRA_STREAM, FileBackend.getUriForFile(activity, file));
} catch (SecurityException e) {
- Toast.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()), Toast.LENGTH_SHORT).show();
return;
}
shareIntent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
@@ -79,13 +80,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
- Toast.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, Toast.LENGTH_SHORT).show();
}
}
public static void copyToClipboard(XmppActivity activity, Message message) {
if (activity.copyTextToClipboard(message.getMergedBody().toString(), R.string.message)) {
- Toast.makeText(activity, R.string.message_copied_to_clipboard, Toast.LENGTH_SHORT).show();
+ ToastCompat.makeText(activity, R.string.message_copied_to_clipboard, Toast.LENGTH_SHORT).show();
}
}
@@ -103,7 +104,7 @@ public class ShareUtil {
resId = R.string.file_url;
}
if (activity.copyTextToClipboard(url, resId)) {
- Toast.makeText(activity, R.string.url_copied_to_clipboard, Toast.LENGTH_SHORT).show();
+ ToastCompat.makeText(activity, R.string.url_copied_to_clipboard, Toast.LENGTH_SHORT).show();
}
}
@@ -114,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)) {
- Toast.makeText(activity, R.string.jabber_id_copied_to_clipboard, Toast.LENGTH_SHORT).show();
+ ToastCompat.makeText(activity, R.string.jabber_id_copied_to_clipboard, Toast.LENGTH_SHORT).show();
}
return;
} catch (Exception e) {
@@ -126,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)) {
- Toast.makeText(activity, R.string.url_copied_to_clipboard, Toast.LENGTH_SHORT).show();
+ ToastCompat.makeText(activity, R.string.url_copied_to_clipboard, Toast.LENGTH_SHORT).show();
}
}
}
diff --git a/src/main/java/de/pixart/messenger/ui/util/ViewUtil.java b/src/main/java/de/pixart/messenger/ui/util/ViewUtil.java
index 931477425..4a9251832 100644
--- a/src/main/java/de/pixart/messenger/ui/util/ViewUtil.java
+++ b/src/main/java/de/pixart/messenger/ui/util/ViewUtil.java
@@ -17,6 +17,7 @@ import de.pixart.messenger.R;
import de.pixart.messenger.entities.DownloadableFile;
import de.pixart.messenger.persistance.FileBackend;
import de.pixart.messenger.ui.MediaViewerActivity;
+import me.drakeet.support.toast.ToastCompat;
public class ViewUtil {
@@ -28,7 +29,7 @@ public class ViewUtil {
public static void view(Context context, DownloadableFile file) {
if (!file.exists()) {
- Toast.makeText(context, R.string.file_deleted, Toast.LENGTH_SHORT).show();
+ ToastCompat.makeText(context, R.string.file_deleted, Toast.LENGTH_SHORT).show();
return;
}
String mime = file.getMimeType();
@@ -44,7 +45,7 @@ public class ViewUtil {
uri = FileBackend.getUriForFile(context, file);
} catch (SecurityException e) {
Log.d(Config.LOGTAG, "No permission to access " + file.getAbsolutePath(), e);
- Toast.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()), Toast.LENGTH_SHORT).show();
return;
}
// use internal viewer for images and videos
@@ -78,7 +79,7 @@ public class ViewUtil {
try {
context.startActivity(openIntent);
} catch (ActivityNotFoundException e) {
- Toast.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, Toast.LENGTH_SHORT).show();
}
}
}
diff --git a/src/main/java/de/pixart/messenger/ui/widget/RichLinkView.java b/src/main/java/de/pixart/messenger/ui/widget/RichLinkView.java
index c0b97b784..85310d27f 100644
--- a/src/main/java/de/pixart/messenger/ui/widget/RichLinkView.java
+++ b/src/main/java/de/pixart/messenger/ui/widget/RichLinkView.java
@@ -21,6 +21,7 @@ import de.pixart.messenger.R;
import de.pixart.messenger.services.XmppConnectionService;
import de.pixart.messenger.utils.MetaData;
import de.pixart.messenger.utils.RichPreview;
+import me.drakeet.support.toast.ToastCompat;
/**
@@ -136,7 +137,7 @@ public class RichLinkView extends RelativeLayout {
try {
context.startActivity(intent);
} catch (ActivityNotFoundException e) {
- Toast.makeText(context, R.string.no_application_found_to_open_link, Toast.LENGTH_LONG).show();
+ ToastCompat.makeText(context, R.string.no_application_found_to_open_link, Toast.LENGTH_LONG).show();
}
}
diff --git a/src/main/java/de/pixart/messenger/utils/AccountUtils.java b/src/main/java/de/pixart/messenger/utils/AccountUtils.java
index 593d3a089..7b78ce761 100644
--- a/src/main/java/de/pixart/messenger/utils/AccountUtils.java
+++ b/src/main/java/de/pixart/messenger/utils/AccountUtils.java
@@ -11,6 +11,7 @@ import de.pixart.messenger.Config;
import de.pixart.messenger.R;
import de.pixart.messenger.entities.Account;
import de.pixart.messenger.services.XmppConnectionService;
+import me.drakeet.support.toast.ToastCompat;
public class AccountUtils {
@@ -68,7 +69,7 @@ public class AccountUtils {
if (MANAGE_ACCOUNT_ACTIVITY != null) {
activity.startActivity(new Intent(activity, MANAGE_ACCOUNT_ACTIVITY));
} else {
- Toast.makeText(activity, R.string.feature_not_implemented, Toast.LENGTH_SHORT).show();
+ ToastCompat.makeText(activity, R.string.feature_not_implemented, Toast.LENGTH_SHORT).show();
}
}