use of android.widget.Toast in project generic-oauth2-login-for-android by wareninja.
the class NotifierHelper method displayToast.
public static void displayToast(Context caller, String toastMsg, int toastType) {
try {
// try-catch to avoid stupid app crashes
LayoutInflater inflater = LayoutInflater.from(caller);
View mainLayout = inflater.inflate(R.layout.toast_layout, null);
View rootLayout = mainLayout.findViewById(R.id.toast_layout_root);
ImageView image = (ImageView) mainLayout.findViewById(R.id.image);
image.setImageResource(R.drawable.img_icon_notification);
TextView text = (TextView) mainLayout.findViewById(R.id.text);
text.setText(toastMsg);
Toast toast = new Toast(caller);
//toast.setGravity(Gravity.CENTER_VERTICAL, 0, 0);
toast.setGravity(Gravity.BOTTOM, 0, 0);
if (//(isShort)
toastType == SHORT_TOAST)
toast.setDuration(Toast.LENGTH_SHORT);
else
toast.setDuration(Toast.LENGTH_LONG);
toast.setView(rootLayout);
toast.show();
} catch (Exception ex) {
// to avoid stupid app crashes
Log.w(TAG, ex.toString());
}
}
use of android.widget.Toast in project Small by wequick.
the class UIUtils method showToast.
public static void showToast(Context context, String tips) {
Toast toast = Toast.makeText(context, "lib.utils: " + tips, Toast.LENGTH_SHORT);
toast.show();
}
use of android.widget.Toast in project glitch-hq-android by tinyspeck.
the class Util method shortToast.
public static void shortToast(Activity context, String msg) {
Toast sentNotification = Toast.makeText(context, msg, Toast.LENGTH_SHORT);
sentNotification.setGravity(Gravity.CENTER, 0, 0);
sentNotification.show();
}
use of android.widget.Toast in project Conversations by siacs.
the class ConversationActivity method attachImageToConversation.
private void attachImageToConversation(Conversation conversation, Uri uri) {
if (conversation == null) {
return;
}
final Toast prepareFileToast = Toast.makeText(getApplicationContext(), getText(R.string.preparing_image), Toast.LENGTH_LONG);
prepareFileToast.show();
xmppConnectionService.attachImageToConversation(conversation, uri, new UiCallback<Message>() {
@Override
public void userInputRequried(PendingIntent pi, Message object) {
hidePrepareFileToast(prepareFileToast);
}
@Override
public void success(Message message) {
hidePrepareFileToast(prepareFileToast);
xmppConnectionService.sendMessage(message);
}
@Override
public void error(final int error, Message message) {
hidePrepareFileToast(prepareFileToast);
runOnUiThread(new Runnable() {
@Override
public void run() {
replaceToast(getString(error));
}
});
}
});
}
use of android.widget.Toast in project platform_frameworks_base by android.
the class NekoActivationActivity method toastUp.
private void toastUp(String s) {
Toast toast = Toast.makeText(this, s, Toast.LENGTH_SHORT);
toast.getView().setBackgroundDrawable(null);
toast.show();
}
Aggregations