use ToastCompat everywhere

This commit is contained in:
Christian Schneppe 2021-04-10 21:26:01 +02:00
parent 6c299307bd
commit 29c37cd6be
41 changed files with 182 additions and 217 deletions

View file

@ -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<Jid> 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);

View file

@ -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();
}

View file

@ -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<String, Object, UpdateService.Wrapp
} else {
ToastMessage = context.getString(R.string.no_update_available);
}
ToastCompat.makeText(context, ToastMessage, Toast.LENGTH_LONG).show();
ToastCompat.makeText(context, ToastMessage, ToastCompat.LENGTH_LONG).show();
});
}

View file

@ -5,7 +5,6 @@ import android.os.Bundle;
import android.text.SpannableStringBuilder;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;
import java.util.Calendar;
@ -46,7 +45,7 @@ public class AboutActivity extends XmppActivity {
final Uri uri = Uri.parse(Config.privacyURL);
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();
}
});
Button termsOfUseButton = findViewById(R.id.show_terms_of_use);
@ -55,7 +54,7 @@ public class AboutActivity extends XmppActivity {
final Uri uri = Uri.parse(Config.termsOfUseURL);
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();
}
});
}

View file

@ -1,7 +1,6 @@
package eu.siacs.conversations.ui;
import android.view.View;
import android.widget.Toast;
import androidx.annotation.StringRes;
import androidx.appcompat.app.AlertDialog;
@ -13,7 +12,6 @@ import eu.siacs.conversations.entities.Blockable;
import eu.siacs.conversations.entities.Conversation;
import eu.siacs.conversations.ui.util.JidDialog;
import me.drakeet.support.toast.ToastCompat;
import eu.siacs.conversations.xmpp.Jid;
public final class BlockContactDialog {
public static void show(final XmppActivity xmppActivity, final Blockable blockable) {
@ -48,12 +46,12 @@ public final class BlockContactDialog {
} else {
boolean toastShown = false;
if (xmppActivity.xmppConnectionService.sendBlockRequest(blockable, binding.reportSpam.isChecked())) {
ToastCompat.makeText(xmppActivity, R.string.corresponding_conversations_closed, Toast.LENGTH_SHORT).show();
ToastCompat.makeText(xmppActivity, R.string.corresponding_conversations_closed, ToastCompat.LENGTH_SHORT).show();
toastShown = true;
}
if (xmppActivity instanceof ContactDetailsActivity) {
if (!toastShown) {
ToastCompat.makeText(xmppActivity, R.string.contact_blocked_past_tense, Toast.LENGTH_SHORT).show();
ToastCompat.makeText(xmppActivity, R.string.contact_blocked_past_tense, ToastCompat.LENGTH_SHORT).show();
}
xmppActivity.finish();
}

View file

@ -2,7 +2,6 @@ package eu.siacs.conversations.ui;
import android.os.Bundle;
import android.text.Editable;
import android.widget.Toast;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentTransaction;
@ -15,9 +14,9 @@ import eu.siacs.conversations.entities.Blockable;
import eu.siacs.conversations.entities.ListItem;
import eu.siacs.conversations.entities.RawBlockable;
import eu.siacs.conversations.ui.interfaces.OnBackendConnected;
import eu.siacs.conversations.xmpp.Jid;
import eu.siacs.conversations.xmpp.OnUpdateBlocklist;
import me.drakeet.support.toast.ToastCompat;
import eu.siacs.conversations.xmpp.Jid;
public class BlocklistActivity extends AbstractSearchableListItemActivity implements OnUpdateBlocklist {
private Account account = null;
@ -89,7 +88,7 @@ public class BlocklistActivity extends AbstractSearchableListItemActivity implem
dialog.setOnEnterJidDialogPositiveListener((accountJid, contactJid) -> {
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;
});

View file

@ -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();
}
});

View file

@ -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;
}
}

View file

@ -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();
});
}

View file

@ -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();
}
}

View file

@ -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<Message>() {
@ -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;

View file

@ -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) {

View file

@ -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();
});

View file

@ -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)) {

View file

@ -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());
}
}

View file

@ -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();
}
}

View file

@ -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

View file

@ -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();
}
}

View file

@ -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);
});

View file

@ -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) {

View file

@ -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 {

View file

@ -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());

View file

@ -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();
}
}
}

View file

@ -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() {

View file

@ -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();

View file

@ -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<Jid> 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<Conversation>() {
@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) {

View file

@ -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;
}
});

View file

@ -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 {

View file

@ -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);

View file

@ -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)) {

View file

@ -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<Account> 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);

View file

@ -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<MediaAdapter.MediaViewHol
this.activity.startActivity(Intent.createChooser(share, this.activity.getText(R.string.share_with)));
} catch (ActivityNotFoundException e) {
//This should happen only on faulty androids because normally chooser is always available
ToastCompat.makeText(this.activity, R.string.no_application_found_to_open_file, Toast.LENGTH_SHORT).show();
ToastCompat.makeText(this.activity, R.string.no_application_found_to_open_file, ToastCompat.LENGTH_SHORT).show();
}
}
@ -238,7 +236,7 @@ public class MediaAdapter extends RecyclerView.Adapter<MediaAdapter.MediaViewHol
uri = FileBackend.getUriForFile(this.activity, file);
} catch (SecurityException e) {
Log.d(Config.LOGTAG, "No permission to access " + file.getAbsolutePath(), e);
ToastCompat.makeText(this.activity, this.activity.getString(R.string.no_permission_to_access_x, file.getAbsolutePath()), Toast.LENGTH_SHORT).show();
ToastCompat.makeText(this.activity, this.activity.getString(R.string.no_permission_to_access_x, file.getAbsolutePath()), ToastCompat.LENGTH_SHORT).show();
return;
}
String mime = MimeUtils.guessMimeTypeFromUri(this.activity, uri);
@ -253,7 +251,7 @@ public class MediaAdapter extends RecyclerView.Adapter<MediaAdapter.MediaViewHol
try {
this.activity.startActivity(openIntent);
} catch (ActivityNotFoundException e) {
ToastCompat.makeText(this.activity, R.string.no_application_found_to_open_file, Toast.LENGTH_SHORT).show();
ToastCompat.makeText(this.activity, R.string.no_application_found_to_open_file, ToastCompat.LENGTH_SHORT).show();
}
}

View file

@ -33,7 +33,6 @@ import android.widget.LinearLayout;
import android.widget.ProgressBar;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;
import androidx.core.app.ActivityCompat;
import androidx.core.content.ContextCompat;
@ -476,7 +475,7 @@ public class MessageAdapter extends ArrayAdapter<Message> {
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<Message> {
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<Message> {
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<Message> {
}
}
} 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();
}
}

View file

@ -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();
}
}
}

View file

@ -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;
}

View file

@ -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();
}
}
}

View file

@ -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);
}
}

View file

@ -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();
}
}
}

View file

@ -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();
}
}

View file

@ -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();
}
}

View file

@ -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<Jid> 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);